text:
use std::fmt::Show;
use std::default::Default;

// Test that two blanket impls conflict (at least without negative
// bounds).  After all, some other crate could implement Even or Odd
// for the same type (though this crate doesn't).

trait MyTrait {
    fn get(&self) -> usize;
}

trait Even { }

trait Odd { }

impl Even for isize { }

impl Odd for usize { }

impl<T:Even> MyTrait for T { //~ ERROR E0119
    fn get(&self) -> usize { 0 }
}

impl<T:Odd> MyTrait for T {
    fn get(&self) -> usize { 0 }
}

fn main() { }


text:
/// @todo Documentation Core/Python/PythonInterpreter.cc

#ifdef BUILD_WITH_PYTHON
#ifdef _MSC_VER
//#pragma warning( push )
#pragma warning( disable: 4244 )
#endif

#include <Python.h>
#include <boost/python.hpp>
#include <boost/filesystem.hpp>
#include <boost/regex.hpp>
#include <boost/preprocessor.hpp>
#include <string>
#include <vector>
#include <condition_variable>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/string/trim_all.hpp>

//#include <Core/Application/Application.h>
#include <Core/Utils/StringContainer.h>
#include <Core/Utils/Lockable.h>
#include <Core/Utils/Legacy/StringUtil.h>

#include <Core/Python/PythonInterpreter.h>

#include <Dataflow/Engine/Python/SCIRunPythonModule.h>
#include <Core/Logging/Log.h>

using namespace SCIRun::Core;

namespace SCIRun
{
namespace Core
{

class PythonInterpreterPrivate : public Lockable
{
public:
  typedef std::pair< std::string, PyObject* ( * )( void ) > module_entry_type;
  typedef std::list< module_entry_type > module_list_type;

  std::string read_from_console( const int bytes = -1 );

  const wchar_t* programName() const { return !program_name_.empty() ? &program_name_[0] : L"<unset>"; }
  void setProgramName(const std::vector<wchar_t>& name)
  {
    program_name_ = name;
    //std::wcout << "PROGRAM NAME SET TO: " << programName() << std::endl;
  }

	// A list of Python extension modules that need to be initialized
	module_list_type modules_;
	// An instance of python CommandCompiler object (defined in codeop.py)
	boost::python::object compiler_;
	// The context of the Python main module.
	boost::python::object globals_;
	// Whether the Python interpreter has been initialized.
	bool initialized_;
	bool terminal_running_;
	// The input buffer
	std::string input_buffer_;
	// Whether the interpreter is waiting for input
	bool waiting_for_input_;
	// The command buffer (for Python statements that span over multiple lines)
	std::string command_buffer_;
	// Python sys.ps1
	std::string prompt1_;
	// Python sys.ps2
	std::string prompt2_;

	// Condition variable to make sure the PythonInterpreter thread has
	// completed initialization before continuing the main thread.
	std::condition_variable thread_condition_variable_;
private:
  // The name of the executable
  std::vector< wchar_t > program_name_;
};

std::string PythonInterpreterPrivate::read_from_console( const int bytes /*= -1 */ )
{
	lock_type lock( this->get_mutex() );

	std::string result;
	if ( !input_buffer_.empty() )
	{
		if ( bytes <= 0 )
		{
			result = input_buffer_;
			input_buffer_.clear();
		}
		else
		{
			result = input_buffer_.substr( 0, bytes );
			if ( bytes < static_cast< int >( input_buffer_.size() ) )
			{
				input_buffer_ = input_buffer_.substr( bytes );
			}
			else
			{
				input_buffer_.clear();
			}
		}
	}

	int more_bytes = bytes - static_cast< int >( result.size() );
	while ( ( bytes <= 0 && result.empty() ) ||
		( bytes > 0 && more_bytes > 0 ) )
	{
		this->waiting_for_input_ = true;
		this->thread_condition_variable_.wait( lock );

		// Abort reading if an interrupt signal has been received.
		if ( PyErr_CheckSignals() != 0 ) break;

		if ( bytes <= 0 )
		{
			result = input_buffer_;
			input_buffer_.clear();
		}
		else
		{
			result += input_buffer_.substr( 0, more_bytes );
			if ( more_bytes < static_cast< int >( input_buffer_.size() ) )
			{
				input_buffer_ = input_buffer_.substr( more_bytes );
			}
			else
			{
				input_buffer_.clear();
			}
		}

		more_bytes = bytes - static_cast< int >( result.size() );
	}

	this->waiting_for_input_ = false;
	return result;
}

}}

//////////////////////////////////////////////////////////////////////////
// Class PythonTerminal
//////////////////////////////////////////////////////////////////////////
class PythonStdIO
{
public:
	boost::python::object read( int n )
	{
		std::string data = PythonInterpreter::Instance().private_->read_from_console( n );
		boost::python::str pystr( data.c_str() );
		return pystr.encode();
	}

	std::string readline()
	{
		return PythonInterpreter::Instance().private_->read_from_console();
	}

	int write( const std::string& data )
	{
		PythonInterpreter::Instance().output_signal_( data );
		return static_cast< int >( data.size() );
	}
};

class PythonStdErr
{
public:
	int write( const std::string& data )
	{
		PythonInterpreter::Instance().error_signal_( data );
		return static_cast< int >( data.size() );
	}
};

BOOST_PYTHON_MODULE( interpreter )
{
	boost::python::class_< PythonStdIO >( "terminalio" )
		.def( "read", &PythonStdIO::read )
		.def( "readline", &PythonStdIO::readline )
		.def( "write", &PythonStdIO::write );

	boost::python::class_< PythonStdErr >( "terminalerr" )
		.def( "write", &PythonStdErr::write );
}

CORE_SINGLETON_IMPLEMENTATION( PythonInterpreter );

PythonInterpreter::PythonInterpreter() :
	private_( new PythonInterpreterPrivate )
{
	this->private_->initialized_ = false;
	this->private_->terminal_running_ = false;
	this->private_->waiting_for_input_ = false;
}

PythonInterpreter::~PythonInterpreter()
{
	// NOTE: Boost.Python requires that we don't call Py_Finalize
	//Py_Finalize();
}

//#define PRINT_PY_INIT_DEBUG(n) std::cout << "ev " << (n) << std::endl;
#define PRINT_PY_INIT_DEBUG(n)

bool needsSpecialPythonPathTreatment(const std::string& commandLine)
{
#if defined(BUILD_HEADLESS) && defined(__APPLE__)
  (void)commandLine;
  return true;
#else
  const std::string TEST_EXECUTABLE_NAME = "SCIRun_test";
  const std::string UNIT_TEST_EXECUTABLE_NAME = "Engine_Python_Tests";
  return commandLine.find(TEST_EXECUTABLE_NAME) != std::string::npos
    || commandLine.find(UNIT_TEST_EXECUTABLE_NAME) != std::string::npos;
  //TODO: this version is bugged if the test network name starts with a relative path: stem() returns the network name, not the executable name.
  //the full command line isn't normally a valid path object anyway.
  //  return 0 == boost::filesystem::path(commandLine).stem().string().compare(0, TEST_EXECUTABLE_NAME.size(), TEST_EXECUTABLE_NAME);
#endif
}

void PythonInterpreter::initialize_eventhandler(bool needsSpecialPythonPathTreatment, const boost::filesystem::path& libPath)
{
  PRINT_PY_INIT_DEBUG(1);
	using namespace boost::python;

	PythonInterpreterPrivate::lock_type lock( this->private_->get_mutex() );
  PRINT_PY_INIT_DEBUG(2);
	// Register C++ to Python type converters
	//RegisterToPythonConverters();

  // Add the extension modules
  PyImport_AppendInittab( "interpreter", PyInit_interpreter );
  PyImport_AppendInittab( "SCIRunPythonAPI", PyInit_SCIRunPythonAPI );
  for ( module_list_type::iterator it = this->private_->modules_.begin();
       it != this->private_->modules_.end(); ++it )
  {
    PyImport_AppendInittab( ( *it ).first.c_str(), ( *it ).second );
  }
  PRINT_PY_INIT_DEBUG(3);
  //std::wcerr << "initialize_eventhandler: program name=" << this->private_->programName() << std::endl;
  Py_SetProgramName(const_cast< wchar_t* >(this->private_->programName()));

  PRINT_PY_INIT_DEBUG(4);
  //std::wcout << "lib_path: " << lib_path.wstring() << std::endl;
  std::wstringstream lib_paths;
#if defined( _WIN32 )
  const std::wstring PATH_SEP(L";");
#else
  const std::wstring PATH_SEP(L":");
#endif
  PRINT_PY_INIT_DEBUG(5);
#if defined( __APPLE__ )
  boost::filesystem::path lib_path = libPath.parent_path();
  std::vector<boost::filesystem::path> lib_path_list;
  // relative paths
  PRINT_PY_INIT_DEBUG(lib_path);
  PRINT_PY_INIT_DEBUG(boost::filesystem::path(PYTHONPATH));
  lib_path_list.push_back(lib_path.parent_path() / boost::filesystem::path("Frameworks") / PYTHONPATH);
  PRINT_PY_INIT_DEBUG(lib_path_list.back());
  lib_path_list.push_back(lib_path / PYTHONPATH);
  PRINT_PY_INIT_DEBUG(lib_path_list.back());
  lib_path_list.push_back(lib_path.parent_path() / PYTHONPATH);
  PRINT_PY_INIT_DEBUG(lib_path_list.back());

  if (needsSpecialPythonPathTreatment)
  {
    boost::filesystem::path full_lib_path(PYTHONLIBDIR);
    full_lib_path /= PYTHONLIB;
    lib_path_list.push_back(full_lib_path);
  }

  for ( size_t i = 0; i < lib_path_list.size(); ++i )
  {
    auto path = lib_path_list[i];
    boost::filesystem::path plat_lib_path = path / "plat-darwin";
    boost::filesystem::path dynload_lib_path = path / "lib-dynload";
    boost::filesystem::path site_lib_path = path / "site-packages";
    if (i > 0)
    {
      lib_paths << PATH_SEP;
    }
    lib_paths << path.wstring() << PATH_SEP
              << plat_lib_path.wstring() << PATH_SEP
              << dynload_lib_path.wstring() << PATH_SEP
              << site_lib_path.wstring();
  }

  Py_SetPath( lib_paths.str().c_str() );
#elif defined (_WIN32)
  boost::filesystem::path lib_path = libPath;// Application::Instance().executablePath();
  boost::filesystem::path top_lib_path = lib_path / PYTHONPATH / PYTHONNAME;
  //std::cout << "top_lib_path: " << top_lib_path.string() << std::endl;
  boost::filesystem::path dynload_lib_path = top_lib_path / "lib-dynload";
  //std::cout << "dynload_lib_path: " << dynload_lib_path.string() << std::endl;
  boost::filesystem::path site_lib_path = top_lib_path / "site-packages";
  //std::cout << "site_lib_path: " << site_lib_path.string() << std::endl;
  lib_paths << top_lib_path.wstring() << PATH_SEP
            << site_lib_path.wstring();
  //std::wcout << "lib_paths final: " << lib_paths.str() << std::endl;
  Py_SetPath( lib_paths.str().c_str() );
  PRINT_PY_INIT_DEBUG(6);
#else
  // linux...
  boost::filesystem::path lib_path = libPath;
  boost::filesystem::path top_lib_path = lib_path / PYTHONPATH;
  boost::filesystem::path dynload_lib_path = top_lib_path / "lib-dynload";
  boost::filesystem::path site_lib_path = top_lib_path / "site-packages";
  boost::filesystem::path plat_lib_path = top_lib_path / "plat-linux";
  lib_paths << top_lib_path.wstring() << PATH_SEP
            << plat_lib_path.wstring() << PATH_SEP
            << dynload_lib_path.wstring() << PATH_SEP
            << site_lib_path.wstring();
  Py_SetPath( lib_paths.str().c_str() );
#endif

  // TODO: remove debug print when confident python initialization is stable
  //std::wcerr << lib_paths.str() << std::endl;
  PRINT_PY_INIT_DEBUG(7);
  Py_IgnoreEnvironmentFlag = 1;
  Py_InspectFlag = 1;
  Py_OptimizeFlag = 2;
#if !defined( _WIN32 )
  Py_NoSiteFlag = 1;
#endif
  Py_Initialize();
  PRINT_PY_INIT_DEBUG(8);
	// Create the compiler object
	PyRun_SimpleString( "from codeop import CommandCompiler\n"
		"__internal_compiler = CommandCompiler()\n" );
 	boost::python::object main_module = boost::python::import( "__main__" );
 	boost::python::object main_namespace = main_module.attr( "__dict__" );
	this->private_->compiler_ = main_namespace[ "__internal_compiler" ];
	this->private_->globals_ = main_namespace;
  PRINT_PY_INIT_DEBUG(9);
	// Set up the prompt strings
	PyRun_SimpleString( "import sys\n"
		"try:\n"
		"\tsys.ps1\n"
		"except AttributeError:\n"
		"\tsys.ps1 = \">>> \"\n"
		"try:\n"
		"\tsys.ps2\n"
		"except AttributeError:\n"
		"\tsys.ps2 = \"... \"\n" );
	boost::python::object sys_module = main_namespace[ "sys" ];
	boost::python::object sys_namespace = sys_module.attr( "__dict__" );
	this->private_->prompt1_ = boost::python::extract< std::string >( sys_namespace[ "ps1" ] );
	this->private_->prompt2_ = boost::python::extract< std::string >( sys_namespace[ "ps2" ] );
  PRINT_PY_INIT_DEBUG(10);
	// Hook up the I/O
	PyRun_SimpleString( "import interpreter\n"
		"__term_io = interpreter.terminalio()\n"
		"__term_err = interpreter.terminalerr()\n" );
	PyRun_SimpleString( "import sys\n"
		"sys.stdin = __term_io\n"
		"sys.stdout = __term_io\n"
		"sys.stderr = __term_err\n" );

  PyRun_SimpleString(
    "import atexit\n"
    "def quit_gracefully():\n"
    "\tprint('Goodbye!')\n"
    "atexit.register(quit_gracefully)\n"
  );

  PRINT_PY_INIT_DEBUG(11);
	// Remove intermediate python variables
	PyRun_SimpleString( "del (interpreter, __internal_compiler, __term_io, __term_err)\n" );
  PRINT_PY_INIT_DEBUG(12);

  this->private_->initialized_ = true;
  PRINT_PY_INIT_DEBUG(999);
}

