text:
from five import grok
from persistent.dict import PersistentDict
from plone.directives import form
from plone.formwidget.contenttree.source import ObjPathSourceBinder
from plone.memoize.instance import memoize
from plone.supermodel import model
from Products.CMFCore.interfaces import IDublinCore
from Products.CMFCore.utils import getToolByName
from tn.plonemailing import _
from tn.plonemailing import interfaces
from z3c.relationfield.interfaces import IHasRelations
from zope.annotation.interfaces import IAnnotations

import inspect
import plone.app.controlpanel
import z3c.relationfield
import zope.component
import zope.interface

NEWSLETTER_PROPERTIES_KEY = 'tn.plonemailing.newsletter-properties'

possiblePossibleSubscriberProviders = ObjPathSourceBinder(**dict(
    object_provides=interfaces.IPossibleSubscriberProvider.__identifier__
))

base_newsletter = interfaces.INewsletterAttributes

class INewsletterFromContent(model.Schema, interfaces.ISubscriberProvider):
    """Transform a content into a newsletter.
    """

    form.fieldset(
        'newsletter',
        label=_(u'Newsletter'),
        fields=('author_address', 'author_name',
                'sender_address', 'sender_name',
                'reply_to_address', 'reply_to_name',
                'subject'),
    )

    possible_subscriber_providers = z3c.relationfield.RelationList(
        title=_(u'Subscriber providers'),
        description=_(u'The subscriber providers to which this content '
                      u'should be sent.'),
        required=False,
        value_type=z3c.relationfield.RelationChoice(
            source=possiblePossibleSubscriberProviders
        )
    )

    author_address = zope.schema.TextLine(
        title=_(u'Author e-mail address'),
        description=_(u'The e-mail address of the author of the newsletter.  '
                      u'If none is provided, the address '
                      u'set as the site\'s contact form address will be '
                      u'used.'),
        required=False,
    )

    author_name = zope.schema.TextLine(
        title=_(u'Author name'),
        description=_(u'The name of the author of the newsletter.  '
                      u'This is the name which will appear in the in '
                      u'the mailbox of the subscriber.'),
        required=False,
    )

    sender_address = zope.schema.TextLine(
        title=_(u'Sender e-mail address'),
        description=_(u'The e-mail address of the sender of the newsletter.  '
                      u'This '
                      u'should match the authentication address used to send '
                      u'the newsletter (otherwise you may have delivery '
                      u'problems for some subscribers).  If none is provided, '
                      u'the "Author e-mail address" is used.'),
        required=False,
    )

    sender_name = zope.schema.TextLine(
        title=_(u'Sender name'),
        description=_(u'The name of the sender of the newsletter.  If none is '
                      u'provided, the "Author name" is used.'),
        required=False
    )

    reply_to_address = zope.schema.TextLine(
        title=_("Reply e-mail address"),
        description=_(u'The e-mail address where replies should go to.  '
                      u'Leave blank '
                      u'to not set a reply address.'),
        required=base_newsletter['reply_to_address'].required,
    )

    reply_to_name = zope.schema.TextLine(
        title=_("Reply person name"),
        description=_(u'The name of the person whom replies should go to.'),
        required=base_newsletter['reply_to_name'].required,
    )

    subject = zope.schema.TextLine(
        title=_(u'Subject'),
        description=_(u'The subject of the newsletter.  If none is provided '
                      u'the title of the content is used.'),
        required=False,
    )

zope.interface.alsoProvides(INewsletterFromContent, form.IFormFieldProvider)

def add_annotations_properties(*names):
    def generate_property(name):
        def get(self):
            return self.annotations.get(name)

        def set(self, value):
            self.annotations[name] = value
        return property(get, set)
    for name in names:
        inspect.currentframe(1).f_locals[name] = generate_property(name)

class NewsletterFromContent(object):
    """Store newsletter properties in an annotation in the content object.
    """
    zope.component.adapts(IDublinCore)
    zope.interface.implements(INewsletterFromContent)

    def __init__(self, context):
        self.context = context

    add_annotations_properties('author_address', 'author_name',
                               'sender_address', 'sender_name',
                               'reply_to_address', 'reply_to_name',
                               'subject')

    # 'possible_subscriber_providers' is implemented as an attribute, in order
    # to allow cataloging by z3c.relationfield.
    @property
    def possible_subscriber_providers(self):
        # If set to None, return an empty list.
        return getattr(
            self.context,
            '_newsletter_from_content_possible_subscriber_providers',
            []
        ) or []

    @possible_subscriber_providers.setter
    def possible_subscriber_providers(self, value):
        self.context.\
            _newsletter_from_content_possible_subscriber_providers = value

    @property
    def subscribers(self):
        for possible_provider in self.possible_subscriber_providers:
            obj = possible_provider.to_object
            provider = interfaces.ISubscriberProvider(obj)
            for subscriber in provider.subscribers:
                yield subscriber

    @property
    @memoize
    def annotations(self):
        annotations = IAnnotations(self.context)
        values = annotations.get(NEWSLETTER_PROPERTIES_KEY, None)
        if values is None:
            values = annotations[NEWSLETTER_PROPERTIES_KEY] = PersistentDict()
        return values

class NewsletterAttributes(grok.Adapter):
    grok.context(interfaces.IPossibleNewsletterAttributes)
    grok.implements(interfaces.INewsletterAttributes)

    def __init__(self, context):
        self.context = context

    @property
    def author_address(self):
        return (self.behavior().author_address or
                self.mail_settings().email_from_address)

    @property
    def author_name(self):
        return (self.behavior().author_name or
                self.mail_settings().email_from_name)

    @property
    def sender_address(self):
        return self.behavior().sender_address or self.author_address

    @property
    def sender_name(self):
        return self.behavior().sender_name or self.author_name

    @property
    def reply_to_address(self):
        return self.behavior().reply_to_address

    @property
    def reply_to_name(self):
        return self.behavior().reply_to_name

    @property
    def subject(self):
        return self.behavior().subject or self.context.title

    @property
    @memoize
    def html(self):
        return interfaces.INewsletterHTML(self.context).html

    @property
    def last_sent(self):
        return self.annotations.get('last_sent')

    @last_sent.setter
    def last_sent(self, value):
        self.annotations['last_sent'] = value

    @memoize
    def mail_settings(self):
        portal = getToolByName(self.context, 'portal_url').getPortalObject()
        return plone.app.controlpanel.mail.IMailSchema(portal)

    @memoize
    def behavior(self):
        return INewsletterFromContent(self.context)

    @property
    @memoize
    def annotations(self):
        annotations = IAnnotations(self.context)
        values = annotations.get(NEWSLETTER_PROPERTIES_KEY, None)
        if values is None:
            values = annotations[NEWSLETTER_PROPERTIES_KEY] = PersistentDict()
        return values

class INewsletterFromContentMarker(IHasRelations,
                                   interfaces.IPossibleNewsletterAttributes):
    """Marker interface for items which can be turned into newsletters.
    """

    # Since z3c.relationfield will do an attribute lookup to get the relations
    # to index in its catalog, this field is declared by this interface,
    # although it being just a marker provided by the object on which the
    # behavior INewsletterFromContent is assigned, which in turn populates and
    # manages this field.
    _newsletter_from_content_possible_subscriber_providers = \
        z3c.relationfield.RelationList(
            required=False,
            value_type=z3c.relationfield.RelationChoice(
                source=possiblePossibleSubscriberProviders
            )
        )


text:
FROM node:13 AS asseble-js

RUN npm install --global bower@1.8.2

COPY --chown=node:node ./bower.json /home/bower/
WORKDIR /home/bower

USER node
RUN bower install --force-latest

# the stage of our build will use a gradle
FROM gradle:4.1.0-jdk8-alpine AS build

# copy src code to the container
COPY --chown=gradle:gradle . /home/gradle/app
COPY --from=asseble-js --chown=gradle:gradle /home/bower/bower_components /home/gradle/app/src/main/resources/static/bower_components

WORKDIR /home/gradle/app

# package our application code
RUN gradle clean build -x test --no-daemon

# the second stage of our build will use open jdk 8
FROM openjdk:8-jre-slim

EXPOSE 8080

RUN mkdir /app

