text:
<?xml version="1.0" encoding="UTF-8"?>
<!-- The plugin.dtd file is located in the OXYGEN_INSATALL_DIR/plugins directory -->
<!DOCTYPE plugin SYSTEM "../plugin.dtd">

<plugin
 id="animo.oxygenxml.webdav"
 name="oXygen XML WEBDAV"
 description=""
 version="${project.version}"
 vendor="Dmitriy Shabanov"
 class="animo.oxygenxml.webdav.Plugin"
 classLoaderType="preferReferencedResources">

 <runtime>
  <library name="lib/oxygenxml-webdav-${project.version}.jar"/>
 </runtime>

  <extension type="URLHandler"
             class="animo.oxygenxml.webdav.URLHandler"/>

  <extension type="WorkspaceAccess"
            class="animo.oxygenxml.webdav.WorkspaceExtension"/>

</plugin>


text:
package com.epi;

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

public class InsertList {
  // @include
  // Insert newNode after node.
  public static void insertAfter(ListNode<Integer> node,
                                 ListNode<Integer> newNode) {
    newNode.next = node.next;
    node.next = newNode;
  }
  // @exclude

  private static void checkAnswer(ListNode<Integer> L, List<Integer> vals) {
    for (int i = 0; i < vals.size(); ++i) {
      assert(L.data == vals.get(i));
      L = L.next;
    }
    assert(L == null);
  }

  public static void main(String[] args) {
    ListNode<Integer> L;
    L = new ListNode<>(2, new ListNode<>(4, new ListNode<>(3, null)));
    insertAfter(L, new ListNode<>(1, null));
    checkAnswer(L, Arrays.asList(2, 1, 4, 3));
    insertAfter(L.next.next, new ListNode<>(10, null));
    checkAnswer(L, Arrays.asList(2, 1, 4, 10, 3));
    insertAfter(L.next.next.next.next, new ListNode<>(-1, null));
    checkAnswer(L, Arrays.asList(2, 1, 4, 10, 3, -1));
  }
}

redpajama_set_name: RedPajamaGithub


text:
DartFuzz
========

DartFuzz is a tool for generating random programs with the objective
of fuzz testing the Dart project. Each randomly generated program
can be run under various modes of execution, such as using JIT,
using AOT, using JavaScript after dart2js, and using various target
architectures (x86, arm, etc.). Any difference between the outputs
(**divergence**) may indicate a bug in one of the execution modes.

How to run DartFuzz
===================
To generate a single random Dart program, run

    dart dartfuzz.dart [--help] [--seed SEED] [--[no-]fp] FILENAME

where

    --help      : prints help and exits
    --seed      : defines random seed (system-set by default)
    --[no-]fp   : enables/disables floating-point operations (default: on)
    --[no-]ffi  : enables/disables FFI method calls (default: off)
    --[no-]flat : enables/disables flat types (default: off)
    --[no-]mini : enables minimization mode (default: off)
    --smask     : bitmask indicating which statements to omit (Bit=1 omits, defaults to "0")
    --emask     : bitmask indicating which expressions to omit (Bit=1 omits, defaults to "0")

The tool provides a runnable main isolate. A typical single
test run looks as:

    dart dartfuzz.dart fuzz.dart
    dart fuzz.dart

How to start DartFuzz testing
=============================
To start a fuzz testing session, run

    dart dartfuzz_test.dart [--help]
                            [--isolates ISOLATES ]
                            [--repeat REPEAT]
                            [--time TIME]
                            [--num-output-lines NUMOUTPUTLINES]
                            [--true_divergence]
                            [--show-stats]
                            [--dart-top DARTTOP]
                            [--mode1 MODE]
                            [--mode2 MODE]
                            [--[no-]rerun]

where

    --help             : prints help and exits
    --isolates         : number of isolates in the session (1 by default)
    --repeat           : number of tests to run (1000 by default)
    --time             : time limit in seconds (none by default)
    --num-output-lines : number of output lines to be printed in the case of a divergence (200 by default)
    --true-divergence  : only report true divergences (true by default)
    --show-stats       : show statistics during session (true by default)
    --dart-top         : sets DART_TOP explicitly through command line
    --mode1            : m1
    --mode2            : m2, and values one of
        jit-[debug-][ia32|x64|arm32|arm64]               = Dart JIT
        aot-[debug-][x64|arm32|arm64]                    = Dart AOT
        djs-x64                                          = dart2js + Node.JS
    --[no-]rerun       : re-run a testcase if there is only a divergence in
                         the return codes outside the range [-255,+255];
                         if the second run produces no divergence the previous
                         one will be ignored (true by default)

If no modes are given, a random combination is used.

This fuzz testing tool must have access to the top of a Dart SDK
development tree (DART_TOP) in which all proper binaries have been
built already (for example, testing jit-ia32 will invoke the binary
${DART_TOP}/out/ReleaseIA32/dart to start the Dart VM). The DART_TOP
can be provided through the --dart-top option, as an environment
variable, or, by default, as the current directory by invoking the
fuzz testing tool from the Dart SDK top.

Background
==========

Although test suites are extremely useful to validate the correctness of a
system and to ensure that no regressions occur, any test suite is necessarily
finite in size and scope. Tests typically focus on validating particular
features by means of code sequences most programmers would expect. Regression
tests often use slightly less idiomatic code sequences, since they reflect
problems that were not anticipated originally, but occurred "in the field".
Still, any test suite leaves the developer wondering whether undetected bugs
and flaws still linger in the system.

Over the years, fuzz testing has gained popularity as a testing technique for
discovering such lingering bugs, including bugs that can bring down a system
in an unexpected way. Fuzzing refers to feeding a large amount of random data
as input to a system in an attempt to find bugs or make it crash.
Generation-based fuzz testing constructs random, but properly formatted input
data. Mutation-based fuzz testing applies small random changes to existing
inputs in order to detect shortcomings in a system. Profile-guided or
coverage-guided fuzz testing adds a direction to the way these random changes
are applied. Multi-layered approaches generate random inputs that are
subsequently mutated at various stages of execution.

The randomness of fuzz testing implies that the size and scope of testing is
no longer bounded. Every new run can potentially discover bugs and crashes
that were hereto undetected.

Links
=====

