text:
/*
 * Module Name:
 *     Umbra -- umbra.c
 *
 * Description:
 *     driver of the whole Umbra system
 *
 * Author:
 *     Qin Zhao
 *
 */

#include "umbra.h"
#include "global.h"

#include "shadow.h"
#include "instrument.h"
#include "table.h"
#include "cfg.h"
#include "analyzer.h"
#include "optimize.h"

#ifdef LINUX_KERNEL
#include "dr_kernel_utils.h"
DEFINE_PER_CPU(umbra_info_t*, cpu_umbra_info);
#define KERNEL_TEXT_BASE ((void*) 0xffffffff80000000)
#define KERNEL_TEXT_SIZE (512 * 1024 * 1024)
#endif

/* data structure for global process information */
proc_info_t proc_info;
wrap_func_t *wrap_funcs;
static void
umbra_wrap_func_on_module_load(void *drcontext, const module_data_t *info);

/* set default options for umbra */
static void
proc_info_options_init(void)
{
    proc_info.options.opt_ems64           = false;
    proc_info.options.opt_inline_check    = true;
    proc_info.options.opt_map_check       = true;
    proc_info.options.opt_aflags_stealing = true;
    proc_info.options.opt_regs_stealing   = true;
    proc_info.options.opt_trace           = false;
    proc_info.options.opt_group           = true;
#ifdef DOUBLE_SHADOW
    proc_info.options.opt_group           = false;
    proc_info.options.opt_regs_stealing   = false;
    proc_info.options.opt_aflags_stealing = false;
#endif
#ifdef LINUX_KERNEL
    /* We aren't using opt_group to make it simple to special case user
     * memory.
     * TODO(peter): Figure out how to enable opt_group.
     */
    proc_info.options.opt_group           = false;
    proc_info.options.opt_unsafe_regs_stealing   = false;
    proc_info.options.opt_unsafe_aflags_stealing   = false;
#endif
    proc_info.options.stat                = false;
    proc_info.options.adapt_alloc         = false;
    proc_info.options.swap_stack          = false;
}

/* initialize the proc_info */
static void
proc_info_init(void)
{
    memset(&proc_info, 0, sizeof(proc_info_t));
    proc_info.mutex = dr_mutex_create();
    proc_info.num_offs = 0;
    proc_info.pid   = dr_get_process_id();
    proc_info.log   = umbra_open_proc_log(proc_info.pid);
    proc_info.unit_bits = ADDRESS_SPACE_UNIT_ALIGN_BITS;
    proc_info.unit_mask = ADDRESS_SPACE_UNIT_ALIGN_MASK;
    proc_info.unit_size = ADDRESS_SPACE_UNIT_ALIGN_SIZE;
    proc_info_options_init();
}

/* finalize the proc_info */
static void
proc_info_exit(void)
{
    dr_fprintf(proc_info.log, "num instr: %llu\n", proc_info.num_instrs);
    dr_mutex_destroy(proc_info.mutex);
    dr_close_file(proc_info.log);
}

/* initialize thread private umbra info */
static void
umbra_info_init(void *drcontext, umbra_info_t *info)
{
    memset(info, 0, sizeof(umbra_info_t));
    info->drcontext = drcontext;
    info->tid = dr_get_thread_id(drcontext);
    info->log = umbra_open_thread_log(info->tid);
    dr_mutex_lock(proc_info.mutex);
    proc_info.num_threads++;
    dr_mutex_unlock(proc_info.mutex);
}

/* finalize thread private umbra info */
static void
umbra_info_exit(void *drcontext, umbra_info_t *info)
{
    /* close log file */
    dr_close_file(info->log);
}

/* print execution statistics */
static void
print_stat_count(void *drcontext, umbra_info_t *info)
{
    if (proc_info.options.stat == false)
        return;
    dr_mutex_lock(proc_info.mutex);
    proc_info.num_instrs += info->num_dyn_instrs;
    dr_mutex_unlock(proc_info.mutex);

    dr_fprintf(info->log,
               "Num of dynamic app instrs: %llu\n",
               info->num_dyn_instrs);

    dr_fprintf(info->log,
               "Num of dynamic app references: %llu\n",
               info->num_dyn_refs);
    dr_fprintf(info->log,
               "Num of bb inline check: %llu,"
               "trace inline check: %llu\n",
               info->num_bb_inline_checks,
               info->num_trace_inline_checks);
    dr_fprintf(info->log,
               "\ttotal inline check: %llu, "
               "miss: %llu, hit ratio: %f\n",
               info->num_bb_inline_checks +
               info->num_trace_inline_checks,
               info->num_map_checks,
               (info->num_bb_inline_checks == 0) ? 0 :
               ((double)(info->num_bb_inline_checks +
                         info->num_trace_inline_checks -
                         info->num_map_checks) /
                (double)(info->num_bb_inline_checks +
                         info->num_trace_inline_checks)));
    dr_fprintf(info->log,
               "Num of map checks: %llu, miss: %llu, hit ratio: %f\n",
               info->num_map_checks,
               info->num_map_searchs,
               (info->num_map_checks == 0) ? 0 :
               ((double)(info->num_map_checks -
                         info->num_map_searchs) /
                (double)(info->num_map_checks)));
    dr_fprintf(info->log,
               "Num of map searchs: %llu, miss: %llu, hit ratio: %f\n",
               info->num_map_searchs,
               info->num_clean_calls,
               (info->num_map_searchs == 0) ? 0 :
               ((double)(info->num_map_searchs -
                         info->num_clean_calls) /
                (double)(info->num_map_searchs)));
    dr_fprintf(info->log,
               "Num of clean calls: %llu\n",
               info->num_clean_calls);
    dr_fprintf(info->log,
               "Num of aflags restore: %llu\n",
               info->num_aflags_restores);
    dr_fprintf(info->log,
               "Num of reg restore: %llu\n",
               info->num_reg_restores);
    dr_fprintf(info->log,
               "Num of static app instrs %llu\n",
               info->num_app_instrs);
    dr_fprintf(info->log,
               "Num of static refs: %llu\n",
               info->num_app_refs);
    dr_fprintf(info->log,
               "Num of ref_cache: %llu\n",
               info->num_ref_caches);
    dr_fprintf(info->log,
               "Num of SIGSEGV/SIGBUS: %llu\n",
               info->num_sigs);
}

/*---------------------------------------------------------------------*
 *                 Exported Function Implementation                    *
 *---------------------------------------------------------------------*/

static void
check_option_compatibility(option_t *options)
{
#ifdef LINUX_KERNEL
#define ASSERT_OPTION(option, value) do {\
    DR_ASSERT(options->option == (value));\
    options->option = (value); } while (0)
    ASSERT_OPTION(swap_stack, false);
    ASSERT_OPTION(opt_ems64, false);
    /* TODO(peter): Add support for these. They don't work because we dispatch
     * on an interrupt handler between the spill and the restore. Umbra for
     * userspace Linux has the same problem.
     */
    ASSERT_OPTION(opt_unsafe_aflags_stealing, false);
    ASSERT_OPTION(opt_unsafe_regs_stealing, false);
    ASSERT_OPTION(double_shadow, false);
    ASSERT_OPTION(opt_group, false);
#undef ASSERT_OPTION
#endif
}

/* initialize umbra system */
void
umbra_init(client_id_t id)
{
    DR_ASSERT_MSG(dr_using_all_private_caches(),
                  "Error: UMBRA only works in "
                  "thread private cache");
    /* init the process information */
    proc_info_init();
    /* umbra client init function */
    umbra_client_init(id);
    check_option_compatibility(&proc_info.options);
    /* shadow memory manager init */
    shadow_init();
}

/* finalize umbra system */
void
umbra_exit(void)
{
    /* shadow memory manager exit */
    shadow_exit();
    /* umbra client exit */
    if (proc_info.client.client_exit != NULL)
        proc_info.client.client_exit();
    /* proc_info exit */
    proc_info_exit();
}

/* initialize thread private data structure for umbra */
void
umbra_thread_init(void *drcontext)
{
    umbra_info_t *info;

    /* initialize thread private umbra_info */
    info = (umbra_info_t *)
        dr_thread_alloc(drcontext, sizeof(umbra_info_t));

#ifdef LINUX_KERNEL
    __get_cpu_var(cpu_umbra_info) = info;
#endif

    dr_set_tls_field      (drcontext, info);
    umbra_info_init       (drcontext, info);
    table_thread_init     (drcontext, info);
    cfg_thread_init       (drcontext, info);
    shadow_thread_init    (drcontext, info);
    analyzer_thread_init  (drcontext, info);
    instrument_thread_init(drcontext, info);
    if (proc_info.client.thread_init != NULL)
        proc_info.client.thread_init(drcontext, info);
}

/* finalize thread private data structure for umbra */
void
umbra_thread_exit(void *drcontext)
{
    umbra_info_t *info =
        (umbra_info_t *)dr_get_tls_field(drcontext);
    print_stat_count(drcontext, info);
    instrument_thread_exit(drcontext, info);
    analyzer_thread_exit  (drcontext, info);
    shadow_thread_exit    (drcontext, info);
    cfg_thread_exit       (drcontext, info);
    if (proc_info.client.thread_exit != NULL)
        proc_info.client.thread_exit(drcontext, info);
    table_thread_exit     (drcontext, info);
    umbra_info_exit       (drcontext, info);
    dr_set_tls_field      (drcontext, NULL);
    dr_thread_free(drcontext, info, sizeof(umbra_info_t));
#ifdef LINUX_KERNEL
    __get_cpu_var(cpu_umbra_info) = NULL;
#endif
}

/* fork init */
void
umbra_fork_init(void *drcontext)
{
    proc_info.pid = dr_get_process_id();
    proc_info.log = umbra_open_proc_log(proc_info.pid);
}

/* add the module for stack */
static void
add_stack_module(void *drcontext, umbra_info_t *info)
{
    dr_mcontext_t mcontext;
    int           app_errno;
    memory_map_t  *map;
#ifndef LINUX_KERNEL
    memory_mod_t  *mod;
#endif
    int i;

    dr_get_mcontext(drcontext, &mcontext, &app_errno);
    dr_mutex_lock(proc_info.mutex);
#ifdef LINUX_KERNEL
    map = memory_map_app_lazy_add(KERNEL_TEXT_BASE);
#else
    mod = memory_mod_app_lookup((void *)mcontext.xsp);
    DR_ASSERT(mod != NULL);
    /* get system stack */
    if (proc_info.stack_top == NULL)
        proc_info.stack_top = mod->app_base;
    map = mod->map;
#endif
    dr_mutex_unlock(proc_info.mutex);
    DR_ASSERT(map != NULL);

    info->stack_ref_cache = table_alloc_ref_cache(drcontext, info);
    info->stack_ref_cache->tag    = (reg_t)map->app_base;
    info->stack_map_tag    = (reg_t)map->app_base;
    for (i = 0; i < MAX_NUM_SHADOWS; i++) {
        info->stack_ref_cache->offset[i] = map->offset[i];
        info->stack_map_offset[i] = map->offset[i];
    }
}

