text:
<?php
/**
 * Generated by Protobuf protoc plugin.
 *
 * File descriptor :
 * POGOProtos/Networking/Responses/CheckAwardedBadgesResponse.proto
 */

namespace POGOProtos\Networking\Responses;

/**
 * Protobuf message : POGOProtos.Networking.Responses.CheckAwardedBadgesResponse
 */
class CheckAwardedBadgesResponse extends \Protobuf\AbstractMessage
{

    /**
     * @var \Protobuf\UnknownFieldSet
     */
    protected $unknownFieldSet = null;

    /**
     * @var \Protobuf\Extension\ExtensionFieldMap
     */
    protected $extensions = null;

    /**
     * success optional bool = 1
     *
     * @var bool
     */
    protected $success = null;

    /**
     * awarded_badges repeated enum = 2
     *
     * @var \Protobuf\Collection<\POGOProtos\Enums\BadgeType>
     */
    protected $awarded_badges = null;

    /**
     * awarded_badge_levels repeated int32 = 3
     *
     * @var \Protobuf\Collection
     */
    protected $awarded_badge_levels = null;

    /**
     * avatar_template_ids repeated string = 4
     *
     * @var \Protobuf\Collection
     */
    protected $avatar_template_ids = null;

    /**
     * Check if 'success' has a value
     *
     * @return bool
     */
    public function hasSuccess()
    {
        return $this->success !== null;
    }

    /**
     * Get 'success' value
     *
     * @return bool
     */
    public function getSuccess()
    {
        return $this->success;
    }

    /**
     * Set 'success' value
     *
     * @param bool $value
     */
    public function setSuccess($value = null)
    {
        $this->success = $value;
    }

    /**
     * Check if 'awarded_badges' has a value
     *
     * @return bool
     */
    public function hasAwardedBadgesList()
    {
        return $this->awarded_badges !== null;
    }

    /**
     * Get 'awarded_badges' value
     *
     * @return \Protobuf\Collection<\POGOProtos\Enums\BadgeType>
     */
    public function getAwardedBadgesList()
    {
        return $this->awarded_badges;
    }

    /**
     * Set 'awarded_badges' value
     *
     * @param \Protobuf\Collection<\POGOProtos\Enums\BadgeType> $value
     */
    public function setAwardedBadgesList(\Protobuf\Collection $value = null)
    {
        $this->awarded_badges = $value;
    }

    /**
     * Add a new element to 'awarded_badges'
     *
     * @param \POGOProtos\Enums\BadgeType $value
     */
    public function addAwardedBadges(\POGOProtos\Enums\BadgeType $value)
    {
        if ($this->awarded_badges === null) {
            $this->awarded_badges = new \Protobuf\EnumCollection();
        }

        $this->awarded_badges->add($value);
    }

    /**
     * Check if 'awarded_badge_levels' has a value
     *
     * @return bool
     */
    public function hasAwardedBadgeLevelsList()
    {
        return $this->awarded_badge_levels !== null;
    }

    /**
     * Get 'awarded_badge_levels' value
     *
     * @return \Protobuf\Collection
     */
    public function getAwardedBadgeLevelsList()
    {
        return $this->awarded_badge_levels;
    }

    /**
     * Set 'awarded_badge_levels' value
     *
     * @param \Protobuf\Collection $value
     */
    public function setAwardedBadgeLevelsList(\Protobuf\Collection $value = null)
    {
        $this->awarded_badge_levels = $value;
    }

    /**
     * Add a new element to 'awarded_badge_levels'
     *
     * @param int $value
     */
    public function addAwardedBadgeLevels($value)
    {
        if ($this->awarded_badge_levels === null) {
            $this->awarded_badge_levels = new \Protobuf\ScalarCollection();
        }

        $this->awarded_badge_levels->add($value);
    }

    /**
     * Check if 'avatar_template_ids' has a value
     *
     * @return bool
     */
    public function hasAvatarTemplateIdsList()
    {
        return $this->avatar_template_ids !== null;
    }

    /**
     * Get 'avatar_template_ids' value
     *
     * @return \Protobuf\Collection
     */
    public function getAvatarTemplateIdsList()
    {
        return $this->avatar_template_ids;
    }

    /**
     * Set 'avatar_template_ids' value
     *
     * @param \Protobuf\Collection $value
     */
    public function setAvatarTemplateIdsList(\Protobuf\Collection $value = null)
    {
        $this->avatar_template_ids = $value;
    }

    /**
     * Add a new element to 'avatar_template_ids'
     *
     * @param string $value
     */
    public function addAvatarTemplateIds($value)
    {
        if ($this->avatar_template_ids === null) {
            $this->avatar_template_ids = new \Protobuf\ScalarCollection();
        }

        $this->avatar_template_ids->add($value);
    }

    /**
     * {@inheritdoc}
     */
    public function extensions()
    {
        if ( $this->extensions !== null) {
            return $this->extensions;
        }

        return $this->extensions = new \Protobuf\Extension\ExtensionFieldMap(__CLASS__);
    }

    /**
     * {@inheritdoc}
     */
    public function unknownFieldSet()
    {
        return $this->unknownFieldSet;
    }

    /**
     * {@inheritdoc}
     */
    public static function fromStream($stream, \Protobuf\Configuration $configuration = null)
    {
        return new self($stream, $configuration);
    }

    /**
     * {@inheritdoc}
     */
    public static function fromArray(array $values)
    {
        $message = new self();
        $values  = array_merge([
            'success' => null,
            'awarded_badges' => [],
            'awarded_badge_levels' => [],
            'avatar_template_ids' => []
        ], $values);

        $message->setSuccess($values['success']);

        foreach ($values['awarded_badges'] as $item) {
            $message->addAwardedBadges($item);
        }

        foreach ($values['awarded_badge_levels'] as $item) {
            $message->addAwardedBadgeLevels($item);
        }

        foreach ($values['avatar_template_ids'] as $item) {
            $message->addAvatarTemplateIds($item);
        }

        return $message;
    }

    /**
     * {@inheritdoc}
     */
    public static function descriptor()
    {
        return \google\protobuf\DescriptorProto::fromArray([
            'name'      => 'CheckAwardedBadgesResponse',
            'field'     => [
                \google\protobuf\FieldDescriptorProto::fromArray([
                    'number' => 1,
                    'name' => 'success',
                    'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_BOOL(),
                    'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_OPTIONAL()
                ]),
                \google\protobuf\FieldDescriptorProto::fromArray([
                    'number' => 2,
                    'name' => 'awarded_badges',
                    'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_ENUM(),
                    'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED(),
                    'type_name' => '.POGOProtos.Enums.BadgeType'
                ]),
                \google\protobuf\FieldDescriptorProto::fromArray([
                    'number' => 3,
                    'name' => 'awarded_badge_levels',
                    'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_INT32(),
                    'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED()
                ]),
                \google\protobuf\FieldDescriptorProto::fromArray([
                    'number' => 4,
                    'name' => 'avatar_template_ids',
                    'type' => \google\protobuf\FieldDescriptorProto\Type::TYPE_STRING(),
                    'label' => \google\protobuf\FieldDescriptorProto\Label::LABEL_REPEATED()
                ]),
            ],
        ]);
    }

    /**
     * {@inheritdoc}
     */
    public function toStream(\Protobuf\Configuration $configuration = null)
    {
        $config  = $configuration ?: \Protobuf\Configuration::getInstance();
        $context = $config->createWriteContext();
        $stream  = $context->getStream();

        $this->writeTo($context);
        $stream->seek(0);

        return $stream;
    }

    /**
     * {@inheritdoc}
     */
    public function writeTo(\Protobuf\WriteContext $context)
    {
        $stream      = $context->getStream();
        $writer      = $context->getWriter();
        $sizeContext = $context->getComputeSizeContext();

        if ($this->success !== null) {
            $writer->writeVarint($stream, 8);
            $writer->writeBool($stream, $this->success);
        }

        if ($this->awarded_badges !== null) {
            foreach ($this->awarded_badges as $val) {
                $writer->writeVarint($stream, 16);
                $writer->writeVarint($stream, $val->value());
            }
        }

        if ($this->awarded_badge_levels !== null) {
            foreach ($this->awarded_badge_levels as $val) {
                $writer->writeVarint($stream, 24);
                $writer->writeVarint($stream, $val);
            }
        }

        if ($this->avatar_template_ids !== null) {
            foreach ($this->avatar_template_ids as $val) {
                $writer->writeVarint($stream, 34);
                $writer->writeString($stream, $val);
            }
        }

        if ($this->extensions !== null) {
            $this->extensions->writeTo($context);
        }

        return $stream;
    }

    /**
     * {@inheritdoc}
     */
    public function readFrom(\Protobuf\ReadContext $context)
    {
        $reader = $context->getReader();
        $length = $context->getLength();
        $stream = $context->getStream();

        $limit = ($length !== null)
            ? ($stream->tell() + $length)
            : null;

        while ($limit === null || $stream->tell() < $limit) {

            if ($stream->eof()) {
                break;
            }

            $key  = $reader->readVarint($stream);
            $wire = \Protobuf\WireFormat::getTagWireType($key);
            $tag  = \Protobuf\WireFormat::getTagFieldNumber($key);

            if ($stream->eof()) {
                break;
            }

            if ($tag === 1) {
                \Protobuf\WireFormat::assertWireType($wire, 8);

                $this->success = $reader->readBool($stream);

                continue;
            }

            if ($tag === 2) {
                $innerSize  = $reader->readVarint($stream);
                $innerLimit = $stream->tell() + $innerSize;

                if ($this->awarded_badges === null) {
                    $this->awarded_badges = new \Protobuf\EnumCollection();
                }

                while ($stream->tell() < $innerLimit) {
                    $this->awarded_badges->add(\POGOProtos\Enums\BadgeType::valueOf($reader->readVarint($stream)));
                }

                continue;
            }

            if ($tag === 3) {
                $innerSize  = $reader->readVarint($stream);
                $innerLimit = $stream->tell() + $innerSize;

                if ($this->awarded_badge_levels === null) {
                    $this->awarded_badge_levels = new \Protobuf\ScalarCollection();
                }

                while ($stream->tell() < $innerLimit) {
                    $this->awarded_badge_levels->add($reader->readVarint($stream));
                }

                continue;
            }

            if ($tag === 4) {
                \Protobuf\WireFormat::assertWireType($wire, 9);

                if ($this->avatar_template_ids === null) {
                    $this->avatar_template_ids = new \Protobuf\ScalarCollection();
                }

                $this->avatar_template_ids->add($reader->readString($stream));

                continue;
            }

            $extensions = $context->getExtensionRegistry();
            $extension  = $extensions ? $extensions->findByNumber(__CLASS__, $tag) : null;

            if ($extension !== null) {
                $this->extensions()->add($extension, $extension->readFrom($context, $wire));

                continue;
            }

            if ($this->unknownFieldSet === null) {
                $this->unknownFieldSet = new \Protobuf\UnknownFieldSet();
            }

            $data    = $reader->readUnknown($stream, $wire);
            $unknown = new \Protobuf\Unknown($tag, $wire, $data);

            $this->unknownFieldSet->add($unknown);

        }
    }

    /**
     * {@inheritdoc}
     */
    public function serializedSize(\Protobuf\ComputeSizeContext $context)
    {
        $calculator = $context->getSizeCalculator();
        $size       = 0;

        if ($this->success !== null) {
            $size += 1;
            $size += 1;
        }

        if ($this->awarded_badges !== null) {
            foreach ($this->awarded_badges as $val) {
                $size += 1;
                $size += $calculator->computeVarintSize($val->value());
            }
        }

        if ($this->awarded_badge_levels !== null) {
            foreach ($this->awarded_badge_levels as $val) {
                $size += 1;
                $size += $calculator->computeVarintSize($val);
            }
        }

        if ($this->avatar_template_ids !== null) {
            foreach ($this->avatar_template_ids as $val) {
                $size += 1;
                $size += $calculator->computeStringSize($val);
            }
        }

        if ($this->extensions !== null) {
            $size += $this->extensions->serializedSize($context);
        }

        return $size;
    }

