text:
/* $NetBSD: term_private.h,v 1.19 2020/06/21 15:05:23 roy Exp $ */

/*
 * Copyright (c) 2009, 2010, 2013, 2020 The NetBSD Foundation, Inc.
 *
 * This code is derived from software contributed to The NetBSD Foundation
 * by Roy Marples.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef _TERM_PRIVATE_H_
#define _TERM_PRIVATE_H_

/* This header should only be used by libterminfo, tic and infocmp. */

/* The terminfo database structure is private to us,
 * so it's documented here.
 *
 * Version 1 - types 1 and 2.
 * terminfo defines the largest number as 32767 and the largest
 * compiled entry as 4093 bytes long. Negative numbers are not allowed.
 * Thus, we store all numbers as uint16_t, including string length.
 * We reserve negative numbers -1 and -2 to mean absent or cancelled.
 * All strings are prefixed by length, including the null terminator.
 * The largest string length we can handle is 65535 bytes,
 * including the null terminator.
 * The largest capability block we can handle is 65535 bytes.
 *
 * Version 2 - type 3
 * Extends terminfo numbers upto 2147483647 by storing the value as a uint32_t.
 * This means that we exceed the current terminfo defined limits in every way.
 *
 * Type 1 capabilities are defined as:
 * header byte (always 1)
 * name
 * description,
 * cap length, num flags, index, char,
 * cap length, num numbers, index, number,
 * cap length, num strings, index, string,
 * cap length, num undefined caps, name, type (char), flag, number, string
 *
 * Type 2 entries are aliases and defined as:
 * header byte (always 2)
 * 32bit id of the corresponding terminal in the file
 * name
 *
 * Type 3 extends Type 1 so that it can store terminfo numbers
 * as uint32_t. All other numerics are still stored as uint16_t.
 *
 * The database itself is created using cdbw(3) and the numbers are
 * always stored as little endian.
 */

#include <sys/types.h>
#include <assert.h>
#include <limits.h>
#include <string.h>

#define _TERMINFO
#define TERMINFO_RTYPE_O1 1
#define TERMINFO_ALIAS 2
#define TERMINFO_RTYPE 3

/* , and | are the two print characters now allowed
 * in terminfo aliases or long descriptions.
 * As | is generally used to delimit aliases inside the
 * description, we use a comma. */
#define TERMINFO_VDELIM ','
#define TERMINFO_VDELIMSTR ","

/* We use the same ncurses tic macros so that our data is identical
 * when a caller uses the long name macros to access te terminfo data
 * directly. */
#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */
#define ABSENT_NUMERIC (-1)
#define ABSENT_STRING (char *)0
#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */
#define CANCELLED_NUMERIC (-2)
#define CANCELLED_STRING (char *)(-1)
#define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */
#define VALID_NUMERIC(s) ((s) >= 0)
#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING)

typedef struct {
  const char *id;
  char type;
  char flag;
  int num;
  const char *str;
} TERMUSERDEF;

typedef struct {
  int fildes;
  /* We need to expose these so that the macros work */
  const char *name;
  const char *desc;
  signed char *flags;
  int *nums;
  const char **strs;
  /* Storage area for terminfo data */
  char *_area;
  size_t _arealen;
  size_t _nuserdefs;
  TERMUSERDEF *_userdefs;
  /* So we don't rely on the global ospeed */
  short _ospeed;
  /* Output buffer for tparm */
  char *_buf;
  size_t _buflen;
  size_t _bufpos;
  /* A-Z static variables for tparm  */
  long _snums[26];
  /* aliases of the terminal, | separated */
  const char *_alias;
} TERMINAL;

extern const char *_ti_database;

ssize_t _ti_flagindex(const char *);
ssize_t _ti_numindex(const char *);
ssize_t _ti_strindex(const char *);
const char *_ti_flagid(ssize_t);
const char *_ti_numid(ssize_t);
const char *_ti_strid(ssize_t);
int _ti_getterm(TERMINAL *, const char *, int);
void _ti_setospeed(TERMINAL *);

/* libterminfo can compile terminfo strings too */
#define TIC_WARNING (1 << 0)
#define TIC_DESCRIPTION (1 << 1)
#define TIC_ALIAS (1 << 2)
#define TIC_COMMENT (1 << 3)
#define TIC_EXTRA (1 << 4)
#define TIC_COMPAT_V1 (1 << 5)

typedef struct {
  char *buf;
  size_t buflen;
  size_t bufpos;
  size_t entries;
} TBUF;

typedef struct {
  char *name;
  char *alias;
  char *desc;
  int rtype;
  TBUF flags;
  TBUF nums;
  TBUF strs;
  TBUF extras;
} TIC;

#define _ti_numsize(tic)                                                       \
  ((tic)->rtype == TERMINFO_RTYPE_O1 ? sizeof(uint16_t) : sizeof(uint32_t))

int _ti_promote(TIC *);
char *_ti_grow_tbuf(TBUF *, size_t);
char *_ti_get_token(char **, char);
const char *_ti_find_cap(TIC *, TBUF *, char, short);
const char *_ti_find_extra(TIC *, TBUF *, const char *);
char *_ti_getname(int, const char *);
size_t _ti_store_extra(TIC *, int, const char *, char, char, int, const char *,
                       size_t, int);
TIC *_ti_compile(char *, int);
ssize_t _ti_flatten(uint8_t **, const TIC *);
void _ti_freetic(TIC *);

int _ti_encode_buf_id_num(TBUF *, int, int, size_t);
int _ti_encode_buf_id_count_str(TBUF *, int, const void *, size_t);
int _ti_encode_buf_id_flags(TBUF *, int, int);

#define TPARM_MAX 9 /* not likely to change */
int _ti_parm_analyse(const char *, int *, int);

static __inline int _ti_decode_16(const char **cap) {
  int num = (int16_t)le16dec(*cap);

  *cap += sizeof(uint16_t);
  return num;
}

static __inline int _ti_decode_32(const char **cap) {
  int num = (int32_t)le32dec(*cap);

  *cap += sizeof(uint32_t);
  return num;
}

static __inline int _ti_decode_num(const char **cap, int rtype) {
  if (rtype == TERMINFO_RTYPE_O1) {
    return _ti_decode_16(cap);
  } else {
    return _ti_decode_32(cap);
  }
}

static __inline void _ti_encode_16(char **cap, size_t num) {
  _DIAGASSERT(num <= UINT16_MAX);
  le16enc(*cap, (uint16_t)num);
  *cap += sizeof(uint16_t);
}

static __inline void _ti_encode_32(char **cap, size_t num) {
  _DIAGASSERT(num <= UINT32_MAX);
  le32enc(*cap, (uint32_t)num);
  *cap += sizeof(uint32_t);
}

static __inline void _ti_encode_str(char **cap, const void *buf, size_t len) {
  memcpy(*cap, buf, len);
  *cap += len;
}

static __inline void _ti_encode_count_str(char **cap, const char *name,
                                          size_t len) {
  _ti_encode_16(cap, (uint16_t)len);
  if (name == NULL)
    return;
  _ti_encode_str(cap, name, len);
}

static __inline void _ti_encode_buf_16(TBUF *tbuf, size_t num) {
  _DIAGASSERT(num <= UINT16_MAX);
  le16enc(tbuf->buf + tbuf->bufpos, (uint16_t)num);
  tbuf->bufpos += sizeof(uint16_t);
}

static __inline void _ti_encode_buf_32(TBUF *tbuf, size_t num) {
  _DIAGASSERT(num <= UINT32_MAX);
  le32enc(tbuf->buf + tbuf->bufpos, (uint32_t)num);
  tbuf->bufpos += sizeof(uint32_t);
}

static __inline void _ti_encode_buf_count_str(TBUF *tbuf, const void *buf,
                                              size_t len) {
  _ti_encode_buf_16(tbuf, len);
  memcpy(tbuf->buf + tbuf->bufpos, buf, len);
  tbuf->bufpos += len;
}

static __inline void _ti_encode_buf_num(TBUF *tbuf, int num, int rtype) {
  if (rtype == TERMINFO_RTYPE_O1) {
    if (num > INT16_MAX)
      num = INT16_MAX;
    _ti_encode_buf_16(tbuf, (uint16_t)num);
  } else {
    if (num > INT32_MAX)
      num = INT32_MAX;
    _ti_encode_buf_32(tbuf, (uint32_t)num);
  }
}

#endif


text:
package vos;

import org.codehaus.jackson.annotate.*;

public class Actor {

	//// Atributos

	@JsonProperty(value="CEDULA")
	private int cedula;

	@JsonProperty(value="NOMBRE")
	private String nombre;

	@JsonProperty(value="ID_COMPAÑIA")
	private int idcompañia;

	@JsonProperty(value="NACIONALIDAD")
	private String nacionalidad;

	public Actor(@JsonProperty(value="CEDULA")int cedula,@JsonProperty(value="ID_COMPAÑIA")int idcompañia, @JsonProperty(value="NOMBRE")String nombre,@JsonProperty(value="NACIONALIDAD") String nacionalidad)
	{
		super();
		this.cedula = cedula;
		this.nombre = nombre;
		this.idcompañia = idcompañia;
		this.nacionalidad = nacionalidad;
	}

	public int getCedula() {
		return cedula;
	}

	public void setCedula(int duration) {
		this.cedula = duration;
	}

	public String getNombre() {
		return nombre;
	}

	public void setNombre(String id) {
		this.nombre = id;
	}

	public int getIdCompania() {
		return idcompañia;
	}

	public void setName(int name) {
		this.idcompañia = name;
	}

	public String getNacionalidad() {
		return nacionalidad;
	}

	public void setNacionalidad(String name) {
		this.nacionalidad = name;
	}

}

redpajama_set_name: RedPajamaGithub


text:
trap "wait" TERM EXIT