/* invocated on basic block building event */
dr_emit_flags_t
umbra_basic_block(void *drcontext,
                  void *tag,
                  instrlist_t *ilist,
                  bool  for_trace,
                  bool  translating)
{
    umbra_info_t *info = (umbra_info_t *)dr_get_tls_field(drcontext);
    basic_block_t *bb;

    if (proc_info.client.app_to_app_transformation) {
        proc_info.client.app_to_app_transformation(drcontext, info, tag, ilist,
                                                   for_trace);
    }

    if (info->stack_ref_cache == NULL)
        add_stack_module(drcontext, info);
    /* retrive the basic block data structure */
    bb = cfg_basic_block(drcontext, info, tag, ilist);
    /* instrument the basic block code */
    instrument_basic_block(drcontext, info, bb, ilist,
                           for_trace);
    /* let DR store the translation information */
    return DR_EMIT_STORE_TRANSLATIONS;
}

/* invocated on trace building event */
dr_emit_flags_t
umbra_trace(void *drcontext,
            void *tag,
            instrlist_t *ilist,
            bool  translating)
{
    umbra_info_t *info = (umbra_info_t *)dr_get_tls_field(drcontext);
    /* the functionality instrumentation is done on each bb event
     * we try to optimize the instrumentation on trace
     */
    optimize_trace(drcontext, info, tag, ilist);
    return DR_EMIT_STORE_TRANSLATIONS;
}

/* if a trace should be stoped at next_tag bb */
dr_custom_trace_action_t
umbra_end_trace(void *drcontext,
                void *trace_tag,
                void *next_tag)
{
    /* let DR decides */
    return CUSTOM_TRACE_DR_DECIDES;
}

/* event on code fragment deletion */
void
umbra_delete(void *drcontext, void *tag)
{
    /* Do nothing */
    return;
}

/* event on restore state */
void
umbra_restore_state(void *drcontext,
                    void *tag,
                    dr_mcontext_t *mcontext,
                    bool restore_memory,
                    bool app_code_consistent)
{
    /* Do nothing */
    return;
}

/* event on which syscall is interested */
bool
umbra_filter_syscall(void *drcontext, int sysnum)
{
    /* intercept every syscall */
    return true;
}

/* invocated before the system call */
bool
umbra_pre_syscall(void *drcontext, int sysnum)
{
    umbra_info_t *info = (umbra_info_t *)dr_get_tls_field(drcontext);
    /* notify shadow memory manager */
    shadow_pre_syscall(drcontext, info, sysnum);
    return true;
}

/* invocated after the system call */
void
umbra_post_syscall(void *drcontext, int sysnum)
{
    umbra_info_t *info = (umbra_info_t *)dr_get_tls_field(drcontext);
    /* notify shadow memory manager */
    shadow_post_syscall(drcontext, info, sysnum);
}

/* invocated on each module load event */
void
umbra_module_load(void *drcontext,
                  const module_data_t *info,
                  bool loaded)
{
    umbra_info_t *umbra_info = (umbra_info_t *)dr_get_tls_field(drcontext);
    DR_ASSERT(info != NULL);

    umbra_wrap_func_on_module_load(drcontext, info);
    shadow_module_load(drcontext, umbra_info, info, loaded);
}

/* invocated on each module unload event */
void
umbra_module_unload(void *drcontext,
                    const module_data_t *info)
{
    umbra_info_t *umbra_info = (umbra_info_t *)dr_get_tls_field(drcontext);
    shadow_module_unload(drcontext, umbra_info, info);
}

#ifdef LINUX_KERNEL
    /* TODO(peter): Add some interrupt handling code here. */
bool
umbra_interrupt(void *drcontext, dr_interrupt_t *interrupt)
{
    umbra_info_t *umbra_info = (umbra_info_t *)dr_get_tls_field(drcontext);
    if (!shadow_interrupt(umbra_info, interrupt)) {
        return false;
    }
    if (!instrument_interrupt(umbra_info, interrupt)) {
        return false;
    }
    if (proc_info.client.interrupt) {
        return proc_info.client.interrupt(umbra_info, interrupt);
    }
    return true;
}

