text:
$(document).ready(function() {
    $("body").removeClass("no-js");

    var theDiv = $("div:first"),
        // Get image URL from inside brackets, e.g. url(http://example.com/image.jpg), even if contained by quotes
        bgSrcRegex = /url\(["|']?(.+?)["|']?\)/,
        theDivBgSrc = theDiv.attr('style').match(bgSrcRegex)[1], // Can't use .css("background") as this gets computed style (none)
        // Get background position info e.g. center center/cover
        bgPosRegex = /url\(.+\)\s(.*?)[;|"]/,
        theDivBgPos = theDiv.attr('style').match(bgPosRegex)[1];
    console.log("background image src " + theDivBgSrc);

    // Regex to get image size suffix
    var sizeSuffixRegex = /_([^_]*)(?=\.jpg|\.jpeg|\.png|\.gif)/;

    var bgs = {
        lowResBgSrc: theDivBgSrc.replace(sizeSuffixRegex, "_XS"),
        highResBgSrc: theDivBgSrc.replace(sizeSuffixRegex, "_XL")
    };

    // In case browser has put quotes around the high res src, remove all quotes
    var removeQuotesRegex = /("|')/g;
    for (bgSrc in bgs) {
        bgs[bgSrc] = bgs[bgSrc].replace(removeQuotesRegex, "");
    }

    // Pre-load low res background image
    var imgS = new Image();
    console.log("new image created " + imgS.src);
    $(imgS).attr("src", bgs.lowResBgSrc);
    console.log("imgS source set " + imgS.src);

    $(imgS).load(function() {
        // Show low res image (whilst waiting for high res to load)
        console.log("imgS loaded");
        theDiv.css("cssText", "background: url(" + bgs.lowResBgSrc + ") " + theDivBgPos + " !important");
        // .css("background", "url(etc) !important") doesn't work, won't override CSS stylesheet !important
        console.log("div css changed");
    });

    // Create MediaQueryListener object
    var mql = window.matchMedia("(-webkit-min-device-pixel-ratio: 1), (min-device-pixel-ratio: 1), (min-resolution: 96dpi), (min-resolution: 1dppx)");
    // Just a starter media query, will need to use ones for different resolutions etc
    console.log(mql);
    if (mql.matches) {
        console.log("Media match success");
        // Pre-load high res image
        var imgL = new Image();
        console.log("new image created " + imgL.src);
        $(imgL).attr("src", bgs.highResBgSrc);
        console.log("imgL source set " + imgL.src);

        // After high res image has pre-loaded, replace original image
        $(imgL).load(function() {
            console.log("imgL loaded");
            theDiv.css("cssText", "background: url(" + bgs.highResBgSrc + ") " + theDivBgPos + " !important");
            // .css("background", "url(etc) !important") won't override CSS stylesheet !important
            console.log("div css changed");
        });
    }
});


text:
    {% if termination.parent_object.provider %}

            {{ termination.parent_object.provider }}
            {{ termination.parent_object }}

    {% else %}
        {{ termination.parent_object|linkify }}
    {% endif %}

    {{ termination|linkify }}

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Config;

use CodeIgniter\Config\BaseConfig;

class Pager extends BaseConfig
{
    /**
     * --------------------------------------------------------------------------
     * Templates
     * --------------------------------------------------------------------------
     *
     * Pagination links are rendered out using views to configure their
     * appearance. This array contains aliases and the view names to
     * use when rendering the links.
     *
     * Within each view, the Pager object will be available as $pager,
     * and the desired group as $pagerGroup;
     *
     * @var array<string, string>
     */
    public $templates = [
        'default_full'   => 'CodeIgniter\Pager\Views\default_full',
        'default_simple' => 'CodeIgniter\Pager\Views\default_simple',
        'default_head'   => 'CodeIgniter\Pager\Views\default_head',
    ];

    /**
     * --------------------------------------------------------------------------
     * Items Per Page
     * --------------------------------------------------------------------------
     *
     * The default number of results shown in a single page.
     *
     * @var int
     */
    public $perPage = 20;
}


text:
// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import 'babel-polyfill'
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import 'common/style/index.styl'
// import fastclick from 'fastclick'
import store from './store'
import global from 'common/js/plugins/global'
import VueLazyload from 'vue-lazyload'
/* eslint-disable no-unused-vars */
// import console from 'vconsole'
// fastclick.attach(document.body)
Vue.config.productionTip = false
Vue.use(global)
Vue.use(VueLazyload, {
  loading: require('common/images/default.gif')
})
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  template: '<App/>',
  components: { App }
})


text:
package org.apache.cassandra.service.reads.repair;

import java.util.Map;

import com.codahale.metrics.Meter;
import org.apache.cassandra.db.DecoratedKey;
import org.apache.cassandra.db.Mutation;
import org.apache.cassandra.db.ReadCommand;
import org.apache.cassandra.db.partitions.UnfilteredPartitionIterators;
import org.apache.cassandra.locator.Endpoints;
import org.apache.cassandra.locator.Replica;
import org.apache.cassandra.locator.ReplicaPlan;
import org.apache.cassandra.metrics.ReadRepairMetrics;

/**
 * Only performs the collection of data responses and reconciliation of them, doesn't send repair mutations
 * to replicas. This preserves write atomicity, but doesn't provide monotonic quorum reads
 */
public class ReadOnlyReadRepair<E extends Endpoints<E>, P extends ReplicaPlan.ForRead<E>>
        extends AbstractReadRepair<E, P>
{
    ReadOnlyReadRepair(ReadCommand command, ReplicaPlan.Shared<E, P> replicaPlan, long queryStartNanoTime)
    {
        super(command, replicaPlan, queryStartNanoTime);
    }

    @Override
    public UnfilteredPartitionIterators.MergeListener getMergeListener(P replicaPlan)
    {
        return UnfilteredPartitionIterators.MergeListener.NOOP;
    }

    @Override
    Meter getRepairMeter()
    {
        return ReadRepairMetrics.reconcileRead;
    }

    @Override
    public void maybeSendAdditionalWrites()
    {

    }

    @Override
    public void repairPartition(DecoratedKey partitionKey, Map<Replica, Mutation> mutations, ReplicaPlan.ForTokenWrite writePlan)
    {
        throw new UnsupportedOperationException("ReadOnlyReadRepair shouldn't be trying to repair partitions");
    }

    @Override
    public void awaitWrites()
    {

    }
}


text:
<?php

/**
* Simple Login System class
*/
class SimpleLoginSystem {

    // variables
    var $bLoggedIn;

    /**
    * constructor
    */
    function SimpleLoginSystem() {
        $this->bLoggedIn = false;
        if ($_COOKIE['member_name'] && $_COOKIE['member_pass']) {
            if ($this->check_login($_COOKIE['member_name'], $_COOKIE['member_pass'], true)) {
                $this->bLoggedIn = true;
            }
        }
        $GLOBALS['bLoggedIn'] = $this->bLoggedIn;
    }

    function getLoginBox() {
        ob_start();
        require_once('templates/login_form.html');
        $sLoginForm = ob_get_clean();

        $sLogoutForm = 'Logout
';

        if ((int)$_REQUEST['logout'] == 1) {
            $this->simple_logout();
            header("Location: index.php"); exit;
        }

        if ($_REQUEST['username'] && $_REQUEST['password']) {
            if ($this->check_login($_REQUEST['username'], MD5($_REQUEST['password']))) {
                $this->simple_login($_REQUEST['username'], $_REQUEST['password']);

                header("Location: index.php"); exit;
            } else {
                return 'Username or Password is incorrect' . $sLoginForm;
            }
        } else {
            if ($_COOKIE['member_name'] && $_COOKIE['member_pass']) {
                if ($this->check_login($_COOKIE['member_name'], $_COOKIE['member_pass'])) {
                    return 'Hello ' . $_COOKIE['member_name'] . '! ' . $sLogoutForm;
                }
            }
            return $sLoginForm;
        }
    }

    function simple_login($sName, $sPass) {
        $this->simple_logout();

        $sMd5Password = MD5($sPass);

        $iCookieTime = time() + 24*60*60*30;
        setcookie("member_name", $sName, $iCookieTime, '/');
        $_COOKIE['member_name'] = $sName;
        setcookie("member_pass", $sMd5Password, $iCookieTime, '/');
        $_COOKIE['member_pass'] = $sMd5Password;
    }

    function simple_logout() {
        setcookie('member_name', '', time() - 96 * 3600, '/');
        setcookie('member_pass', '', time() - 96 * 3600, '/');

        unset($_COOKIE['member_name']);
        unset($_COOKIE['member_pass']);
    }

    function check_login($sName, $sPass, $bSetGlobals = false) {
        $sNameSafe = $GLOBALS['MySQL']->process_db_input($sName, A_TAGS_STRIP);
        $sPassSafe = $GLOBALS['MySQL']->process_db_input($sPass, A_TAGS_STRIP);

        $sSQL = "SELECT `id` FROM `s_members` WHERE `name`='{$sNameSafe}' AND `pass`='{$sPassSafe}'";
        $iID = (int)$GLOBALS['MySQL']->getOne($sSQL);

        if ($bSetGlobals) {
            $this->setLoggedMemberInfo($iID);
        }

        return ($iID > 0);
    }

    function setLoggedMemberInfo($iMemberID) {
        $sSQL = "SELECT * FROM `s_members` WHERE `id`='{$iMemberID}'";
        $aMemberInfos = $GLOBALS['MySQL']->getAll($sSQL);
        $GLOBALS['aLMemInfo'] = $aMemberInfos[0];
    }
}

$GLOBALS['oSimpleLoginSystem'] = new SimpleLoginSystem();

?>


text:
lgsm_version="070116"

# Description: getopt arguments.

fn_getopt_generic(){
case "$getopt" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		fn_restart;;
	u|update)
		update_check.sh;;
	fu|force-update|update-restart)
		forceupdate=1;
		update_check.sh;;
	uf|update-functions)
		update_functions.sh;;
	v|validate)
		command_validate.sh;;
	m|monitor)
		command_monitor.sh;;
	et|email-test)
		command_email_test.sh;;
	d|details)
		command_details.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	dd|depsdetect)
		command_dev_detect_deps.sh;;
	*)
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "http://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "\e[93mCommands\e[0m"
	{
		echo -e "\e[34mstart\t\e[0mStart the server."
		echo -e "\e[34mstop\t\e[0mStop the server."
		echo -e "\e[34mrestart\t\e[0mRestart the server."
		echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD."
		echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD."
		echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
		echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD."
		echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
		echo -e "\e[34memail-test\t\e[0mSends test monitor email."
		echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
		echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
		echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
		echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
		echo -e "\e[34minstall\t\e[0mInstall the server."
		echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts."
	} | column -s $'\t' -t
	esac
exit
}

fn_getopt_teamspeak3(){
case "$getopt" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		fn_restart;;
	u|update)
		update_check.sh;;
	uf|update-functions)
		update_functions.sh;;
	m|monitor)
		command_monitor.sh;;
	et|email-test)
		command_email_test.sh;;
	d|details)
		command_details.sh;;
	b|backup)
		command_backup.sh;;
	pw|change-password)
		command_ts3_server_pass.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	dd|depsdetect)
		command_dev_detect_deps.sh;;
	*)
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "http://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "\e[93mCommands\e[0m"
	{
		echo -e "\e[34mstart\t\e[0mStart the server."
		echo -e "\e[34mstop\t\e[0mStop the server."
		echo -e "\e[34mrestart\t\e[0mRestart the server."
		echo -e "\e[34mupdate\t\e[0mChecks and applies updates from teamspeak.com."
		echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
		echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
		echo -e "\e[34memail-test\t\e[0mSends test monitor email."
		echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
		echo -e "\e[34mchange-password\t\e[0mChanges TS3 serveradmin password."
		echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
		echo -e "\e[34minstall\t\e[0mInstall the server."
		echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts."
	} | column -s $'\t' -t
	esac
exit
}

fn_getopt_mumble(){
case "$getopt" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		fn_restart;;
	uf|update-functions)
		update_functions.sh;;
	m|monitor)
		command_monitor.sh;;
	et|email-test)
		command_email_test.sh;;
	b|backup)
		command_backup.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dd|depsdetect)
		command_dev_detect_deps.sh;;
	*)
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "http://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "\e[93mCommands\e[0m"
	{
		echo -e "\e[34mstart\t\e[0mStart the server."
		echo -e "\e[34mstop\t\e[0mStop the server."
		echo -e "\e[34mrestart\t\e[0mRestart the server."
		echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
		echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
		echo -e "\e[34memail-test\t\e[0mSends test monitor email."
		echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
		echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
		echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
	} | column -s $'\t' -t
	esac
exit
}

fn_getopt_gmodserver(){
case "$getopt" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		fn_restart;;
	u|update)
		update_check.sh;;
	fu|force-update|update-restart)
		forceupdate=1;
		update_check.sh;;
	uf|update-functions)
		update_functions.sh;;
	v|validate)
		command_validate.sh;;
	m|monitor)
		command_monitor.sh;;
	et|email-test)
		command_email_test.sh;;
	d|details)
		command_details.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	dd|depsdetect)
		command_dev_detect_deps.sh;;
	*)
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "http://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "\e[93mCommands\e[0m"
	{
		echo -e "\e[34mstart\t\e[0mStart the server."
		echo -e "\e[34mstop\t\e[0mStop the server."
		echo -e "\e[34mrestart\t\e[0mRestart the server."
		echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD."
		echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD."
		echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
		echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD."
		echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
		echo -e "\e[34memail-test\t\e[0mSends test monitor email."
		echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
		echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
		echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
		echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
		echo -e "\e[34minstall\t\e[0mInstall the server."
		echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts."
	} | column -s $'\t' -t
	esac
exit
}

fn_getopt_unreal(){
case "$getopt" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		fn_restart;;
	uf|update-functions)
		update_functions.sh;;
	m|monitor)
		command_monitor.sh;;
	et|email-test)
		command_email_test.sh;;
	d|details)
		command_details.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	mc|map-compressor)
		compress_ut99_maps.sh;;
	dd|depsdetect)
		command_dev_detect_deps.sh;;
	*)
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "http://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "\e[93mCommands\e[0m"
	{
		echo -e "\e[34mstart\t\e[0mStart the server."
		echo -e "\e[34mstop\t\e[0mStop the server."
		echo -e "\e[34mrestart\t\e[0mRestart the server."
		echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
		echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
		echo -e "\e[34memail-test\t\e[0mSends test monitor email."
		echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
		echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
		echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
		echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
		echo -e "\e[34minstall\t\e[0mInstall the server."
		echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
	} | column -s $'\t' -t
	esac
exit
}

fn_getopt_unreal2(){
case "$getopt" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		fn_restart;;
	u|update)
		update_check.sh;;
	fu|force-update|update-restart)
		forceupdate=1;
		update_check.sh;;
	uf|update-functions)
		update_functions.sh;;
	v|validate)
		command_validate.sh;;
	m|monitor)
		command_monitor.sh;;
	et|email-test)
		command_email_test.sh;;
	d|details)
		command_details.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	ai|auto-install)
		fn_autoinstall;;
	dd|depsdetect)
		command_dev_detect_deps.sh;;
	mc|map-compressor)
		compress_unreal2_maps.sh;;
	*)
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "http://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "\e[93mCommands\e[0m"
	{
		echo -e "\e[34mstart\t\e[0mStart the server."
		echo -e "\e[34mstop\t\e[0mStop the server."
		echo -e "\e[34mrestart\t\e[0mRestart the server."
		echo -e "\e[34mupdate\t\e[0mChecks and applies updates from SteamCMD."
		echo -e "\e[34mforce-update\t\e[0mBypasses the check and applies updates from SteamCMD."
		echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
		echo -e "\e[34mvalidate\t\e[0mValidate server files with SteamCMD."
		echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
		echo -e "\e[34memail-test\t\e[0mSends test monitor email."
		echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
		echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
		echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
		echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
		echo -e "\e[34minstall\t\e[0mInstall the server."
		echo -e "\e[34mauto-install\t\e[0mInstall the server, without prompts."
		echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
	} | column -s $'\t' -t
	esac
exit
}

fn_getopt_ut2k4(){
case "$getopt" in
	st|start)
		command_start.sh;;
	sp|stop)
		command_stop.sh;;
	r|restart)
		fn_restart;;
	uf|update-functions)
		update_functions.sh;;
	m|monitor)
		command_monitor.sh;;
	et|email-test)
		command_email_test.sh;;
	d|details)
		command_details.sh;;
	b|backup)
		command_backup.sh;;
	c|console)
		command_console.sh;;
	d|debug)
		command_debug.sh;;
	dev|dev-debug)
		command_dev_debug.sh;;
	i|install)
		command_install.sh;;
	mc|map-compressor)
		compress_unreal2_maps.sh;;
	dd|depsdetect)
		command_dev_detect_deps.sh;;
	*)
	echo "Usage: $0 [option]"
	echo "${gamename} - Linux Game Server Manager - Version ${version}"
	echo "http://gameservermanagers.com/${selfname}"
	echo -e ""
	echo -e "\e[93mCommands\e[0m"
	{
		echo -e "\e[34mstart\t\e[0mStart the server."
		echo -e "\e[34mstop\t\e[0mStop the server."
		echo -e "\e[34mrestart\t\e[0mRestart the server."
		echo -e "\e[34mupdate-functions\t\e[0mRemoves all functions so latest can be downloaded."
		echo -e "\e[34mmonitor\t\e[0mChecks that the server is running."
		echo -e "\e[34memail-test\t\e[0mSends test monitor email."
		echo -e "\e[34mdetails\t\e[0mDisplays useful infomation about the server."
		echo -e "\e[34mbackup\t\e[0mCreate archive of the server."
		echo -e "\e[34mconsole\t\e[0mConsole allows you to access the live view of a server."
		echo -e "\e[34mdebug\t\e[0mSee the output of the server directly to your terminal."
		echo -e "\e[34minstall\t\e[0mInstall the server."
		echo -e "\e[34mmap-compressor\t\e[0mCompresses all ${gamename} server maps."
	} | column -s $'\t' -t
	esac