    /**
     * {@inheritdoc}
     */
    public function clear()
    {
        $this->success = null;
        $this->awarded_badges = null;
        $this->awarded_badge_levels = null;
        $this->avatar_template_ids = null;
    }

    /**
     * {@inheritdoc}
     */
    public function merge(\Protobuf\Message $message)
    {
        if ( ! $message instanceof \POGOProtos\Networking\Responses\CheckAwardedBadgesResponse) {
            throw new \InvalidArgumentException(sprintf('Argument 1 passed to %s must be a %s, %s given', __METHOD__, __CLASS__, get_class($message)));
        }

        $this->success = ($message->success !== null) ? $message->success : $this->success;
        $this->awarded_badges = ($message->awarded_badges !== null) ? $message->awarded_badges : $this->awarded_badges;
        $this->awarded_badge_levels = ($message->awarded_badge_levels !== null) ? $message->awarded_badge_levels : $this->awarded_badge_levels;
        $this->avatar_template_ids = ($message->avatar_template_ids !== null) ? $message->avatar_template_ids : $this->avatar_template_ids;
    }

}


text:
Configuration

                        Collapse menu

                        <input type="checkbox" name="collapsemenu" class="onoffswitch-checkbox" id="collapsemenu">

                        Fixed sidebar

                        <input type="checkbox" name="fixedsidebar" class="onoffswitch-checkbox" id="fixedsidebar">

                        Top navbar

                        <input type="checkbox" name="fixednavbar" class="onoffswitch-checkbox" id="fixednavbar">

                        Boxed layout

                        <input type="checkbox" name="boxedlayout" class="onoffswitch-checkbox" id="boxedlayout">

                        Fixed footer

                        <input type="checkbox" name="fixedfooter" class="onoffswitch-checkbox" id="fixedfooter">

Skins

                             Default

                            Blue light

                            Yellow/Purple

redpajama_set_name: RedPajamaGithub


text:
// file.h cross platform basic file class. supports 64 bit offsets and such.

#pragma once

#include <boost/cstdint.hpp>
#include <string>

#include "mongo/platform/basic.h"
#include "mongo/platform/cstdint.h"

namespace mongo {

    typedef uint64_t fileofs;

    // NOTE: not thread-safe. (at least the windows implementation isn't)

    class File {

    public:
        File();
        ~File();

        bool bad() const { return _bad; }
        void fsync() const;
        bool is_open() const;
        fileofs len();
        void open(const char* filename, bool readOnly = false, bool direct = false);
        void read(fileofs o, char* data, unsigned len);
        void truncate(fileofs size);
        void write(fileofs o, const char* data, unsigned len);

        static boost::intmax_t freeSpace(const std::string& path);

    private:
        bool _bad;
#ifdef _WIN32
        HANDLE _handle;
#else
        int _fd;
#endif
        std::string _name;

    };

}


text:
<?php

namespace peterfriz\pagevisibility;

/**
 * Asset bundle for the js Page Visibility plugin.
 *
 * @author Piet de Vries <friz@pietdevries.nl>
 * @since 1.0
 */
class PageVisibilityAsset extends \yii\web\AssetBundle
{

    /**
     * @inheritdoc
     */
    public $sourcePath = '@peterfriz/pagevisibility/assets';

    /**
     * @inheritdoc
     */
    public $js = [
        'js/page_visibility.js',
    ];

}


text: Uses the nodejs native driver to provide an HTTP api to MongoDB.


text:
exports.definition = {

	config: {
		"columns": {
			"source_id": "string",
			"name":"varchar",
			"map":"varchar",
			"date": "integer",
			"region":  "varchar",
			"organiser": "varchar",
			"url": "varchar",
			"eventCenterLatitude": "float",
			"eventCenterLongitude": "float",
			"classification": "integer",
			"day": "boolean",
			"night": "boolean",
			"eventCenter": "varchar",
			"enabled": "boolean",
			"urlStartlist": "varchar",
			"urlResults": "varchar",

		},
		"defaults":{
			"registred" : false
		},
		"adapter": {
			"type": "sql",
			"collection_name": "event"
		}
	},

	extendModel: function(Model) {
		_.extend(Model.prototype, {

			// extended functions go here

		}); // end extend

		return Model;
	},

	extendCollection: function(Collection) {
		_.extend(Collection.prototype, {
			getByData: function(data) {
				var item;
				var possibleItems = this.where({"source_id":data.source_id});
				if(possibleItems.length > 0) {
					item = possibleItems[0];
					item.set(data);
				}
				else {
					item = Alloy.createModel("event", data);
					item.set('enabled', 1)
					this.add(item);
				}
				return item;
			}
		}); // end extend

		return Collection;
	}

};


text:
<?xml version="1.0" encoding="UTF-8"?>
<GeocodeResponse>
 <status>OK</status>
 <result>
  <type>locality</type>
  <type>political</type>
  <formatted_address>Rauchwart, Austria</formatted_address>
  <address_component>
   <long_name>Rauchwart</long_name>
   <short_name>Rauchwart</short_name>
   <type>locality</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Rauchwart im Burgenland</long_name>
   <short_name>Rauchwart im Burgenland</short_name>
   <type>administrative_area_level_3</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Güssing District</long_name>
   <short_name>Güssing District</short_name>
   <type>administrative_area_level_2</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Burgenland</long_name>
   <short_name>Burgenland</short_name>
   <type>administrative_area_level_1</type>
   <type>political</type>
  </address_component>
  <address_component>
   <long_name>Austria</long_name>
   <short_name>AT</short_name>
   <type>country</type>
   <type>political</type>
  </address_component>
  <geometry>
   <location>
    <lat>47.1335752</lat>
    <lng>16.2371023</lng>
   </location>
   <location_type>APPROXIMATE</location_type>
   <viewport>
    <southwest>
     <lat>47.1085999</lat>
     <lng>16.1989199</lng>
    </southwest>
    <northeast>
     <lat>47.1757101</lat>
     <lng>16.2556200</lng>
    </northeast>
   </viewport>
   <bounds>
    <southwest>
     <lat>47.1085999</lat>
     <lng>16.1989199</lng>
    </southwest>
    <northeast>
     <lat>47.1757101</lat>
     <lng>16.2556200</lng>
    </northeast>
   </bounds>
  </geometry>
  <place_id>ChIJO5CRf5PubkcRUA_mLVeXAAQ</place_id>
 </result>
</GeocodeResponse>


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Philipp. J. Sci. , C, Bot. 8: 181 (1913)

#### Original name
Meliola cylindrophora Rehm

### Remarks
null


text:
/* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE190_Integer_Overflow__int_fgets_square_41.c
Label Definition File: CWE190_Integer_Overflow__int.label.xml
Template File: sources-sinks-41.tmpl.c
*/
/*
 * @description
 * CWE: 190 Integer Overflow
 * BadSource: fgets Read data from the console using fgets()
 * GoodSource: Set data to a small, non-zero number (two)
 * Sinks: square
 *    GoodSink: Ensure there will not be an overflow before squaring data
 *    BadSink : Square data, which can lead to overflow
 * Flow Variant: 41 Data flow: data passed as an argument from one function to another in the same source file
 *
 * */

#include "std_testcase.h"

#define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2)

#include <math.h>

#ifndef OMITBAD

static void badSink(int data)
{
    {
        /* POTENTIAL FLAW: if (data*data) > INT_MAX, this will overflow */
        int result = data * data;
        printIntLine(result);
    }
}

void CWE190_Integer_Overflow__int_fgets_square_41_bad()
{
    int data;
    /* Initialize data */
    data = 0;
    {
        char inputBuffer[CHAR_ARRAY_SIZE] = "";
        /* POTENTIAL FLAW: Read data from the console using fgets() */
        if (fgets(inputBuffer, CHAR_ARRAY_SIZE, stdin) != NULL)
        {
            /* Convert to int */
            data = atoi(inputBuffer);
        }
        else
        {
            printLine("fgets() failed.");
        }
    }
    badSink(data);
}

#endif /* OMITBAD */

#ifndef OMITGOOD

/* goodG2B uses the GoodSource with the BadSink */
static void goodG2BSink(int data)
{
    {
        /* POTENTIAL FLAW: if (data*data) > INT_MAX, this will overflow */
        int result = data * data;
        printIntLine(result);
    }
}

static void goodG2B()
{
    int data;
    /* Initialize data */
    data = 0;
    /* FIX: Use a small, non-zero value that will not cause an integer overflow in the sinks */
    data = 2;
    goodG2BSink(data);
}

/* goodB2G uses the BadSource with the GoodSink */
static void goodB2GSink(int data)
{
    /* FIX: Add a check to prevent an overflow from occurring */
    if (abs((long)data) <= (long)sqrt((double)INT_MAX))
    {
        int result = data * data;
        printIntLine(result);
    }
    else
    {
        printLine("data value is too large to perform arithmetic safely.");
    }
}

static void goodB2G()
{
    int data;
    /* Initialize data */
    data = 0;
    {
        char inputBuffer[CHAR_ARRAY_SIZE] = "";
        /* POTENTIAL FLAW: Read data from the console using fgets() */
        if (fgets(inputBuffer, CHAR_ARRAY_SIZE, stdin) != NULL)
        {
            /* Convert to int */
            data = atoi(inputBuffer);
        }
        else
        {
            printLine("fgets() failed.");
        }
    }
    goodB2GSink(data);
}

void CWE190_Integer_Overflow__int_fgets_square_41_good()
{
    goodB2G();
    goodG2B();
}

#endif /* OMITGOOD */

/* Below is the main(). It is only used when building this testcase on
   its own for testing or for building a binary to use in testing binary
   analysis tools. It is not used when compiling all the testcases as one
   application, which is how source code analysis tools are tested. */

#ifdef INCLUDEMAIN

int main(int argc, char * argv[])
{
    /* seed randomness */
    srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
    printLine("Calling good()...");
    CWE190_Integer_Overflow__int_fgets_square_41_good();
    printLine("Finished good()");
#endif /* OMITGOOD */
#ifndef OMITBAD
    printLine("Calling bad()...");
    CWE190_Integer_Overflow__int_fgets_square_41_bad();
    printLine("Finished bad()");
#endif /* OMITBAD */
    return 0;
}

#endif


text:
#include <memory>

#include <TChain.h>
#include <TTree.h>

#ifdef FROM_CMSSW
#include "../interface/TreeWrapper.h"
#else
#include <TreeWrapper.h>
#endif

namespace ROOT {
    TreeWrapper::TreeWrapper(TTree* tree):
        m_tree(tree),
        m_chain(nullptr),
        m_entry(0) {
            init(tree);
        }

    TreeWrapper::TreeWrapper():
        m_tree(nullptr),
        m_chain(nullptr),
        m_entry(0) {

        }

    TreeWrapper::TreeWrapper(const TreeWrapper& o) {
        m_tree = o.m_tree;
        m_chain = o.m_chain;
        m_leafs = o.m_leafs;
        m_varrGroups = o.m_varrGroups;
    }

    TreeWrapper::TreeWrapper(TreeWrapper&& o) {
        m_tree = o.m_tree;
        m_chain = o.m_chain;
        m_leafs = std::move(o.m_leafs);
        m_varrGroups = std::move(o.m_varrGroups);
    }

    void TreeWrapper::init(TTree* tree) {
        m_tree = tree;
        m_chain = dynamic_cast<TChain*>(tree);
        if (m_chain)
            m_chain->LoadTree(0);

        for (auto& leaf: m_leafs)
            leaf.second->init(this);
        for (auto& vGroup : m_varrGroups)
            vGroup.second->init(this);
    }