namespace
{
  std::vector<std::string> argvFromFullString(const std::string& commandLine)
  {
    using namespace boost::algorithm;
    std::string cmdline = commandLine;
    trim_all(cmdline);
    std::vector<std::string> argv;
    split(argv, cmdline, is_any_of(" "));
    return argv;
  }

  std::vector<std::vector<wchar_t>> wideArgvFromArgv(const std::vector<std::string>& argv)
  {
    std::vector<std::vector<wchar_t>> wideArgv(argv.size());
    std::transform(argv.begin(), argv.end(), wideArgv.begin(), [](const std::string& arg)
    {
      std::vector<wchar_t> wide(arg.size() + 1);
      mbstowcs(&wide[0], arg.c_str(), wide.size() + 1);
      return wide;
    });
    return wideArgv;
  }

  std::vector<wchar_t*> wideArgvPtrsFromWideArgv(std::vector<std::vector<wchar_t>>& wideArgv)
  {
    std::vector<wchar_t*> wideArgvPtrs(wideArgv.size());
    std::transform(wideArgv.begin(), wideArgv.end(), wideArgvPtrs.begin(), [](std::vector<wchar_t>& wide) { return &wide[0]; });
    return wideArgvPtrs;
  }

  std::vector<wchar_t> getProgramName(const std::vector<std::string>& argv)
  {
    size_t name_len = argv[0].size();
    std::vector<wchar_t> program_name(name_len + 1);
    mbstowcs(&program_name[0], argv[0].c_str(), name_len + 1);
    return program_name;
  }

  void setPythonArgv(const std::vector<std::string>& argv)
  {
    auto wideArgv = wideArgvFromArgv(argv);
    auto wideArgvPtrs = wideArgvPtrsFromWideArgv(wideArgv);

    int argsOffset = 0;
    auto scriptFlag1 = std::find(argv.begin(), argv.end(), "-s");
    auto scriptFlag2 = std::find(argv.begin(), argv.end(), "--script");
    if (scriptFlag1 != argv.end())
    {
      argsOffset = scriptFlag1 - argv.begin() + 1;
    }
    else if (scriptFlag2 != argv.end())
    {
      argsOffset = scriptFlag2 - argv.begin() + 1;
    }

    PySys_SetArgv(wideArgvPtrs.size() - argsOffset, &wideArgvPtrs[argsOffset]);
  }
}

void PythonInterpreter::initialize(bool needProgramName, const std::string& commandLine, const boost::filesystem::path& libPath)
{
  const auto argv = argvFromFullString(commandLine);

  if (needProgramName)
  {
    this->private_->setProgramName(getProgramName(argv));
    // TODO: remove debug print when confident python initialization is stable
    //std::wcerr << "initialize program name=" << this->private_->programName() << std::endl;
  }

  initialize_eventhandler(needsSpecialPythonPathTreatment(commandLine), libPath);

  setPythonArgv(argv);

  {
    auto out = [](const std::string& s)
    {
      if (!std::all_of(s.begin(), s.end(), isspace))
        std::cout << "[PYTHON] " << s << std::endl;
    };
    auto error = [](const std::string& s) { std::cerr << "[PYTHON ERROR] " << s << std::endl; };
    output_signal_.connect(out);
    error_signal_.connect(error);
  }

  this->private_->initialized_ = true;
}

void PythonInterpreter::print_banner()
{
	PyRun_SimpleString( "print('Python %s on %s' % (sys.version, sys.platform))\n" );
	this->prompt_signal_( this->private_->prompt1_ );
}

bool PythonInterpreter::run_string( const std::string& command )
{
  LOG_DEBUG("Python::run_string( {} )", command);
	{
		PythonInterpreterPrivate::lock_type lock( this->private_->get_mutex() );
		if ( !this->private_->initialized_ )
		{
			throw std::invalid_argument( "The python interpreter hasn't been initialized!" );
		}
	}

	// Clear any previous Python errors.
	PyErr_Clear();

	// Append the command to the current command buffer
	if ( this->private_->command_buffer_.empty() )
	{
		this->private_->command_buffer_ = command;
	}
	else
	{
		if ( *this->private_->command_buffer_.rbegin() != '\n' )
		{
			this->private_->command_buffer_ += "\n";
		}
		this->private_->command_buffer_ += command;
	}

	// Compile the statement in the buffer
	boost::python::object code_obj;
	try
	{
		code_obj = this->private_->compiler_( this->private_->command_buffer_ );
	}
	catch ( ... ) {}

	// If an error happened during compilation, print the error message
	if ( PyErr_Occurred() )
	{
		PyErr_Print();
	}
	// If compilation succeeded and the code object is not Py_None
	else if ( code_obj )
	{
		try
		{
		  auto result = PyEval_EvalCode( code_obj.ptr(), this->private_->globals_.ptr(), nullptr );
			Py_XDECREF( result );
		}
		catch ( ... ) {}

		if ( PyErr_Occurred() )
		{
			if ( PyErr_ExceptionMatches( PyExc_EOFError ) )
			{
				this->error_signal_( "\nKeyboardInterrupt\n" );
				PyErr_Clear();
        return false;
			}
			else
			{
				PyErr_Print();
			}
		}
	}
	// If the code object is Py_None, prompt for more input
	else
	{
		this->prompt_signal_( this->private_->prompt2_ );
	}

	this->private_->command_buffer_.clear();
	this->prompt_signal_( this->private_->prompt1_ );

  return true;
}

void PythonInterpreter::run_script( const std::string& script )
{
  LOG_DEBUG("Python::run_script( {} )", script);
	{
		PythonInterpreterPrivate::lock_type lock( this->private_->get_mutex() );
		if ( !this->private_->initialized_ )
		{
			throw std::logic_error( "The python interpreter hasn't been initialized!" );
		}
	}

	// Output the script to the console
	//this->output_signal_( "Running script ...\n" );

	// Clear any previous Python errors.
	PyErr_Clear();

	// Compile the script
	boost::python::object code_obj;
	try
	{
		code_obj = this->private_->compiler_( script, "<script>", "exec" );
	}
	catch ( ... ) {}

	// If an error happened during compilation, print the error message
	if ( PyErr_Occurred() )
	{
		PyErr_Print();
	}
	// If compilation succeeded and the code object is not Py_None
	else if ( code_obj )
	{
		boost::python::dict local_var;
		PyObject* result = PyEval_EvalCode( code_obj.ptr(), this->private_->globals_.ptr(), local_var.ptr() );
		Py_XDECREF( result );
		if ( PyErr_Occurred() )
		{
			PyErr_Print();
		}
	}

	this->private_->command_buffer_.clear();
	this->prompt_signal_( this->private_->prompt1_ );
}

bool PythonInterpreter::run_file( const std::string& file_name )
{
  LOG_DEBUG("Python::run_file( {} )", file_name);
	{
		PythonInterpreterPrivate::lock_type lock( this->private_->get_mutex() );
		if ( !this->private_->initialized_ )
		{
			throw std::logic_error( "The python interpreter hasn't been initialized!" );
		}
	}
  const char* file = file_name.c_str();
  PyObject *obj = Py_BuildValue("s", file);
  FILE *fp2 = _Py_fopen_obj(obj, "r+");
  if (fp2)
  {
    PyRun_SimpleFile(fp2, file);
    return true;
  }
  else
  {
    this->error_signal_("Could not load python file: " + file_name);
    return false;
  }
}

void PythonInterpreter::interrupt()
{
	if ( PyErr_CheckSignals() != 0 )
	{
		this->error_signal_( "\nKeyboardInterrupt\n" );
		this->private_->command_buffer_.clear();
		this->prompt_signal_( this->private_->prompt1_ );
	}
}

void PythonInterpreter::start_terminal()
{
	{
		PythonInterpreterPrivate::lock_type lock( this->private_->get_mutex() );
		if ( !this->private_->initialized_ )
		{
			throw std::logic_error( "The python interpreter hasn't been initialized!" );
		}

		if ( this->private_->terminal_running_ )
		{
			return;
		}
	}

	PythonInterpreterPrivate::lock_type lock( this->private_->get_mutex() );
	this->private_->terminal_running_ = true;
	lock.unlock();

	wchar_t** argv = new wchar_t*[ 2 ];
  argv[0] = const_cast< wchar_t* >(this->private_->programName());
	argv[ 1 ] = nullptr;
	Py_Main( 1, argv );
	delete[] argv;

	lock.lock();
	this->private_->terminal_running_ = false;
}

std::string PythonInterpreter::EscapeSingleQuotedString( const std::string& str )
{
	static const boost::regex reg( "[\\\\']" );
	return boost::regex_replace( str, reg, "\\\\$&", boost::regex_constants::format_default );
}

void PythonInterpreter::importSCIRunLibrary()
{
  run_string("import SCIRunPythonAPI; from SCIRunPythonAPI import *");

#ifdef BUILD_TESTING
  const std::string assertFuncCode =
    "def scirun_assert(func, exit=False) :\n"
    "\tif not func() :\n"
    "\t\tscirun_add_module('ReadMatrix') # guarantee errored network\n"
    "\t\tscirun_quit_after_execute()\n"
    "\t\tscirun_execute_all()\n"
    "\telse:\n"
    "\t\tif exit:"
    "\t\t\tscirun_force_quit() # SCIRun returns 0 to console\n";
  run_string(assertFuncCode);
#endif
}

#endif

redpajama_set_name: RedPajamaGithub


text:
(function(global, factory) {

	"use strict";

	if (typeof module === "object" && typeof module.exports === "object") {

		// For CommonJS and CommonJS-like environments where a proper `window`
		// is present, execute the factory and get jQuery.
		// For environments that do not have a `window` with a `document`
		// (such as Node.js), expose a factory as module.exports.
		// This accentuates the need for the creation of a real `window`.
		// e.g. var jQuery = require("jquery")(window);
		// See ticket #14549 for more info.
		module.exports = global.document ? factory(global, true) : function(w) {
			if (!w.document) {
				throw new Error("service requires a window with a document");
			}
			return factory(w);
		};
	} else {
		factory(global);
	}

	// Pass this if window is not defined yet
})(typeof window !== "undefined" ? window : this, function(window, noGlobal) {

	var _ready_events = [], _error_events = [], _is_configed = false;
	var __BASE_URL = '';
	function _fire_events(evntes, arguments) {
		for (var i = 0, len = evntes.length; i < len; i++) {
			evntes[i].apply(service, arguments);
		}
	}
	function _ajax(action, method, data, options) {
		if (arguments.length == 3) {
			options = {};
		} else if (arguments.length == 2) {
			method = 'GET';
			data = method;
			options = {};
		} else if (arguments.length == 1) {
			method = 'GET';
			data = {};
			options = {};
		}

		var xhr = $.ajax($.extend({
			url : "/service",
			type : "POST",
			dataType : 'json',
			headers : {
				'X-XSRF-TOKEN' : _cookie('XSRF-TOKEN')
			},
			data : {
				url : __BASE_URL + action.toLowerCase(),
				type : method.toUpperCase(),
				data : data,
				cookie : __COOKIE_JAR
			}
		}, options));

		xhr.then(function() {
			console.info('http ' + action, arguments);
		}, function(xhr) {
			console.error('http ' + action, arguments);

			_fire_events(_error_events);
		});

		return xhr;
	}

	var service = {}, apis = {};

	/**
	 * 初始化
	 *
	 * @param Array options.jsApis 需要使用的Api required
	 */
	service.config = function(options) {

		_is_configed = true;

		// 添加Api
		options.jsApis.every(function(name) {
			var sev = service, api = apis;
			name.split(/\./g).every(function(n, i, arr) {
				api = api[n];

				if (i == arr.length - 1) {
					sev[n] = api;
				} else {
					sev = sev[n] = sev[n] || {};
				}

				return true;
			});

			return true;
		});

		// 回调
		_fire_events(_ready_events);
	};

	/**
	 * 成功回调
	 */
	service.ready = function(callback) {
		_ready_events.push(callback);

		if (_is_configed)
			callback.apply(service);
	};

	/**
	 * 异常回调
	 */
	service.error = function(callback) {
		_error_events.push(callback);
	};

	if (!noGlobal) {
		window.X = service;
	}

	return service;
});