# copy only the artifacts we need from the first stage and discard the rest
COPY --from=build /home/gradle/app/build/libs/*.jar /app/hanbaikanri.jar

# set the startup command to execute the jar
ENTRYPOINT ["java", "-XX:+UnlockExperimentalVMOptions", "-XX:+UseCGroupMemoryLimitForHeap", "-Dspring.profiles.active=production","-jar","/app/hanbaikanri.jar"]

redpajama_set_name: RedPajamaGithub


text:
enum ARGUMENT_TYPE
{
	ARGUMENT_TYPE_HELP = 0,
	ARGUMENT_TYPE_PID,
	ARGUMENT_TYPE_EXECUTABLE,
	ARGUMENT_TYPE_WORKING_DIRECTORY,
	ARGUMENT_TYPE_COMMAND_LINE_ARGS,
	ARGUMENT_TYPE_HOOK,
	ARGUMENT_TYPE_INVALID
};

struct ArgumentInfo
{
	const char* argument;
	const char* help;
	ARGUMENT_TYPE type;
};

// Each option is prefixed by a forward slash.
// If an argument requires an option, the value will directly follow
// the argument, seperated by a colon.
const ArgumentInfo Arguments[] =
{
	{ "?", NULL, ARGUMENT_TYPE_HELP },
	{ "pid", "Injects a DLL into an already running process", ARGUMENT_TYPE_PID },
	{ "exe", "Runs and then injects a DLL into an executable", ARGUMENT_TYPE_EXECUTABLE },
	{ "cwd", "Requires /exe, changes the current working directory of the executable", ARGUMENT_TYPE_WORKING_DIRECTORY },
	{ "args", "Requires /exe, supplies a list of arguments to the executable", ARGUMENT_TYPE_COMMAND_LINE_ARGS },
	{ "hook", "Provides the hook DLL.", ARGUMENT_TYPE_HOOK },
	{ NULL, NULL, ARGUMENT_TYPE_INVALID } // End of list.
};

// Checks an argument and sets the option.
//
// The parameter, `option', will be set to NULL (or an empty string) if there is no option.
// Otherwise, it will contain the option to the argument.
//
// Returns: The argument type, or ARGUMENT_TYPE_INVALID in the case of malformed input.
ARGUMENT_TYPE CheckArgument(const char* a, const char*& option)
{
	// Set option to NULL to indicate that no option was provided (general case).
	option = NULL;

	// Sanity check, in case an argument provided is empty or immediately invalid.
	// Keep in mind, since an argument begins with the forward slash character,
	// there must be at least two characters in a valid argument.
	if (strlen(a) < 2 || a[0] != '/')
	{
		return ARGUMENT_TYPE_INVALID;
	}

	for (const ArgumentInfo* arg = Arguments; arg->argument != NULL; ++arg)
	{
		int argLength = strlen(arg->argument);

		// Check the option, only checking the minimum amount possible.
		// As well, skip the first character of the provided string, `a'.
		if (std::strncmp(arg->argument, a + 1, argLength) == 0)
		{
			int l = std::strlen(a + 1);

			// Check for an optional option (woo) to the argument.
			// This also serves as a means to check that the provided argument
			// is not actually equal for `argLength' bytes.
			// Otherwise, /A would be considered the same as /ABC.
			if (l >= argLength)
			{
				if (l > argLength && a[argLength + 1] == ':')
					option = &a[argLength + 2]; // Skip the option seperator.

				return arg->type;
			}
		}
	}

	return ARGUMENT_TYPE_INVALID;
}

// The type of process to hook.
enum APPLICATION_HOOK_TYPE
{
	APPLICATION_HOOK_TYPE_PID,
	APPLICATION_HOOK_TYPE_EXECUTABLE,
	APPLICATION_HOOK_TYPE_INVALID
};

int main(int argc, const char* argv[])
{
	// Start with a sane default value. If the value remains unchanged
	// after checking the command-line arguments, an application type
	// was never provided. In this case, bail out and inform the user.
	APPLICATION_HOOK_TYPE hookType = APPLICATION_HOOK_TYPE_INVALID;

	// Required. This is either a PID or an executable name, as determined by `hookType'.
	const char* application = NULL;

	// Required. The hook DLL.
	const char* hook = NULL;

	// Optional working directory and command line options.
	// These are only used, and silently ignored otherwise, if the application hook type
	// is an executable.
	const char* workingDirectory = NULL;
	const char* commandLineArguments = "";

	// Optional value indicating the program should display help.
	bool showHelp = false;

	// Early sanity check. Show a helpful line if no arguments are provided.
	if (argc == 1)
	{
		std::printf("No arguments provided.\n");
		std::printf("Run with /? for  help.");

		return 1;
	}

	// Process the arguments, one at a type. The last type of each argument
	// is the only that matters (to allow overriding previous options).
	// (Obviously skip the first one since it's the executable name.)
	// (Also, if showHelp is set, abort early.)
	for (int i = 1; i < argc && !showHelp; ++i)
	{
		const char* option = NULL;

		switch(CheckArgument(argv[i], option))
		{
			case ARGUMENT_TYPE_HELP:
				showHelp = true;
				break;

			case ARGUMENT_TYPE_PID:
				hookType = APPLICATION_HOOK_TYPE_PID;
				application = option;
				break;

			case ARGUMENT_TYPE_EXECUTABLE:
				hookType = APPLICATION_HOOK_TYPE_EXECUTABLE;
				application = option;
				break;

			case ARGUMENT_TYPE_WORKING_DIRECTORY:
				workingDirectory = option;
				break;

			case ARGUMENT_TYPE_COMMAND_LINE_ARGS:
				commandLineArguments = option;
				break;

			case ARGUMENT_TYPE_HOOK:
				hook = option;
				break;

			default:
				// Silently ignore invalid input.
				break;
		}
	}

	// Show help and exit.
	if (showHelp)
	{
		for (const ArgumentInfo* arg = Arguments; arg->argument != NULL; ++arg)
		{
			if (arg->help)
				std::printf("%4s: %s\n", arg->argument, arg->help);
		}

		return 0;
	}

	// If no hook type is specified, tell the user and exit.
	if (hookType == APPLICATION_HOOK_TYPE_INVALID)
	{
		std::printf("No hook type specified.\n");
		std::printf("Run with /? for  help.");

		return 1;
	}

	// Same for no hook specified.
	if (!hook)
	{
		std::printf("No hook DLL specified.\n");
		std::printf("Run with /? for  help.");

		return 1;
	}

	HANDLE process = INVALID_HANDLE_VALUE;
	HANDLE processThread = INVALID_HANDLE_VALUE;
	int pid = 0;

	// Try and execute the program and get the PID.
	if (hookType == APPLICATION_HOOK_TYPE_EXECUTABLE)
	{
		// Build command line arguments (simply '<application> <commandLineArguments>').
		// Keep in mind there is a space and the terminating NUL character.
		// This has to be done in a non-const buffer since CreateProcess can modify the buffer...
		int commandLineLength = std::strlen(application) + std::strlen(commandLineArguments) + 2;
		char* commandLine = (char*)std::malloc(commandLineLength);

		// Add the application name.
		std::memcpy(commandLine, application, strlen(application));

		// And the space.
		commandLine[strlen(application)] = ' ';

		// And the command line arguments.
		std::memcpy(commandLine + strlen(application) + 1, commandLineArguments, std::strlen(commandLineArguments));

		// Lastly, the NUL terminator.
		commandLine[commandLineLength - 1] = '\0';

		// Run the process.
		STARTUPINFO startupInfo;
		PROCESS_INFORMATION processInformation;

		ZeroMemory(&startupInfo, sizeof(STARTUPINFO));
		startupInfo.cb = sizeof(STARTUPINFO);

		BOOL result = CreateProcess(NULL, commandLine, NULL, NULL, FALSE, CREATE_SUSPENDED, NULL, workingDirectory, &startupInfo, &processInformation);
		free(commandLine);

		if (result)
		{
			processThread = processInformation.hThread;
			CloseHandle(processInformation.hProcess);

			pid = processInformation.dwProcessId;
		}
		else
		{
			std::fprintf(stderr, "Could not open process %s (%lu)!\n", application, GetLastError());

			return 1;
		}
	}
	// Else, get the PID from the argument.
	else
	{
		pid = std::strtol(application, NULL, 0);
	}

	// Open the process.
	process = OpenProcess(PROCESS_CREATE_THREAD | PROCESS_QUERY_INFORMATION | PROCESS_VM_OPERATION | PROCESS_VM_WRITE | PROCESS_VM_READ, FALSE, pid);

	if (process == INVALID_HANDLE_VALUE)
	{
		std::fprintf(stderr, "Could not open process from PID %d", pid);

		return 1;
	}

	// Allocate memory in the process.
	int memorySize = std::strlen(hook) + 1;
	void* memory = VirtualAllocEx(process, NULL, memorySize, MEM_COMMIT, PAGE_READWRITE);

	if (!memory)
	{
		std::fprintf(stderr, "Could not allocate memory in process!");

		CloseHandle(process);

		return 1;
	}

	// Write memory.
	if (WriteProcessMemory(process, memory, hook, memorySize, NULL) == 0)
	{
		std::fprintf(stderr, "Could not write to process memory!");

		// This shouldn't fail if the program has gotten this far.
		if (!VirtualFreeEx(process, memory, memorySize, MEM_RELEASE))
			std::fprintf(stderr, "Also failed to free memory in process...");

		CloseHandle(process);

		return 1;
	}

	// Create a thread, using the `LoadLibraryA' method as the thread function.
	// This is because the remote function would have to exist in the process,
	// and in doing so, would have to be copied over. This is the easier route,
	// since LoadLibrary is shared amongst all processes.
	LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
	HANDLE thread = CreateRemoteThread(process, NULL, 0, routine, memory, 0, NULL);

	if (thread == INVALID_HANDLE_VALUE)
	{
		std::fprintf(stderr, "Could not create thread!");

		// Deja vu.
		if (!VirtualFreeEx(process, memory, memorySize, MEM_RELEASE))
			std::fprintf(stderr, "Also failed to free memory in process...");

		CloseHandle(process);

		return 1;
	}

	// Check the result of the method.
	WaitForSingleObject(thread, INFINITE);

	DWORD exitCode = 0;
	BOOL result = GetExitCodeThread(thread, &exitCode);

	// Free memory, etc.
	VirtualFreeEx(process, memory, memorySize, MEM_RELEASE);
	CloseHandle(thread);

	// Run process.
	if (hookType == APPLICATION_HOOK_TYPE_EXECUTABLE)
	{
		ResumeThread(processThread);
		CloseHandle(processThread);
	}

	CloseHandle(process);

	if (!result || !exitCode)
	{
		std::fprintf(stderr, "Could not inject DLL!");

		return 1;
	}

	// Success!
	std::printf("Injected DLL.");

	return 0;
}


text:
/*
 * Licensed under MIT (https://github.com/ligoj/ligoj/blob/master/LICENSE)
 */