    /**
     * Read the next entry of the tree.
     *
     * returns true in case of success, or false if the end of the tree is reached
     */
    bool TreeWrapper::next(bool readall/* = false*/) {
        uint64_t stop_at = getStopAt();

        if (m_entry >= stop_at)
            return false;

        bool result = getEntry(m_entry, readall);
        m_entry++;

        return result;
    }

    bool TreeWrapper::getEntry(uint64_t entry, bool readall/* = false*/) {

        if (! m_cleaned) {
            for (auto it = m_leafs.begin(); it != m_leafs.end(); ) {
                if (it->second->getBranch() == nullptr) {
                    it = m_leafs.erase(it);
                } else
                    ++it;
            }
            for (auto& vGroup : m_varrGroups) {
              for (auto it = vGroup.second->m_leafs.begin(); vGroup.second->m_leafs.end() != it; ++it) {
                if ( ! it->second->getBranch() ) {
                  it = vGroup.second->m_leafs.erase(it);
                } else {
                  ++it;
                }
              }
            }

            m_cleaned = true;
        }

        if (readall) {
            if (! m_tree->GetEntry(entry, 1))
                return false;
        } else {
            uint64_t local_entry = entry;
            if (m_chain) {
                int64_t tree_index = m_chain->LoadTree(local_entry);
                if (tree_index < 0) {
                    std::cerr << "ERROR: LoadTree failed. Return code: " << tree_index << std::endl;
                    return false;
                }

                local_entry = static_cast<uint64_t>(tree_index);
            }

            for (auto& leaf: m_leafs) {
                int res = leaf.second->getBranch()->GetEntry(local_entry);
                if (res <= 0) {
                    std::cerr << "ERROR: GetEntry failed for branch " << leaf.first << ". Return code: " << res << std::endl;
                    return false;
                }
            }
        }
        for ( auto& vGroup : m_varrGroups ) {
          vGroup.second->getEntry(entry, readall);
        }

        m_entry = entry;
        return true;
    }

    void TreeWrapper::setEntry(uint64_t entry) {
        uint64_t stop_at = getStopAt();

        if (entry >= stop_at)
            m_entry = stop_at - 1;
        else
            m_entry = entry;
    }

    void TreeWrapper::stopAt(uint64_t entry) {
        m_stop_at_set = true;
        if (entry >= getEntries())
            m_stop_at = getEntries();
        else
            m_stop_at = entry + 1;
    }

    Leaf& TreeWrapper::operator[](const std::string& name) {

        if (m_leafs.count(name))
            return *m_leafs.at(name);

        std::shared_ptr<Leaf> leaf(new Leaf(name, this));
        m_leafs[name] = leaf;

        return *leaf;
    }

    TreeGroup TreeWrapper::group(const std::string& prefix) {
        return TreeGroup(prefix, *this);
    }
};


text:
require File.join(File.dirname(__FILE__), '..', 'test_helper')

class ResponseOutputterTest < Testy::TestSuite
  class Handler
    attr_reader :accepted
    def initialize
      @accepted = []
    end

    def accept(request)
      @accepted << request
      [200, {"foo" => "bar"}, "Blah"]
    end
  end

  def setup
    @handler = Handler.new
  end

  def test_response_delegates_request_to_handler
    response = Servy::Response.new(:request, @handler)
    assert_equal([:request], @handler.accepted)
  end

  def test_returns_status
    response = Servy::Response.new(:request, @handler)
    assert_equal(200, response.status)
  end

  def test_returns_headers
    response = Servy::Response.new(:request, @handler)
    assert_equal({"foo" => "bar", "Content-Length" => 4}, response.headers)
  end

  def test_returns_body
    response = Servy::Response.new(:request, @handler)
    assert_equal("Blah", response.body)
  end
end


text:
function [coeff, score, latent, tsquared, explained, mu] = pca_stats(x,varargin)
%PCA Principal Component Analysis (PCA) on raw data.
%   COEFF = PCA(X) returns the principal component coefficients for the N
%   by P data matrix X. Rows of X correspond to observations and columns to
%   variables. Each column of COEFF contains coefficients for one principal
%   component. The columns are in descending order in terms of component
%   variance (LATENT). PCA, by default, centers the data and uses the
%   singular value decomposition algorithm. For the non-default options,
%   use the name/value pair arguments.
%
%   [COEFF, SCORE] = PCA(X) returns the principal component score, which is
%   the representation of X in the principal component space. Rows of SCORE
%   correspond to observations, columns to components. The centered data
%   can be reconstructed by SCORE*COEFF'.
%
%   [COEFF, SCORE, LATENT] = PCA(X) returns the principal component
%   variances, i.e., the eigenvalues of the covariance matrix of X, in
%   LATENT.
%
%   [COEFF, SCORE, LATENT, TSQUARED] = PCA(X) returns Hotelling's T-squared
%   statistic for each observation in X. PCA uses all principal components
%   to compute the TSQUARED (computes in the full space) even when fewer
%   components are requested (see the 'NumComponents' option below). For
%   TSQUARED in the reduced space, use MAHAL(SCORE,SCORE).
%
%   [COEFF, SCORE, LATENT, TSQUARED, EXPLAINED] = PCA(X) returns a vector
%   containing the percentage of the total variance explained by each
%   principal component.
%
%   [COEFF, SCORE, LATENT, TSQUARED, EXPLAINED, MU] = PCA(X) returns the
%   estimated mean.
%
%   [...] = PCA(..., 'PARAM1',val1, 'PARAM2',val2, ...) specifies optional
%   parameter name/value pairs to control the computation and handling of
%   special data types. Parameters are:
%
%    'Algorithm' - Algorithm that PCA uses to perform the principal
%                  component analysis. Choices are:
%        'svd'   - Singular Value Decomposition of X (the default).
%        'eig'   - Eigenvalue Decomposition of the covariance matrix. It
%                  is faster than SVD when N is greater than P, but less
%                  accurate because the condition number of the covariance
%                  is the square of the condition number of X.
%        'als'   - Alternating Least Squares (ALS) algorithm which finds
%                  the best rank-K approximation by factoring a X into a
%                  N-by-K left factor matrix and a P-by-K right factor
%                  matrix, where K is the number of principal components.
%                  The factorization uses an iterative method starting with
%                  random initial values. ALS algorithm is designed to
%                  better handle missing values. It deals with missing
%                  values without listwise deletion (see {'Rows',
%                  'complete'}).
%
%     'Centered' - Indicator for centering the columns of X. Choices are:
%         true   - The default. PCA centers X by subtracting off column
%                  means before computing SVD or EIG. If X contains NaN
%                  missing values, NANMEAN is used to find the mean with
%                  any data available.
%         false  - PCA does not center the data. In this case, the original
%                  data X can be reconstructed by X = SCORE*COEFF'.
%
%     'Economy'  - Indicator for economy size output, when D the degrees of
%                  freedom is smaller than P. D, is equal to M-1, if data
%                  is centered and M otherwise. M is the number of rows
%                  without any NaNs if you use 'Rows', 'complete'; or the
%                  number of rows without any NaNs in the column pair that
%                  has the maximum number of rows without NaNs if you use
%                  'Rows', 'pairwise'. When D < P, SCORE(:,D+1:P) and
%                  LATENT(D+1:P) are necessarily zero, and the columns of
%                  COEFF(:,D+1:P) define directions that are orthogonal to
%                  X. Choices are:
%         true   - This is the default. PCA returns only the first D
%                  elements of LATENT and the corresponding columns of
%                  COEFF and SCORE. This can be significantly faster when P
%                  is much larger than D. NOTE: PCA always returns economy
%                  size outputs if 'als' algorithm is specifed.
%         false  - PCA returns all elements of LATENT. Columns of COEFF and
%                  SCORE corresponding to zero elements in LATENT are
%                  zeros.
%
%     'NumComponents' - The number of components desired, specified as a
%                  scalar integer K satisfying 0 < K <= P. When specified,
%                  PCA returns the first K columns of COEFF and SCORE.
%
%     'Rows'     - Action to take when the data matrix X contains NaN
%                  values. If 'Algorithm' option is set to 'als, this
%                  option is ignored as ALS algorithm deals with missing
%                  values without removing them. Choices are:
%         'complete' - The default action. Observations with NaN values
%                      are removed before calculation. Rows of NaNs are
%                      inserted back into SCORE at the corresponding
%                      location.
%         'pairwise' - If specified, PCA switches 'Algorithm' to 'eig'.
%                      This option only applies when 'eig' method is used.
%                      The (I,J) element of the covariance matrix is
%                      computed using rows with no NaN values in columns I
%                      or J of X. Please note that the resulting covariance
%                      matrix may not be positive definite. In that case,
%                      PCA terminates with an error message.
%         'all'      - X is expected to have no missing values. All data
%                      are used, and execution will be terminated if NaN is
%                      found.
%
%     'Weights'  - Observation weights, a vector of length N containing all
%                  positive elements.
%
%     'VariableWeights' - Variable weights. Choices are:
%          - a vector of length P containing all positive elements.
%          - the string 'variance'. The variable weights are the inverse of
%            sample variance. If 'Centered' is set true at the same time,
%            the data matrix X is centered and standardized. In this case,
%            PCA returns the principal components based on the correlation
%            matrix.
%
%   The following parameter name/value pairs specify additional options
%   when alternating least squares ('als') algorithm is used.
%
%      'Coeff0'  - Initial value for COEFF, a P-by-K matrix. The default is
%                  a random matrix.
%
%      'Score0'  - Initial value for SCORE, a N-by-K matrix. The default is
%                  a matrix of random values.
%
%      'Options' - An options structure as created by the STATSET function.
%                  PCA uses the following fields:
%          'Display' - Level of display output.  Choices are 'off' (the
%                      default), 'final', and 'iter'.
%          'MaxIter' - Maximum number of steps allowed. The default is
%                      100. Unlike in optimization settings, reaching
%                      MaxIter is regarded as convergence.
%           'TolFun' - Positive number giving the termination tolerance for
%                      the cost function.  The default is 1e-6.
%             'TolX' - Positive number giving the convergence threshold
%                      for relative change in the elements of L and R. The
%                      default is 1e-6.
%
%
%   Example:
%       load hald;
%       [coeff, score, latent, tsquared, explained] = pca(ingredients);
%
%   See also PPCA, PCACOV, PCARES, BIPLOT, BARTTEST, CANONCORR, FACTORAN,
%   ROTATEFACTORS.