text:
namespace CoreGlue.Middleware.LiquidMvc.Settings
{
    public class LiquidMvcSettings
    {
        public DebugSettingsNode Debug { get; set; } = new DebugSettingsNode();
        public string ContentDirectory { get; set; } = "wwwroot";
        public string AppDirectory { get; set; } = "app";
    }
}


text:
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse-1">
      Toggle navigation

    </button>

          {{profile.username}}

 Server Info

 Sign Out


text:
import request from 'axios';

import {
  BASE_API_URL,
  URLS
} from '../config';

import loggerFactory from '../utils/logger';

const logger = loggerFactory('From data-service.dist');

request.defaults.baseURL = BASE_API_URL;

export const saveAppConfig = newData => request.put(URLS.CONFIG.APP, newData);
export const getAppConfig = () => request.get(URLS.CONFIG.APP);
export const getAgentEmailConfig = () => request.get(URLS.CONFIG.AGENT_EMAIL);
export const saveAgentEmailConfig = data => {
  logger.debug('Inside saveAgentEmailConfig');
  logger.trace('data', data);

  return request.put(URLS.CONFIG.AGENT_EMAIL, data);
};

export const sendAgentEmail = data => {
  logger.debug('Inside sendAgentEmail');
  logger.trace('data', data);

  return request.post(URLS.EMAIL, data);
};


text:
import React from 'react';
import { shallow, mount } from 'enzyme';
import assert from 'power-assert';
import sinon from 'sinon';
import ResizableAndMovable from 'react-resizable-and-movable';
import Balloon from '../src/index';

const mouseMove = (node, x, y) => {
  const event = document.createEvent('MouseEvents');
  event.initMouseEvent('mousemove', true, true, window,
                       0, 0, 0, x, y, false, false, false, false, 0, null);
  document.dispatchEvent(event);
  return event;
};

describe('<Balloon/>', () => {
  it('should have default properties', () => {
    const balloon = mount(<Balloon />);
    assert.equal(balloon.props().zIndex, 100);
    assert.equal(balloon.props().className, '');
    assert.equal(balloon.props().backgroundColor, '#f5f5f5');
    assert.equal(balloon.props().minWidth, undefined);
    assert.equal(balloon.props().minHeight, undefined);
    assert.equal(balloon.props().maxWidth, undefined);
    assert.equal(balloon.props().maxHeight, undefined);
    assert.deepEqual(balloon.props().style, {});
    assert.deepEqual(balloon.props().start, {
      box: {
        x: 0,
        y: 0,
        width: 100,
        height: 100,
      },
      destination: {
        x: 0,
        y: 0,
      },
    });
  });

  it('Should root element have expected element and styles', () => {
    const balloon = shallow(<Balloon />);
    const expectedStyles = { width: '100%', height: '100%', zIndex: 100 };
    assert.equal(balloon.type(), 'div');
    assert.deepEqual(balloon.prop('style'), expectedStyles);
  });

  it('Should 1st element have expected type', () => {
    const balloon = shallow(<Balloon />);
    const first =  balloon.children().at(0);
    assert.equal(first.text(), '<ResizableAndMovable />');
  });

  it('Should 1st element have expected element without children', () => {
    const balloon = shallow(<Balloon />);
    const child =  balloon.children().at(0).children();
    assert.equal(child.type(), 'div');
    assert.equal(child.props().children, undefined);
  });

  it('Should 1st element have expected element with children', () => {
    const balloon = shallow(<Balloon>Test Text</Balloon>);
    const child =  balloon.children().at(0).children();
    assert.equal(child.type(), 'div');
    assert(child.children().contains('Test Text'));
  });

  it('Should chilrdren wrapper  have expected styles', () => {
    const balloon = shallow(<Balloon>Test Text</Balloon>);
    const child =  balloon.children().at(0).children();
    const expectedStyles = {
      padding: '1px',
      width: '100%',
      height: '100%',
    };
    assert.deepEqual(child.prop('style'), expectedStyles);
  });

  it('Should 2nd element have expected type', () => {
    const balloon = shallow(<Balloon />);
    const second =  balloon.children().at(1);
    assert.equal(second.text(), '<ResizableAndMovable />');
  });

  it('Should 2nd element have expected props', () => {
    const balloon = shallow(<Balloon />);
    const second =  balloon.children().at(1);
    assert.deepEqual(second.props().start, {x: -15, y: -15});
    assert.deepEqual(second.props().isResizable, { x: false, y: false, xy: false });
    assert.equal(second.props().bounds, 'parent');
    assert.equal(second.props().zIndex, 100);
    assert.equal(typeof second.props().onDrag, 'function');
  });

  it('Should 2nd element have marker component', () => {
    const balloon = shallow(<Balloon />);
    const child =  balloon.children().at(1).children();
    assert.equal(child.type(), 'div');
    assert.deepEqual(child.prop('style'), { width: '30px', height: '30px' });
  });

  it('Should 3rd element have expected type', () => {
    const balloon = shallow(<Balloon />);
    const third =  balloon.children().at(2);
    assert.equal(third.type(), 'svg');
  });

  it('Should 3rd element have one path element', () => {
    const balloon = shallow(<Balloon />);
    const third =  balloon.children().at(2);
    assert.equal(third.find('path').length, 1);
  });

  it('Should path on svg have expected props', () => {
    const balloon = shallow(<Balloon />);
    const path =  balloon.children().at(2).children();
    assert.equal(path.prop('strokeWidth'), 1);
    assert.equal(path.prop('stroke'), '#f5f5f5');
    assert.equal(path.prop('fill'), '#f5f5f5');
    assert.equal(path.prop('d').replace(/\s+/g, ''), 'M025Q05000Q050075');
  });

  it('should pass className properly to root ', () => {
    const balloon = shallow(<Balloon className="foo" style={{ color: 'black' }} />);
    assert.equal(balloon.prop('className'), 'foo');
  });

  it('should pass zIndex properly to root', () => {
    const balloon = shallow(<Balloon zIndex={ 999 } />);
    assert.deepEqual(balloon.prop('style'), { width: '100%', height: '100%', zIndex: 999 });
  });

  it('should pass props properly to first resizable box', () => {
    const balloon = shallow(
      <Balloon
         style={{ color: 'black' }}
         start={{ box: { x:100, y: 120, width: 140, height: 160 }, destination: { x:0, y: 0 } }}
         zIndex={ 999 }
         backgroundColor={'#000000'}
         maxHeight={ 200 }
         maxWidth={ 220 }
         minHeight={ 240 }
         minWidth={ 260 }
      />
    );
    const first =  balloon.children().at(0);
    assert.equal(first.prop('zIndex'), 999);
    assert.equal(first.prop('maxHeight'), 200);
    assert.equal(first.prop('maxWidth'), 220);
    assert.equal(first.prop('minHeight'), 240);
    assert.equal(first.prop('minWidth'), 260);
    assert.deepEqual(first.prop('customStyle'), { color: 'black', backgroundColor: '#000000' });
    assert.deepEqual(first.prop('start'), { x: 100, y: 120, width: 140, height: 160 });
  });

  it('should pass props properly to second resizable box', () => {
    const balloon = shallow(
      <Balloon
         start={{ box: { x: 100, y: 120, width: 140, height: 160 }, destination: { x:100, y: 300 } }}
         zIndex={ 999 }
         marker={foo}
      />
    );
    const second =  balloon.children().at(1);
    assert.equal(second.prop('zIndex'), 999);
    assert.deepEqual(second.prop('start'), { x: 85, y: 285 });
    const marker = second.children();
    assert.equal(marker.type(), 'span');
    assert(marker.contains('foo'));
  });

  it('should pass props properly to svg', () => {
    const balloon = shallow(
      <Balloon
         backgroundColor={'#000000'}
         zIndex={999}
      />
    );
    const svg =  balloon.children().at(2);
    assert.equal(svg.prop('style').zIndex, 999);
    const path =  svg.children();
    assert.equal(path.prop('stroke'), '#000000');
    assert.equal(path.prop('fill'), '#000000');
  });

  it('should onPointerDragxxx called, when maker dragged', () => {
    const spy = sinon.spy(Balloon.prototype, 'onPointerDrag');
    const onPointerDragStart = sinon.spy();
    const onPointerDragStop = sinon.spy();
    const onPointerDrag = sinon.spy();
    const balloon = mount(
      <Balloon
         start={{ box: { x: 100, y: 120, width: 140, height: 160 }, destination: { x:100, y: 300 } }}
         onPointerDrag={onPointerDrag}
         onPointerDragStop={onPointerDragStop}
         onPointerDragStart={onPointerDragStart}
      />);
    const marker = balloon.children().at(1).children();
    marker.find('div').at(0).simulate('mousedown');
    // TODO: Not simulated properly
    mouseMove(marker.find('div').get(0), 100, 100);
    marker.find('div').at(0).simulate('mouseup');
    assert(Balloon.prototype.onPointerDrag.calledOnce);
    assert(onPointerDragStart.calledOnce);
    assert(onPointerDragStop.calledOnce);
    assert.deepEqual(onPointerDrag.getCall(0).args[0], {left: 85, top: 285});
    // FIXME: dragStop return NaN
    //assert.deepEqual(onPointerDragStop.getCall(0).args[0], {left: 85, top: 285});
  });

  it('should onBoxDragxxx called, when box dragged', () => {
    const spy = sinon.spy(Balloon.prototype, 'onBoxDrag');
    const onBoxDragStart = sinon.spy();
    const onBoxDragStop = sinon.spy();
    const onBoxDrag = sinon.spy();
    const balloon = mount(
      <Balloon
         start={{ box: { x: 100, y: 120, width: 140, height: 160 }, destination: { x:100, y: 300 } }}
         onBoxDrag={onBoxDrag}
         onBoxDragStop={onBoxDragStop}
         onBoxDragStart={onBoxDragStart}
      />);
    const box = balloon.children().at(0).children();
    box.find('div').at(0).simulate('mousedown');
    // TODO: Not simulated properly
    mouseMove(box.find('div').get(0), 100, 100);
    box.find('div').at(0).simulate('mouseup');
    assert(Balloon.prototype.onBoxDrag.calledOnce);
    assert(onBoxDragStart.calledOnce);
    assert(onBoxDragStop.calledOnce);
    assert.deepEqual(onBoxDrag.getCall(0).args[0], { left: 100, top: 120 });
  });

  it('should onBoxResizexxx called, when box resized', () => {
    const spy = sinon.spy(Balloon.prototype, 'onBoxResize');
    const onBoxResizeStart = sinon.spy();
    const onBoxResizeStop = sinon.spy();
    const onBoxResize = sinon.spy();
    const balloon = mount(
      <Balloon
         start={{ box: { x: 100, y: 120, width: 140, height: 160 }, destination: { x:100, y: 300 } }}
         onBoxResize={onBoxResize}
         onBoxResizeStop={onBoxResizeStop}
         onBoxResizeStart={onBoxResizeStart}
      />
    );
    const box = balloon.children().at(0).children();
    box.find('div').children().at(1).simulate('mousedown');
    mouseMove(box.find('div').children().at(1), 10, 10);
    box.find('div').children().at(1).simulate('mouseup');
    assert(Balloon.prototype.onBoxResize.calledOnce);
    assert(onBoxResizeStart.calledOnce);
    // FIXME: onBoxResizeStop not called
    //assert(onBoxResizeStop.calledOnce);
  });
});


text:
package com.laytonsmith.PureUtilities;

import com.laytonsmith.annotations.NonInheritImplements;
import static org.junit.Assert.assertTrue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.Is.is;
import org.junit.Test;

/**
 *
 * @author cailin
 */
public class NonInheritImplementsTest {

	public static class A1 implements B1 {
		@Override
		public void method(){}
	}
	public static interface B1 {
		void method();
	}

	@Test
	public void testNormalWorks() throws Exception {
		assertThat(NonInheritImplements.Helper.Instanceof(new A1(), B1.class), is(true));
		A1 a1 = new A1();
		B1 b1 = NonInheritImplements.Helper.Cast(B1.class, a1);
		assertTrue(a1 == b1);
	}

	@Test(expected = ClassCastException.class)
	public void testNormalFailsCorrectly1() throws Exception {
		assertThat(NonInheritImplements.Helper.Instanceof(new A1(), NonInheritImplements.class), is(false));
		NonInheritImplements.Helper.Cast(NonInheritImplements.class, this);
	}