static ssize_t
show_umbra_stats(int cpu, char *buf)
{
    char *orig_buf = buf;
    umbra_info_t *umbra_info = __get_cpu_var(cpu_umbra_info);
    if (!umbra_info) {
        return sprintf(buf, "cpu %d not yet initilized!\n", cpu);
    }
    #define PRINT_UMBRA_STAT(name)\
        buf += sprintf(buf, #name ": %lu\n", umbra_info->name);
    PRINT_UMBRA_STAT(num_app_instrs);
    PRINT_UMBRA_STAT(num_app_refs);
    PRINT_UMBRA_STAT(num_ref_caches);
    PRINT_UMBRA_STAT(num_dyn_instrs);
    PRINT_UMBRA_STAT(num_dyn_refs);
    PRINT_UMBRA_STAT(num_dyn_user_refs);
    PRINT_UMBRA_STAT(num_bb_inline_checks);
    PRINT_UMBRA_STAT(num_trace_inline_checks);
    PRINT_UMBRA_STAT(num_fast_lookups);
    PRINT_UMBRA_STAT(num_map_checks);
    PRINT_UMBRA_STAT(num_map_searchs);
    PRINT_UMBRA_STAT(num_clean_calls);
    PRINT_UMBRA_STAT(num_aflags_restores);
    PRINT_UMBRA_STAT(num_reg_restores);
    PRINT_UMBRA_STAT(num_sigs);
    PRINT_UMBRA_STAT(num_pre_wrap_calls);
    PRINT_UMBRA_STAT(num_post_wrap_calls);
    PRINT_UMBRA_STAT(num_post_without_pre);
    PRINT_UMBRA_STAT(num_pre_wrap_intr);
    PRINT_UMBRA_STAT(num_post_wrap_intr);
    PRINT_UMBRA_STAT(num_pages_for_page_table);
    PRINT_UMBRA_STAT(num_pages_for_shadow);
    PRINT_UMBRA_STAT(num_ro_pages_in_shadow);
    PRINT_UMBRA_STAT(num_spill_regs);
    PRINT_UMBRA_STAT(num_dead_regs);
    PRINT_UMBRA_STAT(num_spill_aflags);
    PRINT_UMBRA_STAT(num_dead_aflags);
    PRINT_UMBRA_STAT(num_table_bytes);
    PRINT_UMBRA_STAT(num_table_bb);
    PRINT_UMBRA_STAT(num_table_ref);
    PRINT_UMBRA_STAT(num_table_ref_cache);
    PRINT_UMBRA_STAT(num_table_edge);
    PRINT_UMBRA_STAT(num_table_func);
    PRINT_UMBRA_STAT(num_table_code_hash);
    #undef PRINT_UMBRA_STAT
    return buf - orig_buf;
}

static dr_stats_t umbra_stats;

int
umbra_kernel_init(void)
{
    if (dr_stats_init(&umbra_stats)) {
        return -ENOMEM;
    }
    if (dr_cpu_stat_alloc(&umbra_stats, "stats", show_umbra_stats, THIS_MODULE)) {
        printk("umbra_kernel_init failed: dr_cpu_stat_alloc error\n");
        goto stats_free;
    }
    if (shadow_kernel_init()) {
        printk("umbra_kernel_init failed: shadow_kernel_init error\n");
        goto stats_free;
    }
    if (umbra_client_kernel_init()) {
        printk("umbra_kernel_init failed: umbra_client_kernel_init error\n");
        goto shadow_free;
    }
    return 0;

shadow_free:
    shadow_kernel_exit();
stats_free:
    dr_stats_free(&umbra_stats);
    return -ENOMEM;;
}

void
umbra_kernel_exit(void)
{
    umbra_client_kernel_exit();
    shadow_kernel_exit();
    dr_stats_free(&umbra_stats);
}

#elif defined(LINUX)
/* invocated on each signal received */
dr_signal_action_t
umbra_signal(void *drcontext, dr_siginfo_t *siginfo)
{
    umbra_info_t *umbra_info = (umbra_info_t *)dr_get_tls_field(drcontext);
    return shadow_signal(drcontext, umbra_info, siginfo);
}

#else /* Windows */

bool
umbra_exception(void *drcontext, dr_exception_t *excpt)
{
    umbra_info_t *umbra_info = (umbra_info_t *)dr_get_tls_field(drcontext);
    return shadow_exception(drcontext, umbra_info, excpt);
}

#endif /* LINUX */

static wrap_func_t *
umbra_create_wf(const char *modname,
                const char *name,
                pre_func_wrapper_t pre_func,
                post_func_wrapper_t post_func)
{
    wrap_func_t *wf;
    wf = dr_global_alloc(sizeof(wrap_func_t));
    wf->modname = modname;
    wf->name = name;
    wf->func = NULL;
    wf->size = 0;
    wf->pre_func = pre_func;
    wf->post_func = post_func;

    dr_mutex_lock(proc_info.mutex);
    wf->next = wrap_funcs;
    wrap_funcs = wf;
    dr_mutex_unlock(proc_info.mutex);

    return wf;
}

/* */
static bool
module_name_match(const module_data_t *data, const char *modname)
{
    if (modname == NULL)
        return true;

    if (strncmp(modname, data->names.file_name, strlen(modname)) == 0)
        return true;
    return false;
}

static void
umbra_wrap_func_on_module_load(void *drcontext, const module_data_t *info)
{
    wrap_func_t *wf;
    dr_mutex_lock(proc_info.mutex);
    for (wf = wrap_funcs; wf != NULL; wf = wf->next) {
        if (wf->func != NULL)
            continue;
        if (module_name_match(info, wf->modname)) {
            wf->func = (app_pc)dr_get_proc_address(info->handle, wf->name);
            if (wf->func != NULL)
                umbra_create_wf(wf->modname, wf->name, wf->pre_func,
                                wf->post_func);
        }
    }
    dr_mutex_unlock(proc_info.mutex);
}

void
umbra_wrap_func(const char *modname,
                const char *name,
                pre_func_wrapper_t pre_func,
                post_func_wrapper_t post_func)
{
    wrap_func_t *wf;
    dr_module_iterator_t *mi;
    module_data_t *data;

    wf = umbra_create_wf(modname, name, pre_func, post_func);

    /* find the mod by the name */
    if (modname != NULL) {
        data = dr_lookup_module_by_name(modname);
        if (data != NULL) {
            wf->func = (app_pc)dr_get_proc_address(data->handle, wf->name);
            return;
        }
    }
    /* the module name is NULL or cannot find the module
     * iterate over the module.
     */
    mi = dr_module_iterator_start();
    while (dr_module_iterator_hasnext(mi)) {
        module_data_t *data = dr_module_iterator_next(mi);
        if (module_name_match(data, modname)) {
            if (wf->func == NULL) {
                wf->func = (app_pc)dr_get_proc_address(data->handle, wf->name);
            } else {
                /* FIXME: the operation might be racy, i.e.
                 * multiple threads call umbra_wrap_func, and umbra_wrap_func_module
                 * It is possible more than one thread access the same wp.
                 */
                wf = umbra_create_wf(modname, name, pre_func, post_func);
                wf->func = (app_pc)dr_get_proc_address(data->handle, wf->name);
            }
        }
        dr_free_module_data(data);
        if (wf->func != NULL)
            break;
    }
    dr_module_iterator_stop(mi);
}

void
umbra_wrap_func_address(app_pc func, size_t func_size, const char *name,
                        pre_func_wrapper_t pre_func,
                        post_func_wrapper_t post_func)
{
    wrap_func_t *wf = umbra_create_wf("no module!", name, pre_func, post_func);
    wf->func = func;
    wf->size = func_size;
}

reg_t
umbra_get_arg(int index)
{
    void *drcontext;
    dr_mcontext_t mc;
    int error_no;
    reg_t arg = REG_NULL;
    drcontext = dr_get_current_drcontext();
    dr_get_mcontext(drcontext, &mc, &error_no);
    switch (index) {
    case 0:
        arg = mc.rdi;
        break;
    case 1:
        arg = mc.rsi;
        break;
    case 2:
        arg = mc.rdx;
        break;
    case 3:
        arg = mc.rcx;
        break;
    case 4:
        arg = mc.r8;
        break;
    case 5:
        arg = mc.r9;
        break;
    default:
        DR_ASSERT(false);
    }
    return arg;
}

reg_t
umbra_get_ret_value(void)
{
    void *drcontext = dr_get_current_drcontext();
    dr_mcontext_t mc;
    int error_no;
    dr_get_mcontext(drcontext, &mc, &error_no);
    return mc.rax;
}

umbra_info_t *
umbra_get_info(void)
{
  void *drcontext = dr_get_current_drcontext();
  return dr_get_tls_field(drcontext);
}

/*---------------------------------------------------------------------*
 *                              End of umbra.c                         *
 *---------------------------------------------------------------------*/


text:
#include "pch.h"
#include "GameBaseObject.h"

class GameResourceObject: public GameBaseObject
{
public:
	void PreInit(DX::DeviceResources *resources)
	{
		GameBaseObject::PreInit(resources);
	}
	virtual void Render(btTransform transform, btTransform scaling) = 0;
	void PerformancePersistence(bool onlyGetSize, bool isSaveMod);
	virtual void LoadResource() = 0;
	void SetNameFile(std::string nameFile) { m_nameFile = nameFile; }
	void SetPathFile(std::string pathFile) { m_pathFile = pathFile; }
private:
	std::string m_nameFile;
	std::string m_pathFile;
};

redpajama_set_name: RedPajamaGithub


text:
FROM java:8u66

MAINTAINER rtc.to
LABEL description="Docker image for RTC to GIT migration"

ARG VERSION=6.0.2

ADD RTC-scmTools-Linux64-$VERSION.zip /tmp/rtc-scm-tools.zip
RUN unzip -d /opt /tmp/rtc-scm-tools.zip
RUN rm -f /tmp/rtc-scm-tools.zip
RUN mkdir /var/data

ADD scm.ini /opt/jazz/scmtools/eclipse/scm.ini
ADD plugins/ /opt/jazz/scmtools/eclipse/plugins/
ADD jazz-scm/ /root/.jazz-scm/

ENV PATH=$PATH:/opt/jazz/scmtools/eclipse

VOLUME /var/data

WORKDIR /var/data


text:
<?php

namespace Sellsy\Criteria;

/**
 * Interface CriteriaInterface
 * @package Sellsy\Criteria
 */
interface CriteriaInterface
{
    /**
     * @return array
     */
    public function getParameters();
}


text:
<?php
/**
 * The template for displaying 404 pages (not found)
 *
 * @package FoundationPress
 * @since FoundationPress 1.0.0
 */

get_header(); ?>

		<article <?php post_class() ?> id="post-<?php the_ID(); ?>">

<?php _e( 'File Not Found', 'foundationpress' ); ?>

<?php _e( 'The page you are looking for might have been removed, had its name changed, or is temporarily unavailable.', 'foundationpress' ); ?>

<?php _e( 'Please try the following:', 'foundationpress' ); ?>

<?php _e( 'Check your spelling', 'foundationpress' ); ?>

						<?php
							/* translators: %s: home page url */
							printf( __(
								'Return to the home page', 'foundationpress' ),
								home_url()
							);
						?>

<?php _e( 'Click the Back button', 'foundationpress' ); ?>

	<?php get_sidebar(); ?>

<?php get_footer();


text:
package org.apache.tez.dag.api.client;

import org.apache.tez.dag.api.records.DAGProtos.ProgressProtoOrBuilder;

public class Progress {

  ProgressProtoOrBuilder proxy = null;

  Progress(ProgressProtoOrBuilder proxy) {
    this.proxy = proxy;
  }

  public int getTotalTaskCount() {
    return proxy.getTotalTaskCount();
  }

  public int getSucceededTaskCount() {
    return proxy.getSucceededTaskCount();
  }

  public int getRunningTaskCount() {
    return proxy.getRunningTaskCount();
  }

  public int getFailedTaskCount() {
    return proxy.getFailedTaskCount();
  }

  public int getKilledTaskCount() {
    return proxy.getKilledTaskCount();
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("TotalTasks: ");
    sb.append(getTotalTaskCount());
    sb.append(" Succeeded: ");
    sb.append(getSucceededTaskCount());
    sb.append(" Running: ");
    sb.append(getRunningTaskCount());
    sb.append(" Failed: ");
    sb.append(getFailedTaskCount());
    sb.append(" Killed: ");
    sb.append(getKilledTaskCount());
    return sb.toString();
  }

}


text:
namespace AH.ModuleController.UI.ATMS.Forms
{
    partial class frmArchieveLog
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.DG = new System.Windows.Forms.DataGridView();
            this.radHousekeeping = new AtiqsControlLibrary.SmartRadioButton();
            this.radCSSD = new AtiqsControlLibrary.SmartRadioButton();
            this.cboWarehouseType = new System.Windows.Forms.ComboBox();
            this.smartLabel2 = new AtiqsControlLibrary.SmartLabel();
            this.cboWarehouse = new System.Windows.Forms.ComboBox();
            this.smartLabel5 = new AtiqsControlLibrary.SmartLabel();
            this.btnDown = new System.Windows.Forms.Button();
            this.txtModuleID = new AtiqsControlLibrary.SmartTextBox();
            this.txtStoreid = new AtiqsControlLibrary.SmartTextBox();
            this.txtgrpID = new AtiqsControlLibrary.SmartTextBox();
            this.dtevDate = new System.Windows.Forms.DateTimePicker();
            this.smartLabel6 = new AtiqsControlLibrary.SmartLabel();
            this.smartLabel3 = new AtiqsControlLibrary.SmartLabel();
            this.txtRemarks = new AtiqsControlLibrary.SmartTextBox();
            this.pnlMain.SuspendLayout();
            this.pnlTop.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.DG)).BeginInit();
            this.SuspendLayout();
            //
            // frmLabel
            //
            this.frmLabel.Location = new System.Drawing.Point(391, 9);
            this.frmLabel.Size = new System.Drawing.Size(329, 33);
            this.frmLabel.Text = "Receipt From Maintenance";
            //
            // pnlMain
            //
            this.pnlMain.Controls.Add(this.smartLabel3);
            this.pnlMain.Controls.Add(this.txtRemarks);
            this.pnlMain.Controls.Add(this.dtevDate);
            this.pnlMain.Controls.Add(this.smartLabel6);
            this.pnlMain.Controls.Add(this.txtModuleID);
            this.pnlMain.Controls.Add(this.txtStoreid);
            this.pnlMain.Controls.Add(this.txtgrpID);
            this.pnlMain.Controls.Add(this.btnDown);
            this.pnlMain.Controls.Add(this.cboWarehouse);
            this.pnlMain.Controls.Add(this.smartLabel5);
            this.pnlMain.Controls.Add(this.cboWarehouseType);
            this.pnlMain.Controls.Add(this.smartLabel2);
            this.pnlMain.Controls.Add(this.radCSSD);
            this.pnlMain.Controls.Add(this.radHousekeeping);
            this.pnlMain.Controls.Add(this.DG);
            this.pnlMain.Size = new System.Drawing.Size(1024, 723);
            //
            // pnlTop
            //
            this.pnlTop.Size = new System.Drawing.Size(1025, 58);
            //
            // btnEdit
            //
            this.btnEdit.Enabled = false;
            this.btnEdit.Location = new System.Drawing.Point(412, 644);
            this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
            //
            // btnSave
            //
            this.btnSave.Location = new System.Drawing.Point(299, 644);
            this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
            //
            // btnDelete
            //
            this.btnDelete.Enabled = false;
            this.btnDelete.Location = new System.Drawing.Point(525, 644);
            //
            // btnNew
            //
            this.btnNew.Location = new System.Drawing.Point(186, 644);
            //
            // btnClose
            //
            this.btnClose.Location = new System.Drawing.Point(747, 644);
            //
            // btnPrint
            //
            this.btnPrint.Location = new System.Drawing.Point(636, 644);
            //
            // groupBox1
            //
            this.groupBox1.Location = new System.Drawing.Point(0, 685);
            this.groupBox1.Size = new System.Drawing.Size(1025, 25);
            //
            // DG
            //
            this.DG.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
            this.DG.Location = new System.Drawing.Point(7, 273);
            this.DG.Name = "DG";
            this.DG.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
            this.DG.Size = new System.Drawing.Size(1011, 389);
            this.DG.TabIndex = 8;
            this.DG.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.DG_KeyPress);
            //
            // radHousekeeping
            //
            this.radHousekeeping.AutoSize = true;
            this.radHousekeeping.Checked = true;
            this.radHousekeeping.Font = new System.Drawing.Font("Georgia", 11F);
            this.radHousekeeping.ForeColor = System.Drawing.Color.Gray;
            this.radHousekeeping.Location = new System.Drawing.Point(26, 167);
            this.radHousekeeping.Name = "radHousekeeping";
            this.radHousekeeping.Size = new System.Drawing.Size(125, 22);
            this.radHousekeeping.TabIndex = 9;
            this.radHousekeeping.TabStop = true;
            this.radHousekeeping.Text = "House Keeping";
            this.radHousekeeping.UseVisualStyleBackColor = true;
            this.radHousekeeping.Visible = false;
            this.radHousekeeping.CheckedChanged += new System.EventHandler(this.radHousekeeping_CheckedChanged);
            //
            // radCSSD
            //
            this.radCSSD.AutoSize = true;
            this.radCSSD.Font = new System.Drawing.Font("Georgia", 11F);
            this.radCSSD.ForeColor = System.Drawing.Color.Gray;
            this.radCSSD.Location = new System.Drawing.Point(26, 209);
            this.radCSSD.Name = "radCSSD";
            this.radCSSD.Size = new System.Drawing.Size(63, 22);
            this.radCSSD.TabIndex = 10;
            this.radCSSD.Text = "CSSD";
            this.radCSSD.UseVisualStyleBackColor = true;
            this.radCSSD.Visible = false;
            this.radCSSD.CheckedChanged += new System.EventHandler(this.radCSSD_CheckedChanged);
            //
            // cboWarehouseType
            //
            this.cboWarehouseType.Font = new System.Drawing.Font("Verdana", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.cboWarehouseType.FormattingEnabled = true;
            this.cboWarehouseType.Location = new System.Drawing.Point(321, 179);
            this.cboWarehouseType.Name = "cboWarehouseType";
            this.cboWarehouseType.Size = new System.Drawing.Size(232, 26);
            this.cboWarehouseType.TabIndex = 19;
            this.cboWarehouseType.SelectedIndexChanged += new System.EventHandler(this.cboWarehouseType_SelectedIndexChanged);
            this.cboWarehouseType.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.cboWarehouseType_KeyPress);
            //
            // smartLabel2
            //
            this.smartLabel2.AutoSize = true;
            this.smartLabel2.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold);
            this.smartLabel2.Location = new System.Drawing.Point(190, 184);
            this.smartLabel2.Name = "smartLabel2";
            this.smartLabel2.Size = new System.Drawing.Size(123, 14);
            this.smartLabel2.TabIndex = 18;
            this.smartLabel2.Text = "Warehouse Type:";
            //
            // cboWarehouse
            //
            this.cboWarehouse.Font = new System.Drawing.Font("Verdana", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.cboWarehouse.FormattingEnabled = true;
            this.cboWarehouse.Location = new System.Drawing.Point(706, 178);
            this.cboWarehouse.Name = "cboWarehouse";
            this.cboWarehouse.Size = new System.Drawing.Size(213, 26);
            this.cboWarehouse.TabIndex = 21;
            this.cboWarehouse.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.cboWarehouse_KeyPress);
            //
            // smartLabel5
            //
            this.smartLabel5.AutoSize = true;
            this.smartLabel5.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold);
            this.smartLabel5.Location = new System.Drawing.Point(608, 181);
            this.smartLabel5.Name = "smartLabel5";
            this.smartLabel5.Size = new System.Drawing.Size(87, 14);
            this.smartLabel5.TabIndex = 20;
            this.smartLabel5.Text = "Warehouse:";
            //
            // btnDown
            //
            this.btnDown.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
            this.btnDown.Location = new System.Drawing.Point(925, 178);
            this.btnDown.Name = "btnDown";
            this.btnDown.Size = new System.Drawing.Size(41, 23);
            this.btnDown.TabIndex = 27;
            this.btnDown.Text = ">>";
            this.btnDown.UseVisualStyleBackColor = false;
            this.btnDown.Click += new System.EventHandler(this.btnDown_Click);
            //
            // txtModuleID
            //
            this.txtModuleID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.txtModuleID.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txtModuleID.Location = new System.Drawing.Point(321, 231);
            this.txtModuleID.Name = "txtModuleID";
            this.txtModuleID.Size = new System.Drawing.Size(50, 24);
            this.txtModuleID.TabIndex = 30;
            this.txtModuleID.Visible = false;
            //
            // txtStoreid
            //
            this.txtStoreid.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.txtStoreid.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txtStoreid.Location = new System.Drawing.Point(257, 231);
            this.txtStoreid.Name = "txtStoreid";
            this.txtStoreid.Size = new System.Drawing.Size(58, 24);
            this.txtStoreid.TabIndex = 29;
            this.txtStoreid.Visible = false;
            //
            // txtgrpID
            //
            this.txtgrpID.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.txtgrpID.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txtgrpID.Location = new System.Drawing.Point(201, 222);
            this.txtgrpID.Name = "txtgrpID";
            this.txtgrpID.Size = new System.Drawing.Size(50, 24);
            this.txtgrpID.TabIndex = 28;
            this.txtgrpID.Visible = false;
            //
            // dtevDate
            //
            this.dtevDate.Font = new System.Drawing.Font("Verdana", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.dtevDate.Format = System.Windows.Forms.DateTimePickerFormat.Short;
            this.dtevDate.Location = new System.Drawing.Point(706, 210);
            this.dtevDate.Name = "dtevDate";
            this.dtevDate.Size = new System.Drawing.Size(213, 26);
            this.dtevDate.TabIndex = 32;
            this.dtevDate.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.dtevDate_KeyPress);
            //
            // smartLabel6
            //
            this.smartLabel6.AutoSize = true;
            this.smartLabel6.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold);
            this.smartLabel6.Location = new System.Drawing.Point(601, 215);
            this.smartLabel6.Name = "smartLabel6";
            this.smartLabel6.Size = new System.Drawing.Size(96, 14);
            this.smartLabel6.TabIndex = 31;
            this.smartLabel6.Text = "Receipt Date:";
            //
            // smartLabel3
            //
            this.smartLabel3.AutoSize = true;
            this.smartLabel3.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Bold);
            this.smartLabel3.Location = new System.Drawing.Point(273, 681);
            this.smartLabel3.Name = "smartLabel3";
            this.smartLabel3.Size = new System.Drawing.Size(70, 14);
            this.smartLabel3.TabIndex = 34;
            this.smartLabel3.Text = "Remarks:";
            //
            // txtRemarks
            //
            this.txtRemarks.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            this.txtRemarks.Font = new System.Drawing.Font("Microsoft Sans Serif", 11.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.txtRemarks.Location = new System.Drawing.Point(352, 678);
            this.txtRemarks.Name = "txtRemarks";
            this.txtRemarks.Size = new System.Drawing.Size(391, 24);
            this.txtRemarks.TabIndex = 33;
            this.txtRemarks.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtRemarks_KeyPress);
            //
            // frmArchieveLog
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.ClientSize = new System.Drawing.Size(1025, 710);
            this.isEnterTabAllow = true;
            this.Name = "frmArchieveLog";
            this.Load += new System.EventHandler(this.frmArchieveLog_Load);
            this.pnlMain.ResumeLayout(false);
            this.pnlMain.PerformLayout();
            this.pnlTop.ResumeLayout(false);
            this.pnlTop.PerformLayout();
            ((System.ComponentModel.ISupportInitialize)(this.DG)).EndInit();
            this.ResumeLayout(false);

        }

        #endregion

        private System.Windows.Forms.DataGridView DG;
        private AtiqsControlLibrary.SmartRadioButton radCSSD;
        private AtiqsControlLibrary.SmartRadioButton radHousekeeping;
        private System.Windows.Forms.ComboBox cboWarehouseType;
        private AtiqsControlLibrary.SmartLabel smartLabel2;
        private System.Windows.Forms.ComboBox cboWarehouse;
        private AtiqsControlLibrary.SmartLabel smartLabel5;
        private System.Windows.Forms.Button btnDown;
        private AtiqsControlLibrary.SmartTextBox txtModuleID;
        private AtiqsControlLibrary.SmartTextBox txtStoreid;
        private AtiqsControlLibrary.SmartTextBox txtgrpID;
        private System.Windows.Forms.DateTimePicker dtevDate;
        private AtiqsControlLibrary.SmartLabel smartLabel6;
        private AtiqsControlLibrary.SmartLabel smartLabel3;
        private AtiqsControlLibrary.SmartTextBox txtRemarks;
    }
}