exit
}

if [ "${gamename}" == "Mumble" ]; then
	fn_getopt_mumble
elif [ "${gamename}" == "Teamspeak 3" ]; then
	fn_getopt_teamspeak3
elif [ "${engine}" == "unreal2" ]; then
	if [ "${gamename}" == "Unreal Tournament 2004" ]; then
		fn_getopt_ut2k4
	else
		fn_getopt_unreal2
	fi
elif [ "${engine}" == "unreal" ]; then
	fn_getopt_unreal
else
	fn_getopt_generic
fi


text:
package org.hisp.dhis.eventchart;

import static com.google.common.base.Preconditions.checkNotNull;

import java.util.List;

import org.hisp.dhis.common.AnalyticalObjectStore;
import org.hisp.dhis.common.GenericAnalyticalObjectService;
import org.hisp.dhis.common.hibernate.HibernateAnalyticalObjectStore;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Lars Helge Overland
 */
@Service( "org.hisp.dhis.eventchart.EventChartService" )
public class DefaultEventChartService
    extends GenericAnalyticalObjectService<EventChart>
    implements EventChartService
{
    private final HibernateAnalyticalObjectStore<EventChart> eventChartStore;

    public DefaultEventChartService(
        @Qualifier( "org.hisp.dhis.eventchart.EventChartStore" ) HibernateAnalyticalObjectStore<EventChart> eventChartStore )
    {
        checkNotNull( eventChartStore );
        this.eventChartStore = eventChartStore;
    }

    // -------------------------------------------------------------------------
    // EventReportService implementation
    // -------------------------------------------------------------------------

    @Override
    protected AnalyticalObjectStore<EventChart> getAnalyticalObjectStore()
    {
        return eventChartStore;
    }

    @Override
    public long saveEventChart( EventChart eventChart )
    {
        eventChartStore.save( eventChart );

        return eventChart.getId();
    }

    @Override
    @Transactional
    public void updateEventChart( EventChart eventChart )
    {
        eventChartStore.update( eventChart );
    }

    @Override
    @Transactional( readOnly = true )
    public EventChart getEventChart( long id )
    {
        return eventChartStore.get( id );
    }

    @Override
    @Transactional( readOnly = true )
    public EventChart getEventChart( String uid )
    {
        return eventChartStore.getByUid( uid );
    }

    @Override
    @Transactional
    public void deleteEventChart( EventChart eventChart )
    {
        eventChartStore.delete( eventChart );
    }

    @Override
    @Transactional( readOnly = true )
    public List<EventChart> getAllEventCharts()
    {
        return eventChartStore.getAll();
    }
}


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Console;