	@NonInheritImplements(B2.class)
	public static class A2 {
		public String method2(int i) {
			return Integer.toString(i);
		}
	}

	public static interface B2 {
		String method2(int i);
	}

	@Test
	public void testProxyWorks() throws Exception {
		assertThat(NonInheritImplements.Helper.Instanceof(new A2(), B2.class), is(true));
		A2 a2 = new A2();
		B2 b2 = NonInheritImplements.Helper.Cast(B2.class, a2);
		assertThat(b2.method2(12), is("12"));
	}

}


text:
// Code generated by the FlatBuffers compiler. DO NOT EDIT.

package nntbs

import (
	"strconv"

	flatbuffers "github.com/google/flatbuffers/go"
)

type NumericValueT struct {
	Type  NumericValue
	Value interface{}
}

func NumericValuePack(builder *flatbuffers.Builder, t *NumericValueT) flatbuffers.UOffsetT {
	if t == nil {
		return 0
	}
	switch t.Type {
	case NumericValueIntValue:
		return IntValuePack(builder, t.Value.(*IntValueT))
	case NumericValueUintValue:
		return UintValuePack(builder, t.Value.(*UintValueT))
	case NumericValueLongValue:
		return LongValuePack(builder, t.Value.(*LongValueT))
	case NumericValueUlongValue:
		return UlongValuePack(builder, t.Value.(*UlongValueT))
	case NumericValueDoubleValue:
		return DoubleValuePack(builder, t.Value.(*DoubleValueT))
	case NumericValueAbsentValue:
		return AbsentValuePack(builder, t.Value.(*AbsentValueT))
	case NumericValueNullValue:
		return NullValuePack(builder, t.Value.(*NullValueT))
	}
	return 0
}

func NumericValueUnPack(t NumericValue, table flatbuffers.Table) *NumericValueT {
	switch t {
	case NumericValueIntValue:
		x := IntValue{_tab: table}
		return &NumericValueT{Type: NumericValueIntValue, Value: x.UnPack()}
	case NumericValueUintValue:
		x := UintValue{_tab: table}
		return &NumericValueT{Type: NumericValueUintValue, Value: x.UnPack()}
	case NumericValueLongValue:
		x := LongValue{_tab: table}
		return &NumericValueT{Type: NumericValueLongValue, Value: x.UnPack()}
	case NumericValueUlongValue:
		x := UlongValue{_tab: table}
		return &NumericValueT{Type: NumericValueUlongValue, Value: x.UnPack()}
	case NumericValueDoubleValue:
		x := DoubleValue{_tab: table}
		return &NumericValueT{Type: NumericValueDoubleValue, Value: x.UnPack()}
	case NumericValueAbsentValue:
		x := AbsentValue{_tab: table}
		return &NumericValueT{Type: NumericValueAbsentValue, Value: x.UnPack()}
	case NumericValueNullValue:
		x := NullValue{_tab: table}
		return &NumericValueT{Type: NumericValueNullValue, Value: x.UnPack()}
	}
	return nil
}

/*type ReplicationValueT struct {
	Type  ReplicationValue
	Value interface{}
}

func ReplicationValuePack(builder *flatbuffers.Builder, t *ReplicationValueT) flatbuffers.UOffsetT {
	if t == nil {
		return 0
	}
	switch t.Type {
	case ReplicationValueNNT_V2:
		return NNT_V2Pack(builder, t.Value.(*NNT_V2T))
	case ReplicationValueText:
		return TextPack(builder, t.Value.(*TextT))
	case ReplicationValueHistogram:
		return HistogramPack(builder, t.Value.(*HistogramT))
	case ReplicationValueRawNumeric:
		return RawNumericPack(builder, t.Value.(*RawNumericT))
	case ReplicationValueLogMsg:
		return LogMsgPack(builder, t.Value.(*LogMsgT))
	case ReplicationValueLoadLuaMsg:
		return LoadLuaMsgPack(builder, t.Value.(*LoadLuaMsgT))
	case ReplicationValueDeleteMsg:
		return DeleteMsgPack(builder, t.Value.(*DeleteMsgT))
	case ReplicationValueSurrogatePut:
		return SurrogatePutPack(builder, t.Value.(*SurrogatePutT))
	case ReplicationValueActivityRebuild:
		return ActivityRebuildPack(builder, t.Value.(*ActivityRebuildT))
	case ReplicationValueSetCrdtAlter:
		return SetCrdtAlterPack(builder, t.Value.(*SetCrdtAlterT))
	case ReplicationValueSetCrdtMergeRequest:
		return SetCrdtMergeRequestPack(builder, t.Value.(*SetCrdtMergeRequestT))
	}
	return 0
}

func ReplicationValueUnPack(t ReplicationValue, table flatbuffers.Table) *ReplicationValueT {
	switch t {
	case ReplicationValueNNT_V2:
		x := NNT_V2{_tab: table}
		return &ReplicationValueT{Type: ReplicationValueNNT_V2, Value: x.UnPack()}
	case ReplicationValueText:
		x := Text{_tab: table}
		return &ReplicationValueT{Type: ReplicationValueText, Value: x.UnPack()}
	case ReplicationValueHistogram:
		x := Histogram{_tab: table}
		return &ReplicationValueT{Type: ReplicationValueHistogram, Value: x.UnPack()}
	case ReplicationValueRawNumeric:
		x := RawNumeric{_tab: table}
		return &ReplicationValueT{Type: ReplicationValueRawNumeric, Value: x.UnPack()}
	case ReplicationValueLogMsg:
		x := LogMsg{_tab: table}
		return &ReplicationValueT{Type: ReplicationValueLogMsg, Value: x.UnPack()}
	case ReplicationValueLoadLuaMsg:
		x := LoadLuaMsg{_tab: table}
		return &ReplicationValueT{Type: ReplicationValueLoadLuaMsg, Value: x.UnPack()}
	case ReplicationValueDeleteMsg:
		x := DeleteMsg{_tab: table}
		return &ReplicationValueT{Type: ReplicationValueDeleteMsg, Value: x.UnPack()}
	case ReplicationValueSurrogatePut:
		x := SurrogatePut{_tab: table}
		return &ReplicationValueT{Type: ReplicationValueSurrogatePut, Value: x.UnPack()}
	case ReplicationValueActivityRebuild:
		x := ActivityRebuild{_tab: table}
		return &ReplicationValueT{Type: ReplicationValueActivityRebuild, Value: x.UnPack()}
	case ReplicationValueSetCrdtAlter:
		x := SetCrdtAlter{_tab: table}
		return &ReplicationValueT{Type: ReplicationValueSetCrdtAlter, Value: x.UnPack()}
	case ReplicationValueSetCrdtMergeRequest:
		x := SetCrdtMergeRequest{_tab: table}
		return &ReplicationValueT{Type: ReplicationValueSetCrdtMergeRequest, Value: x.UnPack()}
	}
	return nil
}*/

type BlockType int8

const (
	BlockTypeAll        BlockType = 0
	BlockTypeAverage    BlockType = 1
	BlockTypeCounter    BlockType = 2
	BlockTypeDerivative BlockType = 3
)

var EnumNamesBlockType = map[BlockType]string{
	BlockTypeAll:        "All",
	BlockTypeAverage:    "Average",
	BlockTypeCounter:    "Counter",
	BlockTypeDerivative: "Derivative",
}

var EnumValuesBlockType = map[string]BlockType{
	"All":        BlockTypeAll,
	"Average":    BlockTypeAverage,
	"Counter":    BlockTypeCounter,
	"Derivative": BlockTypeDerivative,
}

func (v BlockType) String() string {
	if s, ok := EnumNamesBlockType[v]; ok {
		return s
	}
	return "BlockType(" + strconv.FormatInt(int64(v), 10) + ")"
}

type NNTDatumT struct {
	Zero             bool
	Count            uint32
	Stddev           float32
	Value            *NumericValueT
	Derivative       float32
	DerivativeStddev float32
	Counter          float32
	CounterStddev    float32
}

func NNTDatumPack(builder *flatbuffers.Builder, t *NNTDatumT) flatbuffers.UOffsetT {
	if t == nil {
		return 0
	}
	valueOffset := NumericValuePack(builder, t.Value)

	NNTDatumStart(builder)
	NNTDatumAddZero(builder, t.Zero)
	NNTDatumAddCount(builder, t.Count)
	NNTDatumAddStddev(builder, t.Stddev)
	if t.Value != nil {
		NNTDatumAddValueType(builder, t.Value.Type)
	}
	NNTDatumAddValue(builder, valueOffset)
	NNTDatumAddDerivative(builder, t.Derivative)
	NNTDatumAddDerivativeStddev(builder, t.DerivativeStddev)
	NNTDatumAddCounter(builder, t.Counter)
	NNTDatumAddCounterStddev(builder, t.CounterStddev)
	return NNTDatumEnd(builder)
}

func (rcv *NNTDatum) UnPack() *NNTDatumT {
	if rcv == nil {
		return nil
	}
	t := &NNTDatumT{}
	t.Zero = rcv.Zero()
	t.Count = rcv.Count()
	t.Stddev = rcv.Stddev()
	valueTable := flatbuffers.Table{}
	if rcv.Value(&valueTable) {
		t.Value = NumericValueUnPack(rcv.ValueType(), valueTable)
	}
	t.Derivative = rcv.Derivative()
	t.DerivativeStddev = rcv.DerivativeStddev()
	t.Counter = rcv.Counter()
	t.CounterStddev = rcv.CounterStddev()
	return t
}

type NNTDatum struct {
	_tab flatbuffers.Table
}

func GetRootAsNNTDatum(buf []byte, offset flatbuffers.UOffsetT) *NNTDatum {
	n := flatbuffers.GetUOffsetT(buf[offset:])
	x := &NNTDatum{}
	x.Init(buf, n+offset)
	return x
}

func (rcv *NNTDatum) Init(buf []byte, i flatbuffers.UOffsetT) {
	rcv._tab.Bytes = buf
	rcv._tab.Pos = i
}

func (rcv *NNTDatum) Table() flatbuffers.Table {
	return rcv._tab
}

func (rcv *NNTDatum) Zero() bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		return rcv._tab.GetBool(o + rcv._tab.Pos)
	}
	return false
}

func (rcv *NNTDatum) MutateZero(n bool) bool {
	return rcv._tab.MutateBoolSlot(4, n)
}

func (rcv *NNTDatum) Count() uint32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		return rcv._tab.GetUint32(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *NNTDatum) MutateCount(n uint32) bool {
	return rcv._tab.MutateUint32Slot(6, n)
}

func (rcv *NNTDatum) Stddev() float32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
	if o != 0 {
		return rcv._tab.GetFloat32(o + rcv._tab.Pos)
	}
	return 0.0
}

func (rcv *NNTDatum) MutateStddev(n float32) bool {
	return rcv._tab.MutateFloat32Slot(8, n)
}

func (rcv *NNTDatum) ValueType() NumericValue {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
	if o != 0 {
		return NumericValue(rcv._tab.GetByte(o + rcv._tab.Pos))
	}
	return 0
}

func (rcv *NNTDatum) MutateValueType(n NumericValue) bool {
	return rcv._tab.MutateByteSlot(10, byte(n))
}

func (rcv *NNTDatum) Value(obj *flatbuffers.Table) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
	if o != 0 {
		rcv._tab.Union(obj, o)
		return true
	}
	return false
}

func (rcv *NNTDatum) Derivative() float32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
	if o != 0 {
		return rcv._tab.GetFloat32(o + rcv._tab.Pos)
	}
	return 0.0
}

func (rcv *NNTDatum) MutateDerivative(n float32) bool {
	return rcv._tab.MutateFloat32Slot(14, n)
}

func (rcv *NNTDatum) DerivativeStddev() float32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(16))
	if o != 0 {
		return rcv._tab.GetFloat32(o + rcv._tab.Pos)
	}
	return 0.0
}

func (rcv *NNTDatum) MutateDerivativeStddev(n float32) bool {
	return rcv._tab.MutateFloat32Slot(16, n)
}

func (rcv *NNTDatum) Counter() float32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(18))
	if o != 0 {
		return rcv._tab.GetFloat32(o + rcv._tab.Pos)
	}
	return 0.0
}

func (rcv *NNTDatum) MutateCounter(n float32) bool {
	return rcv._tab.MutateFloat32Slot(18, n)
}

func (rcv *NNTDatum) CounterStddev() float32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(20))
	if o != 0 {
		return rcv._tab.GetFloat32(o + rcv._tab.Pos)
	}
	return 0.0
}

func (rcv *NNTDatum) MutateCounterStddev(n float32) bool {
	return rcv._tab.MutateFloat32Slot(20, n)
}