text:
  background-color: #FFFFFF;
  width:170px;
  padding:0px;
  border:1px;
  cursor:pointer;
  border-left:1px solid #cccccc;
  border-top:1px solid #cccccc;
  border-right:1px solid #676767;
  border-bottom:1px solid #676767;
}
#gmap3-menu .item{
  font-family: arial,helvetica,sans-serif;
  font-size: 12px;
  text-align:left;
  line-height: 30px;
  border-left:0px;
  border-top:0px;
  border-right:0px;
  padding-left:30px;
  background-repeat: no-repeat;
  background-position: 4px center;
}
#gmap3-menu .item.itemA{
  background-image: url(images/icon_greenA.png);
}
#gmap3-menu .item.itemB{
  background-image: url(images/icon_greenB.png);
}
#gmap3-menu .item.zoomIn{
  background-image: url(images/zoomin.png);
}
#gmap3-menu .item.zoomOut{
  background-image: url(images/zoomout.png);
}
#gmap3-menu .item.centerHere{
  background-image: url(images/here.png);
}
#gmap3-menu .item.hover{
  background-color: #d6e9f8;
}
#gmap3-menu .item.separator{
  border-bottom:1px solid #cccccc;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools" >

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme">
        <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

        <activity
            android:name="com.myrippleapps.mynotes.app.MyActivity"
            android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity
            android:name="com.myrippleapps.mynotes.app.AddNote"
            android:label="@string/title_activity_add_note"
            android:windowSoftInputMode="adjustResize|stateVisible" />
        <!--<activity-->
        <!--android:label="@string/title_activity_add_note"-->
        <!--android:name="com.myrippleapps.mynotes.app.NewNotes"-->
        <!--android:windowSoftInputMode="adjustResize|stateVisible"/>-->
        <activity
            android:name="com.myrippleapps.mynotes.app.EditNote"
            android:label="@string/title_activity_edit_note"
            android:windowSoftInputMode="adjustResize|stateHidden" />
        <activity
            android:name="com.myrippleapps.mynotes.app.EditArchivedNote"
            android:label="@string/title_activity_edit_archived_note"
            android:windowSoftInputMode="adjustResize|stateHidden" />
        <activity
            android:name="com.myrippleapps.mynotes.app.OpenSourceLibraries"
            android:label="@string/title_activity_open_source_libraries" />
        <activity
            android:name="com.myrippleapps.mynotes.app.SettingActivity"
            android:label="@string/title_activity_setting" />
        <activity
            android:name="com.myrippleapps.mynotes.app.AboutActivity"
            android:label="@string/title_activity_about" />
        <activity
            android:name="com.myrippleapps.mynotes.app.MyIntro"
            android:label="@string/intro_title1" />
        <!--<activity-->
        <!--android:label="RecyclerViewTestActivity"-->
        <!--android:name="android.support.v7.widget.TestActivity"/>-->
        <activity
            android:name="com.google.android.gms.ads.AdActivity"
            android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
            android:theme="@android:style/Theme.Translucent" />
    </application>

</manifest>


text:
"""Controllers related to Oppia improvement tasks."""

from __future__ import annotations

import datetime

from core import feconf
from core.constants import constants
from core.controllers import acl_decorators
from core.controllers import base
from core.controllers import domain_objects_validator
from core.domain import config_domain
from core.domain import exp_fetchers
from core.domain import improvements_domain
from core.domain import improvements_services