/**
 *
 * @author Jean Pierre Patzlaff
 */
public class Configuracao {

    public static Boolean getListPennyStocks() {
        return false;
    }
}


text:
module Handbag
  module ApplicationHelper
  end
end


text:
'use strict';

const nock = require('nock');
const terasliceClientJs = require('../');
const Client = require('../lib/client');

describe('Teraslice Client', () => {
    describe('when using the main export function', () => {
        it('returns a function', () => {
            expect(typeof terasliceClientJs).toEqual('function');
        });

        it('should not throw an error if constructed with nothing', () => {
            expect(() => terasliceClientJs()).not.toThrow();
        });

        it('should have jobs, cluster, and assets', () => {
            const client = terasliceClientJs();
            expect(client.jobs).not.toBeUndefined();
            expect(client.cluster).not.toBeUndefined();
            expect(client.assets).not.toBeUndefined();
        });
    });

    describe('when using the Client constructor', () => {
        let client;
        let scope;

        beforeEach(() => {
            client = new Client({
                baseUrl: 'http://teraslice.example.dev'
            });
            scope = nock('http://teraslice.example.dev/v1');
        });

        afterEach(() => {
            nock.cleanAll();
        });

        describe('->get', () => {
            describe('when called with nothing', () => {
                let err;
                beforeEach((done) => {
                    client.get()
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with a empty path message', () => {
                    expect(err.toString()).toEqual('Error: endpoint must not be empty');
                });
            });

            describe('when called with a non-string value', () => {
                let err;
                beforeEach((done) => {
                    client.get({ hello: 'hi' })
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with invalid endpoint error', () => {
                    expect(err.toString()).toEqual('Error: endpoint must be a string');
                });
            });

            describe('when called with too many options', () => {
                let err;
                beforeEach((done) => {
                    client.get('/hi', 'hello', 'here', 'oh no')
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with invalid endpoint error', () => {
                    expect(err.toString()).toEqual('Error: Too many arguments passed to client');
                });
            });

            describe('when called with a valid path', () => {
                let result;

                beforeEach((done) => {
                    scope.get('/hello')
                        .reply(200, { example: 'hello' });

                    client.get('/hello')
                        .then((_result) => {
                            result = _result;
                            done();
                        })
                        .catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).toEqual({ example: 'hello' });
                });
            });

            describe('when called with a valid path', () => {
                let result;

                beforeEach((done) => {
                    scope.get('/hello')
                        .reply(200, { example: 'hello' });

                    client.get('/hello')
                        .then((_result) => {
                            result = _result;
                            done();
                        })
                        .catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).toEqual({ example: 'hello' });
                });
            });

            describe('when called with a path, query and options', () => {
                let result;

                beforeEach((done) => {
                    scope.get('/hello')
                        .query({ hello: true })
                        .reply(200, { example: 'hello' });

                    client.get('/hello', {
                        hello: true
                    }, {
                        json: false,
                        headers: { 'Some-Header': 'yes' }
                    }).then((_result) => {
                        result = _result;
                        done();
                    }).catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).toEqual(JSON.stringify({ example: 'hello' }));
                });
            });

            describe('when called with a path and plain query options', () => {
                let result;

                beforeEach((done) => {
                    scope.get('/hello')
                        .query({ hello: true })
                        .reply(200, { example: 'hello' });

                    client.get('/hello', {
                        hello: true
                    }).then((_result) => {
                        result = _result;
                        done();
                    }).catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).toEqual({ example: 'hello' });
                });
            });
        });

        describe('->post', () => {
            describe('when called with nothing', () => {
                let err;
                beforeEach((done) => {
                    client.post()
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with a empty path message', () => {
                    expect(err.toString()).toEqual('Error: endpoint must not be empty');
                });
            });

            describe('when called with too many options', () => {
                let err;
                beforeEach((done) => {
                    client.post('/hi', 'hello', 'here', 'oh no')
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with invalid endpoint error', () => {
                    expect(err.toString()).toEqual('Error: Too many arguments passed to client');
                });
            });

            describe('when called with a non-string value', () => {
                let err;
                beforeEach((done) => {
                    client.post({ hello: 'hi' })
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with invalid endpoint error', () => {
                    expect(err.toString()).toEqual('Error: endpoint must be a string');
                });
            });

            describe('when called the request throws an error', () => {
                let err;
                beforeEach((done) => {
                    scope.post('/hello')
                        .replyWithError('Oh no');

                    client.post('/hello', { hello: 'hi' })
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with invalid error', () => {
                    expect(err.toString()).toEqual('Error: Oh no');
                });
            });

            describe('when called the server replys with an error', () => {
                let err;
                beforeEach((done) => {
                    scope.post('/hello')
                        .reply(500, {
                            message: 'Oh no',
                            error: 1232
                        });

                    client.post('/hello', { hello: 'hi' })
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with invalid error', () => {
                    expect(err.toString()).toEqual('Error: Oh no');
                    expect(err.error).toEqual(1232);
                    expect(err.code).toEqual(1232);
                    expect(err.statusCode).toEqual(1232);
                });
            });

            describe('when called the server replys and the error is a string', () => {
                let err;
                beforeEach((done) => {
                    scope.post('/hello')
                        .reply(428, {
                            error: 'Uh-oh here is an error'
                        });

                    client.post('/hello', { hello: 'hi' })
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with invalid error', () => {
                    expect(err.toString()).toEqual('Error: Uh-oh here is an error');
                    expect(err.error).toEqual(428);
                    expect(err.code).toEqual(428);
                });
            });

            describe('when called the server replys with empty error', () => {
                let err;
                beforeEach((done) => {
                    scope.post('/hello')
                        .reply(500);

                    client.post('/hello', { hello: 'hi' })
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with invalid error', () => {
                    expect(err.toString()).toEqual('Error: Internal Server Error');
                    expect(err.error).toEqual(500);
                    expect(err.code).toEqual(500);
                });
            });

            describe('when called the server replys with an string', () => {
                let err;
                beforeEach((done) => {
                    scope.post('/hello')
                        .reply(500, 'Oh no');

                    client.post('/hello', { hello: 'hi' })
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with invalid error', () => {
                    expect(err.toString()).toEqual('Error: Oh no');
                    expect(err.error).toEqual(500);
                    expect(err.code).toEqual(500);
                });
            });

            describe('when called with a valid path', () => {
                let result;

                beforeEach((done) => {
                    scope.post('/hello')
                        .reply(200, { example: 'hello' });

                    client.post('/hello')
                        .then((_result) => {
                            result = _result;
                            done();
                        })
                        .catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).toEqual({ example: 'hello' });
                });
            });

            describe('when called with a path and json', () => {
                let result;

                beforeEach((done) => {
                    scope.post('/hello', { hello: true })
                        .reply(200, { example: 'hello' });

                    client.post('/hello', {
                        json: {
                            hello: true
                        }
                    }).then((_result) => {
                        result = _result;
                        done();
                    }).catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).toEqual({ example: 'hello' });
                });
            });

            describe('when called with a path and body', () => {
                let result;

                beforeEach((done) => {
                    scope.post('/hello', JSON.stringify({ hello: true }))
                        .reply(200, { example: 'hello' });

                    client.post('/hello', {
                        body: JSON.stringify({ hello: true }),
                        json: false,
                    }).then((_result) => {
                        result = _result;
                        done();
                    }).catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).toEqual(JSON.stringify({ example: 'hello' }));
                });
            });

            describe('when called with a path and headers', () => {
                let result;

                beforeEach((done) => {
                    scope.post('/hello', { hello: true })
                        .reply(200, { example: 'hello' });

                    client.post('/hello', {
                        headers: {
                            SomeHeader: 'hi'
                        },
                        json: { hello: true },
                    }).then((_result) => {
                        result = _result;
                        done();
                    }).catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).toEqual({ example: 'hello' });
                });
            });

            describe('when called with a path and a buffer', () => {
                let result;

                beforeEach((done) => {
                    scope.post('/hello', 'hello')
                        .reply(200, 'response-hello');

                    client.post('/hello', Buffer.from('hello')).then((_result) => {
                        result = _result;
                        done();
                    }).catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).toEqual('response-hello');
                });
            });
        });

        describe('->put', () => {
            describe('when called with nothing', () => {
                let err;
                beforeEach((done) => {
                    client.put()
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with a empty path message', () => {
                    expect(err.toString()).toEqual('Error: endpoint must not be empty');
                });
            });

            describe('when called with a non-string value', () => {
                let err;
                beforeEach((done) => {
                    client.put({ hello: 'hi' })
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with invalid endpoint error', () => {
                    expect(err.toString()).toEqual('Error: endpoint must be a string');
                });
            });

            describe('when called with a valid path', () => {
                let result;

                beforeEach((done) => {
                    scope.put('/hello')
                        .reply(200, { example: 'hello' });

                    client.put('/hello')
                        .then((_result) => {
                            result = _result;
                            done();
                        })
                        .catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).toEqual({ example: 'hello' });
                });
            });

            describe('when called with a path and body', () => {
                let result;

                beforeEach((done) => {
                    scope.put('/hello', { hello: true })
                        .reply(200, { example: 'hello' });

                    client.put('/hello', {
                        json: {
                            hello: true
                        }
                    }).then((_result) => {
                        result = _result;
                        done();
                    }).catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).toEqual({ example: 'hello' });
                });
            });

            describe('when called with a path and data', () => {
                let result;

                beforeEach((done) => {
                    scope.put('/hello', { hello: true })
                        .reply(200, { example: 'hello' });

                    client.put('/hello', {
                        hello: true
                    }).then((_result) => {
                        result = _result;
                        done();
                    }).catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).toEqual({ example: 'hello' });
                });
            });
        });

        describe('->delete', () => {
            describe('when called with nothing', () => {
                let err;
                beforeEach((done) => {
                    client.delete()
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with a empty path message', () => {
                    expect(err.toString()).toEqual('Error: endpoint must not be empty');
                });
            });

            describe('when called with a non-string value', () => {
                let err;
                beforeEach((done) => {
                    client.delete({ hello: 'hi' })
                        .then(fail)
                        .catch((_err) => {
                            err = _err;
                            done();
                        });
                });

                it('should reject with an error', () => {
                    expect(err instanceof Error).toBeTrue();
                });

                it('should reject with invalid endpoint error', () => {
                    expect(err.toString()).toEqual('Error: endpoint must be a string');
                });
            });

            describe('when called with a valid path', () => {
                let result;

                beforeEach((done) => {
                    scope.delete('/hello')
                        .reply(204);

                    client.delete('/hello')
                        .then((_result) => {
                            result = _result;
                            done();
                        })
                        .catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).not.toEqual(null);
                });
            });

            describe('when called with a path and query', () => {
                let result;

                beforeEach((done) => {
                    scope.delete('/hello')
                        .query({ hello: true })
                        .reply(204);

                    client.delete('/hello', {
                        qs: {
                            hello: true
                        }
                    }).then((_result) => {
                        result = _result;
                        done();
                    }).catch(fail);
                });

                it('should resolve with the response from the server', () => {
                    expect(result).not.toEqual(null);
                });
            });
        });
    });
});