* [Dart bugs found with fuzzing](https://github.com/dart-lang/sdk/issues?utf8=%E2%9C%93&q=label%3Adartfuzz+)
* [DartFuzz](https://github.com/dart-lang/sdk/tree/master/runtime/tools/dartfuzz)
* [DartLibFuzzer](https://github.com/dart-lang/sdk/tree/master/runtime/vm/libfuzzer)
* [Dust](https://pub.dev/packages/dust)
* [LibFuzzer](https://llvm.org/docs/LibFuzzer.html)


text:
#include "../../../include/physics_effects/low_level/collision/pfx_batched_ray_cast.h"
#include "../../../include/physics_effects/base_level/base/pfx_perf_counter.h"

namespace sce {
namespace PhysicsEffects {

///////////////////////////////////////////////////////////////////////////////
// MULTIPLE THREADS

//----------------------------------------------------------------------------
//  pfxCastRaysStartTaskEntry
//
/// The thread PfxTaskEntry function used to cast rays in parallel.
//----------------------------------------------------------------------------
void pfxCastRaysStartTaskEntry(PfxTaskArg *arg)
{
	PfxRayCastParam &param = *((PfxRayCastParam*)arg->io);

	PfxRayInput *rayInputs = (PfxRayInput*)arg->data[0];
	PfxRayOutput *rayOutputs = (PfxRayOutput*)arg->data[1];
	PfxUInt32 iFirstRay = arg->data[2];
	PfxUInt32 iEndRay = arg->data[3];

	for(PfxUInt32 i = iFirstRay; i < iEndRay; i++)
	{
		pfxCastSingleRay(rayInputs[i], rayOutputs[i], param);
	}
}

//----------------------------------------------------------------------------
//  pfxCastRays
//
/// Perform cast rays in parallel using a task manager.
///
/// @param rayInputs    [in] Array of rays to cast
/// @param rayOutputs   [out] On return contains output of ray casts
/// @param param        Information about ray cast
/// @param taskManager  Pointer to the thread task manager to use
//----------------------------------------------------------------------------
void pfxCastRays(PfxRayInput *rayInputs,PfxRayOutput *rayOutputs,int numRays,
	PfxRayCastParam &param,PfxTaskManager *taskManager)
{
	SCE_PFX_ALWAYS_ASSERT(SCE_PFX_PTR_IS_ALIGNED16(param.proxiesX));
	SCE_PFX_ALWAYS_ASSERT(SCE_PFX_PTR_IS_ALIGNED16(param.proxiesY));
	SCE_PFX_ALWAYS_ASSERT(SCE_PFX_PTR_IS_ALIGNED16(param.proxiesZ));
	SCE_PFX_ALWAYS_ASSERT(SCE_PFX_PTR_IS_ALIGNED16(param.proxiesXb));
	SCE_PFX_ALWAYS_ASSERT(SCE_PFX_PTR_IS_ALIGNED16(param.proxiesYb));
	SCE_PFX_ALWAYS_ASSERT(SCE_PFX_PTR_IS_ALIGNED16(param.proxiesZb));
	SCE_PFX_ALWAYS_ASSERT(SCE_PFX_PTR_IS_ALIGNED16(param.offsetRigidStates));
	SCE_PFX_ALWAYS_ASSERT(SCE_PFX_PTR_IS_ALIGNED16(param.offsetCollidables));

	SCE_PFX_PUSH_MARKER("pfxCastRays");

	PfxUInt32 maxBatchSize = numRays / (PfxUInt32)(taskManager->getNumTasks());
	PfxUInt32 iEnd = maxBatchSize, iStart = 0;
	int task = 0;
	taskManager->setTaskEntry((void*)pfxCastRaysStartTaskEntry);

	for (task = 0; task < taskManager->getNumTasks() - 1; task++, iStart += maxBatchSize, iEnd += maxBatchSize)
	{
		taskManager->startTask(task, static_cast<void*>(&param), (PfxUInt32)rayInputs, (PfxUInt32)rayOutputs, iStart, iEnd);
	}

	// send final task
	iEnd = numRays;
	taskManager->startTask(taskManager->getNumTasks() - 1, static_cast<void*>(&param), iStart, iEnd, 0, 0);

	// wait for tasks to complete
	PfxUInt32 data1, data2, data3, data4;
	for (PfxUInt32 i = 0; i < taskManager->getNumTasks(); i++)
		taskManager->waitTask(task, data1, data2, data3, data4);

	SCE_PFX_POP_MARKER();
}

} //namespace PhysicsEffects
} //namespace sce


text:
#include "uwsgi.h"

extern struct uwsgi_server uwsgi;

struct http_status_codes {
        const char      key[3];
        const char      *message;
        int             message_size;
};

/* statistically ordered */
struct http_status_codes hsc[] = {
        {"200", "OK"},
        {"302", "Found"},
        {"404", "Not Found"},
        {"500", "Internal Server Error"},
        {"301", "Moved Permanently"},
        {"304", "Not Modified"},
        {"303", "See Other"},
        {"403", "Forbidden"},
        {"307", "Temporary Redirect"},
        {"401", "Unauthorized"},
        {"400", "Bad Request"},
        {"405", "Method Not Allowed"},
        {"408", "Request Timeout"},

        {"100", "Continue"},
        {"101", "Switching Protocols"},
        {"201", "Created"},
        {"202", "Accepted"},
        {"203", "Non-Authoritative Information"},
        {"204", "No Content"},
        {"205", "Reset Content"},
        {"206", "Partial Content"},
        {"300", "Multiple Choices"},
        {"305", "Use Proxy"},
        {"402", "Payment Required"},
        {"406", "Not Acceptable"},
        {"407", "Proxy Authentication Required"},
        {"409", "Conflict"},
        {"410", "Gone"},
        {"411", "Length Required"},
        {"412", "Precondition Failed"},
        {"413", "Request Entity Too Large"},
        {"414", "Request-URI Too Long"},
        {"415", "Unsupported Media Type"},
        {"416", "Requested Range Not Satisfiable"},
        {"417", "Expectation Failed"},
        {"501", "Not Implemented"},
        {"502", "Bad Gateway"},
        {"503", "Service Unavailable"},
        {"504", "Gateway Timeout"},
        {"505", "HTTP Version Not Supported"},
        {"509", "Bandwidth Limit Exceeded"},
        {"", NULL},
};

void uwsgi_init_default() {

	uwsgi.cpus = 1;
	uwsgi.new_argc = -1;

	uwsgi.backtrace_depth = 64;
	uwsgi.max_apps = 64;

	uwsgi.master_queue = -1;

	uwsgi.signal_socket = -1;
	uwsgi.my_signal_socket = -1;
	uwsgi.stats_fd = -1;

	uwsgi.stats_pusher_default_freq = 3;

	uwsgi.original_log_fd = 2;

	uwsgi.emperor_fd_config = -1;
	uwsgi.emperor_fd_proxy = -1;
	// default emperor scan frequency
	uwsgi.emperor_freq = 3;
	uwsgi.emperor_throttle = 1000;
	uwsgi.emperor_heartbeat = 30;
	uwsgi.emperor_curse_tolerance = 30;
	// max 3 minutes throttling
	uwsgi.emperor_max_throttle = 1000 * 180;
	uwsgi.emperor_pid = -1;

	uwsgi.subscribe_freq = 10;
	uwsgi.subscription_tolerance = 17;

	uwsgi.cores = 1;
	uwsgi.threads = 1;

	// default max number of rpc slot
	uwsgi.rpc_max = 64;

	uwsgi.offload_threads_events = 64;

	uwsgi.default_app = -1;

	uwsgi.buffer_size = 4096;
	uwsgi.body_read_warning = 8;
	uwsgi.numproc = 1;

	uwsgi.forkbomb_delay = 2;

	uwsgi.async = 0;
	uwsgi.async_warn_if_queue_full = 1;
	uwsgi.listen_queue = 100;

	uwsgi.cheaper_overload = 3;

	uwsgi.log_master_bufsize = 8192;

	uwsgi.worker_reload_mercy = 60;
	uwsgi.mule_reload_mercy = 60;

	uwsgi.max_vars = MAX_VARS;
	uwsgi.vec_size = 4 + 1 + (4 * MAX_VARS);

	uwsgi.socket_timeout = 4;
	uwsgi.logging_options.enabled = 1;

	// a workers hould be running for at least 10 seconds
	uwsgi.min_worker_lifetime = 10;

	uwsgi.spooler_frequency = 30;

	uwsgi.shared->spooler_signal_pipe[0] = -1;
	uwsgi.shared->spooler_signal_pipe[1] = -1;

	uwsgi.shared->mule_signal_pipe[0] = -1;
	uwsgi.shared->mule_signal_pipe[1] = -1;

	uwsgi.shared->mule_queue_pipe[0] = -1;
	uwsgi.shared->mule_queue_pipe[1] = -1;

	uwsgi.shared->worker_log_pipe[0] = -1;
	uwsgi.shared->worker_log_pipe[1] = -1;

	uwsgi.shared->worker_req_log_pipe[0] = -1;
	uwsgi.shared->worker_req_log_pipe[1] = -1;

	uwsgi.req_log_fd = 2;

#ifdef UWSGI_SSL
	// 1 day of tolerance
	uwsgi.subscriptions_sign_check_tolerance = 3600 * 24;
	uwsgi.ssl_sessions_timeout = 300;
#endif

	uwsgi.alarm_freq = 3;
	uwsgi.alarm_msg_size = 8192;

	uwsgi.exception_handler_msg_size = 65536;

	uwsgi.multicast_ttl = 1;
	uwsgi.multicast_loop = 1;

	// filling http status codes
	struct http_status_codes *http_sc;
        for (http_sc = hsc; http_sc->message != NULL; http_sc++) {
                http_sc->message_size = strlen(http_sc->message);
        }

	uwsgi.empty = "";

#ifdef __linux__
	uwsgi.cgroup_dir_mode = "0700";
#endif

	uwsgi.wait_read_hook = uwsgi_simple_wait_read_hook;
	uwsgi.wait_write_hook = uwsgi_simple_wait_write_hook;
	uwsgi.wait_milliseconds_hook = uwsgi_simple_wait_milliseconds_hook;
	uwsgi.wait_read2_hook = uwsgi_simple_wait_read2_hook;

	uwsgi_websockets_init();

	// 1 MB default limit
	uwsgi.chunked_input_limit = 1024*1024;

	// clear reforked status
	uwsgi.master_is_reforked = 0;

	uwsgi.master_fifo_fd = -1;
	uwsgi_master_fifo_prepare();

	uwsgi.notify_socket_fd = -1;
}

void uwsgi_setup_reload() {

	char env_reload_buf[11];

	char *env_reloads = getenv("UWSGI_RELOADS");
	if (env_reloads) {
		//convert env value to int
		uwsgi.reloads = atoi(env_reloads);
		uwsgi.reloads++;
		//convert reloads to string
		int rlen = snprintf(env_reload_buf, 10, "%u", uwsgi.reloads);
		if (rlen > 0 && rlen < 10) {
			env_reload_buf[rlen] = 0;
			if (setenv("UWSGI_RELOADS", env_reload_buf, 1)) {
				uwsgi_error("setenv()");
			}
		}
		uwsgi.is_a_reload = 1;
	}
	else {
		if (setenv("UWSGI_RELOADS", "0", 1)) {
			uwsgi_error("setenv()");
		}
	}

}

void uwsgi_autoload_plugins_by_name(char *argv_zero) {

	char *plugins_requested = NULL;

	char *original_proc_name = getenv("UWSGI_ORIGINAL_PROC_NAME");
	if (!original_proc_name) {
		// here we use argv[0];
		original_proc_name = argv_zero;
		setenv("UWSGI_ORIGINAL_PROC_NAME", original_proc_name, 1);
	}
	char *p = strrchr(original_proc_name, '/');
	if (p == NULL)
		p = original_proc_name;
	p = strstr(p, "uwsgi_");
	if (p != NULL) {
		char *ctx = NULL;
		uwsgi_foreach_token(uwsgi_str(p + 6), "_", plugins_requested, ctx) {
			uwsgi_log("[uwsgi] implicit plugin requested %s\n", plugins_requested);
			uwsgi_load_plugin(-1, plugins_requested, NULL);
		}
	}

	plugins_requested = getenv("UWSGI_PLUGINS");
	if (plugins_requested) {
		plugins_requested = uwsgi_concat2(plugins_requested, "");
		char *p, *ctx = NULL;
		uwsgi_foreach_token(plugins_requested, ",", p, ctx) {
			uwsgi_load_plugin(-1, p, NULL);
		}
	}

}

void uwsgi_commandline_config() {
	int i;

	uwsgi.option_index = -1;
	// required in case we want to call getopt_long from the beginning
	optind = 0;

	int argc = uwsgi.argc;
	char **argv = uwsgi.argv;

	if (uwsgi.new_argc > -1 && uwsgi.new_argv) {
		argc = uwsgi.new_argc;
		argv = uwsgi.new_argv;
	}

	char *optname;
	while ((i = getopt_long(argc, argv, uwsgi.short_options, uwsgi.long_options, &uwsgi.option_index)) != -1) {

		if (i == '?') {
			uwsgi_log("getopt_long() error\n");
			exit(1);
		}

		if (uwsgi.option_index > -1) {
			optname = (char *) uwsgi.long_options[uwsgi.option_index].name;
		}
		else {
			optname = uwsgi_get_optname_by_index(i);
		}
		if (!optname) {
			uwsgi_log("unable to parse command line options\n");
			exit(1);
		}
		uwsgi.option_index = -1;
		add_exported_option(optname, optarg, 0);
	}

#ifdef UWSGI_DEBUG
	uwsgi_log("optind:%d argc:%d\n", optind, uwsgi.argc);
#endif

	if (optind < argc) {
		for (i = optind; i < argc; i++) {
			char *lazy = argv[i];
			if (lazy[0] != '[') {
				uwsgi_opt_load(NULL, lazy, NULL);
				// manage magic mountpoint
				int magic = 0;
				int j;
				for (j = 0; j < uwsgi.gp_cnt; j++) {
					if (uwsgi.gp[j]->magic) {
						if (uwsgi.gp[j]->magic(NULL, lazy)) {
							magic = 1;
							break;
						}
					}
				}
				if (!magic) {
					for (j = 0; j < 256; j++) {
						if (uwsgi.p[j]->magic) {
							if (uwsgi.p[j]->magic(NULL, lazy)) {
								magic = 1;
								break;
							}
						}
					}
				}
			}
		}
	}

}

void uwsgi_setup_workers() {
	int i, j;
	// allocate shared memory for workers + master
	uwsgi.workers = (struct uwsgi_worker *) uwsgi_calloc_shared(sizeof(struct uwsgi_worker) * (uwsgi.numproc + 1));

	for (i = 0; i <= uwsgi.numproc; i++) {
		// allocate memory for apps
		uwsgi.workers[i].apps = (struct uwsgi_app *) uwsgi_calloc_shared(sizeof(struct uwsgi_app) * uwsgi.max_apps);

		// allocate memory for cores
		uwsgi.workers[i].cores = (struct uwsgi_core *) uwsgi_calloc_shared(sizeof(struct uwsgi_core) * uwsgi.cores);

		// this is a trick for avoiding too much memory areas
		void *ts = uwsgi_calloc_shared(sizeof(void *) * uwsgi.max_apps * uwsgi.cores);
		// add 4 bytes for uwsgi header
		void *buffers = uwsgi_malloc_shared((uwsgi.buffer_size+4) * uwsgi.cores);
		void *hvec = uwsgi_malloc_shared(sizeof(struct iovec) * uwsgi.vec_size * uwsgi.cores);
		void *post_buf = NULL;
		if (uwsgi.post_buffering > 0)
			post_buf = uwsgi_malloc_shared(uwsgi.post_buffering_bufsize * uwsgi.cores);

		for (j = 0; j < uwsgi.cores; j++) {
			// allocate shared memory for thread states (required for some language, like python)
			uwsgi.workers[i].cores[j].ts = ts + ((sizeof(void *) * uwsgi.max_apps) * j);
			// raw per-request buffer (+4 bytes for uwsgi header)
			uwsgi.workers[i].cores[j].buffer = buffers + ((uwsgi.buffer_size+4) * j);
			// iovec for uwsgi vars
			uwsgi.workers[i].cores[j].hvec = hvec + ((sizeof(struct iovec) * uwsgi.vec_size) * j);
			if (post_buf)
				uwsgi.workers[i].cores[j].post_buf = post_buf + (uwsgi.post_buffering_bufsize * j);
		}

		// master does not need to following steps...
		if (i == 0)
			continue;
		uwsgi.workers[i].signal_pipe[0] = -1;
		uwsgi.workers[i].signal_pipe[1] = -1;
		snprintf(uwsgi.workers[i].name, 0xff, "uWSGI worker %d", i);
	}

	uint64_t total_memory = (sizeof(struct uwsgi_app) * uwsgi.max_apps) + (sizeof(struct uwsgi_core) * uwsgi.cores) + (sizeof(void *) * uwsgi.max_apps * uwsgi.cores) + (uwsgi.buffer_size * uwsgi.cores) + (sizeof(struct iovec) * uwsgi.vec_size * uwsgi.cores);
	if (uwsgi.post_buffering > 0) {
		total_memory += (uwsgi.post_buffering_bufsize * uwsgi.cores);
	}

	total_memory *= (uwsgi.numproc + uwsgi.master_process);
	if (uwsgi.numproc > 0)
		uwsgi_log("mapped %llu bytes (%llu KB) for %d cores\n", (unsigned long long) total_memory, (unsigned long long) (total_memory / 1024), uwsgi.cores * uwsgi.numproc);

	// allocate signal table
        uwsgi.shared->signal_table = uwsgi_calloc_shared(sizeof(struct uwsgi_signal_entry) * 256 * (uwsgi.numproc + 1));

#ifdef UWSGI_ROUTING
	uwsgi_fixup_routes(uwsgi.routes);
	uwsgi_fixup_routes(uwsgi.error_routes);
	uwsgi_fixup_routes(uwsgi.response_routes);
	uwsgi_fixup_routes(uwsgi.final_routes);
#endif

}

pid_t uwsgi_daemonize2() {
	if (uwsgi.has_emperor) {
		logto(uwsgi.daemonize2);
	}
	else {
		if (!uwsgi.is_a_reload) {
			uwsgi_log("*** daemonizing uWSGI ***\n");
			daemonize(uwsgi.daemonize2);
		}
		else if (uwsgi.log_reopen) {
			logto(uwsgi.daemonize2);
		}
	}
	uwsgi.mypid = getpid();

	uwsgi.workers[0].pid = uwsgi.mypid;

	if (uwsgi.pidfile && !uwsgi.is_a_reload) {
		uwsgi_write_pidfile(uwsgi.pidfile);
	}

	if (uwsgi.pidfile2 && !uwsgi.is_a_reload) {
		uwsgi_write_pidfile(uwsgi.pidfile2);
	}

	if (uwsgi.log_master) uwsgi_setup_log_master();

	return uwsgi.mypid;
}

// fix/check related options
void sanitize_args() {

        if (uwsgi.async > 0) {
                uwsgi.cores = uwsgi.async;
        }

        if (uwsgi.threads > 1) {
                uwsgi.has_threads = 1;
                uwsgi.cores = uwsgi.threads;
        }

        if (uwsgi.harakiri_options.workers > 0) {
                if (!uwsgi.post_buffering) {
                        uwsgi_log(" *** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers *** \n");
                }
        }

        if (uwsgi.write_errors_exception_only) {
                uwsgi.ignore_sigpipe = 1;
                uwsgi.ignore_write_errors = 1;
        }

        if (uwsgi.cheaper_count == 0) uwsgi.cheaper = 0;

        if (uwsgi.cheaper_count > 0 && uwsgi.cheaper_count >= uwsgi.numproc) {
                uwsgi_log("invalid cheaper value: must be lower than processes\n");
                exit(1);
        }

        if (uwsgi.cheaper && uwsgi.cheaper_count) {
		if (uwsgi.cheaper_initial) {
                	if (uwsgi.cheaper_initial < uwsgi.cheaper_count) {
                        	uwsgi_log("warning: invalid cheaper-initial value (%d), must be equal or higher than cheaper (%d), using %d as initial number of workers\n",
                                	uwsgi.cheaper_initial, uwsgi.cheaper_count, uwsgi.cheaper_count);
                        	uwsgi.cheaper_initial = uwsgi.cheaper_count;
                	}
                	else if (uwsgi.cheaper_initial > uwsgi.numproc) {
                        	uwsgi_log("warning: invalid cheaper-initial value (%d), must be lower or equal than worker count (%d), using %d as initial number of workers\n",
                                	uwsgi.cheaper_initial, uwsgi.numproc, uwsgi.numproc);
                        	uwsgi.cheaper_initial = uwsgi.numproc;
                	}
		}
		else {
                        uwsgi.cheaper_initial = uwsgi.cheaper_count;
		}
        }

	if (uwsgi.max_worker_lifetime > 0 && uwsgi.min_worker_lifetime >= uwsgi.max_worker_lifetime) {
		uwsgi_log("invalid min-worker-lifetime value (%d), must be lower than max-worker-lifetime (%d)\n",
			uwsgi.min_worker_lifetime, uwsgi.max_worker_lifetime);
		exit(1);
	}

	if (uwsgi.cheaper_rss_limit_soft && uwsgi.logging_options.memory_report != 1 && uwsgi.force_get_memusage != 1) {
		uwsgi_log("enabling cheaper-rss-limit-soft requires enabling also memory-report\n");
		exit(1);
	}
	if (uwsgi.cheaper_rss_limit_hard && !uwsgi.cheaper_rss_limit_soft) {
		uwsgi_log("enabling cheaper-rss-limit-hard requires setting also cheaper-rss-limit-soft\n");
		exit(1);
	}
	if ( uwsgi.cheaper_rss_limit_hard && uwsgi.cheaper_rss_limit_hard <= uwsgi.cheaper_rss_limit_soft) {
		uwsgi_log("cheaper-rss-limit-hard value must be higher than cheaper-rss-limit-soft value\n");
		exit(1);
	}

	/* here we try to choose if thunder lock is a good thing */
#ifdef UNBIT
	if (uwsgi.numproc > 1 && !uwsgi.map_socket) {
		uwsgi.use_thunder_lock = 1;
	}
#endif
}

const char *uwsgi_http_status_msg(char *status, uint16_t *len) {
	struct http_status_codes *http_sc;
	for (http_sc = hsc; http_sc->message != NULL; http_sc++) {
                if (!strncmp(http_sc->key, status, 3)) {
                        *len = http_sc->message_size;
			return http_sc->message;
                }
        }
	return NULL;
}


text:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

/* FireAnt Module */
import { AntModule } from 'fire-ant';

import { ExampleRoutingModule } from './example.routing.module';
import { SharedModule } from '../../app/shared/shared.module';

/** FireAnt Demo Components */
import { Example } from './example';
import { ButtonExample } from './button/example';
import { IconExample } from './icon/example';
import { GridExample } from './grid/example';
import { TooltipExample } from './tooltip/example';
import { PopoverExample } from './popover/example';
import { PopconfirmExample } from './popconfirm/example';
import { Popover2ExampleModule } from './popover2/popover2.module';
import { MenuExample } from './menu/example';
import { BreadcrumbExample } from './breadcrumb/example';
import { SwitchExample } from './switch/example';
import { LayoutExample } from './layout/example';
import { DropdownExample } from './dropdown/example';
import { TagExample } from './tag/example';
import { InputExample } from './input/example';
import { SelectExample } from './select/example';
import { PaginationExample } from './pagination/example';
import { CheckboxExample } from './checkbox/example';
import { RadioExample } from './radio/example';
import { InputNumberExample } from './input-number/example';
import { AvatarExample } from './avatar/example';
import { BadgeExample } from './badge/example';
import { FormExample } from './form/example';
import { TableExample } from './table/example';
import { AlertExample } from './alert/example';
import { MessageExample } from './message/example';
import { NotificationExample } from './notification/example';
import { DialogExample } from './dialog/example';
import { TabsExample } from './tabs/example';
import { ModalExampleModule } from './modal/modal.module';
import { CascaderExample } from './cascader/example';
import { DatePickerExample } from './date-picker/example';
import { TimePickerExample } from './time-picker/example';
import { RateExample } from './rate/example';
import { StepsExampleModule } from './steps/steps.module';
import { FullCalendarExampleModule } from './fullcalendar/fullcalendar.example.module';
import { SpinExample } from './spin/example';
import { ProgressExampleModule } from './progress/progress.module';
import { TreeExampleModule } from './tree/tree.module';

@NgModule({
    imports: [
        CommonModule,
        FormsModule,
        HttpModule,
        SharedModule,
        AntModule,
        ExampleRoutingModule,
        ModalExampleModule,
        StepsExampleModule,
        FullCalendarExampleModule,
        ProgressExampleModule,
        Popover2ExampleModule,
        TreeExampleModule
    ],
    declarations: [
        Example,
        ButtonExample,
        IconExample,
        GridExample,
        TooltipExample,
        PopoverExample,
        PopconfirmExample,
        MenuExample,
        BreadcrumbExample,
        SwitchExample,
        LayoutExample,
        DropdownExample,
        TagExample,
        InputExample,
        SelectExample,
        PaginationExample,
        CheckboxExample,
        RadioExample,
        InputNumberExample,
        AvatarExample,
        BadgeExample,
        FormExample,
        TableExample,
        AlertExample,
        MessageExample,
        NotificationExample,
        DialogExample,
        TabsExample,
        CascaderExample,
        DatePickerExample,
        TimePickerExample,
        RateExample,
        SpinExample,
    ],
    entryComponents: [
        Example,
        ButtonExample,
        IconExample,
        GridExample,
        TooltipExample,
        PopoverExample,
        PopconfirmExample,
        MenuExample,
        BreadcrumbExample,
        SwitchExample,
        LayoutExample,
        DropdownExample,
        TagExample,
        InputExample,
        SelectExample,
        PaginationExample,
        CheckboxExample,
        InputNumberExample,
        AvatarExample,
        BadgeExample,
        FormExample,
        TableExample,
        AlertExample,
        MessageExample,
        NotificationExample,
        DialogExample,
        TabsExample,
        CascaderExample,
        DatePickerExample,
        TimePickerExample,
        RateExample,
        SpinExample,
    ],
    providers: [

    ]
})
export class ExampleModule {

}


text:
class CreateJoinTablePointTerrain < ActiveRecord::Migration[5.0]
  def change
    create_join_table :points, :terrains do |t|
      t.index [:point_id, :terrain_id]
      t.index [:terrain_id, :point_id]
    end
  end
end


text:
using System;
using System.Drawing.Imaging;
using System.Collections.Generic;
using System.IO;
using System.Drawing;
using MoreTerra.Structures;
using MoreTerra.Utilities;
using MoreTerra.Structures.TerraInfo;

namespace MoreTerra
{

    public sealed class ResourceManager
    {
        static ResourceManager instance = null;
        static readonly object mutex = new object();

        private Dictionary<String, Bitmap> markerBitmaps;
		private Dictionary<String, Bitmap> customMarkerBitmaps;
		private Boolean useCustom;

        private ResourceManager()
        {
			useCustom = false;
            this.markerBitmaps = new Dictionary<String, Bitmap>();
			this.customMarkerBitmaps = new Dictionary<String, Bitmap>();
        }

        public static ResourceManager Instance
        {
            get
            {
                lock (mutex)
                {
                    if (instance == null)
                    {
                        instance = new ResourceManager();
                    }
                    return instance;
                }
            }
        }

        /// <summary>
        /// Initialize the resource directory
        /// </summary>
        public void Initialize()
        {
            // Check to see if root folder directory exists
            if (!Directory.Exists(Global.ApplicationRootDirectory))
            {

				String oldRoot;
				String newRoot = Global.ApplicationRootDirectory;

				Directory.CreateDirectory(Global.ApplicationRootDirectory);

				foreach(String s in Global.OldProgramNames)
				{

					oldRoot = System.IO.Path.Combine(Environment.GetFolderPath(
						Environment.SpecialFolder.ApplicationData), s);

					if (Directory.Exists(oldRoot))
					{
						MoveAndCombineDirectories(oldRoot, newRoot);
						Directory.Delete(oldRoot);
					}
				}
            }

            if (!Directory.Exists(Global.ApplicationLogDirectory))
            {
                // Create it
                Directory.CreateDirectory(Global.ApplicationLogDirectory);
            }

            if (!Directory.Exists(Global.ApplicationResourceDirectory))
            {
                // Create it
                Directory.CreateDirectory(Global.ApplicationResourceDirectory);
            }

			// Load
			LoadMarkers();

			// Copy all the markers
            ValidateMarkerResources(false);

			// Load custom markers from the files.
			LoadCustomMarkers();

        }

        /// <summary>
        /// Copy the markers externally to the resource directory
        /// </summary>
        private void ValidateMarkerResources(Boolean overwrite)
        {
            foreach (KeyValuePair<String, Bitmap> kvp in markerBitmaps)
            {
                // if it doesnt exist recopy
                if((!File.Exists(Path.Combine(Global.ApplicationResourceDirectory,
					string.Format("{0}.png", kvp.Key)))) || overwrite == true)
                {
                    SaveMarkerToResourceDirectory(kvp.Value, kvp.Key);
                }
            }
        }

		private void LoadMarkers()
		{
			foreach (KeyValuePair<String, List<MarkerInfo>> kvp in Global.Instance.Info.MarkerSets)
			{
                Bitmap b = (Bitmap)Properties.Resources.ResourceManager.GetObject(kvp.Key);
                markerBitmaps.Add(kvp.Key, b);

                foreach (MarkerInfo mi in kvp.Value)
                {
                    b = (Bitmap)Properties.Resources.ResourceManager.GetObject(mi.markerImage);
                    markerBitmaps.Add(mi.markerImage, b);
                }
			}
		}

        /// <summary>
        /// Loads Markers
        /// </summary>
        private void LoadCustomMarkers()
        {
			// Changed to FileStream as new Bitmap locks the image down.
			// Once loaded why do we need to keep the file from changing?
			FileStream stream;
            foreach (KeyValuePair<String, Bitmap> kvp in markerBitmaps)
            {
				string markerPath = GetMarkerPath(kvp.Key);
				stream = new FileStream(markerPath, FileMode.Open);
                this.customMarkerBitmaps.Add(kvp.Key, new Bitmap(stream));
				stream.Close();
            }
        }

		public void ResetCustomMarkers()
		{
			this.customMarkerBitmaps.Clear();
			ValidateMarkerResources(true);
			LoadCustomMarkers();
		}

        public Bitmap GetMarker(MarkerType markerType)
        {
			return this.GetMarker(Enum.GetName(typeof(MarkerType), markerType));
        }

		public Bitmap GetMarker(String markerName)
		{
			if (useCustom == false)
			{
				if (this.markerBitmaps.ContainsKey(markerName))
					return this.markerBitmaps[markerName];
			}
			else
			{
				if (this.customMarkerBitmaps.ContainsKey(markerName))
					return this.customMarkerBitmaps[markerName];
			}
			throw new ApplicationException(string.Format("Tile type {0} does not have an associated Marker", markerName));
		}

        private string GetMarkerPath(string markerName)
        {
            return Path.Combine(Global.ApplicationResourceDirectory, string.Format("{0}.png", markerName));
        }

        private void SaveMarkerToResourceDirectory(Bitmap marker, string name)
        {
            marker.Save(Path.Combine(Global.ApplicationResourceDirectory, string.Format("{0}.png", name)), ImageFormat.Png);
        }

		private void MoveAndCombineDirectories(String oldDir, String newDir)
		{
			String[] oldDirectories;
			String[] oldFiles;
			String newFileName;
			String newDirectoryName;

			#region MoveFiles
			oldFiles = Directory.GetFiles(oldDir);

			foreach (String file in oldFiles)
			{
				newFileName = Path.Combine(newDir, Path.GetFileName(file));

				if (File.Exists(newFileName))
				{
					// Find which one is newer and delete the older one.
					if (File.GetLastWriteTime(file) > File.GetLastWriteTime(newFileName))
					{
						File.Delete(newFileName);
						File.Move(file, newFileName);
					}
					else
					{
						File.Delete(file);
					}
				} else {
					File.Move(file, newFileName);
				}
			}
			#endregion

			oldDirectories = Directory.GetDirectories(oldDir);

			foreach (String dir in oldDirectories)
			{
				newDirectoryName = Path.Combine(newDir, Path.GetFileName(dir));

				if (Directory.Exists(newDirectoryName))
				{
					MoveAndCombineDirectories(dir, newDirectoryName);
					Directory.Delete(dir);
				}
				else
				{
					// It does not exist so let's just move it.
					Directory.Move(dir, newDirectoryName);
				}
			}
		}

		public Boolean Custom
		{
			get
			{
				return useCustom;
			}
			set
			{
				useCustom = value;
			}
		}

    }
}


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <link rel="stylesheet" href="css/reset.css"/>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="css/style.css"/>

    <title>Side Bar toggle</title>

LOGO

CurrentApp

App1

App2

App3

 Create app

User

Account

Dashboard

App1

App2

App3

Logout

                Data

 User0

 Product10

 Element399

 Element412

 Setting

 Application Keys

Application key

iwPcfZkDIh749MLRQgJ4gr8jqakqe2efCTQNufZe

Copy

Application key

iwPcfZkDIh749MLRQgJ4gr8jqakqe2efCTQNufZe

Copy

Application key

iwPcfZkDIh749MLRQgJ4gr8jqakqe2efCTQNufZe

Copy

Application key

iwPcfZkDIh749MLRQgJ4gr8jqakqe2efCTQNufZe

Copy

 Application Keys

Application key

iwPcfZkDIh749MLRQgJ4gr8jqakqe2efCTQNufZe

Copy

Application key

iwPcfZkDIh749MLRQgJ4gr8jqakqe2efCTQNufZe

Copy

Application key

iwPcfZkDIh749MLRQgJ4gr8jqakqe2efCTQNufZe

Copy

Application key

iwPcfZkDIh749MLRQgJ4gr8jqakqe2efCTQNufZe

Copy

Docs

Home


text:
package org.apache.karaf.jms.internal;

import org.apache.karaf.jms.JmsMessage;
import org.apache.karaf.jms.JmsService;
import org.ops4j.pax.jms.service.ConnectionFactoryFactory;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
import org.osgi.framework.InvalidSyntaxException;
import org.osgi.framework.ServiceReference;
import org.osgi.service.cm.Configuration;
import org.osgi.service.cm.ConfigurationAdmin;

import javax.jms.*;
import javax.jms.Queue;

import java.io.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.*;
import java.util.stream.Collectors;

/**
 * Default implementation of the JMS Service.
 */
public class JmsServiceImpl implements JmsService {

    private BundleContext bundleContext;
    private ConfigurationAdmin configAdmin;
    private Path deployFolder;

    public JmsServiceImpl() {
        deployFolder = Paths.get(System.getProperty("karaf.base"), "deploy");
    }

    @Override
    public void create(String name, String type, String url) throws Exception {
        create(name, type, url, null, null, "jmspooled");
    }

    @Override
    public void create(String name, String type, String url, String username, String password, String pool) throws Exception {
        if (type == null) {
            throw new IllegalArgumentException("JMS connection factory type not known");
        }

        if (connectionFactories().contains(name)) {
            throw new IllegalArgumentException("There is already a ConnectionFactory with the name " + name);
        }

        Dictionary<String, String> properties = new Hashtable<>();
        properties.put("osgi.jndi.service.name", "jms/" + name);
        properties.put(ConnectionFactoryFactory.JMS_CONNECTIONFACTORY_NAME, name);
        properties.put(ConnectionFactoryFactory.JMS_CONNECTIONFACTORY_TYPE, type);
        put(properties, ConnectionFactoryFactory.JMS_URL, url);
        put(properties, ConnectionFactoryFactory.JMS_USER, username);
        put(properties, ConnectionFactoryFactory.JMS_PASSWORD, password);
        if (pool.equals("narayana")) {
            put(properties, "pool", "narayana");
        }
        if (pool.equals("transx") || type.equalsIgnoreCase("activemq")) {
            put(properties, "pool", "transx");
        }
        Configuration config = configAdmin.createFactoryConfiguration("org.ops4j.connectionfactory", null);
        config.update(properties);
    }

    private void put(Dictionary<String, String> properties, String key, String value) {
        if (value != null) {
            properties.put(key, value);
        }
    }

    @Override
    public void delete(String name) throws Exception {
        String filter = String.format("(&(service.factoryPid=org.ops4j.connectionfactory)(%s=%s))", ConnectionFactoryFactory.JMS_CONNECTIONFACTORY_NAME, name);
        Configuration[] configs = configAdmin.listConfigurations(filter);
        for (Configuration config : configs) {
            config.delete();
        }
    }

    @Override
    public List<String> connectionFactories() throws Exception {
        return bundleContext.getServiceReferences(ConnectionFactory.class, null).stream()
                .map(this::getConnectionFactoryName)
                .distinct()
                .collect(Collectors.toList());
    }

    private String getConnectionFactoryName(ServiceReference<ConnectionFactory> reference) {
        if (reference.getProperty("osgi.jndi.service.name") != null) {
            return (String) reference.getProperty("osgi.jndi.service.name");
        } else if (reference.getProperty("name") != null) {
            return (String) reference.getProperty("name");
        } else {
            return reference.getProperty(Constants.SERVICE_ID).toString();
        }
    }

    @Override
    public List<String> connectionFactoryFileNames() throws Exception {
        return Files.list(deployFolder)
                .map(Path::getFileName)
                .map(Path::toString)
                .filter(name -> name.startsWith("connectionfactory-") && name.endsWith(".xml"))
                .collect(Collectors.toList());
    }

    @Override
    public Map<String, String> info(String connectionFactory, String username, String password) throws IOException, JMSException {
        try (JMSContext context = createContext(connectionFactory, username, password)) {
            ConnectionMetaData metaData = context.getMetaData();
            Map<String, String> map = new HashMap<>();
            map.put("product", metaData.getJMSProviderName());
            map.put("version", metaData.getProviderVersion());
            return map;
        }
    }

    @Override
    public int count(String connectionFactory, final String destination, String username, String password) throws IOException, JMSException {
        try (JMSContext context = createContext(connectionFactory, username, password)) {
            try (QueueBrowser browser = context.createBrowser(context.createQueue(destination))) {
                @SuppressWarnings("unchecked")
                Enumeration<Message> enumeration = browser.getEnumeration();
                int count = 0;
                while (enumeration.hasMoreElements()) {
                    enumeration.nextElement();
                    count++;
                }
                return count;
            }
        }
    }

    private JMSContext createContext(String name, String username, String password) {
        return createContext(name, username, password, JMSContext.AUTO_ACKNOWLEDGE);
    }

    private JMSContext createContext(String name, String username, String password, int sessionMode) {
        ServiceReference<ConnectionFactory> sr = lookupConnectionFactory(name);
        ConnectionFactory cf = bundleContext.getService(sr);
        try {
            return cf.createContext(username, password, sessionMode);
        } finally {
            bundleContext.ungetService(sr);
        }
    }

    private ServiceReference<ConnectionFactory> lookupConnectionFactory(String name) {
        try {
            Collection<ServiceReference<ConnectionFactory>> references = bundleContext.getServiceReferences(
                    ConnectionFactory.class,
                    "(|(osgi.jndi.service.name=" + name + ")(name=" + name + ")(service.id=" + name + "))");
            return references.stream()
                    .sorted(Comparator.<ServiceReference<?>>naturalOrder().reversed())
                    .findFirst()
                    .orElseThrow(() -> new IllegalArgumentException("No JMS connection factory found for " + name));
        } catch (InvalidSyntaxException e) {
            throw new RuntimeException("Error finding connection factory service " + name, e);
        }
    }

    private DestinationSource getDestinationSource(JMSContext context) throws JMSException {
        List<DestinationSource.Factory> factories = Arrays.asList(
                new ActiveMQDestinationSourceFactory(),
                new ArtemisDestinationSourceFactory()
        );
        DestinationSource source = null;
        for (DestinationSource.Factory factory : factories) {
            source = factory.create(context);
            if (source != null) {
                break;
            }
        }
        if (source == null) {
            source = d -> Collections.emptyList();
        }
        return source;
    }

    @Override
    public List<String> queues(String connectionFactory, String username, String password) throws JMSException, IOException {
        try (JMSContext context = createContext(connectionFactory, username, password)) {
            return getDestinationSource(context).getNames(DestinationSource.DestinationType.Queue);
        }
    }

    @Override
    public List<String> topics(String connectionFactory, String username, String password) throws IOException, JMSException {
        try (JMSContext context = createContext(connectionFactory, username, password)) {
            return getDestinationSource(context).getNames(DestinationSource.DestinationType.Topic);
        }
    }

    @Override
    public List<JmsMessage> browse(String connectionFactory, final String queue, final String filter,
                                   String username, String password) throws JMSException, IOException {
        try (JMSContext context = createContext(connectionFactory, username, password)) {
            try (QueueBrowser browser = context.createBrowser(context.createQueue(queue), filter)) {
                List<JmsMessage> messages = new ArrayList<>();
                @SuppressWarnings("unchecked")
                Enumeration<Message> enumeration = browser.getEnumeration();
                while (enumeration.hasMoreElements()) {
                    Message message = enumeration.nextElement();

                    messages.add(new JmsMessage(message));
                }
                return messages;
            }
        }
    }

    @Override
    public void send(String connectionFactory, final String queue, final String body, final String replyTo,
                     String username, String password) throws IOException, JMSException {
        try (JMSContext context = createContext(connectionFactory, username, password)) {
            JMSProducer producer = context.createProducer();
            if (replyTo != null) {
                producer.setJMSReplyTo(context.createQueue(replyTo));
            }
            producer.send(context.createQueue(queue), body);
        }
    }

    @Override
    public int consume(String connectionFactory, final String queue, final String selector, String username,
                       String password) throws Exception {
        try (JMSContext context = createContext(connectionFactory, username, password)) {
            try (JMSConsumer consumer = context.createConsumer(context.createQueue(queue), selector)) {
                int count = 0;
                Message message;
                do {
                    message = consumer.receive(500L);
                    if (message != null) {
                        count++;
                    }
                } while (message != null);
                return count;
            }
        }
    }

    @Override
    public int move(String connectionFactory, final String sourceQueue, final String targetQueue,
                    final String selector, String username, String password) throws IOException, JMSException {
        try (JMSContext context = createContext(connectionFactory, username, password, JMSContext.SESSION_TRANSACTED)) {
            Queue source = context.createQueue(sourceQueue);
            Queue target = context.createQueue(targetQueue);
            try (JMSConsumer consumer = context.createConsumer(source, selector)) {
                int count = 0;
                while (true) {
                    Message message = consumer.receive(500L);
                    if (message != null) {
                        context.createProducer().send(target, message);
                        context.commit();
                        count++;
                    } else {
                        break;
                    }
                }
                return count;
            }
        }
   }

    public void setBundleContext(BundleContext bundleContext) {
        this.bundleContext = bundleContext;
    }

    public void setConfigAdmin(ConfigurationAdmin configAdmin) {
        this.configAdmin = configAdmin;
    }
}


text:
package net.stefankrause.sj;

import java.util.Map;

import javax.faces.context.FacesContext;

import org.springframework.beans.factory.ObjectFactory;
import org.springframework.beans.factory.config.Scope;

/**
 * This uses the FacesContext view map as a datastore for a scope in the Spring
 * Framework
 *
 * More simply this is a view scope implementation that works in spring
 *
 * @author Optimus Prime(From the primefaces
 *         team)(http://blog.primefaces.org/?p=702)
 *
 *
 * from https://github.com/Zergleb/Spring-Boot-JSF-Example
 */
public class ViewScope implements Scope {
	public Object get(String name, ObjectFactory<? extends Object> objectFactory) {
		Map<String, Object> viewMap = FacesContext.getCurrentInstance()
				.getViewRoot().getViewMap();
		Object obj;
		if (viewMap.containsKey(name)) {
			obj = viewMap.get(name);
		} else {
			Object object = objectFactory.getObject();
			viewMap.put(name, object);
			obj = object;
		}
		return obj;
	}

	public Object remove(String name) {
		return FacesContext.getCurrentInstance().getViewRoot().getViewMap()
				.remove(name);
	}

	public String getConversationId() {
		return null;
	}

	public void registerDestructionCallback(String name, Runnable callback) {
		// Not supported
	}

	public Object resolveContextualObject(String key) {
		return null;
	}
}


text:
#ifndef LIBGM_HYBRID_INDEX_HPP
#define LIBGM_HYBRID_INDEX_HPP

#include <libgm/datastructure/uint_vector.hpp>

namespace libgm {

  /**
   * A datastructure that represents a linear index into an hybrid
   * vector or matrix.
   */
  struct hybrid_index {
    uint_vector uint;
    uint_vector real;
  };

} // namespace libgm

#endif


text:
set (SOURCES
	main/main.cpp
	core/rtc.cpp
	gui/mainwindow.cpp
	gui/rtccalendarwidget.cpp)

set (HEADERS
	core/rtc.h
	gui/mainwindow.h
	gui/rtccalendarwidget.h)

set (FORMS
	gui/ui/mainwindow.ui)

set (LANGUAGES
	ru_RU
	be_BY)

set (RESOURCES
	resources/resources.qrc)


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

using Duality;
using Duality.Drawing;
using Duality.Resources;
using Duality.Components;
using Duality.Components.Physics;
using Duality.Components.Renderers;

using Duality.Tests.Components;

using NUnit.Framework;

namespace Duality.Tests.Resources
{
	[TestFixture]
	public class SceneTest
	{
		[Test] public void SwitchToNonExistent()
		{
			// Switching to an explicit null Scene should work
			Scene.SwitchTo(null);
			Assert.IsTrue(Scene.Current.IsEmpty);

			// Switching to a Scene that doesn't exist should throw an exception
			Assert.Throws<ArgumentException>(() => Scene.SwitchTo(new ContentRef<Scene>(null, "I_Dont_Exist\\Invalid_Path")));
		}
		[Test] public void SwitchToRegular()
		{
			// Set up some objects
			Scene scene = new Scene();
			Scene scene2 = new Scene();

			// Switch to the first Scene regularly
			{
				Scene.SwitchTo(scene);
				Assert.AreEqual(Scene.Current, scene);
			}

			// Clean up
			scene.Dispose();
			scene2.Dispose();
		}
		[Test] public void SwitchToDuringUpdate()
		{
			// Set up some objects
			Scene scene = new Scene();
			Scene scene2 = new Scene();

			// Switch to the first Scene regularly
			{
				Scene.SwitchTo(scene);
				Assert.AreEqual(Scene.Current, scene);
			}

			// Switch to the second during update
			{
				GameObject obj = new GameObject("SwitchObject");
				var switchComponent = new UpdateSwitchToSceneComponent { Target = scene2 };
				obj.AddComponent(switchComponent);
				scene.AddObject(obj);

				DualityApp.Update();
				Assert.False(switchComponent.Switched);
				Assert.AreEqual(Scene.Current, scene2);

				Scene.SwitchTo(scene);
				Assert.AreEqual(Scene.Current, scene);
			}

			// Clean up
			scene.Dispose();
			scene2.Dispose();
		}
		[Test] public void SwitchToDuringEnter()
		{
			// Set up some objects
			Scene scene = new Scene();
			Scene scene2 = new Scene();

			// Switch to the first Scene regularly
			{
				Scene.SwitchTo(scene);
				Assert.AreEqual(Scene.Current, scene);
			}

			// Switch to the second while entering
			{
				Scene.SwitchTo(null);

				GameObject obj = new GameObject("SwitchObject");
				var switchComponent = new InitSwitchToSceneComponent { Target = scene2 };
				obj.AddComponent(switchComponent);
				scene.AddObject(obj);

				Scene.SwitchTo(scene);
				DualityApp.Update();
				Assert.False(switchComponent.Switched);
				Assert.AreEqual(Scene.Current, scene2);
			}

			// Clean up
			scene.Dispose();
			scene2.Dispose();
		}
		[Test] public void SwitchToDuringLeave()
		{
			// Set up some objects
			Scene scene = new Scene();
			Scene scene2 = new Scene();

			// Switch to the first Scene regularly
			{
				Scene.SwitchTo(scene);
				Assert.AreEqual(Scene.Current, scene);
			}

			// Switch to the second while leaving
			{
				Scene.SwitchTo(scene);

				GameObject obj = new GameObject("SwitchObject");
				var switchComponent = new ShutdownSwitchToSceneComponent { Target = scene2 };
				obj.AddComponent(switchComponent);
				scene.AddObject(obj);

				Scene.SwitchTo(null);
				DualityApp.Update();
				Assert.False(switchComponent.Switched);
				Assert.AreEqual(Scene.Current, scene2);
			}

			// Clean up
			scene.Dispose();
			scene2.Dispose();
		}
		[Test] public void SwitchReloadDeferredDispose()
		{
			// Inject some pseudo loading code for our Scene.
			const string TestSceneName = "TestScene";
			EventHandler<ResourceResolveEventArgs> resolveHandler = delegate(object sender, ResourceResolveEventArgs e)
			{
				if (e.RequestedContent == TestSceneName)
				{
					e.Resolve(new Scene());
				}
			};
			ContentProvider.ResourceResolve += resolveHandler;

			// Retrieve the Scene and make sure it's always the same
			Scene scene = ContentProvider.RequestContent<Scene>(TestSceneName).Res;
			Assert.IsNotNull(scene);
			{
				Scene scene2 = ContentProvider.RequestContent<Scene>(TestSceneName).Res;
				Assert.AreSame(scene, scene2);
			}

			// Switch to the Scene regularly
			{
				Scene.SwitchTo(scene);
				Assert.AreSame(Scene.Current, scene);
			}

			// Reload the Scene during update while using deferred disposal
			{
				GameObject obj = new GameObject("SwitchObject");
				obj.AddComponent<UpdateReloadSceneComponent>();
				scene.AddObject(obj);

				Assert.AreSame(Scene.Current, scene);
				DualityApp.Update();
				Assert.AreNotSame(Scene.Current, scene);
				Assert.AreEqual(TestSceneName, Scene.Current.Path);
			}

			// Clean up
			ContentProvider.ResourceResolve -= resolveHandler;
			scene.Dispose();
		}
		[Test] public void AddRemoveGameObjects()
		{
			// Set up some objects
			Scene scene = new Scene();
			GameObject obj = new GameObject("TestObject");
			GameObject objChildA = new GameObject("TestObjectChildA", obj);
			GameObject objChildB = new GameObject("TestObjectChildB", obj);
			scene.AddObject(obj);

			// Basic setup check (Added properly?)
			Assert.AreEqual(scene, obj.Scene);
			CollectionAssert.AreEquivalent(new[] { obj, objChildA, objChildB }, scene.AllObjects);

			// Removing root object
			scene.RemoveObject(obj);
			Assert.AreEqual(null, obj.Scene);
			CollectionAssert.IsEmpty(scene.AllObjects);

			// Adding removed root object again
			scene.AddObject(obj);
			Assert.AreEqual(scene, obj.Scene);
			CollectionAssert.AreEquivalent(new[] { obj, objChildA, objChildB }, scene.AllObjects);

			// Remove non-root object
			scene.RemoveObject(objChildA);
			CollectionAssert.AreEquivalent(new[] { obj, objChildB }, scene.AllObjects);
			CollectionAssert.DoesNotContain(obj.Children, objChildA);
			Assert.IsNull(objChildA.Scene);
			Assert.IsNull(objChildA.Parent);

			// Clear Scene
			scene.Clear();
			CollectionAssert.IsEmpty(scene.AllObjects);

			// Clean up
			scene.Dispose();
		}
		[Test] public void GameObjectHierarchy()
		{
			// Set up some objects
			Scene scene = new Scene();
			Scene scene2 = new Scene();
			GameObject obj = new GameObject("TestObject");
			GameObject obj2 = new GameObject("TestObject2");
			GameObject objChildA = new GameObject("TestObjectChildA", obj);
			GameObject objChildB = new GameObject("TestObjectChildB", obj);
			scene.AddObject(obj);
			scene2.AddObject(obj2);

			// Remove non-root object
			scene.RemoveObject(objChildA);
			CollectionAssert.AreEquivalent(new[] { obj, objChildB }, scene.AllObjects);
			CollectionAssert.DoesNotContain(obj.Children, objChildA);
			Assert.IsNull(objChildA.Scene);
			Assert.IsNull(objChildA.Parent);

			// Add object implicitly by parent-child relationship
			objChildA.Parent = obj;
			CollectionAssert.AreEquivalent(new[] { obj, objChildA, objChildB }, scene.AllObjects);
			CollectionAssert.Contains(obj.Children, objChildA);
			Assert.AreEqual(scene, objChildA.Scene);
			Assert.AreEqual(obj, objChildA.Parent);

			// Change object parent
			objChildA.Parent = objChildB;
			CollectionAssert.AreEquivalent(new[] { obj, objChildA, objChildB }, scene.AllObjects);
			CollectionAssert.Contains(objChildB.Children, objChildA);
			Assert.AreEqual(scene, objChildA.Scene);
			Assert.AreEqual(objChildB, objChildA.Parent);

			// Clean up
			scene.Dispose();
			scene2.Dispose();
		}
		[Test] public void AddRemoveGameObjectsMultiScene()
		{
			// Set up some objects
			Scene scene = new Scene();
			Scene scene2 = new Scene();
			GameObject obj = new GameObject("TestObject");
			GameObject obj2 = new GameObject("TestObject2");
			GameObject objChildA = new GameObject("TestObjectChildA", obj);
			GameObject objChildB = new GameObject("TestObjectChildB", obj);
			scene.AddObject(obj);
			scene2.AddObject(obj2);

			// Let object switch Scenes implicitly by parent-child relationship
			objChildA.Parent = obj2;
			Assert.AreEqual(scene2, objChildA.Scene);
			CollectionAssert.AreEquivalent(new[] { obj, objChildB }, scene.AllObjects);
			CollectionAssert.AreEquivalent(new[] { obj2, objChildA }, scene2.AllObjects);
			CollectionAssert.Contains(obj2.Children, objChildA);
			Assert.AreEqual(obj2, objChildA.Parent);

			// Remove object from a Scene it doesn't belong to
			scene.RemoveObject(obj2);
			CollectionAssert.AreEquivalent(new[] { obj, objChildB }, scene.AllObjects);
			CollectionAssert.AreEquivalent(new[] { obj2, objChildA }, scene2.AllObjects);

			// Add object to Scene, despite belonging to a different Scene
			scene.AddObject(obj2);
			CollectionAssert.AreEquivalent(new[] { obj, obj2, objChildA, objChildB }, scene.AllObjects);
			CollectionAssert.IsEmpty(scene2.AllObjects);

			// Clean up
			scene.Dispose();
			scene2.Dispose();
		}
		[Test] public void GameObjectActiveLists()
		{
			// Set up some objects
			Scene scene = new Scene();
			GameObject obj = new GameObject("TestObject");
			GameObject obj2 = new GameObject("TestObject2");
			GameObject objChildA = new GameObject("TestObjectChildA", obj);
			GameObject objChildB = new GameObject("TestObjectChildB", obj);
			scene.AddObject(obj);
			scene.AddObject(obj2);

			// Inactive objects shouldn't show up in active lists
			objChildB.Active = false;
			obj2.Active = false;
			CollectionAssert.AreEquivalent(new[] { obj, obj2, objChildA, objChildB }, scene.AllObjects);
			CollectionAssert.AreEquivalent(new[] { obj, objChildA }, scene.ActiveObjects);
			CollectionAssert.AreEquivalent(new[] { obj, obj2 }, scene.RootObjects);
			CollectionAssert.AreEquivalent(new[] { obj }, scene.ActiveRootObjects);

			// Activating them again should make them show up again
			objChildB.Active = true;
			obj2.Active = true;
			CollectionAssert.AreEquivalent(scene.AllObjects, scene.ActiveObjects);
			CollectionAssert.AreEquivalent(scene.RootObjects, scene.ActiveRootObjects);

			// Clean up
			scene.Dispose();
		}
		[Test] public void GameObjectParentLoop()
		{
			// Set up some objects
			Scene scene = new Scene();
			GameObject obj = new GameObject("TestObject");
			GameObject objChild = new GameObject("TestObjectChild", obj);
			GameObject objChildChild = new GameObject("TestObjectChildChild", objChild);
			scene.AddObject(obj);

			// Attempt to create a closed parent loop. Expect the operation to be rejected.
			Assert.Throws<ArgumentException>(() => obj.Parent = objChildChild);
			Assert.AreEqual(null, obj.Parent);
			Assert.AreEqual(obj, objChild.Parent);
			Assert.AreEqual(objChild, objChildChild.Parent);

			// Attempt to create a direct self-reference loop. Expect the operation to be rejected.
			Assert.Throws<ArgumentException>(() => obj.Parent = obj);
			Assert.AreEqual(null, obj.Parent);
			Assert.AreEqual(obj, objChild.Parent);
			Assert.AreEqual(objChild, objChildChild.Parent);

			// Clean up
			scene.Dispose();
		}
		[Test] public void AddChildrenOnInit()
		{
			// Set up an object that will recursively create child objects on activation
			Scene scene = new Scene();
			GameObject testObj = new GameObject("TestObject");
			InitCreateChildComponent createComponent = testObj.AddComponent<InitCreateChildComponent>();
			createComponent.CreateCount = 9;
			scene.AddObject(testObj);

			// Activate the scene, prompting child creation
			scene.Activate();

			// Assert that all child objects were created successfully
			Assert.AreEqual(10, scene.AllObjects.Count());
			Assert.AreEqual(1, scene.RootObjects.Count());
			Assert.AreSame(testObj, scene.RootObjects.FirstOrDefault());
			Assert.IsTrue(scene.AllObjects.All(obj => obj.Children.Count <= 1));

			// Clean up
			scene.Deactivate();
			scene.Dispose();
		}

		/// <summary>
		/// This test will determine whether a <see cref="Scene"/> can be activated, updated and deactivated
		/// in isolation from the global <see cref="Scene.Current"/> setting.
		/// </summary>
		[Test] public void IsolatedSimulation()
		{
			// Create an isolated new test scene with a ball and a platform
			Scene scene = new Scene();

			GameObject ball = new GameObject("Ball");
			Transform ballTransform = ball.AddComponent<Transform>();
			RigidBody ballBody = ball.AddComponent<RigidBody>();
			ballBody.AddShape(new CircleShapeInfo(32.0f, new Vector2(0.0f, 0.0f), 1.0f));
			ball.AddComponent<RigidBodyRenderer>();
			scene.AddObject(ball);

			GameObject platform = new GameObject("Platform");
			Transform platformTransform = platform.AddComponent<Transform>();
			platformTransform.Pos = new Vector3(0.0f, 128.0f, 0.0f);
			RigidBody platformBody = platform.AddComponent<RigidBody>();
			platformBody.AddShape(new ChainShapeInfo(new[] { new Vector2(-128.0f, 0.0f), new Vector2(128.0f, 0.0f) }));
			platformBody.BodyType = BodyType.Static;
			platform.AddComponent<RigidBodyRenderer>();
			scene.AddObject(platform);

			// Do a single, fixed-step Duality update in order to set up
			// Time.DeltaTime in a predictable way.
			DualityApp.Update(true);

			// Assert that the isolated scene remains unaffected
			Assert.AreEqual(new Vector3(0.0f, 0.0f, 0.0f), ballTransform.Pos);
			Assert.AreEqual(new Vector3(0.0f, 128.0f, 0.0f), platformTransform.Pos);

			// Activate the scene to prepare for simulation
			scene.Activate();

			// Run the simulation for a few fixed-step frames
			for (int i = 0; i < 100; i++)
			{
				scene.Update();
			}

			// Deactivate the scene again
			scene.Deactivate();

			// Assert that the balls position is within expected values
			Assert.IsTrue(ballTransform.Pos.Y > 96.0f);
			Assert.IsTrue(ballTransform.Pos.Y < 128.0f);
			Assert.IsTrue(Math.Abs(ballTransform.Pos.X) < 1.00f);
			Assert.IsTrue(Math.Abs(ballTransform.Pos.Z) < 1.00f);
		}
		/// <summary>
		/// This test will determine whether a <see cref="Scene"/> can be rendered
		/// in isolation from the global <see cref="Scene.Current"/> setting.
		/// </summary>
		[Test, Category("Rendering")]
		public void IsolatedRendering()
		{
			// Create an isolated new test scene with a ball and a platform
			Scene scene = new Scene();

			GameObject ball = new GameObject("Ball");
			Transform ballTransform = ball.AddComponent<Transform>();
			SpriteRenderer ballRenderer = ball.AddComponent<SpriteRenderer>();
			scene.AddObject(ball);

			GameObject cameraObj = new GameObject("Camera");
			Transform cameraTransform = cameraObj.AddComponent<Transform>();
			cameraTransform.Pos = new Vector3(0.0f, 0.0f, -500.0f);
			Camera camera = cameraObj.AddComponent<Camera>();
			camera.ClearColor = new ColorRgba(128, 192, 255);
			scene.AddObject(cameraObj);

			// Activate the scene to prepare for simulation
			scene.Activate();

			// Render the scene to an image target
			PixelData renderedImage = null;
			using (Texture texture = new Texture(800, 600, TextureSizeMode.NonPowerOfTwo, TextureMagFilter.Nearest, TextureMinFilter.Nearest))
			using (RenderTarget renderTarget = new RenderTarget(AAQuality.Off, true, texture))
			{
				scene.Render(renderTarget, new Rect(renderTarget.Size), renderTarget.Size);
				renderedImage = texture.GetPixelData();
			}

			// Determine where in the resulting image we should see the ball object.
			// Note that we need to do this after rendering, but before deactivating the scene again,
			// so the correct target resolution is assumed.
			Vector2 ballPosInOutputImage = camera.GetScreenPos(ballTransform.Pos);

			// Deactivate the scene again
			scene.Deactivate();

			// Assert that the image target has the correct background color
			// and deviates from it at the balls position
			Assert.AreEqual(camera.ClearColor, renderedImage[0, 0]);
			Assert.AreNotEqual(camera.ClearColor, renderedImage[(int)ballPosInOutputImage.X, (int)ballPosInOutputImage.Y]);
		}
		/// <summary>
		/// This test will determine whether a <see cref="Scene"/> that was activated in isolation / without
		/// being <see cref="Scene.Current"/> will ensure the initialization and shutdown of objects added
		/// or removed during its lifetime.
		/// </summary>
		[Test] public void IsolatedInitAndShutdown()
		{
			// Create an isolated new test scene
			Scene scene = new Scene();

			GameObject testObj = new GameObject("TestObject");
			InitializableEventReceiver testReceiver = testObj.AddComponent<InitializableEventReceiver>();
			scene.AddObject(testObj);

			// Ensure events are delivered in scene activation
			testReceiver.Reset();
			scene.Activate();
			Assert.IsTrue(testReceiver.HasReceived(InitializableEventReceiver.EventFlag.Activate), "Activate by Scene activation");

			// Ensure events are delivered in scene deactivation
			testReceiver.Reset();
			scene.Deactivate();
			Assert.IsTrue(testReceiver.HasReceived(InitializableEventReceiver.EventFlag.Deactivate), "Deactivate by Scene deactivation");

			// Ensure no events are delivered for removal while deactivated
			testReceiver.Reset();
			scene.RemoveObject(testObj);
			scene.Activate();
			Assert.AreEqual(InitializableEventReceiver.EventFlag.None, testReceiver.ReceivedEvents, "Removal from Scene, activation of Scene");

			// Ensure events are delivered post-activation
			testReceiver.Reset();
			scene.AddObject(testObj);
			Assert.IsTrue(testReceiver.HasReceived(InitializableEventReceiver.EventFlag.Activate), "Activate by addition to active Scene");

			testReceiver.Reset();
			testObj.RemoveComponent(testReceiver);
			Assert.IsTrue(testReceiver.HasReceived(InitializableEventReceiver.EventFlag.Deactivate), "Removal from object in active Scene");
			Assert.IsTrue(testReceiver.HasReceived(InitializableEventReceiver.EventFlag.RemovingFromGameObject), "Removal from object in active Scene");

			testReceiver.Reset();
			testObj.AddComponent(testReceiver);
			Assert.IsTrue(testReceiver.HasReceived(InitializableEventReceiver.EventFlag.Activate), "Addition to object in active Scene");
			Assert.IsTrue(testReceiver.HasReceived(InitializableEventReceiver.EventFlag.AddToGameObject), "Addition to object in active Scene");

			testReceiver.Reset();
			testObj.Active = false;
			Assert.IsTrue(testReceiver.HasReceived(InitializableEventReceiver.EventFlag.Deactivate), "Deactivate by GameObject.Active property in active Scene");

			testReceiver.Reset();
			testObj.Active = true;
			Assert.IsTrue(testReceiver.HasReceived(InitializableEventReceiver.EventFlag.Activate), "Activate by GameObject.Active property in active Scene");

			testReceiver.Reset();
			testReceiver.Active = false;
			Assert.IsTrue(testReceiver.HasReceived(InitializableEventReceiver.EventFlag.Deactivate), "Deactivate by Component.Active property in active Scene");

			testReceiver.Reset();
			testReceiver.Active = true;
			Assert.IsTrue(testReceiver.HasReceived(InitializableEventReceiver.EventFlag.Activate), "Activate by Component.Active property in active Scene");

			testReceiver.Reset();
			scene.RemoveObject(testObj);
			Assert.IsTrue(testReceiver.HasReceived(InitializableEventReceiver.EventFlag.Deactivate), "Deactivate by removal from active Scene");

			// Ensure no de/activation events are delivered in an inactive scene
			scene.Deactivate();
			testReceiver.Reset();
			scene.AddObject(testObj);
			testObj.Active = false;
			testObj.Active = true;
			testReceiver.Active = false;
			testReceiver.Active = true;
			scene.RemoveObject(testObj);
			Assert.AreEqual(InitializableEventReceiver.EventFlag.None, testReceiver.ReceivedEvents, "No de/activation events in inactive Scene");
		}

		private class UpdateSwitchToSceneComponent : Component, ICmpUpdatable
		{
			public ContentRef<Scene> Target { get; set; }
			public bool Switched { get; private set; }
			void ICmpUpdatable.OnUpdate()
			{
				Scene last = Scene.Current;
				Scene.SwitchTo(this.Target);
				this.Switched = (last != Scene.Current && Scene.Current == this.Target);
			}
		}
		private class UpdateReloadSceneComponent : Component, ICmpUpdatable
		{
			void ICmpUpdatable.OnUpdate()
			{
				Scene.Reload();
			}
		}
		private class InitSwitchToSceneComponent : Component, ICmpInitializable
		{
			public ContentRef<Scene> Target { get; set; }
			public bool Switched { get; private set; }
			void ICmpInitializable.OnActivate()
			{
				Scene last = Scene.Current;
				Scene.SwitchTo(this.Target);
				this.Switched = (last != Scene.Current && Scene.Current == this.Target);
			}
			void ICmpInitializable.OnDeactivate() {}
		}
		private class ShutdownSwitchToSceneComponent : Component, ICmpInitializable
		{
			public ContentRef<Scene> Target { get; set; }
			public bool Switched { get; private set; }
			void ICmpInitializable.OnActivate() {}
			void ICmpInitializable.OnDeactivate()
			{
				Scene last = Scene.Current;
				Scene.SwitchTo(this.Target);
				this.Switched = (last != Scene.Current && Scene.Current == this.Target);
			}
		}
		private class InitCreateChildComponent : Component, ICmpInitializable
		{
			public int CreateCount { get; set; }
			void ICmpInitializable.OnActivate()
			{
				if (this.CreateCount > 0)
				{
					GameObject other = new GameObject(string.Format("Object #{0}", this.CreateCount));
					InitCreateChildComponent childComponent = other.AddComponent<InitCreateChildComponent>();
					childComponent.CreateCount = this.CreateCount - 1;

					// Only parent to this object in the end, since this will trigger activation
					other.Parent = this.GameObj;
				}
			}
			void ICmpInitializable.OnDeactivate() { }
		}
	}
}


text:
import {SAVE_FUEL_SAVINGS, CALCULATE_FUEL_SAVINGS} from '../constants/actionTypes';
import calculator from '../businessLogic/fuelSavingsCalculator';
import dateHelper from '../businessLogic/dateHelper';
import objectAssign from 'object-assign';
import initialState from './initialState';

// IMPORTANT: Note that with Redux, state should NEVER be changed.
// State is considered immutable. Instead,
// create a copy of the state passed and set new values on the copy.
// Note that I'm using Object.assign to create a copy of current state
// and update values on the copy.
export default function fuelSavingsAppState(state = initialState, action) {
  switch (action.type) {
    case SAVE_FUEL_SAVINGS:
      // For this example, just simulating a save by changing date modified.
      // In a real app using Redux, you might use redux-thunk and handle the async call in fuelSavingsActions.js
      return objectAssign({}, state, {dateModified: dateHelper.getFormattedDateTime(new Date())});

    case CALCULATE_FUEL_SAVINGS:
    { // limit scope with this code block, to satisfy eslint no-case-declarations rule.
      let newState = objectAssign({}, state);
      newState[action.fieldName] = action.value;
      const calc = calculator();
      newState.necessaryDataIsProvidedToCalculateSavings = calc.necessaryDataIsProvidedToCalculateSavings(newState);
      newState.dateModified = dateHelper.getFormattedDateTime(new Date());

      if (newState.necessaryDataIsProvidedToCalculateSavings) {
        newState.savings = calc.calculateSavings(newState);
      }

      return newState;
    }

    default:
      return state;
  }
}


text: Code exercise as anex to written article in medium.com


text:
#!/usr/local/bin/fontforge

# Created by Monte Hurd on 11/06/14.
# Copyright (c) 2014 Monte Hurd. Provided under MIT-style license; please copy and modify!
#
# Makes "./font.ttf" from svg files found in "./svgs/".
# Svg's must be named according to following convention:
#     "UNICODE_CHAR GLYPH_NAME.svg"
#
# Example: "e950 MY_GLYPH 150.svg"
#	   This will be mapped to the font character e950 with glyph
#          name "MyGlyph".
#
# Note: running the "makeSvgsFromFont.py" script will generate
#     such an svg (named according to the convention) for each
#     glyph found in font.ttf. It will also generate a font.json file.
#
# Run this script with command:
#     fontforge -script makeFontFromSvgs.py
#
# References:
#    http://fontforge.org/python.html
#    http://tex.stackexchange.com/questions/22487/create-a-symbol-font-from-svg-symbols
#    http://fontforge.org/scripting.html
#    http://stderr.org/doc/fontforge/html/scripting-alpha.html#GlyphInfo

import fontforge
import glob
import json

# Create font object.
font = fontforge.font()

# Apply font settings from font.json
config = json.loads(open('./font.json').read())
font.fontname = config["fontname"]
font.fullname = config["fullname"]
font.familyname = config["familyname"]
font.weight = config["weight"]
font.version    = config["version"]
font.encoding   = config["encoding"]
font.copyright  = config["copyright"]
font.em  = config["em"]
font.ascent  = config["ascent"]
font.descent  = config["descent"]

# This is the name used when generating the font file.
fileName = "font"

# Folders!
svgFolder = "./svgs/"
outputFolder = "./"

# Build array of glyph info dictionaries.
print "\nStarted importing glyphs into " + fileName
glyphDictionaries = []
for fullName in glob.glob(svgFolder + '*.svg'):
    fullName = fullName[len(svgFolder):]
    words = fullName.split()
    if (len(words) == 2):
        glyphDictionary = {}
        glyphDictionary["fullName"] = fullName
        glyphDictionary["unicodeChar"] = words[0]
        glyphDictionary["name"] = words[1][:-4]
        glyphDictionaries.append(glyphDictionary)

# Sort it!
glyphDictionaries.sort(key=lambda x: x['name'])

# Add glyph for each dictionary entry to font object.
for glyphDictionary in glyphDictionaries:
        # Put new glyphs in the Private Use Area.
        glyph = font.createChar(int("0x{}".format(glyphDictionary["unicodeChar"]),0), glyphDictionary["name"])

        print "\tImporting \"" + glyphDictionary["fullName"] + "\""
        # Import svg data into the glyph.
        glyph.importOutlines(svgFolder + glyphDictionary["fullName"])

        # Make the glyph rest on the baseline.
        ymin = glyph.boundingBox()[1]
        glyph.transform([1, 0, 0, 1, 0, -ymin])

# Run various fontforge methods.
#font.canonicalContours()
font.round() # Needed to make simplify more reliable.
font.simplify()
font.removeOverlap()
font.round()
font.autoHint()

# Generate actual font files.
#font.generate(outputFolder + fileName + ".pfb", flags=["tfm", "afm"]) # type1 with tfm/afm
#font.generate(outputFolder + fileName + ".otf") # opentype
font.generate(outputFolder + fileName + ".ttf") # truetype
print "Finished generating " + outputFolder + fileName + ".ttf"

# Build css file.
cssFileContentsHeader = """
@font-face {
    font-family: '%s';
    /* src: url('%s.eot'); */ /* IE9 Compat Modes */
    src: url('%s.ttf') format('truetype'); /* Safari, Android, iOS */

         /* url('%s.eot?#iefix') format('embedded-opentype'), */ /* IE6-IE8 */
         /* url('%s.woff') format('woff'), */ /* Modern Browsers */
         /* url('%s.svg#8088f7bbbdba5c9832b27edb3dfcdf09') format('svg'); */ /* Legacy iOS */
}
.glyph {
    display: inline-block;
    height: 2.0em;
    width: 2.0em;
    text-align:center;
    font-family: '%s';
    -webkit-font-smoothing: antialiased;
    font-size: inherit;
    font-style: normal;
    font-weight: normal;
    line-height: 2.0em;
    overflow: visible;
    background-color:#eeeeee;
    border-width:4px;
    border-color:#ffffff;
    border-style:solid;
}
.glyph[dir='rtl'] {
  filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1);
  -webkit-transform: scale(-1, 1);
  -moz-transform: scale(-1, 1);
  -ms-transform: scale(-1, 1);
  -o-transform: scale(-1, 1);
  transform: scale(-1, 1);
}
"""

cssFileContentsHeader = cssFileContentsHeader % (font.familyname, fileName, fileName, fileName, fileName, fileName, font.familyname)

file = open(outputFolder + "font.css", "w")
file.write(cssFileContentsHeader)
for glyphDictionary in glyphDictionaries:
        cssClassForGlyph = """
            .%s:before {
                content:"\%s";
            }
        """
	cssClassForGlyph = cssClassForGlyph % (glyphDictionary["name"], glyphDictionary["unicodeChar"])
        file.write(cssClassForGlyph)

file.close()

# Build html file.
htmlFileContentsHeader = """
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>%s minimal code</title>
    <link rel="stylesheet" href="font.css">
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />

"""

htmlFileContentsHeader = htmlFileContentsHeader % (fileName)

file = open(outputFolder + "font.html", "w")
file.write(htmlFileContentsHeader)

file.write("
Glyphs
")

# Grid of glyphs for top of html file.
counter = 0
for glyphDictionary in glyphDictionaries:
        divForGlyph = """"""
	divForGlyph = divForGlyph % (glyphDictionary["name"])
        file.write(divForGlyph)
	counter += 1
	if (counter % 8) == 0:
            file.write("
")

settingsHTML = """

Reminder: when you've generated a new font, you may need to close your browser and re-open this file before you will see your changes!

Settings

Font name = %s

Full name = %s

Family name = %s

Weight = %s

Version = %s

Encoding = %s

Copyright = %s

Em = %s

Ascent = %s

Descent = %s

""" % (font.fontname, font.fullname, font.familyname, font.weight, font.version, font.encoding, font.copyright, font.em, font.ascent, font.descent)

file.write(settingsHTML)

file.write("
Glyph Names
")

# List of glyphs with names beneath grid.
for glyphDictionary in glyphDictionaries:
        divForGlyph = """

 %s

        """
	divForGlyph = divForGlyph % (glyphDictionary["name"], glyphDictionary["name"])
        file.write(divForGlyph)

file.write("\n\n")

file.close()

# Header file for iOS
glyphDictionaries.sort(key=lambda x: x['unicodeChar'])
file = open(outputFolder + "WikiGlyph_Chars.h", "w")
for glyphDictionary in glyphDictionaries:
        defineForGlyph = '\n#define {0:40} @"\\u{1}"'.format(glyphDictionary["name"], glyphDictionary["unicodeChar"].lower())
        file.write(defineForGlyph)

file.write('\n\n')
file.close()

font.close()

print "Finished generating font.html, font.css and WikiGlyph_Chars.h files\n"


text:
from interface_methods import bootstrap, mcmc, mapestimate, diagnostics, asir

def set_seed(value):
    swignifit_raw.setSeed(value)


text:
<Order OrderID="10309">
	<CustomerID>HUNGO</CustomerID>
	<EmployeeID>3</EmployeeID>
	<OrderDate>1996-09-19T20:02:00</OrderDate>
	<RequiredDate>1996-10-17T22:33:16</RequiredDate>
	<ShippedDate>1996-10-23T04:07:35</ShippedDate>
	<ShipVia>1</ShipVia>
	<Freight>47.3000</Freight>
	<ShipName>Hungry Owl All-Night Grocers</ShipName>
	<ShipAddress>8 Johnstown Road</ShipAddress>
	<ShipCity>Cork</ShipCity>
	<ShipRegion>Co. Cork</ShipRegion>
	<ShipPostalCode/>
	<ShipCountry>Ireland</ShipCountry>
	<OrderDetails>
		<OrderDetail>
			<ProductID>4</ProductID>
			<UnitPrice>17.6000</UnitPrice>
			<Quantity>20</Quantity>
			<Discount>0</Discount>
		</OrderDetail>
		<OrderDetail>
			<ProductID>6</ProductID>
			<UnitPrice>20.0000</UnitPrice>
			<Quantity>30</Quantity>
			<Discount>0</Discount>
		</OrderDetail>
		<OrderDetail>
			<ProductID>42</ProductID>
			<UnitPrice>11.2000</UnitPrice>
			<Quantity>2</Quantity>
			<Discount>0</Discount>
		</OrderDetail>
		<OrderDetail>
			<ProductID>43</ProductID>
			<UnitPrice>36.8000</UnitPrice>
			<Quantity>20</Quantity>
			<Discount>0</Discount>
		</OrderDetail>
		<OrderDetail>
			<ProductID>71</ProductID>
			<UnitPrice>17.2000</UnitPrice>
			<Quantity>3</Quantity>
			<Discount>0</Discount>
		</OrderDetail>
	</OrderDetails>
</Order>


text:
package dreajay.android.safe.activities;

import android.os.Bundle;
import dreajay.android.safe.R;

public class SJFDStep2Activity extends BaseStepActivity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_sjfd_step2);
	}

	@Override
	protected void moveNext() {
		loadActivity(SJFDStep3Activity.class);
		overridePendingTransition(R.anim.anim_tran_right_in, R.anim.anim_tran_left_out);
	}

	@Override
	protected void movePre() {
		loadActivity(SJFDStep1Activity.class);
		overridePendingTransition(R.anim.anim_tran_left_in, R.anim.anim_tran_right_out);
	}

}


text:
package org.osgi.test.cases.device.tbc;

import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.device.DriverLocator;
import org.osgi.service.device.DriverSelector;
import org.osgi.test.cases.device.tbc.locators.BasicTestLocator;
import org.osgi.test.cases.device.tbc.locators.DefaultSelectionLocator;
import org.osgi.test.cases.device.tbc.locators.DriverLoadingLocator1;
import org.osgi.test.cases.device.tbc.locators.DriverLoadingLocator2;
import org.osgi.test.cases.device.tbc.locators.DriverLoadingLocator3;
import org.osgi.test.cases.device.tbc.locators.EmptyLocator;
import org.osgi.test.cases.device.tbc.locators.RedirectionLocator1;
import org.osgi.test.cases.device.tbc.selectors.DriverLoadingTestSelector1;
import org.osgi.test.cases.device.tbc.selectors.DriverLoadingTestSelector2;
import org.osgi.test.support.compatibility.DefaultTestBundleControl;
import org.osgi.test.support.sleep.Sleep;

/**
 * The activator of the device access test case
 *
 * @author ProSyst
 * @version 1.0
 */
public class TestBundleControl extends DefaultTestBundleControl {
	private volatile int		message				= -1;
	/**
	 * Constant for no message in the post box
	 */
	public static final int		MESSAGE_NONE		= -1;
	/**
	 * Constant for OK message in the post box
	 */
	public static final int		MESSAGE_OK			= 0;
	/**
	 * Constant for ERROR message in the post box
	 */
	public static final int		MESSAGE_ERROR		= 1;
	private volatile boolean	noDriverFoundCalled	= false;
	private int					timeout				= 100;
	private ServiceRegistration<TestBundleControl>	tbcReg;

	protected void setUp() {
		tbcReg = getContext().registerService(
				TestBundleControl.class, this, null);
	}

	protected void tearDown() {
		tbcReg.unregister();
	}

	public int setMessage(int m) {
		if (this.message != MESSAGE_NONE && m != MESSAGE_NONE) {
			return -1;
		}
		this.message = m;
		return 0;
	}

	private int getMessage() {
		return this.message;
	}

	public void setNoDriverFoundCalled(boolean called) {
		this.noDriverFoundCalled = called;
	}

	private boolean noDriverFoundCalled() {
		return this.noDriverFoundCalled;
	}

	/*---------------------------------------------------------------------------------------------*/
	/*------------------------- Test methods ------------------------------------------------------*/
	/*---------------------------------------------------------------------------------------------*/
	/**
	 * Tests driver handling when there are no locator services registered
	 */
	public void testStandaloneDriver() {
		Bundle deviceBundle_0 = null;
		Bundle deviceBundle_20 = null;
		Bundle driverBundle_1 = null;
		Bundle driverBundle_7 = null;
		String subtest = "standalone driver test";
		try {
			log(
					subtest,
					"installing and starting device bundle 0 (standart device from the device detection test)");
			deviceBundle_0 = getContext().installBundle(
					getWebServer() + "dev0.jar");
			deviceBundle_0.start();
			log(subtest,
					"installing and starting device bundle 2 (standalone test device)");
			deviceBundle_20 = getContext().installBundle(
					getWebServer() + "dev20.jar");
			deviceBundle_20.start();

			try {
				Sleep.sleep(1000); // Give the RI time to settle (this is
									// BAD!!!!!)
			}
			catch (InterruptedException ie) {
				ie.printStackTrace();
			}

			log(
					subtest,
					"installing driver one - it should attatch to device 2 (standalone test device)");
			driverBundle_7 = getContext().installBundle(
					getWebServer() + "drv7.jar");
			driverBundle_7.start();
			// wait for driver to attach or to be rejected
			waitFor(subtest, "device attachment");

			//
			// The next test case sometimes fails because also the
			// previously registered dev20 is matched by drv7 ...
			// Might be a bug in the RI
			//
			log(subtest,
					"installing and starting basic driver bundle - it should attach to device 1");
			driverBundle_1 = getContext().installBundle(
					getWebServer() + "drv1.jar");
			driverBundle_1.start();
			// wait for driver to attach or to be rejected
			waitFor(subtest, "device attachment");

			log(subtest, "registering a locator service");
			ServiceRegistration<DriverLocator> reg = getContext()
					.registerService(DriverLocator.class,
							new EmptyLocator(this), null);
			log(
					subtest,
					"uninstalling driver 7. This should invoke the findDrivers method for the standalone device");
			driverBundle_7.uninstall();
			waitFor(subtest, "findDrivers call");
			log(subtest, "removing locator");
			reg.unregister();
			log(subtest,
					"installing driver 7. It should attach to device 2 again");
			driverBundle_7 = getContext().installBundle(
					getWebServer() + "drv7.jar");
			driverBundle_7.start();
			// wait for driver to attach or to be rejected
			waitFor(subtest, "device attachment");
		}
		catch (BundleException be) {
			be.printStackTrace();
			fail(subtest, be.getMessage());
		}
		finally {
			try {
				if (driverBundle_1 != null)
					driverBundle_1.uninstall();
				if (deviceBundle_0 != null)
					deviceBundle_0.uninstall();
				if (driverBundle_7 != null)
					driverBundle_7.uninstall();
				if (deviceBundle_20 != null)
					deviceBundle_20.uninstall();
			}
			catch (BundleException be) {
				be.printStackTrace();
				fail(subtest, be.getMessage());
			}
		}
		log(subtest, "finished");
	}

	/**
	 * Tests if devices are correctly recognized from the device manager and if
	 * the corresponding drivers are installed (which is the only way to check
	 * if the device manager has detected a device registration))
	 */
	public void testDeviceDetection() {
		Bundle deviceBundle = null;
		String subtest = "basic test";
		log(subtest, "registering services");
		ServiceRegistration<DriverLocator> locatorSR = getContext()
				.registerService(DriverLocator.class, new BasicTestLocator(
						this), null);
		for (int i = 0; i < 5; i++) {
			setNoDriverFoundCalled(false);
			log(subtest, "installing bundle! Test mode = " + i);
			try {
				deviceBundle = getContext().installBundle(
						getWebServer() + "dev" + String.valueOf(i) + ".jar");
				deviceBundle.start();
				// wait for drivers to attach or to be rejected
				// default timeout is 5 seconds. On slower hosts increase the
				// timeout by setting
				// the osgi.test.device.timeout property to a higher value
				// timeout is calculated with the following formula:
				// osgi.test.device.timeout * 100 milliseconds
				// so the default value for osgi.testdevice.timeout is 50.
				// Setting a lower value will decrease the timeout. Setting to
				// zero or negative will have no effect
				waitFor(subtest, "device detection");
				// wait a specific timeout for the noDriverFoundMethod to be
				// called
				if (i == 2) {
					int counter = 0;
					while (!noDriverFoundCalled() && counter++ < 100) {
						try {
							Sleep.sleep(timeout);
						}
						catch (InterruptedException ie) {
							ie.printStackTrace();
						}
					}
					if (noDriverFoundCalled())
						log(subtest, "noDriverFound called OK");
					else
						fail(subtest, "noDriverFound not called");
				}
				else {
					if (noDriverFoundCalled())
						fail(subtest, "noDriverFound called");
				}
			}
			catch (BundleException be) {
				be.printStackTrace();
				fail(subtest, "Error while installing basic device bundle");
			}
			finally {
				if (deviceBundle != null) {
					try {
						deviceBundle.uninstall();
					}
					catch (BundleException be) {
						be.printStackTrace();
						fail(subtest, be.getMessage());
					}
					/*
					 * the device manager is not obliged to remove idle drivers
					 * so I have to remove them manually
					 */
					uninstallDrivers();
				}
			}
		}
		locatorSR.unregister();
	}

	/**
	 * Tests the correct behavior of the device manager against registered
	 * driver locators and driver selectors
	 */
	public void testDriverLoading() {
		String subtest = "driver loading test";
		log(subtest, "registering locators and selector");
		// registering locators
		ServiceRegistration<DriverLocator> locator1SR = getContext()
				.registerService(DriverLocator.class,
				new DriverLoadingLocator1(this), null);
		ServiceRegistration<DriverLocator> locator2SR = getContext()
				.registerService(DriverLocator.class,
				new DriverLoadingLocator2(this), null);
		ServiceRegistration<DriverLocator> locator3SR = getContext()
				.registerService(DriverLocator.class,
				new DriverLoadingLocator3(this), null);
		// registering selector
		ServiceRegistration<DriverSelector> selector = getContext()
				.registerService(DriverSelector.class,
				new DriverLoadingTestSelector1(this), null);
		// registering one selector more - this should be ignored
		ServiceRegistration<DriverSelector> uselessSelector = getContext()
				.registerService(DriverSelector.class,
				new DriverLoadingTestSelector2(this), null);
		// install the bundle representing the device
		Bundle deviceBundle = null;
		try {
			log(subtest, "installing device bundle");
			deviceBundle = getContext().installBundle(
					getWebServer() + "dev100.jar");
			deviceBundle.start();
			waitFor(subtest, "device attachment");
		}
		catch (BundleException be) {
			be.printStackTrace();
			fail(subtest, "Error while installing the device bundle");
		}
		finally {
			if (deviceBundle != null) {
				try {
					deviceBundle.uninstall();
				}
				catch (BundleException be) {
					be.printStackTrace();
					fail(subtest, be.getMessage());
				}
			}
			locator1SR.unregister();
			locator2SR.unregister();
			locator3SR.unregister();
			selector.unregister();
			uselessSelector.unregister();
			/*
			 * the device manager is not obliged to remove idle drivers so I
			 * have to remove them manually
			 */
			uninstallDrivers();
		}
	}

	/**
	 * Tests the default selection algorithm
	 */
	public void testDefaultSelection() {
		String subtest = "default selection test";
		ServiceRegistration<DriverLocator> locatorSR = getContext()
				.registerService(DriverLocator.class,
				new DefaultSelectionLocator(this), null);
		Bundle deviceBundle = null;
		try {
			log(subtest, "installing device bundle");
			deviceBundle = getContext().installBundle(
					getWebServer() + "dev100.jar");
			deviceBundle.start();
			waitFor(subtest, "device attachment");
		}
		catch (BundleException be) {
			be.printStackTrace();
			fail(subtest, "Error while installing the device bundle");
		}
		finally {
			if (deviceBundle != null) {
				try {
					deviceBundle.uninstall();
				}
				catch (BundleException be) {
					be.printStackTrace();
					fail(subtest, be.getMessage());
				}
			}
			locatorSR.unregister();
			/*
			 * the device manager is not obliged to remove idle drivers so I
			 * have to remove them manually
			 */
			uninstallDrivers();
		}
	}

	/**
	 * Tests rediretion
	 */
	public void testRedirection() {
		String subtest = "redirection test";
		ServiceRegistration<DriverLocator> locator1SR = getContext()
				.registerService(DriverLocator.class,
				new RedirectionLocator1(this), null);
		Bundle deviceBundle = null;
		try {
			log(subtest, "installing device bundle");
			deviceBundle = getContext().installBundle(
					getWebServer() + "dev100.jar");
			deviceBundle.start();
			waitFor(subtest, "device attachment");
			/*
			 * Subtest removed - as stated in the spec the device manager must
			 * call all locator until one finds a driver. The calling order is
			 * not specified so I can't be sure that the dummy locator will be
			 * called.
			 */
			// REMOVED
			// // FIX - as locators may be called in a different thread I have
			// to
			//      // set some kind of timeout before checking the flag
			//      for (int i = 0; (i < 1000) && !RedirectionLocator2.called; i++) {
			//      	try {
			//        	Thread.sleep(5); // 5 seconds should be enough for everything
			//      	} catch (InterruptedException ie) {
			//        	ie.printStackTrace(); // nothing much more to do about this
			//      	}
			//      }
			//
			//      if (RedirectionLocator2.called) {
			//      	log("redirection test", "second locator called OK");
			//      } else {
			//      	log("redirection test", "second locator not called! Error!");
			//      }
			// REMOVED
		}
		catch (BundleException be) {
			be.printStackTrace();
			fail(subtest, "Error while installing the device bundle");
		}
		finally {
			if (deviceBundle != null) {
				try {
					deviceBundle.uninstall();
				}
				catch (BundleException be) {
					be.printStackTrace();
					fail(subtest, be.getMessage());
				}
			}
			locator1SR.unregister();
			/*
			 * the device manager is not obliged to remove idle drivers so I
			 * have to remove them manually
			 */
			uninstallDrivers();
		}
	}

	/*---------------------------------------------------------------------------------------------*/
	/*-------------------------------- utility methods --------------------------------------------*/
	/*---------------------------------------------------------------------------------------------*/
	private void uninstallDrivers() {
		Bundle[] bundles = getContext().getBundles();
		for (int i = 0; i < bundles.length; i++) {
			Bundle b = bundles[i];
			try {
				if (b.getSymbolicName().startsWith(
						"org.osgi.test.cases.device.drv")) {
					log("uninstalling " + b);
					b.uninstall();
				}
			}
			catch (BundleException be) {
				be.printStackTrace();
				fail(be.getMessage());
			}
		}
	}

	private void waitFor(String subtest, String message) {
		int counter = 0;
		int m = TestBundleControl.MESSAGE_NONE;
		while (((m = getMessage()) == TestBundleControl.MESSAGE_NONE)
				&& counter++ < 1000) {
			try {
				Sleep.sleep(timeout);
			}
			catch (InterruptedException ie) {
				ie.printStackTrace();
			}
		}
		switch (m) {
			case TestBundleControl.MESSAGE_OK :
				log(subtest, message + " OK");
				break;
			case TestBundleControl.MESSAGE_NONE :
				fail(subtest, message + " timed out!");
				break;
			case TestBundleControl.MESSAGE_ERROR :
				fail(subtest, "error message received do " + message);
				break;
			default :
				fail(subtest, "unkown message received");
		}
		setMessage(TestBundleControl.MESSAGE_NONE);
	}

	public void log(String subtest, String toLog) {
		log("[" + subtest + "] " + toLog);
	}

	public void fail(String subtest, String toLog) {
		fail("[" + subtest + "] " + toLog);
	}
}


text:
/**
 * @module LineType
 */

/**
 * A faked ENUM for referencing line types.
 *
 * @alias module:LineType
 * @param {number} VERTICAL
 * @param {number} HORIZONTAL
 */
const LineType = Object.freeze({
  VERTICAL: 1,
  HORIZONTAL: 2,
});

export default LineType;