class ExplorationImprovementsHandler(base.BaseHandler):
    """Handles operations related to managing exploration improvement tasks.

    NOTE: Only exploration creators and editors can interface with tasks.
    """

    GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON
    URL_PATH_ARGS_SCHEMAS = {
        'exploration_id': {
            'schema': {
                'type': 'basestring',
                'validators': [{
                    'id': 'is_regex_matched',
                    'regex_pattern': constants.ENTITY_ID_REGEX
                }]
            }
        }
    }
    HANDLER_ARGS_SCHEMAS = {
        'GET': {},
        'POST': {
            'task_entries': {
                'schema': {
                    'type': 'list',
                    'items': {
                        'type': 'object_dict',
                        'validation_method': (
                            domain_objects_validator.validate_task_entries
                        )
                    }
                }
            }
        }
    }

    @acl_decorators.can_edit_exploration
    def get(self, exploration_id):
        open_tasks, resolved_task_types_by_state_name = (
            improvements_services.fetch_exploration_tasks(
                exp_fetchers.get_exploration_by_id(exploration_id)))
        self.render_json({
            'open_tasks': [t.to_dict() for t in open_tasks],
            'resolved_task_types_by_state_name': (
                resolved_task_types_by_state_name),
        })

    @acl_decorators.can_edit_exploration
    def post(self, exploration_id):
        task_entries = self.normalized_payload.get('task_entries')
        task_entries_to_put = []
        for task_entry in task_entries:
            entity_version = task_entry['entity_version']
            task_type = task_entry['task_type']
            target_id = task_entry['target_id']
            status = task_entry['status']
            # The issue_description is allowed to be None.
            issue_description = task_entry.get('issue_description', None)
            task_entries_to_put.append(
                improvements_domain.TaskEntry(
                    constants.TASK_ENTITY_TYPE_EXPLORATION,
                    exploration_id,
                    entity_version,
                    task_type,
                    constants.TASK_TARGET_TYPE_STATE,
                    target_id,
                    issue_description,
                    status,
                    self.user_id,
                    datetime.datetime.utcnow()))
        improvements_services.put_tasks(task_entries_to_put)
        self.render_json({})

class ExplorationImprovementsHistoryHandler(base.BaseHandler):
    """Handles fetching the history of resolved exploration tasks.

    NOTE: Only exploration creators and editors can interface with tasks.
    """

    GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON
    URL_PATH_ARGS_SCHEMAS = {
        'exploration_id': {
            'schema': {
                'type': 'basestring',
                'validators': [{
                    'id': 'is_regex_matched',
                    'regex_pattern': constants.ENTITY_ID_REGEX
                }]
            }
        }
    }
    HANDLER_ARGS_SCHEMAS = {
        'GET': {
            'cursor': {
                'schema': {
                    'type': 'basestring'
                },
                'default_value': None
            }
        }
    }

    @acl_decorators.can_edit_exploration
    def get(self, exploration_id):
        urlsafe_start_cursor = self.normalized_request.get('cursor')

        results, new_urlsafe_start_cursor, more = (
            improvements_services.fetch_exploration_task_history_page(
                exp_fetchers.get_exploration_by_id(exploration_id),
                urlsafe_start_cursor=urlsafe_start_cursor))

        self.render_json({
            'results': [t.to_dict() for t in results],
            'cursor': new_urlsafe_start_cursor,
            'more': more,
        })

class ExplorationImprovementsConfigHandler(base.BaseHandler):
    """Handles fetching the configuration of exploration tasks."""

    GET_HANDLER_ERROR_RETURN_TYPE = feconf.HANDLER_TYPE_JSON
    URL_PATH_ARGS_SCHEMAS = {
        'exploration_id': {
            'schema': {
                'type': 'basestring',
                'validators': [{
                    'id': 'is_regex_matched',
                    'regex_pattern': constants.ENTITY_ID_REGEX
                }]
            }
        }
    }
    HANDLER_ARGS_SCHEMAS = {
        'GET': {}
    }

    @acl_decorators.can_edit_exploration
    def get(self, exploration_id):
        self.render_json({
            'exploration_id': exploration_id,
            'exploration_version': (
                exp_fetchers.get_exploration_by_id(exploration_id).version),
            'is_improvements_tab_enabled': (
                config_domain.IS_IMPROVEMENTS_TAB_ENABLED.value),
            'high_bounce_rate_task_state_bounce_rate_creation_threshold': (
                config_domain
                .HIGH_BOUNCE_RATE_TASK_STATE_BOUNCE_RATE_CREATION_THRESHOLD
                .value),
            'high_bounce_rate_task_state_bounce_rate_obsoletion_threshold': (
                config_domain
                .HIGH_BOUNCE_RATE_TASK_STATE_BOUNCE_RATE_OBSOLETION_THRESHOLD
                .value),
            'high_bounce_rate_task_minimum_exploration_starts': (
                config_domain.HIGH_BOUNCE_RATE_TASK_MINIMUM_EXPLORATION_STARTS
                .value),
        })


text:
import tensorflow as tf
from model import QFunction
from pr import PrioritizedReplayBuf
import collections
import numpy as np
import random

def copy_params(src, dst):
    src_params = [v for v in tf.trainable_variables() if v.name.startswith(src.scope)]
    dst_params = [v for v in tf.trainable_variables() if v.name.startswith(dst.scope)]

    op = [d.assign(s) for s, d in zip(src_params, dst_params)]

    return op

def Hurber_loss(x, y, delta=1.0):
    error = tf.abs(y - x)
    cond = tf.less(error, delta)
    return tf.where(cond,
                    0.5*tf.square(error),
                    delta*error - 0.5*tf.square(delta))

class DDQN_PR:
    def __init__(self, input_shape, action_n, N, alpha=0.5, beta=0.5, beta_decay=50000, gamma=0.99):
        self.shape = input_shape
        self.batch_size = input_shape[0]

        # Prioritized Replay Memory
        self.pr = PrioritizedReplayBuf(N=N,
                                       alpha=alpha,
                                       beta=beta, beta_decay=beta_decay,
                                       batch_size=self.batch_size)
        # Importance Sampling weights
        self.is_w = tf.placeholder(shape=[self.batch_size, 1], dtype=tf.float32)

        Q = QFunction(input_shape, action_n, scope="Q")
        target_Q = QFunction(input_shape, action_n, scope="target_Q")

        # Forward Q
        self.s = tf.placeholder(shape=[None]+input_shape[1:], dtype=tf.float32)
        self.a = tf.placeholder(shape=[self.batch_size, 1], dtype=tf.int32)
        self.probs = Q(self.s, s_bias=False)

        # add offset
        first = tf.expand_dims(tf.range(self.batch_size), axis=1)
        indices = tf.concat(values=[first, self.a], concat_dim=1)
        # gather corresiponding q_vals
        self.q_val = tf.expand_dims(tf.gather_nd(self.probs, indices), axis=1)

        # TD target
        self.done = tf.placeholder(shape=[self.batch_size, 1], dtype=tf.float32)
        self.r = tf.placeholder(shape=[self.batch_size, 1], dtype=tf.float32)
        self.s_ = tf.placeholder(shape=input_shape, dtype=tf.float32)

        # D-DQN
        a_max = tf.expand_dims(tf.argmax(Q(self.s_, reuse=True), axis=1), axis=1)
        a_max = tf.to_int32(a_max)
        target_q_val = tf.expand_dims(
            tf.gather_nd(target_Q(self.s_),
                         tf.concat(values=[first, a_max], concat_dim=1))
            , axis=1)
        self.y = self.r + gamma*(1.0 - self.done)*target_q_val
        # Error Clipping
        # TD-error
        self.delta = Hurber_loss(self.q_val, self.y)
        # Importance sampling
        max_is = tf.reduce_max(self.is_w)
        self.loss = tf.reduce_mean( (self.is_w / max_is)  * self.delta)

        # Update Q
        # reducing step-size by a factor of four
        opt = tf.train.RMSPropOptimizer(0.00025/4, 0.99, 0.0, 1e-6)
        grads_and_vars = opt.compute_gradients(self.loss)
        grads_and_vars = [[grad, var] for grad, var in grads_and_vars \
                          if grad is not None and (var.name.startswith("Q") or var.name.startswith("shared"))]
        self.train_op = opt.apply_gradients(grads_and_vars)

        # Update target Q
        self.target_train_op = copy_params(Q, target_Q)

    def update_target(self, sess):
        _ = sess.run(self.target_train_op)

    def update(self, sess):
        # sample from replay buffer
        d, is_w = self.pr.stratified_sample()
        is_w = np.expand_dims(is_w, axis=1)
        samples = [ e['transition']for e in d]

        s = np.asarray([sample[0] for sample in samples], dtype=np.float32)
        a = np.asarray([[sample[1]] for sample in samples], dtype=np.int32)
        r = np.asarray([[sample[2]] for sample in samples], dtype=np.float32)
        done = np.asarray([[sample[3]] for sample in samples], dtype=np.float32)
        s_ = np.asarray([sample[4] for sample in samples], dtype=np.float32)

        feed={self.s:s, self.a:a, self.r:r, self.done:done, self.s_:s_, self.is_w:is_w}
        _, delta = sess.run([self.train_op, self.delta], feed_dict=feed)

        self.pr.update_delta(d, delta)

    def greedy(self, s, sess):
        probs = sess.run( self.probs, feed_dict={self.s:s})
        return np.argmax(probs)

    def set_exp(self, exp, init=False):
        self.pr.insert(exp, init)


text:
package org.fxmisc.richtext;

import java.text.BreakIterator;
import java.util.Collection;

import javafx.beans.NamedArg;
import org.fxmisc.richtext.model.EditableStyledDocument;

/**
 * A convenience subclass of {@link StyleClassedTextArea} with fixed-width font and an undo manager that observes
 * only plain text changes (not styled changes). It's style class is {@code code-area}.
 */
public class CodeArea extends StyleClassedTextArea {

    {
        getStyleClass().add("code-area");

        // load the default style that defines a fixed-width font
        getStylesheets().add(CodeArea.class.getResource("code-area.css").toExternalForm());

        // don't apply preceding style to typed text
        setUseInitialStyleForInsertion(true);
    }

    /**
     * Creates an area that can render and edit the same {@link EditableStyledDocument} as another {@link CodeArea}.
     */
    public CodeArea(@NamedArg("document") EditableStyledDocument<Collection<String>, String, Collection<String>> document) {
        super(document, false);
    }

    /**
     * Creates an area with no text.
     */
    public CodeArea() {
        super(false);
    }

    /**
     * Creates a text area with initial text content.
     * Initial caret position is set at the beginning of text content.
     *
     * @param text Initial text content.
     */
    public CodeArea(@NamedArg("text") String text) {
        this();

        appendText(text);
        getUndoManager().forgetHistory();
        getUndoManager().mark();

        // position the caret at the beginning
        selectRange(0, 0);
    }