text:
package br.com.tamandua.persistence.dao;

import static org.hibernate.criterion.Example.create;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.Session;
import org.hibernate.ejb.EntityManagerImpl;

import br.com.tamandua.persistence.Image;

public class HomeDAO<T, K> {

    static final Log log = LogFactory.getLog(ImageHome.class);

    @PersistenceContext
    private EntityManager entityManager;

    public HomeDAO() {
        super();
    }

    public void persist(T transientInstance) {
        log.debug("persisting " + transientInstance.getClass().getName() +" instance");
        try {
            entityManager.persist(transientInstance);
            log.debug("persist successful");
        } catch (RuntimeException re) {
            log.error("persist failed", re);
            throw re;
        }
    }

    public void remove(T persistentInstance) {
        log.debug("removing " + persistentInstance.getClass().getName() +" instance");
        try {
            entityManager.remove(persistentInstance);
            log.debug("remove successful");
        } catch (RuntimeException re) {
            log.error("remove failed", re);
            throw re;
        }
    }

    public T merge(T detachedInstance) {
        log.debug("merging " + detachedInstance.getClass().getName() +" instance");
        try {
            T result = entityManager.merge(detachedInstance);
            log.debug("merge successful");
            return result;
        } catch (RuntimeException re) {
            log.error("merge failed", re);
            throw re;
        }
    }

    public T findById(K id) {
        log.debug("getting Image instance with id: " + id);
        try {
            T instance = null; //entityManager.find(T.class, id);
            log.debug("get successful");
            return instance;
        } catch (RuntimeException re) {
            log.error("get failed", re);
            throw re;
        }
    }

    public Image findByUri(String uri) {
        log.debug("getting Image instance with uri: " + uri);
        Image instance = null;
        try {
            Query query = entityManager.createQuery("from Image where uri = ?");
            query.setParameter(1, uri);
            instance = (Image) query.getSingleResult();
            log.debug("get successful");
            return instance;
        } catch (RuntimeException re) {
            log.error("get failed", re);
            throw re;
        }
    }

    /**
     * @return the entityManager
     */
    public EntityManager getEntityManager() {
        return entityManager;
    }

    /**
     * @param entityManager the entityManager to set
     */
    public void setEntityManager(EntityManager entityManager) {
        this.entityManager = entityManager;
    }

    private Session getSession() {
        Session session = null;
        if (entityManager.getDelegate() instanceof EntityManagerImpl) {
            EntityManagerImpl entityManagerImpl = (EntityManagerImpl) entityManager.getDelegate();
            session = entityManagerImpl.getSession();
        } else {
            session = (Session) entityManager.getDelegate();
        }
        return session;
    }

    public List<Image> findByExample(Image instance) {
        log.debug("finding Image instance by example");
        try {
            List<Image> results = (List<Image>) getSession().createCriteria("br.com.tamandua.dao.Image")
                    .add(create(instance)).list();
            log.debug("find by example successful, result size: " + results.size());
            return results;
        } catch (RuntimeException re) {
            log.error("find by example failed", re);
            throw re;
        }
    }

}


text:
plaso.storage.redis package
===========================

Submodules
----------

plaso.storage.redis.merge\_reader module
----------------------------------------

.. automodule:: plaso.storage.redis.merge_reader
   :members:
   :undoc-members:
   :show-inheritance:

plaso.storage.redis.reader module
---------------------------------

.. automodule:: plaso.storage.redis.reader
   :members:
   :undoc-members:
   :show-inheritance:

plaso.storage.redis.redis\_store module
---------------------------------------

.. automodule:: plaso.storage.redis.redis_store
   :members:
   :undoc-members:
   :show-inheritance:

plaso.storage.redis.writer module
---------------------------------

.. automodule:: plaso.storage.redis.writer
   :members:
   :undoc-members:
   :show-inheritance:

Module contents
---------------

.. automodule:: plaso.storage.redis
   :members:
   :undoc-members:
   :show-inheritance:


text:
homebrew-j
==========

Homebrew tap


text:
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from __future__ import absolute_import

import numpy as np

def derivative(ys, xs=None):
    """Calculates the difference-based derivative of a series of numbers.

    Args:
        ys: the y term in dy/dx
        xs: the x term in dy/dx; if None, each dx = 1

    Returns:
        list of numbers with length 1 less than ys and xs
    """
    if xs is None:
        xs = range(len(ys))
    assert len(ys) == len(xs)
    derivative = []
    for x1, x2, y1, y2 in zip(xs[:-1], xs[1:], ys[:-1], ys[1:]):
        derivative.append((y2 - y1) * 1.0 / (x2 - x1))
    return derivative


