text:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.18.1: http://docutils.sourceforge.net/" />

    <title>sparknlp_jsl.annotator.GenericClassifierApproach — Spark NLP 3.3.0 documentation</title>

  <link href="../../static/styles/theme.css?digest=92025949c220c2e29695" rel="stylesheet">
<link href="../../static/styles/pydata-sphinx-theme.css?digest=92025949c220c2e29695" rel="stylesheet">

  <link rel="stylesheet"
    href="../../static/vendor/fontawesome/5.13.0/css/all.min.css">
  <link rel="preload" as="font" type="font/woff2" crossorigin
    href="../../static/vendor/fontawesome/5.13.0/webfonts/fa-solid-900.woff2">
  <link rel="preload" as="font" type="font/woff2" crossorigin
    href="../../static/vendor/fontawesome/5.13.0/webfonts/fa-brands-400.woff2">

    <link rel="stylesheet" type="text/css" href="../../static/pygments.css" />
    <link rel="stylesheet" type="text/css" href="../../static/css/custom.css" />

  <link rel="preload" as="script" href="../../static/scripts/pydata-sphinx-theme.js?digest=92025949c220c2e29695">

    <link rel="shortcut icon" href="../../static/fav.ico"/>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="sparknlp_jsl.annotator.GenericClassifierModel" href="sparknlp_jsl.annotator.GenericClassifierModel.html" />
    <link rel="prev" title="sparknlp_jsl.annotator.EntityChunkEmbeddings" href="sparknlp_jsl.annotator.EntityChunkEmbeddings.html" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="docsearch:language" content="en">

  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbar-collapsible" aria-controls="navbar-collapsible" aria-expanded="false" aria-label="Toggle navigation">

  </button>

  Getting Started

  API Reference

<form class="bd-search d-flex align-items-center" action="../../search.html" method="get">

  <input type="search" class="form-control" name="q" id="search-input" placeholder="Search the docs ..." aria-label="Search the docs ..." autocomplete="off" >
</form>

   sparknlp_jsl.annotator

  <input checked="" class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" type="checkbox"/>

     sparknlp_jsl.annotator.AnnotationMerger

     sparknlp_jsl.annotator.AssertionDLApproach

     sparknlp_jsl.annotator.AssertionDLModel

     sparknlp_jsl.annotator.AssertionFilterer

     sparknlp_jsl.annotator.AssertionLogRegApproach

     sparknlp_jsl.annotator.AssertionLogRegModel

     sparknlp_jsl.annotator.AverageEmbeddings

     sparknlp_jsl.annotator.BertSentenceChunkEmbeddings

     sparknlp_jsl.annotator.Chunk2Token

     sparknlp_jsl.annotator.ChunkConverter

     sparknlp_jsl.annotator.ChunkFilterer

     sparknlp_jsl.annotator.ChunkFiltererApproach

     sparknlp_jsl.annotator.ChunkKeyPhraseExtraction

     sparknlp_jsl.annotator.ChunkMapperApproach

     sparknlp_jsl.annotator.ChunkMapperFilterer

     sparknlp_jsl.annotator.ChunkMapperModel

     sparknlp_jsl.annotator.ChunkMergeApproach

     sparknlp_jsl.annotator.ChunkMergeModel

     sparknlp_jsl.annotator.ChunkSentenceSplitter

     sparknlp_jsl.annotator.CommonResolverParams

     sparknlp_jsl.annotator.ContextualParserApproach

     sparknlp_jsl.annotator.ContextualParserModel

     sparknlp_jsl.annotator.DateNormalizer

     sparknlp_jsl.annotator.DeIdentification

     sparknlp_jsl.annotator.DeIdentificationModel

     sparknlp_jsl.annotator.DocumentLogRegClassifierApproach

     sparknlp_jsl.annotator.DocumentLogRegClassifierModel

     sparknlp_jsl.annotator.DrugNormalizer

     sparknlp_jsl.annotator.EntityChunkEmbeddings

     sparknlp_jsl.annotator.GenericClassifierApproach

     sparknlp_jsl.annotator.GenericClassifierModel

     sparknlp_jsl.annotator.IOBTagger

     sparknlp_jsl.annotator.MedicalBertForSequenceClassification

     sparknlp_jsl.annotator.MedicalBertForTokenClassifier

     sparknlp_jsl.annotator.MedicalDistilBertForSequenceClassification

     sparknlp_jsl.annotator.MedicalGraphBuilderModel

     sparknlp_jsl.annotator.MedicalNerApproach

     sparknlp_jsl.annotator.MedicalNerModel

     sparknlp_jsl.annotator.NerChunker

     sparknlp_jsl.annotator.NerConverterInternal

     sparknlp_jsl.annotator.NerDisambiguator

     sparknlp_jsl.annotator.NerDisambiguatorModel

     sparknlp_jsl.annotator.PosologyREModel

     sparknlp_jsl.annotator.RENerChunksFilter

     sparknlp_jsl.annotator.ReIdentification

     sparknlp_jsl.annotator.RelationExtractionApproach

     sparknlp_jsl.annotator.RelationExtractionDLModel

     sparknlp_jsl.annotator.RelationExtractionModel

     sparknlp_jsl.annotator.ResolverMerger

     sparknlp_jsl.annotator.Router

     sparknlp_jsl.annotator.SentenceEntityResolverApproach

     sparknlp_jsl.annotator.SentenceEntityResolverModel

     sparknlp_jsl.annotator.SentenceResolverParams

     sparknlp_jsl.annotator.TFGraphBuilder

     sparknlp_jsl.annotator.ZeroShotRelationExtractionModel

   sparknlp_jsl.base

  <input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" type="checkbox"/>

     sparknlp_jsl.base.FeaturesAssembler

   sparknlp_jsl.training

  <input class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" type="checkbox"/>

     sparknlp_jsl.training.AnnotationToolJsonReader

     sparknlp_jsl.training.CantemistReader

     sparknlp_jsl.training.CodiEspReader

   sparknlp_jsl._tf_graph_builders.graph_builders

  <input class="toctree-checkbox" id="toctree-checkbox-4" name="toctree-checkbox-4" type="checkbox"/>

     sparknlp_jsl._tf_graph_builders.graph_builders.AssertionTFGraphBuilder

     sparknlp_jsl._tf_graph_builders.graph_builders.GenericClassifierTFGraphBuilder

     sparknlp_jsl._tf_graph_builders.graph_builders.NerTFGraphBuilder

     sparknlp_jsl._tf_graph_builders.graph_builders.RelationExtractionTFGraphBuilder

     sparknlp_jsl._tf_graph_builders.graph_builders.TFGraphBuilder

     sparknlp_jsl._tf_graph_builders.graph_builders.TFGraphBuilderFactory

     sparknlp_jsl._tf_graph_builders.graph_builders.TensorflowAddonsNeeded

     sparknlp_jsl._tf_graph_builders.graph_builders.WrongTFVersion

   sparknlp_jsl._tf_graph_builders.graph_builders

  <input class="toctree-checkbox" id="toctree-checkbox-5" name="toctree-checkbox-5" type="checkbox"/>

     sparknlp_jsl._tf_graph_builders.graph_builders.AssertionTFGraphBuilder

     sparknlp_jsl._tf_graph_builders.graph_builders.GenericClassifierTFGraphBuilder

     sparknlp_jsl._tf_graph_builders.graph_builders.NerTFGraphBuilder

     sparknlp_jsl._tf_graph_builders.graph_builders.RelationExtractionTFGraphBuilder

     sparknlp_jsl._tf_graph_builders.graph_builders.TFGraphBuilder

     sparknlp_jsl._tf_graph_builders.graph_builders.TFGraphBuilderFactory

     sparknlp_jsl._tf_graph_builders.graph_builders.TensorflowAddonsNeeded

     sparknlp_jsl._tf_graph_builders.graph_builders.WrongTFVersion

sparknlp_jsl.annotator.GenericClassifierApproach#

class sparknlp_jsl.annotator.GenericClassifierApproach(classname='com.johnsnowlabs.nlp.annotators.generic_classifier.GenericClassifierApproach')[source]#

Bases: AnnotatorApproach