func NNTDatumStart(builder *flatbuffers.Builder) {
	builder.StartObject(9)
}
func NNTDatumAddZero(builder *flatbuffers.Builder, zero bool) {
	builder.PrependBoolSlot(0, zero, false)
}
func NNTDatumAddCount(builder *flatbuffers.Builder, count uint32) {
	builder.PrependUint32Slot(1, count, 0)
}
func NNTDatumAddStddev(builder *flatbuffers.Builder, stddev float32) {
	builder.PrependFloat32Slot(2, stddev, 0.0)
}
func NNTDatumAddValueType(builder *flatbuffers.Builder, valueType NumericValue) {
	builder.PrependByteSlot(3, byte(valueType), 0)
}
func NNTDatumAddValue(builder *flatbuffers.Builder, value flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(4, flatbuffers.UOffsetT(value), 0)
}
func NNTDatumAddDerivative(builder *flatbuffers.Builder, derivative float32) {
	builder.PrependFloat32Slot(5, derivative, 0.0)
}
func NNTDatumAddDerivativeStddev(builder *flatbuffers.Builder, derivativeStddev float32) {
	builder.PrependFloat32Slot(6, derivativeStddev, 0.0)
}
func NNTDatumAddCounter(builder *flatbuffers.Builder, counter float32) {
	builder.PrependFloat32Slot(7, counter, 0.0)
}
func NNTDatumAddCounterStddev(builder *flatbuffers.Builder, counterStddev float32) {
	builder.PrependFloat32Slot(8, counterStddev, 0.0)
}
func NNTDatumEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}

type NNTBlockT struct {
	Type       BlockType
	Crc        uint32
	Version    uint32
	BlockFloor uint64
	CreationUs uint64
	Data       []*NNTDatumT
}

func NNTBlockPack(builder *flatbuffers.Builder, t *NNTBlockT) flatbuffers.UOffsetT {
	if t == nil {
		return 0
	}
	dataOffset := flatbuffers.UOffsetT(0)
	if t.Data != nil {
		dataLength := len(t.Data)
		dataOffsets := make([]flatbuffers.UOffsetT, dataLength)
		for j := 0; j < dataLength; j++ {
			dataOffsets[j] = NNTDatumPack(builder, t.Data[j])
		}
		NNTBlockStartDataVector(builder, dataLength)
		for j := dataLength - 1; j >= 0; j-- {
			builder.PrependUOffsetT(dataOffsets[j])
		}
		dataOffset = builder.EndVector(dataLength)
	}
	NNTBlockStart(builder)
	NNTBlockAddType(builder, t.Type)
	NNTBlockAddCrc(builder, t.Crc)
	NNTBlockAddVersion(builder, t.Version)
	NNTBlockAddBlockFloor(builder, t.BlockFloor)
	NNTBlockAddCreationUs(builder, t.CreationUs)
	NNTBlockAddData(builder, dataOffset)
	return NNTBlockEnd(builder)
}

func (rcv *NNTBlock) UnPack() *NNTBlockT {
	if rcv == nil {
		return nil
	}
	t := &NNTBlockT{}
	t.Type = rcv.Type()
	t.Crc = rcv.Crc()
	t.Version = rcv.Version()
	t.BlockFloor = rcv.BlockFloor()
	t.CreationUs = rcv.CreationUs()
	dataLength := rcv.DataLength()
	t.Data = make([]*NNTDatumT, dataLength)
	for j := 0; j < dataLength; j++ {
		x := NNTDatum{}
		rcv.Data(&x, j)
		t.Data[j] = x.UnPack()
	}
	return t
}

type NNTBlock struct {
	_tab flatbuffers.Table
}

func GetRootAsNNTBlock(buf []byte, offset flatbuffers.UOffsetT) *NNTBlock {
	n := flatbuffers.GetUOffsetT(buf[offset:])
	x := &NNTBlock{}
	x.Init(buf, n+offset)
	return x
}

func (rcv *NNTBlock) Init(buf []byte, i flatbuffers.UOffsetT) {
	rcv._tab.Bytes = buf
	rcv._tab.Pos = i
}

func (rcv *NNTBlock) Table() flatbuffers.Table {
	return rcv._tab
}

func (rcv *NNTBlock) Type() BlockType {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		return BlockType(rcv._tab.GetInt8(o + rcv._tab.Pos))
	}
	return 0
}

func (rcv *NNTBlock) MutateType(n BlockType) bool {
	return rcv._tab.MutateInt8Slot(4, int8(n))
}

func (rcv *NNTBlock) Crc() uint32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		return rcv._tab.GetUint32(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *NNTBlock) MutateCrc(n uint32) bool {
	return rcv._tab.MutateUint32Slot(6, n)
}

func (rcv *NNTBlock) Version() uint32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
	if o != 0 {
		return rcv._tab.GetUint32(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *NNTBlock) MutateVersion(n uint32) bool {
	return rcv._tab.MutateUint32Slot(8, n)
}

func (rcv *NNTBlock) BlockFloor() uint64 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
	if o != 0 {
		return rcv._tab.GetUint64(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *NNTBlock) MutateBlockFloor(n uint64) bool {
	return rcv._tab.MutateUint64Slot(10, n)
}

func (rcv *NNTBlock) CreationUs() uint64 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(12))
	if o != 0 {
		return rcv._tab.GetUint64(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *NNTBlock) MutateCreationUs(n uint64) bool {
	return rcv._tab.MutateUint64Slot(12, n)
}

func (rcv *NNTBlock) Data(obj *NNTDatum, j int) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
	if o != 0 {
		x := rcv._tab.Vector(o)
		x += flatbuffers.UOffsetT(j) * 4
		x = rcv._tab.Indirect(x)
		obj.Init(rcv._tab.Bytes, x)
		return true
	}
	return false
}

func (rcv *NNTBlock) DataLength() int {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(14))
	if o != 0 {
		return rcv._tab.VectorLen(o)
	}
	return 0
}

func NNTBlockStart(builder *flatbuffers.Builder) {
	builder.StartObject(6)
}
func NNTBlockAddType(builder *flatbuffers.Builder, type_ BlockType) {
	builder.PrependInt8Slot(0, int8(type_), 0)
}
func NNTBlockAddCrc(builder *flatbuffers.Builder, crc uint32) {
	builder.PrependUint32Slot(1, crc, 0)
}
func NNTBlockAddVersion(builder *flatbuffers.Builder, version uint32) {
	builder.PrependUint32Slot(2, version, 0)
}
func NNTBlockAddBlockFloor(builder *flatbuffers.Builder, blockFloor uint64) {
	builder.PrependUint64Slot(3, blockFloor, 0)
}
func NNTBlockAddCreationUs(builder *flatbuffers.Builder, creationUs uint64) {
	builder.PrependUint64Slot(4, creationUs, 0)
}
func NNTBlockAddData(builder *flatbuffers.Builder, data flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(5, flatbuffers.UOffsetT(data), 0)
}
func NNTBlockStartDataVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
func NNTBlockEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}

type NNTT struct {
	Epoch      uint64
	Apocalypse uint64
	Period     uint32
	Blocks     []*NNTBlockT
}

func NNTPack(builder *flatbuffers.Builder, t *NNTT) flatbuffers.UOffsetT {
	if t == nil {
		return 0
	}
	blocksOffset := flatbuffers.UOffsetT(0)
	if t.Blocks != nil {
		blocksLength := len(t.Blocks)
		blocksOffsets := make([]flatbuffers.UOffsetT, blocksLength)
		for j := 0; j < blocksLength; j++ {
			blocksOffsets[j] = NNTBlockPack(builder, t.Blocks[j])
		}
		NNTStartBlocksVector(builder, blocksLength)
		for j := blocksLength - 1; j >= 0; j-- {
			builder.PrependUOffsetT(blocksOffsets[j])
		}
		blocksOffset = builder.EndVector(blocksLength)
	}
	NNTStart(builder)
	NNTAddEpoch(builder, t.Epoch)
	NNTAddApocalypse(builder, t.Apocalypse)
	NNTAddPeriod(builder, t.Period)
	NNTAddBlocks(builder, blocksOffset)
	return NNTEnd(builder)
}

func (rcv *NNT) UnPack() *NNTT {
	if rcv == nil {
		return nil
	}
	t := &NNTT{}
	t.Epoch = rcv.Epoch()
	t.Apocalypse = rcv.Apocalypse()
	t.Period = rcv.Period()
	blocksLength := rcv.BlocksLength()
	t.Blocks = make([]*NNTBlockT, blocksLength)
	for j := 0; j < blocksLength; j++ {
		x := NNTBlock{}
		rcv.Blocks(&x, j)
		t.Blocks[j] = x.UnPack()
	}
	return t
}

type NNT struct {
	_tab flatbuffers.Table
}

func GetRootAsNNT(buf []byte, offset flatbuffers.UOffsetT) *NNT {
	n := flatbuffers.GetUOffsetT(buf[offset:])
	x := &NNT{}
	x.Init(buf, n+offset)
	return x
}

func (rcv *NNT) Init(buf []byte, i flatbuffers.UOffsetT) {
	rcv._tab.Bytes = buf
	rcv._tab.Pos = i
}

func (rcv *NNT) Table() flatbuffers.Table {
	return rcv._tab
}

func (rcv *NNT) Epoch() uint64 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		return rcv._tab.GetUint64(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *NNT) MutateEpoch(n uint64) bool {
	return rcv._tab.MutateUint64Slot(4, n)
}

func (rcv *NNT) Apocalypse() uint64 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		return rcv._tab.GetUint64(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *NNT) MutateApocalypse(n uint64) bool {
	return rcv._tab.MutateUint64Slot(6, n)
}

func (rcv *NNT) Period() uint32 {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(8))
	if o != 0 {
		return rcv._tab.GetUint32(o + rcv._tab.Pos)
	}
	return 0
}

func (rcv *NNT) MutatePeriod(n uint32) bool {
	return rcv._tab.MutateUint32Slot(8, n)
}

func (rcv *NNT) Blocks(obj *NNTBlock, j int) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
	if o != 0 {
		x := rcv._tab.Vector(o)
		x += flatbuffers.UOffsetT(j) * 4
		x = rcv._tab.Indirect(x)
		obj.Init(rcv._tab.Bytes, x)
		return true
	}
	return false
}

func (rcv *NNT) BlocksLength() int {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(10))
	if o != 0 {
		return rcv._tab.VectorLen(o)
	}
	return 0
}

func NNTStart(builder *flatbuffers.Builder) {
	builder.StartObject(4)
}
func NNTAddEpoch(builder *flatbuffers.Builder, epoch uint64) {
	builder.PrependUint64Slot(0, epoch, 0)
}
func NNTAddApocalypse(builder *flatbuffers.Builder, apocalypse uint64) {
	builder.PrependUint64Slot(1, apocalypse, 0)
}
func NNTAddPeriod(builder *flatbuffers.Builder, period uint32) {
	builder.PrependUint32Slot(2, period, 0)
}
func NNTAddBlocks(builder *flatbuffers.Builder, blocks flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(3, flatbuffers.UOffsetT(blocks), 0)
}
func NNTStartBlocksVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
func NNTEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}

type NNTMergeOpT struct {
	Metric *MetricInfoT
	Nnt    []*NNTT
}

func NNTMergeOpPack(builder *flatbuffers.Builder, t *NNTMergeOpT) flatbuffers.UOffsetT {
	if t == nil {
		return 0
	}
	metricOffset := MetricInfoPack(builder, t.Metric)
	nntOffset := flatbuffers.UOffsetT(0)
	if t.Nnt != nil {
		nntLength := len(t.Nnt)
		nntOffsets := make([]flatbuffers.UOffsetT, nntLength)
		for j := 0; j < nntLength; j++ {
			nntOffsets[j] = NNTPack(builder, t.Nnt[j])
		}
		NNTMergeOpStartNntVector(builder, nntLength)
		for j := nntLength - 1; j >= 0; j-- {
			builder.PrependUOffsetT(nntOffsets[j])
		}
		nntOffset = builder.EndVector(nntLength)
	}
	NNTMergeOpStart(builder)
	NNTMergeOpAddMetric(builder, metricOffset)
	NNTMergeOpAddNnt(builder, nntOffset)
	return NNTMergeOpEnd(builder)
}

func (rcv *NNTMergeOp) UnPack() *NNTMergeOpT {
	if rcv == nil {
		return nil
	}
	t := &NNTMergeOpT{}
	t.Metric = rcv.Metric(nil).UnPack()
	nntLength := rcv.NntLength()
	t.Nnt = make([]*NNTT, nntLength)
	for j := 0; j < nntLength; j++ {
		x := NNT{}
		rcv.Nnt(&x, j)
		t.Nnt[j] = x.UnPack()
	}
	return t
}

type NNTMergeOp struct {
	_tab flatbuffers.Table
}

func GetRootAsNNTMergeOp(buf []byte, offset flatbuffers.UOffsetT) *NNTMergeOp {
	n := flatbuffers.GetUOffsetT(buf[offset:])
	x := &NNTMergeOp{}
	x.Init(buf, n+offset)
	return x
}

func (rcv *NNTMergeOp) Init(buf []byte, i flatbuffers.UOffsetT) {
	rcv._tab.Bytes = buf
	rcv._tab.Pos = i
}

func (rcv *NNTMergeOp) Table() flatbuffers.Table {
	return rcv._tab
}