# Big Buck Bunny - 200ms RTT, 200pkts buffer
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_classic_keepalive.png tests/constant_two_con_bbb8_200ms_200p/*_classic-13_keepalive &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_classic_keepalive_est.png tests/constant_two_con_bbb8_200ms_200p/*_classic-13_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_bba0_keepalive.png tests/constant_two_con_bbb8_200ms_200p/*_bba0_keepalive &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_bba1_keepalive_est.png tests/constant_two_con_bbb8_200ms_200p/*_bba1_keepalive_est &
wait
# Big Buck Bunny - 100ms RTT, 200pkts buffer
nice python plot_vlc_scatters.py two_con_scatters_bbb_100ms_classic_keepalive.png tests/constant_two_con_bbb8_100ms_200p/*_classic-13_keepalive &
nice python plot_vlc_scatters.py two_con_scatters_bbb_100ms_classic_keepalive_est.png tests/constant_two_con_bbb8_100ms_200p/*_classic-13_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_100ms_bba0_keepalive_est.png tests/constant_two_con_bbb8_100ms_200p/*_bba0_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_100ms_bba1_keepalive_est.png tests/constant_two_con_bbb8_100ms_200p/*_bba1_keepalive_est &
wait
# Big Buck Bunny - 400ms RTT, 200pkts buffer
nice python plot_vlc_scatters.py two_con_scatters_bbb_400ms_classic_keepalive.png tests/constant_two_con_bbb8_400ms_200p/*_classic-13_keepalive &
nice python plot_vlc_scatters.py two_con_scatters_bbb_400ms_classic_keepalive_est.png tests/constant_two_con_bbb8_400ms_200p/*_classic-13_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_400ms_bba0_keepalive_est.png tests/constant_two_con_bbb8_400ms_200p/*_bba0_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_400ms_bba1_keepalive_est.png tests/constant_two_con_bbb8_400ms_200p/*_bba1_keepalive_est &
wait

# Big Buck Bunny - 200ms RTT, 100%BDP buffer
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_100_classic_keepalive.png tests/constant_two_con_bbb8_200ms_100%p/*_classic-13_keepalive &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_100_classic_keepalive_est.png tests/constant_two_con_bbb8_200ms_100%p/*_classic-13_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_100_bba0_keepalive_est.png tests/constant_two_con_bbb8_200ms_100%p/*_bba0_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_100_bba1_keepalive_est.png tests/constant_two_con_bbb8_200ms_100%p/*_bba1_keepalive_est &
wait
# Big Buck Bunny - 200ms RTT, 50%BDP buffer
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_50_classic_keepalive.png tests/constant_two_con_bbb8_200ms_50%p/*_classic-13_keepalive &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_50_classic_keepalive_est.png tests/constant_two_con_bbb8_200ms_50%p/*_classic-13_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_50_bba0_keepalive_est.png tests/constant_two_con_bbb8_200ms_50%p/*_bba0_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_50_bba1_keepalive_est.png tests/constant_two_con_bbb8_200ms_50%p/*_bba1_keepalive_est &
wait
# Big Buck Bunny - 200ms RTT, 25%BDP buffer
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_25_classic_keepalive.png tests/constant_two_con_bbb8_200ms_25%p/*_classic-13_keepalive &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_25_classic_keepalive_est.png tests/constant_two_con_bbb8_200ms_25%p/*_classic-13_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_25_bba0_keepalive_est.png tests/constant_two_con_bbb8_200ms_25%p/*_bba0_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_25_bba1_keepalive_est.png tests/constant_two_con_bbb8_200ms_25%p/*_bba1_keepalive_est &
wait
# Big Buck Bunny - 200ms RTT, 10%BDP buffer
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_10_classic_keepalive.png tests/constant_two_con_bbb8_200ms_10%p/*_classic-13_keepalive &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_10_classic_keepalive_est.png tests/constant_two_con_bbb8_200ms_10%p/*_classic-13_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_10_bba0_keepalive_est.png tests/constant_two_con_bbb8_200ms_10%p/*_bba0_keepalive_est &
nice python plot_vlc_scatters.py two_con_scatters_bbb_200ms_10_bba1_keepalive_est.png tests/constant_two_con_bbb8_200ms_10%p/*_bba1_keepalive_est &
wait

# BipBop
nice python plot_vlc_scatters.py two_con_scatters_bipbop_200ms_classic_keepalive.png tests/constant_two_con_bipbop_200ms_200p/*_classic-2_keepalive &
nice python plot_vlc_scatters.py two_con_scatters_bipbop_200ms_classic_keepalive_est.png tests/constant_two_con_bipbop_200ms_200p/*_classic-2_keepalive_est &
wait
nice python plot_vlc_scatters.py two_con_scatters_bipbop_200ms_bba0_keepalive.png tests/constant_two_con_bipbop_200ms_200p/*_bba0_keepalive &
nice python plot_vlc_scatters.py two_con_scatters_bipbop_200ms_bba1_keepalive.png tests/constant_two_con_bipbop_200ms_200p/*_bba1_keepalive_est &
wait


text:
<?php
require_once '../secure/db-connection.php';

$data = array();
$data['success'] = false;

if (isset($_POST['csrf-token']) && $_POST['csrf-token'] === $_SESSION['csrf-token'] && isset($_SESSION['id'])) {
	$enroll = $db->prepare("INSERT INTO work_list (work_id, performer_id, performer_accepted) VALUES (:work_id, :performer_id, 1)");
	$enroll->bindParam(':work_id', $_POST['work-id'], PDO::PARAM_STR);
	$enroll->bindParam(':performer_id', $_SESSION['id'], PDO::PARAM_STR);
	if ($enroll->execute()) {
		$work = $db->prepare("UPDATE works SET phase=2 WHERE id = :work_id");
		$work->bindParam(':work_id', $_POST['work-id'], PDO::PARAM_STR);
		if ($work->execute()) {
			$data['success'] = true;
		}
		else {
			$data['error'] = 2;
		}
	}
	else {
		$data['error'] = 1;
	}
}
else {
	$data['error'] = 0;
}
echo json_encode($data);
$db=null;
?>


text:
#include "src/core/lib/iomgr/port.h"

#ifdef GRPC_UV

#include <uv.h>

#include <string.h>

#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/sync.h>

#include "src/core/lib/iomgr/iomgr_uv.h"
#include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/iomgr/pollset_uv.h"

#include "src/core/lib/debug/trace.h"

grpc_core::DebugOnlyTraceFlag grpc_trace_fd_refcount(false, "fd_refcount");

struct grpc_pollset {
  uv_timer_t* timer;
  int shutting_down;
};

/* Indicates that grpc_pollset_work should run an iteration of the UV loop
   before running callbacks. This defaults to 1, and should be disabled if
   grpc_pollset_work will be called within the callstack of uv_run */
int grpc_pollset_work_run_loop;

gpr_mu grpc_polling_mu;

/* This is used solely to kick the uv loop, by setting a callback to be run
   immediately in the next loop iteration.
   Note: In the future, if there is a bug that involves missing wakeups in the
   future, try adding a uv_async_t to kick the loop differently */
uv_timer_t* dummy_uv_handle;

size_t grpc_pollset_size() { return sizeof(grpc_pollset); }

void dummy_timer_cb(uv_timer_t* handle) {}

void dummy_handle_close_cb(uv_handle_t* handle) { gpr_free(handle); }

void grpc_pollset_global_init(void) {
  gpr_mu_init(&grpc_polling_mu);
  dummy_uv_handle = (uv_timer_t*)gpr_malloc(sizeof(uv_timer_t));
  uv_timer_init(uv_default_loop(), dummy_uv_handle);
  grpc_pollset_work_run_loop = 1;
}

void grpc_pollset_global_shutdown(void) {
  GRPC_UV_ASSERT_SAME_THREAD();
  gpr_mu_destroy(&grpc_polling_mu);
  uv_close((uv_handle_t*)dummy_uv_handle, dummy_handle_close_cb);
}

static void timer_run_cb(uv_timer_t* timer) {}

static void timer_close_cb(uv_handle_t* handle) {
  handle->data = (void*)1;
  gpr_free(handle);
}

void grpc_pollset_init(grpc_pollset* pollset, gpr_mu** mu) {
  GRPC_UV_ASSERT_SAME_THREAD();
  *mu = &grpc_polling_mu;
  pollset->timer = (uv_timer_t*)gpr_malloc(sizeof(uv_timer_t));
  uv_timer_init(uv_default_loop(), pollset->timer);
  pollset->shutting_down = 0;
}

void grpc_pollset_shutdown(grpc_pollset* pollset, grpc_closure* closure) {
  GPR_ASSERT(!pollset->shutting_down);
  GRPC_UV_ASSERT_SAME_THREAD();
  pollset->shutting_down = 1;
  if (grpc_pollset_work_run_loop) {
    // Drain any pending UV callbacks without blocking
    uv_run(uv_default_loop(), UV_RUN_NOWAIT);
  } else {
    // kick the loop once
    uv_timer_start(dummy_uv_handle, dummy_timer_cb, 0, 0);
  }
  GRPC_CLOSURE_SCHED(closure, GRPC_ERROR_NONE);
}

void grpc_pollset_destroy(grpc_pollset* pollset) {
  GRPC_UV_ASSERT_SAME_THREAD();
  uv_close((uv_handle_t*)pollset->timer, timer_close_cb);
  // timer.data is a boolean indicating that the timer has finished closing
  pollset->timer->data = (void*)0;
  if (grpc_pollset_work_run_loop) {
    while (!pollset->timer->data) {
      uv_run(uv_default_loop(), UV_RUN_NOWAIT);
    }
  }
}

grpc_error* grpc_pollset_work(grpc_pollset* pollset,
                              grpc_pollset_worker** worker_hdl,
                              grpc_millis deadline) {
  uint64_t timeout;
  GRPC_UV_ASSERT_SAME_THREAD();
  gpr_mu_unlock(&grpc_polling_mu);
  if (grpc_pollset_work_run_loop) {
    grpc_millis now = grpc_core::ExecCtx::Get()->Now();
    if (deadline >= now) {
      timeout = deadline - now;
    } else {
      timeout = 0;
    }
    /* We special-case timeout=0 so that we don't bother with the timer when
       the loop won't block anyway */
    if (timeout > 0) {
      uv_timer_start(pollset->timer, timer_run_cb, timeout, 0);
      /* Run until there is some I/O activity or the timer triggers. It doesn't
         matter which happens */
      uv_run(uv_default_loop(), UV_RUN_ONCE);
      uv_timer_stop(pollset->timer);
    } else {
      uv_run(uv_default_loop(), UV_RUN_NOWAIT);
    }
  }
  if (!grpc_closure_list_empty(*grpc_core::ExecCtx::Get()->closure_list())) {
    grpc_core::ExecCtx::Get()->Flush();
  }
  gpr_mu_lock(&grpc_polling_mu);
  return GRPC_ERROR_NONE;
}

grpc_error* grpc_pollset_kick(grpc_pollset* pollset,
                              grpc_pollset_worker* specific_worker) {
  GRPC_UV_ASSERT_SAME_THREAD();
  uv_timer_start(dummy_uv_handle, dummy_timer_cb, 0, 0);
  return GRPC_ERROR_NONE;
}

#endif /* GRPC_UV */


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Bulletin Labor. Orto Bot. de R. Univ. Siena 2: 161 (1899)

#### Original name
Trichosporum echeveriae Tassi

### Remarks
null


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pdftocbz.converter.pdfToImages;

import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
import javax.imageio.IIOException;
import javax.imageio.IIOImage;
import javax.imageio.ImageIO;
import javax.imageio.ImageTypeSpecifier;
import javax.imageio.ImageWriteParam;
import javax.imageio.ImageWriter;
import javax.imageio.metadata.IIOInvalidTreeException;
import javax.imageio.metadata.IIOMetadata;
import javax.imageio.metadata.IIOMetadataNode;
import javax.imageio.stream.ImageOutputStream;
import org.apache.pdfbox.util.ImageIOUtil;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;

/**
 *
 * @author Tseho
 */
public class CustomImageIOUtil {

    private static final int DEFAULT_SCREEN_RESOLUTION = 72;

    /**
     * Writes a buffered image to a file using the given image format.
     *
     * @param image the image to be written
     * @param imageFormat the target format (ex. "png")
     * @param filename used to construct the filename for the individual images
     * @param imageType the image type (see {@link BufferedImage}.TYPE_*)
     * @param resolution the resolution in dpi (dots per inch)
     * @return true if the images were produced, false if there was an error
     * @throws IOException if an I/O error occurs
     */
    public static boolean writeImage(BufferedImage image, String imageFormat, String filename,
            int imageType, int resolution)
            throws IOException {
        String fileName = filename + "." + imageFormat;
        File file = new File(fileName);
        return writeImage(image, imageFormat, file, resolution);
    }

    /**
     * Writes a buffered image to a file using the given image format.
     *
     * @param image the image to be written
     * @param imageFormat the target format (ex. "png")
     * @param outputStream the output stream to be used for writing
     * @return true if the images were produced, false if there was an error
     * @throws IOException if an I/O error occurs
     */
    public static boolean writeImage(BufferedImage image, String imageFormat, OutputStream outputStream)
            throws IOException {
        return writeImage(image, imageFormat, outputStream, DEFAULT_SCREEN_RESOLUTION);
    }