Trains a TensorFlow model for generic classification of feature vectors. It takes FEATURE_VECTOR annotations from
FeaturesAssembler` as input, classifies them and outputs CATEGORY annotations.

Input Annotation types

Output Annotation type

FEATURE_VECTOR

CATEGORY

Parameters:

labelColumn

Column with one label per document

batchSize

Size for each batch in the optimization process

epochsN

Number of epochs for the optimization process

learningRate

Learning rate for the optimization proces

dropou

Dropout at the output of each laye

validationSplit

Validaiton split - how much data to use for validation

modelFile

File name to load the mode from

fixImbalance

A flag indicating whenther to balance the trainig set

featureScaling

Feature scaling method. Possible values are 'zscore', 'minmax' or empty (no scaling)

outputLogsPath

Path to folder where logs will be saved. If no path is specified, no logs are generated

Examples

>>> import sparknlp
>>> from sparknlp.base import *
>>> from sparknlp.common import *
>>> from sparknlp.annotator import *
>>> from sparknlp.training import *
>>> import sparknlp_jsl
>>> from sparknlp_jsl.base import *
>>> from sparknlp_jsl.annotator import *
>>> from pyspark.ml import Pipeline
>>> features_asm = FeaturesAssembler()     ...    .setInputCols(["feature_1", "feature_2", "...", "feature_n"])     ...    .setOutputCol("features")
...
>>> gen_clf = GenericClassifierApproach() \
...    .setLabelColumn("target") \
...    .setInputCols(["features"]) \
...    .setOutputCol("prediction") \
...    .setModelFile("/path/to/graph_file.pb") \
...    .setEpochsNumber(50) \
...    .setBatchSize(100) \
...    .setFeatureScaling("zscore") \
...    .setlearningRate(0.001) \
...    .setFixImbalance(True) \
...    .setOutputLogsPath("logs") \
...    .setValidationSplit(0.2) # keep 20% of the data for validation purposes
...
>>> pipeline = Pipeline().setStages([
...    features_asm,
...    gen_clf
...])
...
>>> clf_model = pipeline.fit(data)

Methods

__init__([classname])

clear(param)

Clears a param from the param map if it has been explicitly set.

copy([extra])

Creates a copy of this instance with the same uid and some extra params.

explainParam(param)

Explains a single param and returns its name, doc, and optional default value and user-supplied value in a string.

explainParams()

Returns the documentation of all params with their optionally default values and user-supplied values.

extractParamMap([extra])

Extracts the embedded default param values and user-supplied values, and then merges them with extra values from input into a flat param map, where the latter value is used if there exist conflicts, i.e., with ordering: default param values < user-supplied values < extra.

fit(dataset[, params])

Fits a model to the input dataset with optional parameters.

fitMultiple(dataset, paramMaps)

Fits a model to the input dataset for each param map in paramMaps.

getInputCols()

Gets current column names of input annotations.

getLazyAnnotator()

Gets whether Annotator should be evaluated lazily in a RecursivePipeline.

getOrDefault(param)

Gets the value of a param in the user-supplied param map or its default value.

getOutputCol()

Gets output column name of annotations.

getParam(paramName)

Gets a param by its name.

getParamValue(paramName)

Gets the value of a parameter.

hasDefault(param)

Checks whether a param has a default value.

hasParam(paramName)

Tests whether this instance contains a param with a given (string) name.

isDefined(param)

Checks whether a param is explicitly set by user or has a default value.

isSet(param)

Checks whether a param is explicitly set by user.

load(path)

Reads an ML instance from the input path, a shortcut of read().load(path).

read()

Returns an MLReader instance for this class.

save(path)

Save this ML instance to the given path, a shortcut of 'write().save(path)'.

set(param, value)

Sets a parameter in the embedded param map.

setBatchSize(size)

Size for each batch in the optimization process

setDropout(dropout)

Sets drouptup

setEpochsNumber(epochs)

Sets number of epochs for the optimization process

setFeatureScaling(feature_scaling)

Sets Feature scaling method.

setFixImbalance(fix_imbalance)

Sets A flag indicating whenther to balance the trainig set.

setInputCols(*value)

Sets column names of input annotations.

setLabelCol(label_column)

Sets  Size for each batch in the optimization process

setLazyAnnotator(value)

Sets whether Annotator should be evaluated lazily in a RecursivePipeline.

setLearningRate(lamda)

Sets learning rate for the optimization process

setModelFile(mode_file)

Sets file name to load the mode from"

setOutputCol(value)

Sets output column name of annotations.

setOutputLogsPath(output_logs_path)

Sets path to folder where logs will be saved.

setParamValue(paramName)

Sets the value of a parameter.

setValidationSplit(validation_split)

Sets validaiton split - how much data to use for validation

write()

Returns an MLWriter instance for this ML instance.

Attributes

batchSize

dropout

epochsN

featureScaling

fixImbalance

getter_attrs

inputCols

labelColumn

lazyAnnotator

learningRate

modelFile

outputCol

outputLogsPath

params

Returns all params ordered by name.

validationSplit

clear(param)#

Clears a param from the param map if it has been explicitly set.

copy(extra=None)#

Creates a copy of this instance with the same uid and some
extra params. This implementation first calls Params.copy and
then make a copy of the companion Java pipeline component with
extra params. So both the Python wrapper and the Java pipeline
component get copied.

Parameters:

extra – Extra parameters to copy to the new instance

Returns:

Copy of this instance

explainParam(param)#

Explains a single param and returns its name, doc, and optional
default value and user-supplied value in a string.

explainParams()#

Returns the documentation of all params with their optionally
default values and user-supplied values.

extractParamMap(extra=None)#

Extracts the embedded default param values and user-supplied
values, and then merges them with extra values from input into
a flat param map, where the latter value is used if there exist
conflicts, i.e., with ordering: default param values <
user-supplied values < extra.

Parameters:

extra – extra param values

Returns:

merged param map

fit(dataset, params=None)#

Fits a model to the input dataset with optional parameters.

Parameters:

dataset – input dataset, which is an instance of pyspark.sql.DataFrame

params – an optional param map that overrides embedded params. If a list/tuple of
param maps is given, this calls fit on each param map and returns a list of
models.

Returns:

fitted model(s)

New in version 1.3.0.

fitMultiple(dataset, paramMaps)#

Fits a model to the input dataset for each param map in paramMaps.

Parameters:

dataset – input dataset, which is an instance of pyspark.sql.DataFrame.

paramMaps – A Sequence of param maps.

Returns:

A thread safe iterable which contains one model for each param map. Each
call to next(modelIterator) will return (index, model) where model was fit
using paramMaps[index]. index values may not be sequential.

New in version 2.3.0.

getInputCols()#

Gets current column names of input annotations.

getLazyAnnotator()#

Gets whether Annotator should be evaluated lazily in a
RecursivePipeline.

getOrDefault(param)#

Gets the value of a param in the user-supplied param map or its
default value. Raises an error if neither is set.

getOutputCol()#

Gets output column name of annotations.

getParam(paramName)#

Gets a param by its name.

getParamValue(paramName)#

Gets the value of a parameter.

Parameters:

paramNamestr

Name of the parameter

hasDefault(param)#

Checks whether a param has a default value.

hasParam(paramName)#

Tests whether this instance contains a param with a given
(string) name.

isDefined(param)#

Checks whether a param is explicitly set by user or has
a default value.

isSet(param)#

Checks whether a param is explicitly set by user.

classmethod load(path)#

Reads an ML instance from the input path, a shortcut of read().load(path).

property params#

Returns all params ordered by name. The default implementation
uses dir() to get all attributes of type
Param.

classmethod read()#

Returns an MLReader instance for this class.

save(path)#

Save this ML instance to the given path, a shortcut of 'write().save(path)'.

set(param, value)#

Sets a parameter in the embedded param map.

setBatchSize(size)[source]#

Size for each batch in the optimization process

Parameters:

sizeint

Size for each batch in the optimization process

setDropout(dropout)[source]#

Sets drouptup

Parameters:

dropoutfloat

Dropout at the output of each layer

setEpochsNumber(epochs)[source]#

Sets number of epochs for the optimization process

Parameters:

epochsint

Number of epochs for the optimization process

setFeatureScaling(feature_scaling)[source]#

Sets Feature scaling method. Possible values are 'zscore', 'minmax' or empty (no scaling

Parameters:

feature_scalingstr

Feature scaling method. Possible values are 'zscore', 'minmax' or empty (no scaling

setFixImbalance(fix_imbalance)[source]#

Sets A flag indicating whenther to balance the trainig set.

Parameters:

fix_imbalancebool

A flag indicating whenther to balance the trainig set.

setInputCols(*value)#

Sets column names of input annotations.

Parameters:

*valuestr

Input columns for the annotator

setLabelCol(label_column)[source]#

Sets  Size for each batch in the optimization process

Parameters:

labelstr

Column with the value result we are trying to predict.

setLazyAnnotator(value)#

Sets whether Annotator should be evaluated lazily in a
RecursivePipeline.

Parameters:

valuebool

Whether Annotator should be evaluated lazily in a
RecursivePipeline

setLearningRate(lamda)[source]#

Sets learning rate for the optimization process

Parameters:

lamdafloat

Learning rate for the optimization process

setModelFile(mode_file)[source]#

Sets file name to load the mode from"

Parameters:

labelstr

File name to load the mode from"

setOutputCol(value)#

Sets output column name of annotations.

Parameters:

valuestr

Name of output column

setOutputLogsPath(output_logs_path)[source]#

Sets path to folder where logs will be saved. If no path is specified, no logs are generated

Parameters:

labelstr

Path to folder where logs will be saved. If no path is specified, no logs are generated

setParamValue(paramName)#

Sets the value of a parameter.

Parameters:

paramNamestr

Name of the parameter

setValidationSplit(validation_split)[source]#

Sets validaiton split - how much data to use for validation

Parameters:

validation_splitfloat

Validaiton split - how much data to use for validation

uid#

A unique id for the object.

write()#

Returns an MLWriter instance for this ML instance.

previous

sparknlp_jsl.annotator.EntityChunkEmbeddings

next

sparknlp_jsl.annotator.GenericClassifierModel

    © Copyright 2021, John Snow Labs.

Created using Sphinx 5.0.1.


text:
module SubHask.Algebra.Ord
    where

import qualified Prelude as P
import qualified Data.List as L

import qualified GHC.Arr as Arr
import Data.Array.ST hiding (freeze,thaw)
import Control.Monad
import Control.Monad.Random
import Prelude (take)

import SubHask.Algebra
import SubHask.Category
import SubHask.Internal.Prelude
import SubHask.TemplateHaskell.Deriving

--------------------------------------------------------------------------------

-- | This wrapper let's us convert between SubHask's Ord type and the Prelude's.
-- See the "sort" function below for an example.
newtype WithPreludeOrd a = WithPreludeOrd { unWithPreludeOrd :: a }
    deriving Storable

instance Show a => Show (WithPreludeOrd a) where
    show (WithPreludeOrd a) = show a

-- | FIXME: for some reason, our deriving mechanism doesn't work on Show here;
-- It causes's Set's show to enter an infinite loop
deriveHierarchyFiltered ''WithPreludeOrd [ ''Eq_, ''Enum, ''Boolean, ''Ring, ''Metric ] [ ''Show ]

instance Eq a => P.Eq (WithPreludeOrd a) where
    {-# INLINE (==) #-}
    a==b = a==b

instance Ord a => P.Ord (WithPreludeOrd a) where
    {-# INLINE (<=) #-}
    a<=b = a<=b

-- | A wrapper around the Prelude's sort function.
--
-- FIXME:
-- We should put this in the container hierarchy so we can sort any data type
sort :: Ord a => [a] -> [a]
sort = map unWithPreludeOrd . L.sort . map WithPreludeOrd

-- | Randomly shuffles a list in time O(n log n); see http://www.haskell.org/haskellwiki/Random_shuffle
shuffle :: (Eq a, MonadRandom m) => [a] -> m [a]
shuffle xs = do
    let l = length xs
    rands <- take l `liftM` getRandomRs (0, l-1)
    let ar = runSTArray ( do
            ar' <- Arr.thawSTArray (Arr.listArray (0, l-1) xs)
            forM_ (L.zip [0..(l-1)] rands) $ \(i, j) -> do
                vi <- Arr.readSTArray ar' i
                vj <- Arr.readSTArray ar' j
                Arr.writeSTArray ar' j vi
                Arr.writeSTArray ar' i vj
            return ar'
            )
    return (Arr.elems ar)

redpajama_set_name: RedPajamaGithub


text:
const GameAction = require('./GameAction');
const AbilityChoicePrompt = require('../gamesteps/AbilityChoicePrompt');

class ChooseGameAction extends GameAction {
    constructor(choices) {
        super('choose');
        this.choices = this.createChoices(choices);
    }

    createChoices(choiceDefinition) {
        let choices = [];

        for(let [text, handler] of Object.entries(choiceDefinition)) {
            choices.push({ text: text, handler: handler });
        }

        return choices;
    }

    allow() {
        return this.choices.length > 0;
    }

    createEvent(context) {
        return this.event('onChoose', {}, () => {
            if(this.choices.length === 1) {
                this.choices[0].handler(context);
                return;
            }

            context.game.queueStep(new AbilityChoicePrompt(context.game, context, this.choices));
        });
    }
}

module.exports = ChooseGameAction;


text: uglifyjs gson_china.js backen.js >  gnchina.min.js


text:
<?php

/* core/themes/classy/templates/form/details.html.twig */
class __TwigTemplate_9bf7bf604e315cacbdf0a4424429cb924e06d391ce9ac3d824c033983e8e1593 extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        $this->parent = false;

        $this->blocks = array(
        );
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $__internal_aa7e902108f786591d5a71efc5903a925128107986aacc670db3e120e0b43907 = $this->env->getExtension("native_profiler");
        $__internal_aa7e902108f786591d5a71efc5903a925128107986aacc670db3e120e0b43907->enter($__internal_aa7e902108f786591d5a71efc5903a925128107986aacc670db3e120e0b43907_prof = new Twig_Profiler_Profile($this->getTemplateName(), "template", "core/themes/classy/templates/form/details.html.twig"));

        $tags = array("if" => 18, "set" => 20);
        $filters = array();
        $functions = array();

        try {
            $this->env->getExtension('sandbox')->checkSecurity(
                array('if', 'set'),
                array(),
                array()
            );
        } catch (Twig_Sandbox_SecurityError $e) {
            $e->setTemplateFile($this->getTemplateName());

            if ($e instanceof Twig_Sandbox_SecurityNotAllowedTagError && isset($tags[$e->getTagName()])) {
                $e->setTemplateLine($tags[$e->getTagName()]);
            } elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFilterError && isset($filters[$e->getFilterName()])) {
                $e->setTemplateLine($filters[$e->getFilterName()]);
            } elseif ($e instanceof Twig_Sandbox_SecurityNotAllowedFunctionError && isset($functions[$e->getFunctionName()])) {
                $e->setTemplateLine($functions[$e->getFunctionName()]);
            }

            throw $e;
        }

        // line 17
        echo "env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["attributes"]) ? $context["attributes"] : null), "html", null, true));
        echo ">";
        // line 18
        if ((isset($context["title"]) ? $context["title"] : null)) {
            // line 20
            $context["summary_classes"] = array(0 => ((            // line 21
(isset($context["required"]) ? $context["required"] : null)) ? ("js-form-required") : ("")), 1 => ((            // line 22
(isset($context["required"]) ? $context["required"] : null)) ? ("form-required") : ("")));
            // line 25
            echo "    env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, $this->getAttribute((isset($context["summary_attributes"]) ? $context["summary_attributes"] : null), "addClass", array(0 => (isset($context["summary_classes"]) ? $context["summary_classes"] : null)), "method"), "html", null, true));
            echo ">";
            echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["title"]) ? $context["title"] : null), "html", null, true));
            echo "";
        }
        // line 27
        echo "

    ";
        // line 28
        if ((isset($context["errors"]) ? $context["errors"] : null)) {
            // line 29
            echo "

        ";
            // line 30
            echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["errors"]) ? $context["errors"] : null), "html", null, true));
            echo "

    ";
        }
        // line 33
        if ((isset($context["description"]) ? $context["description"] : null)) {
            // line 34
            echo "
";
            echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["description"]) ? $context["description"] : null), "html", null, true));
            echo "
";
        }
        // line 36
        if ((isset($context["children"]) ? $context["children"] : null)) {
            // line 37
            echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["children"]) ? $context["children"] : null), "html", null, true));
        }
        // line 39
        if ((isset($context["value"]) ? $context["value"] : null)) {
            // line 40
            echo $this->env->getExtension('sandbox')->ensureToStringAllowed($this->env->getExtension('drupal_core')->escapeFilter($this->env, (isset($context["value"]) ? $context["value"] : null), "html", null, true));
        }
        // line 42
        echo "

";

        $__internal_aa7e902108f786591d5a71efc5903a925128107986aacc670db3e120e0b43907->leave($__internal_aa7e902108f786591d5a71efc5903a925128107986aacc670db3e120e0b43907_prof);

    }

    public function getTemplateName()
    {
        return "core/themes/classy/templates/form/details.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  94 => 42,  91 => 40,  89 => 39,  86 => 37,  84 => 36,  79 => 34,  77 => 33,  71 => 30,  68 => 29,  66 => 28,  63 => 27,  56 => 25,  54 => 22,  53 => 21,  52 => 20,  50 => 18,  46 => 17,);
    }

    public function getSource()
    {
        return "{#
/**
 * @file
 * Theme override for a details element.
 *
 * Available variables
 * - attributes: A list of HTML attributes for the details element.
 * - errors: (optional) Any errors for this details element, may not be set.
 * - title: (optional) The title of the element, may not be set.
 * - description: (optional) The description of the element, may not be set.
 * - children: (optional) The children of the element, may not be set.
 * - value: (optional) The value of the element, may not be set.
 *
 * @see template_preprocess_details()
 */
#}

  {%- if title -%}
    {%
      set summary_classes = [
        required ? 'js-form-required',
        required ? 'form-required',
      ]
    %}
    {{ title }}
  {%- endif -%}

    {% if errors %}

        {{ errors }}

    {% endif %}
    {%- if description -%}

{{ description }}

    {%- endif -%}
    {%- if children -%}
      {{ children }}
    {%- endif -%}
    {%- if value -%}
      {{ value }}
    {%- endif -%}

";
    }
}


text:
package org.apache.reef.runtime.common.launch;

import org.apache.commons.lang.StringUtils;
import org.apache.reef.util.OSUtils;

import java.io.File;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * A builder for the command line to launch a DotNent Evaluator.
 */
public final class DotNetLaunchCommandBuilder implements LaunchCommandBuilder {
  private static final Logger LOG = Logger.getLogger(DotNetLaunchCommandBuilder.class.getName());
  private static final String EVALUATOR_DLL_PATH = "reef/global/Org.Apache.REEF.Evaluator.dll";
  private static final String EVALUATOR_EXE_PATH = "reef/global/Org.Apache.REEF.Evaluator.exe";

  private String standardErrPath = null;
  private String standardOutPath = null;
  private List<String> evaluatorConfigurationPaths = new ArrayList<>();

  @Override
  public List<String> build() {
    final List<String> result = new LinkedList<>();
    final File dll = new File(EVALUATOR_DLL_PATH);
    final File exe = new File(EVALUATOR_EXE_PATH);
    if (OSUtils.isWindows() && exe.exists()) {
      LOG.log(Level.WARNING, "Using executable file: {0}", exe.getPath());
      result.add(exe.getPath());
    } else if (dll.exists()) {
      LOG.log(Level.WARNING, "Using dll executable file: {0}", dll.getPath());
      result.add("dotnet");
      result.add(dll.getPath());
    } else {
      LOG.log(Level.WARNING, "executable file can NOT be found");
    }
    result.addAll(evaluatorConfigurationPaths);
    if (StringUtils.isNotEmpty(this.standardOutPath)) {
      result.add(">" + this.standardOutPath);
    }
    if (StringUtils.isNotEmpty(this.standardErrPath)) {
      result.add("2>" + this.standardErrPath);
    }
    LOG.log(Level.INFO, "Launch Exe: {0}", StringUtils.join(result, ' '));
    return result;
  }

  @Override
  @SuppressWarnings("checkstyle:hiddenfield")
  public DotNetLaunchCommandBuilder setMemory(final int megaBytes) {
    return this;
  }

  @Override
  public DotNetLaunchCommandBuilder setConfigurationFilePaths(final List<String> configurationFilePaths) {
    this.evaluatorConfigurationPaths.addAll(configurationFilePaths);
    return this;
  }

  @Override
  public DotNetLaunchCommandBuilder setStandardOut(final String standardOut) {
    this.standardOutPath = standardOut;
    return this;
  }

  @Override
  public DotNetLaunchCommandBuilder setStandardErr(final String standardErr) {
    this.standardErrPath = standardErr;
    return this;
  }
}


text:
using System;

namespace Codesmith.SmithShooter
{
#if WINDOWS || XBOX
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main(string[] args)
        {
            using (SmithShooter game = new SmithShooter())
            {
                game.Run();
            }
        }
    }
#endif
}


text:
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

require_once($CFG->libdir.'/eventslib.php');

defined('MOODLE_INTERNAL') || die();

// File areas for file submission assignment.
define('ASSIGNSUBMISSION_FILE_MAXFILES', 20);
define('ASSIGNSUBMISSION_FILE_MAXSUMMARYFILES', 5);
define('ASSIGNSUBMISSION_FILE_FILEAREA', 'submission_files');

/**
 * Library class for file submission plugin extending submission plugin base class
 *
 * @package   assignsubmission_file
 * @copyright 2012 NetSpot {@link http://www.netspot.com.au}
 * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
class assign_submission_file extends assign_submission_plugin {

    /**
     * Get the name of the file submission plugin
     * @return string
     */
    public function get_name() {
        return get_string('file', 'assignsubmission_file');
    }

    /**
     * Get file submission information from the database
     *
     * @param int $submissionid
     * @return mixed
     */
    private function get_file_submission($submissionid) {
        global $DB;
        return $DB->get_record('assignsubmission_file', array('submission'=>$submissionid));
    }

    /**
     * Get the default setting for file submission plugin
     *
     * @param MoodleQuickForm $mform The form to add elements to
     * @return void
     */
    public function get_settings(MoodleQuickForm $mform) {
        global $CFG, $COURSE;

        $defaultmaxfilesubmissions = $this->get_config('maxfilesubmissions');
        $defaultmaxsubmissionsizebytes = $this->get_config('maxsubmissionsizebytes');

        $settings = array();
        $options = array();
        for ($i = 1; $i <= ASSIGNSUBMISSION_FILE_MAXFILES; $i++) {
            $options[$i] = $i;
        }

        $name = get_string('maxfilessubmission', 'assignsubmission_file');
        $mform->addElement('select', 'assignsubmission_file_maxfiles', $name, $options);
        $mform->addHelpButton('assignsubmission_file_maxfiles',
                              'maxfilessubmission',
                              'assignsubmission_file');
        $mform->setDefault('assignsubmission_file_maxfiles', $defaultmaxfilesubmissions);
        $mform->disabledIf('assignsubmission_file_maxfiles', 'assignsubmission_file_enabled', 'notchecked');

        $choices = get_max_upload_sizes($CFG->maxbytes,
                                        $COURSE->maxbytes,
                                        get_config('assignsubmission_file', 'maxbytes'));

        $settings[] = array('type' => 'select',
                            'name' => 'maxsubmissionsizebytes',
                            'description' => get_string('maximumsubmissionsize', 'assignsubmission_file'),
                            'options'=> $choices,
                            'default'=> $defaultmaxsubmissionsizebytes);

        $name = get_string('maximumsubmissionsize', 'assignsubmission_file');
        $mform->addElement('select', 'assignsubmission_file_maxsizebytes', $name, $choices);
        $mform->addHelpButton('assignsubmission_file_maxsizebytes',
                              'maximumsubmissionsize',
                              'assignsubmission_file');
        $mform->setDefault('assignsubmission_file_maxsizebytes', $defaultmaxsubmissionsizebytes);
        $mform->disabledIf('assignsubmission_file_maxsizebytes',
                           'assignsubmission_file_enabled',
                           'notchecked');
    }

    /**
     * Save the settings for file submission plugin
     *
     * @param stdClass $data
     * @return bool
     */
    public function save_settings(stdClass $data) {
        $this->set_config('maxfilesubmissions', $data->assignsubmission_file_maxfiles);
        $this->set_config('maxsubmissionsizebytes', $data->assignsubmission_file_maxsizebytes);
        return true;
    }

    /**
     * File format options
     *
     * @return array
     */
    private function get_file_options() {
        $fileoptions = array('subdirs'=>1,
                                'maxbytes'=>$this->get_config('maxsubmissionsizebytes'),
                                'maxfiles'=>$this->get_config('maxfilesubmissions'),
                                'accepted_types'=>'*',
                                'return_types'=>FILE_INTERNAL);
        if ($fileoptions['maxbytes'] == 0) {
            // Use module default.
            $fileoptions['maxbytes'] = get_config('assignsubmission_file', 'maxbytes');
        }
        return $fileoptions;
    }

    /**
     * Add elements to submission form
     *
     * @param mixed $submission stdClass|null
     * @param MoodleQuickForm $mform
     * @param stdClass $data
     * @return bool
     */
    public function get_form_elements($submission, MoodleQuickForm $mform, stdClass $data) {

        if ($this->get_config('maxfilesubmissions') <= 0) {
            return false;
        }

        $fileoptions = $this->get_file_options();
        $submissionid = $submission ? $submission->id : 0;

        $data = file_prepare_standard_filemanager($data,
                                                  'files',
                                                  $fileoptions,
                                                  $this->assignment->get_context(),
                                                  'assignsubmission_file',
                                                  ASSIGNSUBMISSION_FILE_FILEAREA,
                                                  $submissionid);
        $mform->addElement('filemanager', 'files_filemanager', html_writer::tag('span', $this->get_name(),
            array('class' => 'accesshide')), null, $fileoptions);

        return true;
    }

    /**
     * Count the number of files
     *
     * @param int $submissionid
     * @param string $area
     * @return int
     */
    private function count_files($submissionid, $area) {

        $fs = get_file_storage();
        $files = $fs->get_area_files($this->assignment->get_context()->id,
                                     'assignsubmission_file',
                                     $area,
                                     $submissionid,
                                     'id',
                                     false);

        return count($files);
    }

    /**
     * Save the files and trigger plagiarism plugin, if enabled,
     * to scan the uploaded files via events trigger
     *
     * @param stdClass $submission
     * @param stdClass $data
     * @return bool
     */
    public function save(stdClass $submission, stdClass $data) {
        global $USER, $DB;

        $fileoptions = $this->get_file_options();

        $data = file_postupdate_standard_filemanager($data,
                                                     'files',
                                                     $fileoptions,
                                                     $this->assignment->get_context(),
                                                     'assignsubmission_file',
                                                     ASSIGNSUBMISSION_FILE_FILEAREA,
                                                     $submission->id);

        $filesubmission = $this->get_file_submission($submission->id);

        // Plagiarism code event trigger when files are uploaded.

        $fs = get_file_storage();
        $files = $fs->get_area_files($this->assignment->get_context()->id,
                                     'assignsubmission_file',
                                     ASSIGNSUBMISSION_FILE_FILEAREA,
                                     $submission->id,
                                     'id',
                                     false);

        $count = $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA);

        $params = array(
            'context' => context_module::instance($this->assignment->get_course_module()->id),
            'objectid' => $submission->id,
            'other' => array(
                'content' => '',
                'pathnamehashes' => array_keys($files)
            )
        );
        $event = \assignsubmission_file\event\assessable_uploaded::create($params);
        $event->set_legacy_files($files);
        $event->trigger();

        if ($filesubmission) {
            $filesubmission->numfiles = $this->count_files($submission->id,
                                                           ASSIGNSUBMISSION_FILE_FILEAREA);
            return $DB->update_record('assignsubmission_file', $filesubmission);
        } else {
            $filesubmission = new stdClass();
            $filesubmission->numfiles = $this->count_files($submission->id,
                                                           ASSIGNSUBMISSION_FILE_FILEAREA);
            $filesubmission->submission = $submission->id;
            $filesubmission->assignment = $this->assignment->get_instance()->id;
            return $DB->insert_record('assignsubmission_file', $filesubmission) > 0;
        }
    }

    /**
     * Produce a list of files suitable for export that represent this feedback or submission
     *
     * @param stdClass $submission The submission
     * @param stdClass $user The user record - unused
     * @return array - return an array of files indexed by filename
     */
    public function get_files(stdClass $submission, stdClass $user) {
        $result = array();
        $fs = get_file_storage();

        $files = $fs->get_area_files($this->assignment->get_context()->id,
                                     'assignsubmission_file',
                                     ASSIGNSUBMISSION_FILE_FILEAREA,
                                     $submission->id,
                                     'timemodified',
                                     false);

        foreach ($files as $file) {
            $result[$file->get_filename()] = $file;
        }
        return $result;
    }

    /**
     * Display the list of files  in the submission status table
     *
     * @param stdClass $submission
     * @param bool $showviewlink Set this to true if the list of files is long
     * @return string
     */
    public function view_summary(stdClass $submission, & $showviewlink) {
        $count = $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA);

        // Show we show a link to view all files for this plugin?
        $showviewlink = $count > ASSIGNSUBMISSION_FILE_MAXSUMMARYFILES;
        if ($count <= ASSIGNSUBMISSION_FILE_MAXSUMMARYFILES) {
            return $this->assignment->render_area_files('assignsubmission_file',
                                                        ASSIGNSUBMISSION_FILE_FILEAREA,
                                                        $submission->id);
        } else {
            return get_string('countfiles', 'assignsubmission_file', $count);
        }
    }

    /**
     * No full submission view - the summary contains the list of files and that is the whole submission
     *
     * @param stdClass $submission
     * @return string
     */
    public function view(stdClass $submission) {
        return $this->assignment->render_area_files('assignsubmission_file',
                                                    ASSIGNSUBMISSION_FILE_FILEAREA,
                                                    $submission->id);
    }

    /**
     * Return true if this plugin can upgrade an old Moodle 2.2 assignment of this type
     * and version.
     *
     * @param string $type
     * @param int $version
     * @return bool True if upgrade is possible
     */
    public function can_upgrade($type, $version) {

        $uploadsingletype ='uploadsingle';
        $uploadtype ='upload';

        if (($type == $uploadsingletype || $type == $uploadtype) && $version >= 2011112900) {
            return true;
        }
        return false;
    }

    /**
     * Upgrade the settings from the old assignment
     * to the new plugin based one
     *
     * @param context $oldcontext - the old assignment context
     * @param stdClass $oldassignment - the old assignment data record
     * @param string $log record log events here
     * @return bool Was it a success? (false will trigger rollback)
     */
    public function upgrade_settings(context $oldcontext, stdClass $oldassignment, & $log) {
        global $DB;

        if ($oldassignment->assignmenttype == 'uploadsingle') {
            $this->set_config('maxfilesubmissions', 1);
            $this->set_config('maxsubmissionsizebytes', $oldassignment->maxbytes);
            return true;
        } else if ($oldassignment->assignmenttype == 'upload') {
            $this->set_config('maxfilesubmissions', $oldassignment->var1);
            $this->set_config('maxsubmissionsizebytes', $oldassignment->maxbytes);

            // Advanced file upload uses a different setting to do the same thing.
            $DB->set_field('assign',
                           'submissiondrafts',
                           $oldassignment->var4,
                           array('id'=>$this->assignment->get_instance()->id));

            // Convert advanced file upload "hide description before due date" setting.
            $alwaysshow = 0;
            if (!$oldassignment->var3) {
                $alwaysshow = 1;
            }
            $DB->set_field('assign',
                           'alwaysshowdescription',
                           $alwaysshow,
                           array('id'=>$this->assignment->get_instance()->id));
            return true;
        }
    }

    /**
     * Upgrade the submission from the old assignment to the new one
     *
     * @param context $oldcontext The context of the old assignment
     * @param stdClass $oldassignment The data record for the old oldassignment
     * @param stdClass $oldsubmission The data record for the old submission
     * @param stdClass $submission The data record for the new submission
     * @param string $log Record upgrade messages in the log
     * @return bool true or false - false will trigger a rollback
     */
    public function upgrade(context $oldcontext,
                            stdClass $oldassignment,
                            stdClass $oldsubmission,
                            stdClass $submission,
                            & $log) {
        global $DB;

        $filesubmission = new stdClass();

        $filesubmission->numfiles = $oldsubmission->numfiles;
        $filesubmission->submission = $submission->id;
        $filesubmission->assignment = $this->assignment->get_instance()->id;

        if (!$DB->insert_record('assignsubmission_file', $filesubmission) > 0) {
            $log .= get_string('couldnotconvertsubmission', 'mod_assign', $submission->userid);
            return false;
        }

        // Now copy the area files.
        $this->assignment->copy_area_files_for_upgrade($oldcontext->id,
                                                        'mod_assignment',
                                                        'submission',
                                                        $oldsubmission->id,
                                                        $this->assignment->get_context()->id,
                                                        'assignsubmission_file',
                                                        ASSIGNSUBMISSION_FILE_FILEAREA,
                                                        $submission->id);

        return true;
    }

    /**
     * The assignment has been deleted - cleanup
     *
     * @return bool
     */
    public function delete_instance() {
        global $DB;
        // Will throw exception on failure.
        $DB->delete_records('assignsubmission_file',
                            array('assignment'=>$this->assignment->get_instance()->id));

        return true;
    }

    /**
     * Formatting for log info
     *
     * @param stdClass $submission The submission
     * @return string
     */
    public function format_for_log(stdClass $submission) {
        // Format the info for each submission plugin (will be added to log).
        $filecount = $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA);

        return get_string('numfilesforlog', 'assignsubmission_file', $filecount);
    }

    /**
     * Return true if there are no submission files
     * @param stdClass $submission
     */
    public function is_empty(stdClass $submission) {
        return $this->count_files($submission->id, ASSIGNSUBMISSION_FILE_FILEAREA) == 0;
    }

    /**
     * Get file areas returns a list of areas this plugin stores files
     * @return array - An array of fileareas (keys) and descriptions (values)
     */
    public function get_file_areas() {
        return array(ASSIGNSUBMISSION_FILE_FILEAREA=>$this->get_name());
    }

    /**
     * Copy the student's submission from a previous submission. Used when a student opts to base their resubmission
     * on the last submission.
     * @param stdClass $sourcesubmission
     * @param stdClass $destsubmission
     */
    public function copy_submission(stdClass $sourcesubmission, stdClass $destsubmission) {
        global $DB;

        // Copy the files across.
        $contextid = $this->assignment->get_context()->id;
        $fs = get_file_storage();
        $files = $fs->get_area_files($contextid,
                                     'assignsubmission_file',
                                     ASSIGNSUBMISSION_FILE_FILEAREA,
                                     $sourcesubmission->id,
                                     'id',
                                     false);
        foreach ($files as $file) {
            $fieldupdates = array('itemid' => $destsubmission->id);
            $fs->create_file_from_storedfile($fieldupdates, $file);
        }

        // Copy the assignsubmission_file record.
        if ($filesubmission = $this->get_file_submission($sourcesubmission->id)) {
            unset($filesubmission->id);
            $filesubmission->submission = $destsubmission->id;
            $DB->insert_record('assignsubmission_file', $filesubmission);
        }
        return true;
    }

    /**
     * Return a description of external params suitable for uploading a file submission from a webservice.
     *
     * @return external_description|null
     */
    public function get_external_parameters() {
        return array(
            'files_filemanager' => new external_value(
                PARAM_INT,
                'The id of a draft area containing files for this submission.'
            )
        );
    }
}


text:
//-----------------------------------------------------------------------------
// Copyright (c) 2014 Daniel Buckmaster
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------

#ifndef _NAVMESH_H_
#define _NAVMESH_H_

#include <queue>

#include "scene/sceneObject.h"
#include "collision/concretePolyList.h"
#include "recastPolyList.h"
#include "util/messaging/eventManager.h"

#include "torqueRecast.h"
#include "duDebugDrawTorque.h"
#include "coverPoint.h"

#include <Recast.h>
#include <DetourNavMesh.h>
#include <DetourNavMeshBuilder.h>
#include <DebugDraw.h>
#include <DetourNavMeshQuery.h>

/// @class NavMesh
/// Represents a set of bounds within which a Recast navigation mesh is generated.
/// @see NavMeshPolyList
/// @see Trigger
class NavMesh : public SceneObject {
   typedef SceneObject Parent;
   friend class NavPath;

public:
   /// @name NavMesh build
   /// @{

   /// Initiates the navmesh build process, which includes notifying the
   /// clients and posting an event.
   bool build(bool background = true, bool saveIntermediates = false);
   /// Stop a build in progress.
   void cancelBuild();
   /// Generate cover points from a nav mesh.
   bool createCoverPoints();
   /// Remove all cover points
   void deleteCoverPoints();

   /// Save the navmesh to a file.
   bool save();
   /// Load a saved navmesh from a file.
   bool load();

   /// Instantly rebuild the tiles in the navmesh that overlap the box.
   void buildTiles(const Box3F &box);

   /// Instantly rebuild a specific tile.
   void buildTile(const U32 &tile);

   /// Rebuild parts of the navmesh where links have changed.
   void buildLinks();

   /// Data file to store this nav mesh in. (From engine executable dir.)
   StringTableEntry mFileName;

   /// Name of the SimSet to store cover points in. (Usually a SimGroup.)
   StringTableEntry mCoverSet;

   /// Cell width and height.
   F32 mCellSize, mCellHeight;
   /// @name Actor data
   /// @{
   F32 mWalkableHeight,
      mWalkableClimb,
      mWalkableRadius,
      mWalkableSlope;
   /// @}
   /// @name Generation data
   /// @{
   U32 mBorderSize;
   F32 mDetailSampleDist, mDetailSampleMaxError;
   U32 mMaxEdgeLen;
   F32 mMaxSimplificationError;
   static const U32 mMaxVertsPerPoly;
   U32 mMinRegionArea;
   U32 mMergeRegionArea;
   F32 mTileSize;
   U32 mMaxPolysPerTile;
   /// @}

   /// @name Water
   /// @{
   enum WaterMethod {
      Ignore,
      Solid,
      Impassable
   };

   WaterMethod mWaterMethod;
   /// @}

   /// @}

   /// Return the index of the tile included by this point.
   S32 getTile(const Point3F& pos);

   /// Return the box of a given tile.
   Box3F getTileBox(U32 id);

   /// @name Links
   /// @{

   /// Add an off-mesh link.
   S32 addLink(const Point3F &from, const Point3F &to, U32 flags = 0);

   /// Get the ID of the off-mesh link near the point.
   S32 getLink(const Point3F &pos);

   /// Get the number of links this mesh has.
   S32 getLinkCount();

   /// Get the starting point of a link.
   Point3F getLinkStart(U32 idx);

   /// Get the ending point of a link.
   Point3F getLinkEnd(U32 idx);

   /// Get the flags used by a link.
   LinkData getLinkFlags(U32 idx);

   /// Set flags used by a link.
   void setLinkFlags(U32 idx, const LinkData &d);

   /// Set the selected state of a link.
   void selectLink(U32 idx, bool select, bool hover = true);

   /// Delete the selected link.
   void deleteLink(U32 idx);

   /// @}

   /// Should small characters use this mesh?
   bool mSmallCharacters;
   /// Should regular-sized characters use this mesh?
   bool mRegularCharacters;
   /// Should large characters use this mesh?
   bool mLargeCharacters;
   /// Should vehicles use this mesh?
   bool mVehicles;

   /// @name Annotations
   /// @{
   /* not implemented
   /// Should we automatically generate jump-down links?
   bool mJumpDownLinks;
   /// Height of a 'small' jump link.
   F32 mJumpLinkSmall;
   /// Height of a 'large' jump link.
   F32 mJumpLinkLarge;
   */
   /// Distance to search for cover.
   F32 mCoverDist;

   /// Distance to search horizontally when peeking around cover.
   F32 mPeekDist;

   /// Add cover to walls that don't have corners?
   bool mInnerCover;

   /// @}

   /// @name SimObject
   /// @{

   virtual void onEditorEnable();
   virtual void onEditorDisable();

   void write(Stream &stream, U32 tabStop, U32 flags);

   /// @}

   /// @name SceneObject
   /// @{

   static void initPersistFields();

   bool onAdd();
   void onRemove();

   enum flags {
      BuildFlag    = Parent::NextFreeMask << 0,
      LoadFlag     = Parent::NextFreeMask << 1,
      NextFreeMask = Parent::NextFreeMask << 2,
   };

   U32 packUpdate(NetConnection *conn, U32 mask, BitStream *stream);
   void unpackUpdate(NetConnection *conn, BitStream *stream);

   void setTransform(const MatrixF &mat);
   void setScale(const VectorF &scale);

   /// @}

   /// @name ProcessObject
   /// @{

   void processTick(const Move *move);

   /// @}

   /// @name Rendering
   /// @{

   void prepRenderImage(SceneRenderState *state);
   void render(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInstance *overrideMat);
   void renderLinks(duDebugDraw &dd);
   void renderTileData(duDebugDrawTorque &dd, U32 tile);

   bool mAlwaysRender;

   /// @}

   NavMesh();
   ~NavMesh();
   DECLARE_CONOBJECT(NavMesh);

   /// Return the server-side NavMesh SimSet.
   static SimSet *getServerSet();

   /// Return the EventManager for all NavMeshes.
   static EventManager *getEventManager();

   void inspectPostApply();

protected:

   dtNavMesh const* getNavMesh() { return nm; }

private:
   /// Generates a navigation mesh for the collection of objects in this
   /// mesh. Returns true if successful. Stores the created mesh in tnm.
   bool generateMesh();

   /// Builds the next tile in the dirty list.
   void buildNextTile();

   /// Save imtermediate navmesh creation data?
   bool mSaveIntermediates;

   /// @name Tiles
   /// @{

   struct Tile {
      /// Torque-space world box of this tile.
      Box3F box;
      /// Local coordinates of this box.
      U32 x, y;
      /// Recast min and max points.
      F32 bmin[3], bmax[3];
      /// Default constructor.
      Tile() : box(Box3F::Invalid), x(0), y(0)
      {
         bmin[0] = bmin[1] = bmin[2] = bmax[0] = bmax[1] = bmax[2] = 0.0f;
      }
      /// Value constructor.
      Tile(const Box3F &b, U32 _x, U32 _y, const F32 *min, const F32 *max)
         : box(b), x(_x), y(_y)
      {
         rcVcopy(bmin, min);
         rcVcopy(bmax, max);
      }
   };

   /// Intermediate data for tile creation.
   struct TileData {
      RecastPolyList          geom;
      rcHeightfield        *hf;
      rcCompactHeightfield *chf;
      rcContourSet         *cs;
      rcPolyMesh           *pm;
      rcPolyMeshDetail     *pmd;
      TileData()
      {
         hf = NULL;
         chf = NULL;
         cs = NULL;
         pm = NULL;
         pmd = NULL;
      }
      void freeAll()
      {
         geom.clear();
         rcFreeHeightField(hf);
         rcFreeCompactHeightfield(chf);
         rcFreeContourSet(cs);
         rcFreePolyMesh(pm);
         rcFreePolyMeshDetail(pmd);
      }
      ~TileData()
      {
         freeAll();
      }
   };

   /// List of tiles.
   Vector<Tile> mTiles;

   /// List of tile intermediate data.
   Vector<TileData> mTileData;

   /// List of indices to the tile array which are dirty.
   Vector<U32> mDirtyTiles;

   /// Update tile dimensions.
   void updateTiles(bool dirty = false);

   /// Generates navmesh data for a single tile.
   unsigned char *buildTileData(const Tile &tile, TileData &data, U32 &dataSize);

   /// @}

   /// @name Off-mesh links
   /// @{

   enum SelectState {
      Unselected,
      Hovered,
      Selected
   };

   Vector<F32> mLinkVerts;            ///< Coordinates of each link vertex
   Vector<bool> mLinksUnsynced;       ///< Are the editor links unsynced from the mesh?
   Vector<F32> mLinkRads;             ///< Radius of each link
   Vector<U8> mLinkDirs;              ///< Direction (one-way or bidirectional)
   Vector<U8> mLinkAreas;             ///< Area ID
   Vector<U16> mLinkFlags; ///< Flags
   Vector<U32> mLinkIDs;              ///< ID number of each link
   Vector<U8> mLinkSelectStates;      ///< Selection state of links
   Vector<bool> mDeleteLinks;         ///< Link will be deleted next build.

   U32 mCurLinkID;

   void eraseLink(U32 idx);
   void eraseLinks();
   void setLinkCount(U32 c);

   /// @}

   /// @name Intermediate data
   /// @{

   /// Config struct.
   rcConfig cfg;

   /// Updates our config from console members.
   void updateConfig();

   dtNavMesh *nm;
   rcContext *ctx;

   /// @}

   /// @name Cover
   /// @{

   struct CoverPointData {
      MatrixF trans;
      CoverPoint::Size size;
      bool peek[3];
   };

   /// Attempt to place cover points along a given edge.
   bool testEdgeCover(const Point3F &pos, const VectorF &dir, CoverPointData &data);

   /// @}

   /// Used to perform non-standard validation. detailSampleDist can be 0, or >= 0.9.
   static bool setProtectedDetailSampleDist(void *obj, const char *index, const char *data);

   /// Updates the client when we check the alwaysRender option.
   static bool setProtectedAlwaysRender(void *obj, const char *index, const char *data);

   /// @name Threaded updates
   /// @{

   /// A simple flag to say we are building.
   bool mBuilding;

   /// @}

   /// @name Rendering
   /// @{

   duDebugDrawTorque mDbgDraw;

   void renderToDrawer();

   /// @}

   /// Server-side set for all NavMesh objects.
   static SimObjectPtr<SimSet> smServerSet;

   /// Use this object to manage update events.
   static SimObjectPtr<EventManager> smEventManager;
};

typedef NavMesh::WaterMethod NavMeshWaterMethod;
DefineEnumType(NavMeshWaterMethod);

#endif


text:
package hudson.slaves;

import com.google.common.annotations.VisibleForTesting;
import hudson.Extension;
import hudson.FilePath;
import jenkins.util.SystemProperties;
import hudson.model.Computer;
import hudson.model.Slave;
import hudson.model.TaskListener;
import hudson.remoting.Channel;
import hudson.remoting.PingThread;
import jenkins.security.MasterToSlaveCallable;
import jenkins.slaves.PingFailureAnalyzer;

import javax.annotation.CheckForNull;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Establish a periodic ping to keep connections between {@link Slave slaves}
 * and the main Jenkins node alive. This prevents network proxies from
 * terminating connections that are idle for too long.
 *
 * @since 1.405
 */
@Extension
public class ChannelPinger extends ComputerListener {
    static final int PING_TIMEOUT_SECONDS_DEFAULT = 4 * 60;
    static final int PING_INTERVAL_SECONDS_DEFAULT = 5 * 60;

    private static final Logger LOGGER = Logger.getLogger(ChannelPinger.class.getName());
    private static final String TIMEOUT_SECONDS_PROPERTY = ChannelPinger.class.getName() + ".pingTimeoutSeconds";
    private static final String INTERVAL_MINUTES_PROPERTY_DEPRECATED = ChannelPinger.class.getName() + ".pingInterval";
    private static final String INTERVAL_SECONDS_PROPERTY = ChannelPinger.class.getName() + ".pingIntervalSeconds";

    /**
     * Timeout for the ping in seconds.
     */
    private int pingTimeoutSeconds = SystemProperties.getInteger(TIMEOUT_SECONDS_PROPERTY, PING_TIMEOUT_SECONDS_DEFAULT, Level.WARNING);

    /**
     * Interval for the ping in seconds.
     */
    private int pingIntervalSeconds = PING_INTERVAL_SECONDS_DEFAULT;

    public ChannelPinger() {

        Integer interval = SystemProperties.getInteger(INTERVAL_SECONDS_PROPERTY, null, Level.WARNING);

        // if interval wasn't set we read the deprecated property in minutes
        if (interval == null) {
            interval = SystemProperties.getInteger(INTERVAL_MINUTES_PROPERTY_DEPRECATED,null, Level.WARNING);
            if (interval != null) {
                LOGGER.warning(INTERVAL_MINUTES_PROPERTY_DEPRECATED + " property is deprecated, " + INTERVAL_SECONDS_PROPERTY + " should be used");
                interval *= 60; //to seconds
            }
        }

        if (interval != null) {
            pingIntervalSeconds = interval;
        }
    }

    @Override
    public void preOnline(Computer c, Channel channel, FilePath root, TaskListener listener)  {
        SlaveComputer slaveComputer = null;
        if (c instanceof SlaveComputer) {
            slaveComputer = (SlaveComputer) c;
        }
        install(channel, slaveComputer);
    }

    public void install(Channel channel) {
        install(channel, null);
    }

    @VisibleForTesting
    /*package*/ void install(Channel channel, @CheckForNull SlaveComputer c) {
        if (pingTimeoutSeconds < 1 || pingIntervalSeconds < 1) {
            LOGGER.warning("Agent ping is disabled");
            return;
        }

        // set up ping from both directions, so that in case of a router dropping a connection,
        // both sides can notice it and take compensation actions.
        try {
            channel.call(new SetUpRemotePing(pingTimeoutSeconds, pingIntervalSeconds));
            LOGGER.fine("Set up a remote ping for " + channel.getName());
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, "Failed to set up a ping for " + channel.getName(), e);
        }

        setUpPingForChannel(channel, c, pingTimeoutSeconds, pingIntervalSeconds, true);
    }

    @VisibleForTesting
    /*package*/ static class SetUpRemotePing extends MasterToSlaveCallable<Void, IOException> {
        private static final long serialVersionUID = -2702219700841759872L;
        @Deprecated
        private transient int pingInterval;
        private final int pingTimeoutSeconds;
        private final int pingIntervalSeconds;

        SetUpRemotePing(int pingTimeoutSeconds, int pingIntervalSeconds) {
            this.pingTimeoutSeconds = pingTimeoutSeconds;
            this.pingIntervalSeconds = pingIntervalSeconds;
        }

        @Override
        public Void call() throws IOException {
            setUpPingForChannel(Channel.current(), null, pingTimeoutSeconds, pingIntervalSeconds, false);
            return null;
        }

        @Override
        public int hashCode() {
            final int prime = 31;
            int result = 1;
            result = prime * result + pingIntervalSeconds;
            result = prime * result + pingTimeoutSeconds;
            return result;
        }

        @Override
        public boolean equals(Object obj) {
            if (this == obj) {
                return true;
            }
            if (obj == null) {
                return false;
            }
            if (getClass() != obj.getClass()) {
                return false;
            }
            SetUpRemotePing other = (SetUpRemotePing) obj;
            if (pingIntervalSeconds != other.pingIntervalSeconds) {
                return false;
            }
            if (pingTimeoutSeconds != other.pingTimeoutSeconds) {
                return false;
            }
            return true;
        }

        protected Object readResolve() {
            if (pingInterval != 0) {
                return new SetUpRemotePing(PING_TIMEOUT_SECONDS_DEFAULT, pingInterval * 60);
            }
            return this;
        }
    }

    @VisibleForTesting
    /*package*/ static void setUpPingForChannel(final Channel channel, final SlaveComputer computer, int timeoutSeconds, int intervalSeconds, final boolean analysis) {
        LOGGER.log(Level.FINE, "setting up ping on {0} with a {1} seconds interval and {2} seconds timeout", new Object[] {channel.getName(), intervalSeconds, timeoutSeconds});
        final AtomicBoolean isInClosed = new AtomicBoolean(false);
        final PingThread t = new PingThread(channel, timeoutSeconds * 1000L, intervalSeconds * 1000L) {
            @Override
            protected void onDead(Throwable cause) {
                    if (analysis) {
                        analyze(cause);
                    }
                    boolean inClosed = isInClosed.get();
                    // Disassociate computer channel before closing it
                    if (computer != null) {
                        Exception exception = cause instanceof Exception ? (Exception) cause: new IOException(cause);
                        computer.disconnect(new OfflineCause.ChannelTermination(exception));
                    }
                    if (inClosed) {
                        LOGGER.log(Level.FINE,"Ping failed after the channel "+channel.getName()+" is already partially closed.",cause);
                    } else {
                        LOGGER.log(Level.INFO,"Ping failed. Terminating the channel "+channel.getName()+".",cause);
                    }
            }
            /** Keep in a separate method so we do not even try to do class loading on {@link PingFailureAnalyzer} from an agent JVM. */
            private void analyze(Throwable cause) {
                for (PingFailureAnalyzer pfa : PingFailureAnalyzer.all()) {
                    try {
                        pfa.onPingFailure(channel, cause);
                    } catch (IOException ex) {
                        LOGGER.log(Level.WARNING, "Ping failure analyzer " + pfa.getClass().getName() + " failed for " + channel.getName(), ex);
                    }
                }
            }
            @Deprecated
            @Override
            protected void onDead() {
                onDead(null);
            }
        };

        channel.addListener(new Channel.Listener() {
            @Override
            public void onClosed(Channel channel, IOException cause) {
                LOGGER.fine("Terminating ping thread for " + channel.getName());
                isInClosed.set(true);
                t.interrupt();  // make sure the ping thread is terminated
            }
        });

        t.start();
        LOGGER.log(Level.FINE, "Ping thread started for {0} with a {1} seconds interval and a {2} seconds timeout",
                   new Object[] { channel, intervalSeconds, timeoutSeconds });
    }
}


text:
import { Button, Join, Popover, Spacer, Text } from "@artsy/palette"
import {
  addToCalendar,
  AddToCalendar as AddToCalendarEvent,
  ContextModule,
} from "@artsy/cohesion"
import {
  generateGoogleCalendarUrl,
  generateIcsCalendarUrl,
} from "v2/Components/AddToCalendar/helpers"
import { useAnalyticsContext, useTracking } from "v2/System"

export interface AddToCalendarProps {
  title: string
  startDate: string
  endDate?: string
  description?: string
  address?: string
  href: string
  liveAuctionUrl?: string
  contextModule: ContextModule
}

export const AddToCalendar: React.FC<AddToCalendarProps> = props => {
  const { trackEvent } = useTracking()
  const {
    contextPageOwnerId,
    contextPageOwnerSlug,
    contextPageOwnerType,
  } = useAnalyticsContext()
  const googleUrl = generateGoogleCalendarUrl(props)
  const icsUrl = generateIcsCalendarUrl(props)

  const trackClick = (subject: AddToCalendarEvent["subject"]) => {
    trackEvent(
      addToCalendar({
        context_module: props.contextModule,
        context_owner_id: contextPageOwnerId,
        context_owner_slug: contextPageOwnerSlug,
        context_owner_type: contextPageOwnerType!,
        subject,
      })
    )
  }

  return (
    <Popover
      placement="bottom"
      popover={
        <Text variant="xs" width={300}>
          <Join separator={<Spacer mb={1} />}>
             trackClick("google")}
              target="_blank"
            >
              Google

             trackClick("iCal")}>
              iCal

             trackClick("outlook")}>
              Outlook

          </Join>
        </Text>
      }
    >
      {({ onVisible, anchorRef }) => {
        return (
          <Button
            variant="secondaryOutline"
            size="small"
            onClick={onVisible}
            ref={anchorRef}
          >
            <Text variant="xs">+ Add to Calendar</Text>
          </Button>
        )
      }}
    </Popover>
  )
}


text:
package pfnguyen.statlogic.descriptive;

import java.util.ArrayList;
import java.util.Collections;

public class Quartiles {
    private double lowerQuartile;
    private Double median;
    private double upperQuartile;

    public Quartiles(ArrayList<Double> values) {
        calcMedian(values);
    }

    private void calcMedian(ArrayList<Double> values) {

        Collections.sort(values);

        /* Finds median for even sized ArrayList */
        if (values.size() % 2 == 0) {
            if (values.size() % 4 != 0) {
                lowerQuartile = values.get((values.size()/4));
                median = values.get(values.size()/2-1) + values.get((values.size()/2)) / 2;
                upperQuartile = values.get((values.size()/4*3+1));
            }
            else {
                lowerQuartile = (values.get(values.size()/4-1) + values.get((values.size()/4))) / 2;
                median = (values.get(values.size()/2-1) + values.get((values.size()/2))) / 2;
                upperQuartile = (values.get(values.size()/4*3-1) + values.get((values.size()/4*3))) / 2;
            }
        }
        /* Finds median for odd sized ArrayList */
        else if (values.size() % 4 == 1) {
            lowerQuartile = (values.get(values.size()/4-1) + values.get((values.size()/4))) / 2;
            median = values.get((values.size()/2));
            upperQuartile = (values.get(values.size()/4*3) + values.get((values.size()/4*3+1))) / 2;
        }
        else {
            lowerQuartile = values.get((values.size()/4));
            median = values.get((values.size()/2));
            upperQuartile = values.get((values.size()/4*3+2));
        }
    }

    public String getStringOfMedian() {
        return median.toString();
    }

    public double getLowerQuartile () {
        return lowerQuartile;
    }

    public double getUpperQuartile() {
        return upperQuartile;
    }

    public double getMedian() {
        return median;
    }
}


text:
package com.enginyoyen.statsd.utils

import com.enginyoyen.statsd.model.Statistic

/**
 * Created by enginyoyen on 21/08/14.
 */
object MetricParser {

  private val METRIC_PATTERN = """(.+):(\d+)\|(c|ms|g)(?:(?<=c)\|@(\d+(?:\.\d+)?))?""".r

  /**
   * Parses the incoming metric string and returns a list of Statistic objects-
   *
   * @param rawMetric
   * @return
   */
  def getStat(rawMetric: String): List[Statistic] = {
    val regexMatches = METRIC_PATTERN.findAllMatchIn(rawMetric)
    val list = regexMatches flatMap {m => List(Statistic(m.group(1), m.group(2).toInt, m.group(3)))}
    list.toList
  }
}


text:
package com.google.jstestdriver;

import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.inject.AbstractModule;
import com.google.inject.assistedinject.FactoryProvider;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Names;
import com.google.inject.util.Providers;
import com.google.jstestdriver.action.ConfigureGatewayAction;
import com.google.jstestdriver.hooks.FileInfoScheme;
import com.google.jstestdriver.output.MultiTestResultListener;
import com.google.jstestdriver.output.TestResultListener;
import com.google.jstestdriver.output.XmlPrinter;
import com.google.jstestdriver.output.XmlPrinterImpl;

import junit.framework.TestCase;

import java.io.File;
import java.io.FileWriter;
import java.io.Reader;
import java.io.StringReader;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

/**
 * Tests for {@link com.google.jstestdriver.IDEPluginActionBuilder}
 *
 * @author alexeagle@google.com (Alex Eagle)
 */
public class IDEPluginActionBuilderTest extends TestCase {
  File tmpDir;

  @Override
  protected void setUp() throws Exception {
    tmpDir = File.createTempFile("test", "JsTestDriver");
    tmpDir.delete();
    tmpDir.mkdir();
    tmpDir.deleteOnExit();
    File file = new File(tmpDir, "blash.js");
    new FileWriter(file).append("a = 1;").close();
  }

  public void testExample() throws Exception {
    Reader configReader = new StringReader("load:\n- blash.js\nserver:\n -http://foo");
    ConfigurationParser configParser =
        new ConfigurationParser(tmpDir, configReader, new DefaultPathRewriter());

    IDEPluginActionBuilder builder = new IDEPluginActionBuilder(configParser, "http://localhost:42242",
        "http://localhost:42242", new ResponseStreamFactoryStub(), new File("."));
    builder.install(new AbstractModule(){
                     @Override
                     protected void configure() {
                       Multibinder.newSetBinder(binder(), FileInfoScheme.class)
                           .addBinding().to(HttpFileInfoScheme.class);
                       bind(Server.class).to(MyServer.class);
                       bind(XmlPrinter.class).to(XmlPrinterImpl.class);
                       bind(TestResultListener.class).toInstance(
                           new MultiTestResultListener(Collections.<TestResultListener>emptySet()));
                       bind(JsonArray.class).annotatedWith(Names.named("gateway"))
                           .toInstance(new JsonArray());
                       bind(ConfigureGatewayAction.Factory.class).toProvider(
                           FactoryProvider.newFactory(ConfigureGatewayAction.Factory.class,
                               ConfigureGatewayAction.class));
                     }
                   });
    builder.addAllTests();
    ActionRunner runner = builder.build();
    assertNotNull(runner);
    //runner.runActions();
    // TODO(corysmith): fix the fact this test is all integration.
    // Without a server. :P
  }

  public void testInstallModuleOverwritingResolvedJustInTimeInjection() throws Exception {
    Reader configReader = new StringReader("load:\n- blash.js\nserver:\n -http://foo");
    ConfigurationParser configParser =
        new ConfigurationParser(tmpDir, configReader, new DefaultPathRewriter());

    IDEPluginActionBuilder builder = new IDEPluginActionBuilder(configParser, "http://address",
        "http://address", new ResponseStreamFactoryStub(), new File("."));
    builder.install(new AbstractModule(){
                     @Override
                     protected void configure() {
                       Multibinder.newSetBinder(binder(), FileInfoScheme.class)
                           .addBinding().to(HttpFileInfoScheme.class);
                       bind(Server.class).to(MyServer.class);
                       bind(XmlPrinter.class).to(XmlPrinterImpl.class);
                       bind(TestResultListener.class)
                           .toProvider(Providers.<TestResultListener>of(null));
                       bind(JsonArray.class).annotatedWith(Names.named("gateway"))
                           .toInstance(new JsonArray());
                       bind(ConfigureGatewayAction.Factory.class).toProvider(
                           FactoryProvider.newFactory(ConfigureGatewayAction.Factory.class,
                               ConfigureGatewayAction.class));
                     }
                   });
    builder.addAllTests();
    builder.build();
    configReader.reset();

    builder.install(new AbstractModule(){
      @Override
      protected void configure() {
        bind(FileLoader.class).to(MyFileLoader.class);
      }
    });
    builder.build();
  }

  private final class ResponseStreamFactoryStub implements ResponseStreamFactory {
    private final class NullResponseStream implements ResponseStream {
      public void stream(Response response) {
      }

      public void finish() {
      }
    }

    public ResponseStream getDryRunActionResponseStream() {
      return new NullResponseStream();
    }

    public ResponseStream getEvalActionResponseStream() {
      return new NullResponseStream();
    }

    public ResponseStream getResetActionResponseStream() {
      return new NullResponseStream();
    }

    public ResponseStream getRunTestsActionResponseStream(String browserId) {
      return new NullResponseStream();
    }
  }

  static class MyFileLoader implements FileLoader {

    public List<FileInfo> loadFiles(
    		Collection<FileInfo> filesToLoad, boolean shouldReset) {
      return new LinkedList<FileInfo>(filesToLoad);
    }
  }

  static class MyServer implements Server {

    private Gson gson = new Gson();

    public String fetch(String url) {
      BrowserInfo browserInfo = new BrowserInfo();

      browserInfo.setId(1l);
      browserInfo.setName("name");
      browserInfo.setOs("os");
      browserInfo.setVersion("version");
      return gson.toJson(Arrays.asList(browserInfo));
    }

    public String post(String url, Map<String, String> params) {
      return null;
    }

    public String postJson(String url, JsonElement json) {
      return null;
    }

    public String startSession(String baseUrl, String id) {
      return null;
    }

    public void stopSession(String baseUrl, String id, String sessionId) {
    }
  }
}


text:
<?php
error_reporting(E_STRICT | E_ALL);

require_once(dirname(__FILE__)."/../../vendor/autoload.php");

use SBData\Model\Table\Anchor\AnchorRow;
use Examples\LowLevel\Model\MyGallery;

/* Construct album model from the gallery model */
$myGallery = new MyGallery();
$album = $myGallery->constructAlbum();

/* Album controller */
try
{
	if(!array_key_exists("ALBUM_ID", $_REQUEST))
		$album->create();
	else if(array_key_exists("__operation", $_REQUEST))
	{
		if($_REQUEST["__operation"] == "insert_album")
		{
			if($album->insert($_REQUEST))
			{
				header("Location: ".$_SERVER["PHP_SELF"]."?".http_build_query(array(
					"ALBUM_ID" => $album->entity["ALBUM_ID"]
				), "", null, PHP_QUERY_RFC3986));
				exit;
			}
		}
		else if($_REQUEST["__operation"] == "update_album")
		{
			if($album->update($_REQUEST))
			{
				header("Location: ".$_SERVER["PHP_SELF"]."?".http_build_query(array(
					"ALBUM_ID" => $album->entity["ALBUM_ID"]
				), "", null, PHP_QUERY_RFC3986));
				exit;
			}
		}
		else if($_REQUEST["__operation"] == "remove_album")
		{
			$album->remove($_REQUEST["ALBUM_ID"]);

			header("Location: ".$_SERVER["HTTP_REFERER"].AnchorRow::composePreviousRowFragment("album"));
			exit;
		}
		else if($_REQUEST["__operation"] == "moveleft_album")
		{
			if($album->moveLeft($_REQUEST["ALBUM_ID"]))
				$rowFragment = AnchorRow::composePreviousRowFragment("album");
			else
				$rowFragment = AnchorRow::composeRowFragment("album");

			header("Location: ".$_SERVER["HTTP_REFERER"].$rowFragment);
			exit;
		}
		else if($_REQUEST["__operation"] == "moveright_album")
		{
			if($album->moveRight($_REQUEST["ALBUM_ID"]))
				$rowFragment = AnchorRow::composeNextRowFragment("album");
			else
				$rowFragment = AnchorRow::composeRowFragment("album");

			header("Location: ".$_SERVER["HTTP_REFERER"].$rowFragment);
			exit;
		}
		else
			throw new Exception("Unknown operation: ".$_REQUEST["__operation"]);
	}
	else
		$album->view($_REQUEST["ALBUM_ID"]);

	$error = null;
}
catch(Exception $ex)
{
	header("HTTP/1.1 404 Not Found");
	$error = $ex->getMessage();
}
?>
<!DOCTYPE html>

		<title>Album</title>
		<link rel="stylesheet" type="text/css" href="style.css">
		<link rel="stylesheet" type="text/css" href="gallery.css">

Album

		<?php
		/* View the album */

		if($error === null)
		{
			\SBGallery\View\HTML\displayAlbumBreadcrumbs($album, "gallery.php", "album.php");

			if(array_key_exists("view", $_GET) && $_GET["view"] == "1")
				\SBGallery\View\HTML\displayAlbum($album);
			else
			{
				\SBGallery\View\HTML\displayEditableAlbum($album,
					"Submit",
					"One or more fields are incorrectly specified and marked with a red color!",
					"This field is incorrectly specified!");
			}
		}
		else
		{
			?>

<?= $error ?>

			<?php
		}
		?>


text:
package org.elasticsearch.action.admin.indices.mapping.put;

import org.elasticsearch.action.support.master.AcknowledgedResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.ConstructingObjectParser;
import org.elasticsearch.common.xcontent.XContentParser;

import java.io.IOException;

/**
 * The response of put mapping operation.
 */
public class PutMappingResponse extends AcknowledgedResponse {

    private static final ConstructingObjectParser<PutMappingResponse, Void> PARSER = new ConstructingObjectParser<>("put_mapping",
        true, args -> new PutMappingResponse((boolean) args[0]));

    static {
        declareAcknowledgedField(PARSER);
    }

    protected PutMappingResponse() {

    }

    protected PutMappingResponse(boolean acknowledged) {
        super(acknowledged);
    }

    @Override
    public void readFrom(StreamInput in) throws IOException {
        super.readFrom(in);
        readAcknowledged(in);
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        super.writeTo(out);
        writeAcknowledged(out);
    }

    public static PutMappingResponse fromXContent(XContentParser parser) {
        return PARSER.apply(parser, null);
    }
}


text:
import Router from 'next/router'
import { observer } from 'mobx-react'
import DropDownMenu from 'material-ui/DropDownMenu'
import MenuItem from 'material-ui/MenuItem'
import projects from '~/stores/projects'
import { headingStyle } from '~/components/elements/styles'

@observer
export default class extends React.Component {
  constructor(props) {
    super(props)
    this.state = { path: props.path }
  }

  handleChange = (event, index, path) => {
    this.setState({ path })
    Router.push(path)
  };

  handlePrefetch = path => () => {
    Router.prefetch(path)
  };

  styles = {
    menuStyle: {
      ...headingStyle,
      marginTop: -8,
      fontSize: 24,
    },
    menuItemStyle: {
      ...headingStyle,
    },
  };

  render() {
    return (
      <DropDownMenu
        value={this.state.path}
        onChange={this.handleChange}
        style={this.styles.menuStyle}
      >
        <MenuItem
          value={'/'}
          primaryText="Home"
          style={this.styles.menuItemStyle}
          onMouseEnter={this.handlePrefetch('/')}
        />
        {projects.values.map((project, index) => (
          <MenuItem
            key={index}
            value={project.route}
            primaryText={project.name}
            style={this.styles.menuItemStyle}
            onMouseEnter={this.handlePrefetch('/todo')}
          />
        ))}
      </DropDownMenu>
    )
  }
}


text:
/**
 *
 */
package bixie.boogie.ast.expression;

import java.util.HashMap;
import java.util.HashSet;

import bixie.boogie.ast.Body;
import bixie.boogie.ast.location.ILocation;

/**
 * @author schaef
 *
 */
public class CodeExpression extends Expression {

	Body body;

	public CodeExpression(ILocation loc, Body b) {
		super(loc);
		this.body = b;
	}

	public Body getBody() {
		return this.body;
	}

	/**
	 * Returns a textual description of this object.
	 */
	@Override
	public String toString() {
		return "CodeExpression";
	}

	/* (non-Javadoc)
	 * @see boogie.expression.Expression#substitute(java.util.HashMap)
	 */
	@Override
	public Expression substitute(HashMap<String, Expression> s) {
		throw new RuntimeException("Subsitution for CodeExpression not implemented!");
	}

	@Override
	public HashSet<IdentifierExpression> getFreeVariables() {
//		HashSet<IdentifierExpression> ret = new HashSet<IdentifierExpression>();
//		for (Statement s : this.body.getBlock()) {
			throw new RuntimeException("Not implemented");
//		}
//		return ret;
	}

}