func (rcv *NNTMergeOp) Metric(obj *MetricInfo) *MetricInfo {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		x := rcv._tab.Indirect(o + rcv._tab.Pos)
		if obj == nil {
			obj = new(MetricInfo)
		}
		obj.Init(rcv._tab.Bytes, x)
		return obj
	}
	return nil
}

func (rcv *NNTMergeOp) Nnt(obj *NNT, j int) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		x := rcv._tab.Vector(o)
		x += flatbuffers.UOffsetT(j) * 4
		x = rcv._tab.Indirect(x)
		obj.Init(rcv._tab.Bytes, x)
		return true
	}
	return false
}

func (rcv *NNTMergeOp) NntLength() int {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(6))
	if o != 0 {
		return rcv._tab.VectorLen(o)
	}
	return 0
}

func NNTMergeOpStart(builder *flatbuffers.Builder) {
	builder.StartObject(2)
}
func NNTMergeOpAddMetric(builder *flatbuffers.Builder, metric flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(metric), 0)
}
func NNTMergeOpAddNnt(builder *flatbuffers.Builder, nnt flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(1, flatbuffers.UOffsetT(nnt), 0)
}
func NNTMergeOpStartNntVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
func NNTMergeOpEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}

type NNTMergeT struct {
	Ops []*NNTMergeOpT
}

func NNTMergePack(builder *flatbuffers.Builder, t *NNTMergeT) flatbuffers.UOffsetT {
	if t == nil {
		return 0
	}
	opsOffset := flatbuffers.UOffsetT(0)
	if t.Ops != nil {
		opsLength := len(t.Ops)
		opsOffsets := make([]flatbuffers.UOffsetT, opsLength)
		for j := 0; j < opsLength; j++ {
			opsOffsets[j] = NNTMergeOpPack(builder, t.Ops[j])
		}
		NNTMergeStartOpsVector(builder, opsLength)
		for j := opsLength - 1; j >= 0; j-- {
			builder.PrependUOffsetT(opsOffsets[j])
		}
		opsOffset = builder.EndVector(opsLength)
	}
	NNTMergeStart(builder)
	NNTMergeAddOps(builder, opsOffset)
	return NNTMergeEnd(builder)
}

func (rcv *NNTMerge) UnPack() *NNTMergeT {
	if rcv == nil {
		return nil
	}
	t := &NNTMergeT{}
	opsLength := rcv.OpsLength()
	t.Ops = make([]*NNTMergeOpT, opsLength)
	for j := 0; j < opsLength; j++ {
		x := NNTMergeOp{}
		rcv.Ops(&x, j)
		t.Ops[j] = x.UnPack()
	}
	return t
}

type NNTMerge struct {
	_tab flatbuffers.Table
}

func GetRootAsNNTMerge(buf []byte, offset flatbuffers.UOffsetT) *NNTMerge {
	n := flatbuffers.GetUOffsetT(buf[offset:])
	x := &NNTMerge{}
	x.Init(buf, n+offset)
	return x
}

func (rcv *NNTMerge) Init(buf []byte, i flatbuffers.UOffsetT) {
	rcv._tab.Bytes = buf
	rcv._tab.Pos = i
}

func (rcv *NNTMerge) Table() flatbuffers.Table {
	return rcv._tab
}

func (rcv *NNTMerge) Ops(obj *NNTMergeOp, j int) bool {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		x := rcv._tab.Vector(o)
		x += flatbuffers.UOffsetT(j) * 4
		x = rcv._tab.Indirect(x)
		obj.Init(rcv._tab.Bytes, x)
		return true
	}
	return false
}

func (rcv *NNTMerge) OpsLength() int {
	o := flatbuffers.UOffsetT(rcv._tab.Offset(4))
	if o != 0 {
		return rcv._tab.VectorLen(o)
	}
	return 0
}

func NNTMergeStart(builder *flatbuffers.Builder) {
	builder.StartObject(1)
}
func NNTMergeAddOps(builder *flatbuffers.Builder, ops flatbuffers.UOffsetT) {
	builder.PrependUOffsetTSlot(0, flatbuffers.UOffsetT(ops), 0)
}
func NNTMergeStartOpsVector(builder *flatbuffers.Builder, numElems int) flatbuffers.UOffsetT {
	return builder.StartVector(4, numElems, 4)
}
func NNTMergeEnd(builder *flatbuffers.Builder) flatbuffers.UOffsetT {
	return builder.EndObject()
}


text:
beadledom-testing
=================

This project adds some additional tooling to make the JAX-RS services testing easier.

Download
--------

Download using Maven:

.. code-block:: xml

  <dependencies>
      ...
      <dependency>
          <groupId>com.cerner.beadledom</groupId>
         <artifactId>beadledom-testing</artifactId>
          <version>[Insert latest version]</version>
      </dependency>
      ...
  </dependencies>

Usage
-----

JsonMatchers
  check out the `scala doc <https://github.com/cerner/beadledom/blob/main/testing/src/main/scala/com/cerner/beadledom/testing/JsonMatchers.scala>`_ on the trait for the usage instructions.

UnitSpec
  Base spec for including ``FunSpec`` and Scalatest Mixins


text:
RedisTree is a Laravel package that provides an elegant web interface for Redis.
It assists you in monitoring your server statistics and exploring your Redis key hierarchy.

Screenshots

**Requires PHP 7.3+**

## Installation
### Add to Composer
```
composer require "mmeyer2k/redistree:dev-master"
```

### Add Service Provider
Add the following line into the `providers` array in `config/app.php`
```php
Mmeyer2k\RedisTree\RedisTreeServiceProvider::class,
```

### Add Routes
To allow for full customization of the URL and security mechanisms employed, routing to the RedisTree controller is left to the developer.
To serve the GUI from `/redistree` **without any kind of security**, add the following stub to your `routes.php` file.
```php
\Mmeyer2k\RedisTree\RedisTreeModel::registerRoutes();
```

### Security
Place the `registerRoutes()` within a route group to provide authentication flexibility.

## Features
1. Ability to choose what characters represent keyspace separators.
2. Toggleable prompting before destructive actions.
3. Simple integration with existing Laravel 5 applications.
4. Elegant and intuitive interface.


text:
package io.quarkus.extest.deployment;

import java.security.interfaces.DSAPublicKey;

import io.quarkus.builder.item.SimpleBuildItem;

final public class PublicKeyBuildItem extends SimpleBuildItem {
    private DSAPublicKey publicKey;

    public PublicKeyBuildItem(DSAPublicKey publicKey) {
        this.publicKey = publicKey;
    }

    public DSAPublicKey getPublicKey() {
        return publicKey;
    }
}


text:
Greedy Algorithm for TSP in Perl
type: 'make run' to execute


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/id_ques_layout"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/id_ques_text"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:paddingTop="12dp"
        android:paddingBottom="12dp"
        android:clickable="true"
        android:layout_gravity="center_vertical"
        android:singleLine="true"
        android:background="@drawable/v5_ques_bg_selector"
        android:textColor="@color/v5_black"
        android:textSize="13sp" />

</RelativeLayout>


text:
Babylon.js GUI module
=====================

For usage documentation please visit http://doc.babylonjs.com/overviews/gui

# Installation instructions

## CDN

Compiled js files (minified and source) are offered on our public CDN here:

* https://cdn.babylonjs.com/gui/babylon.gui.js
* https://cdn.babylonjs.com/gui/babylon.gui.min.js

## NPM

To install using npm :

```
npm install --save babylonjs babylonjs-gui
```

If using TypeScript, the typing needs to be added to tsconfig.json:

```
    ....
    "types": [
        "babylonjs",
        "babylonjs-gui",
        "angularFTW"
    ],
    ....
```

Afterwards it can be imported to the project using:

```
import * as GUI from 'babylonjs-gui';
```

Using webpack to package your project will use the minified js file.


text:
<?php

//-----------------------------------------------------------------------------------------------------------------------------------
//
// Filename   : config.php
// Date       : 15th October 2009
// Version    : 0.1
//
// Copyright (C) 2012 Melvin Carvalho, Akbar Hossain, László Török
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is furnished
// to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
// PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// "Everything should be made as simple as possible, but no simpler."
// -- Albert Einstein
//
//-----------------------------------------------------------------------------------------------------------------------------------

$config = array(

        /* db */
        'db_name'        => 'foaf',                     // db name
        'db_user'        => 'root',                          // db username
        'db_pwd'         => '',                              // db password

        /* store */
        'store_name'     => 'arc_tests',                     // tmp table name

        /* modes */
        'multi_user'     => true,                            // not yet impl
        'auto_generate'  => true,                            // not yet impl
        'federation_uri' => '',                              // not yet impl
        'certficate_uri' => 'https://foaf.me/keygen.php'     // not yet impl

);

?>


text:
package org.apache.sling.scripting.freemarker.internal;

import java.io.Reader;
import java.nio.charset.StandardCharsets;

import javax.script.Bindings;
import javax.script.ScriptContext;
import javax.script.ScriptEngineFactory;
import javax.script.ScriptException;

import freemarker.ext.beans.BeansWrapper;
import freemarker.log.Logger;
import freemarker.template.TemplateHashModel;
import freemarker.template.Version;
import org.apache.sling.api.scripting.SlingBindings;
import org.apache.sling.api.scripting.SlingScriptHelper;
import org.apache.sling.scripting.api.AbstractSlingScriptEngine;

import freemarker.template.Configuration;
import freemarker.template.Template;

/**
 * A ScriptEngine that uses FreeMarker templates
 * to render a Resource in HTML.
 */
public class FreemarkerScriptEngine extends AbstractSlingScriptEngine {
    private static final Logger log = Logger.getLogger(FreemarkerScriptEngine.class.getName());

    private final Version version = new Version(2, 3, 24);

    private final Configuration configuration;

    private final BeansWrapper beansWrapper;

    private final TemplateHashModel statics;

    public FreemarkerScriptEngine(ScriptEngineFactory factory) {
        super(factory);
        configuration = new Configuration(version);
        configuration.setDefaultEncoding(StandardCharsets.UTF_8.name());
        beansWrapper = new BeansWrapper(version);
        statics = beansWrapper.getStaticModels();
    }

    public Object eval(Reader reader, ScriptContext scriptContext)
            throws ScriptException {
        Bindings bindings = scriptContext.getBindings(ScriptContext.ENGINE_SCOPE);
        SlingScriptHelper helper = (SlingScriptHelper) bindings.get(SlingBindings.SLING);
        if (helper == null) {
            throw new ScriptException("SlingScriptHelper missing from bindings");
        }

        // ensure GET request
        if (!"GET".equals(helper.getRequest().getMethod())) {
            throw new ScriptException(
                "FreeMarker templates only support GET requests");
        }

        String scriptName = helper.getScript().getScriptResource().getPath();

        try {
            Template tmpl = new Template(scriptName, reader, configuration);
            bindings.put("statics", statics);
            tmpl.process(bindings, scriptContext.getWriter());
        } catch (Throwable t) {
            log.error("Failure running Freemarker script.", t);
            throw new ScriptException("Failure running FreeMarker script "
                + scriptName);
        }

        return null;
    }

}


text:
class CreateParticipants < ActiveRecord::Migration
  def change
    create_table :participants do |t|
      t.string :first_name, :null => false, limit: 32
      t.string :last_name, :null => false, limit: 64
      t.integer :gender, :null => false
      t.date :birthdate
      t.string :city
      t.string :state
      t.references :country, index: true, foreign_key: true
      t.string :email
      t.string :phone

      t.timestamps null: false
      t.integer :created_by, null: false
      t.integer :updated_by, null: false
    end
  end
end


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

using GroupControl.Model;

namespace GroupControl.IDAL
{
    public interface IAutoServiceInfoDAL:IBaseDAL<AutoServiceInfo, AutoServiceInfoViewModel>
    {
    }
}


text:
from typing import Optional

import numpy as np
from ConfigSpace.configuration_space import ConfigurationSpace
from ConfigSpace.hyperparameters import (
    CategoricalHyperparameter,
    Constant,
    UniformFloatHyperparameter,
    UniformIntegerHyperparameter,
    UnParametrizedHyperparameter,
)

from autosklearn.askl_typing import FEAT_TYPE_TYPE
from autosklearn.pipeline.components.base import AutoSklearnPreprocessingAlgorithm
from autosklearn.pipeline.constants import DENSE, INPUT, SPARSE, UNSIGNED_DATA
from autosklearn.util.common import check_for_bool, check_none