    @Override // to select words containing underscores
    public void selectWord()
    {
        if ( getLength() == 0 ) return;

        CaretSelectionBind<?,?,?> csb = getCaretSelectionBind();
        int paragraph = csb.getParagraphIndex();
        int position = csb.getColumnPosition();

        String paragraphText = getText( paragraph );
        BreakIterator breakIterator = BreakIterator.getWordInstance( getLocale() );
        breakIterator.setText( paragraphText );

        breakIterator.preceding( position );
        int start = breakIterator.current();

        while ( start > 0 && paragraphText.charAt( start-1 ) == '_' )
        {
            if ( --start > 0 && ! breakIterator.isBoundary( start-1 ) )
            {
                breakIterator.preceding( start );
                start = breakIterator.current();
            }
        }

        breakIterator.following( position );
        int end = breakIterator.current();
        int len = paragraphText.length();

        while ( end < len && paragraphText.charAt( end ) == '_' )
        {
            if ( ++end < len && ! breakIterator.isBoundary( end+1 ) )
            {
                breakIterator.following( end );
                end = breakIterator.current();
            }
            // For some reason single digits aren't picked up so ....
            else if ( Character.isDigit( paragraphText.charAt( end ) ) )
            {
                end++;
            }
        }

        csb.selectRange( paragraph, start, paragraph, end );
    }
}


text:
package x7c1.wheat.modern.database.selector.presets

import android.database.{Cursor, SQLException}
import x7c1.wheat.macros.database.Query
import x7c1.wheat.modern.database.selector.{CanIdentify, CursorReadable, CursorReifiable}

import scala.language.{higherKinds, reflectiveCalls}

abstract class CanTraverseEntity[
  I[T] <: CanIdentify[T],
  FROM: CursorReifiable: ({ type L[T] = CanTraverseBySelect[I, T] })#L,
  TO: ({ type L[T] = CursorReadable[FROM, T] })#L
] extends CanTraverseBySelect[I, TO]{

  override def queryAbout[X: I](target: X): Query = {
    implicitly[CanTraverseBySelect[I, FROM]] queryAbout target
  }
  override def fromCursor(cursor: Cursor): Either[SQLException, ClosableSequence[TO]] = {
    val sequence = ClosableSequence[FROM, TO](cursor)
    Right(sequence)
  }
}


text:
package org.apache.activemq.artemis.jms.client;

import javax.jms.QueueConnectionFactory;

import org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration;
import org.apache.activemq.artemis.api.core.TransportConfiguration;
import org.apache.activemq.artemis.api.core.client.ServerLocator;
import org.apache.activemq.artemis.api.jms.JMSFactoryType;

/**
 * {@inheritDoc}
 */
public class ActiveMQQueueConnectionFactory extends ActiveMQConnectionFactory implements QueueConnectionFactory {

   private static final long serialVersionUID = 5312455021322463546L;

   public ActiveMQQueueConnectionFactory() {
      super();
   }

   public ActiveMQQueueConnectionFactory(String url) {
      super(url);
   }

   public ActiveMQQueueConnectionFactory(ServerLocator serverLocator) {
      super(serverLocator);
   }

   public ActiveMQQueueConnectionFactory(boolean ha, final DiscoveryGroupConfiguration groupConfiguration) {
      super(ha, groupConfiguration);
   }

   public ActiveMQQueueConnectionFactory(String url, String user, String password) {
      super(url, user, password);
   }

   public ActiveMQQueueConnectionFactory(boolean ha, TransportConfiguration... initialConnectors) {
      super(ha, initialConnectors);
   }

   public int getFactoryType() {
      return JMSFactoryType.QUEUE_CF.intValue();
   }
}


text:
function SchemaVisitor() {
};

SchemaVisitor.prototype = {
    startVisiting : function(name) {
    },
    endVisiting : function(name) {
    },
    arrayItemEncountered : function(typeName) {
    },
    objectEncountered : function(name, isArray) {
    },
    stringPropEncountered : function(name, enumValues) {
    },
    otherPropEncountered : function(name) {
    },
    toUpperName : function(propertyName) {
        return propertyName.charAt(0).toUpperCase() + propertyName.slice(1);
    },
    toSingular : function(propertyName) {
        if(propertyName.charAt(propertyName.length - 1) === 's') {
            if(propertyName.charAt(propertyName.length - 2) === 'e') {
                if(propertyName.charAt(propertyName.length - 3) === 's') {
                    return propertyName.slice(0, propertyName.length - 2);
                }
            }

            return propertyName.slice(0, propertyName.length - 1);
        }
        return propertyName;
    }
};

module.exports = SchemaVisitor;


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

namespace XenAdmin.Core
{
    public interface INotifyCollectionChanged
    {
        event CollectionChangeEventHandler CollectionChanged;
        event EventHandler BatchCollectionChanged;
        void OnBatchCollectionChanged();
    }
}


text:
// .NAME vtkTubeFilter - filter that generates tubes around lines
// .SECTION Description
// vtkTubeFilter is a filter that generates a tube around each input line.
// The tubes are made up of triangle strips and rotate around the tube with
// the rotation of the line normals. (If no normals are present, they are
// computed automatically.) The radius of the tube can be set to vary with
// scalar or vector value. If the radius varies with scalar value the radius
// is linearly adjusted. If the radius varies with vector value, a mass
// flux preserving variation is used. The number of sides for the tube also
// can be specified. You can also specify which of the sides are visible. This
// is useful for generating interesting striping effects. Other options
// include the ability to cap the tube and generate texture coordinates.
// Texture coordinates can be used with an associated texture map to create
// interesting effects such as marking the tube with stripes corresponding
// to length or time.
//
// This filter is typically used to create thick or dramatic lines. Another
// common use is to combine this filter with vtkStreamLine to generate
// streamtubes.

// .SECTION Caveats
// The number of tube sides must be greater than 3. If you wish to use fewer
// sides (i.e., a ribbon), use vtkRibbonFilter.
//
// The input line must not have duplicate points, or normals at points that
// are parallel to the incoming/outgoing line segments. (Duplicate points
// can be removed with vtkCleanPolyData.) If a line does not meet this
// criteria, then that line is not tubed.

// .SECTION See Also
// vtkRibbonFilter vtkStreamLine

// .SECTION Thanks
// Michael Finch for absolute scalar radius

#ifndef __vtkTubeFilter_h
#define __vtkTubeFilter_h

#include "vtkPolyDataAlgorithm.h"

#define VTK_VARY_RADIUS_OFF 0
#define VTK_VARY_RADIUS_BY_SCALAR 1
#define VTK_VARY_RADIUS_BY_VECTOR 2
#define VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR 3

#define VTK_TCOORDS_OFF                    0
#define VTK_TCOORDS_FROM_NORMALIZED_LENGTH 1
#define VTK_TCOORDS_FROM_LENGTH            2
#define VTK_TCOORDS_FROM_SCALARS           3

class vtkCellArray;
class vtkCellData;
class vtkDataArray;
class vtkFloatArray;
class vtkPointData;
class vtkPoints;

class VTK_GRAPHICS_EXPORT vtkTubeFilter : public vtkPolyDataAlgorithm
{
public:
  vtkTypeMacro(vtkTubeFilter,vtkPolyDataAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Construct object with radius 0.5, radius variation turned off, the
  // number of sides set to 3, and radius factor of 10.
  static vtkTubeFilter *New();

  // Description:
  // Set the minimum tube radius (minimum because the tube radius may vary).
  vtkSetClampMacro(Radius,double,0.0,VTK_DOUBLE_MAX);
  vtkGetMacro(Radius,double);

  // Description:
  // Turn on/off the variation of tube radius with scalar value.
  vtkSetClampMacro(VaryRadius,int,
                   VTK_VARY_RADIUS_OFF,VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);
  vtkGetMacro(VaryRadius,int);
  void SetVaryRadiusToVaryRadiusOff()
    {this->SetVaryRadius(VTK_VARY_RADIUS_OFF);};
  void SetVaryRadiusToVaryRadiusByScalar()
    {this->SetVaryRadius(VTK_VARY_RADIUS_BY_SCALAR);};
  void SetVaryRadiusToVaryRadiusByVector()
    {this->SetVaryRadius(VTK_VARY_RADIUS_BY_VECTOR);};
  void SetVaryRadiusToVaryRadiusByAbsoluteScalar()
    {this->SetVaryRadius(VTK_VARY_RADIUS_BY_ABSOLUTE_SCALAR);};
  const char *GetVaryRadiusAsString();

  // Description:
  // Set the number of sides for the tube. At a minimum, number of sides is 3.
  vtkSetClampMacro(NumberOfSides,int,3,VTK_LARGE_INTEGER);
  vtkGetMacro(NumberOfSides,int);

  // Description:
  // Set the maximum tube radius in terms of a multiple of the minimum radius.
  vtkSetMacro(RadiusFactor,double);
  vtkGetMacro(RadiusFactor,double);

  // Description:
  // Set the default normal to use if no normals are supplied, and the
  // DefaultNormalOn is set.
  vtkSetVector3Macro(DefaultNormal,double);
  vtkGetVectorMacro(DefaultNormal,double,3);

  // Description:
  // Set a boolean to control whether to use default normals.
  // DefaultNormalOn is set.
  vtkSetMacro(UseDefaultNormal,int);
  vtkGetMacro(UseDefaultNormal,int);
  vtkBooleanMacro(UseDefaultNormal,int);

  // Description:
  // Set a boolean to control whether tube sides should share vertices.
  // This creates independent strips, with constant normals so the
  // tube is always faceted in appearance.
  vtkSetMacro(SidesShareVertices, int);
  vtkGetMacro(SidesShareVertices, int);
  vtkBooleanMacro(SidesShareVertices, int);

  // Description:
  // Turn on/off whether to cap the ends with polygons.
  vtkSetMacro(Capping,int);
  vtkGetMacro(Capping,int);
  vtkBooleanMacro(Capping,int);

  // Description:
  // Control the striping of the tubes. If OnRatio is greater than 1,
  // then every nth tube side is turned on, beginning with the Offset
  // side.
  vtkSetClampMacro(OnRatio,int,1,VTK_LARGE_INTEGER);
  vtkGetMacro(OnRatio,int);

  // Description:
  // Control the striping of the tubes. The offset sets the
  // first tube side that is visible. Offset is generally used with
  // OnRatio to create nifty striping effects.
  vtkSetClampMacro(Offset,int,0,VTK_LARGE_INTEGER);
  vtkGetMacro(Offset,int);

  // Description:
  // Control whether and how texture coordinates are produced. This is
  // useful for striping the tube with length textures, etc. If you
  // use scalars to create the texture, the scalars are assumed to be
  // monotonically increasing (or decreasing).
  vtkSetClampMacro(GenerateTCoords,int,VTK_TCOORDS_OFF,
                   VTK_TCOORDS_FROM_SCALARS);
  vtkGetMacro(GenerateTCoords,int);
  void SetGenerateTCoordsToOff()
    {this->SetGenerateTCoords(VTK_TCOORDS_OFF);}
  void SetGenerateTCoordsToNormalizedLength()
    {this->SetGenerateTCoords(VTK_TCOORDS_FROM_NORMALIZED_LENGTH);}
  void SetGenerateTCoordsToUseLength()
    {this->SetGenerateTCoords(VTK_TCOORDS_FROM_LENGTH);}
  void SetGenerateTCoordsToUseScalars()
    {this->SetGenerateTCoords(VTK_TCOORDS_FROM_SCALARS);}
  const char *GetGenerateTCoordsAsString();

  // Description:
  // Control the conversion of units during the texture coordinates
  // calculation. The TextureLength indicates what length (whether
  // calculated from scalars or length) is mapped to the [0,1)
  // texture space.
  vtkSetClampMacro(TextureLength,double,0.000001,VTK_LARGE_INTEGER);
  vtkGetMacro(TextureLength,double);

protected:
  vtkTubeFilter();
  ~vtkTubeFilter() {}

  // Usual data generation method
  int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *);

