text:
<?php

namespace CLI\Command\Permissions;

use Symfony\Component\Finder\Finder;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * Checks application permissions
 *
 * @package CLI
 * @subpackage Permissions
 */
class CheckCommand extends Command
{

    protected function configure()
    {
        $this->setName('permissions:check');
        $this->setDescription('Check file / directory permissions');
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln("Checking file permissions");

        // Check File owner / group
        $dialog = $this->getHelperSet()->get('dialog');
        $ownread = $dialog->ask($output, '<question>What should the owner for readable files be?</question> [username] ', 'username');
        $grpread = $dialog->ask($output, '<question>What should the group for readable directories be?</question> [usergroup] ', 'usergroup');
        $ownwrite = $dialog->ask($output, '<question>What should the owner for writable files be?</question> [www-data] ', 'www-data');
        $grpwrite = $dialog->ask($output, '<question>What should the group for writable directories be?</question> [www-data] ', 'www-data');

        // Check webroot
        $output->writeln("Checking webroot");
        $file = new \SplFileInfo(WEBROOT);
        // owner
        $output->write("Owner");
        $owner = posix_getpwuid($file->getOwner());
        if ($ownread != $owner['name']) {
            $output->writeln(": <error>Webroot is owned by {$owner['name']}</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
        // group
        $output->write("Group");
        $group = posix_getgrgid($file->getGroup());
        if ($grpread != $group['name']) {
            $output->writeln(": <error>Webroot is in group {$group['name']}</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
        // permissions
        $output->write("Permissions");
        $perms = substr(sprintf('%o', $file->getPerms()), -4);
        if ($perms != "0775") {
            $output->writeln(": <error>Webroot should have permissions 0775</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }

        // SYSTEM
        $output->writeln("Checking system folder");
        $file = new \SplFileInfo(SYSTEM);
        // owner
        $output->write("Owner");
        $owner = posix_getpwuid($file->getOwner());
        if ($ownread != $owner['name']) {
            $output->writeln(": <error>System folder is owned by {$owner['name']}</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
        // group
        $output->write("Group");
        $group = posix_getgrgid($file->getGroup());
        if ($grpread != $group['name']) {
            $output->writeln(": <error>System folder is in group {$group['name']}</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
        // permissions
        $output->write("Permissions");
        $perms = substr(sprintf('%o', $file->getPerms()), -4);
        if ($perms != "0775") {
            $output->writeln(": <error>System folder should have permissions 0775</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }

        // Public Files
        $output->writeln("Checking public user files");
        $file = new \SplFileInfo(WEBROOT . DIRECTORY_SEPARATOR . 'userfiles');
        // owner
        $output->write("Owner");
        $owner = posix_getpwuid($file->getOwner());
        if ($ownwrite != $owner['name']) {
            $output->writeln(": <error>Userfiles folder is owned by {$owner['name']}</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
        //group
        $output->write("Group");
        $group = posix_getgrgid($file->getGroup());
        if ($grpwrite != $group['name']) {
            $output->writeln(": <error>Userfiles folder is in group {$group['name']}</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
        // permissions
        $output->write("Permissions");
        $perms = substr(sprintf('%o', $file->getPerms()), -4);
        if ($perms != "0777") {
            $output->writeln(": <error>Userfiles folder should have permissions 0777</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }

        // Private Files
        $output->writeln("Checking private user files");
        $file = new \SplFileInfo(SYSTEM . DIRECTORY_SEPARATOR . 'userfiles');
        // owner
        $output->write("Owner");
        $owner = posix_getpwuid($file->getOwner());
        if ($ownwrite != $owner['name']) {
            $output->writeln(": <error>Userfiles folder is owned by {$owner['name']}</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
        //group
        $output->write("Group");
        $group = posix_getgrgid($file->getGroup());
        if ($grpwrite != $group['name']) {
            $output->writeln(": <error>Userfiles folder is in group {$group['name']}</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
        // permissions
        $output->write("Permissions");
        $perms = substr(sprintf('%o', $file->getPerms()), -4);
        if ($perms != "0777") {
            $output->writeln(": <error>Userfiles folder should have permissions 0777</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }

        // Logs
        $output->writeln("Checking log folder");
        $file = new \SplFileInfo(SYSTEM . DIRECTORY_SEPARATOR . 'logs');
        // owner
        $output->write("Owner");
        $owner = posix_getpwuid($file->getOwner());
        if ($ownwrite != $owner['name']) {
            $output->writeln(": <error>Log folder is owned by {$owner['name']}</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
        //group
        $output->write("Group");
        $group = posix_getgrgid($file->getGroup());
        if ($grpwrite != $group['name']) {
            $output->writeln(": <error>Log folder is in group {$group['name']}</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
        // permissions
        $output->write("Permissions");
        $perms = substr(sprintf('%o', $file->getPerms()), -4);
        if ($perms != "0777") {
            $output->writeln(": <error>Log folder should have permissions 0777</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }

        // Cache
        $output->writeln("Checking cache folder");
        $file = new \SplFileInfo(SYSTEM . DIRECTORY_SEPARATOR . 'cache');
        // owner
        $output->write("Owner");
        $owner = posix_getpwuid($file->getOwner());
        if ($ownwrite != $owner['name']) {
            $output->writeln(": <error>Cache folder is owned by {$owner['name']}</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
        //group
        $output->write("Group");
        $group = posix_getgrgid($file->getGroup());
        if ($grpwrite != $group['name']) {
            $output->writeln(": <error>Cache folder is in group {$group['name']}</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
        // permissions
        $output->write("Permissions");
        $perms = substr(sprintf('%o', $file->getPerms()), -4);
        if ($perms != "0777") {
            $output->writeln(": <error>Cache folder should have permissions 0777</error>");
        } else {
            $output->writeln(": <info>OK</info>");
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
import itertools
from collections import defaultdict
from pycomber.strategies import MergeAbstract

class Manager(MergeAbstract):
    """Merge manager. Needs to be configured before can be used"""

    def __init__(self):
        """Object initialization"""
        self._strategies = defaultdict(dict)
        self._factories = {}

    def set_factory(self, base_type, factory):
        """Sets factory for given base type

        Arguments:
            :param    base_type: base type to cast from
            :type     base_type: type
            :param    factory: factory used to cast variable
            :type     factory: callable
        :returns: Manager -- instance of Manager class (self)
        :raises:  TypeError
        """
        self._factories[base_type] = factory
        return self

    def get_factory(self, base_type):
        """Returns factory function for given base type

        Arguments:
            :param    base_type: type to get factory for
            :type     base_type: type
        :returns: callable -- factory method
        :raises:  KeyError
        """
        return self._factories[base_type]

    def set_strategy(self, strategy, left_type, right_type=None):
        """Sets strategy of merging from left_type to right_type

        One can pass either single type or iterator with list of types.
        If "right_type" is ommited - left type would be duplicated.
        Cartesian product of left_type x right_type would be generated
        and all pairs would be used to define strategy for.

        Arguments
            :param    strategy: strategy of merging left_type to right_type
            :type     strategy: callable
            :param    left_type: type to merge from
            :type     left_type: type | iterable
            :param    right_type: type to merge to
            :type     right_type: type | iterable
        :returns: Manager -- instance of Manager class (self)
        """
        for (l, r) in self._cartesian_product(left_type, right_type):
            self._strategies[l][r] = strategy
        return self

    def get_strategy(self, left_type, right_type):
        """Returns merging strategy for left_type (from) and right_type (to)

        Arguments:
            :param    left_type: merge from this type
            :type     left_type: type
            :param    right_type: merge to this type
            :type     right_type: type
        :returns: callable -- factory method
        :raises:  TypeError
        """
        try:
            return self._strategies[left_type][right_type]
        except KeyError:
            raise TypeError("Missing strategy for types %s and %s" % \
                                                        (left_type, right_type))

    def _cartesian_product(self, left_type, right_type):
        """Makes cartesiam product of left_type x right_type

        Arguments:
            :param    left_type: merge from this type
            :type     left_type: type | iterator
            :param    right_type: merge to this type
            :type     right_type: type | iterator
        :returns: generator -- cartesian product of left_type x right_type
        """
        lt = self._variable_as_set(left_type)
        if right_type is None:
            rt = lt
        else:
            rt = self._variable_as_set(right_type)
        return itertools.product(lt, rt)

    def _variable_as_set(self, var):
        """If given variable is iterator - returns this varialbe.
        Otherwise creates iterator containing this one variable

        Arguments:
            :param    var: variable to cast to generator
            :type     var: type | iterator
        :returns: generator
        """
        try:
            len(var)
        except TypeError:
            return set([var])
        else:
            return var

    def __call__(self, merge_from=None, merge_to=None):
        """Merges given instances merge_from and merge_to.
        Creates new instances during merge process.

        Arguments:
            :param    merge_from: merge from this object
            :type     merge_from: object
            :param    merge_to: merge to this object
            :type     merge_to: object
        :returns: object
        :raises: TypeError
        """
        (left_type, right_type) = (type(merge_from), type(merge_to))
        strategy = self.get_strategy(left_type, right_type)
        return self._cast(strategy(merge_from, merge_to))

    def _cast(self, var):
        """Casts given variable using predefined factory (if available)

        Arguments:
            :param    var: variable to cast
            :type     var: type
        :returns: object
        """
        try:
            return self.get_factory(type(var))(var)
        except KeyError:
            return var


text:
import React, {PropTypes} from 'react';
import {max} from 'd3-array';
import {scaleBand, scaleLinear} from 'd3-scale';
import Sandbox from '../common/Sandbox';
import Bars from './Bars';

export default class BarChart extends React.Component {

	static propTypes = {
		width: PropTypes.number,
		height: PropTypes.number,
		data: PropTypes.array.isRequired
	};

	static defaultProps = {
		width: 600,
		height: 400
	};

	render() {
		const {width, height, data} = this.props;

		const xScale = scaleBand()
							.domain(data.map(d => d.name))
							.rangeRound([0, width], true)
							.paddingInner(.1);

		const yScale = scaleLinear()
							.domain([0, max(data, d => d.value)])
							.range([height, 0]);

		return <Sandbox width={width} height={height}>
					<Bars data={data} width={width} height={height} xScale={xScale} yScale={yScale} />
				</Sandbox>;
	}
};


text:
/* First created by JCasGen Wed Mar 23 19:38:34 CET 2016 */
package de.tudarmstadt.ukp.dkpro.core.discourse.pdtb;

import org.apache.uima.cas.Feature;
import org.apache.uima.cas.FeatureStructure;
import org.apache.uima.cas.Type;
import org.apache.uima.cas.impl.CASImpl;
import org.apache.uima.cas.impl.FSGenerator;
import org.apache.uima.cas.impl.FeatureImpl;
import org.apache.uima.cas.impl.TypeImpl;
import org.apache.uima.jcas.JCas;
import org.apache.uima.jcas.JCasRegistry;
import org.apache.uima.jcas.tcas.Annotation_Type;

/** Discourse relation
 * Updated by JCasGen Wed Mar 23 19:38:34 CET 2016
 * @generated */
public class DiscourseRelation_Type extends Annotation_Type {
  /** @generated */
  @Override
  protected FSGenerator getFSGenerator() {return fsGenerator;}
  /** @generated */
  private final FSGenerator fsGenerator =
    new FSGenerator() {
      public FeatureStructure createFS(int addr, CASImpl cas) {
  			 if (DiscourseRelation_Type.this.useExistingInstance) {
  			   // Return eq fs instance if already created
  		     FeatureStructure fs = DiscourseRelation_Type.this.jcas.getJfsFromCaddr(addr);
  		     if (null == fs) {
  		       fs = new DiscourseRelation(addr, DiscourseRelation_Type.this);
  			   DiscourseRelation_Type.this.jcas.putJfsFromCaddr(addr, fs);
  			   return fs;
  		     }
  		     return fs;
        } else return new DiscourseRelation(addr, DiscourseRelation_Type.this);
  	  }
    };
  /** @generated */
  @SuppressWarnings ("hiding")
  public final static int typeIndexID = DiscourseRelation.typeIndexID;
  /** @generated
     @modifiable */
  @SuppressWarnings ("hiding")
  public final static boolean featOkTst = JCasRegistry.getFeatOkTst("de.tudarmstadt.ukp.dkpro.core.discourse.pdtb.DiscourseRelation");

  /** @generated */
  final Feature casFeat_relationId;
  /** @generated */
  final int     casFeatCode_relationId;
  /** @generated */
  public int getRelationId(int addr) {
        if (featOkTst && casFeat_relationId == null)
      jcas.throwFeatMissing("relationId", "de.tudarmstadt.ukp.dkpro.core.discourse.pdtb.DiscourseRelation");
    return ll_cas.ll_getIntValue(addr, casFeatCode_relationId);
  }
  /** @generated */
  public void setRelationId(int addr, int v) {
        if (featOkTst && casFeat_relationId == null)
      jcas.throwFeatMissing("relationId", "de.tudarmstadt.ukp.dkpro.core.discourse.pdtb.DiscourseRelation");
    ll_cas.ll_setIntValue(addr, casFeatCode_relationId, v);}

  /** @generated */
  final Feature casFeat_arg1;
  /** @generated */
  final int     casFeatCode_arg1;
  /** @generated */
  public int getArg1(int addr) {
        if (featOkTst && casFeat_arg1 == null)
      jcas.throwFeatMissing("arg1", "de.tudarmstadt.ukp.dkpro.core.discourse.pdtb.DiscourseRelation");
    return ll_cas.ll_getRefValue(addr, casFeatCode_arg1);
  }
  /** @generated */
  public void setArg1(int addr, int v) {
        if (featOkTst && casFeat_arg1 == null)
      jcas.throwFeatMissing("arg1", "de.tudarmstadt.ukp.dkpro.core.discourse.pdtb.DiscourseRelation");
    ll_cas.ll_setRefValue(addr, casFeatCode_arg1, v);}

  /** @generated */
  final Feature casFeat_arg2;
  /** @generated */
  final int     casFeatCode_arg2;
  /** @generated */
  public int getArg2(int addr) {
        if (featOkTst && casFeat_arg2 == null)
      jcas.throwFeatMissing("arg2", "de.tudarmstadt.ukp.dkpro.core.discourse.pdtb.DiscourseRelation");
    return ll_cas.ll_getRefValue(addr, casFeatCode_arg2);
  }
  /** @generated */
  public void setArg2(int addr, int v) {
        if (featOkTst && casFeat_arg2 == null)
      jcas.throwFeatMissing("arg2", "de.tudarmstadt.ukp.dkpro.core.discourse.pdtb.DiscourseRelation");
    ll_cas.ll_setRefValue(addr, casFeatCode_arg2, v);}

  /** initialize variables to correspond with Cas Type and Features
	* @generated */
  public DiscourseRelation_Type(JCas jcas, Type casType) {
    super(jcas, casType);
    casImpl.getFSClassRegistry().addGeneratorForType((TypeImpl)this.casType, getFSGenerator());

    casFeat_relationId = jcas.getRequiredFeatureDE(casType, "relationId", "uima.cas.Integer", featOkTst);
    casFeatCode_relationId  = (null == casFeat_relationId) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_relationId).getCode();

    casFeat_arg1 = jcas.getRequiredFeatureDE(casType, "arg1", "de.tudarmstadt.ukp.dkpro.core.discourse.pdtb.DiscourseArgument", featOkTst);
    casFeatCode_arg1  = (null == casFeat_arg1) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_arg1).getCode();

    casFeat_arg2 = jcas.getRequiredFeatureDE(casType, "arg2", "de.tudarmstadt.ukp.dkpro.core.discourse.pdtb.DiscourseArgument", featOkTst);
    casFeatCode_arg2  = (null == casFeat_arg2) ? JCas.INVALID_FEATURE_CODE : ((FeatureImpl)casFeat_arg2).getCode();

  }
}


text:
<?php

namespace SugarCli\Console\Command\Package;

use Inet\SugarCRM\Exception\SugarException;
use SugarCli\Console\Command\AbstractConfigOptionCommand;
use SugarCli\Console\ExitCode;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Filesystem\Filesystem;

class ScanCommand extends AbstractConfigOptionCommand
{
    protected function configure()
    {
        $this->setName('package:scan')
            ->setDescription('Scan a package for SugarCRM Cloud compatibility')
            ->setHelp(<<<EOHELP
Use the SugarCRM package scanner to find incompatibilities with SugarCRM Cloud hosting.
EOHELP
            )
            ->enableStandardOption('path')
            ->enableStandardOption('user-id')
            ->addArgument(
                'package',
                InputArgument::REQUIRED,
                'Package file to scan'
            );
    }

    protected function extractZip($file)
    {
        $fs = new Filesystem();
        $tmp_dir = sys_get_temp_dir() . '/package_scanner_' . md5_file($file);
        $fs->mkdir($tmp_dir);
        $zip = new \ZipArchive();
        if ($zip->open($file) === true) {
            $zip->extractTo($tmp_dir);
            $zip->close();
        } else {
            throw new RuntimeException('Unable to open file "$file"');
        }
        return $tmp_dir;
    }

    protected function scanPackageDir($path)
    {
        $this->getService('sugarcrm.entrypoint');
        global $mod_strings;
        require_once('ModuleInstall/ModuleScanner.php');
        $mod_strings = return_module_language('en_us', 'Administration');

        $module_scanner = new \ModuleScanner();
        $module_scanner->scanPackage($path);
        $fs = new Filesystem();
        $fs->remove($path);
        if ($module_scanner->hasIssues() === true) {
            return $module_scanner->getIssues();
        }
        return false;
    }

    protected function printIssues($path, $issues_data, $output)
    {
        foreach ($issues_data as $type => $issues) {
            $output->writeln(' → <comment>'.ucfirst($type).'</comment>:');
            foreach ($issues as $file_path => $issue) {
                $relative_path = str_replace($path . '/', '', $file_path);
                $output->write('    • <comment>'.$relative_path.'</comment>: ');
                if (is_array($issue)) {
                    $output->writeln('');
                    foreach ($issue as $reason) {
                        $output->writeln('       - '.$reason);
                    }
                } else {
                    $output->writeln($issue);
                }
            }
        }
    }

    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $zip_file = $input->getArgument('package');
        if (!is_readable($zip_file)) {
            $output->writeln("<error>File '$php_file' not found or unreadable!</error>");
            return ExitCode::EXIT_FILE_NOT_FOUND;
        }
        $tmp_dir = $this->extractZip($zip_file);
        try {
            $issues_data = $this->scanPackageDir($tmp_dir);
            if (!empty($issues_data)) {
                $this->printIssues($tmp_dir, $issues_data, $output);
                return ExitCode::EXIT_PACKAGE_SCAN_ERROR;
            }
            $output->writeln('Your package is compatible with SugarCRM Cloud');
        } catch (SugarException $e) {
            $output->writeln('<error>' . $e . '</error>');
            return ExitCode::EXIT_UNKNOWN_SUGAR_ERROR;
        }
    }
}


text:
<?="\n\n"?>
<?
header('Content-Type: text/html; charset=utf-8');
date_default_timezone_set('Europe/Madrid');
?>
<?
echo "PHP_OS: ".PHP_OS."
";
echo "Interface con el servdor web (php_sapi_name()): ".php_sapi_name();
?>

<?
echo "Propietario del fichero ejecutado: ".get_current_user();
?>

<?
echo "Usuario bajo el que corre el script (whoami): ".exec('whoami');
?>

<?
/* PHP 5.4.0 para usarlas en fastcgi
echo "Lista de cabeceras de request(var_dump(apache_request_headers())): ";
var_dump(apache_request_headers());
echo "Lista de cabeceras de response (var_dump(apache_request_headers())): ";
var_dump(apache_response_headers());
*/
echo "Lista de cabeceras de response (var_dump(headers_list())): ";
echo '
';
var_dump(headers_list());
echo "
";
?>

<?
echo "Configuración regional actual (setlocale(LC_ALL, 0)): ".setlocale(LC_ALL, 0);
echo " -> Prueba de locale (22/12/1978 13:14:15): ".strftime("%A %e %B %Y", mktime(13, 14, 15, 12, 22, 1978));
echo "
";
echo "Configuración regional: Cambiando a es_ES (setlocale(LC_ALL, 'es_ES')): ".setlocale(LC_ALL, 'es_ES');
echo " -> Prueba de locale (22/12/1978 13:14:15): ".strftime("%A %e %B %Y", mktime(13, 14, 15, 12, 22, 1978));
?>

<?
echo "Proceso de hash salteado sha256: ";
$pass="12345678";
$salt=hash('sha256', uniqid(mt_rand(), true));
$hash=$salt.hash('sha256',$salt.$pass);
echo $hash."
";
//los primeros 64 caracteres del hash son el salt usado para este pass
//que deberemos recuperar para juntar con el pass introducido y comprobar

?>

get_loaded_extensions() + get_loaded_extensions(true):
<?
echo "
".print_r(array_merge(get_loaded_extensions(),get_loaded_extensions(true)),true)."
";
?>

phpinfo:
<?
ob_start();
phpinfo();
$phpinfoResult=ob_get_clean();
preg_match_all("=]*>(.*)=siU", $phpinfoResult, $a);
$phpinfo = $a[1][0];
/*
$phpinfo = str_replace( 'width="600"', 'width="750"', $phpinfo );
$phpinfo = str_replace( 'border="0" cellpadding', 'class="x" border="0" cellpadding', $phpinfo );
$phpinfo = str_replace( '', '
', $phpinfo );
$phpinfo = str_replace( '', '
', $phpinfo );
$phpinfo = str_replace( '', '
', $phpinfo );
$phpinfo = str_replace( '	', '
	', $phpinfo );
*/
echo '
'.PHP_EOL.$phpinfo.PHP_EOL.'
';
?>
<?="\n\n"?>


text:
namespace OpenQA.Selenium.DevTools.DOMDebugger
{
    using Newtonsoft.Json;

    /// <summary>
    /// Removes breakpoint on particular DOM event.
    /// </summary>
    public sealed class RemoveEventListenerBreakpointCommandSettings : ICommand
    {
        private const string DevToolsRemoteInterface_CommandName = "DOMDebugger.removeEventListenerBreakpoint";

        [JsonIgnore]
        public string CommandName
        {
            get { return DevToolsRemoteInterface_CommandName; }
        }

        /// <summary>
        /// Event name.
        /// </summary>
        [JsonProperty("eventName")]
        public string EventName
        {
            get;
            set;
        }
        /// <summary>
        /// EventTarget interface name.
        /// </summary>
        [JsonProperty("targetName", DefaultValueHandling = DefaultValueHandling.Ignore)]
        public string TargetName
        {
            get;
            set;
        }
    }

    public sealed class RemoveEventListenerBreakpointCommandResponse : ICommandResponse<RemoveEventListenerBreakpointCommandSettings>
    {
    }
}


text:
			 // improvements in apps as a result.
#endif

namespace eastl
{
	///////////////////////////////////////////////////////////////////////////
	/// overloaded
	///
	/// A helper class that permits you to combine multiple function objects into one.
	/// Typically, this helper is really handy when visiting an eastl::variant with multiple lambdas.
	/// Example:
	///
	/// eastl::variant<int, string> v{42};
	///
	/// eastl::visit(
	///	 eastl::overloaded{
	///		  [](const int& x) { std::cout << "Visited an integer: " << x  << "\n"; }, // Will reach that lambda with x == 42.
	///		  [](const string& s) { std::cout << "Visited an string: " << s  << "\n"; }
	///	 },
	///	 v
	/// );
	///////////////////////////////////////////////////////////////////////////
	template <class... T>
	struct overloaded;

	template <class T>
	struct overloaded<T> : T
	{
		template <class U>
		EA_CPP14_CONSTEXPR overloaded(U&& u) : T(eastl::forward<U>(u))
		{
		}

		using T::operator();
	};

	template <class T, class... R>
	struct overloaded<T, R...> : T, overloaded<R...>
	{
		template <class U, class... V>
		EA_CPP14_CONSTEXPR overloaded(U&& u, V&&... v) : T(eastl::forward<U>(u)), overloaded<R...>(eastl::forward<V>(v)...)
		{
		}

		using T::operator();
		using overloaded<R...>::operator();
	};

	#ifdef __cpp_deduction_guides
	template <class... T>
	overloaded(T...) -> overloaded<T...>;
	#endif

	///////////////////////////////////////////////////////////////////////////
	/// make_overloaded
	///
	/// Helper function to create an overloaded instance when lacking deduction guides.
	/// make_overloaded(f1, f2, f3) == overloaded{f1, f2, f3}
	///////////////////////////////////////////////////////////////////////////
	template <class... T>
	EA_CPP14_CONSTEXPR overloaded<typename eastl::remove_cvref<T>::type...> make_overloaded(T&&... t)
	{
		return overloaded<typename eastl::remove_cvref<T>::type...>{eastl::forward<T>(t)...};
	}

} // namespace eastl

#endif // EASTL_OVERLOADED_H


text:
package main

import (
	"fmt"
	"io/ioutil"
	"strings"
	"time"

	"golang.org/x/oauth2"

	"github.com/golang/glog"
	"github.com/google/go-github/github"
	"github.com/spf13/cobra"
)

// Client can be used to run commands again Github API
type Client struct {
	Token     string
	TokenFile string
	Org       string
	Project   string

	githubClient *github.Client
}

const (
	tokenLimit = 50 // We try to stop that far from the API limit
)

// AddFlags parses options for github client
func (client *Client) AddFlags(cmd *cobra.Command) {
	cmd.PersistentFlags().StringVar(&client.Token, "token", "",
		"The OAuth Token to use for requests.")
	cmd.PersistentFlags().StringVar(&client.TokenFile, "token-file", "",
		"The file containing the OAuth Token to use for requests.")
	cmd.PersistentFlags().StringVar(&client.Org, "organization", "",
		"The github organization to scan")
	cmd.PersistentFlags().StringVar(&client.Project, "project", "",
		"The github project to scan")
}

func (client *Client) CheckFlags() error {
	if client.Org == "" {
		return fmt.Errorf("organization flag must be set")
	}
	client.Org = strings.ToLower(client.Org)

	if client.Project == "" {
		return fmt.Errorf("project flag must be set")
	}
	client.Project = strings.ToLower(client.Project)

	return nil
}

// Create the github client that we use to communicate with github
func (client *Client) getGithubClient() (*github.Client, error) {
	if client.githubClient != nil {
		return client.githubClient, nil
	}
	token := client.Token
	if len(token) == 0 && len(client.TokenFile) != 0 {
		data, err := ioutil.ReadFile(client.TokenFile)
		if err != nil {
			return nil, err
		}
		token = strings.TrimSpace(string(data))
	}

	if len(token) > 0 {
		ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: token})
		tc := oauth2.NewClient(oauth2.NoContext, ts)
		client.githubClient = github.NewClient(tc)
	} else {
		client.githubClient = github.NewClient(nil)
	}
	return client.githubClient, nil
}

// Make sure we have not reached the limit or wait
func (client *Client) limitsCheckAndWait() {
	var sleep time.Duration
	githubClient, err := client.getGithubClient()
	if err != nil {
		glog.Error("Failed to get RateLimits: ", err)
		sleep = time.Minute
	} else {
		limits, _, err := githubClient.RateLimits()
		if err != nil {
			glog.Error("Failed to get RateLimits:", err)
			sleep = time.Minute
		}
		if limits != nil && limits.Core != nil && limits.Core.Remaining < tokenLimit {
			sleep = limits.Core.Reset.Sub(time.Now())
			glog.Warning("RateLimits: reached. Sleeping for ", sleep)
		}
	}

	time.Sleep(sleep)
}

// ClientInterface describes what a client should be able to do
type ClientInterface interface {
	RepositoryName() string
	FetchIssues(time.Time, chan *github.Issue)
	FetchIssueEvents(*int, chan *github.IssueEvent)
	FetchIssueComments(int, time.Time, chan *github.IssueComment)
	FetchPullComments(int, time.Time, chan *github.PullRequestComment)
}

func (client *Client) RepositoryName() string {
	return fmt.Sprintf("%s/%s", client.Org, client.Project)
}

// FetchIssues from Github, until 'latest' time
func (client *Client) FetchIssues(latest time.Time, c chan *github.Issue) {
	opt := &github.IssueListByRepoOptions{Since: latest, Sort: "updated", State: "all", Direction: "asc"}

	githubClient, err := client.getGithubClient()
	if err != nil {
		close(c)
		glog.Error(err)
		return
	}

	count := 0
	for {
		client.limitsCheckAndWait()

		issues, resp, err := githubClient.Issues.ListByRepo(client.Org, client.Project, opt)
		if err != nil {
			close(c)
			glog.Error(err)
			return
		}

		for _, issue := range issues {
			c <- issue
			count++
		}

		if resp.NextPage == 0 {
			break
		}
		opt.ListOptions.Page = resp.NextPage
	}

	glog.Infof("Fetched %d issues updated issue since %v.", count, latest)
	close(c)
}

// Look for a specific Id in a list of events
func hasID(events []*github.IssueEvent, ID int) bool {
	for _, event := range events {
		if *event.ID == ID {
			return true
		}
	}
	return false
}

// FetchIssueEvents from github and return the full list, until it matches 'latest'
// The entire last page will be included so you can have redundancy.
func (client *Client) FetchIssueEvents(latest *int, c chan *github.IssueEvent) {
	opt := &github.ListOptions{PerPage: 100}

	githubClient, err := client.getGithubClient()
	if err != nil {
		close(c)
		glog.Error(err)
		return
	}

	count := 0
	for {
		client.limitsCheckAndWait()

		events, resp, err := githubClient.Issues.ListRepositoryEvents(client.Org, client.Project, opt)
		if err != nil {
			glog.Error("Request failed. Wait before trying again.")
			time.Sleep(time.Second)
			continue
		}

		for _, event := range events {
			c <- event
			count++
		}
		if resp.NextPage == 0 || (latest != nil && hasID(events, *latest)) {
			break
		}
		opt.Page = resp.NextPage
	}

	glog.Infof("Fetched %d events.", count)
	close(c)
}

// FetchIssueComments fetches comments associated to given Issue (since latest)
func (client *Client) FetchIssueComments(issueID int, latest time.Time, c chan *github.IssueComment) {
	opt := &github.IssueListCommentsOptions{Since: latest, Sort: "updated", Direction: "asc"}

	githubClient, err := client.getGithubClient()
	if err != nil {
		close(c)
		glog.Error(err)
		return
	}

	count := 0
	for {
		client.limitsCheckAndWait()

		comments, resp, err := githubClient.Issues.ListComments(client.Org, client.Project, issueID, opt)
		if err != nil {
			close(c)
			glog.Error(err)
			return
		}

		for _, comment := range comments {
			c <- comment
			count++
		}
		if resp.NextPage == 0 {
			break
		}
		opt.ListOptions.Page = resp.NextPage
	}

	glog.Infof("Fetched %d issue comments updated since %v for issue #%d.", count, latest, issueID)
	close(c)
}

// FetchPullComments fetches comments associated to given PullRequest (since latest)
func (client *Client) FetchPullComments(issueID int, latest time.Time, c chan *github.PullRequestComment) {
	opt := &github.PullRequestListCommentsOptions{Since: latest, Sort: "updated", Direction: "asc"}

	githubClient, err := client.getGithubClient()
	if err != nil {
		close(c)
		glog.Error(err)
		return
	}

	count := 0
	for {
		client.limitsCheckAndWait()

		comments, resp, err := githubClient.PullRequests.ListComments(client.Org, client.Project, issueID, opt)
		if err != nil {
			close(c)
			glog.Error(err)
			return
		}

		for _, comment := range comments {
			c <- comment
			count++
		}
		if resp.NextPage == 0 {
			break
		}
		opt.ListOptions.Page = resp.NextPage
	}

	glog.Infof("Fetched %d review comments updated since %v for issue #%d.", count, latest, issueID)
	close(c)
}


text:
module GoogleAnymote
  # Gem version
  VERSION = "0.0.5"
end


text:
<?xml version="1.0" encoding="UTF-8"?>
<methodCall>
 <methodName>bigintParam</methodName>
 <params>
  <param>
   <value>
    <ex:biginteger xmlns:ex="http://ws.apache.org/xmlrpc/namespaces/extensions">9223372036854775808</ex:biginteger>
   </value>
  </param>
 </params>
</methodCall>


text:
namespace shell {

namespace {
#if defined(OS_LINUX)
char kArchitecture[] = "linux-x64";
#elif defined(OS_ANDROID)
char kArchitecture[] = "android-arm";
#else
#error "Unsupported."
#endif
};

NetworkFetcher::NetworkFetcher(
    bool disable_cache,
    bool predictable_app_filenames,
    const GURL& url,
    mojo::NetworkService* network_service,
    mojo::URLResponseDiskCache* url_response_disk_cache,
    const FetchCallback& loader_callback)
    : Fetcher(loader_callback),
      disable_cache_(disable_cache),
      predictable_app_filenames_(predictable_app_filenames),
      url_(url),
      url_response_disk_cache_(url_response_disk_cache),
      weak_ptr_factory_(this) {
  StartNetworkRequest(url, network_service);
}

NetworkFetcher::~NetworkFetcher() {
}

const GURL& NetworkFetcher::GetURL() const {
  return url_;
}

GURL NetworkFetcher::GetRedirectURL() const {
  if (!response_)
    return GURL::EmptyGURL();

  if (response_->redirect_url.is_null())
    return GURL::EmptyGURL();

  return GURL(response_->redirect_url);
}

mojo::URLResponsePtr NetworkFetcher::AsURLResponse(
    base::TaskRunner* task_runner,
    uint32_t skip) {
  if (skip != 0) {
    MojoResult result = ReadDataRaw(
        response_->body.get(), nullptr, &skip,
        MOJO_READ_DATA_FLAG_ALL_OR_NONE | MOJO_READ_DATA_FLAG_DISCARD);
    DCHECK_EQ(result, MOJO_RESULT_OK);
  }
  return response_.Pass();
}

void NetworkFetcher::RecordCacheToURLMapping(const base::FilePath& path,
                                             const GURL& url) {
  // This is used to extract symbols on android.
  // TODO(eseidel): All users of this log should move to using the map file.
  LOG(INFO) << "Caching mojo app " << url << " at " << path.value();

  base::FilePath temp_dir;
  base::GetTempDir(&temp_dir);
  base::ProcessId pid = base::Process::Current().Pid();
  std::string map_name = base::StringPrintf("mojo_shell.%d.maps", pid);
  base::FilePath map_path = temp_dir.Append(map_name);

  // TODO(eseidel): Paths or URLs with spaces will need quoting.
  std::string map_entry =
      base::StringPrintf("%s %s\n", path.value().c_str(), url.spec().c_str());
  // TODO(eseidel): AppendToFile is missing O_CREAT, crbug.com/450696
  if (!PathExists(map_path))
    base::WriteFile(map_path, map_entry.data(), map_entry.length());
  else
    base::AppendToFile(map_path, map_entry.data(), map_entry.length());
}

// For remote debugging, GDB needs to be, a apriori, aware of the filename a
// library will be loaded from. AppIds should be be both predictable and unique,
// but any hash would work. Currently we use sha256 from crypto/secure_hash.h
bool NetworkFetcher::ComputeAppId(const base::FilePath& path,
                                  std::string* digest_string) {
  scoped_ptr<crypto::SecureHash> ctx(
      crypto::SecureHash::Create(crypto::SecureHash::SHA256));
  base::File file(path, base::File::FLAG_OPEN | base::File::FLAG_READ);
  if (!file.IsValid()) {
    LOG(ERROR) << "Failed to open " << path.value() << " for computing AppId";
    return false;
  }
  char buf[1024];
  while (file.IsValid()) {
    int bytes_read = file.ReadAtCurrentPos(buf, sizeof(buf));
    if (bytes_read == 0)
      break;
    ctx->Update(buf, bytes_read);
  }
  if (!file.IsValid()) {
    LOG(ERROR) << "Error reading " << path.value();
    return false;
  }
  // The output is really a vector of unit8, we're cheating by using a string.
  std::string output(crypto::kSHA256Length, 0);
  ctx->Finish(string_as_array(&output), output.size());
  output = base::HexEncode(output.c_str(), output.size());
  // Using lowercase for compatiblity with sha256sum output.
  *digest_string = base::StringToLowerASCII(output);
  return true;
}

bool NetworkFetcher::RenameToAppId(const GURL& url,
                                   const base::FilePath& old_path,
                                   base::FilePath* new_path) {
  std::string app_id;
  if (!ComputeAppId(old_path, &app_id))
    return false;

  // Using a hash of the url as a directory to prevent a race when the same
  // bytes are downloaded from 2 different urls. In particular, if the same
  // application is connected to twice concurrently with different query
  // parameters, the directory will be different, which will prevent the
  // collision.
  std::string dirname = base::HexEncode(
      crypto::SHA256HashString(url.spec()).data(), crypto::kSHA256Length);

  base::FilePath temp_dir;
  base::GetTempDir(&temp_dir);
  base::FilePath app_dir = temp_dir.Append(dirname);
  // The directory is leaked, because it can be reused at any time if the same
  // application is downloaded. Deleting it would be racy. This is only
  // happening when --predictable-app-filenames is used.
  bool result = base::CreateDirectoryAndGetError(app_dir, nullptr);
  DCHECK(result);
  std::string unique_name = base::StringPrintf("%s.mojo", app_id.c_str());
  *new_path = app_dir.Append(unique_name);
  return base::Move(old_path, *new_path);
}

void NetworkFetcher::OnFileRetrievedFromCache(
    base::Callback<void(const base::FilePath&, bool)> callback,
    mojo::Array<uint8_t> path_as_array,
    mojo::Array<uint8_t> cache_dir) {
  bool success = !path_as_array.is_null();
  if (success) {
    path_ = base::FilePath(std::string(
        reinterpret_cast<char*>(&path_as_array.front()), path_as_array.size()));
    if (predictable_app_filenames_) {
      // The copy completed, now move to $TMP/$APP_ID.mojo before the dlopen.
      base::FilePath new_path;
      if (RenameToAppId(url_, path_, &new_path)) {
        if (base::PathExists(new_path)) {
          path_ = new_path;
          success = true;
        }
      }
    }
  }

  if (success)
    RecordCacheToURLMapping(path_, url_);

  base::MessageLoop::current()->PostTask(FROM_HERE,
                                         base::Bind(callback, path_, success));
}

void NetworkFetcher::AsPath(
    base::TaskRunner* task_runner,
    base::Callback<void(const base::FilePath&, bool)> callback) {
  // This should only called once, when we have a response.
  DCHECK(response_.get());

  url_response_disk_cache_->GetFile(
      response_.Pass(), base::Bind(&NetworkFetcher::OnFileRetrievedFromCache,
                                   weak_ptr_factory_.GetWeakPtr(), callback));
}

std::string NetworkFetcher::MimeType() {
  return response_->mime_type;
}

bool NetworkFetcher::HasMojoMagic() {
  std::string magic;
  return BlockingPeekNBytes(response_->body.get(), &magic, strlen(kMojoMagic),
                            kPeekTimeout) &&
         magic == kMojoMagic;
}

bool NetworkFetcher::PeekFirstLine(std::string* line) {
  return BlockingPeekLine(response_->body.get(), line, kMaxShebangLength,
                          kPeekTimeout);
}

void NetworkFetcher::StartNetworkRequest(
    const GURL& url,
    mojo::NetworkService* network_service) {
  TRACE_EVENT_ASYNC_BEGIN1("mojo_shell", "NetworkFetcher::NetworkRequest", this,
                           "url", url.spec());
  mojo::URLRequestPtr request(mojo::URLRequest::New());
  request->url = mojo::String::From(url);
  request->auto_follow_redirects = false;
  request->bypass_cache = disable_cache_;
  mojo::Array<mojo::String> headers(1);
  headers[0] = base::StringPrintf("X-Architecture: %s", kArchitecture);
  request->headers = headers.Pass();

  network_service->CreateURLLoader(mojo::GetProxy(&url_loader_));
  url_loader_->Start(request.Pass(),
                     base::Bind(&NetworkFetcher::OnLoadComplete,
                                weak_ptr_factory_.GetWeakPtr()));
}

void NetworkFetcher::OnLoadComplete(mojo::URLResponsePtr response) {
  TRACE_EVENT_ASYNC_END0("mojo_shell", "NetworkFetcher::NetworkRequest", this);
  scoped_ptr<Fetcher> owner(this);
  if (response->error) {
    LOG(ERROR) << "Error (" << response->error->code << ": "
               << response->error->description << ") while fetching "
               << response->url;
    loader_callback_.Run(nullptr);
    return;
  }

  if (response->status_code >= 400 && response->status_code < 600) {
    LOG(ERROR) << "Error (" << response->status_code << ": "
               << response->status_line << "): "
               << "while fetching " << response->url;
    loader_callback_.Run(nullptr);
    return;
  }

  response_ = response.Pass();
  loader_callback_.Run(owner.Pass());
}

}  // namespace shell


text:
package org.quartz.core;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import org.quartz.exceptions.SchedulerConfigException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 *

 * This is class is a simple implementation of a thread pool, based on the {@link org.quartz.core.ThreadPool} interface.
 *

 *

 * Runnable objects are sent to the pool with the {@link #runInThread(Runnable)} method, which blocks until a
 * Thread becomes available.
 *

 *

 * The pool has a fixed number of Threads, and does not grow or shrink based on demand.
 *

 *
 * @author James House
 * @author Juergen Donnerstag
 */
public class SimpleThreadPool implements ThreadPool {

  /*
   * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Data members.
   * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   */

  private int count = -1;

  private int prio = Thread.NORM_PRIORITY;

  private boolean isShutdown = false;
  private boolean handoffPending = false;

  private boolean inheritLoader = false;

  private boolean inheritGroup = true;

  private boolean makeThreadsDaemons = false;

  private ThreadGroup threadGroup;

  private final Object nextRunnableLock = new Object();

  private List<WorkerThread> workers;
  private LinkedList<WorkerThread> availWorkers = new LinkedList<WorkerThread>();
  private LinkedList<WorkerThread> busyWorkers = new LinkedList<WorkerThread>();

  private String threadNamePrefix;

  private final Logger log = LoggerFactory.getLogger(getClass());

  private String schedulerInstanceName;

  /*
   * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Constructors.
   * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   */

  /**
   *

   * Create a new (unconfigured) SimpleThreadPool.
   *

   *
   * @see #setThreadCount(int)
   * @see #setThreadPriority(int)
   */
  public SimpleThreadPool() {

  }

  /*
   * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Interface.
   * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   */

  public Logger getLog() {

    return log;
  }

  @Override
  public int getPoolSize() {

    return getThreadCount();
  }

  /**
   *

   * Set the number of worker threads in the pool - has no effect after initialize() has been called.
   *

   */
  public void setThreadCount(int count) {

    this.count = count;
  }

  /**
   *

   * Get the number of worker threads in the pool.
   *

   */
  public int getThreadCount() {

    return count;
  }

  /**
   *

   * Set the thread priority of worker threads in the pool - has no effect after initialize() has been called.
   *

   */
  public void setThreadPriority(int prio) {

    this.prio = prio;
  }

  /**
   *

   * Get the thread priority of worker threads in the pool.
   *

   */
  public int getThreadPriority() {

    return prio;
  }

  public void setThreadNamePrefix(String prfx) {

    this.threadNamePrefix = prfx;
  }

  public String getThreadNamePrefix() {

    if (threadNamePrefix == null) {
      threadNamePrefix = schedulerInstanceName + "-SimpleThreadPoolWorker";
    }
    return threadNamePrefix;
  }

  /**
   * @return Returns the threadsInheritContextClassLoaderOfInitializingThread.
   */
  public boolean isThreadsInheritContextClassLoaderOfInitializingThread() {

    return inheritLoader;
  }

  /**
   * @param inheritLoader The threadsInheritContextClassLoaderOfInitializingThread to set.
   */
  public void setThreadsInheritContextClassLoaderOfInitializingThread(boolean inheritLoader) {

    this.inheritLoader = inheritLoader;
  }

  public boolean isThreadsInheritGroupOfInitializingThread() {

    return inheritGroup;
  }

  public void setThreadsInheritGroupOfInitializingThread(boolean inheritGroup) {

    this.inheritGroup = inheritGroup;
  }

  /**
   * @return Returns the value of makeThreadsDaemons.
   */
  public boolean isMakeThreadsDaemons() {

    return makeThreadsDaemons;
  }

  /**
   * @param makeThreadsDaemons The value of makeThreadsDaemons to set.
   */
  public void setMakeThreadsDaemons(boolean makeThreadsDaemons) {

    this.makeThreadsDaemons = makeThreadsDaemons;
  }

  public void setInstanceId(String schedInstId) {

  }

  @Override
  public void initialize() throws SchedulerConfigException {

    if (workers != null && workers.size() > 0) {
      return;
    }

    if (count <= 0) {
      throw new SchedulerConfigException("Thread count must be > 0");
    }
    if (prio <= 0 || prio > 9) {
      throw new SchedulerConfigException("Thread priority must be > 0 and <= 9");
    }

    if (isThreadsInheritGroupOfInitializingThread()) {
      threadGroup = Thread.currentThread().getThreadGroup();
    } else {
      // follow the threadGroup tree to the root thread group.
      threadGroup = Thread.currentThread().getThreadGroup();
      ThreadGroup parent = threadGroup;
      while (!parent.getName().equals("main")) {
        threadGroup = parent;
        parent = threadGroup.getParent();
      }
      threadGroup = new ThreadGroup(parent, schedulerInstanceName + "-SimpleThreadPool");
      if (isMakeThreadsDaemons()) {
        threadGroup.setDaemon(true);
      }
    }

    if (isThreadsInheritContextClassLoaderOfInitializingThread()) {
      getLog().info("Job execution threads will use class loader of thread: " + Thread.currentThread().getName());
    }

    // create the worker threads and start them
    Iterator workerThreads = createWorkerThreads(count).iterator();
    while (workerThreads.hasNext()) {
      WorkerThread wt = (WorkerThread) workerThreads.next();
      wt.start();
      availWorkers.add(wt);
    }
  }

  private List<WorkerThread> createWorkerThreads(int count) {

    workers = new LinkedList<WorkerThread>();
    for (int i = 1; i <= count; ++i) {
      WorkerThread wt = new WorkerThread(this, threadGroup, getThreadNamePrefix() + "-" + i, getThreadPriority(), isMakeThreadsDaemons());
      if (isThreadsInheritContextClassLoaderOfInitializingThread()) {
        wt.setContextClassLoader(Thread.currentThread().getContextClassLoader());
      }
      workers.add(wt);
    }

    return workers;
  }

  /**
   *

   * Terminate any worker threads in this thread group.
   *

   *

   * Jobs currently in progress will complete.
   *

   */
  public void shutdown() {

    shutdown(true);
  }

  /**
   *

   * Terminate any worker threads in this thread group.
   *

   *

   * Jobs currently in progress will complete.
   *

   */
  @Override
  public void shutdown(boolean waitForJobsToComplete) {

    synchronized (nextRunnableLock) {
      isShutdown = true;

      if (workers == null) {
        return;
      }

      // signal each worker thread to shut down
      Iterator workerThreads = workers.iterator();
      while (workerThreads.hasNext()) {
        WorkerThread wt = (WorkerThread) workerThreads.next();
        wt.shutdown();
        availWorkers.remove(wt);
      }

      // Give waiting (wait(1000)) worker threads a chance to shut down.
      // Active worker threads will shut down after finishing their
      // current job.
      nextRunnableLock.notifyAll();

      if (waitForJobsToComplete == true) {

        // wait for hand-off in runInThread to complete...
        while (handoffPending) {
          try {
            nextRunnableLock.wait(100);
          } catch (Throwable t) {
          }
        }

        // Wait until all worker threads are shut down
        while (busyWorkers.size() > 0) {
          WorkerThread wt = busyWorkers.getFirst();
          try {
            getLog().debug("Waiting for thread " + wt.getName() + " to shut down");

            // note: with waiting infinite time the
            // application may appear to 'hang'.
            nextRunnableLock.wait(2000);
          } catch (InterruptedException ex) {
          }
        }

        getLog().debug("shutdown complete");
      }
    }
  }

  /**
   *

   * Run the given Runnable object in the next available Thread. If while waiting the thread pool is asked to shut down, the
   * Runnable is executed immediately within a new additional thread.
   *

   *
   * @param runnable the Runnable to be added.
   */
  @Override
  public boolean runInThread(Runnable runnable) {

    if (runnable == null) {
      return false;
    }

    synchronized (nextRunnableLock) {

      handoffPending = true;

      // Wait until a worker thread is available
      while ((availWorkers.size() < 1) && !isShutdown) {
        try {
          nextRunnableLock.wait(500);
        } catch (InterruptedException ignore) {
        }
      }

      if (!isShutdown) {
        WorkerThread wt = availWorkers.removeFirst();
        busyWorkers.add(wt);
        wt.run(runnable);
      } else {
        // If the thread pool is going down, execute the Runnable
        // within a new additional worker thread (no thread from the pool).
        WorkerThread wt = new WorkerThread(this, threadGroup, "WorkerThread-LastJob", prio, isMakeThreadsDaemons(), runnable);
        busyWorkers.add(wt);
        workers.add(wt);
        wt.start();
      }
      nextRunnableLock.notifyAll();
      handoffPending = false;
    }

    return true;
  }

  @Override
  public int blockForAvailableThreads() {

    synchronized (nextRunnableLock) {

      while ((availWorkers.size() < 1 || handoffPending) && !isShutdown) {
        try {
          nextRunnableLock.wait(500);
        } catch (InterruptedException ignore) {
        }
      }

      return availWorkers.size();
    }
  }

  private void makeAvailable(WorkerThread wt) {

    synchronized (nextRunnableLock) {
      if (!isShutdown) {
        availWorkers.add(wt);
      }
      busyWorkers.remove(wt);
      nextRunnableLock.notifyAll();
    }
  }

  private void clearFromBusyWorkersList(WorkerThread wt) {

    synchronized (nextRunnableLock) {
      busyWorkers.remove(wt);
      nextRunnableLock.notifyAll();
    }
  }

  /*
   * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WorkerThread Class.
   * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   */

  /**
   *

   * A Worker loops, waiting to execute tasks.
   *

   */
  private class WorkerThread extends Thread {

    // A flag that signals the WorkerThread to terminate.
    private boolean run = true;

    private SimpleThreadPool tp;

    private Runnable runnable = null;

    private boolean runOnce = false;

    /**
     *

     * Create a worker thread and start it. Waiting for the next Runnable, executing it, and waiting for the next Runnable, until the shutdown flag is
     * set.
     *

     */
    private WorkerThread(SimpleThreadPool tp, ThreadGroup threadGroup, String name, int prio, boolean isDaemon) {

      this(tp, threadGroup, name, prio, isDaemon, null);
    }

    /**
     *

     * Create a worker thread, start it, execute the runnable and terminate the thread (one time execution).
     *

     */
    private WorkerThread(SimpleThreadPool tp, ThreadGroup threadGroup, String name, int prio, boolean isDaemon, Runnable runnable) {

      super(threadGroup, name);
      this.tp = tp;
      this.runnable = runnable;
      if (runnable != null) {
        runOnce = true;
      }
      setPriority(prio);
      setDaemon(isDaemon);
    }

    /**
     *

     * Signal the thread that it should terminate.
     *

     */
    void shutdown() {

      synchronized (this) {
        run = false;
      }
    }

    public void run(Runnable newRunnable) {

      synchronized (this) {
        if (runnable != null) {
          throw new IllegalStateException("Already running a Runnable!");
        }

        runnable = newRunnable;
        this.notifyAll();
      }
    }

    /**
     *

     * Loop, executing targets as they are received.
     *

     */
    @Override
    public void run() {

      boolean ran = false;
      boolean shouldRun = false;
      synchronized (this) {
        shouldRun = run;
      }

      while (shouldRun) {
        try {
          synchronized (this) {
            while (runnable == null && run) {
              this.wait(500);
            }

            if (runnable != null) {
              ran = true;
              runnable.run();
            }
          }
        } catch (InterruptedException unblock) {
          // do nothing (loop will terminate if shutdown() was called
          try {
            getLog().error("Worker thread was interrupt()'ed.", unblock);
          } catch (Exception e) {
            // ignore to help with a tomcat glitch
          }
        } catch (Throwable exceptionInRunnable) {
          try {
            getLog().error("Error while executing the Runnable: ", exceptionInRunnable);
          } catch (Exception e) {
            // ignore to help with a tomcat glitch
          }
        } finally {
          synchronized (this) {
            runnable = null;
          }
          // repair the thread in case the runnable mucked it up...
          if (getPriority() != tp.getThreadPriority()) {
            setPriority(tp.getThreadPriority());
          }

          if (runOnce) {
            synchronized (this) {
              run = false;
            }
            clearFromBusyWorkersList(this);
          } else if (ran) {
            ran = false;
            makeAvailable(this);
          }

        }

        // read value of run within synchronized block to be
        // sure of its value
        synchronized (this) {
          shouldRun = run;
        }
      }

      // if (log.isDebugEnabled())
      try {
        getLog().debug("WorkerThread is shut down.");
      } catch (Exception e) {
        // ignore to help with a tomcat glitch
      }
    }
  }
}


text:
package org.apache.isis.applib.layout.menubars;

import java.util.List;

import org.apache.isis.applib.annotation.Programmatic;
import org.apache.isis.applib.layout.component.ServiceActionLayoutData;

public interface MenuSection {

    @Programmatic
    List<ServiceActionLayoutData> getServiceActions();
}


text:
title: Telerik.Web.UI.ClientDataSource.SortExpression
page_title: Client-side API Reference
description: Client-side API Reference
slug: Telerik.Web.UI.ClientDataSource.SortExpression
---

# Telerik.Web.UI.ClientDataSource.SortExpression

## Inheritance Hierarchy

* *[Telerik.Web.UI.ClientDataSource.SortExpression]({%slug Telerik.Web.UI.ClientDataSource.SortExpression%})*

## Methods

###  get_sortOrder

none

#### Parameters

#### Returns

`None`

###  set_sortOrder

Telerik.Web.UI.ClientDataSource.SortOrder

#### Parameters

#### Returns

`None`


text:
while true
do
	julia src/repl.jl
	sleep 2
done


text:
/**
 * This private project is a project which automatizate workflow in medical center AVESTA
 * (http://avesta-center.com) called "MedRegistry". The "MedRegistry" demonstrates my programming
 * skills to * potential employers.
 *

 * Here is short description: ( for more detailed description please read README.md or go to
 * https://github.com/theshamuel/medregistry )
 *

 * Front-end: JS, HTML, CSS (basic simple functionality) Back-end: Spring (Spring Boot, Spring IoC,
 * Spring Data, Spring Test), JWT library, Java8 DB: MongoDB Tools: git,maven,docker.
 *

 * My LinkedIn profile: https://www.linkedin.com/in/alex-gladkikh-767a15115/
 */
package com.theshamuel.medreg.controllers;

import com.theshamuel.medreg.ResponsePage;
import com.theshamuel.medreg.exception.DuplicateRecordException;
import com.theshamuel.medreg.model.sequence.dao.SequenceRepository;
import com.theshamuel.medreg.model.customerservice.dto.CustomerServiceDto;
import com.theshamuel.medreg.model.visit.dto.VisitDto;
import com.theshamuel.medreg.model.visit.service.VisitService;
import java.math.BigInteger;
import java.time.Duration;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * The Visit's controller class.
 *
 * @author Alex Gladkikh
 */
@RestController
@RequestMapping(value = "/api/v1", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class VisitController {

    private static Logger logger = LoggerFactory.getLogger(VisitController.class);

    /**
     * The Visit service.
     */
    VisitService visitService;

    /**
     * The Sequence repository.
     */
    SequenceRepository sequenceRepository;

    /**
     * Instantiates a new Visit's controller.
     *
     * @param visitService       the visit service
     * @param sequenceRepository the sequence repository
     */
    @Autowired
    public VisitController(VisitService visitService, SequenceRepository sequenceRepository) {
        this.visitService = visitService;
        this.sequenceRepository = sequenceRepository;
    }

    /**
     * Gets visit order by label.
     *
     * @param pgCount the count response records
     * @param pgStart the start cursor position
     * @return the visit order by label
     */
    @GetMapping(value = "/visits")
    public ResponseEntity<List<VisitDto>> getVisitOrderByLabel(
            @RequestParam(value = "count", defaultValue = "15") int pgCount,
            @RequestParam(value = "start", defaultValue = "0") int pgStart,
            @RequestParam(value = "filter", defaultValue = "") String filter) {
        Sort.Direction sortDirection = Direction.DESC;
        int page = 0;
        if (pgStart > 0) {
            page = pgStart / 15;
        }
        List<VisitDto> result;
        ResponsePage grid = new ResponsePage();
        Instant start = Instant.now();
        if (filter != null && filter.trim().length() > 0) {
            Page p = visitService.findByFilter(new PageRequest(page, pgCount,
                    new Sort(new Sort.Order(sortDirection, "dateEvent"),
                            new Sort.Order(sortDirection, "timeEvent"))), filter);
            result = p.getContent();
            grid.setTotal_count(result.size());

        } else {
            result = visitService.findAll(new PageRequest(page, pgCount,
                    new Sort(new Sort.Order(sortDirection, "dateEvent")))).getContent();
            grid.setTotal_count(visitService.count());
        }
        grid.setData(result);
        grid.setPos(pgStart);
        Instant finish = Instant.now();
        logger.debug("Elapsed time getVisitOrderByLabel: {}", Duration.between(start, finish).toMillis());
        return new ResponseEntity(grid, HttpStatus.OK);
    }

    /**
     * Gets visit by doctor and date event.
     *
     * @param doctorId  the doctor's id
     * @param dateEvent the date of event
     * @return the list of visit by doctor's id and date event
     */
    @GetMapping(value = "/visits/{doctorId}/{dateEvent}")
    public ResponseEntity<List<VisitDto>> getVisitByDoctorAndDateEvent(
            @PathVariable(value = "doctorId") String doctorId,
            @PathVariable(value = "dateEvent") String dateEvent) {

        List<VisitDto> result;
        if (!doctorId.equals("-1")) {
            result = visitService
                    .getVisitsByDoctorAndDateEvent(doctorId, LocalDate.parse(dateEvent));
        } else {
            result = visitService.getVisitsByDateEvent(LocalDate.parse(dateEvent));
        }
        return new ResponseEntity(result, HttpStatus.OK);
    }

    /**
     * Gets visit by doctor and between dates of event.
     *
     * @param doctorId       the doctor's id
     * @param startDateEvent the date event
     * @param endDateEvent   the date event
     * @return the list of visit by doctor's id and date event
     */
    @GetMapping(value = "/visits/{doctorId}/{startDateEvent}/{endDateEvent}")
    public ResponseEntity<List<VisitDto>> getVisitByDoctorAndBetweenDateEvent(
            @PathVariable(value = "doctorId") String doctorId,
            @PathVariable(value = "startDateEvent") String startDateEvent,
            @PathVariable(value = "endDateEvent") String endDateEvent) {

        List<VisitDto> result;
        if (!doctorId.equals("-1")) {
            result = visitService
                    .getVisitsByDoctorAndBetweenDateEvent(doctorId, LocalDate.parse(startDateEvent),
                            LocalDate.parse(endDateEvent));
        } else {
            result = visitService.getVisitsBetweenDateEvent(LocalDate.parse(startDateEvent),
                    LocalDate.parse(endDateEvent));
        }
        return new ResponseEntity(result, HttpStatus.OK);
    }

    /**
     * Save visit.
     *
     * @param visit the visit
     * @return the response entity included saved visit
     */
    @PostMapping(value = "/visits", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseEntity<VisitDto> saveVisit(@RequestBody VisitDto visit) {
        if (!visitService.isUniqueVisit(visit.getDoctorId(), visit.getAppointmentId())) {
            throw new DuplicateRecordException(
                    "Визит пациента на данную дату и время к доктору уже создан");
        } else {
            LocalDateTime now = LocalDateTime.now();
            visit.setModifyDate(now);
            visit.setCreatedDate(now);
            visit.setContractNum(sequenceRepository.getNextSequence("contractNum"));
            return new ResponseEntity(visitService.save(visit), HttpStatus.CREATED);
        }
    }
    /**
     * Get visit.
     *
     * @param id    the visit's id
     * @return the response entity
     */
    @GetMapping(value = "/visits/{id}")
    public ResponseEntity<VisitDto> getVisitById(@PathVariable("id") String id) {
        return new ResponseEntity(visitService.findOne(id), HttpStatus.OK);
    }

    /**
     * Update visit.
     *
     * @param id    the visit's id
     * @param visit the visit
     * @return the response entity
     */
    @PutMapping(value = "/visits/{id}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseEntity<VisitDto> updateVisit(@PathVariable("id") String id,
            @RequestBody VisitDto visit) {
        VisitDto currentVisit = visitService.findOne(id);
        if (visit == null) {
            return new ResponseEntity(HttpStatus.NO_CONTENT);
        }

        if (!visitService.isUniqueVisit(visit.getDoctorId(), visit.getAppointmentId())
                && !currentVisit.getDoctorId().equals(visit.getDoctorId()) && !currentVisit
                .getAppointmentId().equals(visit.getAppointmentId())) {
            throw new DuplicateRecordException(
                    "Визит пациента на данную дату и время к доктору уже создан");
        } else {
            currentVisit.setClientId(visit.getClientId());
            currentVisit.setDoctorId(visit.getDoctorId());
            currentVisit.setAppointmentId(visit.getAppointmentId());
            currentVisit.setAuthor(visit.getAuthor());
            currentVisit.setModifyDate(LocalDateTime.now());
            currentVisit.setTerminalSum(visit.getTerminalSum());
            currentVisit.setDiagnosis(visit.getDiagnosis());
            currentVisit.setTherapy(visit.getTherapy());
            currentVisit.setAdditionalExamination(visit.getAdditionalExamination());
            currentVisit = visitService.save(currentVisit);
            return new ResponseEntity(currentVisit, HttpStatus.OK);
        }
    }

    /**
     * Gets services of visit.
     *
     * @param id the visit's id
     * @return the list of services from visit
     */
    @GetMapping(value = "/visits/{id}/services", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseEntity<List<CustomerServiceDto>> getServicesOfVisit(@PathVariable("id") String id) {
        return new ResponseEntity(visitService.getServices(id), HttpStatus.OK);
    }

    /**
     * Add service of visit response entity.
     *
     * @param id        the visit's id
     * @param serviceId the service's id
     * @param discount  the discount
     * @return the response entity with status of operation
     */
    @PostMapping(value = "/visits/{id}/services/{serviceId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseEntity addServiceOfVisit(@PathVariable("id") String id,
            @PathVariable("serviceId") String serviceId,
            @RequestParam(value = "discount", defaultValue = "0") BigInteger discount) {
        visitService.addService(id, serviceId, discount);
        return new ResponseEntity(HttpStatus.OK);
    }

    /**
     * Delete service from visit.
     *
     * @param id        the visit's id
     * @param serviceId the service's id
     * @return the response entity with status of operation
     */
    @DeleteMapping(value = "/visits/{id}/services/{serviceId}", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public ResponseEntity deleteServiceOfVisit(@PathVariable("id") String id,
            @PathVariable("serviceId") String serviceId) {
        visitService.deleteService(id, serviceId);
        return new ResponseEntity(HttpStatus.OK);
    }

    /**
     * Delete visit.
     *
     * @param id the visit's id
     * @return the response entity with status of operation
     */
    @DeleteMapping(value = "/visits/{id}")
    public ResponseEntity deleteVisit(@PathVariable(value = "id") String id) {
        VisitDto visit = visitService.findOne(id);
        if (visit == null) {
            return new ResponseEntity(HttpStatus.NO_CONTENT);
        }
        visitService.delete(id);
        return new ResponseEntity(HttpStatus.OK);
    }
}


text:
<!doctype html>

    <meta charset="utf-8">
    <title>Create New Part</title>
    <meta name="description" content="">
    <meta name="author" content="Jiexin Guo">
    <meta name="viewport" content="width=device-width">

    <link rel="stylesheet" href="../static/css/bootstrap.min.css">
    <link rel="stylesheet" href="../static/css/bootstrap-responsive.min.css">
    <link rel="stylesheet" href="../static/css/jquery.mCustomScrollbar.css">
    <link rel="stylesheet" href="../static/css/reset.css">
    <link rel="stylesheet" href="../static/css/slider_style.css">
    <link rel="stylesheet" href="../static/css/dtree.css">
    <link rel="stylesheet" href="../static/css/graphiti.css">
    <link rel="stylesheet" href="../static/css/help2.css">

Regulation network

Gene Circuit

Protocol

Help

                Protein

              <input class='btn' id='buttonReg' type="button" value="Add a part from registry" style="margin-left:15%;width:35%;height:50px;float:left;margin-top:15px;color:white;background:#3ABBB7;" onClick="addPartFromRegButtonOnclick(this);"></input>
              <input class='btn' id='buttonSeq' type="button" value="Add a part from sequence" style="margin-left:15px;width:35%;height:50px;float:left;margin-top:15px;color:white;background:#3ABBB7;" onClick="addSeqPartButtonOnclick(this);"></input>

              <textarea id='seqInput' style="font-size:20px;width:100%;height:100%;"></textarea>

Basic information

              Type:
              <select id='typeSelect' style="width:35.5%;height:40px;float:left;position:relative;">
                <option selected="selected" value="">Basic Type</option>
                <option value="promoter">Regulatory</option>
                <option value="RBS">RBS</option>
                <option value="Coding">Coding</option>
                <option value="Terminator">Terminator</option>
                <option value="Repressor">Repressor</option>
                <option value="Inducer">Inducer</option>
                <option value="Corepressor">Corepressor</option>
                <option value="plasmid_backbone">Plasmid backbone</option>
              </select>
              Short description:
              <input id='shortDesp' type="text" style="width:35%;height:30px;float:left;position:relative;"></input>
              Name:
              <input id='name' type="text" style="width:35%;height:30px;float:left;position:relative;"></input>
              Nick name:
              <input id='nickname' type="text" style="width:35%;height:30px;float:left;position:relative;"></input>
              Short name:
              <input id='ShortName' type="text" style="width:35%;height:30px;float:left;position:relative;"></input>
              Author:
              <input id='Author' type="text" style="width:35%;height:30px;float:left;position:relative;"></input>

Modeling parameters

              <form id='PromoterForm' style="display:none;">

Promoter

                 Name:
                <input type="text" id="PromoterName" style="width:35%;height:30px;float:left;position:relative;" placeholder="LuxR"/>
                 Number:
                <input type="text" id="PromoterNumber" style="width:35%;height:30px;float:left;position:relative;" placeholder="BBa_I1051"/>
                 PoPS:
                <input type="text" id="PromoterPoPS" style="width:35%;height:30px;float:left;position:relative;"/>
                 MPPromoter:
                <input type="text" id="PromoterMPPromoter" style="width:35%;height:30px;float:left;position:relative;"/>
                 LeakageRate:
                <input type="text" id="PromoterLeakageRate" style="width:35%;height:30px;float:left;position:relative;"/>
                 Type:
                <input type="text" id="PromoterType" style="width:35%;height:30px;float:left;position:relative;" />
                K1:
                <input type="text" id="PromoterK1" style="width:35%;height:30px;float:left;position:relative;"/>
                 Activator:
                <input type="text" id="PromoterActivator" style="width:35%;height:30px;float:left;position:relative;"/>
                 Repressor:
                <input type="text" id="PromoterRepressor" style="width:35%;height:30px;float:left;position:relative;"/>
                 Source:
                <input type="text" id="PromoterSource" style="width:35%;height:30px;float:left;position:relative;"/>
              </form>
              <form id='RBSForm' style="display:none;">

RBS

                 Name:
                <input type="text" id="RBSName" style="width:35%;height:30px;float:left;position:relative;" placeholder="LuxR"/>
                 Number:
                <input type="text" id="RBSNumber" style="width:35%;height:30px;float:left;position:relative;" placeholder="LuxR"/>
                 MPRBS:
                <input type="text" id="RBSMPRBS" style="width:35%;height:30px;float:left;position:relative;" placeholder="0.12"/>
                 RIPS:
                <input type="text" id="RBSRIPS" style="width:35%;height:30px;float:left;position:relative;" placeholder="0.12"/>
              </form>
              <form id='ActRep' style="display:none;">

Activator/Repressor

                 Name:
                <input type="text" id="ActName" style="width:35%;height:30px;float:left;position:relative;" placeholder="LuxR"/>
                 Number:
                <input type="text" id="ActNumber" style="width:35%;height:30px;float:left;position:relative;" placeholder="LuxR"/>
                 HillCoeff1:
                <input type="text" id="HillCoeff1" style="width:35%;height:30px;float:left;position:relative;" placeholder="2"/>
                 K1:
                <input type="text" id="ActK1" style="width:35%;height:30px;float:left;position:relative;" placeholder="0.12"/>
                 K2:
                <input type="text" id="ActK2" style="width:35%;height:30px;float:left;position:relative;" placeholder="0.12"/>
              </form>
              <form id='Inducer' style="display:none;">

Inducer

                 Name:
                <input type="text" id="InducerName" style="width:35%;height:30px;float:left;position:relative;" placeholder="LuxR"/>
                 Number:
                <input type="text" id="InducerNumber" style="width:35%;height:30px;float:left;position:relative;" placeholder="LuxR"/>
                 HillCoeff2:
                <input type="text" id="HillCoeff2" style="width:35%;height:30px;float:left;position:relative;" placeholder="2"/>
                 K2:
                <input type="text" id="InducerK2" style="width:35%;height:30px;float:left;position:relative;" placeholder="0.12"/>
              </form>
              <form id='terminatorForm' style="display:none;">

Terminator

                 Name:
                <input type="text" id="terminatorName" style="width:35%;height:30px;float:left;position:relative;" placeholder="LuxR"/>
                 Number:
                <input type="text" id="terminatorNumber" style="width:35%;height:30px;float:left;position:relative;" placeholder="LuxR"/>
                 Efficiency:
                <input type="text" id="Efficiency" style="width:35%;height:30px;float:left;position:relative;" placeholder="0.12"/>
              </form>
              <form id='plasmid_backboneForm'  style="display:none;">

Plasmid_backbone

                 Name:
                <input type="text" id="plasmid_backboneName" style="width:35%;height:30px;float:left;position:relative;" placeholder="LuxR"/>
                 Number:
                <input type="text" id="plasmid_backboneNumber" style="width:35%;height:30px;float:left;position:relative;" placeholder="LuxR"/>
                 CopyNumber:
                <input type="text" id="CopyNumber" style="width:35%;height:30px;float:left;position:relative;" placeholder="0.12"/>
              </form>

Sequence

              Assembly Standard
              <select id='standardSelect' style="width:46%;height:40px;float:left;position:relative;" onChange="standardChange(this);">
                <option selected="selected" value="">Assembly Standard</option>
                <option value="RFC10">RFC 10</option>
                <option value="RFC20">RFC 20</option>
                <option value="RFC21">RFC 21</option>
                <option value="RFC23">RFC 23</option>
              </select>
              <textarea id='finalSeq' style="font-size:20px;width:92%;height:80px;"></textarea>

            <input id='buttonAccept' class='btn' type="button" value="Accept" style="display:none;margin-left:35%;width:30%;height:40px;float:left;margin-top:15px;color:white;background:#3ABBB7;" onClick="acButtonOnclick(this);"></input>

          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Info

File Saved!

          <button class="btn btn-success btn-mini" data-dismiss="modal" aria-hidden="true">Close</button>

          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

File List

          <button class="btn btn-success btn-mini" data-dismiss="modal" aria-hidden="true">Close</button>

          Close X

Add biobricks

Build regulation network

View the information

Save the network

Create own part

Manage your own part


text:
package com.kaching.platform.testing;

import static com.google.common.collect.Lists.newArrayList;
import static java.math.BigDecimal.valueOf;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.junit.ComparisonFailure;

/**
 * Extension of JUnit assertions.
 */
public class Assert extends org.junit.Assert {
  protected Assert() {}

  public static void assertBigDecimalEquals(double d1, BigDecimal d2) {
    assertBigDecimalEquals(null, d1, d2);
  }

  public static void assertBigDecimalEquals(String message, double d1, BigDecimal d2) {
    assertBigDecimalEquals(message, valueOf(d1), d2);
  }

  public static void assertBigDecimalEquals(String message, double d1, BigDecimal d2, int scale) {
    assertBigDecimalEquals(message, valueOf(d1), d2, scale);
  }

  public static void assertBigDecimalEquals(String message, BigDecimal d1, BigDecimal d2, int scale) {
    assertBigDecimalEquals(
        message,
        d1.setScale(scale, RoundingMode.HALF_UP),
        d2.setScale(scale, RoundingMode.HALF_UP));
  }

  public static void assertBigDecimalEquals(BigDecimal d1, BigDecimal d2) {
    assertBigDecimalEquals(null, d1, d2);
  }

  public static void assertBigDecimalEquals(BigDecimal d1, BigDecimal d2, int scale) {
    assertBigDecimalEquals(
        null,
        d1.setScale(scale, RoundingMode.HALF_UP),
        d2.setScale(scale, RoundingMode.HALF_UP));
  }

  public static void assertBigDecimalEquals(double d1, BigDecimal d2, int scale) {
    assertBigDecimalEquals(valueOf(d1), d2, scale);
  }

  public static void assertBigDecimalEquals(
      String message, BigDecimal d1, BigDecimal d2) {
    if (d1 == null && d2 == null) {
      return;
    }

    if (d1 == null || d2 == null || d1.compareTo(d2) != 0) {
      throw new ComparisonFailure(
          (message == null) ? "" : message,
          (d1 == null) ? "null" : d1.toPlainString(),
          (d2 == null) ? "null" : d2.toPlainString());
    }
  }

  public static void assertBigDecimalEquals(
      List<BigDecimal> expected, List<BigDecimal> actual) {
    assertBigDecimalEquals(null, expected, actual);
  }

  public static void assertBigDecimalEquals(String message,
      List<BigDecimal> expected, List<BigDecimal> actual) {
    if (expected == null || actual == null) {
      assertEquals(message, expected, actual);
    } else {
      Iterator<BigDecimal> eachExpected = expected.iterator();
      Iterator<BigDecimal> eachActual = actual.iterator();
      while (eachExpected.hasNext() && eachActual.hasNext()) {
        try {
          assertBigDecimalEquals(message, eachExpected.next(), eachActual.next());
        } catch(ComparisonFailure e) {
          assertEquals(message, expected, actual);
        }
      }
      if (eachExpected.hasNext() != eachActual.hasNext()) {
        assertEquals(message, expected, actual);
      }
    }
  }

  public static <K> void assertBigDecimalEquals(
      Map<K, BigDecimal> expected, Map<K, BigDecimal> actual) {
    assertTrue(expected.size() == actual.size());
    for (K key : expected.keySet()) {
      assertTrue(actual.containsKey(key));
      assertBigDecimalEquals(expected.get(key), actual.get(key), 5);
    }
  }

  public static void assertBigDecimalEquals(int d1, BigDecimal d2) {
    assertBigDecimalEquals(null, new BigDecimal(Integer.toString(d1)), d2);
  }

  public static void assertBigDecimalEquals(String message, int d1, BigDecimal d2) {
    assertBigDecimalEquals(message, new BigDecimal(Integer.toString(d1)), d2);
  }

  public static void assertBigDecimalEquals(float d1, BigDecimal d2) {
    assertBigDecimalEquals(null, new BigDecimal(Float.toString(d1)), d2);
  }

  public static void assertBigDecimalEquals(String message, float d1, BigDecimal d2) {
    assertBigDecimalEquals(message, new BigDecimal(Float.toString(d1)), d2);
  }

  public static void assertFloatEquals(float f1, float f2) {
    assertBigDecimalEquals(null, new BigDecimal(Float.toString(f1)),
        new BigDecimal(Float.toString(f2)));
  }

  public static void assertFloatEquals(float f1, float f2, int scale) {
    assertBigDecimalEquals(null, new BigDecimal(Float.toString(f1)),
        new BigDecimal(Float.toString(f2)), scale);
  }

  public static void assertFloatEquals(String message, float f1, float f2) {
    assertBigDecimalEquals(message, new BigDecimal(Float.toString(f1)),
        new BigDecimal(Float.toString(f2)));
  }

  public static <T> void assertContains(Collection<T>collection, T object) {
    if (!collection.contains(object)) {
      junit.framework.Assert.fail("Expected to find " + object);
    }
  }

  public static void assertArrayEquals(Object[] expected, Object[] actual) {
    assertEquals(newArrayList(expected), newArrayList(actual));
  }

  @SuppressWarnings("finally")
  public static void assertNotEquals(Object expected, Object actual) {
    boolean wasEqual = false;
    try {
      assertEquals(expected, actual);
      wasEqual = true;
    } catch (AssertionError e) {
    } finally {
      if (wasEqual) {
        fail();
      }
      return;
    }
  }

}


text:
package org.jmockit.internal.expectations.mocking;

import static java.lang.reflect.Modifier.*;
import org.jmockit.*;
import org.jmockit.internal.expectations.state.*;
import org.jmockit.internal.injection.*;
import org.jmockit.internal.reflection.*;
import org.jmockit.internal.state.*;
import org.jmockit.internal.util.*;

import javax.annotation.*;
import java.lang.annotation.*;
import java.lang.reflect.*;

@SuppressWarnings("EqualsAndHashcode")
public final class MockedType extends InjectionProvider
{
   @Mocked private static final Object DUMMY = null;
   private static final int DUMMY_HASHCODE;

   static {
      int h = 0;

      try {
         Field dummy = MockedType.class.getDeclaredField("DUMMY");
         Mocked mocked = dummy.getAnnotation(Mocked.class);
         h = mocked.hashCode();
      }
      catch (NoSuchFieldException ignore) {}

      DUMMY_HASHCODE = h;
   }

   @Nullable public final Field field;
   private final boolean fieldFromTestClass;
   private final int accessModifiers;
   @Nullable private final Mocked mocked;
   @Nullable private final Class<?> parameterImplementationClass;
   private final boolean injectable;
   @Nullable Object providedValue;

   public MockedType(@Nonnull Field field) {
      super(field.getGenericType(), field.getName());
      this.field = field;
      fieldFromTestClass = true;
      accessModifiers = field.getModifiers();
      mocked = field.getAnnotation(Mocked.class);
      parameterImplementationClass = null;
      injectable = true;
      registerCascadingAsNeeded();
   }

   private void registerCascadingAsNeeded() {
      if (isMockableType()) {
         Type mockedType = declaredType;

         if (!(mockedType instanceof TypeVariable<?>)) {
            ExecutingTest executingTest = TestRun.getExecutingTest();
            CascadingTypes types = executingTest.getCascadingTypes();
            types.add(fieldFromTestClass, mockedType);
         }
      }
   }

   MockedType(
      @Nonnull TestMethod testMethod, @Nonnegative int paramIndex,
      @Nonnull Type parameterType, @Nonnull Annotation[] annotationsOnParameter,
      @Nullable Class<?> parameterImplementationClass
   ) {
      super(parameterType, ParameterNames.getName(testMethod, paramIndex));
      field = null;
      fieldFromTestClass = false;
      accessModifiers = 0;
      mocked = getAnnotation(annotationsOnParameter, Mocked.class);
      this.parameterImplementationClass = parameterImplementationClass;
      injectable = true;

      if (providedValue == null && parameterType instanceof Class<?>) {
         Class<?> parameterClass = (Class<?>) parameterType;

         if (parameterClass.isPrimitive()) {
            providedValue = DefaultValues.defaultValueForPrimitiveType(parameterClass);
         }
      }

      registerCascadingAsNeeded();
   }

   @Nullable
   private static <A extends Annotation> A getAnnotation(
       @Nonnull Annotation[] annotations, @Nonnull Class<A> annotation
   ) {
      for (Annotation paramAnnotation : annotations) {
         if (paramAnnotation.annotationType() == annotation) {
            //noinspection unchecked
            return (A) paramAnnotation;
         }
      }

      return null;
   }

   MockedType(@Nonnull String cascadingMethodName, @Nonnull Type cascadedType) {
      super(cascadedType, cascadingMethodName);
      field = null;
      fieldFromTestClass = false;
      accessModifiers = 0;
      mocked = null;
      injectable = true;
      parameterImplementationClass = null;
   }

   @Nonnull @Override public Class<?> getClassOfDeclaredType() { return getClassType(); }

   /**
    * @return the class object corresponding to the type to be mocked, or {@code TypeVariable.class} in case the
    * mocked type is a type variable (which usually occurs when the mocked implements/extends multiple types)
    */
   @Nonnull
   public Class<?> getClassType() {
      if (parameterImplementationClass != null) {
         return parameterImplementationClass;
      }

      Type mockedType = declaredType;

      if (mockedType instanceof Class<?>) {
         return (Class<?>) mockedType;
      }

      if (mockedType instanceof ParameterizedType) {
         ParameterizedType parameterizedType = (ParameterizedType) mockedType;
         return (Class<?>) parameterizedType.getRawType();
      }

      // Occurs when declared type is a TypeVariable, usually having two or more bound types.
      // In such cases, there isn't a single class type.
      return TypeVariable.class;
   }

   boolean isMockableType() {
      if (mocked == null) {
         return false;
      }

      Type mockedType = declaredType;

      if (!(mockedType instanceof Class<?>)) {
         return true;
      }

      Class<?> classType = (Class<?>) mockedType;

      if (isUnmockableJREType(classType)) {
         return false;
      }

      if (injectable) {
         if (isJREValueType(classType) || classType.isEnum()) {
            return false;
         }
      }

      return true;
   }

   private static boolean isUnmockableJREType(@Nonnull Class<?> type) {
      return type.isPrimitive() || type.isArray() || type == Integer.class;
   }

   private static boolean isJREValueType(@Nonnull Class<?> type) {
      return
         type == String.class || type == Boolean.class || type == Character.class ||
         Number.class.isAssignableFrom(type);
   }

   public boolean isInjectable() { return mocked != null && injectable; }

   @Nullable @Override
   public Object getValue(@Nullable Object owner) {
      if (field == null) {
         return providedValue;
      }

      Object value = FieldReflection.getFieldValue(field, owner);

      if (!injectable) {
         return value;
      }

      Class<?> fieldType = field.getType();

      if (value == null) {
         if (providedValue != null) {
            return providedValue;
         }

         if (isFinalFieldOrParameter()) {
            return NULL;
         }

         if (fieldType == String.class) {
            return "";
         }

         return null;
      }

      if (providedValue == null) {
         return value;
      }

      if (!fieldType.isPrimitive()) {
         return value;
      }

      Object defaultValue = DefaultValues.defaultValueForPrimitiveType(fieldType);

      return value.equals(defaultValue) ? providedValue : value;
   }

   private boolean isFinalFieldOrParameter() { return field == null || isFinal(accessModifiers); }

   @Override
   public int hashCode() {
      int result = declaredType.hashCode();

      if (isFinal(accessModifiers)) {
         result *= 31;
      }

      if (injectable) {
         result *= 37;
      }

      if (mocked != null) {
         int h = mocked.hashCode();

         if (h != DUMMY_HASHCODE) {
            result = 31 * result + h;
         }
      }

      return result;
   }
}


text:
module TestBasicTypes
where

import BasicTypes

res = do
 m1 <- Success "abc"
 return $ m1


text:
<?xml version="1.0" encoding="UTF-8"?>
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata">
    <fullName>Author__c</fullName>
    <externalId>false</externalId>
    <label>Author</label>
    <referenceTo>Author__c</referenceTo>
    <relationshipLabel>Books</relationshipLabel>
    <relationshipName>Books</relationshipName>
    <relationshipOrder>0</relationshipOrder>
    <reparentableMasterDetail>false</reparentableMasterDetail>
    <trackHistory>false</trackHistory>
    <trackTrending>false</trackTrending>
    <type>MasterDetail</type>
    <writeRequiresMasterRead>true</writeRequiresMasterRead>
</CustomField>