class ExtraTreesPreprocessorRegression(AutoSklearnPreprocessingAlgorithm):
    def __init__(
        self,
        n_estimators,
        criterion,
        min_samples_leaf,
        min_samples_split,
        max_features,
        bootstrap=False,
        max_leaf_nodes=None,
        max_depth="None",
        min_weight_fraction_leaf=0.0,
        oob_score=False,
        n_jobs=1,
        random_state=None,
        verbose=0,
    ):

        self.n_estimators = n_estimators
        self.estimator_increment = 10
        if criterion not in ("mse", "friedman_mse", "mae"):
            raise ValueError(
                "'criterion' is not in ('mse', 'friedman_mse', "
                "'mae'): %s" % criterion
            )
        self.criterion = criterion
        self.min_samples_leaf = min_samples_leaf
        self.min_samples_split = min_samples_split
        self.max_features = max_features
        self.bootstrap = bootstrap
        self.max_leaf_nodes = max_leaf_nodes
        self.max_depth = max_depth
        self.min_weight_fraction_leaf = min_weight_fraction_leaf

        self.oob_score = oob_score
        self.n_jobs = n_jobs
        self.random_state = random_state
        self.verbose = verbose
        self.preprocessor = None

    def fit(self, X, Y):
        from sklearn.ensemble import ExtraTreesRegressor
        from sklearn.feature_selection import SelectFromModel

        self.n_estimators = int(self.n_estimators)
        self.min_samples_leaf = int(self.min_samples_leaf)
        self.min_samples_split = int(self.min_samples_split)
        self.max_features = float(self.max_features)
        self.bootstrap = check_for_bool(self.bootstrap)
        self.n_jobs = int(self.n_jobs)
        self.verbose = int(self.verbose)

        if check_none(self.max_leaf_nodes):
            self.max_leaf_nodes = None
        else:
            self.max_leaf_nodes = int(self.max_leaf_nodes)

        if check_none(self.max_depth):
            self.max_depth = None
        else:
            self.max_depth = int(self.max_depth)

        self.min_weight_fraction_leaf = float(self.min_weight_fraction_leaf)

        num_features = X.shape[1]
        max_features = int(float(self.max_features) * (np.log(num_features) + 1))
        # Use at most half of the features
        max_features = max(1, min(int(X.shape[1] / 2), max_features))
        estimator = ExtraTreesRegressor(
            n_estimators=self.n_estimators,
            criterion=self.criterion,
            max_depth=self.max_depth,
            min_samples_split=self.min_samples_split,
            min_samples_leaf=self.min_samples_leaf,
            bootstrap=self.bootstrap,
            max_features=max_features,
            max_leaf_nodes=self.max_leaf_nodes,
            oob_score=self.oob_score,
            n_jobs=self.n_jobs,
            verbose=self.verbose,
            min_weight_fraction_leaf=self.min_weight_fraction_leaf,
            random_state=self.random_state,
        )

        estimator.fit(X, Y)
        self.preprocessor = SelectFromModel(
            estimator=estimator, threshold="mean", prefit=True
        )

        return self

    def transform(self, X):
        if self.preprocessor is None:
            raise NotImplementedError
        return self.preprocessor.transform(X)

    @staticmethod
    def get_properties(dataset_properties=None):
        return {
            "shortname": "ETR",
            "name": "Extra Trees Regressor Preprocessing",
            "handles_regression": True,
            "handles_classification": False,
            "handles_multiclass": False,
            "handles_multilabel": False,
            "handles_multioutput": True,
            "is_deterministic": True,
            "input": (DENSE, SPARSE, UNSIGNED_DATA),
            "output": (INPUT,),
        }

    @staticmethod
    def get_hyperparameter_search_space(
        feat_type: Optional[FEAT_TYPE_TYPE] = None, dataset_properties=None
    ):
        cs = ConfigurationSpace()

        n_estimators = Constant("n_estimators", 100)
        criterion = CategoricalHyperparameter(
            "criterion", ["mse", "friedman_mse", "mae"]
        )
        max_features = UniformFloatHyperparameter(
            "max_features", 0.1, 1.0, default_value=1.0
        )

        max_depth = UnParametrizedHyperparameter(name="max_depth", value="None")
        max_leaf_nodes = UnParametrizedHyperparameter("max_leaf_nodes", "None")

        min_samples_split = UniformIntegerHyperparameter(
            "min_samples_split", 2, 20, default_value=2
        )
        min_samples_leaf = UniformIntegerHyperparameter(
            "min_samples_leaf", 1, 20, default_value=1
        )
        min_weight_fraction_leaf = Constant("min_weight_fraction_leaf", 0.0)

        bootstrap = CategoricalHyperparameter(
            "bootstrap", ["True", "False"], default_value="False"
        )

        cs.add_hyperparameters(
            [
                n_estimators,
                criterion,
                max_features,
                max_depth,
                max_leaf_nodes,
                min_samples_split,
                min_samples_leaf,
                min_weight_fraction_leaf,
                bootstrap,
            ]
        )

        return cs


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

<title>All Classes</title>
<meta name="date" content="2015-06-30">
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="Style">

All Classes

Application

Controller

JDatePanel

LibGoogleCalendarConnector

LibMysqlConnector

Model

RoundedBorder

View


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using Tetsuo.Core.Contracts;
using Tetsuo.Common.Contracts;
using Tetsuo.Core.Common;
using Tetsuo.Entities;
using System.Threading;
using System.ServiceModel.Description;
using System.ServiceModel.MsmqIntegration;
using System.Messaging;
using Tetsuo.Entities.Model;
using System.Reflection;
using System.Threading.Tasks;

namespace Tetsuo.Services
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)]
    public class RouteDispatcher : TetsuoServiceBase
    {

        public RouteDispatcher()
        {

            this.ObjectID = 1;
            this.Source = Common.InstrumentationSources.Gateway;
            Initialize();
        }

        public override void Route(MsmqMessage<RoutedMessageContract> value)
        {
            value.Body.IsFromGateway = true;
            base.Route(value);
        }

        public override void Start(MsmqMessage<RoutedMessageContract> value)
        {
            Instrument(Common.TransmissionStatusCodes.SVC_START, "Starting route dispatcher...", Common.InstrumentationSources.Hub, this.ObjectID);
            base.Start(value);
        }

        private void Initialize()
        {
            EntityManager em = new EntityManager();
            List<Hub> hubs = em.GetHubsByGateway(ObjectID);
            foreach (var hub in hubs)
            {
                List<HubService> spokes = em.GetSpokesByHub(hub.HubId);
                //ServiceHost host =
                //     CreateServiceHost<TetsuoHubService>("Tetsuo.Core.Contracts.IRouteDispatcher", hub.HubName + ".request");
                //(host.SingletonInstance as TetsuoHubService).SetObjectID(Common.InstrumentationSources.Hub, hub.HubId);
                Instrument(Common.TransmissionStatusCodes.SVC_START, "Starting hub " + hub.HubName, Common.InstrumentationSources.Hub, hub.HubId);

                spokes.ForEach(spoke =>
                {
                    string qName = string.Format(@"{0}\private$\{1}.{2}.request",Environment.MachineName,
                        hub.HubName,spoke.HubServiceName);
                    if(!(MessageQueue.Exists(qName)))
                        MessageQueue.Create(qName,true);
                    ServiceHost spokeHost =
                     CreateServiceHost<TetsuoHubService>("Tetsuo.Core.Contracts.IRouteDispatcher", hub.HubName + "." + spoke.HubServiceName + ".request");
                    //spokeHost.AddServiceEndpoint(spoke.SpokeContract, new MsmqIntegrationBinding(), @"msmq.formatname:DIRECT=OS:.\private$\" + hub.HubName + "." + spoke.SpokeName + ".request");
                    (spokeHost.SingletonInstance as TetsuoHubService).SetObjectID(Common.InstrumentationSources.Spoke, spoke.HubServiceId);
                    Assembly asm = Assembly.LoadFrom(spoke.HubServiceAssembly);
                    if (!(spokeHost.SingletonInstance as TetsuoHubService).Assemblies.Contains(asm))
                        (spokeHost.SingletonInstance as TetsuoHubService).Assemblies.Add(asm);
                    (spokeHost.SingletonInstance as TetsuoHubService).HostedContract = asm.CreateInstance(spoke.ClientClass);
                    serviceThreads.Add(spokeHost);
                    Instrument(Common.TransmissionStatusCodes.SVC_START, "Service for " + spoke.HubServiceName + " successfully started.", Common.InstrumentationSources.Spoke, spoke.HubServiceId);

                });
                //host.Open();
                //serviceThreads.Add(host);
            }
        }

    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>de.starwit</groupId>
        <artifactId>ljprojectbuilder</artifactId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>

    <artifactId>persistence</artifactId>
    <packaging>jar</packaging>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-validation</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mariadb.jdbc</groupId>
            <artifactId>mariadb-java-client</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-mysql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.flywaydb</groupId>
            <artifactId>flyway-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-log4j2</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springdoc</groupId>
            <artifactId>springdoc-openapi-security</artifactId>
        </dependency>
    </dependencies>

</project>


text:
package org.unitsheet.source;

import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class WorkbookSourceProviderTest {

    private final WorkbookSourceProvider underTest = new WorkbookSourceProvider();

    @Test
    public void checkClasspathPrefixMeansClasspathWorkbooksourceReturned() {
        WorkbookSource workbookSource = underTest.createWorkbookSourceForPath("classpath:testpath");
        assertTrue(workbookSource instanceof ClasspathWorkbookSource);
    }

    @Test
    public void checkClasspathPrefixStrippedFromPath() {
        WorkbookSource workbookSource = underTest.createWorkbookSourceForPath("classpath:testpath");
        assertEquals("testpath", workbookSource.getPath());
    }

    @Test
    public void checkNoClasspathPrefixMeansFileWorkbooksourceReturned() {
        WorkbookSource workbookSource = underTest.createWorkbookSourceForPath("testpath");
        assertTrue(workbookSource instanceof FilesystemWorkbookSource);
    }

}


text:
require "nokogiri"
require 'json'
require "sneakers/handlers/maxretry"

module Legacy
  class VocabularyValidator
    include Sneakers::Worker
    include Amqp::MessagePublisher

    def self.queue_name
      "hbx.vocab_validator"
    end

    def self.retry_exchange_name
      queue_name + "-retry"
    end

    from_queue queue_name,
      :ack => true,
      :prefetch => 1,
      :threads => 1,
      :exchange => Settings.listener_direct_request_exchange_name,
      :exchange_options => Settings.listener_direct_request_exchange_options,
      :routing_key => [
        "policy.cancel",
        "policy.initial_enrollment",
        "policy.maintenance",
        "policy.renewal"
      ],
      :handler => Sneakers::Handlers::Maxretry,
      :retry_timeout => 5000,
      :heartbeat => 5,
      :arguments => {
        :'x-dead-letter-exchange' => self.retry_exchange_name
      }

      XML_PATHS = {
        :emp => "http://dchealthlink.com/vocabularies/1/employer"
      }

      def initialize(queue = nil, pool = nil, opts = {})
        super(queue, pool, opts)
        schema_document_location =  File.join(
          File.expand_path(
            Rails.root
          ),
          "schemas", "legacy", "process.xsd"
        )
        @schema = Nokogiri::XML.Schema(File.open(schema_document_location))
      end

      # We need to check if this is shop, and if so, send a copy to the
      # payment processor
      def work_with_params(msg, delivery_info, props)
        the_xml = Nokogiri::XML(msg)
        errors = @schema.validate(the_xml)
        email = "trey.evans@dc.gov"
        if !props.headers.nil?
          if !props.headers["submitted_by"].nil?
            email = props.headers["submitted_by"]
          end
        end
        if errors.any?
          error_data = {
            :document => msg.to_s.encode('UTF-8', undef: :replace, replace: ''),
            :errors => errors.map(&:message),
            :submitted_by => email
          }
          with_confirmed_channel do |chan|
            dex = chan.default_exchange
            dex.publish(JSON.dump(error_data), :routing_key => "hbx.vocab_validator.failures", :durable => true)
          end
        else
          is_shop = the_xml.xpath("//emp:employer", XML_PATHS).any?
          with_confirmed_channel do |chan|
            dex = chan.default_exchange
            dex.publish(msg, :routing_key => props.reply_to)
            if is_shop
              dex.publish(msg, :routing_key => "hbx.payment_processor_updates")
            end
          end
        end
        ack!
      end
  end
end


text:
package shark

import java.io.{BufferedReader, InputStreamReader}
import java.sql.DriverManager
import java.sql.Statement
import java.sql.Connection

import scala.collection.JavaConversions._

import org.scalatest.{BeforeAndAfterAll, FunSuite}
import org.scalatest.matchers.ShouldMatchers

/**
 * Test for the Shark server.
 */
class SharkServerSuite extends FunSuite with BeforeAndAfterAll with ShouldMatchers with TestUtils {

  val WAREHOUSE_PATH = TestUtils.getWarehousePath("server")
  val METASTORE_PATH = TestUtils.getMetastorePath("server")
  val DRIVER_NAME  = "org.apache.hadoop.hive.jdbc.HiveDriver"
  val TABLE = "test"
  // use a different port, than the hive standard 10000,
  // for tests to avoid issues with the port being taken on some machines
  val PORT = "9011"

  Class.forName(DRIVER_NAME)

  override def beforeAll() { launchServer() }

  override def afterAll() { stopServer() }

  private def launchServer(args: Seq[String] = Seq.empty) {
    // Forking a new process to start the Shark server. The reason to do this is it is
    // hard to clean up Hive resources entirely, so we just start a new process and kill
    // that process for cleanup.
    val defaultArgs = Seq("./bin/shark", "--service", "sharkserver",
      "--verbose",
      "-p",
      PORT,
      "--hiveconf",
      "hive.root.logger=INFO,console",
      "--hiveconf",
      "\"javax.jdo.option.ConnectionURL=jdbc:derby:;databaseName=" + METASTORE_PATH + ";create=true\"",
      "--hiveconf",
      "\"hive.metastore.warehouse.dir=" + WAREHOUSE_PATH + "\"")
    val pb = new ProcessBuilder(defaultArgs ++ args)
    process = pb.start()
    inputReader = new BufferedReader(new InputStreamReader(process.getInputStream))
    errorReader = new BufferedReader(new InputStreamReader(process.getErrorStream))
    waitForOutput(inputReader, "Starting Shark server")
  }

  private def stopServer() {
    process.destroy()
    process.waitFor()
  }

  test("test query execution against a shark server") {

    val dataFilePath = TestUtils.dataFilePath + "/kv1.txt"
    val stmt = createStatement()
    stmt.executeQuery("DROP TABLE IF EXISTS test")
    stmt.executeQuery("DROP TABLE IF EXISTS test_cached")
    stmt.executeQuery("CREATE TABLE test(key int, val string)")
    stmt.executeQuery("LOAD DATA LOCAL INPATH '" + dataFilePath+ "' OVERWRITE INTO TABLE test")
    stmt.executeQuery("CREATE TABLE test_cached as select * from test limit 499")

    var rs = stmt.executeQuery("select count(*) from test")
    rs.next()
    rs.getInt(1) should equal (500)

    rs = stmt.executeQuery("select count(*) from test_cached")
    rs.next()
    rs.getInt(1) should equal (499)

    stmt.close()
  }

  def getConnection(): Connection = {
    DriverManager.getConnection("jdbc:hive://localhost:" + PORT + "/default", "", "")
  }

  def createStatement(): Statement = getConnection().createStatement()
}


text:
package org.apache.camel.spring.routebuilder;

import java.util.HashMap;
import java.util.Map;

import org.apache.camel.Route;
import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.RouteTemplateDefinition;
import org.apache.camel.spring.SpringTestSupport;
import org.junit.jupiter.api.Test;
import org.springframework.context.support.AbstractXmlApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

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

public class SpringRouteTemplateTest extends SpringTestSupport {

    @Override
    protected AbstractXmlApplicationContext createApplicationContext() {
        return new ClassPathXmlApplicationContext("org/apache/camel/spring/routebuilder/SpringRouteTemplateTest.xml");
    }

    @Test
    public void testDefineRouteTemplate() throws Exception {
        assertEquals(1, context.getRouteTemplateDefinitions().size());

        RouteTemplateDefinition routeTemplate = context.getRouteTemplateDefinition("myTemplate");
        assertEquals("foo", routeTemplate.getTemplateParameters().get(0).getName());
        assertEquals("bar", routeTemplate.getTemplateParameters().get(1).getName());
    }

    @Test
    public void testCreateRouteFromRouteTemplate() throws Exception {
        assertEquals(1, context.getRouteTemplateDefinitions().size());

        RouteTemplateDefinition routeTemplate = context.getRouteTemplateDefinition("myTemplate");
        assertEquals("foo", routeTemplate.getTemplateParameters().get(0).getName());
        assertEquals("bar", routeTemplate.getTemplateParameters().get(1).getName());

        getMockEndpoint("mock:cheese").expectedBodiesReceived("Hello Cheese");
        getMockEndpoint("mock:cake").expectedBodiesReceived("Hello Cake");

        Map<String, Object> parameters = new HashMap<>();
        parameters.put("foo", "one");
        parameters.put("bar", "cheese");
        context.addRouteFromTemplate("first", "myTemplate", parameters);

        parameters.put("foo", "two");
        parameters.put("bar", "cake");
        context.addRouteFromTemplate("second", "myTemplate", parameters);

        assertEquals(2, context.getRouteDefinitions().size());
        assertEquals(2, context.getRoutes().size());
        assertEquals("Started", context.getRouteController().getRouteStatus("first").name());
        assertEquals("Started", context.getRouteController().getRouteStatus("second").name());
        assertEquals("true", context.getRoute("first").getProperties().get(Route.TEMPLATE_PROPERTY));
        assertEquals("true", context.getRoute("second").getProperties().get(Route.TEMPLATE_PROPERTY));

        template.sendBody("direct:one", "Hello Cheese");
        template.sendBody("direct:two", "Hello Cake");

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testCreateRouteFromRouteTemplateAutoAssignedRouteId() throws Exception {
        assertEquals(1, context.getRouteTemplateDefinitions().size());

        RouteTemplateDefinition routeTemplate = context.getRouteTemplateDefinition("myTemplate");
        assertEquals("foo", routeTemplate.getTemplateParameters().get(0).getName());
        assertEquals("bar", routeTemplate.getTemplateParameters().get(1).getName());

        getMockEndpoint("mock:cheese").expectedBodiesReceived("Hello Cheese");

        Map<String, Object> parameters = new HashMap<>();
        parameters.put("foo", "one");
        parameters.put("bar", "cheese");
        String routeId = context.addRouteFromTemplate(null, "myTemplate", parameters);

        assertNotNull(routeId);
        assertEquals(1, context.getRouteDefinitions().size());
        assertEquals(1, context.getRoutes().size());
        assertEquals("Started", context.getRouteController().getRouteStatus(routeId).name());
        assertEquals("true", context.getRoute(routeId).getProperties().get(Route.TEMPLATE_PROPERTY));

        template.sendBody("direct:one", "Hello Cheese");

        assertMockEndpointsSatisfied();
    }

    @Test
    public void testCreateRouteFromRouteTemplateAutoAssignedRouteIdClash() throws Exception {
        context.addRoutes(new RouteBuilder() {
            @Override
            public void configure() throws Exception {
                // use a route id that can clash with auto assigned
                from("direct:hello").to("mock:hello").routeId("route1");
            }
        });

        assertEquals(1, context.getRouteDefinitions().size());
        assertEquals(1, context.getRouteTemplateDefinitions().size());

        RouteTemplateDefinition routeTemplate = context.getRouteTemplateDefinition("myTemplate");
        assertEquals("foo", routeTemplate.getTemplateParameters().get(0).getName());
        assertEquals("bar", routeTemplate.getTemplateParameters().get(1).getName());

        getMockEndpoint("mock:cheese").expectedBodiesReceived("Hello Cheese");

        Map<String, Object> parameters = new HashMap<>();
        parameters.put("foo", "one");
        parameters.put("bar", "cheese");
        String routeId = context.addRouteFromTemplate(null, "myTemplate", parameters);

        assertNotNull(routeId);
        assertTrue(!routeId.equals("route1"), "Should not be named route1");
        assertEquals(2, context.getRouteDefinitions().size());
        assertEquals(2, context.getRoutes().size());
        assertEquals("Started", context.getRouteController().getRouteStatus(routeId).name());
        assertEquals("true", context.getRoute(routeId).getProperties().get(Route.TEMPLATE_PROPERTY));

        template.sendBody("direct:one", "Hello Cheese");

        assertMockEndpointsSatisfied();
    }

}


text:
             $release->id]) }}">{{ $release->game->name }}

        @if ($release->game->description)