  double Radius; //minimum radius of tube
  int VaryRadius; //controls radius variation
  int NumberOfSides; //number of sides to create tube
  double RadiusFactor; //maxium allowablew radius
  double DefaultNormal[3];
  int UseDefaultNormal;
  int SidesShareVertices;
  int Capping; //control whether tubes are capped
  int OnRatio; //control the generation of the sides of the tube
  int Offset;  //control the generation of the sides
  int GenerateTCoords; //control texture coordinate generation
  double TextureLength; //this length is mapped to [0,1) texture space

  // Helper methods
  int GeneratePoints(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
                     vtkPoints *inPts, vtkPoints *newPts,
                     vtkPointData *pd, vtkPointData *outPD,
                     vtkFloatArray *newNormals, vtkDataArray *inScalars,
                     double range[2], vtkDataArray *inVectors, double maxNorm,
                     vtkDataArray *inNormals);
  void GenerateStrips(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
                      vtkIdType inCellId, vtkCellData *cd, vtkCellData *outCD,
                      vtkCellArray *newStrips);
  void GenerateTextureCoords(vtkIdType offset, vtkIdType npts, vtkIdType *pts,
                             vtkPoints *inPts, vtkDataArray *inScalars,
                            vtkFloatArray *newTCoords);
  vtkIdType ComputeOffset(vtkIdType offset,vtkIdType npts);

  // Helper data members
  double Theta;

private:
  vtkTubeFilter(const vtkTubeFilter&);  // Not implemented.
  void operator=(const vtkTubeFilter&);  // Not implemented.
};

#endif


text:
package me.nithanim.gw2api.v2.api.files;

import javax.ws.rs.client.WebTarget;

import me.nithanim.gw2api.v2.util.rest.DataUtil;
import me.nithanim.gw2api.v2.util.rest.RequestHelper;

public class FilesResourceImpl implements FilesResource {
  private final WebTarget webTarget;

  public FilesResourceImpl(WebTarget webResource) {
    this.webTarget = webResource.path("files");
  }

  @Override
  public String[] getOverview() {
    return RequestHelper.INSTANCE.getRequest(webTarget, String[].class);
  }

  @Override
  public File get(String id) {
    return RequestHelper.INSTANCE.getRequest(webTarget.path(String.valueOf(id)), File.class);
  }

  @Override
  public File[] get(String[] ids) {
    return RequestHelper.INSTANCE.getRequest(
        webTarget, File[].class, "ids", DataUtil.stringstsToCommaSeparatedString(ids));
  }

  @Override
  public File[] getAll() {
    return RequestHelper.INSTANCE.getRequest(webTarget, File[].class, "ids", "all");
  }
}


text:
package com.jk.util.exceptions.handler;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * The Interface ExceptionHandler.
 *
 * @author Jalal Kiswani
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface ExceptionHandler {

}


text:
import {Inject, Injectable, OpaqueToken} from 'angular2/src/core/di';
import {AnimationBuilder} from 'angular2/src/animate/animation_builder';
import {
  isPresent,
  isBlank,
  RegExpWrapper,
  CONST_EXPR,
  stringify
} from 'angular2/src/core/facade/lang';
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';

import {DOM} from 'angular2/src/core/dom/dom_adapter';

import {EventManager} from './events/event_manager';

import {DomSharedStylesHost} from './shared_styles_host';
import {WtfScopeFn, wtfLeave, wtfCreateScope} from '../../profile/profile';

import {
  Renderer,
  RenderProtoViewRef,
  RenderViewRef,
  RenderElementRef,
  RenderFragmentRef,
  RenderViewWithFragments,
  RenderTemplateCmd,
  RenderEventDispatcher
} from '../api';

import {DOCUMENT} from './dom_tokens';
import {createRenderView, NodeFactory} from '../view_factory';
import {DefaultRenderView, DefaultRenderFragmentRef, DefaultProtoViewRef} from '../view';
import {camelCaseToDashCase} from './util';

// TODO(tbosch): solve SVG properly once https://github.com/angular/angular/issues/4417 is done
const XLINK_NAMESPACE = 'http://www.w3.org/1999/xlink';
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
const SVG_ELEMENT_NAMES = CONST_EXPR({
  'altGlyph': true,
  'altGlyphDef': true,
  'altGlyphItem': true,
  'animate': true,
  'animateColor': true,
  'animateMotion': true,
  'animateTransform': true,
  'circle': true,
  'clipPath': true,
  'color-profile': true,
  'cursor': true,
  'defs': true,
  'desc': true,
  'ellipse': true,
  'feBlend': true,
  'feColorMatrix': true,
  'feComponentTransfer': true,
  'feComposite': true,
  'feConvolveMatrix': true,
  'feDiffuseLighting': true,
  'feDisplacementMap': true,
  'feDistantLight': true,
  'feFlood': true,
  'feFuncA': true,
  'feFuncB': true,
  'feFuncG': true,
  'feFuncR': true,
  'feGaussianBlur': true,
  'feImage': true,
  'feMerge': true,
  'feMergeNode': true,
  'feMorphology': true,
  'feOffset': true,
  'fePointLight': true,
  'feSpecularLighting': true,
  'feSpotLight': true,
  'feTile': true,
  'feTurbulence': true,
  'filter': true,
  'font': true,
  'font-face': true,
  'font-face-format': true,
  'font-face-name': true,
  'font-face-src': true,
  'font-face-uri': true,
  'foreignObject': true,
  'g': true,
  'glyph': true,
  'glyphRef': true,
  'hkern': true,
  'image': true,
  'line': true,
  'linearGradient': true,
  'marker': true,
  'mask': true,
  'metadata': true,
  'missing-glyph': true,
  'mpath': true,
  'path': true,
  'pattern': true,
  'polygon': true,
  'polyline': true,
  'radialGradient': true,
  'rect': true,
  'set': true,
  'stop': true,
  'style': true,
  'svg': true,
  'switch': true,
  'symbol': true,
  'text': true,
  'textPath': true,
  'title': true,
  'tref': true,
  'tspan': true,
  'use': true,
  'view': true,
  'vkern': true
});

const SVG_ATTR_NAMESPACES = CONST_EXPR({'href': XLINK_NAMESPACE, 'xlink:href': XLINK_NAMESPACE});

export abstract class DomRenderer extends Renderer implements NodeFactory<Node> {
  abstract registerComponentTemplate(templateId: number, commands: RenderTemplateCmd[],
                                     styles: string[], nativeShadow: boolean);

  abstract resolveComponentTemplate(templateId: number): RenderTemplateCmd[];

  createProtoView(cmds: RenderTemplateCmd[]): RenderProtoViewRef {
    return new DefaultProtoViewRef(cmds);
  }

  abstract createRootHostView(hostProtoViewRef: RenderProtoViewRef, fragmentCount: number,
                              hostElementSelector: string): RenderViewWithFragments;

  abstract createView(protoViewRef: RenderProtoViewRef,
                      fragmentCount: number): RenderViewWithFragments;

  abstract destroyView(viewRef: RenderViewRef);

  abstract createRootContentInsertionPoint();

  getNativeElementSync(location: RenderElementRef): any {
    return resolveInternalDomView(location.renderView).boundElements[location.boundElementIndex];
  }

  getRootNodes(fragment: RenderFragmentRef): Node[] { return resolveInternalDomFragment(fragment); }

  attachFragmentAfterFragment(previousFragmentRef: RenderFragmentRef,
                              fragmentRef: RenderFragmentRef) {
    var previousFragmentNodes = resolveInternalDomFragment(previousFragmentRef);
    if (previousFragmentNodes.length > 0) {
      var sibling = previousFragmentNodes[previousFragmentNodes.length - 1];
      let nodes = resolveInternalDomFragment(fragmentRef);
      moveNodesAfterSibling(sibling, nodes);
      this.animateNodesEnter(nodes);
    }
  }

  /**
   * Iterates through all nodes being added to the DOM and animates them if necessary
   * @param nodes
   */
  animateNodesEnter(nodes: Node[]) {
    for (let i = 0; i < nodes.length; i++) this.animateNodeEnter(nodes[i]);
  }

  /**
   * Performs animations if necessary
   * @param node
   */
  abstract animateNodeEnter(node: Node);

  /**
   * If animations are necessary, performs animations then removes the element; otherwise, it just
   * removes the element.
   * @param node
   */
  abstract animateNodeLeave(node: Node);

  attachFragmentAfterElement(elementRef: RenderElementRef, fragmentRef: RenderFragmentRef) {
    var parentView = resolveInternalDomView(elementRef.renderView);
    var element = parentView.boundElements[elementRef.boundElementIndex];
    var nodes = resolveInternalDomFragment(fragmentRef);
    moveNodesAfterSibling(element, nodes);
    this.animateNodesEnter(nodes);
  }

  abstract detachFragment(fragmentRef: RenderFragmentRef);

  hydrateView(viewRef: RenderViewRef) { resolveInternalDomView(viewRef).hydrate(); }

  dehydrateView(viewRef: RenderViewRef) { resolveInternalDomView(viewRef).dehydrate(); }

  createTemplateAnchor(attrNameAndValues: string[]): Node {
    return this.createElement('script', attrNameAndValues);
  }
  abstract createElement(name: string, attrNameAndValues: string[]): Node;
  abstract mergeElement(existing: Node, attrNameAndValues: string[]);
  abstract createShadowRoot(host: Node, templateId: number): Node;
  createText(value: string): Node { return DOM.createTextNode(isPresent(value) ? value : ''); }
  appendChild(parent: Node, child: Node) { DOM.appendChild(parent, child); }
  abstract on(element: Node, eventName: string, callback: Function);
  abstract globalOn(target: string, eventName: string, callback: Function): Function;

  setElementProperty(location: RenderElementRef, propertyName: string, propertyValue: any): void {
    var view = resolveInternalDomView(location.renderView);
    DOM.setProperty(<Element>view.boundElements[location.boundElementIndex], propertyName,
                    propertyValue);
  }

  setElementAttribute(location: RenderElementRef, attributeName: string,
                      attributeValue: string): void {
    var view = resolveInternalDomView(location.renderView);
    var element = view.boundElements[location.boundElementIndex];
    var dashCasedAttributeName = camelCaseToDashCase(attributeName);
    if (isPresent(attributeValue)) {
      DOM.setAttribute(element, dashCasedAttributeName, stringify(attributeValue));
    } else {
      DOM.removeAttribute(element, dashCasedAttributeName);
    }
  }