    private static boolean writeImage(BufferedImage image, String imageFormat, Object outputStream, int resolution)
            throws IOException {
        ImageOutputStream outputFileStream = (ImageOutputStream) outputStream;
        //System.out.println(outputFile.getAbsolutePath());
        try {
            ImageIO.write(image, "jpg", outputFileStream);
            outputFileStream.flush();
            outputFileStream.close();
        } catch (IOException e) {
            System.out.println(e.toString());
        }
        /*
        boolean bSuccess = true;
        ImageOutputStream output = null;
        ImageWriter imageWriter = null;
        try
        {
            output = ImageIO.createImageOutputStream( outputStream );

            boolean foundWriter = false;
            Iterator<ImageWriter> writerIter = ImageIO.getImageWritersByFormatName( imageFormat );
            while( writerIter.hasNext() && !foundWriter )
            {
                try
                {
                    imageWriter = (ImageWriter)writerIter.next();
                    ImageWriteParam writerParams = imageWriter.getDefaultWriteParam();
                    if( writerParams.canWriteCompressed() )
                    {
                        writerParams.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
                        // reset the compression type if overwritten by setCompressionMode
                        if (writerParams.getCompressionType() == null)
                        {
                            writerParams.setCompressionType(writerParams.getCompressionTypes()[0]);
                        }
                        writerParams.setCompressionQuality(1.0f);
                    }
                    IIOMetadata meta = createMetadata( image, imageWriter, writerParams, resolution);
                    imageWriter.setOutput( output );
                    IIOImage iioImage = new IIOImage( image, null, meta );
                    imageWriter.write( null, iioImage , writerParams );
                    foundWriter = true;
                    iioImage = null;
                }
                catch( IIOException io )
                {
                    throw new IOException( io.getMessage() );
                }
                finally
                {

                    if( imageWriter != null )
                    {
                        imageWriter.reset();
                        imageWriter.dispose();

                    }
                }
            }
            if( !foundWriter )
            {
                bSuccess = false;
            }
        }
        finally
        {
            if( output != null )
            {
                output.flush();
                output.close();
            }
        }
        return bSuccess;
        */
        return true;
    }

    private static IIOMetadata createMetadata(RenderedImage image, ImageWriter imageWriter,
            ImageWriteParam writerParams, int resolution) {
        ImageTypeSpecifier type;
        if (writerParams.getDestinationType() != null) {
            type = writerParams.getDestinationType();
        } else {
            type = ImageTypeSpecifier.createFromRenderedImage(image);
        }
        IIOMetadata meta = imageWriter.getDefaultImageMetadata(type, writerParams);
        return (addResolution(meta, resolution) ? meta : null);
    }
    private static final String STANDARD_METADATA_FORMAT = "javax_imageio_1.0";

    private static boolean addResolution(IIOMetadata meta, int resolution) {
        if (!meta.isReadOnly() && meta.isStandardMetadataFormatSupported()) {
            IIOMetadataNode root = (IIOMetadataNode) meta.getAsTree(STANDARD_METADATA_FORMAT);
            IIOMetadataNode dim = getChildNode(root, "Dimension");
            if (dim == null) {
                dim = new IIOMetadataNode("Dimension");
                root.appendChild(dim);
            }
            IIOMetadataNode child;
            child = getChildNode(dim, "HorizontalPixelSize");
            if (child == null) {
                child = new IIOMetadataNode("HorizontalPixelSize");
                dim.appendChild(child);
            }
            child.setAttribute("value",
                    Double.toString(resolution / 25.4));
            child = getChildNode(dim, "VerticalPixelSize");
            if (child == null) {
                child = new IIOMetadataNode("VerticalPixelSize");
                dim.appendChild(child);
            }
            child.setAttribute("value",
                    Double.toString(resolution / 25.4));
            try {
                meta.mergeTree(STANDARD_METADATA_FORMAT, root);
            } catch (IIOInvalidTreeException e) {
                throw new RuntimeException("Cannot update image metadata: "
                        + e.getMessage());
            }
            return true;
        }
        return false;
    }