{{ $release->game->description }}

        @endif

             $release->publisher->id]) }}" class="p-brand h-card">
                {{ $release->publisher->nickname or $release->publisher->name }}

             $release->game->developer->id]) }}" class="h-card">
                {{ $release->game->developer->nickname or $release->game->developer->name }}


text:
/* DO NOT MODIFY. Generated with Sango, by Afero.io */

package io.afero.example;
public final class Sango {
    public static final String VERSION = "Sango © 2016-2019 Afero, Inc - Build 295";
}


text:
require 'spec_helper'

describe 'apache::mod::dev', type: :class do
  let(:pre_condition) do
    [
      'include apache',
    ]
  end

  it_behaves_like 'a mod class, without including apache'

  ['RedHat 6', 'Debian 11', 'FreeBSD 9'].each do |os|
    context "on a #{os} OS" do
      include_examples os

      it { is_expected.to contain_class('apache::dev') }
    end
  end
end


text:
/* Code generated by IfcQuery EXPRESS generator, www.ifcquery.com */

#include <sstream>
#include <limits>
#include <map>
#include "ifcpp/reader/ReaderUtil.h"
#include "ifcpp/writer/WriterUtil.h"
#include "ifcpp/model/BasicTypes.h"
#include "ifcpp/model/BuildingException.h"
#include "ifcpp/IFC4X3/include/IfcTextAlignment.h"

// TYPE IfcTextAlignment = STRING;
IFC4X3::IfcTextAlignment::IfcTextAlignment( std::string value ) { m_value = value; }
shared_ptr<BuildingObject> IFC4X3::IfcTextAlignment::getDeepCopy( BuildingCopyOptions& options )
{
	shared_ptr<IfcTextAlignment> copy_self( new IfcTextAlignment() );
	copy_self->m_value = m_value;
	return copy_self;
}
void IFC4X3::IfcTextAlignment::getStepParameter( std::stringstream& stream, bool is_select_type ) const
{
	if( is_select_type ) { stream << "IFCTEXTALIGNMENT("; }
	stream << "'" << encodeStepString( m_value ) << "'";
	if( is_select_type ) { stream << ")"; }
}
shared_ptr<IFC4X3::IfcTextAlignment> IFC4X3::IfcTextAlignment::createObjectFromSTEP( const std::string& arg, const std::map<int,shared_ptr<BuildingEntity> >& map, std::stringstream& errorStream )
{
	if( arg.compare( "$" ) == 0 ) { return shared_ptr<IfcTextAlignment>(); }
	if( arg.compare( "*" ) == 0 ) { return shared_ptr<IfcTextAlignment>(); }
	shared_ptr<IfcTextAlignment> type_object( new IfcTextAlignment() );
	readString( arg, type_object->m_value );
	return type_object;
}


text:
package com.amazonaws.services.glue.model.transform;

import javax.annotation.Generated;

import com.amazonaws.SdkClientException;
import com.amazonaws.services.glue.model.*;

import com.amazonaws.protocol.*;
import com.amazonaws.annotation.SdkInternalApi;

/**
 * DatabaseIdentifierMarshaller
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
@SdkInternalApi
public class DatabaseIdentifierMarshaller {

    private static final MarshallingInfo<String> CATALOGID_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)
            .marshallLocationName("CatalogId").build();
    private static final MarshallingInfo<String> DATABASENAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING)
            .marshallLocation(MarshallLocation.PAYLOAD).marshallLocationName("DatabaseName").build();

    private static final DatabaseIdentifierMarshaller instance = new DatabaseIdentifierMarshaller();

    public static DatabaseIdentifierMarshaller getInstance() {
        return instance;
    }

    /**
     * Marshall the given parameter object.
     */
    public void marshall(DatabaseIdentifier databaseIdentifier, ProtocolMarshaller protocolMarshaller) {

        if (databaseIdentifier == null) {
            throw new SdkClientException("Invalid argument passed to marshall(...)");
        }

        try {
            protocolMarshaller.marshall(databaseIdentifier.getCatalogId(), CATALOGID_BINDING);
            protocolMarshaller.marshall(databaseIdentifier.getDatabaseName(), DATABASENAME_BINDING);
        } catch (Exception e) {
            throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
        }
    }

}


text:
using System;
using Eto.Threading;

#if OSX
#if XAMMAC2
using AppKit;
using Foundation;
using CoreGraphics;
using ObjCRuntime;
using CoreAnimation;
#else
using MonoMac.AppKit;
using MonoMac.Foundation;
using MonoMac.CoreGraphics;
using MonoMac.ObjCRuntime;
using MonoMac.CoreAnimation;
#endif

namespace Eto.Mac.Threading
#elif IOS

using MonoTouch.Foundation;
using MonoTouch.ObjCRuntime;

namespace Eto.iOS.Threading
#endif
{
	public class ThreadHandler : WidgetHandler<NSThread, Thread, Thread.ICallback>, Thread.IHandler
	{
		class Delegate : NSObject
		{
			WeakReference handler;
			public ThreadHandler Handler { get { return (ThreadHandler)handler.Target; } set { handler = new WeakReference(value); } }

			[Export("execute")]
			public void Execute()
			{
				using (var pool = new NSAutoreleasePool())
				{
					Handler.Callback.OnExecuted(Handler.Widget);
				}
			}
		}

		static readonly Selector selExecute = new Selector("execute");

		public void Create()
		{
			Control = new NSThread(new Delegate { Handler = this }, selExecute, null);
		}

		public void CreateCurrent()
		{
			Control = NSThread.Current;
		}

		public void CreateMain()
		{
			Control = NSThread.MainThread;
		}

		public void Start()
		{
			Control.Start();
		}

		public void Abort()
		{
			Control.Cancel();
		}

		public bool IsAlive { get { return Control.IsExecuting; } }

		public bool IsMain { get { return Control.IsMainThread; } }
	}
}