define([
	'jquery', 'cascade', 'bootstrap', 'form'
], function ($, $cascade) {
	// Global handler for better bootstrap implicit experience
	$('body').popover({selector: '[data-toggle="popover"]:not([data-trigger="manual"])', html: 'true', trigger: 'hover focus', container: 'body'});
	$('body').tooltip({selector: '[data-toggle="tooltip"]:not([data-trigger="manual"])', html: 'true', trigger: 'hover focus', container: 'body', animation: false});

	function closeTooltips() {
		$('[data-toggle="tooltip"][aria-describedby]').each(function() {
			$(this).tooltip('hide');
		});
		// Destroy orphan previous tooltips
		$('.tooltip.in').empty().remove();
	};
	$(document).on('click', '.toggle-visibility', function () {
		$(this).toggleClass('active');
	}).on('click', '.disabled,[disabled]', function (event) {
		event.preventDefault();
	}).on('click', '[data-toggle="popover"][data-trigger="manual"]', function () {
		$(this).popover('toggle');
	}).on('mousedown', function (e) {
		// Auto hide popover on click
		if ($('.popover.in').length && $(e.target).closest('[data-toggle="popover"],.popover').length === 0) {
			$('.popover.in').each(function () {
				$('[aria-describedby="' + $(this).attr('id') + '"]').popover('hide');
			});
		}
	}).on('show.bs.dropdown', null, function(e) {
		// Close previous dropdowns
		$('.dropdown-menu.detached').closeDropdown();

		// Handle the dropdown inside an absolute/overflow-hidden container, move the dropdown to body
		var $trigger = $(e.relatedTarget);
		if (!$trigger.hasClass('detached') && $trigger.closest('.dropdown-overflow').length && $trigger.closest('.dropdown').length) {
			var flag = 'dropdown-' + Math.random();
			var $dropdown = $trigger.closest('.dropdown');
			var $menu = $dropdown.find('.dropdown-menu').addClass('detached').attr('data-previous-container',flag);
			$trigger.addClass('detached').attr('data-dropdown-container',flag);
			$('body').append($menu.css({
				position: 'absolute',
				display: 'initial',
				left: $menu.offset().left + 'px',
				width : $menu.width() + 'px',
				top: ($menu.offset().top + $(e.target).outerHeight()) + 'px'
			}).data('open', true).detach());
		}
	}).on('hidden.bs.dropdown', null, function(e) {
		var $trigger = $(e.relatedTarget);
		if ($trigger.hasClass('detached')) {
			$('[data-previous-container="' + $trigger.attr('data-dropdown-container') + '"]').closeDropdown();
		}
	}).on('change', '.btn-file :file', function () {
		var $input = $(this);
		var label = $input.val().replace(/\\/g, '/').replace(/.*\//, '');
		$input.parents('.input-group').find(':text').val(label);
		// FIX : #19192 ->
	}).off('click.bs.button.data-api', '[data-toggle^="button"]').on('click.bs.button.data-api', '[data-toggle^="button"]', function (e) {
		var $btn = $(e.target).closest('.btn').button('toggle');
		if (!($(e.target).is('input[type="radio"]') || $(e.target).is('input[type="checkbox"]'))) {
			// Prevent double click on radios, and the double selections (so cancellation) on checkboxes
			e.preventDefault();
			// The target component still receive the focus
			if ($btn.is('input,button')) {
				$btn.trigger('focus');
			} else {
				$btn.find('input:visible,button:visible').first().trigger('focus');
			}
		}
	}).on('click', '.retract', function () {
		var $retractable = $(this).closest('.retractable');
		$retractable.toggleClass('retracted').trigger('retract:' + ($retractable.hasClass('.retracted') ? 'retracted' : 'expended'));
	}).on('keypress', 'form:not([method]),[method="get"],form[method="GET"]', function (e) {
		// Some browser (like Chrome) the first submit is used (hidden or not) and receive a click
		if ((e.which === 13 || e.keyCode === 13) && !$(e.target).is('textarea')) {
			// Determines the right input
			var $button = $(this).find('input:visible[type=submit]:not(.disabled):not(.hide):not(.hidden):not([disabled]),button:visible[type=submit]:not(.disabled):not(.hide):not(.hidden):not([disabled])').first();
			if ($button.length) {
				$button.trigger('click');
				e.preventDefault();
				return false;
			}
		}
	}).on('submit', 'form:not([method]),[method="get"],form[method="GET"]', function (e) {
		e.preventDefault();
	}).on('click.bs.tab.data-api.ajax', 'a[data-toggle="tab-ajax"][data-ajax]:not([cascade-loaded])', function (e) {
		// Load active partials for tab
		var $tab = $(this)
		var $link = $tab.attr('cascade-loaded','true');
		$.proxy($cascade.loadPartial, $link)(function() {
			$link.attr('data-toggle', 'tab').trigger('click.bs.tab.data-api');
		});
		e.preventDefault();
	})
	// Load active partials for collapse
	.on('show.bs.collapse', '.collapse[data-ajax]', $cascade.loadPartial)
	// Load active partials for popover
	.on('show.bs.popover', '[data-ajax]', $cascade.loadPartial)
	// Load active partials for modal
	.on('click.bs.modal.data-api.ajax', '[data-toggle="modal-ajax"][data-ajax]:not([cascade-loaded])', function (e) {
		var $link = $(this).attr('cascade-loaded','true');
		$.proxy($cascade.loadPartial, $link)(function() {
			$link.attr('data-toggle', 'modal').trigger('click.bs.modal.data-api');
		});
		e.preventDefault();
	}).on('show.bs.modal', '.modal', closeTooltips)
	.on('show.bs.tooltip', null, closeTooltips)
	.on('hide.bs.modal', '.modal', closeTooltips)
	.on('select2-close', null, closeTooltips)
	.on('show.bs.modal', '.modal[data-ajax]', $cascade.loadPartial);

	// Placeholder patch for Select2
	$.fn.select2Placeholder = function(placeholder) {
		var data = $(this).data('select2');
		if (typeof placeholder === 'string') {
			data.opts.placeholder = placeholder;
			if ($(this).select2('data') === null) {
				data.container.find('.select2-chosen').html(placeholder);
			}
			return this;
		}
		// Return the current Select2 value
		return data.opts.placeholder;
	};

	$.fn.hideGroup = function () {
		$(this).closest('.form-group').addClass('hidden');
		return this;
	};
	$.fn.closeDropdown = function () {
		this.each(function() {
			var $dropdown = $(this);
			var flag = $dropdown.attr('data-previous-container') || $dropdown.attr('data-dropdown-container');
			var $trigger = $();
			var $container = $();
			if (flag) {
				$trigger = $('[data-dropdown-container="' + flag + '"]');
				$dropdown = $('[data-previous-container="' + flag + '"]');
				$container = $trigger.parent();
			} else if ($dropdown.is('.dropdown-menu')) {
				$container = $dropdown.parent();
				$trigger = $container.find('[data-toggle="dropdown"]');
			} else if ($dropdown.is('.dropdown')) {
				$container = $dropdown;
				$trigger = $container.find('[data-toggle="dropdown"]');
				$dropdown = $container.find('.dropdown-menu');
			} else if ($dropdown.is('[data-toggle="dropdown"]')) {
				$container = $dropdown.parent();
				$trigger = $dropdown;
				$dropdown = $container.find('.dropdown-menu');
			}
			if ($trigger.hasClass('detached')) {
				$container.removeClass('open').append($dropdown.removeClass('detached').css({
					position: '',
					left: '',
					width: '',
					display: '',
					top: ''
				}).detach());
				$trigger.removeClass('detached');
			}
			$container.removeAttr('data-open');
			$trigger.removeAttr('data-dropdown-container');
			$dropdown.data('open', false).removeAttr('data-previous-container');
		});
	};
	/**
	 * $ shortcut to apply disabled mode.
	 */
	$.fn.disable = function () {
		var yes = (arguments.length === 0 || arguments[0]) && 'disabled';
		$(this)[yes ? 'attr' : 'removeAttr']('disabled', 'disabled').prop('disabled', yes)[yes ? 'addClass' : 'removeClass']('disabled');
		return this;
	};
	/**
	 * $ shortcut to apply enabled mode.
	 */
	$.fn.enable = function () {
		$(this).disable(!(arguments.length === 0 || arguments[0]));
		return this;
	};
	$.fn.showGroup = function () {
		$(this).closest('.form-group').removeClass('hidden');
		return this;
	};
	$.fn.rawText = function (rawText) {
		// Get text mode
		if (typeof rawText === 'undefined') {
			var text = this.first().contents().filter(function () {
				return this.nodeType === 3;
			});
			return text.length ? text[0].textContent || '' : '';
		}
		// Set text
		this.each(function () {
			var text = $(this).contents().filter(function () {
				return this.nodeType === 3;
			});
			if (rawText && text.length === 0) {
				// Create a new text node at the end
				$(this).append(document.createTextNode(rawText));
			} else {
				// Replace the content of existing node
				text.each(function () {
					this.textContent = rawText;
				});
			}
		});
		return this;
	};

	function selectMenu() {
		var selector = $(this).closest('li');
		// Check there is not yet selected child
		if (selector.parents('.navbar,.nav-pills.nav-stacked').find('li.active').length === 0) {
			selector.addClass('active');
			$.fn.collapse && selector.parents('.navbar').length === 0 && selector.parents('.collapse').collapse('show');
			selector.parents('.dropdown').addClass('active');
		}
	}

	/**
	 * Synchronize the menu with the URL of the context url
	 * @param  {string} url Current url to synchronize with menus.
	 */
	function synchronizeMenu(url) {
		var patterns = [];
		var fragments = url.split('/');
		do {
			patterns.push('a[href^="' + fragments.join('/').replace(/"/g, '\\"') + '"]');
			fragments.pop();
		} while (fragments.length);
		var base = _('_main').find('.navbar,.nav-pills.nav-stacked');

		// Remove all highlights
		base.find('li.active').removeClass('active');

		// Highlight tool bar menu
		for (var index = 0; index < patterns.length; index++) {
			base.find(patterns[index]).each(selectMenu);
		}
	}

	// Transformation
	$cascade.register('html', function (selector) {
		// Add popover feature
		selector.find('.tab-pane.active[data-ajax]').each($cascade.loadPartial);
	});
	$cascade.register('hash', function (url) {
		$('.modal-backdrop').remove();
		$('.tooltip').remove();
		$('.popover').remove();
		$('.dropdown-menu.detached').closeDropdown();
		synchronizeMenu(url);
	});

	/**
	 * Full screen management : enter full screen
	 * @param {Object} $selector Optional selector.
	 */
	$.fn.fullscreen = function() {
		var el = $(this)[0] || document.documentElement;

		// use necessary prefixed versions
		if (el.webkitRequestFullscreen) {
			el.webkitRequestFullscreen();
			return;
		}
		if (el.mozRequestFullScreen) {
			el.mozRequestFullScreen();
			return;
		}
		if (el.msRequestFullscreen) {
			el.msRequestFullscreen();
			return;
		}
		// finally the standard version
		el.requestFullscreen && el.requestFullscreen();
	};

	/**
	 * Exit full screen management
	 */
	$.fn.exitFullscreen = function() {
		// use necessary prefixed versions
		if (document.webkitExitFullscreen) {
			document.webkitCancelFullScreen();
			return;
		}
		if (document.mozCancelFullScreen) {
			document.mozCancelFullScreen();
			return;
		}
		if (document.msExitFullscreen) {
			document.msExitFullscreen();
			return;
		}
		// finally the standard version
		document.exitFullscreen && document.exitFullscreen();
	};

});


text:
package com.digitalascent.core.aws.lamdba.framework.validation;

import com.digitalascent.core.aws.lamdba.framework.RequestValidator;
import com.google.common.collect.ImmutableList;

import java.util.List;

public final class ChainedRequestValidator implements RequestValidator {
    private final List<RequestValidator> requestValidators;

    public ChainedRequestValidator(List<RequestValidator> requestValidators) {
        this.requestValidators = ImmutableList.copyOf(requestValidators);
    }

    @Override
    public void validate(Object request) {
        for (RequestValidator requestValidator : requestValidators) {
            requestValidator.validate(request);
        }
    }
}


text:
<?php

namespace Ucf\Hierarchy\Model;

/**
 * Class PathEnumeration
 * @package Ucf\Hierarchy\Model
 */
class PathEnumeration extends AbstractHierarchy
{
    const GENEALOGY = 'genealogy';
    const SORT_ID = 'sort_id';

    /**
     * {@inheritDoc}
     */
    public function validate(array $item)
    {
        foreach ([self::ID, self::GENEALOGY, self::SORT_ID] as $field) {
            if (!array_key_exists($field, $item)) {
                return false;
            }
        }

        return true;
    }
}


text:
    // Keyboard Search Module
    // ======================

    // _Set Current Search Option
    // -------------------------
    //      Sets the currently selected dropdown list search option

    selectBoxIt._setCurrentSearchOption = function(currentOption) {

        var self = this;

        // Does not change the current option if `showFirstOption` is false and the matched search item is the hidden first option.
        // Otherwise, the current option value is updated
        if ((self.options["aggressiveChange"] || self.options["selectWhenHidden"] || self.listItems.eq(currentOption).is(":visible")) && self.listItems.eq(currentOption).data("disabled") !== true) {

            // Calls the `blur` event of the currently selected dropdown list option
            self.listItems.eq(self.currentFocus).blur();

            // Sets `currentIndex` to the currently selected dropdown list option
            self.currentIndex = currentOption;

            // Sets `currentFocus` to the currently selected dropdown list option
            self.currentFocus = currentOption;

            // Focuses the currently selected dropdown list option
            self.listItems.eq(self.currentFocus).focusin();

            // Updates the scrollTop so that the currently selected dropdown list option is visible to the user
            self._scrollToView("search");

            // Triggers the custom `search` event on the original select box
            self.triggerEvent("search");

        }

        // Maintains chainability
        return self;

    };

    // _Search Algorithm
    // -----------------
    //      Uses regular expressions to find text matches
    selectBoxIt._searchAlgorithm = function(currentIndex, alphaNumeric) {

        var self = this,

            // Boolean to determine if a pattern match exists
            matchExists = false,

            // Iteration variable used in the outermost for loop
            x,

            // Iteration variable used in the nested for loop
            y,

            // Variable used to cache the length of the text array (Small enhancement to speed up traversing)
            arrayLength,

            // Variable storing the current search
            currentSearch,

            // Variable storing the textArray property
            textArray = self.textArray,

            // Variable storing the current text property
            currentText = self.currentText;

        // Loops through the text array to find a pattern match
        for (x = currentIndex, arrayLength = textArray.length; x < arrayLength; x += 1) {

            currentSearch = textArray[x];

            // Nested for loop to help search for a pattern match with the currently traversed array item
            for (y = 0; y < arrayLength; y += 1) {

                // Searches for a match
                if (textArray[y].search(alphaNumeric) !== -1) {

                    // `matchExists` is set to true if there is a match
                    matchExists = true;

                    // Exits the nested for loop
                    y = arrayLength;

                }

            } // End nested for loop

            // If a match does not exist
            if (!matchExists) {

                // Sets the current text to the last entered character
                self.currentText = self.currentText.charAt(self.currentText.length - 1).

                // Escapes the regular expression to make sure special characters are seen as literal characters instead of special commands
                replace(/[|()\[{.+*?$\\]/g, "\\$0");

                currentText = self.currentText;

            }

            // Resets the regular expression with the new value of `self.currentText`
            alphaNumeric = new RegExp(currentText, "gi");

            // Searches based on the first letter of the dropdown list options text if the currentText < 3 characters
            if (currentText.length < 3) {

                alphaNumeric = new RegExp(currentText.charAt(0), "gi");

                // If there is a match based on the first character
                if ((currentSearch.charAt(0).search(alphaNumeric) !== -1)) {

                    // Sets properties of that dropdown list option to make it the currently selected option
                    self._setCurrentSearchOption(x);

                    if((currentSearch.substring(0, currentText.length).toLowerCase() !== currentText.toLowerCase()) || self.options["similarSearch"]) {

                        // Increments the current index by one
                        self.currentIndex += 1;

                    }

                    // Exits the search
                    return false;

                }

            }

            // If `self.currentText` > 1 character
            else {

                // If there is a match based on the entire string
                if ((currentSearch.search(alphaNumeric) !== -1)) {

                    // Sets properties of that dropdown list option to make it the currently selected option
                    self._setCurrentSearchOption(x);

                    // Exits the search
                    return false;

                }

            }

            // If the current text search is an exact match
            if (currentSearch.toLowerCase() === self.currentText.toLowerCase()) {

                // Sets properties of that dropdown list option to make it the currently selected option
                self._setCurrentSearchOption(x);

                // Resets the current text search to a blank string to start fresh again
                self.currentText = "";

                // Exits the search
                return false;

            }

        }

       // Returns true if there is not a match at all
        return true;

    };

    // Search
    // ------
    //      Calls searchAlgorithm()
    selectBoxIt.search = function(alphaNumericKey, callback, rememberPreviousSearch) {

        var self = this;

        // If the search method is being called internally by the plugin, and not externally as a method by a user
        if (rememberPreviousSearch) {

            // Continued search with history from past searches.  Properly escapes the regular expression
            self.currentText += alphaNumericKey.replace(/[|()\[{.+*?$\\]/g, "\\$0");

        }

        else {

            // Brand new search.  Properly escapes the regular expression
            self.currentText = alphaNumericKey.replace(/[|()\[{.+*?$\\]/g, "\\$0");

        }

        // Searches globally
        var searchResults = self._searchAlgorithm(self.currentIndex, new RegExp(self.currentText, "gi"));

        // Searches the list again if a match is not found.  This is needed, because the first search started at the array indece of the currently selected dropdown list option, and does not search the options before the current array indece.
        // If there are many similar dropdown list options, starting the search at the indece of the currently selected dropdown list option is needed to properly traverse the text array.
        if (searchResults) {

            // Searches the dropdown list values starting from the beginning of the text array
            self._searchAlgorithm(0, self.currentText);

        }

        // Provide callback function support
        self._callbackSupport(callback);

        // Maintains chainability
        return self;

    };


text:
package com.mmnaseri.couteau.reflection.beans.impl;

import com.mmnaseri.couteau.basics.api.Processor;
import com.mmnaseri.couteau.reflection.beans.BeanDescriptor;
import com.mmnaseri.couteau.reflection.beans.ReadAccessorAware;
import com.mmnaseri.couteau.reflection.beans.WriteAccessorAware;
import com.mmnaseri.couteau.reflection.error.NoSuchPropertyException;
import com.mmnaseri.couteau.reflection.property.ReadPropertyAccessor;
import com.mmnaseri.couteau.reflection.property.WritePropertyAccessor;
import com.mmnaseri.couteau.reflection.util.ReflectionUtils;

import java.lang.reflect.Modifier;
import java.lang.reflect.Type;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * This is a bean descriptor that will take in a bean class and then project all its properties through the use of
 * read/write accessors.
 *
 * @author Milad Naseri (mmnaseri@programmer.net)
 * @since 1.0 (7/9/13, 2:10 PM)
 */
public abstract class AbstractClassBeanDescriptor<E> implements BeanDescriptor<E>, ReadAccessorAware, WriteAccessorAware {

    /**
     * The bean class being described
     */
    private final Class<E> beanClass;

    /**
     * The property readers for this descriptor
     */
    private final Map<String, ReadPropertyAccessor<?>> readers = new HashMap<String, ReadPropertyAccessor<?>>();

    /**
     * The property writers for this descriptors
     */
    private final Map<String, WritePropertyAccessor<?>> writers = new HashMap<String, WritePropertyAccessor<?>>();

    /**
     * Instantiates the bean descriptor while taking in the bean class
     * @param beanClass    the class to be used
     */
    public AbstractClassBeanDescriptor(Class<E> beanClass) {
        this(beanClass, null);
    }

    /**
     * Instantiates the bean descriptor while taking in the bean class
     * @param beanClass    the class to be used
     */
    protected AbstractClassBeanDescriptor(Class<E> beanClass, Processor<AbstractClassBeanDescriptor<E>> processor) {
        if (processor != null) {
            processor.process(this);
        }
        this.beanClass = beanClass;
        this.readers.putAll(getReaders());
        this.writers.putAll(getWriters());
    }

    /**
     * @return a map of property names to property readers
     */
    protected abstract Map<String, ReadPropertyAccessor<?>> getReaders();

    /**
     * @return a map of property names to property writers
     */
    protected abstract Map<String, WritePropertyAccessor<?>> getWriters();

    /**
     * @return the type of the bean being described
     */
    @Override
    public Class<E> getBeanType() {
        return beanClass;
    }

    /**
     * @return the names of the properties available to this descriptor
     */
    @Override
    public Set<String> getPropertyNames() {
        return readers.keySet();
    }

    /**
     * Determines the type of the given property
     * @param propertyName    the name of the property
     * @return this property's type
     * @throws NoSuchPropertyException
     */
    @Override
    public Class<?> getPropertyType(String propertyName) throws NoSuchPropertyException {
        if (!hasProperty(propertyName)) {
            throw new NoSuchPropertyException(getBeanType(), propertyName);
        }
        return readers.containsKey(propertyName) ? readers.get(propertyName).getPropertyType() : writers.get(propertyName).getPropertyType();
    }

    /**
     * Determines whether this bean has a property with the given name
     * @param propertyName    the name of the property
     * @return {@code true} if the bean has this property, and {@code false} otherwise.
     */
    @Override
    public boolean hasProperty(String propertyName) {
        return readers.containsKey(propertyName) || writers.containsKey(propertyName);
    }

    /**
     * Will return the generic property reader for the property named as specified
     * @param propertyName    the name of the property
     * @return the property reader
     * @throws NoSuchPropertyException
     */
    @Override
    public ReadPropertyAccessor<?> getPropertyReader(String propertyName) throws NoSuchPropertyException {
        return getPropertyReader(propertyName, Object.class);
    }

    /**
     * Will return the property reader for a property of the given name and type
     * @param propertyName    the name of the property
     * @param propertyType    the type of the property
     * @param <T>             the type parameter for the property
     * @return the property reader
     * @throws NoSuchPropertyException
     */
    @Override
    public <T> ReadPropertyAccessor<T> getPropertyReader(String propertyName, Class<T> propertyType) throws NoSuchPropertyException {
        if (!hasProperty(propertyName)) {
            throw new NoSuchPropertyException(getBeanType(), propertyName);
        }
        final ReadPropertyAccessor<?> accessor = readers.get(propertyName);
        if (!ReflectionUtils.mapType(propertyType).isAssignableFrom(ReflectionUtils.mapType(accessor.getPropertyType()))) {
            throw new NoSuchPropertyException(getBeanType(), propertyName, propertyType);
        }
        //noinspection unchecked
        return (ReadPropertyAccessor<T>) accessor;
    }

    /**
     * Will return a generic property writer for the given property
     * @param propertyName    the property name
     * @return the property writer
     * @throws NoSuchPropertyException
     */
    @Override
    public WritePropertyAccessor<?> getPropertyWriter(String propertyName) throws NoSuchPropertyException {
        return getPropertyWriter(propertyName, Object.class);
    }

    /**
     * Will return a property writer for a property of the given name-type
     * @param propertyName    the name of the property
     * @param propertyType    the type of the property
     * @param <T>             the type parameter of the property
     * @return the property writer
     * @throws NoSuchPropertyException
     */
    @Override
    public <T> WritePropertyAccessor<T> getPropertyWriter(String propertyName, Class<T> propertyType) throws NoSuchPropertyException {
        if (!hasProperty(propertyName)) {
            throw new NoSuchPropertyException(getBeanType(), propertyName);
        }
        if (!isWritable(propertyName)) {
            return null;
        }
        final WritePropertyAccessor<?> accessor = writers.get(propertyName);
        if (!ReflectionUtils.mapType(propertyType).isAssignableFrom(ReflectionUtils.mapType(accessor.getPropertyType()))) {
            throw new NoSuchPropertyException(getBeanType(), propertyName, propertyType);
        }
        //noinspection unchecked
        return (WritePropertyAccessor<T>) accessor;
    }

    /**
     * Determines whether the given property can be written to or whether it is just
     * a read-only property.
     * @param propertyName    the name of the property
     * @return {@code true} if the property is writable
     * @throws NoSuchPropertyException
     */
    public boolean isWritable(String propertyName) throws NoSuchPropertyException {
        if (!hasProperty(propertyName)) {
            throw new NoSuchPropertyException(getBeanType(), propertyName);
        }
        return writers.containsKey(propertyName);
    }

    /**
     * Will return the generic type of the property. If the property does not define a generic
     * type, this method's return value will be equivalent to that of {@link #getPropertyType(String)}
     * @param propertyName    the name of the property
     * @return the generic type of the property
     * @throws NoSuchPropertyException
     */
    @Override
    public Type getGenericPropertyType(String propertyName) throws NoSuchPropertyException {
        return readers.containsKey(propertyName) ? getPropertyReader(propertyName).getGenericPropertyType() : getPropertyWriter(propertyName).getGenericPropertyType();
    }

    /**
     * Determines whether the wrapped class is abstract or not
     * @return {@code true} if the wrapped class is abstract or if it is an interface
     */
    public boolean isAbstract() {
        return Modifier.isAbstract(beanClass.getModifiers()) || beanClass.isInterface();
    }

}


text:
using namespace gpdxl;

XERCES_CPP_NAMESPACE_USE

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerPlan::CParseHandlerPlan
//
//	@doc:
//		Constructor
//
//---------------------------------------------------------------------------
CParseHandlerPlan::CParseHandlerPlan
	(
	CMemoryPool *mp,
	CParseHandlerManager *parse_handler_mgr,
	CParseHandlerBase *parse_handler_root
	)
	:
	CParseHandlerBase(mp, parse_handler_mgr, parse_handler_root),
	m_plan_id(0),
	m_plan_space_size(0),
	m_dxl_node(NULL),
	m_direct_dispatch_info(NULL)
{}

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerPlan::~CParseHandlerPlan
//
//	@doc:
//		Destructor
//
//---------------------------------------------------------------------------
CParseHandlerPlan::~CParseHandlerPlan()
{
	CRefCount::SafeRelease(m_dxl_node);
}

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerPlan::CreateDXLNode
//
//	@doc:
//		Root of constructed DXL plan
//
//---------------------------------------------------------------------------
CDXLNode *
CParseHandlerPlan::CreateDXLNode()
{
	return m_dxl_node;
}

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerPlan::GetParseHandlerType
//
//	@doc:
//		Parse handler type
//
//---------------------------------------------------------------------------
EDxlParseHandlerType
CParseHandlerPlan::GetParseHandlerType() const
{
	return EdxlphPlan;
}

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerPlan::StartElement
//
//	@doc:
//		Invoked by Xerces to process an opening tag
//
//---------------------------------------------------------------------------
void
CParseHandlerPlan::StartElement
	(
	const XMLCh* const element_uri,
	const XMLCh* const element_local_name,
	const XMLCh* const element_qname,
	const Attributes &attrs
	)
{
	if (0 == XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenDirectDispatchInfo), element_local_name))
	{
		GPOS_ASSERT(0 < this->Length());
		CParseHandlerBase *direct_dispatch_parse_handler = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenDirectDispatchInfo), m_parse_handler_mgr, this);
		m_parse_handler_mgr->ActivateParseHandler(direct_dispatch_parse_handler);

		// store parse handler
		this->Append(direct_dispatch_parse_handler);
		direct_dispatch_parse_handler->startElement(element_uri, element_local_name, element_qname, attrs);
		return;
	}

	if (0 != XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenPlan), element_local_name))
	{
		CWStringDynamic *str = CDXLUtils::CreateDynamicStringFromXMLChArray(m_parse_handler_mgr->GetDXLMemoryManager(), element_local_name);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, str->GetBuffer());
	}

	// parse plan id
	const XMLCh *xml_str_plan_id = CDXLOperatorFactory::ExtractAttrValue(attrs, EdxltokenPlanId, EdxltokenPlan);
	m_plan_id = CDXLOperatorFactory::ConvertAttrValueToUllong(m_parse_handler_mgr->GetDXLMemoryManager(), xml_str_plan_id, EdxltokenPlanId, EdxltokenPlan);

	// parse plan space size
	const XMLCh *xmlszPlanSpaceSize = CDXLOperatorFactory::ExtractAttrValue(attrs, EdxltokenPlanSpaceSize, EdxltokenPlan);
	m_plan_space_size = CDXLOperatorFactory::ConvertAttrValueToUllong(m_parse_handler_mgr->GetDXLMemoryManager(), xmlszPlanSpaceSize, EdxltokenPlanSpaceSize, EdxltokenPlan);

	// create a parse handler for physical nodes and activate it
	GPOS_ASSERT(NULL != m_mp);
	CParseHandlerBase *base_parse_handler = CParseHandlerFactory::GetParseHandler(m_mp, CDXLTokens::XmlstrToken(EdxltokenPhysical), m_parse_handler_mgr, this);
	m_parse_handler_mgr->ActivateParseHandler(base_parse_handler);

	// store parse handler
	this->Append(base_parse_handler);
}

//---------------------------------------------------------------------------
//	@function:
//		CParseHandlerPlan::EndElement
//
//	@doc:
//		Invoked by Xerces to process a closing tag
//
//---------------------------------------------------------------------------
void
CParseHandlerPlan::EndElement
	(
	const XMLCh* const, // element_uri,
	const XMLCh* const element_local_name,
	const XMLCh* const // element_qname
	)
{
	if(0 != XMLString::compareString(CDXLTokens::XmlstrToken(EdxltokenPlan), element_local_name))
	{
		CWStringDynamic *str = CDXLUtils::CreateDynamicStringFromXMLChArray(m_parse_handler_mgr->GetDXLMemoryManager(), element_local_name);
		GPOS_RAISE(gpdxl::ExmaDXL, gpdxl::ExmiDXLUnexpectedTag, str->GetBuffer());
	}

	CParseHandlerPhysicalOp *operator_parse_handler = dynamic_cast<CParseHandlerPhysicalOp *>((*this)[0]);

	GPOS_ASSERT(NULL != operator_parse_handler->CreateDXLNode());

	// store constructed child
	m_dxl_node = operator_parse_handler->CreateDXLNode();
	m_dxl_node->AddRef();

	if (2 == this->Length())
	{
		CParseHandlerDirectDispatchInfo *direct_dispatch_info_parse_handler = dynamic_cast<CParseHandlerDirectDispatchInfo *>((*this)[1]);
		CDXLDirectDispatchInfo *dxl_direct_dispatch_info = direct_dispatch_info_parse_handler->GetDXLDirectDispatchInfo();
		GPOS_ASSERT(NULL != dxl_direct_dispatch_info);

		dxl_direct_dispatch_info->AddRef();
		m_dxl_node->SetDirectDispatchInfo(dxl_direct_dispatch_info);
	}
	// deactivate handler

	m_parse_handler_mgr->DeactivateHandler();
}

// EOF


text:
from __future__ import print_function
import time, sys, signal, atexit
from upm import pyupm_hcsr04 as hcsr04

def main():
    # Instantiate a HCSR04 Distance sensor on digital pins 2 and 4
    hcsr04_sensor = hcsr04.HCSR04(2, 4);

    ## Exit handlers ##
    # This function stops python from printing a stacktrace when you hit control-C
    def SIGINTHandler(signum, frame):
        raise SystemExit

    # This function lets you run code on exit
    def exitHandler():
        print("Exiting")
        sys.exit(0)

    # Register exit handlers
    atexit.register(exitHandler)
    signal.signal(signal.SIGINT, SIGINTHandler)

    # Read the value every second and detect the pressure
    while(1):
        print("Distance: {0}".format(hcsr04_sensor.getDistance(hcsr04.HCSR04_CM)))
        time.sleep(1)

if __name__ == '__main__':
    main()


text:
package kafka.api

import java.util.Properties

import kafka.utils.TestUtils
import org.apache.kafka.common.config.SslConfigs
import org.apache.kafka.common.config.internals.BrokerSecurityConfigs
import org.apache.kafka.common.network.Mode
import org.apache.kafka.common.security.auth._
import org.apache.kafka.common.utils.Java
import org.junit.jupiter.api.BeforeEach

object SslEndToEndAuthorizationTest {
  class TestPrincipalBuilder extends KafkaPrincipalBuilder {
    private val Pattern = "O=A (.*?),CN=(.*?)".r

    // Use full DN as client principal to test special characters in principal
    // Use field from DN as server principal to test custom PrincipalBuilder
    override def build(context: AuthenticationContext): KafkaPrincipal = {
      val peerPrincipal = context.asInstanceOf[SslAuthenticationContext].session.getPeerPrincipal.getName
      peerPrincipal match {
        case Pattern(name, _) =>
          val principal = if (name == "server") name else peerPrincipal
          new KafkaPrincipal(KafkaPrincipal.USER_TYPE, principal)
        case _ =>
          KafkaPrincipal.ANONYMOUS
      }
    }
  }
}

class SslEndToEndAuthorizationTest extends EndToEndAuthorizationTest {

  import kafka.api.SslEndToEndAuthorizationTest.TestPrincipalBuilder

  override protected def securityProtocol = SecurityProtocol.SSL
  // Since there are other E2E tests that enable SSL, running this test with TLSv1.3 if supported
  private  val tlsProtocol = if (Java.IS_JAVA11_COMPATIBLE) "TLSv1.3" else "TLSv1.2"

  this.serverConfig.setProperty(BrokerSecurityConfigs.SSL_CLIENT_AUTH_CONFIG, "required")
  this.serverConfig.setProperty(BrokerSecurityConfigs.PRINCIPAL_BUILDER_CLASS_CONFIG, classOf[TestPrincipalBuilder].getName)
  this.serverConfig.setProperty(SslConfigs.SSL_PROTOCOL_CONFIG, tlsProtocol)
  this.serverConfig.setProperty(SslConfigs.SSL_ENABLED_PROTOCOLS_CONFIG, tlsProtocol)
  // Escaped characters in DN attribute values: from http://www.ietf.org/rfc/rfc2253.txt
  // - a space or "#" character occurring at the beginning of the string
  // - a space character occurring at the end of the string
  // - one of the characters ",", "+", """, "\", "<", ">" or ";"
  //
  // Leading and trailing spaces in Kafka principal dont work with ACLs, but we can workaround by using
  // a PrincipalBuilder that removes/replaces them.
  private val clientCn = """\#A client with special chars in CN : (\, \+ \" \\ \< \> \; ')"""
  override val clientPrincipal = new KafkaPrincipal(KafkaPrincipal.USER_TYPE, s"O=A client,CN=$clientCn")
  override val kafkaPrincipal = new KafkaPrincipal(KafkaPrincipal.USER_TYPE, "server")
  @BeforeEach
  override def setUp(): Unit = {
    startSasl(jaasSections(List.empty, None, ZkSasl))
    super.setUp()
  }

  override def clientSecurityProps(certAlias: String): Properties = {
    val props = TestUtils.securityConfigs(Mode.CLIENT, securityProtocol, trustStoreFile,
      certAlias, clientCn, clientSaslProperties, tlsProtocol)
    props.remove(SslConfigs.SSL_ENDPOINT_IDENTIFICATION_ALGORITHM_CONFIG)
    props
  }
}


text:
require "test/unit"

$:.unshift File.expand_path(File.dirname(__FILE__) + "/../lib")


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>org.diirt</groupId>
        <artifactId>diirt-all</artifactId>
        <version>3.0.1-SNAPSHOT</version>
    </parent>
    <groupId>org.diirt.javafx</groupId>
    <artifactId>javafx-all</artifactId>
    <name>javafx</name>
    <description>Sub-project for all ui elements based on Java FX.</description>
    <packaging>pom</packaging>
    <modules>
        <module>tools</module>
        <module>javafx</module>
    </modules>
</project>


text:
package com.google.gxp.compiler.parser;

import com.google.gxp.compiler.alerts.AlertSink;
import com.google.gxp.compiler.alerts.SourcePosition;

import java.util.List;

/**
 * The http://google.com/2001/gxp/nomsg (aka "nomsg:") namespace. Can only
 * be used for attributes, not elements.
 */
public class NoMsgNamespace implements Namespace {
  private NoMsgNamespace(){}

  public String getUri() {
    return "http://google.com/2001/gxp/nomsg";
  }

  public static final Namespace INSTANCE = new NoMsgNamespace();

  public ParsedElement createElement(AlertSink alertSink,
                                     SourcePosition sourcePosition,
                                     String displayName,
                                     String tagName,
                                     List<ParsedAttribute> attrs,
                                     List<ParsedElement> children) {
    alertSink.add(new UnknownElementError(sourcePosition, this, displayName));
    return null;
  }

  public <T> T acceptVisitor(NamespaceVisitor<T> visitor) {
    return visitor.visitNoMsgNamespace(this);
  }
}


text:
/**
 * Thrown when a key exchange exception occurs within the Message Security
 * Layer.
 *
 * @author Wesley Miaw <wmiaw@netflix.com>
 */
var MslKeyExchangeException = MslException.extend({
    /**
     * Construct a new MSL key exchange exception with the specified error,
     * details, and cause.
     *
     * @param {MslError} error the error.
     * @param {string} details the details text. May be null or undefined.
     * @param {Error} cause the cause. May be null or undefined.
     * @constructor
     */
    init: function init(error, details, cause) {
        init.base.call(this, error, details, cause);

        // The properties.
        var props = {
            name: { value: "MslKeyExchangeException", writable: false, configurable: true }
        };
        Object.defineProperties(this, props);
    },
});


text:
package com.malmstein.yahnac.base;

import android.os.StrictMode;

/**
 * Enables StrictMode with defaults to detect all wrong doing.
 * <p/>
 * See http://developer.android.com/reference/android/os/StrictMode.html for more
 */
public final class StrictModeManager {

    private StrictModeManager() {
        throw new IllegalStateException("This class should not be instantiated");
    }

    /**
     * Initializes StrictMode to close activity and log to console when a violation occurs.
     */
    public static void initializeStrictMode() {
        initializeStrictMode(newVmPolicyBuilderWithDefaults(), newThreadPolicyBuilderWithDefaults());
    }

    public static void initializeStrictMode(StrictMode.VmPolicy.Builder vmPolicyBuilder, StrictMode.ThreadPolicy.Builder threadPolicyBuilder) {
        StrictMode.setThreadPolicy(threadPolicyBuilder.penaltyDeath().build());
        StrictMode.setVmPolicy(vmPolicyBuilder.penaltyDeath().build());
    }

    /**
     * Initializes StrictMode to log to console when a violation occurs.
     */
    public static void initializeStrictModeLogOnly() {
        initializeStrictModeLogOnly(newVmPolicyBuilderWithDefaults(), newThreadPolicyBuilderWithDefaults());
    }

    public static void initializeStrictModeLogOnly(StrictMode.VmPolicy.Builder vmPolicyBuilder, StrictMode.ThreadPolicy.Builder threadPolicyBuilder) {
        StrictMode.setThreadPolicy(threadPolicyBuilder.build());
        StrictMode.setVmPolicy(vmPolicyBuilder.build());
    }

    public static StrictMode.VmPolicy.Builder newVmPolicyBuilderWithDefaults() {
        return new StrictMode.VmPolicy.Builder().detectAll().penaltyLog();
    }

    public static StrictMode.ThreadPolicy.Builder newThreadPolicyBuilderWithDefaults() {
        return new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog();
    }

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Annls mycol. 11(5): 427 (1913)

#### Original name
Polystictus bivalvis Pers.

### Remarks
null


text:
using System;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Web;

using DotNetNuke.Services.Upgrade;
using System.Collections.Generic;

#endregion

namespace DotNetNuke.Common.Utilities
{
    /// -----------------------------------------------------------------------------
    /// Namespace:  DotNetNuke.Common.Utilities
    /// Project:    DotNetNuke
    /// Class:      HtmlUtils
    /// -----------------------------------------------------------------------------
    ///
    /// HtmlUtils is a Utility class that provides Html Utility methods
    ///
    /// <remarks>
    /// </remarks>
    /// -----------------------------------------------------------------------------
    public class HtmlUtils
    {
        private static readonly Regex HtmlDetectionRegex = new Regex("<(.*\\s*)>", RegexOptions.Compiled);
        private static readonly Regex StripWhiteSpaceRegex = new Regex("\\s+", RegexOptions.Compiled);
        private static readonly Regex StripNonWordRegex = new Regex("\\W*", RegexOptions.Compiled);
        private static readonly Regex StripTagsRegex = new Regex("<[^<>]*>", RegexOptions.Compiled);
        private static readonly Regex RemoveInlineStylesRegEx = new Regex("", RegexOptions.Compiled | RegexOptions.Multiline);

        //Match all variants of
 tag (
,
,
, including embedded space
        private static readonly Regex ReplaceHtmlNewLinesRegex = new Regex("\\s*<\\s*[bB][rR]\\s*/\\s*>\\s*", RegexOptions.Compiled);

        //Create Regular Expression objects
        private const string PunctuationMatch = "[~!#\\$%\\^&*\\(\\)-+=\\{\\[\\}\\]\\|;:\\x22'<,>\\.\\?\\\\\\t\\r\\v\\f\\n]";
        private static readonly Regex AfterRegEx = new Regex(PunctuationMatch + "\\s", RegexOptions.Compiled);
        private static readonly Regex BeforeRegEx = new Regex("\\s" + PunctuationMatch, RegexOptions.Compiled);
        private static readonly Regex EntityRegEx = new Regex("&[^;]+;", RegexOptions.Compiled);

        /// -----------------------------------------------------------------------------
        ///
        /// Clean removes any HTML Tags, Entities (and optionally any punctuation) from
        /// a string
        ///
        /// <remarks>
        /// Encoded Tags are getting decoded, as they are part of the content!
        /// </remarks>
        /// <param name="HTML">The Html to clean</param>
        /// <param name="RemovePunctuation">A flag indicating whether to remove punctuation</param>
        /// <returns>The cleaned up string</returns>
        /// -----------------------------------------------------------------------------
        public static string Clean(string HTML, bool RemovePunctuation)
        {
            if (string.IsNullOrWhiteSpace(HTML))
            {
                return string.Empty;
            }

            if (HTML.Contains("<"))
            {
                // Fix when it is a double-encoded document
                HTML = HttpUtility.HtmlDecode(HTML);
            }

            //First remove any HTML Tags ("<....>")
            HTML = StripTags(HTML, true);

            //Second replace any HTML entities (  < etc) through their char symbol
            HTML = HttpUtility.HtmlDecode(HTML);

            //Thirdly remove any punctuation
            if (RemovePunctuation)
            {
                HTML = StripPunctuation(HTML, true);
                // When RemovePunctuation is false, HtmlDecode() would have already had removed these
                //Finally remove extra whitespace
                HTML = StripWhiteSpace(HTML, true);
            }

            return HTML;
        }

        /// -----------------------------------------------------------------------------
        ///
        ///   CleanWithTagInfo removes unspecified HTML Tags, Entities (and optionally any punctuation) from a string.
        ///
        /// <param name = "html"></param>
        /// <param name="tagsFilter"></param>
        /// <param name = "removePunctuation"></param>
        /// <returns>The cleaned up string</returns>
        /// <remarks>
        /// </remarks>
        /// -----------------------------------------------------------------------------
        public static string CleanWithTagInfo(string html, string tagsFilter, bool removePunctuation)
        {
            if (string.IsNullOrWhiteSpace(html))
            {
                return string.Empty;
            }

            //First remove unspecified HTML Tags ("<....>")
            html = StripUnspecifiedTags(html, tagsFilter, true);

            //Second replace any HTML entities (  < etc) through their char symbol
            html = HttpUtility.HtmlDecode(html);

            //Thirdly remove any punctuation
            if (removePunctuation)
            {
                html = StripPunctuation(html, true);
            }

            //Finally remove extra whitespace
            html = StripWhiteSpace(html, true);

            return html;
        }

        /// -----------------------------------------------------------------------------
        ///
        /// Formats an Email address
        ///
        /// <param name="Email">The email address to format</param>
        /// <returns>The formatted email address</returns>
        /// -----------------------------------------------------------------------------
        public static string FormatEmail(string Email)
        {
            return FormatEmail(Email, true);
        }

        /// -----------------------------------------------------------------------------
        ///
        /// Formats an Email address
        ///
        /// <param name="Email">The email address to format</param>
        /// <param name="cloak">A flag that indicates whether the text should be cloaked</param>
        /// <returns>The formatted email address</returns>
        /// -----------------------------------------------------------------------------
        public static string FormatEmail(string Email, bool cloak)
        {
            string formatEmail = "";
            if (!string.IsNullOrEmpty(Email) && !string.IsNullOrEmpty(Email.Trim()))
            {
                if (Email.IndexOf("@", StringComparison.Ordinal) != -1)
                {
                    formatEmail = string.Format("{0}", Email);
                }
                else
                {
                    formatEmail = Email;
                }
            }
            if (cloak)
            {
                formatEmail = Globals.CloakText(formatEmail);
            }
            return formatEmail;
        }

        /// -----------------------------------------------------------------------------
        ///
        /// FormatText replaces
 tags by LineFeed characters
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="HTML">The HTML content to clean up</param>
        /// <param name="RetainSpace">Whether ratain Space</param>
        /// <returns>The cleaned up string</returns>
        /// -----------------------------------------------------------------------------
        public static string FormatText(string HTML, bool RetainSpace)
        {
            return ReplaceHtmlNewLinesRegex.Replace(HTML, Environment.NewLine);
        }

        /// -----------------------------------------------------------------------------
        ///
        ///   Formats String as Html by replacing linefeeds by

        ///
        /// <remarks>
        /// </remarks>
        /// <param name = "strText">Text to format</param>
        /// <returns>The formatted html</returns>
        /// -----------------------------------------------------------------------------
        public static string ConvertToHtml(string strText)
        {

            if (!string.IsNullOrEmpty(strText))
            {
                var htmlBuilder = new StringBuilder(strText);
                htmlBuilder.Replace("\r\n", "
");
                htmlBuilder.Replace("\n", "
");
                htmlBuilder.Replace("\r", "
");
                return htmlBuilder.ToString();
            }

            return strText;
        }

        /// -----------------------------------------------------------------------------
        ///
        ///   Formats Html as text by removing
 tags and replacing by linefeeds
        ///
        /// <remarks>
        /// </remarks>
        /// <param name = "strHtml">Html to format</param>
        /// <returns>The formatted text</returns>
        /// -----------------------------------------------------------------------------
        public static string ConvertToText(string strHtml)
        {
            string strText = strHtml;

            if (!string.IsNullOrEmpty(strText))
            {
                //First remove white space (html does not render white space anyway and it screws up the conversion to text)
                //Replace it by a single space
                strText = StripWhiteSpace(strText, true);

                //Replace all variants of
 by Linefeeds
                strText = FormatText(strText, false);
            }

            return strText;
        }

        /// -----------------------------------------------------------------------------
        ///
        /// Format a domain name including link
        ///
        /// <param name="Website">The domain name to format</param>
        /// <returns>The formatted domain name</returns>
        /// -----------------------------------------------------------------------------
        public static string FormatWebsite(object Website)
        {
            string formatWebsite = "";
            if (Website != DBNull.Value)
            {
                if (!String.IsNullOrEmpty(Website.ToString().Trim()))
                {
                    if (Website.ToString().IndexOf(".", StringComparison.Ordinal) > -1)
                    {
                        formatWebsite = string.Format("{0}", Website,
                            (Website.ToString().IndexOf("://", StringComparison.Ordinal) > -1 ? "" : "http://"));
                    }
                    else
                    {
                        formatWebsite = Website.ToString();
                    }
                }
            }
            return formatWebsite;
        }

        /// -----------------------------------------------------------------------------
        ///
        /// Shorten returns the first (x) characters of a string
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="txt">The text to reduces</param>
        /// <param name="length">The max number of characters to return</param>
        /// <param name="suffix">An optional suffic to append to the shortened string</param>
        /// <returns>The shortened string</returns>
        /// -----------------------------------------------------------------------------
        public static string Shorten(string txt, int length, string suffix)
        {
            if (!string.IsNullOrEmpty(txt) && txt.Length > length)
            {
                txt = txt.Substring(0, length) + suffix;
            }

            return txt;
        }

        /// -----------------------------------------------------------------------------
        ///
        /// StripEntities removes the HTML Entities from the content
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="HTML">The HTML content to clean up</param>
        /// <param name="RetainSpace">Indicates whether to replace the Entity by a space (true) or nothing (false)</param>
        /// <returns>The cleaned up string</returns>
        /// -----------------------------------------------------------------------------
        [Obsolete("This method has been deprecated. Please use System.Web.HtmlUtility.HtmlDecode")]
        public static string StripEntities(string HTML, bool RetainSpace)
        {
            var repString = RetainSpace ? " " : "";
            //Replace Entities by replacement String and return mofified string
            return EntityRegEx.Replace(HTML, repString);
        }

        /// -----------------------------------------------------------------------------
        ///
        /// Checks whether the string contains any HTML Entity or not
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="html">The HTML content to clean up</param>
        /// <returns>True if the string contains any entity</returns>
        /// -----------------------------------------------------------------------------
        public static bool ContainsEntity(string html)
        {
            return !string.IsNullOrEmpty(html) && EntityRegEx.IsMatch(html);
        }

        ///
        /// Removes Inline CSS Styles
        ///
        /// <param name="HTML">The HTML content to clean up</param>
        /// <returns>The cleaned up string</returns>
        public static string RemoveInlineStyle(string HTML)
        {
            return RemoveInlineStylesRegEx.Replace(HTML, "");

        }
        /// -----------------------------------------------------------------------------
        ///
        /// StripTags removes the HTML Tags from the content
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="HTML">The HTML content to clean up</param>
        /// <param name="RetainSpace">Indicates whether to replace the Tag by a space (true) or nothing (false)</param>
        /// <returns>The cleaned up string</returns>
        /// -----------------------------------------------------------------------------
        public static string StripTags(string HTML, bool RetainSpace)
        {
            return StripTagsRegex.Replace(HTML, RetainSpace ? " " : "");
        }

        /// -----------------------------------------------------------------------------
        ///
        ///   StripUnspecifiedTags removes the HTML tags from the content -- leaving behind the info
        ///   for the specified HTML tags.
        ///
        /// <param name = "html"></param>
        /// <param name="specifiedTags"></param>
        /// <param name = "retainSpace"></param>
        /// <returns>The cleaned up string</returns>
        /// <remarks>
        /// </remarks>
        /// -----------------------------------------------------------------------------
        public static string StripUnspecifiedTags(string html, string specifiedTags, bool retainSpace)
        {
            if (string.IsNullOrWhiteSpace(html))
            {
                return string.Empty;
            }

            var result = new StringBuilder();

            //Set up Replacement String
            var repString = retainSpace ? " " : "";

            //Stripped HTML
            result.Append(StripTagsRegex.Replace(html, repString));

            //Adding Tag info from specified tags
            foreach (Match m in Regex.Matches(html, "(?<=(" + specifiedTags + ")=)\"(?.*?)\""))
            {
                if (m.Value.Length > 0)
                {
                    result.Append(" " + m.Value);
                }
            }

            return result.ToString();
        }

        /// -----------------------------------------------------------------------------
        ///
        /// StripPunctuation removes the Punctuation from the content
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="HTML">The HTML content to clean up</param>
        /// <param name="RetainSpace">Indicates whether to replace the Punctuation by a space (true) or nothing (false)</param>
        /// <returns>The cleaned up string</returns>
        /// -----------------------------------------------------------------------------
        public static string StripPunctuation(string HTML, bool RetainSpace)
        {
            if (string.IsNullOrWhiteSpace(HTML))
            {
                return string.Empty;
            }

            //Define return string
            string retHTML = HTML + " "; //Make sure any punctuation at the end of the String is removed

            //Set up Replacement String
            var repString = RetainSpace ? " " : "";
            while (BeforeRegEx.IsMatch(retHTML))
            {
                retHTML = BeforeRegEx.Replace(retHTML, repString);
            }
            while (AfterRegEx.IsMatch(retHTML))
            {
                retHTML = AfterRegEx.Replace(retHTML, repString);
            }
            // Return modified string after trimming leading and ending quotation marks
            return retHTML.Trim('"');
        }

        /// -----------------------------------------------------------------------------
        ///
        /// StripWhiteSpace removes the WhiteSpace from the content
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="HTML">The HTML content to clean up</param>
        /// <param name="RetainSpace">Indicates whether to replace the WhiteSpace by a space (true) or nothing (false)</param>
        /// <returns>The cleaned up string</returns>
        /// -----------------------------------------------------------------------------
        public static string StripWhiteSpace(string HTML, bool RetainSpace)
        {
            if (string.IsNullOrWhiteSpace(HTML))
                return Null.NullString;

            return StripWhiteSpaceRegex.Replace(HTML, RetainSpace ? " " : "");
        }

        /// -----------------------------------------------------------------------------
        ///
        /// StripNonWord removes any Non-Word Character from the content
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="HTML">The HTML content to clean up</param>
        /// <param name="RetainSpace">Indicates whether to replace the Non-Word Character by a space (true) or nothing (false)</param>
        /// <returns>The cleaned up string</returns>
        /// -----------------------------------------------------------------------------
        public static string StripNonWord(string HTML, bool RetainSpace)
        {
            if (string.IsNullOrWhiteSpace(HTML))
                return HTML;

            string RepString = RetainSpace ? " " : "";
            return StripNonWordRegex.Replace(HTML, RepString);
        }

        ///
        ///   Determines wether or not the passed in string contains any HTML tags
        ///
        /// <param name = "text">Text to be inspected</param>
        /// <returns>True for HTML and False for plain text</returns>
        /// <remarks>
        /// </remarks>
        public static bool IsHtml(string text)
        {
            if (string.IsNullOrEmpty(text))
            {
                return false;
            }

            return HtmlDetectionRegex.IsMatch(text);
        }

        /// -----------------------------------------------------------------------------
        ///
        /// WriteError outputs an Error Message during Install/Upgrade etc
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="response">The ASP.Net Response object</param>
        /// <param name="file">The filename where the Error Occurred</param>
        /// <param name="message">The error message</param>
        /// -----------------------------------------------------------------------------
        public static void WriteError(HttpResponse response, string file, string message)
        {
            response.Write("
Error Details
");
            response.Write("
");
            response.Write("
File	" + file + "
");
            response.Write("
Error  	" + message + "
");
            response.Write("
");
            response.Write("

");
            response.Flush();
        }

        /// -----------------------------------------------------------------------------
        ///
        /// WriteFeedback outputs a Feedback Line during Install/Upgrade etc
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="response">The ASP.Net Response object</param>
        /// <param name="indent">The indent for this feedback message</param>
        /// <param name="message">The feedback message</param>
        /// -----------------------------------------------------------------------------
        public static void WriteFeedback(HttpResponse response, Int32 indent, string message)
        {
            WriteFeedback(response, indent, message, true);
        }

        /// -----------------------------------------------------------------------------
        ///
        /// WriteFeedback outputs a Feedback Line during Install/Upgrade etc
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="response">The ASP.Net Response object</param>
        /// <param name="indent">The indent for this feedback message</param>
        /// <param name="message">The feedback message</param>
        /// <param name="showtime">Show the timespan before the message</param>
        /// -----------------------------------------------------------------------------
        public static void WriteFeedback(HttpResponse response, Int32 indent, string message, bool showtime)
        {
            try
            {
                bool showInstallationMessages;
                string configSetting = Config.GetSetting("ShowInstallationMessages") ?? "true";
                if (bool.TryParse(configSetting, out showInstallationMessages) && showInstallationMessages)
                {
                    //Get the time of the feedback
                    TimeSpan timeElapsed = Upgrade.RunTime;
                    string strMessage = "";
                    if (showtime)
                    {
                        strMessage += timeElapsed.ToString().Substring(0, timeElapsed.ToString().LastIndexOf(".", StringComparison.Ordinal) + 4) + " -";
                    }
                    for (int i = 0; i <= indent; i++)
                    {
                        strMessage += " ";
                    }
                    strMessage += message;
                    response.Write(strMessage);
                    response.Flush();
                }
            }
            catch (HttpException ex)
            {
                // Swallowing this for when requests have timed out. Log in case a listener is implemented
                System.Diagnostics.Trace.TraceError(ex.ToString());
            }
        }

        ///
        /// This method adds an empty char to the response stream to avoid closing http connection on long running tasks
        ///
        public static void WriteKeepAlive()
        {
            if (HttpContext.Current != null)
            {
                if (HttpContext.Current.Request.RawUrl.ToLowerInvariant().Contains("install.aspx?"))
                {
                    var response = HttpContext.Current.Response;
                    response.Write(" ");
                    response.Flush();
                }

            }
        }

        /// -----------------------------------------------------------------------------
        ///
        /// WriteFooter outputs the Footer during Install/Upgrade etc
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="response">The ASP.Net Response object</param>
        /// -----------------------------------------------------------------------------
        public static void WriteFooter(HttpResponse response)
        {
            response.Write("");
            response.Write("");
            response.Flush();
        }

        /// -----------------------------------------------------------------------------
        ///
        /// WriteHeader outputs the Header during Install/Upgrade etc
        ///
        /// <remarks>
        /// </remarks>
        /// <param name="response">The ASP.Net Response object</param>
        /// <param name="mode">The mode Install/Upgrade etc</param>
        /// -----------------------------------------------------------------------------
        public static void WriteHeader(HttpResponse response, string mode)
        {
            //Set Response buffer to False
            response.Buffer = false;

            //create an install page if it does not exist already
            if (!File.Exists(HttpContext.Current.Server.MapPath("~/Install/Install.htm")))
            {
                if (File.Exists(HttpContext.Current.Server.MapPath("~/Install/Install.template.htm")))
                {
                    File.Copy(HttpContext.Current.Server.MapPath("~/Install/Install.template.htm"), HttpContext.Current.Server.MapPath("~/Install/Install.htm"));
                }
            }
            //read install page and insert into response stream
            if (File.Exists(HttpContext.Current.Server.MapPath("~/Install/Install.htm")))
            {
                response.Write(FileSystemUtils.ReadFile(HttpContext.Current.Server.MapPath("~/Install/Install.htm")));
            }
            switch (mode)
            {
                case "install":
                    response.Write("
Installing DNN
");
                    break;
                case "upgrade":
                    response.Write("
Upgrading DNN
");
                    break;
                case "addPortal":
                    response.Write("
Adding New Portal
");
                    break;
                case "installResources":
                    response.Write("
Installing Resources
");
                    break;
                case "executeScripts":
                    response.Write("
Executing Scripts
");
                    break;
                case "none":
                    response.Write("
Nothing To Install At This Time
");
                    break;
                case "noDBVersion":
                    response.Write("
New DNN Database
");
                    break;
                case "error":
                    response.Write("
Error Installing DNN
");
                    break;
                default:
                    response.Write("
" + mode + "
");
                    break;
            }
            response.Flush();
        }

        public static void WriteSuccessError(HttpResponse response, bool bSuccess)
        {
            WriteFeedback(response, 0, bSuccess ? "Success
" : "Error!
", false);
        }

        public static void WriteScriptSuccessError(HttpResponse response, bool bSuccess, string strLogFile)
        {
            if (bSuccess)
            {
                WriteFeedback(response, 0, "Success
", false);
            }
            else
            {
                WriteFeedback(response, 0, "Error! (see " + strLogFile + " for more information)
", false);
            }
        }

        ///
        /// Searches the provided html for absolute hrefs that match the provided aliases and converts them to relative urls
        ///
        /// <param name="html">The input html</param>
        /// <param name="aliases">a list of aliases that should be made into relative urls</param>
        /// <returns>html string</returns>
        public static string AbsoluteToRelativeUrls(string html, IEnumerable<string> aliases)
        {
            if (string.IsNullOrWhiteSpace(html))
            {
                return string.Empty;
            }

            foreach (string portalAlias in aliases)
            {
                string searchAlias = portalAlias;
                if (!portalAlias.EndsWith("/"))
                {
                    searchAlias = string.Format("{0}/", portalAlias);
                }

                var exp = new Regex("((?:href|src)=")https?://" + searchAlias + "(.*?")", RegexOptions.IgnoreCase);

                if (portalAlias.Contains("/"))
                {
                    html = exp.Replace(html, "$1" + portalAlias.Substring(portalAlias.IndexOf("/", StringComparison.InvariantCultureIgnoreCase)) + "/$2");
                }
                else
                {
                    html = exp.Replace(html, "$1/$2");
                }
            }

            return html;
        }

    }
}


text:
@interface NSDate(Addition)

+ (NSString *)getFormatTime:(NSDate *)date format:(NSString *)format;
+ (NSString *)getFormatTime:(NSDate *)date;
+ (NSString *)getFormatTime2:(NSString *)time;
+ (NSDate *)convertTime:(NSString *)time;
+ (NSDate *)convertTime:(NSString *)time format:(NSString *)format;
+ (NSDate *)convertTimeFromNumber:(NSNumber *)time;
// 矫正时区问题
+ (NSDate *)convertTimeFromNumber2:(NSNumber *)time;
+ (NSString *)convertToDay:(NSDate *)date;
+ (NSNumber *)convertNumberFromTime:(NSDate *)time;
+ (NSString *)getDisplayTime:(NSDate *)date;
+ (NSDateComponents *)getComponenet:(NSDate *)date;

@end


text:
echo off
echo -------------------------------------------------------------------------
echo deploying client repository ....
echo -------------------------------------------------------------------------

rem if your client repository is different, change the value.
set CLIENT_REPO=%WSFCPP_HOME%\client_repo

echo Start creating a client repository at %CLIENT_REPO%

if exist  "%CLIENT_REPO%" (
    echo %CLIENT_REPO% exists.
) else (
    echo Creating a new directory for client repo
    mkdir "%CLIENT_REPO%"
)

@echo Copying axis2.xml to client_repo
copy /Y "%WSFCPP_HOME%\samples\src\c\rampartc\data\client_axis2.xml" "%CLIENT_REPO%\axis2.xml"

call deploy.bat
echo off

@echo Copying libraries to client_repo
xcopy /S/I/Q/Y "%WSFCPP_HOME%\lib" "%CLIENT_REPO%\lib"

@echo Copying latest modules to client_repo
xcopy /S/I/Q/Y "%WSFCPP_HOME%\modules" "%CLIENT_REPO%\modules"

echo -------------------------------------------------------------------------
echo Client repository deployed to %CLIENT_REPO%
echo -------------------------------------------------------------------------
echo on


text:
'use strict';

exports.__esModule = true;
exports.copyValue = exports.copyCollection = exports.copy = void 0;

var _polyfill = require('./polyfill');

var toString = Object.prototype.toString;

function copy(target, customizer) {
  var resultValue = copyValue(target);

  if (resultValue !== null) {
    return resultValue;
  }

  return copyCollection(target, customizer);
}

function copyCollection(target, customizer) {
  if (typeof customizer !== 'function') {
    throw new TypeError('customizer is must be a Function');
  }

  if (typeof target === 'function') {
    var source = String(target);

    // NOTE:
    //
    //   https://gist.github.com/jdalton/5e34d890105aca44399f
    //
    //   - https://gist.github.com/jdalton/5e34d890105aca44399f#gistcomment-1283831
    //   - http://es5.github.io/#x15
    //
    //   native functions does not have prototype:
    //
    //       Object.toString.prototype  // => undefined
    //       (function() {}).prototype  // => {}
    //
    //   but cannot detect native constructor:
    //
    //       typeof Object     // => 'function'
    //       Object.prototype  // => {}
    //
    //   and cannot detect null binded function:
    //
    //       String(Math.abs)
    //         // => 'function abs() { [native code] }'
    //
    //     Firefox, Safari:
    //       String((function abs() {}).bind(null))
    //         // => 'function abs() { [native code] }'
    //
    //     Chrome:
    //       String((function abs() {}).bind(null))
    //         // => 'function () { [native code] }'
    if (/^\s*function\s*\S*\([^\)]*\)\s*{\s*\[native code\]\s*}/.test(source)) {
      // native function
      return target;
    } else {
      // user defined function
      return new Function('return ' + String(source))();
    }
  }

  var targetClass = toString.call(target);

  if (targetClass === '[object Array]') {
    return [];
  }

  if (targetClass === '[object Object]' && target.constructor === Object) {
    return {};
  }

  if (targetClass === '[object Date]') {
    // NOTE:
    //
    //   Firefox need to convert
    //
    //   Firefox:
    //     var date = new Date;
    //     +date;            // 1420909365967
    //     +new Date(date);  // 1420909365000
    //     +new Date(+date); // 1420909365967
    //
    //   Chrome:
    //     var date = new Date;
    //     +date;            // 1420909757913
    //     +new Date(date);  // 1420909757913
    //     +new Date(+date); // 1420909757913
    return new Date(target.getTime());
  }

  if (targetClass === '[object RegExp]') {
    // NOTE:
    //
    //   Chrome, Safari:
    //     (new RegExp).source => "(?:)"
    //
    //   Firefox:
    //     (new RegExp).source => ""
    //
    //   Chrome, Safari, Firefox:
    //     String(new RegExp) => "/(?:)/"
    var regexpText = String(target),
        slashIndex = regexpText.lastIndexOf('/');

    return new RegExp(regexpText.slice(1, slashIndex), regexpText.slice(slashIndex + 1));
  }

  if ((0, _polyfill.isBuffer)(target)) {
    var buffer = new Buffer(target.length);

    target.copy(buffer);

    return buffer;
  }

  var customizerResult = customizer(target);

  if (customizerResult !== void 0) {
    return customizerResult;
  }

  return null;
}

function copyValue(target) {
  var targetType = typeof target;

  // copy String, Number, Boolean, undefined and Symbol
  // without null and Function
  if (target !== null && targetType !== 'object' && targetType !== 'function') {
    return target;
  }

  return null;
}

exports.copy = copy;
exports.copyCollection = copyCollection;
exports.copyValue = copyValue;


text:
Title: Oakland Wiki: This Messy Thing Called Governance
Date: 2013-10-22 15:00
Tags: Oakland Wiki
Slug: cpetrozzo-assign4
Category: assign4
Author: Christine Petrozzo

After immersing myself in the community for the last two months, I cannot figure out if the organization is governed
by a benevolent dictatorship or if its by consensus. However, I asked about a conflict last last week, and what I've figured
out thus far based on my conversations with the other volunteers within the Oakland Wiki Google group is: Oakland Wiki comes
to a consensus either within the Google group, or during the group's regular Thursday meetings in downtown Oakland. With
this being said, the group could be considered a benevolent dictatorship because these in-person meetings eliminate other
people who are contributing to the project remotely.

I've emailed the group, based on my last posting, this question:

"Thanks, Julio! I understand where you coming from, for sure.

However, you bring up the issue of discussing at a Thursday in-person meeting. Is this the typical form of governance?
Do issues get decided upon based off these meetings? Or, is there another governance model so everyone who cannot attend
still has the ability to voice an opinion? Or, is the discussion on the Google group where things often are decided?
Just curious, in case I cannot make it on Thursdays."

I have not received a response yet, but from what I understand, a woman named Marina Kukso, managing director, is one of the
those who are heading the group because she is involved with LocalWiki, the grass roots organization working to collect,
share and open the world's local knowledge. LocalWiki provides the platform for each city or town's local wiki.

I do not think this is the best form of governance, though I think there's a good basis. I think it should involve people
based within the local community. However, it seems as though the people contributing to the project cannot be heard unless
they join the Google group or attend the meetings. I think a poll page should be implemented based on issues so other people
working remotely can include their votes on proposed issues. Otherwise, it feels very messy and not streamlined.

Right now, it seems a little out of sorts. And I substantiate this observation with the fact that there's no policy documents
on the site! I think I could propose writing up a page on how governance works within the organization, otherwise, again the
volunteers have to continually ask questions on the Google group or be present at a physical meeting.

added Comments Thomas 11/6/2013 (see commit description)


text:
#ifndef TENSORFLOW_COMPILER_XLA_SERVICE_GPU_GPU_TYPES_H_
#define TENSORFLOW_COMPILER_XLA_SERVICE_GPU_GPU_TYPES_H_

#include <string>
#include <utility>

#include "absl/types/variant.h"
#include "tensorflow/compiler/xla/stream_executor/device_description.h"
#include "tensorflow/compiler/xla/types.h"

namespace xla {
namespace gpu {

// GpuVersion is used to abstract Gpu hardware version.
//
// On Cuda platform, it comprises of se::CudaComputeCapability.
//
// On ROCm platform, it comprises of se::RocmComputeCapability.
using GpuVersion =
    std::variant<se::CudaComputeCapability, se::RocmComputeCapability>;
}  // namespace gpu
}  // namespace xla

#endif  // TENSORFLOW_COMPILER_XLA_SERVICE_GPU_GPU_TYPES_H_


text:
class ExceptionsController < ApplicationController

  # handle NotFound exceptions (404)
  def not_found
    render :format => :html
  end

  # handle NotAcceptable exceptions (406)
  def not_acceptable
    render :format => :html
  end

  def unauthorized
    @message = request.exceptions.first.message
    render :layout => false
  end

end