text:
- Node and npm - [http://nodejs.org/](http://nodejs.org/)
- Cordova CLI - [https://github.com/apache/cordova-cli/](https://github.com/apache/cordova-cli/)
- Grunt - [http://gruntjs.com/](http://gruntjs.com/)
- Grunt-init - [https://github.com/gruntjs/grunt-init](https://github.com/gruntjs/grunt-init) – see: [http://gruntjs.com/project-scaffolding](http://gruntjs.com/project-scaffolding)

Then install the global npm dependencies – depending how you installed node.js, you might need to use `sudo` before any of the `-g` – global – npm installs:

- `npm install -g cordova` (assuming you haven't already, this is all you need to create cordova projects)
- `npm install -g grunt-cli` - this will give us the `grunt` command that will be the backbone of our build set-up
- `npm install -g grunt-init` - this is the tool for initialising a Grunt.js workflow in your project using templates like this one.

## Installation

#### Start by cloning this repo:

- `git clone https://github.com/devgeeks/grunt-init-cordova.git`

Now, if you run `grunt-init`, under "currently-available init templates" you should now have an entry called "cordova"

If everything worked and you have the cordova template available, you are ready to use it with the [cordova-cli](https://github.com/apache/cordova-cli/) tool to get your new project up and running.

#### Create a new cordova project using the cli tool:

The `cordova create` command takes a path / destination dir, a package ID (in reverse-domain format) and the name of the app.

- `cordova create ./MyNewProject org.devgeeks.mynewproject MyNewProject`
- `cd ./MyNewProject`
- `cordova platform add ios` and/or `cordova platform add android`, etc

*NOTE: this init template uses a folder called `./src` as the source folder if you choose to have one. It then sets up Grunt tasks to concatenate and minify those files and place the concatenated and minified files in `./www/js/MyNewProject.js` and  `./www/js/MyNewProject.min.js` respectively. You will also have to answer "y" to the init question about concatenation. If this doesn't suit your workflow, but you do still wish to be set up for concatenation and/or minification – i.e.: you don't have a `./src` folder – it will just create empty tasks for concatenation and minification for you to fill out.*

#### Next, it's time to init the project with grunt:

- `grunt-init <path/to/this/repo>`
  - This will ask you some questions about your project (usually, the defaults are fine) and create some files like a `Gruntfile.js` file and a `package.json` file.

#### After initialising, you need to install the dependencies:

- `npm install` - This should install some grunt task plugins and their requirements

#### That's it! You are ready to roll:

##### Commands:

`grunt` (default command): runs the lint task, the concat and min tasks (if you decided you wanted them) and runs the jasmine tests that come with the cordova default example project created in the `www` folder when creating the project.

`grunt jshint`: lints the files in `www/js` using jshint.

`grunt debug:ios`: runs `cordova build ios && cordova emulate ios` to run up your project in the iOS Simulator (requires [ios-sim](https://github.com/phonegap/ios-sim)).

`grunt debug:android`: runs `cordova build android && cordova emulate android` to run up your project in the Android Emulator.

`grunt debug:blackberry10`: runs `cordova build blackberry10 && cordova emulate blackberry10` to run up your project in the Blackberry environment (NOTE: this still needs the flags added...).

`grunt watch`: watches the files in you jshint list for changes and runs `grunt jshint` – and concatenation and minification, if you chose it – when triggered.


text:
categories: []
comments: true
layout: post
published: true
status: publish
tags: []
title: "chaos theory"
type: post
---

I
start to worry about my family, of none but their health, after my
reading over an article "Life Changes lead to reduce your chances
of heart attack and stroke". I don't know whether they have already
realized or not, that their own choices would somehow, decisively set
their own way in future. The same as Chaos Theory, just a little step
makes a gap in ten years, or 20. so why not we just give up the
smoking or have a moderate drinking rather than in an unacceptable
way to spoil your own chips. Otherwise, me, your son have to have
taken a consideration of 29% chance in heart attacking and smoking in
next decade since you are already in your own fifties. And I would
definitely not go to take it as a lottery for no such things in the
world boasts for 29% hitting prizes, the same way implying a 29 out
of 100 person of the same physical conditions would suffer while the
other 79 would not in just 10 years, which would be exponential
increasing at your 70s. Why not I bet one million dollars on my ass
for that would of course happen in future time, say 20 if not 10,
lest you don't wrap yourself off those habits and keep them away from
your touch. My suggestion is either you take off, or you suffer.
Pay
more attention to your own cholesterol level and blood pressure by a
regular system of seeing doctors, getting rid off smoking, your daily
dietary intaking, and physical practicing as well, which according to
those scientific nerds will result in a as low as 3% of outbreaking.

Do
u remember, my father, we could almost share a quick money if you
quit smoking after mom asked me to persuade u to do that for a prize
of the amount in case u quit and I proposed to spit this prize for
compensating your own sacrifice. U didn't. Single thought change the
life, isn't it? Or won't it? We'll see.


text:
package core.time.parse;

import org.junit.Test;

import java.time.LocalDate;
import java.time.Month;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;

import static org.junit.Assert.assertEquals;

public class ParseDateTest {

	@Test
	public void parseDate() {
		LocalDate expected = LocalDate.of(2015, Month.OCTOBER, 30);
		assertEquals(LocalDate.parse("2015-10-30"), expected);
	}

	@Test
	public void parseDateWithISOFormatter() {
		LocalDate expected = LocalDate.of(2015, Month.OCTOBER, 30);
		DateTimeFormatter isoFormatter = DateTimeFormatter.ISO_LOCAL_DATE;
		assertEquals(LocalDate.parse("2015-10-30", isoFormatter), expected);
	}

	@Test
	public void parseDateWithCustomFormatter() {
		LocalDate expected = LocalDate.of(2015, Month.OCTOBER, 30);
		DateTimeFormatter customFormatter = DateTimeFormatter.ofPattern("yyyy-dd-MM");
		assertEquals(LocalDate.parse("2015-30-10", customFormatter), expected);
	}

	@Test(expected = DateTimeParseException.class)
	public void parseWrongFormatDate() {
		LocalDate.parse("2015-00-00");
	}
}


text:
package com.google.doclava;

import java.util.Set;
import java.util.TreeSet;

public class Errors {
  public static boolean hadError = false;
  private static boolean warningsAreErrors = false;
  private static TreeSet<ErrorMessage> allErrors = new TreeSet<ErrorMessage>();

  public static void error(ErrorCode error, SourcePositionInfo where, String text) {
    if (error.getLevel() == HIDDEN) {
      return;
    }

    int level = (!warningsAreErrors && error.getLevel() == WARNING) ? WARNING : ERROR;
    String which = level == WARNING ? " warning " : " error ";
    String message = which + error.getCode() + ": " + text;

    if (where == null) {
      where = SourcePositionInfo.UNKNOWN;
    }

    allErrors.add(new ErrorMessage(error, where, message));

    if (error.getLevel() == ERROR || (warningsAreErrors && error.getLevel() == WARNING)) {
      hadError = true;
    }
  }

  public static void clearErrors() {
    hadError = false;
    allErrors.clear();
  }

  public static void printErrors() {
    printErrors(allErrors);
  }

  public static void printErrors(Set<ErrorMessage> errors) {
    for (ErrorMessage m : errors) {
      if (m.getError().getLevel() == WARNING) {
        System.err.println(m.toString());
      }
    }
    for (ErrorMessage m : errors) {
      if (m.getError().getLevel() == ERROR) {
        System.err.println(m.toString());
      }
    }
  }

  public static Set<ErrorMessage> getErrors() {
    return allErrors;
  }

  public static int HIDDEN = 0;
  public static int WARNING = 1;
  public static int ERROR = 2;

  public static void setWarningsAreErrors(boolean val) {
    warningsAreErrors = val;
  }

  // Exit status codes
  public static final int EXIT_NORMAL = 0;
  public static final int EXIT_ERROR = 1;
  public static final int EXIT_BAD_ARGUMENTS = 2;
  public static final int EXIT_PARSE_ERROR = 3;

  // Errors for API verification
  public static final ErrorCode PARSE_ERROR = new ErrorCode(1, ERROR);
  public static final ErrorCode ADDED_PACKAGE = new ErrorCode(2, WARNING);
  public static final ErrorCode ADDED_CLASS = new ErrorCode(3, WARNING);
  public static final ErrorCode ADDED_METHOD = new ErrorCode(4, WARNING);
  public static final ErrorCode ADDED_FIELD = new ErrorCode(5, WARNING);
  public static final ErrorCode ADDED_INTERFACE = new ErrorCode(6, WARNING);
  public static final ErrorCode REMOVED_PACKAGE = new ErrorCode(7, WARNING);
  public static final ErrorCode REMOVED_CLASS = new ErrorCode(8, WARNING);
  public static final ErrorCode REMOVED_METHOD = new ErrorCode(9, WARNING);
  public static final ErrorCode REMOVED_FIELD = new ErrorCode(10, WARNING);
  public static final ErrorCode REMOVED_INTERFACE = new ErrorCode(11, WARNING);
  public static final ErrorCode CHANGED_STATIC = new ErrorCode(12, WARNING);
  public static final ErrorCode CHANGED_FINAL = new ErrorCode(13, WARNING);
  public static final ErrorCode CHANGED_TRANSIENT = new ErrorCode(14, WARNING);
  public static final ErrorCode CHANGED_VOLATILE = new ErrorCode(15, WARNING);
  public static final ErrorCode CHANGED_TYPE = new ErrorCode(16, WARNING);
  public static final ErrorCode CHANGED_VALUE = new ErrorCode(17, WARNING);
  public static final ErrorCode CHANGED_SUPERCLASS = new ErrorCode(18, WARNING);
  public static final ErrorCode CHANGED_SCOPE = new ErrorCode(19, WARNING);
  public static final ErrorCode CHANGED_ABSTRACT = new ErrorCode(20, WARNING);
  public static final ErrorCode CHANGED_THROWS = new ErrorCode(21, WARNING);
  public static final ErrorCode CHANGED_NATIVE = new ErrorCode(22, HIDDEN);
  public static final ErrorCode CHANGED_CLASS = new ErrorCode(23, WARNING);
  public static final ErrorCode CHANGED_DEPRECATED = new ErrorCode(24, WARNING);
  public static final ErrorCode CHANGED_SYNCHRONIZED = new ErrorCode(25, ERROR);

  // Errors in javadoc generation
  public static final ErrorCode UNRESOLVED_LINK = new ErrorCode(101, WARNING);
  public static final ErrorCode BAD_INCLUDE_TAG = new ErrorCode(102, WARNING);
  public static final ErrorCode UNKNOWN_TAG = new ErrorCode(103, WARNING);
  public static final ErrorCode UNKNOWN_PARAM_TAG_NAME = new ErrorCode(104, WARNING);
  public static final ErrorCode UNDOCUMENTED_PARAMETER = new ErrorCode(105, HIDDEN);
  public static final ErrorCode BAD_ATTR_TAG = new ErrorCode(106, ERROR);
  public static final ErrorCode BAD_INHERITDOC = new ErrorCode(107, HIDDEN);
  public static final ErrorCode HIDDEN_LINK = new ErrorCode(108, WARNING);
  public static final ErrorCode HIDDEN_CONSTRUCTOR = new ErrorCode(109, WARNING);
  public static final ErrorCode UNAVAILABLE_SYMBOL = new ErrorCode(110, ERROR);
  public static final ErrorCode HIDDEN_SUPERCLASS = new ErrorCode(111, WARNING);
  public static final ErrorCode DEPRECATED = new ErrorCode(112, HIDDEN);
  public static final ErrorCode DEPRECATION_MISMATCH = new ErrorCode(113, HIDDEN);
  public static final ErrorCode MISSING_COMMENT = new ErrorCode(114, WARNING);
  public static final ErrorCode IO_ERROR = new ErrorCode(115, HIDDEN);
  public static final ErrorCode NO_SINCE_DATA = new ErrorCode(116, HIDDEN);
  public static final ErrorCode NO_FEDERATION_DATA = new ErrorCode(117, WARNING);
  public static final ErrorCode NO_SINCE_FILE = new ErrorCode(118, WARNING);

  public static final ErrorCode[] ERRORS =
      {UNRESOLVED_LINK, BAD_INCLUDE_TAG, UNKNOWN_TAG, UNKNOWN_PARAM_TAG_NAME,
          UNDOCUMENTED_PARAMETER, BAD_ATTR_TAG, BAD_INHERITDOC, HIDDEN_LINK, HIDDEN_CONSTRUCTOR,
          UNAVAILABLE_SYMBOL, HIDDEN_SUPERCLASS, DEPRECATED, DEPRECATION_MISMATCH, MISSING_COMMENT,
          IO_ERROR, NO_SINCE_DATA, NO_FEDERATION_DATA, NO_SINCE_FILE, PARSE_ERROR, ADDED_PACKAGE,
          ADDED_CLASS, ADDED_METHOD, ADDED_FIELD, ADDED_INTERFACE, REMOVED_PACKAGE, REMOVED_CLASS,
          REMOVED_METHOD, REMOVED_FIELD, REMOVED_INTERFACE, CHANGED_STATIC, CHANGED_FINAL,
          CHANGED_TRANSIENT, CHANGED_VOLATILE, CHANGED_TYPE, CHANGED_VALUE, CHANGED_SUPERCLASS,
          CHANGED_SCOPE, CHANGED_ABSTRACT, CHANGED_THROWS, CHANGED_NATIVE, CHANGED_CLASS,
          CHANGED_DEPRECATED, CHANGED_SYNCHRONIZED};

  public static boolean setErrorLevel(int code, int level) {
    for (ErrorCode e : ERRORS) {
      if (e.getCode() == code) {
        e.setLevel(level);
        return true;
      }
    }
    return false;
  }
}


text:
package com.soasta.jenkins;

import hudson.Extension;
import hudson.model.AbstractDescribableImpl;
import hudson.model.Descriptor;
import hudson.util.FormValidation;
import hudson.util.ListBoxModel;

import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.QueryParameter;

/**
 * represents a user defined threshold, for a specific transaction
 * @author dbekel
 *
 */
public class TransactionThreshold extends AbstractDescribableImpl<TransactionThreshold>
{
  private final String thresholdname;
  private final String thresholdvalue;
  private final String transactionname;

  private static final String PCTL_90TH       = "90th Percentile";
  private static final String MIN_MSG_RSP     = "Min Response Time";
  private static final String MAX_MSG_RSP     = "Max Response Time";
  private static final String AVG_MSG_RSP     = "Average Response Time";
  private static final String BYTES_SENT      = "Total Bytes Sent";
  private static final String BYTES_RECEIVED  = "Total Bytes Received";
  private static final String TRANSACTION_ERRORS = "Errors Per Transaction";
  private static final String MIN_TRANSACTION_COUNT = "Minimum Transaction Count";
  private static final String MIN_DURATION     = "Min Duration";
  private static final String MAX_DURATION     = "Max Duration";
  private static final String AVG_DURATION     = "Average Duration";

  private static final char   THRESHOLD_STR_SEPERATOR = '/' ;
  private static final String THRESHOLD_TO_SCOMMAND_FORMAT  = "%s" + THRESHOLD_STR_SEPERATOR + "%s" + THRESHOLD_STR_SEPERATOR + "%s";

  /**
   * filled by the jenkins plugin, when the user enters data in the UI
   * @param transactionname - name of transaction
   * @param thresholdname - threshold name, picked from a list box
   * @param thresholdvalue - the threshold value
   */
  @DataBoundConstructor
  public TransactionThreshold(String transactionname, String thresholdname, String thresholdvalue) {
      this.thresholdname = thresholdname;
      this.thresholdvalue = thresholdvalue;
      this.transactionname = transactionname;
  }

  /**
   * Getters are needed for Jenkins implementation
   */
  public String getTransactionname() {
      return transactionname;
  }

  public String getThresholdname() {
      return thresholdname;
  }

  public String getThresholdvalue() {
      return thresholdvalue;
  }

  public String toScommandString() {
      String WHITESPACE_PATTERN = "\\s";
      String trimSpaceThresholdName = thresholdname.replaceAll(WHITESPACE_PATTERN,"");
      String scommandFormatted = String.format(THRESHOLD_TO_SCOMMAND_FORMAT, transactionname,trimSpaceThresholdName,thresholdvalue);
      return scommandFormatted;
  }

  @Extension
  public static class DescriptorImpl extends Descriptor<TransactionThreshold> {

    @Override
    public String getDisplayName() {
      return "";
    }

    /**
     * check for valid transaction name
     * @param value - the value from jenkins UI
     * @return if "FormValidation.error" is returned, the user is notified of bad input
     */
    public FormValidation doCheckTransactionname(@QueryParameter String value) {
      if (value == null || value.trim().isEmpty()) {
        return FormValidation.error("Paramater 'Transaction Name' is required");
      }
      return FormValidation.ok();
    }

    /**
     * checks the validity of the threshold value parameter
     * it should be an alphanumeric number
     * @param value - entered via jenkins UI
     */
    public FormValidation doCheckThresholdvalue(@QueryParameter String value) {
      // basic checks, the string must not be empty
      if (value == null || value.trim().isEmpty()) {
        return FormValidation.error("Parameter 'Threshold Value' is required");
      }

      // verify that the string truly represents a number
      double dNum=0;
      try{
        dNum = Double.parseDouble(value);
      }
      catch(NumberFormatException e){
        return FormValidation.error("Value must be a positive number");
      }

      if (dNum < 0)
        return FormValidation.error("Value must be >= 0");

      return FormValidation.ok();
    }

    /**
     * required by the jenkins framework
     * fills the thresholds names into the listbox item.
     * than the user can select one of them as the desired threshold name.
     *
     * @return ListBoxModel item filled with the strings to be displayed in the listbox
     */
    public ListBoxModel doFillThresholdnameItems() {
      final ListBoxModel listBox = new ListBoxModel();

      listBox.add(AVG_MSG_RSP, "AverageResponseTime");
      listBox.add(PCTL_90TH, "90thPercentile");
      listBox.add(MIN_MSG_RSP, "MinResponseTime");
      listBox.add(MAX_MSG_RSP, "MaxResponseTime");
      listBox.add(BYTES_SENT, "TotalBytesSent");
      listBox.add(BYTES_RECEIVED, "TotalBytesReceived");
      listBox.add(TRANSACTION_ERRORS, "ErrorsPerTransaction");
      listBox.add(MIN_TRANSACTION_COUNT, "MinimumTransactionCount");
      listBox.add(MIN_DURATION, "MinDuration");
      listBox.add(MAX_DURATION, "MaxDuration");
      listBox.add(AVG_DURATION, "AverageDuration");

      return listBox;
    }

  }  //class
}


text:
using LifecycleControl = service_manager::test::mojom::LifecycleControl;
using LifecycleControlRequest =
    service_manager::test::mojom::LifecycleControlRequest;

namespace service_manager {
class ServiceContext;

namespace test {

class AppClient : public Service,
                  public InterfaceFactory<LifecycleControl>,
                  public LifecycleControl {
 public:
  AppClient();
  explicit AppClient(service_manager::mojom::ServiceRequest request);
  ~AppClient() override;

  void set_runner(ServiceRunner* runner) {
    runner_ = runner;
  }

  // Service:
  bool OnConnect(const ServiceInfo& remote_info,
                 InterfaceRegistry* registry) override;

  // InterfaceFactory<LifecycleControl>:
  void Create(const Identity& remote_identity,
              LifecycleControlRequest request) override;

  // LifecycleControl:
  void Ping(const PingCallback& callback) override;
  void GracefulQuit() override;
  void Crash() override;
  void CloseServiceManagerConnection() override;

 private:
  void BindingLost();

  ServiceRunner* runner_ = nullptr;
  mojo::BindingSet<LifecycleControl> bindings_;
  std::unique_ptr<ServiceContext> context_;

  DISALLOW_COPY_AND_ASSIGN(AppClient);
};

}  // namespace test
}  // namespace service_manager

#endif  // SERVICES_SERVICE_MANAGER_TESTS_LIFECYCLE_APP_CLIENT_H_


text:
package com.amazonaws.services.workmail.model;

import java.io.Serializable;
import javax.annotation.Generated;

import com.amazonaws.AmazonWebServiceRequest;

/**
 *
 * @see AWS
 *      API Documentation
 */
@Generated("com.amazonaws:aws-java-sdk-code-generator")
public class DescribeMailboxExportJobRequest extends com.amazonaws.AmazonWebServiceRequest implements Serializable, Cloneable {

    /**
     *

     * The mailbox export job ID.
     *

     */
    private String jobId;
    /**
     *

     * The organization ID.
     *

     */
    private String organizationId;

    /**
     *

     * The mailbox export job ID.
     *

     *
     * @param jobId
     *        The mailbox export job ID.
     */

    public void setJobId(String jobId) {
        this.jobId = jobId;
    }

    /**
     *

     * The mailbox export job ID.
     *

     *
     * @return The mailbox export job ID.
     */

    public String getJobId() {
        return this.jobId;
    }

    /**
     *

     * The mailbox export job ID.
     *

     *
     * @param jobId
     *        The mailbox export job ID.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeMailboxExportJobRequest withJobId(String jobId) {
        setJobId(jobId);
        return this;
    }

    /**
     *

     * The organization ID.
     *

     *
     * @param organizationId
     *        The organization ID.
     */

    public void setOrganizationId(String organizationId) {
        this.organizationId = organizationId;
    }

    /**
     *

     * The organization ID.
     *

     *
     * @return The organization ID.
     */

    public String getOrganizationId() {
        return this.organizationId;
    }

    /**
     *

     * The organization ID.
     *

     *
     * @param organizationId
     *        The organization ID.
     * @return Returns a reference to this object so that method calls can be chained together.
     */

    public DescribeMailboxExportJobRequest withOrganizationId(String organizationId) {
        setOrganizationId(organizationId);
        return this;
    }

    /**
     * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
     * redacted from this string using a placeholder value.
     *
     * @return A string representation of this object.
     *
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("{");
        if (getJobId() != null)
            sb.append("JobId: ").append(getJobId()).append(",");
        if (getOrganizationId() != null)
            sb.append("OrganizationId: ").append(getOrganizationId());
        sb.append("}");
        return sb.toString();
    }

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;

        if (obj instanceof DescribeMailboxExportJobRequest == false)
            return false;
        DescribeMailboxExportJobRequest other = (DescribeMailboxExportJobRequest) obj;
        if (other.getJobId() == null ^ this.getJobId() == null)
            return false;
        if (other.getJobId() != null && other.getJobId().equals(this.getJobId()) == false)
            return false;
        if (other.getOrganizationId() == null ^ this.getOrganizationId() == null)
            return false;
        if (other.getOrganizationId() != null && other.getOrganizationId().equals(this.getOrganizationId()) == false)
            return false;
        return true;
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int hashCode = 1;

        hashCode = prime * hashCode + ((getJobId() == null) ? 0 : getJobId().hashCode());
        hashCode = prime * hashCode + ((getOrganizationId() == null) ? 0 : getOrganizationId().hashCode());
        return hashCode;
    }

    @Override
    public DescribeMailboxExportJobRequest clone() {
        return (DescribeMailboxExportJobRequest) super.clone();
    }

}


text:
<?php

namespace OrganisationApiTest\Controller;

use Doctrine\ORM\EntityManager;
use DvsaCommon\Dto\Organisation\MotTestLogSummaryDto;
use DvsaCommon\Dto\Search\MotTestSearchParamsDto;
use DvsaCommon\Utility\DtoHydrator;
use DvsaCommonApi\Controller\AbstractDvsaRestfulController;
use DvsaCommonApiTest\Controller\AbstractRestfulControllerTestCase;
use DvsaCommonTest\TestUtils\XMock;
use DvsaElasticSearch\Service\ElasticSearchService;
use OrganisationApi\Controller\MotTestLogController;
use OrganisationApi\Service\MotTestLogService;
use PHPUnit\Framework\MockObject\MockObject as MockObj;

/**
 * Class MotTestLogControllerTest.
 */
class MotTestLogControllerTest extends AbstractRestfulControllerTestCase
{
    const CONTENT_TYPE_JSON = 'application/json; charset=utf-8';

    const AE_ID = 1;

    /**
     * @var MotTestLogService|MockObj
     */
    private $mockMotTestLogSrv;
    /**
     * @var ElasticSearchService|MockObj
     */
    private $mockEsSrv;
    /**
     * @var EntityManager
     */
    private $mockEntityManager;

    protected function setUp()
    {
        $this->mockMotTestLogSrv = XMock::of(MotTestLogService::class);
        $this->mockEsSrv = XMock::of(ElasticSearchService::class);
        $this->mockEntityManager = XMock::of(EntityManager::class);

        $this->setController(
            new MotTestLogController(
                $this->mockMotTestLogSrv,
                $this->mockEsSrv,
                $this->mockEntityManager
            )
        );

        parent::setUp();
    }

    /**
     * Test access for specified action and parameters.
     *
     * @param string $method HTTP request type (get, post, put)
     * @param string $action Route action
     * @param array  $params Route, post parameters
     * @param array  $mocks  Service Mocks
     * @param array  $expect Expected result
     *
     * @dataProvider dataProviderTestActionsResultAndAccess
     */
    public function testActionsResultAndAccess($method, $action, $params, $mocks, $expect)
    {
        $result = null;

        //  logic block: mock
        if ($mocks !== null) {
            foreach ($mocks as $mock) {
                $this->mockMethod(
                    $this->{$mock['class']}, $mock['method'], $this->once(), $mock['result'], $mock['params']
                );
            }
        }

        //  logic block: check exception
        if (!empty($expect['exception'])) {
            $exception = $expect['exception'];
            $this->expectException($exception['class'], $exception['message'], $exception['code']);
        }

        //  logic block: call
        if (isset($params['postContent'])) {
            $this->request->setContent(json_encode($params['postContent']));
            $this->request->getHeaders()->addHeaderLine('Content-Type', self::CONTENT_TYPE_JSON);
        }

        $result = $this->getResultForAction($method, $action, $params['route']);

        //  logic block: check
        if (isset($expect['error'])) {
            $this->assertResponseStatusAndResultHasError(
                $this->getController()->getResponse(),
                $expect['statusCode'],
                $result,
                $expect['error']['message'],
                $expect['error']['code']
            );
        } else {
            $this->assertResponseStatusAndResult($expect['statusCode'], $expect['result'], $result);
        }
    }

    public function dataProviderTestActionsResultAndAccess()
    {
        $dto = (new MotTestLogSummaryDto())
            ->setYear(1024)
            ->setMonth(1);

        return [
            // get summary
            [
                'method' => 'get',
                'action' => 'summary',
                'params' => [
                    'route' => [
                        'id' => self::AE_ID,
                    ],
                ],
                'mocks' => [
                    [
                        'class' => 'mockMotTestLogSrv',
                        'method' => 'getMotTestLogSummaryForOrganisation',
                        'params' => self::AE_ID,
                        'result' => $dto,
                    ],
                ],
                'expect' => [
                    'statusCode' => self::HTTP_OK_CODE,
                    'result' => ['data' => DtoHydrator::dtoToJson($dto)],
                ],
            ],

            //  get log data :: invalid id
            [
                'method' => 'post',
                'action' => 'logData',
                'params' => [
                    'route' => [
                        'id' => 'invalidId',
                    ],
                ],
                'mocks' => [],
                'expect' => [
                    'statusCode' => self::HTTP_ERR_400,
                    'error' => [
                        'message' => MotTestLogController::ERR_ORG_ID,
                        'code' => AbstractDvsaRestfulController::ERROR_CODE_REQUIRED,
                    ],
                ],
            ],
            //  get log data :: valid id
            [
                'method' => 'post',
                'action' => 'logData',
                'params' => [
                    'route' => [
                        'id' => self::AE_ID,
                        ],
                    'postContent' => DtoHydrator::dtoToJson(new MotTestSearchParamsDto()),
                ],
                'mocks' => [
                    [
                        'class' => 'mockEsSrv',
                        'method' => 'findTestsLog',
                        'params' => null,
                        'result' => 'SERVICE RESULT',
                    ],
                ],
                'expect' => [
                    'statusCode' => self::HTTP_OK_CODE,
                    'result' => ['data' => 'SERVICE RESULT'],
                ],
            ],
        ];
    }
}


text:
package uk.ac.open.crc.intt;

import java.util.ArrayList;
import java.util.List;

/**
 * Provides a simple API
 * for tokenising identifier names.
 *
 * <p>
 * Instances of this class are configured and created by using
 * {@linkplain IdentifierNameTokeniserFactory}.
 * </p>
 *
 */
public final class IdentifierNameTokeniser {

    private final BasicTokeniser basicTokeniser;
    private final SingleCaseTokeniser singleCaseTokeniser;

    private final DictionarySet dictionarySet;

    private final AggregatedDictionary aggregatedDictionary;
    private final ProjectVocabulary projectVocabulary;

    private final int projectVocabularyThreshold;

    private final boolean recursiveSplit;
    private final boolean expandModals;

    private final PrefixConcatenator prefixConcatenator;

    /**
     * Creates an identifier tokeniser.
     * @param dictionarySet a set of dictionaries
     * @param separatorCharacters a {@code String} that will be interpreted as
     * contain a set of separator characters
     * @param vocabularyThreshold a minimum length of a dictionary entity
     * @param recursiveSplit indicates if single character strings should be split
     * @param expandModals indicates if negated modal verbs should be split
     */
    IdentifierNameTokeniser(
            DictionarySet dictionarySet,
            String separatorCharacters,
            int vocabularyThreshold,
            boolean recursiveSplit,
            boolean expandModals) {
        this.dictionarySet = dictionarySet;
        this.basicTokeniser =
                new BasicTokeniser(this.dictionarySet, separatorCharacters);
        this.singleCaseTokeniser =
                new SingleCaseTokeniser(this.dictionarySet);
        this.aggregatedDictionary =
                this.dictionarySet.getAggregatedDictionary();
        this.projectVocabulary = this.dictionarySet.getProjectVocabulary();
        this.projectVocabularyThreshold = vocabularyThreshold;
        this.recursiveSplit = recursiveSplit;
        this.expandModals = expandModals;

        this.prefixConcatenator = new PrefixConcatenator();
    }

    private synchronized List<String> greedySplit(String name) {
        return this.singleCaseTokeniser.split(name);
    }

    /**
     * Tokenises an identifier name, returning a {@code List} of tokens.
     *
     * @param identifierName an identifier name
     *
     * @return a list of tokens
     */
    public synchronized List<String> tokenise(String identifierName) {

        List<String> words = this.basicTokeniser.tokenise(identifierName);

        ArrayList<String> tokens = new ArrayList<>();
        // expand the modals if set
        if ( this.expandModals ) {
            ArrayList<String> modalTokens = new ArrayList<>();
            ModalExpansion expander = ModalExpansion.getInstance();
            boolean modalExpanded = false;

            for (String word : words) {
                if ( expander.isExpandable( word ) ) {
                    modalTokens.addAll( expander.getExpansionFor( word ) );
                    modalExpanded = true;
                }
                else {
                    modalTokens.add( word );
                }
            }

            if ( modalExpanded ) {
                // now copy it all back to words, if altered
                words = modalTokens;
            }
        }

        if ( this.recursiveSplit ) {
            // applies greedysplit to every unrecognised token.
            for (String word : words) {
                if (word.length() > 1
                        && ! this.aggregatedDictionary.isWord( word )
                        && ! word.matches("^.*[0-9]+.*$")) {
                    tokens.addAll( greedySplit( word ) );
                }
                else {
                    tokens.add(word);
                }
            }
        }
        else {
            // the original behaviour from v0.2.0 (i.e. roughly the ECOOP paper behaviour)
            // this only splits a single case identifer name
            if (words.size() == 1
                    && words.get( 0 ).length() > 1
                    && ! this.aggregatedDictionary.isWord( words.get( 0 ) )
                    && ! words.get( 0 ).matches("^.*[0-9]+.*$")) {
                // now use the greedy
                tokens.addAll( greedySplit( words.get( 0 ) ) );
            }
            else {
                tokens.addAll( words );
            }
        }

        tokens.stream()
                .filter( (token) -> ( token.length() > this.projectVocabularyThreshold ) )
                .forEach( (token) -> {
            this.projectVocabulary.add( token );
        } );

        return tokens;
    }

    /**
     * Tokenises an identifier name, returning a {@code List} of tokens each of
     * which lists the word lists in which the token was found.
     *
     * @param identifierName an identifier name
     *
     * @return a list of tokens each with 0..n word lists in which the token
     * was found
     */
    public synchronized List<TaggedToken> tokeniseWithOrigins( String identifierName ) {
        return tagTokens( tokenise( identifierName ) );
    }

    /**
     * Undertakes a naive or conservative tokenisation using separator
     * characters and LCUC boundaries.
     * @param identifierName a name
     * @return a list of tokens resulting from conservative tokenisation
     */
    public synchronized List<String> naiveTokenisation( String identifierName ) {
        return this.basicTokeniser.naiveTokensation( identifierName );
    }

    /**
     * Undertakes a naive or conservative tokenisation using separator
     * characters and LCUC boundaries.
     * @param identifierName a name
     * @return a list of tokens each with a list of the 0..n word lists in which
     * they are found
     */
    public synchronized List<TaggedToken> naiveTokenisationWithOrigins( String identifierName ) {
        return tagTokens( naiveTokenisation( identifierName ) );
    }

    private synchronized List<TaggedToken> tagTokens( List<String> tokenList ) {
        List<TaggedToken> outputList = new ArrayList<>();

        tokenList.forEach(t -> {
            TaggedToken tt = new TaggedToken( t );
            outputList.add( tt );
            this.aggregatedDictionary.tags( t ).forEach( d -> tt.add( d ));  // review this as there seems to be duplication
        });
        return outputList;
    }

    // input is a tokenised identifier name.
    /**
     * Processes a tokenised name joining tokens that have been inadvertently
     * split by the developer. For example, subMenu is tokenised to sub and menu,
     * and this method will revise the tokenisation to submenu.
     * @param tokens a list of tokens from a tokenised name
     * @return a revised list of tokens where prefixes have been concatenated
     * with their orphaned words
     */
    public synchronized List<String> prefixConcatenation( List<String> tokens ) {
        return this.prefixConcatenator.combinePrefixes( tokens );
    }

    /**
     * Expands any contractions of negated modal verbs. For example, cant
     * becomes can not.
     * @param tokens the tokens of a tokenised name
     * @return a revision of the input list with any negated modal verbs expanded
     */
    public synchronized List<String> modalExpansion( List<String> tokens ) {
        ModalExpansion expander = ModalExpansion.getInstance();
        if ( ! expander.containsExpandable( tokens ) ) {
            return tokens;
        }

        ArrayList<String> modalTokens = new ArrayList<>();
        tokens.stream().forEach( (token) -> {
            if ( expander.isExpandable( token ) ) {
                modalTokens.addAll( expander.getExpansionFor( token ) );
            }
            else {
                modalTokens.add( token );
            }
        } );
        return modalTokens;
    }

}


text:
<?php

namespace ChiliLabs\JsonPatch\Operation;

use ChiliLabs\JsonPatch\Exception\OperationException;
use ChiliLabs\JsonPointer\Access\AccessFacade;

/**
 * @author Daniel Tschinder <daniel@tschinder.de>
 */
class AddOperation extends AbstractPatchOperation
{
    const NAME = 'add';

    /**
     * @var mixed
     */
    private $value;

    /**
     * @param string $path
     * @param mixed  $value
     */
    public function __construct($path, $value)
    {
        parent::__construct($path);
        $this->value = $value;
    }

    /**
     * {@inheritdoc}
     */
    public function __invoke($document, AccessFacade $access)
    {
        if ($access->isReadable($document, $this->path) && $access->get($document, $this->path) !== null) {
            throw new OperationException(sprintf('The path "%s" does already exist.', (string) $this->path));
        }

        $access->create($document, $this->path, $this->value);

        return $document;
    }
}


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

<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<TITLE>
org.sword.wechat4j.request
</TITLE>

<META NAME="date" CONTENT="2015-02-03">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">

org.sword.wechat4j.request

类

Item

ScanCodeInfo

SendLocationInfo

SendPicsInfo

WechatRequest


text:
module ExcelFunctions

  def _filtered_range(range, *criteria)
    # Sort out the sum range
    range = [range] unless range.is_a?(Array)
    range = range.flatten

    indexes = _filtered_range_indexes(range, *criteria)
    return indexes if indexes.is_a?(Symbol)
    range.values_at(*indexes)
  end

  def _filtered_range_indexes(range, *criteria)
    # Sort out the criteria
    0.step(criteria.length-1,2).each do |i|
      if criteria[i].is_a?(Array)
        criteria[i] = criteria[i].flatten
      else
        criteria[i] = [criteria[i]]
      end
    end

    filtered = []

    # Work through each part of the sum range
    range.each_with_index do |potential,index|
      #next unless potential.is_a?(Numeric)

      # If a criteria fails, this is set to false and no further criteria are evaluated
      pass = true

      0.step(criteria.length-1,2).each do |i|
        check_range = criteria[i]
        required_value = criteria[i+1] || 0
        if required_value.is_a?(String)
          any_start = required_value.start_with?('*')
          any_end = required_value.end_with?('*')
          if any_start || any_end
            required_value = ".*"+required_value[1..-1] if any_start
            required_value = required_value[0..-2]+".*" if any_end
            required_value = /^#{required_value}$/i
          end
        end
        return :value if index >= check_range.length
        check_value = check_range[index]

        pass = case check_value
        when String
          case required_value
          when String
            check_value.downcase == required_value.downcase
          when Regexp
            check_value =~ required_value
          when Numeric
            begin
              Float(check_value) == required_value.to_f
            rescue ArgumentError
              false
            end
          else
            check_value.downcase == required_value.to_s.downcase
          end
        when true, false
          check_value == required_value
        when nil
          required_value == ""
        when Numeric
          case required_value
          when Numeric
            check_value == required_value
          when String
            required_value =~ /^\s*(<=|>=|<|>)?\s*([-+]?[0-9]+\.?[0-9]*([eE][-+]?[0-9]+)?)\s*$/
            if $1 && $2
              check_value.send($1,$2.to_f)
            elsif $2
              check_value == $2.to_f
            else
              false
            end
          else
            check_value == required_value
          end
        when Symbol
          check_value == required_value
        end # case check_value

        break unless pass
      end # criteria loop

      filtered << index if pass
    end

    return filtered
  end

  def sumifs(range,*criteria)
    filtered = _filtered_range(range,*criteria)
    sum(*filtered)
  end

end


text:
import json

class ApiResponseReader:

	def __init__(self):

		pass

	@staticmethod
	def getResultCode( json_string ):

		rs = ApiResponseReader.parseResultMessage( json_string, "result", "code")

		if rs == None:

			return 600

		return int( rs )

	@staticmethod
	def getResultMessage( json_string ):

		return ApiResponseReader.parseResultMessage( json_string, "result", "message")

	@staticmethod
	def getDataElements( json_string ):

		dat = ApiResponseReader.parseResultMessage( json_string, "data", "list" )

		if dat == None:

			return []

		return dat

	@staticmethod
	def parseResultMessage( json_string, top, name):

		vals = json.loads( json_string)

		if vals.has_key(top) == True:

			if vals[top].has_key(name) == True:

				return vals[top][name]

		return None


text:
package java.net;

/**
 * Represents a family of communication protocols.
 *
 * @since 1.7
 */

public interface ProtocolFamily {
    /**
     * Returns the name of the protocol family.
     */
    String name();
}