% References:
%   [1] Jolliffe, I.T. Principal Component Analysis, 2nd ed.,Springer,2002.
%   [2] Krzanowski, W.J., Principles of Multivariate Analysis, Oxford
%       University Press, 1988.
%   [3] Seber, G.A.F., Multivariate Observations, Wiley, 1984.
%   [4] Jackson, J.E., A User's Guide to Principal Components, Wiley, 1988.
%   [5] Sam Roweis, EM algorithms for PCA and SPCA, In Proceedings of the
%       1997 conference on Advances in neural information processing
%       systems 10 (NIPS '97), MIT Press, Cambridge, MA, USA, 626-632,1998.
%   [6] Alexander Ilin and Tapani Raiko. Practical Approaches to Principal
%       Component Analysis in the Presence of Missing Values. J. Mach.
%       Learn. Res. 11 (August 2010), 1957-2000, 2010.

%   Copyright 2012 The MathWorks, Inc.

[n, p] = size(x);

% Parse arguments and check if parameter/value pairs are valid
paramNames = {'Algorithm','Centered','Economy','NumComponents','Rows',...
    'Weights','VariableWeights','Coeff0','Score0','Options'};
defaults   = {'svd',       true,      true,    p,           'complete',...
    ones(1,n) ,ones(1,p),        [],      [], statset('pca')};

[vAlgorithm, vCentered, vEconomy, vNumComponents, vRows,vWeights,...
    vVariableWeights, c0, s0, opts, setFlag]...
    = internal.stats.parseArgs(paramNames, defaults, varargin{:});
% Validate String value for  Algorithm value
AlgorithmNames = {'svd','eig','als'};
vAlgorithm = internal.stats.getParamVal(vAlgorithm,AlgorithmNames,...
    '''Algorithm''');
% Validate boolean value for 'Centered' option
vCentered = internal.stats.parseOnOff(vCentered,'''Centered''');
% Validate boolean value for 'Economy' option
vEconomy = internal.stats.parseOnOff(vEconomy,'''Economy''');
% Validate the number of components option 'NumComponents'
if ~isempty(x) && ~internal.stats.isScalarInt(vNumComponents,1,p)
    error(message('stats:pca:WrongNumComponents',p));
end
% Validate value for 'Rows' option
RowsNames = {'complete','pairwise','all'};
vRows = internal.stats.getParamVal(vRows,RowsNames,'''Rows''');
if setFlag.Rows && strcmp(vAlgorithm,'als')
    warning(message('stats:pca:NoALSRows'));
end
if strcmp(vRows,'pairwise')
    if setFlag.Algorithm && strcmp(vAlgorithm,'svd')
    warning(message('stats:pca:NoPairwiseSVD'));
    end
    vAlgorithm = 'eig';
end
% Validate Weights Vectors
if isvector(vWeights) && isequal(numel(vWeights),n)
    vWeights = reshape(vWeights,1,n); % make sure it is a row vector
else
    error(message('stats:pca:WrongObsWeights', n));
end

if internal.stats.isString(vVariableWeights)
    WeightsNames = {'variance'};
    internal.stats.getParamVal(vVariableWeights,WeightsNames,...
        '''VariableWeights''');
    vVariableWeights = 1./classreg.learning.internal.wnanvar(x,vWeights,1);
elseif isnumeric(vVariableWeights) && isvector(vVariableWeights)...
        && (isequal(numel(vVariableWeights), p))
    vVariableWeights = reshape(vVariableWeights,1,p);
else
    error(message('stats:pca:WrongVarWeights', p));
end

if any(vWeights <= 0) || any(vVariableWeights <= 0)
    error(message('stats:pca:NonPositiveWeights'));
end
% end of checking input arguments

% Handling special empty case
if isempty(x)
    pOrZero = ~vEconomy * p;
    coeff = zeros(p, pOrZero);
    coeff(1:p+1:end) = 1;
    score = zeros(n, pOrZero);
    latent = zeros(pOrZero, 1);
    tsquared = zeros(n, 1);
    explained = [];
    mu = [];
    return;
end

nanIdx = isnan(x);
numNaN = sum(nanIdx, 2); % number of NaNs in each row
wasNaN = any(numNaN,2); % Rows that contain NaN

% Handling special cases where X is all NaNs:
if all(nanIdx(:))
    coeff = NaN;
    score = NaN;
    latent = NaN;
    tsquared = NaN;
    explained = NaN;
    mu = NaN;
    return;
end
% Handling special scalar case;
if isscalar(x)
    coeff = 1;
    score = (~vCentered)*x;
    latent = (~vCentered)*x^2;
    tsquared = ~vCentered;
    explained = 100;
    mu = vCentered*x;
    return;
end

if strcmp(vRows,'all') && (~strcmp(vAlgorithm,'als'))
    if any(wasNaN)
        error(message('stats:pca:RowsAll'));
    else
        vRows = 'complete';
    end
end

if strcmp(vRows,'complete')
    % Degrees of freedom (DOF) is n-1 if centered and n if not centered,
    % where n is the numer of rows without any NaN element.
    DOF = max(0,n-vCentered-sum(wasNaN));
elseif strcmp(vRows,'pairwise')
    % DOF is the maximum number of element pairs without NaNs
    notNaN = double(~nanIdx);
    nanC = notNaN'*notNaN;
    nanC = nanC.*(~eye(p));
    DOF = max(nanC(:));
    DOF = DOF-vCentered;
else
    DOF = max(0,n-vCentered);
end

% Weighted sample mean:
mu = classreg.learning.internal.wnanmean(x, vWeights);

% Compute by EIG if no weights are given
switch vAlgorithm
case 'eig'
    % Center the data if 'Centered' is true.
    if vCentered
        x = bsxfun(@minus,x,mu);
    end

    % Use EIG to compute.
    [coeff, eigValues] = localEIG(x, vCentered, vRows, vWeights,...
        vVariableWeights);

    % When 'Economy' value is true, nothing corresponding to zero
    % eigenvalues should be returned.
    if (DOF<p)
        if vEconomy
            coeff(:, DOF+1:p) = [];
            eigValues(DOF+1:p, :) = [];
        else % make sure they are zeros.
            eigValues(DOF+1:p, :) = 0;
        end
    end

    % Check if eigvalues are all postive
    if any(eigValues<0)
        error(message('stats:pca:CovNotPositiveSemiDefinite'));
    end

    if nargout > 1
        score = x/coeff';
        latent = eigValues; % Output Eigenvalues
        if nargout > 3
            tsquared = localTSquared(score, latent, n, p);
        end
    end

case 'svd' % Use SVD to compute
    % Center the data if 'Centered' is true.
    if vCentered
        x = bsxfun(@minus,x,mu);
    end

    [U,sigma, coeff, wasNaN] = localSVD(x, n,...
        vEconomy, vWeights, vVariableWeights);
    if nargout > 1
        score =  bsxfun(@times,U,sigma');
        latent = sigma.^2./DOF;
        if nargout > 3
            tsquared = localTSquared(score,latent,DOF,p);
        end
        %Insert NaNs back
        if any(wasNaN)
            score = internal.stats.insertnan(wasNaN, score);
            if nargout >3
                tsquared = internal.stats.insertnan(wasNaN,tsquared);
            end
        end
    end

    if DOF < p
        % When 'Economy' value is true, nothing corresponding to zero
        % eigenvalues should be returned.
        if vEconomy
            coeff(:, DOF+1:end) = [];
            if nargout > 1
                score(:, DOF+1:end)=[];
                latent(DOF+1:end, :)=[];
            end
        elseif nargout > 1
        % otherwise, eigenvalues and corresponding outputs need to pad
        % zeros because svd(x,0) does not return columns of U corresponding
        % to components of (DOF+1):p.
            score(:, DOF+1:p) = 0;
            latent(DOF+1:p, 1) = 0;
        end
    end

case 'als' % Alternating Least Square Algorithm

    vNumComponents = min([vNumComponents,n-vCentered,p]);  % ALS always return economy sized outputs

    if isempty(s0);
        s0 = randn(n,vNumComponents);
    elseif ~isequal(size(s0),[n,vNumComponents])|| any(isnan(s0(:)))
        error(message('stats:pca:BadInitialValues','Score0',n,vNumComponents));
    end
    if isempty(c0);
        c0 = randn(p,vNumComponents);
    elseif ~isequal(size(c0),[p,vNumComponents]) || any(isnan(c0(:)))
        error(message('stats:pca:BadInitialValues','Coeff0',p,vNumComponents));
    end

    [score,coeff,mu,latent]=alsmf(x,vNumComponents,'L0',s0,'R0',c0,...
        'Weights',vWeights,'VariableWeights',vVariableWeights,...
        'Orthonormal',true,'Centered',vCentered,'Options',opts);

    if nargout > 3
        % T-squared values are in reduced space.
        tsquared = localTSquared(score, latent,n-vCentered, vNumComponents);
    end
end % end of switch vAlgorithm

% Calcuate the percentage of the total variance explained by each principal
% component.
if nargout > 4
    explained = 100*latent/sum(latent);
end

% Output only the first k principal components
if (vNumComponents<DOF)
    coeff(:, vNumComponents+1:end) = [];
    if nargout > 1
    score(:, vNumComponents+1:end) = [];
    end
end

% Enforce a sign convention on the coefficients -- the largest element in
% each column will have a positive sign.
[~,maxind] = max(abs(coeff), [], 1);
[d1, d2] = size(coeff);
colsign = sign(coeff(maxind + (0:d1:(d2-1)*d1)));
coeff = bsxfun(@times, coeff, colsign);
if nargout > 1
    score = bsxfun(@times, score, colsign); % scores = score
end

end % End of main function

%----------------Subfucntions--------------------------------------------

function [coeff, eigValues]=localEIG(x,vCentered, vRows,vWeights,...
        vVariableWeights)
% Compute by EIG. vRows are the options of handing NaN when compute
% covariance matrix

% Apply observation and variable weights
OmegaSqrt = sqrt(vWeights);
PhiSqrt = sqrt(vVariableWeights);
x = bsxfun(@times, x, OmegaSqrt');
x = bsxfun(@times, x, PhiSqrt);

xCov = ncnancov(x, vRows, vCentered);

[coeff, eigValueDiag] = eig(xCov);
[eigValues, idx] = sort(diag(eigValueDiag), 'descend');
coeff = coeff(:, idx);

coeff = bsxfun(@times, coeff,1./PhiSqrt');
end

function [U,sigma, coeff, wasNaN] = localSVD(x, n,...,
    vEconomy, vWeights, vVariableWeights)
% Compute by SVD. Weights are supplied by vWeights and vVariableWeights.

% Remove NaNs missing data and record location
[~,wasNaN,x] = internal.stats.removenan(x);
if n==1  % special case because internal.stats.removenan treats all vectors as columns
    wasNaN = wasNaN';
    x = x';
end

% Apply observation and variable weights
vWeights(wasNaN) = [];
OmegaSqrt = sqrt(vWeights);
PhiSqrt = sqrt(vVariableWeights);
x = bsxfun(@times, x, OmegaSqrt');
x = bsxfun(@times, x, PhiSqrt);

if vEconomy
    [U,sigma,coeff] = svd(x,'econ');
else
    [U,sigma, coeff] = svd(x, 0);
end

U = bsxfun(@times, U, 1./OmegaSqrt');
coeff = bsxfun(@times, coeff,1./PhiSqrt');

if n == 1     % sigma might have only 1 row
    sigma = sigma(1);
else
    sigma = diag(sigma);
end
end

function tsquared = localTSquared(score, latent,DOF, p)
% Subfunction to calulate the Hotelling's T-squared statistic. It is the
% sum of squares of the standardized scores, i.e., Mahalanobis distances.
% When X appears to have column rank < r, ignore components that are
% orthogonal to the data.

if isempty(score)
    tsquared = score;
    return;
end

r = min(DOF,p); % Max possible rank of x;
if DOF > 1
    q = sum(latent > max(DOF,p)*eps(latent(1)));
    if q < r
        warning(message('stats:pca:ColRankDefX', q));
    end
else
    q = 0;
end
standScores = bsxfun(@times, score(:,1:q), 1./sqrt(latent(1:q,:))');
tsquared = sum(standScores.^2, 2);
end

function c = ncnancov(x,Rows,centered)
%   C = NCNANCOV(X) returns X'*X/N, where N is the number of observations
%   after removing rows missing values.
%
%   C = NCNANCOV(...,'pairwise') computes C(I,J) using rows with no NaN
%   values in columns I or J.  The result may not be a positive definite
%   matrix. C = NCNANCOV(...,'complete') is the default, and it omits rows
%   with any NaN values, even if they are not in column I or J.
%
%   C = NCNANCOV(...,true), C is normalized by N-1 if data X is already
%   centered. The default is false.

if nargin <2
    Rows = 'complete';
end

d = 0;
if nargin>2
    d =  d + centered;
end

idxnan = isnan(x);

[n, p] = size(x);

if ~any(any(idxnan))
    c = x'*x/(n-d);
elseif strcmp(Rows,'complete')
    nanrows = any(idxnan,2);
    xNotNaN = x((~nanrows),:);
    denom = max(0, (size(xNotNaN,1)-d) );
    c = xNotNaN'*xNotNaN/denom;
elseif strcmp(Rows,'pairwise')
    c = zeros(p,class(x));
    for i = 1:p
        for j = 1:i
            NonNaNRows = ~any(idxnan(:,[i, j]),2);
            denom = max(0,(sum(NonNaNRows)-d));
            c(i,j) = x(NonNaNRows,i)'*x(NonNaNRows,j)/denom;
        end
    end
    c = c + tril(c,-1)';
end
end


text:
package fr.inra.maiage.bibliome.util.notation;

public class Syntax {
	private static final char TAB = '\t';
	private static final char NL = '\n';
	private static final char ESCAPE = '\\';
	private static final char ESCAPE_NL = 'n';
	private static final char ESCAPE_TAB = 't';

	private int tabWidth = 8;
	private char map1 = ':';
	private char map2 = '=';
	private char quote1 = '"';
	private char quote2 = '\'';
	private char variable = '~';
	private char comment = '#';
	private char directive = '%';

	public Syntax() {
		super();
	}

	private Syntax(int tabWidth, char map1, char map2, char quote1, char quote2, char variable, char comment, char directive) {
		super();
		this.tabWidth = tabWidth;
		this.map1 = map1;
		this.map2 = map2;
		this.quote1 = quote1;
		this.quote2 = quote2;
		this.variable = variable;
		this.comment = comment;
		this.directive = directive;
	}

	public Syntax(Syntax syntax) {
		this(syntax.tabWidth, syntax.map1, syntax.map2, syntax.quote1, syntax.quote2, syntax.variable, syntax.comment, syntax.directive);
	}

	public int getTabWidth() {
		return tabWidth;
	}

	public char getMap1() {
		return map1;
	}

	public char getMap2() {
		return map2;
	}

	public char getQuote1() {
		return quote1;
	}

	public char getQuote2() {
		return quote2;
	}

	public char getVariable() {
		return variable;
	}

	public char getComment() {
		return comment;
	}

	public char getDirective() {
		return directive;
	}

	public void setDirective(char directive) {
		this.directive = directive;
	}

	public void setMap1(char map1) {
		this.map1 = map1;
	}

	public void setMap2(char map2) {
		this.map2 = map2;
	}

	public void setQuote1(char quote1) {
		this.quote1 = quote1;
	}

	public void setQuote2(char quote2) {
		this.quote2 = quote2;
	}

	public void setVariable(char variable) {
		this.variable = variable;
	}

	public void setComment(char comment) {
		this.comment = comment;
	}

	public void setTabWidth(int tabWidth) {
		this.tabWidth = tabWidth;
	}

	public static char getTab() {
		return TAB;
	}

	public static char getNl() {
		return NL;
	}

	public static char escape() {
		return ESCAPE;
	}

	public static char escapeNL() {
		return ESCAPE_NL;
	}

	public static char escapeTab() {
		return ESCAPE_TAB;
	}

	public static boolean isWhitespace(char c) {
		return Character.isWhitespace(c);
	}

	public String printable(String s, boolean key) {
		if (s.isEmpty()) {
			StringBuilder sb = new StringBuilder(2);
			sb.append(getQuote1());
			sb.append(getQuote1());
			return sb.toString();
		}
		int nl = s.indexOf(getNl());
		boolean trim = isWhitespace(s.charAt(0)) || isWhitespace(s.charAt(s.length() - 1));
		if (nl != -1 || trim) {
			return quotedString(s);
		}
		return unquotedString(s, key);
	}

	private char choseQuote(String s) {
		final char q1 = getQuote1();
		final char q2 = getQuote2();
		int n1 = 0;
		int n2 = 0;
		final int len = s.length();
		for (int i = 0; i < len; ++i) {
			char c = s.charAt(i);
			if (c == q1) {
				++n1;
			}
			else if (c == q2) {
				++n2;
			}
		}
		if (n1 <= n2) {
			return q1;
		}
		return q2;
	}

	private String quotedString(String s) {
		StringBuilder sb = new StringBuilder();
		final char quote = choseQuote(s);
		sb.append(quote);
		final int len = s.length();
		for (int i = 0; i < len; ++i) {
			char c = s.charAt(i);
			if (c == escape()) {
				sb.append(escape());
				sb.append(escape());
				continue;
			}
			if (c == getNl()) {
				sb.append(escape());
				sb.append(escapeNL());
				continue;
			}
			if (c == getTab()) {
				sb.append(escape());
				sb.append(escapeTab());
				continue;
			}
			if (c == quote) {
				sb.append(quote);
			}
			sb.append(c);
		}
		sb.append(quote);
		return sb.toString();
	}

	private String unquotedString(String s, boolean key) {
		StringBuilder sb = new StringBuilder();
		final int len = s.length();
		for (int i = 0; i < len; ++i) {
			char c = s.charAt(i);
			if (c == getComment()) {
				sb.append(escape());
				sb.append(getComment());
				continue;
			}
			if (c == escape()) {
				sb.append(escape());
				sb.append(escape());
				continue;
			}
			if (c == getMap1() || c == getMap2()) {
				if (key) {
					sb.append(escape());
				}
				sb.append(c);
				continue;
			}
			if (c == getNl()) {
				sb.append(escape());
				sb.append(escapeNL());
				continue;
			}
			if (c == getTab()) {
				sb.append(escape());
				sb.append(escapeTab());
				continue;
			}
			if (c == getQuote1() || c == getQuote2()) {
				if (i == 0) {
					sb.append(escape());
				}
				sb.append(c);
				continue;
			}
			sb.append(c);
		}
		return sb.toString();
	}
}


text:
using Umbraco.Core.Models;

namespace Umbraco.Core.Persistence.Repositories
{
    public interface ILanguageRepository : IRepositoryQueryable<int, ILanguage>
    {

    }
}


text:
package ru.stqa.pft.addressbook.tests;

import org.testng.annotations.Test;
import ru.stqa.pft.addressbook.model.ContactData;
import ru.stqa.pft.addressbook.model.Contacts;

import java.io.File;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;

public class ContactCreationTest extends TestBase {

   @Test //(enabled = false)
    public void testContactCreation() {
       Contacts before = app.contact().all();

       File photo = new File("src/test/resources/b269688.jpg");
       ContactData contact = new ContactData().withFirstName("FirstName2").withLastName("LastName2").withAddress(null).withPhoneNumberHome("22111222333")
              .withEmail("firstname2.lastname2@test.com").withGroup("[none]").withPhoto(photo);

        app.contact().create(contact);
        app.goTo().homePage();
        assertThat(app.contact().count(), equalTo(before.size() + 1));
       Contacts after = app.contact().all();
       assertThat(after, equalTo(before.withAdded(contact.withId(after.stream().mapToInt((g) -> g.getId()).max().getAsInt()))));

    }

    /*@Test
    public void testCurrentDir() {
      File currentDir = new File("."); // to4ka - eto tekucshaya directoriya
        System.out.println(currentDir.getAbsolutePath());
        File photo = new File("src/test/resources/b269688.jpg");
        System.out.println(photo.getAbsolutePath());
        System.out.println(photo.exists());
    }
    */
}


text:
<?xml version="1.0" encoding="utf-8" ?>
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".ScreenerFragment"
>

  <androidx.fragment.app.FragmentContainerView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/add_patient_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
    />

</FrameLayout>


text: I represent a test object for a category.


text:
const expect = require('expect');
const describe = require('mocha').describe;
const it = require('mocha').it;
const request = require('supertest');
const express = require('express');

const ErrorHandler = require('./ErrorHandler');
const ContextError = require('./ContextError');

describe('ErrorHandler', () => {
    describe('when no error is passed', () => {
        it('should respond with a simple 500', (done) => {
            const collab = express();

            collab.use((req, res, next) => {
                // Setup
                const SUT = ErrorHandler.bind(ErrorHandler, req, res);
                // Use
                return Promise.reject()
                    .catch(SUT);
            });

            request(collab)
                .get('/')
                .expect(500, done)
        });
    });

    describe('when an error is passed', () => {
        it('should use the code property as HTTP status code', (done) => {
            const collab = express();

            collab.use((req, res, next) => {
                // Setup
                const SUT = ErrorHandler.bind(ErrorHandler, req, res);
                // Use
                let error = new ContextError(null, 503);
                return Promise.reject(error)
                    .catch(SUT);
            });

            request(collab)
                .get('/')
                .expect(503, done)
        });

        it('should ignore invalid status code', (done) => {
            const collab = express();
            const error = {msg: 'custom error', code: 11000};

            collab.use((req, res, next) => {
                // Setup
                const SUT = ErrorHandler.bind(ErrorHandler, req, res);
                // Use
                return Promise.reject(error)
                    .catch(SUT);
            });

            request(collab)
                .get('/')
                .expect(res => {
                    expect(res.statusCode).toBe(500);
                    expect(res.body.reason).toEqual(error);
                })
                .end(done)
        });
    });
});


text:
<?xml version="1.0" ?>

<container xmlns="http://symfony.com/schema/dic/services"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

    <parameters>
        <parameter key="neutron_user.security.authentication_handler.class">Neutron\UserBundle\Security\AuthenticationHandler</parameter>
        <parameter key="neutron_user.security.interactive_login_listener.class">Neutron\UserBundle\Security\InteractiveLoginListener</parameter>
        <parameter key="neutron_user.security.on_access_denied_handler.class">Neutron\UserBundle\Security\OnAccessDeniedHandler</parameter>
    </parameters>

    <services>
        <service id="neutron_user.security.authentication_handler" class="%neutron_user.security.authentication_handler.class%">
            <argument type="service" id="router" />
            <tag name="monolog.logger" channel="security" />
        </service>

        <service id="neutron_user.security.interactive_login_listener" class="%neutron_user.security.interactive_login_listener.class%">
        	<tag name="kernel.event_listener" event="security.interactive_login" method="onSecurityInteractiveLogin" />
        </service>

        <service id="neutron_user.security.on_access_denied_handler" class="%neutron_user.security.on_access_denied_handler.class%">
        	<argument type="service" id="http_kernel" />
        	<argument type="service" id="router" />
        	<tag name="kernel.event_listener" event="kernel.exception" priority="10"/>
        </service>

        <!-- <service id="neutron_user.security.on_access_denied_handler" class="%neutron_user.security.on_access_denied_handler.class%">
        	<argument type="service" id="router" />
            <tag name="kernel.event_listener" event="security.kernel_response" method="handle" priority="200" />
        </service>  -->

    </services>

</container>


text:
<?php namespace Dick\BackupManager\Http\Controllers;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Auth;
use App;
use Storage;
use Carbon\Carbon;
use Artisan;

class BackupController extends Controller {

	public function __construct()
	{
		$this->middleware('auth');

		// Check for the right roles to access these pages
		if (!\Entrust::can('view-backups')) {
	        abort(403, 'Unauthorized access - you do not have the necessary permissions to see this page.');
	    }
	}

	public function index()
	{
		$disk = Storage::disk(config('dick.backupmanager.disk'));
		$files = $disk->files('backups');
		$this->data['backups'] = [];

		// make an array of backup files, with their filesize and creation date
		foreach ($files as $k => $f) {
			// only take the zip files into account
			if (substr($f, -4) == '.zip' && $disk->exists($f)) {
				$this->data['backups'][] = [
											'file_path' => $f,
											'file_name' => str_replace('backups/', '', $f),
											'file_size' => $disk->size($f),
											'last_modified' => $disk->lastModified($f),
											];
			}
		}

		// reverse the backups, so the newest one would be on top
		$this->data['backups'] = array_reverse($this->data['backups']);

		return view("backupmanager::backup", $this->data);
	}

	public function create()
	{
		if (!\Entrust::can('make-backups')) {
	        abort(403, 'Unauthorized access - you do not have the necessary permission to make backups.');
	    }

	    try {
	      Artisan::call('backup:run');
	      echo 'done backup:run';
	    } catch (Exception $e) {
	      Response::make($e->getMessage(), 500);
	    }

	    // return 'success';
	}

	/**
	 * Downloads a backup zip file.
	 *
	 * TODO: make it work no matter the flysystem driver (S3 Bucket, etc).
	 */
	public function download($file_name)
	{
		if (!\Entrust::can('download-backups')) {
	        abort(403, 'Unauthorized access - you do not have the necessary permission to download backups.');
	    }

		$disk = Storage::disk(config('dick.backupmanager.disk'));

		if ($disk->exists('backups/'.$file_name)) {
			return response()->download(storage_path('backups/'.$file_name));
		}
		else
		{
			abort(404, "The backup file doesn't exist.");
		}
	}

	/**
	 * Deletes a backup file.
	 */
	public function delete($file_name)
	{
		if (!\Entrust::can('delete-backups')) {
	        abort(403, 'Unauthorized access - you do not have the necessary permission to delete backups.');
	    }

		$disk = Storage::disk(config('dick.backupmanager.disk'));

		if ($disk->exists('backups/'.$file_name)) {
			$disk->delete('backups/'.$file_name);

			return 'success';
		}
		else
		{
			abort(404, "The backup file doesn't exist.");
		}
	}
}


text:
package org.tanrabad.survey.nearby.matching;

public class LcsMatchScore implements StringMatchScore {
    @Override public double calculate(int result, int compareStringLength) {
        return (double) result / (double) compareStringLength;
    }
}


text:
class Puppet::Pops::Parser::Locator

  RUBY_1_9_3 = (1 << 16 | 9 << 8 | 3)
  RUBY_2_0_0 = (2 << 16 | 0 << 8 | 0)
  RUBYVER_ARRAY = RUBY_VERSION.split(".").collect {|s| s.to_i }
  RUBYVER = (RUBYVER_ARRAY[0] << 16 | RUBYVER_ARRAY[1] << 8 | RUBYVER_ARRAY[2])

  # Computes a symbol representing which ruby runtime this is running on
  # This implementation will fail if there are more than 255 minor or micro versions of ruby
  #
  def self.locator_version
    if RUBYVER >= RUBY_2_0_0
      :ruby20
    elsif RUBYVER >= RUBY_1_9_3
      :ruby19
    else
      :ruby18
    end
  end
  LOCATOR_VERSION = locator_version

  # Constant set to true if multibyte is supported (includes multibyte extended regular expressions)
  MULTIBYTE = !!(LOCATOR_VERSION == :ruby19 || LOCATOR_VERSION == :ruby20)

  # Creates, or recreates a Locator. A Locator is created if index is not given (a scan is then
  # performed of the given source string.
  #
  def self.locator(string, file, index = nil)
    case LOCATOR_VERSION
    when :ruby20, :ruby19
      Locator19.new(string, file, index)
    else
      Locator18.new(string, file, index)
    end
  end

  # Returns the file name associated with the string content
  def file
  end

  # Returns the string content
  def string
  end

  # Returns the position on line (first position on a line is 1)
  def pos_on_line(offset)
  end

  # Returns the line number (first line is 1) for the given offset
  def line_for_offset(offset)
  end

  # Returns the offset on line (first offset on a line is 0).
  #
  def offset_on_line(offset)
  end

  # Returns the character offset for a given reported offset
  def char_offset(byte_offset)
  end

  # Returns the length measured in number of characters from the given start and end reported offset
  def char_length(offset, end_offset)
  end

  # Returns the line index - an array of line offsets for the start position of each line, starting at 0 for
  # the first line.
  #
  def line_index()
  end

  # A Sublocator locates a concrete locator (subspace) in a virtual space.
  # The `leading_line_count` is the (virtual) number of lines preceding the first line in the concrete locator.
  # The `leading_offset` is the (virtual) byte offset of the first byte in the concrete locator.
  # The `leading_line_offset` is the (virtual) offset / margin in characters for each line.
  #
  # This illustrates characters in the sublocator (`.`) inside the subspace (`X`):
  #
  #      1:XXXXXXXX
  #      2:XXXX.... .. ... ..
  #      3:XXXX. . .... ..
  #      4:XXXX............
  #
  # This sublocator would be configured with leading_line_count = 1,
  # leading_offset=8, and leading_line_offset=4
  #
  # Note that leading_offset must be the same for all lines and measured in characters.
  #
  class SubLocator < Puppet::Pops::Parser::Locator
    attr_reader :locator
    attr_reader :leading_line_count
    attr_reader :leading_offset
    attr_reader :leading_line_offset

    def self.sub_locator(string, file, leading_line_count, leading_offset, leading_line_offset)
      self.new(Puppet::Pops::Parser::Locator.locator(string, file),
        leading_line_count,
        leading_offset,
        leading_line_offset)
    end

    def initialize(locator, leading_line_count, leading_offset, leading_line_offset)
      @locator = locator
      @leading_line_count = leading_line_count
      @leading_offset = leading_offset
      @leading_line_offset = leading_line_offset
    end

    def file
      @locator.file
    end

    def string
      @locator.string
    end

    # Given offset is offset in the subspace
    def line_for_offset(offset)
      @locator.line_for_offset(offset) + @leading_line_count
    end

    # Given offset is offset in the subspace
    def offset_on_line(offset)
      @locator.offset_on_line(offset) + @leading_line_offset
    end

    # Given offset is offset in the subspace
    def char_offset(offset)
      effective_line = @locator.line_for_offset(offset)
      locator.char_offset(offset) + (effective_line * @leading_line_offset) + @leading_offset
    end

    # Given offsets are offsets in the subspace
    def char_length(offset, end_offset)
      effective_line = @locator.line_for_offset(end_offset) - @locator.line_for_offset(offset)
      locator.char_length(offset, end_offset) + (effective_line * @leading_line_offset)
    end

    def pos_on_line(offset)
      offset_on_line(offset) +1
    end
  end

  private

  class AbstractLocator < Puppet::Pops::Parser::Locator
    attr_accessor :line_index
    attr_accessor :string
    attr_accessor :prev_offset
    attr_accessor :prev_line
    attr_reader   :string
    attr_reader   :file

    # Create a locator based on a content string, and a boolean indicating if ruby version support multi-byte strings
    # or not.
    #
    def initialize(string, file, index = nil)
      @string = string.freeze
      @file = file.freeze
      @prev_offset = nil
      @prev_line = nil
      @line_index = index
      compute_line_index unless !index.nil?
    end

    # Returns the position on line (first position on a line is 1)
    def pos_on_line(offset)
      offset_on_line(offset) +1
    end

    def to_location_hash(reported_offset, end_offset)
      pos        = pos_on_line(reported_offset)
      offset     = char_offset(reported_offset)
      length     = char_length(reported_offset, end_offset)
      start_line = line_for_offset(reported_offset)
      { :line => start_line, :pos => pos, :offset => offset, :length => length}
    end

    # Returns the index of the smallest item for which the item > the given value
    # This is a min binary search. Although written in Ruby it is only slightly slower than
    # the corresponding method in C in Ruby 2.0.0 - the main benefit to use this method over
    # the Ruby C version is that it returns the index (not the value) which means there is not need
    # to have an additional structure to get the index (or record the index in the structure). This
    # saves both memory and CPU. It also does not require passing a block that is called since this
    # method is specialized to search the line index.
    #
    def ary_bsearch_i(ary, value)
      low = 0
      high = ary.length
      mid = nil
      smaller = false
      satisfied = false
      v = nil

      while low < high do
          mid = low + ((high - low) / 2)
          v = (ary[mid] > value)
          if v == true
            satisfied = true
            smaller = true
          elsif !v
            smaller = false
          else
            raise TypeError, "wrong argument, must be boolean or nil, got '#{v.class}'"
          end

          if smaller
            high = mid
          else
            low = mid + 1;
          end
      end

      return nil if low == ary.length
      return nil if !satisfied
      return low
    end

    # Common impl for 18 and 19 since scanner is byte based
    def compute_line_index
      scanner = StringScanner.new(string)
      result = [0] # first line starts at 0
      while scanner.scan_until(/\n/)
        result << scanner.pos
      end
      self.line_index = result.freeze
    end

    # Returns the line number (first line is 1) for the given offset
    def line_for_offset(offset)
      if prev_offset == offset
        # use cache
        return prev_line
      end
      if line_nbr = ary_bsearch_i(line_index, offset)
        # cache
        prev_offset = offset
        prev_line = line_nbr
        return line_nbr
      end
      # If not found it is after last
      # clear cache
      prev_offset = prev_line = nil
      return line_index.size
    end
  end

  class Locator18 < AbstractLocator

    def offset_on_line(offset)
      line_offset = line_index[ line_for_offset(offset)-1 ]
      offset - line_offset
    end

    def char_offset(char_offset)
      char_offset
    end

    def char_length(offset, end_offset)
      end_offset - offset
    end

  end

  # This implementation is for Ruby19 and Ruby20. It uses byteslice to get strings from byte based offsets.
  # For Ruby20 this is faster than using the Stringscanner.charpos method (byteslice outperforms it, when
  # strings are frozen).
  #
  class Locator19 < AbstractLocator

    # Returns the offset on line (first offset on a line is 0).
    # Ruby 19 is multibyte but has no character position methods, must use byteslice
    def offset_on_line(offset)
      line_offset = line_index[ line_for_offset(offset)-1 ]
      string.byteslice(line_offset, offset-line_offset).length
    end

    # Returns the character offset for a given byte offset
    # Ruby 19 is multibyte but has no character position methods, must use byteslice
    def char_offset(byte_offset)
      string.byteslice(0, byte_offset).length
    end

    # Returns the length measured in number of characters from the given start and end byte offseta
    def char_length(offset, end_offset)
      string.byteslice(offset, end_offset - offset).length
    end
  end
end


text:
(function (window, ch) {
    'use strict';

    function normalizeOptions(options) {
        var num = window.parseInt(options, 10);

        if (!window.isNaN(num)) {
            options = {
                'max': num
            };
        }

        return options;
    }

    /**
     * Countdown counts the maximum of characters that user can enter in a form control. Countdown could limit the possibility to continue inserting charset.
     * @memberof ch
     * @constructor
     * @augments ch.Component
     * @param {HTMLElement} el A HTMLElement to create an instance of ch.Countdown.
     * @param {Object} [options] Options to customize an instance.
     * @param {Number} [options.max] Number of the maximum amount of characters user can input in form control. Default: 500.
     * @param {String} [options.plural] Message of remaining amount of characters, when it's different to 1. The variable that represents the number to be replaced, should be a hash. Default: "# characters left.".
     * @param {String} [options.singular] Message of remaining amount of characters, when it's only 1. The variable that represents the number to be replaced, should be a hash. Default: "# character left.".
     * @returns {countdown} Returns a new instance of Countdown.
     * @example
     * // Create a new Countdown.
     * var countdown = new ch.Countdown([el], [options]);
     * @example
     * // Create a new Countdown with custom options.
     * var countdown = new ch.Countdown({
     *     'max': 250,
     *     'plural': 'Left: # characters.',
     *     'singular': 'Left: # character.'
     * });
     * @example
     * // Create a new Countdown using the shorthand way (max as parameter).
     * var countdown = new ch.Countdown({'max': 500});
     */
    function Countdown(el, options) {

        /**
         * Reference to context of an instance.
         * @type {Object}
         * @private
         */
        var that = this;

        this._init(el, options);

        if (this.initialize !== undefined) {
            /**
             * If you define an initialize method, it will be executed when a new Countdown is created.
             * @memberof! ch.Countdown.prototype
             * @function
             */
            this.initialize();
        }

        /**
         * Event emitted when the component is ready to use.
         * @event ch.Countdown#ready
         * @example
         * // Subscribe to "ready" event.
         * countdown.on('ready', function () {
         *     // Some code here!
         * });
         */
        window.setTimeout(function () { that.emit('ready'); }, 50);
    }

    // Inheritance
    tiny.inherits(Countdown, ch.Component);

    var parent = Countdown.super_.prototype;

    /**
     * The name of the component.
     * @memberof! ch.Countdown.prototype
     * @type {String}
     */
    Countdown.prototype.name = 'countdown';

    /**
     * Returns a reference to the constructor function.
     * @memberof! ch.Countdown.prototype
     * @function
     */
    Countdown.prototype.constructor = Countdown;

    /**
     * Configuration by default.
     * @type {Object}
     * @private
     */
    Countdown.prototype._defaults = {
        'plural': '# characters left.',
        'singular': '# character left.',
        'max': 500
    };

    /**
     * Initialize a new instance of Countdown and merge custom options with defaults options.
     * @memberof! ch.Countdown.prototype
     * @function
     * @private
     * @returns {countdown}
     */
    Countdown.prototype._init = function (el, options) {
        // Call to its parent init method
        parent._init.call(this, el, options);

        /**
         * Reference to context of an instance.
         * @type {Object}
         * @private
         */
        var that = this,

            /**
             * Create the "id" attribute.
             * @type {String}
             * @private
             */
            messageID = 'ch-countdown-message-' + that.uid,

           /**
             * Singular or Plural message depending on amount of remaining characters.
             * @type {String}
             * @private
             */
            message;

        /**
         * The countdown trigger.
         * @type {HTMLTextAreaElement}
         * @example
         * // Gets the countdown trigger.
         * countdown.trigger;
         */
        this.trigger = this._el;
        'keyup keypress keydown input paste cut'.split(' ')
            .forEach(function(name) {
                tiny.on(that.trigger, name, function () { that._count(); });
            });

        /**
         * Amount of free characters until full the field.
         * @type {Number}
         * @private
         */
        that._remaining = that._options.max - that._contentLength();

        // Update the message
        message = ((that._remaining === 1) ? that._options.singular : that._options.plural);

        /**
         * The countdown container.
         * @type {HTMLParagraphElement}
         */
        that.container = (function () {
            var parent = tiny.parent(that._el);
            parent.insertAdjacentHTML('beforeend', '' + message.replace('#', that._remaining) + '');

            return parent.querySelector('#' + messageID);
        }());

        this.on('disable', this._removeError);

        return this;
    };

    /**
     * Returns the length of value.
     * @function
     * @private
     * @returns {Number}
     */
    Countdown.prototype._contentLength = function () {
        return this._el.value.length;
    };

    /**
     * Process input of data on form control and updates remaining amount of characters or limits the content length. Also, change the visible message of remaining characters.
     * @function
     * @private
     * @returns {countdown}
     */
    Countdown.prototype._count = function () {

        if (!this._enabled) {
            return this;
        }

        var length = this._contentLength(),
            message;

        this._remaining = this._options.max - length;

        // Limit Count alert the user
        if (length <= this._options.max) {

            if (this._exceeded) {
                // Update exceeded flag
                this._exceeded = false;
                this._removeError();
            }

        } else if (length > this._options.max) {

            /**
             * Event emitted when the lenght of characters is exceeded.
             * @event ch.Countdown#exceed
             * @example
             * // Subscribe to "exceed" event.
             * countdown.on('exceed', function () {
             *     // Some code here!
             * });
             */
            this.emit('exceed');

            // Update exceeded flag
            this._exceeded = true;

            this.trigger.setAttribute('aria-invalid', 'true');
            tiny.addClass(this.trigger, 'ch-validation-error');

            tiny.addClass(this.container, 'ch-countdown-exceeded');
        }

        // Change visible message of remaining characters
        // Singular or Plural message depending on amount of remaining characters
        message = (this._remaining !== 1 ? this._options.plural : this._options.singular).replace(/\#/g, this._remaining);

        // Update DOM text
        this.container.innerText  = message;

        return this;

    };

     /**
     * Process input of data on form control and updates remaining amount of characters or limits the content length. Also, change the visible message of remaining characters.
     * @function
     * @private
     * @returns {countdown}
     */
    Countdown.prototype._removeError = function () {
        tiny.removeClass(this.trigger, 'ch-validation-error');
        this.trigger.setAttribute('aria-invalid', 'false');

        tiny.removeClass(this.container, 'ch-countdown-exceeded');

        return this;
    };

    /**
     * Destroys a Countdown instance.
     * @memberof! ch.Countdown.prototype
     * @function
     * @example
     * // Destroy a countdown
     * countdown.destroy();
     * // Empty the countdown reference
     * countdown = undefined;
     */
    Countdown.prototype.destroy = function () {
        var parentElement = tiny.parent(this.container);
        parentElement.removeChild(this.container);

        tiny.trigger(window.document, ch.onlayoutchange);

        parent.destroy.call(this);

        return;
    };

    // Factorize
    ch.factory(Countdown, normalizeOptions);

}(this, this.ch));


text:
from __future__ import absolute_import

from .celery import app


text:
"use strict";

const BaseValidator = require('./BaseValidator');

/**
 * @module nodeviau/validator/NumberValidator
 * @author Itari <itari.onkar@gmail.com>
 * @licence MIT
 *
 * @class
 * @classdesc Number (integer and float) validator
 */
class NumberValidator extends BaseValidator{
    /**
     * Init arguments.
     */
    init(){
        super.init();

        if(typeof this.canFloat === 'undefined'){
            this.canFloat = true;
        }
    }

    /**
     * Validate attribute which must be a number.
     * @param model
     * @param attributeName
     * @returns void
     */
    validateAttribute(model, attributeName){

        if(this.isEmptyAndIsAllowed(model, attributeName)){
            return;
        }

        let checkValue = model[attributeName];

        if(isNaN(checkValue)){
            model.addError(attributeName, "Value must be number.");
            return;
        }

        // value can not be float
        if(this.canFloat === false
            && (+checkValue === checkValue && (!isFinite(checkValue) || !!(checkValue % 1)))
        ){
            model.addError(attributeName, "Value can not be float.");
            return;
        }

        // if defined min or max
        if(typeof this.min !== 'undefined' && model[attributeName] < this.min){
            model.addError(attributeName, "Value can not be less than " + this.min +".");
            return;
        }

        if(typeof this.max !== 'undefined' && model[attributeName] > this.max){
            model.addError(attributeName, "Value can not be more than " + this.max +".");
            return;
        }
    }
}

module.exports = NumberValidator;


text:
<?php declare(strict_types=1);

namespace DrdPlus\Races\Krolls;

use DrdPlus\Codes\SubRaceCode;

class CommonKroll extends Kroll
{
    public const COMMON = SubRaceCode::COMMON;

    /**
     * @return Kroll|CommonKroll
     */
    public static function getIt(): CommonKroll
    {
        return parent::getItBySubrace(SubRaceCode::getIt(SubRaceCode::COMMON));
    }

    public function getSubRaceCode(): SubRaceCode
    {
        return SubRaceCode::getIt(SubRaceCode::COMMON);
    }

}


text:
OsmPbfInputFormat
=================

An Hadoop API Inputformat for reading Open Street Map Protobuf Files

Installation
------------

This library relies on the Hadoop client library, Google protobufs and the osmpbf library. All dependencies are summarized in the `pom.xml` file, so that maven takes care of them for you. Simply type:

	mvn package

You should then find all the relevant jars in the `build` subdirectory.

Usage
-----

Simply set the input format in your job configuration:

	jobConf.setInputFormat(FirstMapReduceInputFormat.class);

Then, make sure your mapper class has `LongWritable` as its key class and `OsmPrimitive` as its value class. For instance, here is the example of a class that divides the map in a grid of 2048x2048 blocks and returns the block number as key with the node count (always 1) as value:

	public class UselessExample extends Mapper<LongWritable, OsmPrimitive, LongWritable, LongWritable> {
		private static final SIDE_BREAKDOWN = 2048;

		public void map(LongWritable key, OsmPrimitive value, Context context) {
			long x = (value.lon + 180) * SIDE_BREAKDOWN / 360;
			long y = (value.lat + 90) * SIDE_BREAKDOWN / 180;

			context.write(new LongWritable(y*SIDE_BREAKDOWN + x), new LongWritable(1));
		}
	}

In the reducer, one can then count the number of nodes per tile.

Notes
-----

 * This package relies on [crosby.binary.file](https://github.com/scrosby/OSM-binary), which isn't yet configured to work as a Maven repository. While the pull request gets written and integrated, a pre-compiled version of the library is kept in this repository.
 * In this early version, only dense nodes are supported. Other primitives will be added soon.

Contributing
------------

Simply fork the repository, create a new branch, work in that branch then send me a pull request.


text:
namespace Farmhand.Installers.Patcher.Injection.Components.Modifiers.Converters
{
    /// <summary>
    ///     The HookHandlerPropertyProvider interface.
    /// </summary>
    public interface IAlterBaseFieldProtectionAttributeConverter : IAttributeConverter
    {
        /// <summary>
        ///     Gets the minimum protection level.
        /// </summary>
        /// <remarks>
        ///     0 = Private
        ///     1 = Protected
        ///     2 = Public
        /// </remarks>
        int MinimumProtectionLevel { get; }
    }
}


text:
Installing from Source
======================

To install globally use

    $ python setup.py install

of locally use

    $ python setup.py install --user

If you prefer to use ARTview without installing, simply add the this path to
your PYTHONPATH (directory or with a .pth file) and compile the extension
in-place.

    $ python setup.py build_ext -i


text:
<?php

namespace App\Http\Controllers;

use App\Models\Process;
use Illuminate\Http\Request;
use Maatwebsite\Excel\Excel;

class ProcessCsvDownloadsController extends Controller
{
    public function index(Request $request, Process $process, Excel $excel)
    {
        $excel->create($process->id, function ($excel) use ($process) {
            $excel->sheet('Leads', function ($sheet) use ($process) {
                $sheet->fromArray($process->getDownloadData());
            });
        })->store('csv', storage_path('excel/exports'));

        $file = storage_path('excel/exports')."/{$process->id}.csv";

        return response()->download($file);
    }
}


text:
package brotli

/* Block split point selection utilities. */

type blockSplit struct {
	num_types          uint
	num_blocks         uint
	types              []byte
	lengths            []uint32
	types_alloc_size   uint
	lengths_alloc_size uint
}

const (
	kMaxLiteralHistograms        uint    = 100
	kMaxCommandHistograms        uint    = 50
	kLiteralBlockSwitchCost      float64 = 28.1
	kCommandBlockSwitchCost      float64 = 13.5
	kDistanceBlockSwitchCost     float64 = 14.6
	kLiteralStrideLength         uint    = 70
	kCommandStrideLength         uint    = 40
	kSymbolsPerLiteralHistogram  uint    = 544
	kSymbolsPerCommandHistogram  uint    = 530
	kSymbolsPerDistanceHistogram uint    = 544
	kMinLengthForBlockSplitting  uint    = 128
	kIterMulForRefining          uint    = 2
	kMinItersForRefining         uint    = 100
)

func countLiterals(cmds []command, num_commands uint) uint {
	var total_length uint = 0
	/* Count how many we have. */

	var i uint
	for i = 0; i < num_commands; i++ {
		total_length += uint(cmds[i].insert_len_)
	}

	return total_length
}

func copyLiteralsToByteArray(cmds []command, num_commands uint, data []byte, offset uint, mask uint, literals []byte) {
	var pos uint = 0
	var from_pos uint = offset & mask
	var i uint
	for i = 0; i < num_commands; i++ {
		var insert_len uint = uint(cmds[i].insert_len_)
		if from_pos+insert_len > mask {
			var head_size uint = mask + 1 - from_pos
			copy(literals[pos:], data[from_pos:][:head_size])
			from_pos = 0
			pos += head_size
			insert_len -= head_size
		}

		if insert_len > 0 {
			copy(literals[pos:], data[from_pos:][:insert_len])
			pos += insert_len
		}

		from_pos = uint((uint32(from_pos+insert_len) + commandCopyLen(&cmds[i])) & uint32(mask))
	}
}

func myRand(seed *uint32) uint32 {
	/* Initial seed should be 7. In this case, loop length is (1 << 29). */
	*seed *= 16807

	return *seed
}

func bitCost(count uint) float64 {
	if count == 0 {
		return -2.0
	} else {
		return fastLog2(count)
	}
}

const histogramsPerBatch = 64

const clustersPerBatch = 16

func initBlockSplit(self *blockSplit) {
	self.num_types = 0
	self.num_blocks = 0
	self.types = nil
	self.lengths = nil
	self.types_alloc_size = 0
	self.lengths_alloc_size = 0
}

func destroyBlockSplit(self *blockSplit) {
	self.types = nil
	self.lengths = nil
}

func splitBlock(cmds []command, num_commands uint, data []byte, pos uint, mask uint, params *encoderParams, literal_split *blockSplit, insert_and_copy_split *blockSplit, dist_split *blockSplit) {
	{
		var literals_count uint = countLiterals(cmds, num_commands)
		var literals []byte = make([]byte, literals_count)

		/* Create a continuous array of literals. */
		copyLiteralsToByteArray(cmds, num_commands, data, pos, mask, literals)

		/* Create the block split on the array of literals.
		   Literal histograms have alphabet size 256. */
		splitByteVectorLiteral(literals, literals_count, kSymbolsPerLiteralHistogram, kMaxLiteralHistograms, kLiteralStrideLength, kLiteralBlockSwitchCost, params, literal_split)

		literals = nil
	}
	{
		var insert_and_copy_codes []uint16 = make([]uint16, num_commands)
		/* Compute prefix codes for commands. */

		var i uint
		for i = 0; i < num_commands; i++ {
			insert_and_copy_codes[i] = cmds[i].cmd_prefix_
		}

		/* Create the block split on the array of command prefixes. */
		splitByteVectorCommand(insert_and_copy_codes, num_commands, kSymbolsPerCommandHistogram, kMaxCommandHistograms, kCommandStrideLength, kCommandBlockSwitchCost, params, insert_and_copy_split)

		/* TODO: reuse for distances? */

		insert_and_copy_codes = nil
	}
	{
		var distance_prefixes []uint16 = make([]uint16, num_commands)
		var j uint = 0
		/* Create a continuous array of distance prefixes. */

		var i uint
		for i = 0; i < num_commands; i++ {
			var cmd *command = &cmds[i]
			if commandCopyLen(cmd) != 0 && cmd.cmd_prefix_ >= 128 {
				distance_prefixes[j] = cmd.dist_prefix_ & 0x3FF
				j++
			}
		}

		/* Create the block split on the array of distance prefixes. */
		splitByteVectorDistance(distance_prefixes, j, kSymbolsPerDistanceHistogram, kMaxCommandHistograms, kCommandStrideLength, kDistanceBlockSwitchCost, params, dist_split)

		distance_prefixes = nil
	}
}


text:
      Search: <input type="text" ng-model="$ctrl.query" />

          {{person.first_name}}
          {{person.first_name}}
          {{person.created}}


text:
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Diagnostics;
using FluentAssertions;
using System.Collections.Generic;

namespace SBad.Map.Test
{
	[TestClass]
	public class Floor_tests
	{
		[TestMethod]
		public void FloorPlan_displays_costs()
		{
			var plan = new FloorPlan();
			plan.FloorTiles.Add(new FloorTile(0, 0));
			plan.FloorTiles.Add(new FloorTile(1, 0, cost: -1));
			plan.FloorTiles.Add(new FloorTile(2, 0, cost: 1));
			plan.FloorTiles.Add(new FloorTile(3, 0, cost: 2));
			plan.FloorTiles.Add(new FloorTile(4, 0, cost: 3));
			plan.FloorTiles.Add(new FloorTile(0, 1, cost: 4));
			plan.FloorTiles.Add(new FloorTile(2, 1, cost: 6));
			plan.FloorTiles.Add(new FloorTile(3, 1, cost: 99));
			plan.FloorTiles.Add(new FloorTile(1, 1, cost: 5));

			string display = plan.Print();

			Debug.Write(display);
			display.ShouldBeEquivalentTo("++_23" + Environment.NewLine + "456X+" + Environment.NewLine);
		}

		[TestMethod]
		public void FloorPlan_displays_paths()
		{
			var plan = new FloorPlan();
			plan.FloorTiles.AddRange(_FillArea(2, 2));

			var path = new List<Location>();
			path.Add(new Location(0, 0));
			path.Add(new Location(1, 1));
			string display = plan.Print(path);

			Debug.Write(display);
			display.ShouldBeEquivalentTo("A+" + Environment.NewLine + "+B" + Environment.NewLine);
		}

		[TestMethod]
		public void FloorPlan_displays_agents()
		{
			var plan = new FloorPlan();//NSubstitute.Substitute.For<FloorPlan>();
			plan.FloorTiles.AddRange(_FillArea(3, 1));

			plan.AddAgent("Test Agent", new Agent().Move(new Location(1, 0)));
			string display = plan.Print();

			Debug.Write(display);
			display.ShouldBeEquivalentTo("+@+" + Environment.NewLine);
		}
		[TestMethod]
		public void FloorPlan_detects_tiles()
		{
			FloorPlan plan = NSubstitute.Substitute.For<FloorPlan>();
			plan.GetFloorTile(10, 1).Should().BeNull();

			plan.FloorTiles.AddRange(_FillArea(30, 10, 1));
			plan.GetFloorTile(20, 1).Cost.Value.ShouldBeEquivalentTo(1);

			plan.GetFloorTile(10, 2).Cost = 5;
			plan.GetFloorTile(10, 2).Cost.Value.ShouldBeEquivalentTo(5);

			plan.GetFloorTile(30, 0).Should().BeNull();
			plan.GetFloorTile(0, 10).Should().BeNull();
		}

		[TestMethod]
		public void FloorPlan_detects_adjacent_tiles()
		{
			FloorPlan plan = NSubstitute.Substitute.For<FloorPlan>();
			plan.FloorTiles.AddRange(_FillArea(5, 5));
			var center = plan.GetFloorTile(2, 2);

			plan.GetNorth(center).Should().BeSameAs(plan.GetFloorTile(2, 1));
			plan.GetSouth(center).Should().BeSameAs(plan.GetFloorTile(2, 3));
			plan.GetWest(center).Should().BeSameAs(plan.GetFloorTile(1, 2));
			plan.GetEast(center).Should().BeSameAs(plan.GetFloorTile(3, 2));

			plan.GetNorth(center).Should().NotBeSameAs(plan.GetFloorTile(2, 3));

			var corner = plan.GetFloorTile(0, 0);
			plan.GetNorth(corner).Should().BeNull();
			plan.GetSouth(corner).Should().BeSameAs(plan.GetFloorTile(0, 1));
			plan.GetWest(corner).Should().BeNull();
			plan.GetEast(corner).Should().BeSameAs(plan.GetFloorTile(1, 0));

			corner = plan.GetFloorTile(4, 4);
			plan.GetNorth(corner).Should().BeSameAs(plan.GetFloorTile(4, 3));
			plan.GetSouth(corner).Should().BeNull();
			plan.GetWest(corner).Should().BeSameAs(plan.GetFloorTile(3, 4));
			plan.GetEast(corner).Should().BeNull();
		}
		[TestMethod]
		public void FloorPlan_detects_agents()
		{
			FloorPlan plan = new FloorPlan();//NSubstitute.Substitute.For<FloorPlan>();
			plan.FloorTiles.AddRange(_FillArea(30, 10, 1));
			plan.IsAgentOnTile(11, 4).Should().BeFalse();

			var agent = new Agent();// NSubstitute.Substitute.For<IAgent>();
			agent.Move(new Location(11, 4));

			plan.AddAgent("Test Agent", agent);
			plan.IsAgentOnTile(11, 4).Should().BeTrue();

			plan.IsAgentOnTile(4, 11).Should().BeFalse();
		}

		private IEnumerable<FloorTile> _FillArea(int width, int height, int? cost = null)
		{
			var tiles = new List<FloorTile>();
			for (int row = 0; row < height; row++)
			{
				for (int col = 0; col < width; col++)
				{
					tiles.Add(new FloorTile(col, row, cost: cost));
				}
			}
			return tiles;
		}
	}
}


text:
<?xml version="1.0" encoding="UTF-8"?>

<!--
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
-->

<!-- ear-ant.xml: contains targets for projects that produce
     ear files. This file is not meant to be included in a project directly.
     This file should only be included if this project is defining
     is.ear.module property.
     @Author: Inderjeet Singh -->

<project name="ear-ant" default="dummy-default">

    <property name="app.module" value="${build.dir}/${module.name}.ear"/>
    <property name="ear.build.dir" value="${build.dir}/ear"/>

    <!-- To build ear module the build system  needs to know
         the sub modules which make up the ear and is spefied
         using path id, in this case ear-components, for example:
    <path id="ear-components">
        <filelist dir="./duke-stateful-ejb" files="build.xml"/>
        <filelist dir="./duke-stateful-appclient" files="build.xml"/>
        <filelist dir="./test" files="build.xml"/>
    </path>
    -->

    <macrodef name="iterate">
        <attribute name="target"/>
        <sequential>
            <subant target="@{target}" failonerror="false">
                <buildpath refid="ear-components"/>
            </subant>
        </sequential>
    </macrodef>

    <target name="ear">
        <iterate target="default"/>
        <antcall target="default"/>
    </target>

    <target name="-pre-clean">
        <iterate target="clean"/>
    </target>

    <target name="package" depends="-post-compile" description="packages the archive">
        <echo message="building ear package"/>
        <!--antcall target="clean"/-->
        <mkdir dir="${ear.build.dir}"/>
        <mkdir dir="${ear.build.dir}/META-INF"/>
        <copy file="${src.conf}/sun-application.xml" todir="${ear.build.dir}/META-INF/" failonerror="false" />       <copy file="${src.conf}/application.xml" todir="${ear.build.dir}/META-INF/" failonerror="false"/>
        <dirname property="ear.dir" file="${ear.build.dir}/MANIFEST/"/>
        <subant target="bpp-copy-dist" failonerror="false">
            <property name="dist.dir" value="${ear.dir}"/>
            <buildpath refid="ear-components"/>
        </subant>
        <delete file="${app.module}"/>
        <jar jarfile="${app.module}" basedir="${ear.build.dir}" />
        <delete dir="${ear.build.dir}"/>
    </target>

    <target name="dummy-default"/>

</project>


text:
#ifndef GALAXYORBIT_H
#define GALAXYORBIT_H

typedef struct {
    float zmax;		/* max altitude, pc */
    float zphase;	/* phase of z oscillations, radians */
    float Rg;		/* radius of generating-circle orbit */
    float ecc;		/* eccentricity */
    float Rphase0;	/* phase of epicycle ellipse */
    float Rgphase;	/* phase of generating-circle */
    float zomega;	/* angular freq of vert oscillations, radians/Myr */
    float Romegapc;	/* angular freq of longitudinal orbit, radians-pc/Myr */
} GalOrbit;

#endif


text:
package org.apache.camel.component.cxf.jaxrs;

/**
 * We can get and set the BeanId through this interface
 */
public interface BeanIdAware {

    String getBeanId();

    void setBeanId(String id);

}