  setElementClass(location: RenderElementRef, className: string, isAdd: boolean): void {
    var view = resolveInternalDomView(location.renderView);
    var element = view.boundElements[location.boundElementIndex];
    if (isAdd) {
      DOM.addClass(element, className);
    } else {
      DOM.removeClass(element, className);
    }
  }

  setElementStyle(location: RenderElementRef, styleName: string, styleValue: string): void {
    var view = resolveInternalDomView(location.renderView);
    var element = view.boundElements[location.boundElementIndex];
    var dashCasedStyleName = camelCaseToDashCase(styleName);
    if (isPresent(styleValue)) {
      DOM.setStyle(element, dashCasedStyleName, stringify(styleValue));
    } else {
      DOM.removeStyle(element, dashCasedStyleName);
    }
  }

  invokeElementMethod(location: RenderElementRef, methodName: string, args: any[]): void {
    var view = resolveInternalDomView(location.renderView);
    var element = <Element>view.boundElements[location.boundElementIndex];
    DOM.invoke(element, methodName, args);
  }

  setText(viewRef: RenderViewRef, textNodeIndex: number, text: string): void {
    var view = resolveInternalDomView(viewRef);
    DOM.setText(view.boundTextNodes[textNodeIndex], text);
  }

  setEventDispatcher(viewRef: RenderViewRef, dispatcher: RenderEventDispatcher): void {
    resolveInternalDomView(viewRef).setEventDispatcher(dispatcher);
  }
}

@Injectable()
export class DomRenderer_ extends DomRenderer {
  private _componentCmds: Map<number, RenderTemplateCmd[]> = new Map<number, RenderTemplateCmd[]>();
  private _nativeShadowStyles: Map<number, string[]> = new Map<number, string[]>();
  private _document;

  constructor(private _eventManager: EventManager,
              private _domSharedStylesHost: DomSharedStylesHost, private _animate: AnimationBuilder,
              @Inject(DOCUMENT) document) {
    super();
    this._document = document;
  }

  registerComponentTemplate(templateId: number, commands: RenderTemplateCmd[], styles: string[],
                            nativeShadow: boolean) {
    this._componentCmds.set(templateId, commands);
    if (nativeShadow) {
      this._nativeShadowStyles.set(templateId, styles);
    } else {
      this._domSharedStylesHost.addStyles(styles);
    }
  }

  resolveComponentTemplate(templateId: number): RenderTemplateCmd[] {
    return this._componentCmds.get(templateId);
  }

  /** @internal */
  _createRootHostViewScope: WtfScopeFn = wtfCreateScope('DomRenderer#createRootHostView()');
  createRootHostView(hostProtoViewRef: RenderProtoViewRef, fragmentCount: number,
                     hostElementSelector: string): RenderViewWithFragments {
    var s = this._createRootHostViewScope();
    var element = DOM.querySelector(this._document, hostElementSelector);
    if (isBlank(element)) {
      wtfLeave(s);
      throw new BaseException(`The selector "${hostElementSelector}" did not match any elements`);
    }
    return wtfLeave(s, this._createView(hostProtoViewRef, element));
  }

  /** @internal */
  _createViewScope = wtfCreateScope('DomRenderer#createView()');
  createView(protoViewRef: RenderProtoViewRef, fragmentCount: number): RenderViewWithFragments {
    var s = this._createViewScope();
    return wtfLeave(s, this._createView(protoViewRef, null));
  }

  private _createView(protoViewRef: RenderProtoViewRef,
                      inplaceElement: HTMLElement): RenderViewWithFragments {
    var view = createRenderView((<DefaultProtoViewRef>protoViewRef).cmds, inplaceElement, this);
    var sdRoots = view.nativeShadowRoots;
    for (var i = 0; i < sdRoots.length; i++) {
      this._domSharedStylesHost.addHost(sdRoots[i]);
    }
    return new RenderViewWithFragments(view, view.fragments);
  }

  destroyView(viewRef: RenderViewRef) {
    var view = <DefaultRenderView<Node>>viewRef;
    var sdRoots = view.nativeShadowRoots;
    for (var i = 0; i < sdRoots.length; i++) {
      this._domSharedStylesHost.removeHost(sdRoots[i]);
    }
  }

  animateNodeEnter(node: Node) {
    if (DOM.isElementNode(node) && DOM.hasClass(node, 'ng-animate')) {
      DOM.addClass(node, 'ng-enter');
      this._animate.css()
          .addAnimationClass('ng-enter-active')
          .start(<HTMLElement>node)
          .onComplete(() => { DOM.removeClass(node, 'ng-enter'); });
    }
  }

  animateNodeLeave(node: Node) {
    if (DOM.isElementNode(node) && DOM.hasClass(node, 'ng-animate')) {
      DOM.addClass(node, 'ng-leave');
      this._animate.css()
          .addAnimationClass('ng-leave-active')
          .start(<HTMLElement>node)
          .onComplete(() => {
            DOM.removeClass(node, 'ng-leave');
            DOM.remove(node);
          });
    } else {
      DOM.remove(node);
    }
  }

  /** @internal */
  _detachFragmentScope = wtfCreateScope('DomRenderer#detachFragment()');
  detachFragment(fragmentRef: RenderFragmentRef) {
    var s = this._detachFragmentScope();
    var fragmentNodes = resolveInternalDomFragment(fragmentRef);
    for (var i = 0; i < fragmentNodes.length; i++) {
      this.animateNodeLeave(fragmentNodes[i]);
    }
    wtfLeave(s);
  }
  createElement(name: string, attrNameAndValues: string[]): Node {
    var isSvg = SVG_ELEMENT_NAMES[name] == true;
    var el = isSvg ? DOM.createElementNS(SVG_NAMESPACE, name) : DOM.createElement(name);
    this._setAttributes(el, attrNameAndValues, isSvg);
    return el;
  }
  mergeElement(existing: Node, attrNameAndValues: string[]) {
    DOM.clearNodes(existing);
    this._setAttributes(existing, attrNameAndValues, false);
  }
  private _setAttributes(node: Node, attrNameAndValues: string[], isSvg: boolean) {
    for (var attrIdx = 0; attrIdx < attrNameAndValues.length; attrIdx += 2) {
      var attrName = attrNameAndValues[attrIdx];
      var attrValue = attrNameAndValues[attrIdx + 1];
      var attrNs = isSvg ? SVG_ATTR_NAMESPACES[attrName] : null;
      if (isPresent(attrNs)) {
        DOM.setAttributeNS(node, XLINK_NAMESPACE, attrName, attrValue);
      } else {
        DOM.setAttribute(node, attrName, attrValue);
      }
    }
  }
  createRootContentInsertionPoint(): Node {
    return DOM.createComment('root-content-insertion-point');
  }
  createShadowRoot(host: Node, templateId: number): Node {
    var sr = DOM.createShadowRoot(host);
    var styles = this._nativeShadowStyles.get(templateId);
    for (var i = 0; i < styles.length; i++) {
      DOM.appendChild(sr, DOM.createStyleElement(styles[i]));
    }
    return sr;
  }
  on(element: Node, eventName: string, callback: Function) {
    this._eventManager.addEventListener(<HTMLElement>element, eventName,
                                        decoratePreventDefault(callback));
  }
  globalOn(target: string, eventName: string, callback: Function): Function {
    return this._eventManager.addGlobalEventListener(target, eventName,
                                                     decoratePreventDefault(callback));
  }
}

function resolveInternalDomView(viewRef: RenderViewRef): DefaultRenderView<Node> {
  return <DefaultRenderView<Node>>viewRef;
}

function resolveInternalDomFragment(fragmentRef: RenderFragmentRef): Node[] {
  return (<DefaultRenderFragmentRef<Node>>fragmentRef).nodes;
}

function moveNodesAfterSibling(sibling, nodes) {
  if (nodes.length > 0 && isPresent(DOM.parentElement(sibling))) {
    for (var i = 0; i < nodes.length; i++) {
      DOM.insertBefore(sibling, nodes[i]);
    }
    DOM.insertBefore(nodes[0], sibling);
  }
}

function decoratePreventDefault(eventHandler: Function): Function {
  return (event) => {
    var allowDefaultBehavior = eventHandler(event);
    if (!allowDefaultBehavior) {
      // TODO(tbosch): move preventDefault into event plugins...
      DOM.preventDefault(event);
    }
  };
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>The GNU C Library: Memory</title>

<meta name="description" content="The GNU C Library: Memory">
<meta name="keywords" content="The GNU C Library: Memory">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="index.html#Top" rel="up" title="Top">
<link href="Memory-Concepts.html#Memory-Concepts" rel="next" title="Memory Concepts">
<link href="Error-Messages.html#Error-Messages" rel="prev" title="Error Messages">

Next: Character Handling, Previous: Error Reporting, Up: Top   [Contents][Index]

3 Virtual Memory Allocation And Paging

This chapter describes how processes manage and use memory in a system
that uses the GNU C Library.

The GNU C Library has several functions for dynamically allocating
virtual memory in various ways.  They vary in generality and in
efficiency.  The library also provides functions for controlling paging
and allocation of real memory.

• Memory Concepts:	  	An introduction to concepts and terminology.

• Memory Allocation:	  	Allocating storage for your program data

• Resizing the Data Segment:	  	brk, sbrk

• Locking Pages:	  	Preventing page faults

Memory mapped I/O is not discussed in this chapter.  See Memory-mapped I/O.


text:
class Braces {
  void m() {
    final var <caret>isEqualsVoorSyncResync = this instanceof A ? isEqual2() : isEqual();//keep me
  }

  private boolean isEqual() {
    return false;
  }

  private boolean isEqual2() {
    return false;
  }
}


text:
A very simple JS game, where you connect the dots, to make a shape.

## Description

A JS game, built using EaselJS, where you drag a turtle on screen to connect dots to form shapes.

## Installation

Either:

1. [Download the repo](https://help.github.com/articles/fetching-a-remote/#clone) as a ZIP file, and extract to a location on your local machine. Open index.html in the root directory of the branch in your favourite browser.

2. [Clone the repo](https://help.github.com/articles/fetching-a-remote/#clone) using Git: `git clone https://github.com/sugarlabs/connectthedots.git`. Open index.html in the root directory of the cloned branch in your favourite browser.

3. Fork this repo, and run the game using GitHub Pages, building it from the master branch. For more information, read [this article](https://help.github.com/articles/configuring-a-publishing-source-for-github-pages/)

Once you have opened the game, follow the on-screen instructions

## Support

Please open an issue [here](https://github.com/sugarlabs/connectthedots/issues/new), and we'll get back to you as soon as possible.

## Contribution

Please contribute by forking this repo, committing changes to your forked repo, and opening a pull request.


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**count** | **Integer** | Number of API Products returned.  |  [optional]
**list** | [**List<APIProductInfoDTO>**](APIProductInfoDTO.md) |  |  [optional]
**pagination** | [**PaginationDTO**](PaginationDTO.md) |  |  [optional]