    private static IIOMetadataNode getChildNode(Node n, String name) {
        NodeList nodes = n.getChildNodes();
        for (int i = 0; i < nodes.getLength(); i++) {
            Node child = nodes.item(i);
            if (name.equals(child.getNodeName())) {
                return (IIOMetadataNode) child;
            }
        }
        return null;
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

      <link rel="stylesheet" href="css/full_list.css" type="text/css" media="screen" charset="utf-8" />

      <link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />

    <base id="base_target" target="_parent" />

Method List

          Classes

          Methods

          Files

Search: <input type="text" />

    #%

      String

    #algorithm

      HMAC::Signer

    #auth_info

      Warden::Strategies::HMAC::Query

    #authenticate!

      Warden::Strategies::HMAC::Base

    #call

      Request::Hmac

    #canonical_representation

      HMAC::Signer

    #debug

      Warden::Strategies::HMAC::Base

    #default_opts

      HMAC::Signer

    #generate_signature

      HMAC::Signer

    #given_signature

      Warden::Strategies::HMAC::Header

    #headers

      Warden::Strategies::HMAC::Base

    #initialize

      Request::Hmac

    #initialize

      HMAC::Signer

    #logger

      Warden::Strategies::HMAC::Base

    #nonce

      Warden::Strategies::HMAC::Header

    #nonce

      Warden::Strategies::HMAC::Query

    #old_format

      String

    #params

      Warden::Strategies::HMAC::Base

    #parsed_auth_header

      Warden::Strategies::HMAC::Header

    #request_method

      Warden::Strategies::HMAC::Base

    #request_timestamp

      Warden::Strategies::HMAC::Query

    #request_timestamp

      Warden::Strategies::HMAC::Header

    #retrieve_user

      Warden::Strategies::HMAC::Base

    #secret

      HMAC::Signer

    #sign

      Request::Hmac

    #sign_request

      HMAC::Signer

    #sign_url

      HMAC::Signer

    #signature_valid?

      Warden::Strategies::HMAC::Query

    #signature_valid?

      Warden::Strategies::HMAC::Header

    #valid?

      Warden::Strategies::HMAC::Query

    #valid?

      Warden::Strategies::HMAC::Header

    #validate_signature

      HMAC::Signer

    #validate_url_signature

      HMAC::Signer


text:
#ifndef _WX_UNIX_UTILSX11_H_
#define _WX_UNIX_UTILSX11_H_

#include "wx/defs.h"
#include "wx/gdicmn.h"

#include <X11/Xlib.h>

// NB: Content of this header is for wxWidgets' private use! It is not
//     part of public API and may be modified or even disappear in the future!

#if defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXX11__)

#if defined(__WXGTK__)
typedef void WXDisplay;
typedef void* WXWindow;
#endif
typedef unsigned long WXKeySym;

int wxCharCodeXToWX(WXKeySym keySym);
WXKeySym wxCharCodeWXToX(int id);

class wxIconBundle;

void wxSetIconsX11( WXDisplay* display, WXWindow window,
                    const wxIconBundle& ib );

enum wxX11FullScreenMethod
{
    wxX11_FS_AUTODETECT = 0,
    wxX11_FS_WMSPEC,
    wxX11_FS_KDE,
    wxX11_FS_GENERIC
};

wxX11FullScreenMethod wxGetFullScreenMethodX11(WXDisplay* display,
                                               WXWindow rootWindow);

void wxSetFullScreenStateX11(WXDisplay* display, WXWindow rootWindow,
                             WXWindow window, bool show, wxRect *origSize,
                             wxX11FullScreenMethod method);

// Class wrapping X11 Display: it opens it in ctor and closes it in dtor.
class wxX11Display
{
public:
    wxX11Display() { m_dpy = XOpenDisplay(NULL); }
    ~wxX11Display() { if ( m_dpy ) XCloseDisplay(m_dpy); }

    operator Display *() const { return m_dpy; }

    // Using DefaultRootWindow() with an object of wxX11Display class doesn't
    // compile because it is a macro which tries to cast wxX11Display so
    // provide a convenient helper.
    Window DefaultRoot() const { return DefaultRootWindow(m_dpy); }

private:
    Display *m_dpy;

    wxDECLARE_NO_COPY_CLASS(wxX11Display);
};

#endif // __WXMOTIF__, __WXGTK__, __WXX11__

#endif // _WX_UNIX_UTILSX11_H_


text:
package com.netflix.exhibitor.core.config.consul;

import com.google.common.net.HostAndPort;
import com.netflix.exhibitor.core.config.LoadedInstanceConfig;
import com.netflix.exhibitor.core.config.PropertyBasedInstanceConfig;
import com.netflix.exhibitor.core.config.StringConfigs;
import com.orbitz.consul.Consul;
import com.orbitz.consul.model.session.SessionInfo;
import com.pszymczyk.consul.ConsulProcess;
import com.pszymczyk.consul.ConsulStarterBuilder;
import org.apache.curator.test.Timing;
import org.apache.curator.utils.CloseableUtils;
import org.testng.Assert;
import org.testng.annotations.*;

import java.util.List;
import java.util.Properties;

public class TestConsulConfigProvider {
    private Timing timing;
    private ConsulProcess consul;
    private Consul client;

    @BeforeClass
    public void setupClass() throws Exception {
        consul = ConsulStarterBuilder.consulStarter().build().start();
    }

    @AfterClass
    public void tearDownClass()
    {
        consul.close();
    }

    @BeforeMethod
    public void setup() throws Exception {
        timing = new Timing();

        consul.reset();
        client = Consul.builder()
                .withHostAndPort(HostAndPort.fromParts("localhost", consul.getHttpPort()))
                .build();
    }

    @Test
    public void testBasic() throws Exception {
        ConsulConfigProvider config = new ConsulConfigProvider(client, "prefix", new Properties());

        try {
            config.start();
            config.loadConfig();

            Properties properties = new Properties();
            properties.setProperty(PropertyBasedInstanceConfig.toName(StringConfigs.ZOO_CFG_EXTRA, PropertyBasedInstanceConfig.ROOT_PROPERTY_PREFIX), "1,2,3");
            config.storeConfig(new PropertyBasedInstanceConfig(properties, new Properties()), 0);

            timing.sleepABit();

            LoadedInstanceConfig instanceConfig = config.loadConfig();
            Assert.assertEquals(instanceConfig.getConfig().getRootConfig().getString(StringConfigs.ZOO_CFG_EXTRA), "1,2,3");

            List<SessionInfo> sessions = client.sessionClient().listSessions();
            Assert.assertEquals(sessions.size(), 0, "Consul session still exists!");
        }
        finally {
            CloseableUtils.closeQuietly(config);
        }
    }
}


text:
<template name="chat">

Discussão sobre a tarefa {{taskName}}

			CHAT

					{{#each messages}}

							{{authorname}} diz:
							{{messageBody}}

					{{/each}}

			<form id="send">

					<textarea class="form-control send-message" rows="3" placeholder="Write a reply..." tabIndex="-1"></textarea>

					<input type="submit" class="btn btn-default btn-block" value="Enviar">

			</form>

</template>


text:
package io.gravitee.rest.api.model;

import io.gravitee.rest.api.model.permissions.ApiPermission;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author David BRASSELY (david.brassely at graviteesource.com)
 * @author Nicolas GERAUD (nicolas.geraud at graviteesource.com)
 * @author GraviteeSource Team
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ApiPermissionsAllowed {
    ApiPermission[] value();
}


text:
function plotlyjs_syncplot(plt::Plot{PlotlyJSBackend})
    plt[:overwrite_figure] && closeall()
    plt.o = PlotlyJS.plot()
    traces = PlotlyJS.GenericTrace[]
    for series_dict in plotly_series(plt)
        plotly_type = pop!(series_dict, :type)
        series_dict[:transpose] = false
        push!(traces, PlotlyJS.GenericTrace(plotly_type; series_dict...))
    end
    PlotlyJS.addtraces!(plt.o, traces...)
    layout = plotly_layout(plt)
    w, h = plt[:size]
    PlotlyJS.relayout!(plt.o, layout, width = w, height = h)
    return plt.o
end

# ------------------------------------------------------------------------------

for (mime, fmt) in (
    "application/pdf" => "pdf",
    "image/png"       => "png",
    "image/svg+xml"   => "svg",
    "image/eps"       => "eps",
)
    @eval _show(io::IO, ::MIME{Symbol($mime)}, plt::Plot{PlotlyJSBackend}) =
        PlotlyJS.savefig(io, plotlyjs_syncplot(plt), format = $fmt)
end

# Use the Plotly implementation for json and html:
_show(io::IO, mime::MIME"application/vnd.plotly.v1+json", plt::Plot{PlotlyJSBackend}) =
    plotly_show_js(io, plt)

html_head(plt::Plot{PlotlyJSBackend}) = plotly_html_head(plt)
html_body(plt::Plot{PlotlyJSBackend}) = plotly_html_body(plt)

_show(io::IO, ::MIME"text/html", plt::Plot{PlotlyJSBackend}) =
    write(io, embeddable_html(plt))

_display(plt::Plot{PlotlyJSBackend}) = display(plotlyjs_syncplot(plt))

function PlotlyJS.WebIO.render(plt::Plot{PlotlyJSBackend})
    return PlotlyJS.WebIO.render(plotlyjs_syncplot(plt))
end

function closeall(::PlotlyJSBackend)
    if !isplotnull() && isa(current().o, PlotlyJS.SyncPlot)
        close(current().o)
    end
end

Base.showable(::MIME"application/prs.juno.plotpane+html", plt::Plot{PlotlyJSBackend}) = true


text:
#ifndef __DAVAENGINE_GRAPHICFONT_H__
#define __DAVAENGINE_GRAPHICFONT_H__

#include "Render/2D/Font.h"
#include "Render/Renderer.h"

namespace DAVA
{

#define GRAPHIC_FONT_CACHE_SIZE 1000 //text cache size
#define GRAPHIC_FONT_INDEX_BUFFER_SIZE ((GRAPHIC_FONT_CACHE_SIZE)*6)

class GraphicInternalFont;

class GraphicFont : public Font
{
public:
    class GraphicFontVertex
    {
    public:
        Vector3 position;
        Vector2 texCoord;
    };

    GraphicFont();

protected:
    virtual ~GraphicFont();

public:
    static GraphicFont* Create(const FilePath& descriptorPath, const FilePath& texturePath);

    /**
     \brief Get string size(rect).
     \param[in] str - processed string
     \param[in, out] charSizes - if present(not NULL), will contain widths of every symbol in str
     \returns bounding rect for string in pixels
     */
    virtual Font::StringMetrics GetStringMetrics(float32 size, const WideString& str, Vector<float32>* charSizes = 0) const;

    /**
     \brief Checks if symbol is present in font.
     \param[in] ch - tested symbol
     \returns true if symbol is available, false otherwise
     */
    virtual bool IsCharAvaliable(char16 ch) const;

    /**
     \brief Get height of highest symbol in font.
     \returns height in pixels
     */
    virtual uint32 GetFontHeight(float32 size) const;

    /**
     \brief Clone font.
     */
    virtual Font* Clone() const;

    /**
     \brief Get font texture
     */
    Texture* GetTexture() const;

    /**
     \brief Tests if two fonts are the same.
     */
    virtual bool IsEqual(const Font* font) const;

    // Put font properties into YamlNode
    virtual YamlNode* SaveToYamlNode() const;

    //We need to return font path
    const FilePath& GetFontPath() const;

    Font::StringMetrics DrawStringToBuffer(float32 size,
                                           const WideString& str,
                                           int32 xOffset,
                                           int32 yOffset,
                                           GraphicFontVertex* vertexBuffer,
                                           int32& charDrawed,
                                           Vector<float32>* charSizes = NULL,
                                           int32 justifyWidth = 0,
                                           int32 spaceAddon = 0) const;

    float32 GetSpread(float32 size) const;

protected:
    // Get the raw hash string (identical for identical fonts).
    virtual String GetRawHashString();

private:
    float32 GetSizeScale(float32 size) const;
    bool LoadTexture(const FilePath& path);

    GraphicInternalFont* fontInternal;
    Texture* texture;
};

inline Texture* GraphicFont::GetTexture() const
{
    return texture;
}
}

#endif //__DAVAENGINE_GRAPHICFONT_H__


text:
ACL_IMPL_FILE_PRAGMA_PUSH

namespace acl
{
	//////////////////////////////////////////////////////////////////////////
	// We only support up to 65534 bones, we reserve 65535 for the invalid index
	constexpr uint16_t k_invalid_bone_index = 0xFFFF;

	namespace impl
	{
		//////////////////////////////////////////////////////////////////////////
		// Simple iterator utility class to allow easy looping
		class BoneChainIterator
		{
		public:
			BoneChainIterator(const uint32_t* bone_chain, BitSetDescription bone_chain_desc, uint16_t bone_index, uint16_t offset)
				: m_bone_chain(bone_chain)
				, m_bone_chain_desc(bone_chain_desc)
				, m_bone_index(bone_index)
				, m_offset(offset)
			{}

			BoneChainIterator& operator++()
			{
				ACL_ASSERT(m_offset <= m_bone_index, "Cannot increment the iterator, it is no longer valid");

				// Skip the current bone
				m_offset++;

				// Iterate until we find the next bone part of the chain or until we reach the end of the chain
				// TODO: Use clz or similar to find the next set bit starting at the current index
				while (m_offset < m_bone_index && !bitset_test(m_bone_chain, m_bone_chain_desc, m_offset))
					m_offset++;

				return *this;
			}

			uint16_t operator*() const
			{
				ACL_ASSERT(m_offset <= m_bone_index, "Returned bone index doesn't belong to the bone chain");
				ACL_ASSERT(bitset_test(m_bone_chain, m_bone_chain_desc, m_offset), "Returned bone index doesn't belong to the bone chain");
				return m_offset;
			}

			// We only compare the offset in the bone chain. Two iterators on the same bone index
			// from two different or equal chains will be equal.
			bool operator==(const BoneChainIterator& other) const { return m_offset == other.m_offset; }
			bool operator!=(const BoneChainIterator& other) const { return m_offset != other.m_offset; }

		private:
			const uint32_t*		m_bone_chain;
			BitSetDescription	m_bone_chain_desc;
			uint16_t			m_bone_index;
			uint16_t			m_offset;
		};
	}

	//////////////////////////////////////////////////////////////////////////
	// Simple bone chain container to allow easy looping
	//
	// A bone chain allows looping over all bones up to a specific bone starting
	// at the root bone.
	//////////////////////////////////////////////////////////////////////////
	struct BoneChain
	{
		BoneChain(const uint32_t* bone_chain, BitSetDescription bone_chain_desc, uint16_t bone_index)
			: m_bone_chain(bone_chain)
			, m_bone_chain_desc(bone_chain_desc)
			, m_bone_index(bone_index)
		{
			// We don't know where this bone chain starts, find the root bone
			// TODO: Use clz or similar to find the next set bit starting at the current index
			uint16_t root_index = 0;
			while (!bitset_test(bone_chain, bone_chain_desc, root_index))
				root_index++;

			m_root_index = root_index;
		}

		impl::BoneChainIterator begin() const { return impl::BoneChainIterator(m_bone_chain, m_bone_chain_desc, m_bone_index, m_root_index); }
		impl::BoneChainIterator end() const { return impl::BoneChainIterator(m_bone_chain, m_bone_chain_desc, m_bone_index, m_bone_index + 1); }

		const uint32_t*		m_bone_chain;
		BitSetDescription	m_bone_chain_desc;
		uint16_t			m_root_index;
		uint16_t			m_bone_index;
	};

	//////////////////////////////////////////////////////////////////////////
	// A rigid bone description
	//
	// Bones are organized in a tree with a single root bone. Each bone has
	// one or more children and every bone except the root has a single parent.
	//////////////////////////////////////////////////////////////////////////
	struct alignas(16) RigidBone
	{
		//////////////////////////////////////////////////////////////////////////
		// Default constructor, initializes a simple root bone with no name
		RigidBone()
			: name()
			, bone_chain(nullptr)
			, vertex_distance(1.0F)
			, parent_index(k_invalid_bone_index)
			, bind_transform(transform_identity_64())
		{
			(void)padding;
		}

		~RigidBone() = default;

		RigidBone(RigidBone&& other)
			: name(std::move(other.name))
			, bone_chain(other.bone_chain)
			, vertex_distance(other.vertex_distance)
			, parent_index(other.parent_index)
			, bind_transform(other.bind_transform)
		{
			new(&other) RigidBone();
		}

		RigidBone& operator=(RigidBone&& other)
		{
			std::swap(name, other.name);
			std::swap(bone_chain, other.bone_chain);
			std::swap(vertex_distance, other.vertex_distance);
			std::swap(parent_index, other.parent_index);
			std::swap(bind_transform, other.bind_transform);

			return *this;
		}

		//////////////////////////////////////////////////////////////////////////
		// Returns whether or not this bone is a root bone
		bool is_root() const { return parent_index == k_invalid_bone_index; }

		// Name of the bone (used for debugging purposes only)
		String			name;

		// A bit set, a set bit at index X indicates the bone at index X is in the chain
		// This can be used to iterate on the bone chain efficiently from root to the current bone
		const uint32_t*	bone_chain;

		// Virtual vertex distance used by hierarchical error function
		// The error metric measures the error of a virtual vertex at this
		// distance from the bone in object space
		float			vertex_distance;

		// The parent bone index or an invalid bone index for the root bone
		// TODO: Introduce a type for bone indices
		uint16_t		parent_index;

		// Unused memory left as padding
		uint8_t			padding[2];

		// The bind transform is in its parent's local space
		// Note that the scale is ignored and this value is only used by the additive error metrics
		Transform_64	bind_transform;
	};

	//////////////////////////////////////////////////////////////////////////
	// A rigid skeleton made up of a tree of rigid bones
	//
	// This hierarchical structure is important and forms the back bone of the
	// error metrics. When calculating the error introduced by lowering the
	// precision of a single bone track, we will walk up the hierarchy and
	// calculate the error relative to the root bones (object/mesh space).
	//////////////////////////////////////////////////////////////////////////
	class RigidSkeleton
	{
	public:
		//////////////////////////////////////////////////////////////////////////
		// Constructs a RigidSkeleton instance and moves the data from the input
		// 'bones' into the skeleton instance (destructive operation on the input array).
		//    - allocator: The allocator instance to use to allocate and free memory
		//    - bones: An array of bones to initialize the skeleton with
		//    - num_bones: The number of input bones
		RigidSkeleton(IAllocator& allocator, RigidBone* bones, uint16_t num_bones)
			: m_allocator(allocator)
			, m_bones(allocate_type_array<RigidBone>(allocator, num_bones))
			, m_num_bones(num_bones)
		{
			// Calculate which bones are leaf bones that have no children
			BitSetDescription bone_bitset_desc = BitSetDescription::make_from_num_bits(num_bones);
			uint32_t* is_leaf_bitset = allocate_type_array<uint32_t>(allocator, bone_bitset_desc.get_size());
			bitset_reset(is_leaf_bitset, bone_bitset_desc, false);

			// By default  and if we find a child, we'll mark it as non-leaf
			bitset_set_range(is_leaf_bitset, bone_bitset_desc, 0, num_bones, true);

#if defined(ACL_HAS_ASSERT_CHECKS)
			uint32_t num_root_bones = 0;
#endif

			// Move and validate the input data
			for (uint16_t bone_index = 0; bone_index < num_bones; ++bone_index)
			{
				RigidBone& bone = bones[bone_index];

				const bool is_root = bone.parent_index == k_invalid_bone_index;

				ACL_ASSERT(bone.bone_chain == nullptr, "Bone chain should be calculated internally");
				ACL_ASSERT(is_root || bone.parent_index < bone_index, "Bones must be sorted parent first");
				ACL_ASSERT(quat_is_finite(bone.bind_transform.rotation), "Bind rotation is invalid: [%f, %f, %f, %f]", quat_get_x(bone.bind_transform.rotation), quat_get_y(bone.bind_transform.rotation), quat_get_z(bone.bind_transform.rotation), quat_get_w(bone.bind_transform.rotation));
				ACL_ASSERT(quat_is_normalized(bone.bind_transform.rotation), "Bind rotation isn't normalized: [%f, %f, %f, %f]", quat_get_x(bone.bind_transform.rotation), quat_get_y(bone.bind_transform.rotation), quat_get_z(bone.bind_transform.rotation), quat_get_w(bone.bind_transform.rotation));
				ACL_ASSERT(vector_is_finite3(bone.bind_transform.translation), "Bind translation is invalid: [%f, %f, %f]", vector_get_x(bone.bind_transform.translation), vector_get_y(bone.bind_transform.translation), vector_get_z(bone.bind_transform.translation));

				// If we have a parent, mark it as not being a leaf bone (it has at least one child)
				if (!is_root)
					bitset_set(is_leaf_bitset, bone_bitset_desc, bone.parent_index, false);

#if defined(ACL_HAS_ASSERT_CHECKS)
				if (is_root)
					num_root_bones++;
#endif

				m_bones[bone_index] = std::move(bone);

				// Input scale is ignored and always set to [1.0, 1.0, 1.0]
				m_bones[bone_index].bind_transform.scale = vector_set(1.0);
			}

			m_num_leaf_bones = safe_static_cast<uint16_t>(bitset_count_set_bits(is_leaf_bitset, bone_bitset_desc));

			m_leaf_bone_chains = allocate_type_array<uint32_t>(allocator, size_t(m_num_leaf_bones) * bone_bitset_desc.get_size());

			uint16_t leaf_index = 0;
			for (uint16_t bone_index = 0; bone_index < num_bones; ++bone_index)
			{
				if (!bitset_test(is_leaf_bitset, bone_bitset_desc, bone_index))
					continue;	// Skip non-leaf bones

				uint32_t* bone_chain = m_leaf_bone_chains + (leaf_index * bone_bitset_desc.get_size());
				bitset_reset(bone_chain, bone_bitset_desc, false);

				uint16_t chain_bone_index = bone_index;
				while (chain_bone_index != k_invalid_bone_index)
				{
					bitset_set(bone_chain, bone_bitset_desc, chain_bone_index, true);

					RigidBone& bone = m_bones[chain_bone_index];

					// We assign a bone chain the first time we find a bone that isn't part of one already
					if (bone.bone_chain == nullptr)
						bone.bone_chain = bone_chain;

					chain_bone_index = bone.parent_index;
				}

				leaf_index++;
			}

			ACL_ASSERT(num_root_bones > 0, "No root bone found. The root bones must have a parent index = 0xFFFF");
			ACL_ASSERT(leaf_index == m_num_leaf_bones, "Invalid number of leaf bone found");
			deallocate_type_array(m_allocator, is_leaf_bitset, bone_bitset_desc.get_size());
		}

		~RigidSkeleton()
		{
			deallocate_type_array(m_allocator, m_bones, m_num_bones);

			BitSetDescription bone_bitset_desc = BitSetDescription::make_from_num_bits(m_num_bones);
			deallocate_type_array(m_allocator, m_leaf_bone_chains, size_t(m_num_leaf_bones) * bone_bitset_desc.get_size());
		}

		RigidSkeleton(const RigidSkeleton&) = delete;
		RigidSkeleton& operator=(const RigidSkeleton&) = delete;

		//////////////////////////////////////////////////////////////////////////
		// Returns the array of bones contained in the skeleton
		const RigidBone* get_bones() const { return m_bones; }

		//////////////////////////////////////////////////////////////////////////
		// Returns a specific bone from its index
		const RigidBone& get_bone(uint16_t bone_index) const
		{
			ACL_ASSERT(bone_index < m_num_bones, "Invalid bone index: %u >= %u", bone_index, m_num_bones);
			return m_bones[bone_index];
		}

		//////////////////////////////////////////////////////////////////////////
		// Returns the number of bones in the skeleton
		uint16_t get_num_bones() const { return m_num_bones; }

		//////////////////////////////////////////////////////////////////////////
		// Returns a bone chain for a specific bone from its index
		BoneChain get_bone_chain(uint16_t bone_index) const
		{
			ACL_ASSERT(bone_index < m_num_bones, "Invalid bone index: %u >= %u", bone_index, m_num_bones);
			const RigidBone& bone = m_bones[bone_index];
			return BoneChain(bone.bone_chain, BitSetDescription::make_from_num_bits(m_num_bones), bone_index);
		}

	private:
		// The allocator instance used to allocate and free memory by this skeleton instance
		IAllocator&	m_allocator;

		// The array of bone data for this skeleton, contains 'm_num_bones' entries
		RigidBone*	m_bones;

		// Contiguous block of memory for the bone chains, contains m_num_leaf_bones * get_bitset_size(m_num_bones) entries
		uint32_t*	m_leaf_bone_chains;

		// Number of bones contained in this skeleton
		uint16_t	m_num_bones;

		// Number of leaf bones contained in this skeleton
		uint16_t	m_num_leaf_bones;
	};
}

ACL_IMPL_FILE_PRAGMA_POP


text:
/**
 * Bed script in the cabin.
 */
window.mapObjects['bed'] = MapObject.extend({
    trigger: function (player) {
        var hasFire = this.map.fireplaceLit;
        var isNighttime = Time.getHour() >= 18 || Time.getHour() <= 6;
        var hasLogs = Inventory.getItemQty(ItemTypes.FIRE_WOOD) >= 1;

        if (isNighttime && !hasFire && hasLogs) {
            Dialogue.prepare([{
                text: "It's freezing in here. I should light a fire with the wood I have before sleeping."
            }]);
        }
        else if (hasFire || isNighttime) {
            player.canControl = false;

            var dialoguePages = [];

            if (hasFire) {
                dialoguePages.push({
                    text: "The cabin is warm now. Should I sleep?"
                });
            } else {
                dialoguePages.push({
                    text: "It seems insane to go to sleep in here with this cold, but going outside might be worse right now."
                });
                dialoguePages.push({
                    text: "What should I do?"
                });
            }

            dialoguePages[dialoguePages.length - 1].options = [
                "Sleep (+ 6 hours)",
                "Nevermind"
            ];

            Dialogue.prepare(dialoguePages, function (data) {
                if (data.option == 1) {
                    // Yes
                    Time.addHours(6);
                    Needs.changeNeed(NeedType.SLEEP, -60);

                    if (hasFire) {
                        Needs.changeNeed(NeedType.COLD, -30);
                    }

                    $('#textoverlay').fadeIn('fast', function () {
                        player.canControl = true;

                        if (!IntroText.running) {
                            $('#textoverlay').fadeOut('fast');
                        }

                    }.bind(this));
                } else {
                    // No
                    player.canControl = true;
                }
            }.bind(this));
        } else {
            Dialogue.prepare([{
                text: "It's a bed. Once I find a way to warm up this cabin I may be able to get some rest here."
            }]);
        }

        Dialogue.show();
    }
});


text:
/*eslint no-new:0*/
import Ember from 'ember';
import { describe, it } from 'mocha';
import assert from 'chai';
import FunctionResolver from 'ember-cli-keyboard-actions/function-resolver';
var testActions = {
  keyDownActions: {
    'key37': function () {
      return 'key37';
    },
    'backspace': function () {
      return 'backspace';
    },
    'alphanumeric': function () {
      return 'alphanumeric';
    },
    'any': function () {
      return 'any';
    }
  },
  keyUpActions: {
    'key37': function () {
      return 'key37';
    },
    'backspace': function () {
      return 'backspace';
    }
  },
  keyPressActions: {
    'key37': function () {
      return 'key37';
    },
    'backspace': function () {
      return 'backspace';
    }
  }
};

describe('FunctionResolver', function () {
  it('should be able to resolve a key action based on keyX', function () {
    var keyDown = new FunctionResolver(testActions.keyDownActions);
    var keyUp = new FunctionResolver(testActions.keyUpActions);
    var keyPress = new FunctionResolver(testActions.keyPressActions);

    Ember.run.next(function () {
      assert.equal(keyDown.resolveKeyCode(37)(), 'key37');
      assert.equal(keyUp.resolveKeyCode(37)(), 'key37');
      assert.equal(keyPress.resolveKeyCode(37)(), 'key37');
    });
  });

  it('should be able to resolve a key action to a key name', function () {
    var keyDown = new FunctionResolver(testActions.keyDownActions);
    var keyUp = new FunctionResolver(testActions.keyUpActions);
    var keyPress = new FunctionResolver(testActions.keyPressActions);

    Ember.run.next(function () {
      assert.equal(keyDown.resolvePrettyName(8)(), 'backspace');
      assert.equal(keyUp.resolvePrettyName(8)(), 'backspace');
      assert.equal(keyPress.resolvePrettyName(8)(), 'backspace');
    });
  });

  it('should be able to resolve a key action from a key range', function () {
    var keyDown = new FunctionResolver(testActions.keyDownActions);

    Ember.run.next(function () {
      assert.equal(keyDown.resolveKeyRange(85)(), 'alphanumeric');
    });
  });

  it('should be able to resolve a catch all', function () {
    var keyDown = new FunctionResolver(testActions.keyDownActions);

    Ember.run.next(function () {
      assert.equal(keyDown.resolveCatchAll()(), 'any');
    });
  });
});


text:
package hammer.util;

public interface PropertiesFile {
    void load(String filename);

    String prop(String name);

    boolean has(String name);
}


text:
def watch(listener, *paths)
  callback = lambda { |changed_dirs, options| @called = true; listener.on_change(changed_dirs, options) }
  @adapter = Listen::Adapter.select_and_initialize(paths, { :latency => test_latency }, &callback)
  @adapter.start(false)

  yield

  t = Thread.new { sleep(test_latency * 5); @adapter.stop }
  @adapter.wait_for_callback
ensure
  Thread.kill(t) if t
  @adapter.stop
end

shared_examples_for 'a filesystem adapter' do
  subject { described_class.new(File.dirname(__FILE__), &Proc.new {}) }

  describe '#start' do
    after { subject.stop }

    context 'with the blocking param set to true' do
      it 'blocks the current thread after starting the workers' do
        @called = false
        t = Thread.new { subject.start(true); @called = true }
        sleep(test_latency * 3)
        Thread.kill(t) if t
        @called.should be_false
      end
    end

    context 'with the blocking param set to false' do
      it 'does not block the current thread after starting the workers' do
        @called = false
        t = Thread.new { subject.start(false); @called = true }
        sleep(test_latency * 3)
        Thread.kill(t) if t
        @called.should be_true
      end
    end
  end

  describe '#started?' do
    context 'with a new adapter' do
      it 'returns false' do
        subject.should_not be_started
      end
    end

    context 'with a stopped adapter' do
      before { subject.start(false); subject.stop }

      it 'returns false' do
        subject.should_not be_started
      end
    end

    context 'with a started adapter' do
      before { subject.start(false) }
      after { subject.start }

      it 'returns true' do
        subject.should be_started
      end
    end
  end
end

shared_examples_for 'an adapter that call properly listener#on_change' do |*args|
  options = (args.first && args.first.is_a?(Hash)) ? args.first : {}
  let(:listener) { mock(Listen::Listener) }
  before { described_class.stub(:works?) { true } }

  context 'single file operations' do
    context 'when a file is created' do
      it 'detects the added file' do
        fixtures do |path|
          if options[:recursive]
            listener.should_receive(:on_change).once.with([path], :recursive => true)
          else
            listener.should_receive(:on_change).once.with([path], {})
          end

          watch(listener, path) do
            touch 'new_file.rb'
          end
        end
      end

      context 'given a symlink' do
        it 'detects the added file' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with([path], {})
            end

            touch 'new_file.rb'

            watch(listener, path) do
              ln_s 'new_file.rb', 'new_file_symlink.rb'
            end
          end
        end
      end

      context 'given a new created directory' do
        it 'detects the added file' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with do |array, options|
                array.should =~ [path, "#{path}/a_directory"]
              end
            end

            watch(listener, path) do
              mkdir 'a_directory'
              # Needed for INotify, because of :recursive rb-inotify custom flag?
              sleep 0.05 if @adapter.is_a?(Listen::Adapters::Linux)
              touch 'a_directory/new_file.rb'
            end
          end
        end
      end

      context 'given an existing directory' do
        it 'detects the added file' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with(["#{path}/a_directory"], {})
            end

            mkdir 'a_directory'

            watch(listener, path) do
              touch 'a_directory/new_file.rb'
            end
          end
        end
      end

      context 'given a directory with subdirectories' do
        it 'detects the added file' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with(["#{path}/a_directory/subdirectory"], {})
            end

            mkdir_p 'a_directory/subdirectory'

            watch(listener, path) do
              touch 'a_directory/subdirectory/new_file.rb'
            end
          end
        end
      end
    end

    context 'when a file is modified' do
      it 'detects the modified file' do
        fixtures do |path|
          if options[:recursive]
            listener.should_receive(:on_change).once.with([path], :recursive => true)
          else
            listener.should_receive(:on_change).once.with([path], {})
          end

          touch 'existing_file.txt'

          watch(listener, path) do
            touch 'existing_file.txt'
          end
        end
      end

      context 'given a symlink' do
        it 'detects the modified file' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with([path], {})
            end

            touch 'existing_file.rb'
            ln_s  'existing_file.rb', 'existing_file_symlink.rb'

            watch(listener, path) do
              touch 'existing_file.rb'
            end
          end
        end
      end

      context 'given a hidden file' do
        it 'detects the modified file' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with([path], {})
            end

            touch '.hidden'

            watch(listener, path) do
              touch '.hidden'
            end
          end
        end
      end

      unless options[:adapter] == :windows
        context 'given a file mode change' do
          it 'does not detect the mode change' do
            fixtures do |path|
              if options[:recursive]
                listener.should_receive(:on_change).once.with([path], :recursive => true)
              else
                listener.should_receive(:on_change).once.with([path], {})
              end

              touch 'run.rb'

              watch(listener, path) do
                chmod 0777, 'run.rb'
              end
            end
          end
        end
      end

      context 'given an existing directory' do
        it 'detects the modified file' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with(["#{path}/a_directory"], {})
            end

            mkdir 'a_directory'
            touch 'a_directory/existing_file.txt'

            watch(listener, path) do
              touch 'a_directory/existing_file.txt'
            end
          end
        end
      end

      context 'given a directory with subdirectories' do
        it 'detects the modified file' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with(["#{path}/a_directory/subdirectory"], {})
            end

            mkdir_p 'a_directory/subdirectory'
            touch   'a_directory/subdirectory/existing_file.txt'

            watch(listener, path) do
              touch 'a_directory/subdirectory/new_file.rb'
            end
          end
        end
      end
    end

    context 'when a file is moved' do
      it 'detects the file move' do
        fixtures do |path|
          if options[:recursive]
            listener.should_receive(:on_change).once.with([path], :recursive => true)
          else
            listener.should_receive(:on_change).once.with([path], {})
          end

          touch 'move_me.txt'

          watch(listener, path) do
            mv 'move_me.txt', 'new_name.txt'
          end
        end
      end

      context 'given a symlink' do
        it 'detects the file move' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with([path], {})
            end

            touch 'move_me.rb'
            ln_s  'move_me.rb', 'move_me_symlink.rb'

            watch(listener, path) do
              mv 'move_me_symlink.rb', 'new_symlink.rb'
            end
          end
        end
      end

      context 'given an existing directory' do
        it 'detects the file move into the directory' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with do |array, options|
                array.should =~ [path, "#{path}/a_directory"]
              end
            end

            mkdir 'a_directory'
            touch 'move_me.txt'

            watch(listener, path) do
              mv 'move_me.txt', 'a_directory/move_me.txt'
            end
          end
        end

        it 'detects a file move out of the directory' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with do |array, options|
                array.should =~ [path, "#{path}/a_directory"]
              end
            end

            mkdir 'a_directory'
            touch 'a_directory/move_me.txt'

            watch(listener, path) do
              mv 'a_directory/move_me.txt', 'i_am_here.txt'
            end
          end
        end

        it 'detects a file move between two directories' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with do |array, options|
                array.should =~ ["#{path}/from_directory", "#{path}/to_directory"]
              end
            end

            mkdir 'from_directory'
            touch 'from_directory/move_me.txt'
            mkdir 'to_directory'

            watch(listener, path) do
              mv 'from_directory/move_me.txt', 'to_directory/move_me.txt'
            end
          end
        end
      end

      context 'given a directory with subdirectories' do
        it 'detects files movements between subdirectories' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with do |array, options|
                array.should =~ ["#{path}/a_directory/subdirectory", "#{path}/b_directory/subdirectory"]
              end
            end

            mkdir_p 'a_directory/subdirectory'
            mkdir_p 'b_directory/subdirectory'
            touch   'a_directory/subdirectory/move_me.txt'

            watch(listener, path) do
              mv 'a_directory/subdirectory/move_me.txt', 'b_directory/subdirectory'
            end
          end
        end
      end
    end

    context 'when a file is deleted' do
      it 'detects the file removal' do
        fixtures do |path|
          if options[:recursive]
            listener.should_receive(:on_change).once.with([path], :recursive => true)
          else
            listener.should_receive(:on_change).once.with([path], {})
          end

          touch 'unnecessary.txt'

          watch(listener, path) do
            rm 'unnecessary.txt'
          end
        end
      end

      context 'given a symlink' do
        it 'detects the file removal' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with([path], {})
            end

            touch 'unnecessary.rb'
            ln_s  'unnecessary.rb', 'unnecessary_symlink.rb'

            watch(listener, path) do
              rm 'unnecessary_symlink.rb'
            end
          end
        end
      end

      context 'given an existing directory' do
        it 'detects the file removal' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with(["#{path}/a_directory"], {})
            end

            mkdir 'a_directory'
            touch 'a_directory/do_not_use.rb'

            watch(listener, path) do
              rm 'a_directory/do_not_use.rb'
            end
          end
        end
      end

      context 'given a directory with subdirectories' do
        it 'detects the file removal' do
          fixtures do |path|
            if options[:recursive]
              listener.should_receive(:on_change).once.with([path], :recursive => true)
            else
              listener.should_receive(:on_change).once.with(["#{path}/a_directory/subdirectory"], {})
            end

            mkdir_p 'a_directory/subdirectory'
            touch   'a_directory/subdirectory/do_not_use.rb'

            watch(listener, path) do
              rm 'a_directory/subdirectory/do_not_use.rb'
            end
          end
        end
      end
    end
  end

  context 'multiple file operations' do
    it 'detects the added files' do
      fixtures do |path|
        if options[:recursive]
          listener.should_receive(:on_change).at_least(:once).with([path], :recursive => true)
        else
          listener.should_receive(:on_change).once.with do |array, options|
            array.should =~ [path, "#{path}/a_directory"]
          end
        end

        watch(listener, path) do
          touch 'a_file.rb'
          touch 'b_file.rb'
          mkdir 'a_directory'
          # Needed for INotify, because of :recursive rb-inotify custom flag?
          # Also needed for the osx adapter
          sleep 0.05
          touch 'a_directory/a_file.rb'
          touch 'a_directory/b_file.rb'
        end
      end
    end

    it 'detects the modified files' do
      fixtures do |path|
        if options[:recursive]
          listener.should_receive(:on_change).once.with([path], :recursive => true)
        else
          listener.should_receive(:on_change).once.with do |array, options|
            array.should =~ [path, "#{path}/a_directory"]
          end
        end

        touch 'a_file.rb'
        touch 'b_file.rb'
        mkdir 'a_directory'
        touch 'a_directory/a_file.rb'
        touch 'a_directory/b_file.rb'

        watch(listener, path) do
          touch 'b_file.rb'
          touch 'a_directory/a_file.rb'
        end
      end
    end

    it 'detects the removed files' do
      fixtures do |path|
        if options[:recursive]
          listener.should_receive(:on_change).once.with([path], :recursive => true)
        else
          listener.should_receive(:on_change).once.with do |array, options|
            array.should =~ [path, "#{path}/a_directory"]
          end
        end

        touch 'a_file.rb'
        touch 'b_file.rb'
        mkdir 'a_directory'
        touch 'a_directory/a_file.rb'
        touch 'a_directory/b_file.rb'

        watch(listener, path) do
          rm 'b_file.rb'
          rm 'a_directory/a_file.rb'
        end
      end
    end
  end

  context 'single directory operations' do
    it 'detects a moved directory' do
      fixtures do |path|
        if options[:recursive]
          listener.should_receive(:on_change).once.with([path], :recursive => true)
        else
          listener.should_receive(:on_change).once.with([path], {})
        end

        mkdir 'a_directory'
        touch 'a_directory/a_file.rb'
        touch 'a_directory/b_file.rb'

        watch(listener, path) do
          mv 'a_directory', 'renamed'
        end
      end
    end

    it 'detects a removed directory' do
      fixtures do |path|
        if options[:recursive]
          listener.should_receive(:on_change).once.with([path], :recursive => true)
        else
          listener.should_receive(:on_change).once.with do |array, options|
            array.should =~ [path, "#{path}/a_directory"]
          end
        end

        mkdir 'a_directory'
        touch 'a_directory/a_file.rb'
        touch 'a_directory/b_file.rb'

        watch(listener, path) do
          rm_rf 'a_directory'
        end
      end
    end
  end

  context "paused adapter" do
    context 'when a file is created' do
      it "doesn't detects the added file" do
        fixtures do |path|
          watch(listener, path) do
            @adapter.paused = true
            touch 'new_file.rb'
          end
          @called.should be_nil
        end
      end
    end
  end

  context "when multiple directories are listened to" do
    context 'when files are added to one of multiple directories' do
      it 'detects added files' do
        fixtures(2) do |path1, path2|
          if options[:recursive]
            listener.should_receive(:on_change).once.with([path2], :recursive => true)
          else
            listener.should_receive(:on_change).once.with([path2], {})
          end

          watch(listener, path1, path2) do
            touch "#{path2}/new_file.rb"
          end
        end
      end
    end

    context 'when files are added to multiple directories' do
      it 'detects added files' do
        fixtures(2) do |path1, path2|
          if options[:recursive]
            listener.should_receive(:on_change).once.with do |directories, options|
              directories.should =~ [path1, path2] && options.should == {:recursive => true}
            end
          else
            listener.should_receive(:on_change).once.with do |directories, options|
              directories.should =~ [path1, path2] && options.should == {}
            end
          end

          watch(listener, path1, path2) do
            touch "#{path1}/new_file.rb"
            touch "#{path2}/new_file.rb"
          end
        end
      end
    end

    context 'given a new and an existing directory on multiple directories' do
      it 'detects the added file' do
        fixtures(2) do |path1, path2|
          if options[:recursive]
            listener.should_receive(:on_change).once.with do |directories, options|
              directories.should =~ [path1, path2] && options.should == {:recursive => true}
            end
          else
            listener.should_receive(:on_change).once.with do |directories, options|
              directories.should =~ [path2, "#{path2}/b_directory", "#{path1}/a_directory"] && options.should == {}
            end
          end

          mkdir "#{path1}/a_directory"

          watch(listener, path1, path2) do
            mkdir "#{path2}/b_directory"
            sleep 0.05
            touch "#{path1}/a_directory/new_file.rb"
            touch "#{path2}/b_directory/new_file.rb"
          end
        end
      end
    end

    context 'when a file is moved between the multiple watched directories' do
      it 'detects the movements of the file' do
        fixtures(3) do |path1, path2, path3|
          if options[:recursive]
            listener.should_receive(:on_change).once.with do |directories, options|
              directories.should =~ [path1, path2, path3] && options.should == {:recursive => true}
            end
          else
            listener.should_receive(:on_change).once.with do |directories, options|
              directories.should =~ ["#{path1}/from_directory", path2, "#{path3}/to_directory"] && options.should == {}
            end
          end

          mkdir "#{path1}/from_directory"
          touch "#{path1}/from_directory/move_me.txt"
          mkdir "#{path3}/to_directory"

          watch(listener, path1, path2, path3) do
            mv "#{path1}/from_directory/move_me.txt", "#{path2}/move_me.txt"
            mv "#{path2}/move_me.txt", "#{path3}/to_directory/move_me.txt"
          end
        end
      end
    end

    context 'when files are deleted from the multiple watched directories' do
      it 'detects the files removal' do
        fixtures(2) do |path1, path2|
          if options[:recursive]
            listener.should_receive(:on_change).once.with do |directories, options|
              directories.should =~ [path1, path2] && options.should == {:recursive => true}
            end
          else
            listener.should_receive(:on_change).once.with do |directories, options|
              directories.should =~ [path1, path2] && options.should == {}
            end
          end

          touch "#{path1}/unnecessary.txt"
          touch "#{path2}/unnecessary.txt"

          watch(listener, path1, path2) do
            rm "#{path1}/unnecessary.txt"
            rm "#{path2}/unnecessary.txt"
          end
        end
      end
    end
  end

end


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<meta name="copyright" content="(C) Copyright 2005" />
<meta name="DC.rights.owner" content="(C) Copyright 2005" />
<meta content="public" name="security" />
<meta content="index,follow" name="Robots" />
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
<meta content="reference" name="DC.Type" />
<meta name="DC.Title" content="RENAME INDEX statement" />
<meta content="RENAME INDEX statement" name="DC.subject" />
<meta content="RENAME INDEX statement" name="keywords" />
<meta scheme="URI" name="DC.Relation" content="crefsqljrenamestatements.html" />
<meta scheme="URI" name="DC.Relation" content="rrefsqljrenamecolumnstatement.html" />
<meta scheme="URI" name="DC.Relation" content="rrefsqljrenametablestatement.html" />
<meta content="XHTML" name="DC.Format" />
<meta content="rrefsqlj95598" name="DC.Identifier" />
<meta content="en-us" name="DC.Language" />
<link href="commonltr.css" type="text/css" rel="stylesheet" />
<title>RENAME INDEX statement</title>

RENAME INDEX statement

This statement allows you to rename an index in the current schema.
Users cannot rename indexes in the SYS schema.

Syntax

RENAME INDEX index-Name TO new-index-Name

Example

RENAME INDEX DESTINDEX TO ARRIVALINDEX

Statement dependency system

RENAME
INDEX is not allowed if there are any open cursors that reference the index
being renamed.

Parent topic: RENAME statements

Related reference

RENAME COLUMN statement

RENAME TABLE statement


text:
package exception;

public class CaptchaNotMatchedException extends Exception {
    public CaptchaNotMatchedException() {
        super("Captcha not matched.");
    }
}


text:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
/** @publicapi @module params */ /** */
var common_1 = require("../common/common");
var predicates_1 = require("../common/predicates");
/**
 * An internal class which implements [[ParamTypeDefinition]].
 *
 * A [[ParamTypeDefinition]] is a plain javascript object used to register custom parameter types.
 * When a param type definition is registered, an instance of this class is created internally.
 *
 * This class has naive implementations for all the [[ParamTypeDefinition]] methods.
 *
 * Used by [[UrlMatcher]] when matching or formatting URLs, or comparing and validating parameter values.
 *
 * #### Example:
 * ```js
 * var paramTypeDef = {
 *   decode: function(val) { return parseInt(val, 10); },
 *   encode: function(val) { return val && val.toString(); },
 *   equals: function(a, b) { return this.is(a) && a === b; },
 *   is: function(val) { return angular.isNumber(val) && isFinite(val) && val % 1 === 0; },
 *   pattern: /\d+/
 * }
 *
 * var paramType = new ParamType(paramTypeDef);
 * ```
 * @internalapi
 */
var ParamType = /** @class */ (function () {
    /**
     * @param def  A configuration object which contains the custom type definition.  The object's
     *        properties will override the default methods and/or pattern in `ParamType`'s public interface.
     * @returns a new ParamType object
     */
    function ParamType(def) {
        /** @inheritdoc */
        this.pattern = /.*/;
        /** @inheritdoc */
        this.inherit = true;
        common_1.extend(this, def);
    }
    // consider these four methods to be "abstract methods" that should be overridden
    /** @inheritdoc */
    ParamType.prototype.is = function (val, key) {
        return true;
    };
    /** @inheritdoc */
    ParamType.prototype.encode = function (val, key) {
        return val;
    };
    /** @inheritdoc */
    ParamType.prototype.decode = function (val, key) {
        return val;
    };
    /** @inheritdoc */
    ParamType.prototype.equals = function (a, b) {
        // tslint:disable-next-line:triple-equals
        return a == b;
    };
    ParamType.prototype.$subPattern = function () {
        var sub = this.pattern.toString();
        return sub.substr(1, sub.length - 2);
    };
    ParamType.prototype.toString = function () {
        return "{ParamType:" + this.name + "}";
    };
    /** Given an encoded string, or a decoded object, returns a decoded object */
    ParamType.prototype.$normalize = function (val) {
        return this.is(val) ? val : this.decode(val);
    };
    /**
     * Wraps an existing custom ParamType as an array of ParamType, depending on 'mode'.
     * e.g.:
     * - urlmatcher pattern "/path?{queryParam[]:int}"
     * - url: "/path?queryParam=1&queryParam=2
     * - $stateParams.queryParam will be [1, 2]
     * if `mode` is "auto", then
     * - url: "/path?queryParam=1 will create $stateParams.queryParam: 1
     * - url: "/path?queryParam=1&queryParam=2 will create $stateParams.queryParam: [1, 2]
     */
    ParamType.prototype.$asArray = function (mode, isSearch) {
        if (!mode)
            return this;
        if (mode === 'auto' && !isSearch)
            throw new Error("'auto' array mode is for query parameters only");
        return new ArrayType(this, mode);
    };
    return ParamType;
}());
exports.ParamType = ParamType;
/**
 * Wraps up a `ParamType` object to handle array values.
 * @internalapi
 */
function ArrayType(type, mode) {
    var _this = this;
    // Wrap non-array value as array
    function arrayWrap(val) {
        return predicates_1.isArray(val) ? val : predicates_1.isDefined(val) ? [val] : [];
    }
    // Unwrap array value for "auto" mode. Return undefined for empty array.
    function arrayUnwrap(val) {
        switch (val.length) {
            case 0:
                return undefined;
            case 1:
                return mode === 'auto' ? val[0] : val;
            default:
                return val;
        }
    }
    // Wraps type (.is/.encode/.decode) functions to operate on each value of an array
    function arrayHandler(callback, allTruthyMode) {
        return function handleArray(val) {
            if (predicates_1.isArray(val) && val.length === 0)
                return val;
            var arr = arrayWrap(val);
            var result = common_1.map(arr, callback);
            return allTruthyMode === true ? common_1.filter(result, function (x) { return !x; }).length === 0 : arrayUnwrap(result);
        };
    }
    // Wraps type (.equals) functions to operate on each value of an array
    function arrayEqualsHandler(callback) {
        return function handleArray(val1, val2) {
            var left = arrayWrap(val1), right = arrayWrap(val2);
            if (left.length !== right.length)
                return false;
            for (var i = 0; i < left.length; i++) {
                if (!callback(left[i], right[i]))
                    return false;
            }
            return true;
        };
    }
    ['encode', 'decode', 'equals', '$normalize'].forEach(function (name) {
        var paramTypeFn = type[name].bind(type);
        var wrapperFn = name === 'equals' ? arrayEqualsHandler : arrayHandler;
        _this[name] = wrapperFn(paramTypeFn);
    });
    common_1.extend(this, {
        dynamic: type.dynamic,
        name: type.name,
        pattern: type.pattern,
        inherit: type.inherit,
        raw: type.raw,
        is: arrayHandler(type.is.bind(type), true),
        $arrayMode: mode,
    });
}
//# sourceMappingURL=paramType.js.map


text:
#import "MarkupEditorController.h"
#import "MarkupEditorItemFactory.h"

@implementation MarkupEditorController

- (id) initWithNibName: (NSString *)aNibName bundle: (NSBundle *)aBundle
{
	self = [super initWithNibName: aNibName bundle: aBundle];
	if (nil == self)
		return nil;

	MarkupEditorItemFactory *itemFactory = [MarkupEditorItemFactory factory];
	ETLayoutItemGroup *item = [itemFactory itemGroup];

	[self setTemplate: [ETItemTemplate templateWithItem: item  objectClass: [NSMutableDictionary class]]
	          forType: [self currentObjectType]];
	/*[self setTemplate: [ETItemTemplate templateWithItem: [itemFactory item] objectClass: [NSString class]]
	          forType: [self currentObjectType]];*/

	return self;
}

- (ETLayoutItemGroup *) content
{
	return (ETLayoutItemGroup *)[[super content] itemForIdentifier: @"documentContent"];
}

@end


text:
function [number_of_message_pushed]=generate_load(type, time_period)
% pushes generated messages for the period of time_period to a kafka topic
% type is "text" or "random_number"
% time_period is in milliseconds

% Authors: Pooyan Jamshidi (pooyan.jamshidi@gmail.com)
% The code is released under the FreeBSD License.
% Copyright (C) 2016 Pooyan Jamshidi, Imperial College London
init();

global kafka topic
if ~isdeployed
    ip=kafka;
    topic_=topic;
else
    ip = getmcruserdata('kafka');
    topic_ = getmcruserdata('topic');
end

api='/topics/';
url=[ip api topic_];

switch type
    case 'text'
        fid=fopen('test.txt','r');
        number_of_message_pushed=0;
        tStart=tic;
        while toc(tStart)*1000<=time_period
            tline=fgetl(fid);
            if feof(fid)
                fseek(fid,0,'bof');
            end
            data = struct('records',{{struct('value',struct('sentence',tline))}});
            header = http_createHeader('Content-Type','application/vnd.kafka.json.v1+json');
            [status,extras]=urlread2(url,'POST',mls.internal.toJSON(data),header);
            number_of_message_pushed=number_of_message_pushed+1;
        end
        fclose(fid);

    case 'random_number'
        tStart=tic;
        size=6;
        number_of_message_pushed=0;
        while toc(tStart)*1000<=time_period
            rand_number=randi([int64(10^(size-1)),int64(10^size)]);
            data = struct('records',{{struct('value',struct('number',rand_number))}});
            header = http_createHeader('Content-Type','application/vnd.kafka.json.v1+json');
            [status,extras]=urlread2(url,'POST',mls.internal.toJSON(data),header);
            number_of_message_pushed=number_of_message_pushed+1;
        end

end
end


text:
<!DOC TYPE html>

    <meta charset="utf-8">
    <title>Product List</title>
    <link href='http://fonts.googleapis.com/css?family=Roboto+Slab:400,700|Open+Sans:300italic,400,300' rel='stylesheet' type='text/css'>
  <link href="../css/typography.css" rel="stylesheet">
  <link href="../css/buttons.css" rel="stylesheet">
  <link href="../css/media-object.css" rel="stylesheet">
	<link href="../css/product-list.css" rel="stylesheet">

Product Name

            The Best of the best!
            $79

Some great feature

Another super feature

And more...

        BUY NOW


text:
RH_NRF905::RH_NRF905(uint8_t chipEnablePin, uint8_t txEnablePin, uint8_t slaveSelectPin, RHGenericSPI& spi)
    :
    RHNRFSPIDriver(slaveSelectPin, spi)
{
    _chipEnablePin = chipEnablePin;
    _txEnablePin   = txEnablePin;
}

bool RH_NRF905::init()
{
#if defined (__MK20DX128__) || defined (__MK20DX256__)
    // Teensy is unreliable at 8MHz:
    _spi.setFrequency(RHGenericSPI::Frequency1MHz);
#else
    _spi.setFrequency(RHGenericSPI::Frequency8MHz);
#endif
    if (!RHNRFSPIDriver::init())
	return false;

    // Initialise the slave select pin and the tx Enable pin
    pinMode(_chipEnablePin, OUTPUT);
    pinMode(_txEnablePin, OUTPUT);
    digitalWrite(_chipEnablePin, LOW);
    digitalWrite(_txEnablePin, LOW);

    // Configure the chip
    // CRC 16 bits enabled. 16MHz crystal freq
    spiWriteRegister(RH_NRF905_CONFIG_9, RH_NRF905_CONFIG_9_CRC_EN | RH_NRF905_CONFIG_9_CRC_MODE_16BIT | RH_NRF905_CONFIG_9_XOF_16MHZ);

    // Make sure we are powered down
    setModeIdle();

    // Some innocuous defaults
    setChannel(108, LOW); // 433.2 MHz
    setRF(RH_NRF905::TransmitPowerm10dBm);

    return true;
}

// Use the register commands to read and write the registers
uint8_t RH_NRF905::spiReadRegister(uint8_t reg)
{
    return spiRead((reg & RH_NRF905_REG_MASK) | RH_NRF905_REG_R_CONFIG);
}

uint8_t RH_NRF905::spiWriteRegister(uint8_t reg, uint8_t val)
{
    return spiWrite((reg & RH_NRF905_REG_MASK) | RH_NRF905_REG_W_CONFIG, val);
}

uint8_t RH_NRF905::spiBurstReadRegister(uint8_t reg, uint8_t* dest, uint8_t len)
{
    return spiBurstRead((reg & RH_NRF905_REG_MASK) | RH_NRF905_REG_R_CONFIG, dest, len);
}

uint8_t RH_NRF905::spiBurstWriteRegister(uint8_t reg, uint8_t* src, uint8_t len)
{
    return spiBurstWrite((reg & RH_NRF905_REG_MASK) | RH_NRF905_REG_W_CONFIG, src, len);
}

uint8_t RH_NRF905::statusRead()
{
    // The status is a byproduct of sending a command
    return spiCommand(0);
}

bool RH_NRF905::setChannel(uint16_t channel, bool hiFrequency)
{
    spiWriteRegister(RH_NRF905_CONFIG_0, channel & RH_NRF905_CONFIG_0_CH_NO);
    // Set or clear the high bit of the channel
    uint8_t bit8 = (channel >> 8) & 0x01;
    uint8_t reg1 = spiReadRegister(RH_NRF905_CONFIG_1);
    reg1 = (reg1 & ~0x01) | bit8;
    // Set or clear the HFREQ_PLL bit
    reg1 &= ~RH_NRF905_CONFIG_1_HFREQ_PLL;
    if (hiFrequency)
	reg1 |= RH_NRF905_CONFIG_1_HFREQ_PLL;
    spiWriteRegister(RH_NRF905_CONFIG_1, reg1);
    return true;
}

bool RH_NRF905::setNetworkAddress(uint8_t* address, uint8_t len)
{
    if (len < 1 || len > 4)
	return false;
    // Set RX_AFW and TX_AFW
    spiWriteRegister(RH_NRF905_CONFIG_2, len | (len << 4));
    spiBurstWrite(RH_NRF905_REG_W_TX_ADDRESS, address, len);
    spiBurstWriteRegister(RH_NRF905_CONFIG_5, address, len);
    return true;
}

bool RH_NRF905::setRF(TransmitPower power)
{
    // Enum definitions of power are the same numerical values as the register
    uint8_t reg1 = spiReadRegister(RH_NRF905_CONFIG_1);
    reg1 &= ~RH_NRF905_CONFIG_1_PA_PWR;
    reg1 |= ((power & 0x3) << 2) & RH_NRF905_CONFIG_1_PA_PWR;
    spiWriteRegister(RH_NRF905_CONFIG_1, reg1);
    return true;
}

void RH_NRF905::setModeIdle()
{
    if (_mode != RHModeIdle)
    {
	digitalWrite(_chipEnablePin, LOW);
	digitalWrite(_txEnablePin, LOW);
	_mode = RHModeIdle;
    }
}

void RH_NRF905::setModeRx()
{
    if (_mode != RHModeRx)
    {
	digitalWrite(_txEnablePin, LOW);
	digitalWrite(_chipEnablePin, HIGH);
	_mode = RHModeRx;
    }
}

void RH_NRF905::setModeTx()
{
    if (_mode != RHModeTx)
    {
	// Its the high transition that puts us into TX mode
	digitalWrite(_txEnablePin, HIGH);
	digitalWrite(_chipEnablePin, HIGH);
	_mode = RHModeTx;
    }
}

bool RH_NRF905::send(const uint8_t* data, uint8_t len)
{
    if (len > RH_NRF905_MAX_MESSAGE_LEN)
	return false;

    if (!waitCAD())
	return false;  // Check channel activity

    // Set up the headers
    _buf[0] = _txHeaderTo;
    _buf[1] = _txHeaderFrom;
    _buf[2] = _txHeaderId;
    _buf[3] = _txHeaderFlags;
    _buf[4] = len;
    memcpy(_buf+RH_NRF905_HEADER_LEN, data, len);
    spiBurstWrite(RH_NRF905_REG_W_TX_PAYLOAD, _buf, len + RH_NRF905_HEADER_LEN);
    setModeTx();
    // Radio will return to Standby mode after transmission is complete
    _txGood++;
    return true;
}

bool RH_NRF905::waitPacketSent()
{
    if (_mode != RHModeTx)
	return false;

    while (!(statusRead() & RH_NRF905_STATUS_DR))
	YIELD;
    setModeIdle();
    return true;
}

bool RH_NRF905::isSending()
{
    if (_mode != RHModeTx)
	return false;

    return !(statusRead() & RH_NRF905_STATUS_DR);
}

bool RH_NRF905::printRegister(uint8_t reg)
{
#ifdef RH_HAVE_SERIAL
    Serial.print(reg, HEX);
    Serial.print(": ");
    Serial.println(spiReadRegister(reg), HEX);
#endif

    return true;
}

bool RH_NRF905::printRegisters()
{
    uint8_t registers[] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09};

    uint8_t i;
    for (i = 0; i < sizeof(registers); i++)
	printRegister(registers[i]);
    return true;
}

// Check whether the latest received message is complete and uncorrupted
void RH_NRF905::validateRxBuf()
{
    // Check the length
    uint8_t len = _buf[4];
    if (len > RH_NRF905_MAX_MESSAGE_LEN)
	return; // Silly LEN header

    // Extract the 4 headers
    _rxHeaderTo    = _buf[0];
    _rxHeaderFrom  = _buf[1];
    _rxHeaderId    = _buf[2];
    _rxHeaderFlags = _buf[3];
    if (_promiscuous ||
	_rxHeaderTo == _thisAddress ||
	_rxHeaderTo == RH_BROADCAST_ADDRESS)
    {
	_rxGood++;
	_bufLen = len + RH_NRF905_HEADER_LEN; // _buf still includes the headers
	_rxBufValid = true;
    }
}

bool RH_NRF905::available()
{
    if (!_rxBufValid)
    {
	if (_mode == RHModeTx)
	    return false;
	setModeRx();
	if (!(statusRead() & RH_NRF905_STATUS_DR))
	    return false;
	// Get the message into the RX buffer, so we can inspect the headers
	// we still dont know how long is the user message
	spiBurstRead(RH_NRF905_REG_R_RX_PAYLOAD, _buf, RH_NRF905_MAX_PAYLOAD_LEN);
	validateRxBuf();
	if (_rxBufValid)
	    setModeIdle(); // Got one

    }
    return _rxBufValid;
}

void RH_NRF905::clearRxBuf()
{
    _rxBufValid = false;
    _bufLen = 0;
}

bool RH_NRF905::recv(uint8_t* buf, uint8_t* len)
{
    if (!available())
	return false;
    if (buf && len)
    {
	// Skip the 4 headers that are at the beginning of the rxBuf
	if (*len > _bufLen-RH_NRF905_HEADER_LEN)
	    *len = _bufLen-RH_NRF905_HEADER_LEN;
	memcpy(buf, _buf+RH_NRF905_HEADER_LEN, *len);
    }
    clearRxBuf(); // This message accepted and cleared
    return true;
}

uint8_t RH_NRF905::maxMessageLength()
{
    return RH_NRF905_MAX_MESSAGE_LEN;
}


text:
<?php

use common\widgets\GridView;

/* @var $this \yii\web\View */
/* @var $dataProvider \yii\data\ArrayDataProvider */

$this->title = Yii::t('czater', 'Calls');
$this->params['breadcrumbs'][] = $this->title;
?>

<?= GridView::widget([
	'dataProvider' => $dataProvider,
]) ?>


text:
(function (templateCompiler) {
    // elements
    var templateArea = document.getElementById('template');
    var templateData = document.getElementById('data');
    var templateCompiled = document.getElementById('compiled');
    var templateResult = document.getElementById('result');
    // additional variables
    var compiler;
    var userData;
    // set inital values
    try {
        userData = JSON.parse(templateData.value);
    } catch (e) {
        console.log('[Templata] ' + e.message);
    }

    if (userData) {
        createTemplate(templateArea.value, userData);
    }

    // add listener
    templateArea.addEventListener('keyup', function (e) {
        createTemplate(e.target.value);
    }, { capture: false, passive: true });
    templateData.addEventListener('keyup', function (e) {
        parseData(e.target.value);
    }, { capture: false, passive: true });

    function parseData(inputData) {
        var errorOccurred = false;
        var data;

        try {
            data = JSON.parse(inputData);
        } catch (e) {
            errorOccurred = true;

            if (console && console.log) {
                console.log('[Templata] ' + e.message);
            }
        }

        if (!errorOccurred) {
            renderTemplate(data);
        }
    }

    function createTemplate(template, data) {
        compiler = templateCompiler(template);
        templateCompiled.value = compiler.toString();

        renderTemplate(data);
    }

    function renderTemplate(data) {
        if (!data) {
            data = userData;
        } else {
            userData = data;
        }

        templateResult.value = compiler(data);
    }
})(window.Templata);