text:
package org.apache.cloudstack.storage.command;

import java.util.HashMap;
import java.util.Map;

import com.cloud.agent.api.to.DataTO;

public final class CopyCommand extends StorageSubSystemCommand {
    private DataTO srcTO;
    private DataTO destTO;
    private DataTO cacheTO;
    private boolean executeInSequence = false;
    private Map<String, String> options = new HashMap<String, String>();
    private Map<String, String> options2 = new HashMap<String, String>();

    public CopyCommand(final DataTO srcData, final DataTO destData, final int timeout, final boolean executeInSequence) {
        super();
        srcTO = srcData;
        destTO = destData;
        setWait(timeout);
        this.executeInSequence = executeInSequence;
    }

    public DataTO getDestTO() {
        return destTO;
    }

    public void setSrcTO(final DataTO srcTO) {
        this.srcTO = srcTO;
    }

    public void setDestTO(final DataTO destTO) {
        this.destTO = destTO;
    }

    public DataTO getSrcTO() {
        return srcTO;
    }

    @Override
    public boolean executeInSequence() {
        return executeInSequence;
    }

    public DataTO getCacheTO() {
        return cacheTO;
    }

    public void setCacheTO(final DataTO cacheTO) {
        this.cacheTO = cacheTO;
    }

    public int getWaitInMillSeconds() {
        return getWait() * 1000;
    }

    public void setOptions(final Map<String, String> options) {
        this.options = options;
    }

    public Map<String, String> getOptions() {
        return options;
    }

    public void setOptions2(final Map<String, String> options2) {
        this.options2 = options2;
    }

    public Map<String, String> getOptions2() {
        return options2;
    }

    @Override
    public void setExecuteInSequence(final boolean inSeq) {
        executeInSequence = inSeq;
    }
}


text:
class CalculateClues
  # I could rename line to something like `row_or_column`
  def initialize(line:)
    @line = line
  end

  def call
    @line
      .chunk { |color| color }
      .reject { |color, _| color.blank? }
      .map.with_index do |(color, occurrences), position|
        Clue.new(contiguous_boxes: occurrences.count, color: color, position: position)
      end
  end
end

redpajama_set_name: RedPajamaGithub


text:
<?php
/**
 *
 * - PopojiCMS Core
 *
 * - File : request.php
 * - Version : 1.0
 * - Author : Panada Framework - Iskandar Soesman <k4ndar@yahoo.com> Edited by Jenuar Dalapang
 * - License : http://www.opensource.org/licenses/bsd-license.php
 *
 *
 * Ini adalah library untuk menangani proses request data.
 * This is library for handling request process.
 *
 * Contoh untuk penggunaan class ini
 * Example for uses this class
 *
 *
 * $request = new PoRequest;
 * $request->post(key_name, filter_type, flags);
 * $request->get(key_name, filter_type, flags);
 * $request->cookie(key_name, filter_type, flags);
 * $request->stripTagsAttributes($string, $allowtags = null, $allowattributes = null);
 *
*/

class PoRequest
{
    /**
     * Handler for HTTP GET request
     *
     * @param mix $key
     * @param int $filterType
     * @param int $flags
     * @return mix
     */
    public function get($key = false, $filterType = false, $flags = false)
    {
        if( ! $key )
            return filter_var_array($_GET, $filterType);

        if( ! isset($_GET[$key]) )
            return false;

        if( $filterType )
           return filter_input(INPUT_GET, $key, $filterType, $flags);
        else
            return $_GET[$key];

    }

    /**
     * Handler for HTTP POST request
     *
     * @param mix $key
     * @param int $filterType
     * @param int $flags
     * @return mix
     */
    public function post($key = false, $filterType = false, $flags = false)
    {
        if( ! $key )
            return filter_var_array($_POST, $filterType);

        if( ! isset($_POST[$key]) )
            return false;

        if( $filterType )
           return filter_input(INPUT_POST, $key, $filterType, $flags);
        else
            return $_POST[$key];

    }

    /**
     * Handler for HTTP POST request
     *
     * @param mix $key
     * @param int $filterType
     * @param int $flags
     * @return mix
     */
    public function cookie($key, $filterType = false, $flags = false)
    {
        if( ! $key )
            return filter_var_array($_COOKIE, $filterType);

        if( ! isset($_COOKIE[$key]) )
            return false;

        if( $filterType )
           return filter_input(INPUT_COOKIE, $key, $filterType, $flags);
        else
            return $_COOKIE[$key];
    }

    /**
     * Strip any html tags and attributes defined by user
     *
     * @param string $str
     * @param string | array $allowtags
     * @param string | array $allowattributes
     * @return string
     */
    public function stripTagsAttributes($str, $allowtags = null, $allowattributes = null)
    {
        /**
         * ID:  Ada kemungkinan dimana string yang diinput diconvert dulu menjadi htmlentities.
         *      Untuk menghindari hal ini, maka semua format htmlentities dikembalikan (docode) dulu ke format aslinya.
         *
         *      $str = html_entity_decode($str, ENT_QUOTES);
         */

        /**
         * ID:  Jika string < diikuti dengan tanda non-alpha selain tanda ?, maka ubah menjadi < (htmlentities)
         *      Ini berguna jika string yang diinput berupa emotion code seperpti <*_*> atau tanda panah <=
         */
        // Original $str = preg_replace(array('/<\*/', '/<=/', '/_/'), '<\\1', $str);
        $str = preg_replace(array('/<\*/', '/<=/'), '<\\1', $str);

        /**
         * ID:  Hapus semua tag html dan php yang tidak didefinisikan dari input string.
         */
        $str = strip_tags($str, $allowtags);

        /**
         * ID:  Kembalikan string < menjadi <
         */
        $str = str_replace('<', '<', $str);

        /**
         * See original function at http://php.net/manual/en/function.strip-tags.php#91498
         */
        if ( ! is_null($allowattributes) ) {

            if( ! is_array($allowattributes) )
                $allowattributes = explode(",", $allowattributes);

            if( is_array($allowattributes) )
                $allowattributes = implode(")(?<!",$allowattributes);

            if ( strlen($allowattributes) > 0 )
                $allowattributes = "(?<!".$allowattributes.")";

            $str = preg_replace_callback("/<[^>]*>/i",create_function(
                '$matches',
                'return preg_replace("/ [^ =]*'.$allowattributes.'=(\"[^\"]*\"|\'[^\']*\')/i", "", $matches[0]);'
            ),$str);
        }

        return $str;
    }

	/**
     * Check internet connection
     *
     * @param string $sCheckHost
     * @return boolean
     */
	public function check_internet_connection($sCheckHost = 'www.google.com')
	{
		return (bool) @fsockopen($sCheckHost, 80, $iErrno, $sErrStr, 5);
	}

}


text:
#pragma once
#include <aws/lex-models/LexModelBuildingService_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <aws/core/utils/DateTime.h>
#include <aws/lex-models/model/ChannelType.h>
#include <aws/core/utils/memory/stl/AWSMap.h>
#include <aws/lex-models/model/ChannelStatus.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace LexModelBuildingService
{
namespace Model
{

  /**
   *
Represents an association between an Amazon Lex bot and an external messaging
   * platform.

See Also:
   AWS
   * API Reference

   */
  class AWS_LEXMODELBUILDINGSERVICE_API BotChannelAssociation
  {
  public:
    BotChannelAssociation();
    BotChannelAssociation(Aws::Utils::Json::JsonView jsonValue);
    BotChannelAssociation& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The name of the association between the bot and the channel.

     */
    inline const Aws::String& GetName() const{ return m_name; }

    /**
     *
The name of the association between the bot and the channel.

     */
    inline void SetName(const Aws::String& value) { m_nameHasBeenSet = true; m_name = value; }

    /**
     *
The name of the association between the bot and the channel.

     */
    inline void SetName(Aws::String&& value) { m_nameHasBeenSet = true; m_name = std::move(value); }

    /**
     *
The name of the association between the bot and the channel.

     */
    inline void SetName(const char* value) { m_nameHasBeenSet = true; m_name.assign(value); }

    /**
     *
The name of the association between the bot and the channel.

     */
    inline BotChannelAssociation& WithName(const Aws::String& value) { SetName(value); return *this;}

    /**
     *
The name of the association between the bot and the channel.

     */
    inline BotChannelAssociation& WithName(Aws::String&& value) { SetName(std::move(value)); return *this;}

    /**
     *
The name of the association between the bot and the channel.

     */
    inline BotChannelAssociation& WithName(const char* value) { SetName(value); return *this;}

    /**
     *
A text description of the association you are creating.

     */
    inline const Aws::String& GetDescription() const{ return m_description; }

    /**
     *
A text description of the association you are creating.

     */
    inline void SetDescription(const Aws::String& value) { m_descriptionHasBeenSet = true; m_description = value; }

    /**
     *
A text description of the association you are creating.

     */
    inline void SetDescription(Aws::String&& value) { m_descriptionHasBeenSet = true; m_description = std::move(value); }

    /**
     *
A text description of the association you are creating.

     */
    inline void SetDescription(const char* value) { m_descriptionHasBeenSet = true; m_description.assign(value); }

    /**
     *
A text description of the association you are creating.

     */
    inline BotChannelAssociation& WithDescription(const Aws::String& value) { SetDescription(value); return *this;}

    /**
     *
A text description of the association you are creating.

     */
    inline BotChannelAssociation& WithDescription(Aws::String&& value) { SetDescription(std::move(value)); return *this;}

    /**
     *
A text description of the association you are creating.

     */
    inline BotChannelAssociation& WithDescription(const char* value) { SetDescription(value); return *this;}

    /**
     *
An alias pointing to the specific version of the Amazon Lex bot to which this
     * association is being made.

     */
    inline const Aws::String& GetBotAlias() const{ return m_botAlias; }

    /**
     *
An alias pointing to the specific version of the Amazon Lex bot to which this
     * association is being made.

     */
    inline void SetBotAlias(const Aws::String& value) { m_botAliasHasBeenSet = true; m_botAlias = value; }

    /**
     *
An alias pointing to the specific version of the Amazon Lex bot to which this
     * association is being made.

     */
    inline void SetBotAlias(Aws::String&& value) { m_botAliasHasBeenSet = true; m_botAlias = std::move(value); }

    /**
     *
An alias pointing to the specific version of the Amazon Lex bot to which this
     * association is being made.

     */
    inline void SetBotAlias(const char* value) { m_botAliasHasBeenSet = true; m_botAlias.assign(value); }

    /**
     *
An alias pointing to the specific version of the Amazon Lex bot to which this
     * association is being made.

     */
    inline BotChannelAssociation& WithBotAlias(const Aws::String& value) { SetBotAlias(value); return *this;}

    /**
     *
An alias pointing to the specific version of the Amazon Lex bot to which this
     * association is being made.

     */
    inline BotChannelAssociation& WithBotAlias(Aws::String&& value) { SetBotAlias(std::move(value)); return *this;}

    /**
     *
An alias pointing to the specific version of the Amazon Lex bot to which this
     * association is being made.

     */
    inline BotChannelAssociation& WithBotAlias(const char* value) { SetBotAlias(value); return *this;}

    /**
     *
The name of the Amazon Lex bot to which this association is being made.

     * <note>
Currently, Amazon Lex supports associations with Facebook and Slack,
     * and Twilio.
 </note>
     */
    inline const Aws::String& GetBotName() const{ return m_botName; }

    /**
     *
The name of the Amazon Lex bot to which this association is being made.

     * <note>
Currently, Amazon Lex supports associations with Facebook and Slack,
     * and Twilio.
 </note>
     */
    inline void SetBotName(const Aws::String& value) { m_botNameHasBeenSet = true; m_botName = value; }

    /**
     *
The name of the Amazon Lex bot to which this association is being made.

     * <note>
Currently, Amazon Lex supports associations with Facebook and Slack,
     * and Twilio.
 </note>
     */
    inline void SetBotName(Aws::String&& value) { m_botNameHasBeenSet = true; m_botName = std::move(value); }

    /**
     *
The name of the Amazon Lex bot to which this association is being made.

     * <note>
Currently, Amazon Lex supports associations with Facebook and Slack,
     * and Twilio.
 </note>
     */
    inline void SetBotName(const char* value) { m_botNameHasBeenSet = true; m_botName.assign(value); }

    /**
     *
The name of the Amazon Lex bot to which this association is being made.

     * <note>
Currently, Amazon Lex supports associations with Facebook and Slack,
     * and Twilio.
 </note>
     */
    inline BotChannelAssociation& WithBotName(const Aws::String& value) { SetBotName(value); return *this;}

    /**
     *
The name of the Amazon Lex bot to which this association is being made.

     * <note>
Currently, Amazon Lex supports associations with Facebook and Slack,
     * and Twilio.
 </note>
     */
    inline BotChannelAssociation& WithBotName(Aws::String&& value) { SetBotName(std::move(value)); return *this;}

    /**
     *
The name of the Amazon Lex bot to which this association is being made.

     * <note>
Currently, Amazon Lex supports associations with Facebook and Slack,
     * and Twilio.
 </note>
     */
    inline BotChannelAssociation& WithBotName(const char* value) { SetBotName(value); return *this;}

    /**
     *
The date that the association between the Amazon Lex bot and the channel was
     * created.

     */
    inline const Aws::Utils::DateTime& GetCreatedDate() const{ return m_createdDate; }

    /**
     *
The date that the association between the Amazon Lex bot and the channel was
     * created.

     */
    inline void SetCreatedDate(const Aws::Utils::DateTime& value) { m_createdDateHasBeenSet = true; m_createdDate = value; }

    /**
     *
The date that the association between the Amazon Lex bot and the channel was
     * created.

     */
    inline void SetCreatedDate(Aws::Utils::DateTime&& value) { m_createdDateHasBeenSet = true; m_createdDate = std::move(value); }

    /**
     *
The date that the association between the Amazon Lex bot and the channel was
     * created.

     */
    inline BotChannelAssociation& WithCreatedDate(const Aws::Utils::DateTime& value) { SetCreatedDate(value); return *this;}

    /**
     *
The date that the association between the Amazon Lex bot and the channel was
     * created.

     */
    inline BotChannelAssociation& WithCreatedDate(Aws::Utils::DateTime&& value) { SetCreatedDate(std::move(value)); return *this;}

    /**
     *
Specifies the type of association by indicating the type of channel being
     * established between the Amazon Lex bot and the external messaging platform.

     */
    inline const ChannelType& GetType() const{ return m_type; }

    /**
     *
Specifies the type of association by indicating the type of channel being
     * established between the Amazon Lex bot and the external messaging platform.

     */
    inline void SetType(const ChannelType& value) { m_typeHasBeenSet = true; m_type = value; }

    /**
     *
Specifies the type of association by indicating the type of channel being
     * established between the Amazon Lex bot and the external messaging platform.

     */
    inline void SetType(ChannelType&& value) { m_typeHasBeenSet = true; m_type = std::move(value); }

    /**
     *
Specifies the type of association by indicating the type of channel being
     * established between the Amazon Lex bot and the external messaging platform.

     */
    inline BotChannelAssociation& WithType(const ChannelType& value) { SetType(value); return *this;}

    /**
     *
Specifies the type of association by indicating the type of channel being
     * established between the Amazon Lex bot and the external messaging platform.

     */
    inline BotChannelAssociation& WithType(ChannelType&& value) { SetType(std::move(value)); return *this;}

    /**
     *
Provides information necessary to communicate with the messaging platform.
     *

     */
    inline const Aws::Map<Aws::String, Aws::String>& GetBotConfiguration() const{ return m_botConfiguration; }

    /**
     *
Provides information necessary to communicate with the messaging platform.
     *

     */
    inline void SetBotConfiguration(const Aws::Map<Aws::String, Aws::String>& value) { m_botConfigurationHasBeenSet = true; m_botConfiguration = value; }

    /**
     *
Provides information necessary to communicate with the messaging platform.
     *

     */
    inline void SetBotConfiguration(Aws::Map<Aws::String, Aws::String>&& value) { m_botConfigurationHasBeenSet = true; m_botConfiguration = std::move(value); }

    /**
     *
Provides information necessary to communicate with the messaging platform.
     *

     */
    inline BotChannelAssociation& WithBotConfiguration(const Aws::Map<Aws::String, Aws::String>& value) { SetBotConfiguration(value); return *this;}

    /**
     *
Provides information necessary to communicate with the messaging platform.
     *

     */
    inline BotChannelAssociation& WithBotConfiguration(Aws::Map<Aws::String, Aws::String>&& value) { SetBotConfiguration(std::move(value)); return *this;}

    /**
     *
Provides information necessary to communicate with the messaging platform.
     *

     */
    inline BotChannelAssociation& AddBotConfiguration(const Aws::String& key, const Aws::String& value) { m_botConfigurationHasBeenSet = true; m_botConfiguration.emplace(key, value); return *this; }

    /**
     *
Provides information necessary to communicate with the messaging platform.
     *

     */
    inline BotChannelAssociation& AddBotConfiguration(Aws::String&& key, const Aws::String& value) { m_botConfigurationHasBeenSet = true; m_botConfiguration.emplace(std::move(key), value); return *this; }

    /**
     *
Provides information necessary to communicate with the messaging platform.
     *

     */
    inline BotChannelAssociation& AddBotConfiguration(const Aws::String& key, Aws::String&& value) { m_botConfigurationHasBeenSet = true; m_botConfiguration.emplace(key, std::move(value)); return *this; }

    /**
     *
Provides information necessary to communicate with the messaging platform.
     *

     */
    inline BotChannelAssociation& AddBotConfiguration(Aws::String&& key, Aws::String&& value) { m_botConfigurationHasBeenSet = true; m_botConfiguration.emplace(std::move(key), std::move(value)); return *this; }

    /**
     *
Provides information necessary to communicate with the messaging platform.
     *

     */
    inline BotChannelAssociation& AddBotConfiguration(const char* key, Aws::String&& value) { m_botConfigurationHasBeenSet = true; m_botConfiguration.emplace(key, std::move(value)); return *this; }

    /**
     *
Provides information necessary to communicate with the messaging platform.
     *

     */
    inline BotChannelAssociation& AddBotConfiguration(Aws::String&& key, const char* value) { m_botConfigurationHasBeenSet = true; m_botConfiguration.emplace(std::move(key), value); return *this; }

    /**
     *
Provides information necessary to communicate with the messaging platform.
     *

     */
    inline BotChannelAssociation& AddBotConfiguration(const char* key, const char* value) { m_botConfigurationHasBeenSet = true; m_botConfiguration.emplace(key, value); return *this; }

    /**
     *
The status of the bot channel.

 CREATED - The
     * channel has been created and is ready for use.

     * IN_PROGRESS - Channel creation is in progress.

     * FAILED - There was an error creating the channel. For information
     * about the reason for the failure, see the failureReason field.

     *

     */
    inline const ChannelStatus& GetStatus() const{ return m_status; }

    /**
     *
The status of the bot channel.

 CREATED - The
     * channel has been created and is ready for use.

     * IN_PROGRESS - Channel creation is in progress.

     * FAILED - There was an error creating the channel. For information
     * about the reason for the failure, see the failureReason field.

     *

     */
    inline void SetStatus(const ChannelStatus& value) { m_statusHasBeenSet = true; m_status = value; }

    /**
     *
The status of the bot channel.

 CREATED - The
     * channel has been created and is ready for use.

     * IN_PROGRESS - Channel creation is in progress.

     * FAILED - There was an error creating the channel. For information
     * about the reason for the failure, see the failureReason field.

     *

     */
    inline void SetStatus(ChannelStatus&& value) { m_statusHasBeenSet = true; m_status = std::move(value); }

    /**
     *
The status of the bot channel.

 CREATED - The
     * channel has been created and is ready for use.

     * IN_PROGRESS - Channel creation is in progress.

     * FAILED - There was an error creating the channel. For information
     * about the reason for the failure, see the failureReason field.

     *

     */
    inline BotChannelAssociation& WithStatus(const ChannelStatus& value) { SetStatus(value); return *this;}

    /**
     *
The status of the bot channel.

 CREATED - The
     * channel has been created and is ready for use.

     * IN_PROGRESS - Channel creation is in progress.

     * FAILED - There was an error creating the channel. For information
     * about the reason for the failure, see the failureReason field.

     *

     */
    inline BotChannelAssociation& WithStatus(ChannelStatus&& value) { SetStatus(std::move(value)); return *this;}

    /**
     *
If status is FAILED, Amazon Lex provides the reason
     * that it failed to create the association.

     */
    inline const Aws::String& GetFailureReason() const{ return m_failureReason; }

    /**
     *
If status is FAILED, Amazon Lex provides the reason
     * that it failed to create the association.

     */
    inline void SetFailureReason(const Aws::String& value) { m_failureReasonHasBeenSet = true; m_failureReason = value; }

    /**
     *
If status is FAILED, Amazon Lex provides the reason
     * that it failed to create the association.

     */
    inline void SetFailureReason(Aws::String&& value) { m_failureReasonHasBeenSet = true; m_failureReason = std::move(value); }

    /**
     *
If status is FAILED, Amazon Lex provides the reason
     * that it failed to create the association.

     */
    inline void SetFailureReason(const char* value) { m_failureReasonHasBeenSet = true; m_failureReason.assign(value); }

    /**
     *
If status is FAILED, Amazon Lex provides the reason
     * that it failed to create the association.

     */
    inline BotChannelAssociation& WithFailureReason(const Aws::String& value) { SetFailureReason(value); return *this;}

    /**
     *
If status is FAILED, Amazon Lex provides the reason
     * that it failed to create the association.

     */
    inline BotChannelAssociation& WithFailureReason(Aws::String&& value) { SetFailureReason(std::move(value)); return *this;}

    /**
     *
If status is FAILED, Amazon Lex provides the reason
     * that it failed to create the association.

     */
    inline BotChannelAssociation& WithFailureReason(const char* value) { SetFailureReason(value); return *this;}

  private:

    Aws::String m_name;
    bool m_nameHasBeenSet;

    Aws::String m_description;
    bool m_descriptionHasBeenSet;

    Aws::String m_botAlias;
    bool m_botAliasHasBeenSet;

    Aws::String m_botName;
    bool m_botNameHasBeenSet;

    Aws::Utils::DateTime m_createdDate;
    bool m_createdDateHasBeenSet;

    ChannelType m_type;
    bool m_typeHasBeenSet;

    Aws::Map<Aws::String, Aws::String> m_botConfiguration;
    bool m_botConfigurationHasBeenSet;

    ChannelStatus m_status;
    bool m_statusHasBeenSet;

    Aws::String m_failureReason;
    bool m_failureReasonHasBeenSet;
  };

} // namespace Model
} // namespace LexModelBuildingService
} // namespace Aws


text:
package dsl

import (
	"sync"
	"time"

	"github.com/tgres/tgres/rrd"
	"github.com/tgres/tgres/serde"
	"github.com/tgres/tgres/series"
)

// A NamedDSFetcher is a serde.Fetcher which also implements a method
// for finding DS's by its dotted name using filepath.Match-like
// syntax.
type NamedDSFetcher interface {
	dsFetcher
	fsFinder
}

type fsFinder interface {
	identsFromPattern(ident string) map[string]serde.Ident
	FsFind(pattern string) []*FsFindNode
}

type dsFetcher interface {
	FetchOrCreateDataSource(ident serde.Ident, dsSpec *rrd.DSSpec) (rrd.DataSourcer, error)
	FetchSeries(ds rrd.DataSourcer, from, to time.Time, maxPoints int64) (series.Series, error)
}

type rraDataLoader interface {
	LoadRRAData(rra rrd.RoundRobinArchiver) (rrd.RoundRobinArchiver, error)
}

type dsFetcherSearcher interface {
	dsFetcher
	serde.DataSourceSearcher
}

type dsFetcherLoader interface {
	dsFetcher
	rraDataLoader
}

// Methods necessary for a DSL context and what namedDsFetch only needs to
// expose.
type ctxDSFetcher interface {
	dsFetcher
	identsFromPattern(pattern string) map[string]serde.Ident
}

type namedDsFetcher struct {
	*sync.Mutex
	*dsLRU     // provides dsFetcher methods
	dsns       *fsFindCache
	lastReload time.Time
	minAge     time.Duration
}

type watcher interface {
	Watch(ident serde.Ident, ch chan DataPoint) rrd.DataSourcer
	Unwatch(ident serde.Ident)
}

// Returns a new instance of a NamedDSFetcher. The current
// implementation will re-fetch all series names any time a series
// cannot be found. TODO: Make this better.
func NewNamedDSFetcher(db dsFetcherSearcher, dsc watcher, lruCap int) *namedDsFetcher {
	return &namedDsFetcher{
		dsns:   newFsFindCache(db.(serde.DataSourceSearcher), "name"),
		Mutex:  &sync.Mutex{},
		minAge: time.Minute,
		dsLRU:  newDsLRU(db.(dsFetcher), dsc, lruCap),
	}
}

func (r *namedDsFetcher) identsFromPattern(ident string) map[string]serde.Ident {
	if r.dsns.empty() {
		r.dsns.reload()
	}
	return r.dsns.identsFromPattern(ident)
}

func (r *namedDsFetcher) Preload() {
	r.Lock()
	r.dsns.reload()
	r.lastReload = time.Now()
	r.Unlock()
}

func (r *namedDsFetcher) Warmup() {
	if r.dsLRU != nil {
		r.dsLRU.loadState()
	}
}

func (r *namedDsFetcher) StartStateSaver() {
	if r.dsLRU != nil {
		go r.dsLRU.stateSaver(30 * time.Second) // TODO configurable?
	}
}

// FsFind provides a way of searching dot-separated names using same
// rules as filepath.Match, as well as comma-separated values in curly
// braces such as "foo.{bar,baz}".
func (r *namedDsFetcher) FsFind(pattern string) []*FsFindNode {
	result := r.dsns.fsFind(pattern)
	go func() {
		r.Lock()
		if r.lastReload.Before(time.Now().Add(-r.minAge)) {
			// TODO: This is better done with NOTIFY trigger on ds table changes
			r.dsns.reload()
			r.lastReload = time.Now()
		}
		r.Unlock()
	}()
	return result
}

type NamedDsFetcherStats struct {
	LruEvictions int
	LruSize      int
	LruHits      int
	LruMisses    int
}

func (r *namedDsFetcher) Stats() NamedDsFetcherStats {
	if r.dsLRU.Cache == nil {
		return NamedDsFetcherStats{}
	}
	r.dsLRU.Lock()
	defer r.dsLRU.Unlock()
	result := NamedDsFetcherStats{
		LruEvictions: r.dsLRU.evictions,
		LruSize:      r.dsLRU.Len(),
		LruHits:      r.dsLRU.hits,
		LruMisses:    r.dsLRU.misses,
	}
	r.dsLRU.evictions = 0
	r.dsLRU.hits = 0
	r.dsLRU.misses = 0
	return result
}


text:
export SBT_HOME=${IROOT}/sbt
source $IROOT/java7.installed

sed -i 's|127.0.0.1|'"${DBHOST}"'|g' src/main/resources/application.conf

${SBT_HOME}/bin/sbt assembly && rm -rf target/scala-2.10/cache

java -jar target/scala-2.10/plain-benchmark-assembly-1.0.1.jar &


text:
var http = require('http-get');

exports.load = function(settings) {
    var filename = settings.filename || settings.fileurl.split('/').pop();
    var dir = settings.dir || "";

    http.get(settings.fileurl, dir + "/" +  filename, function (error, result) {
        if (error) {
            console.error(error);
            if(settings.error) settings.error();
        } else {
            //console.log('File downloaded at: ' + result.file);
            if(settings.ready) settings.ready(result.file);
        }
    });
};


text:
<?php

class BandModel extends Model {

    protected $k_id_band;
    protected $n_name_band;
    //Los campos que desea ocultar para que no se reflejen en la vista.
    protected $table = "band";
    //Los campos que desea exculir del modelo.
    protected $exclude = ["hidden", "exclude", "table", "class", "db", "__data"];

    public function __construct($properties = null) {
        parent::__construct($properties);
        $this->class = get_class($this);
    }

    public function setKIdBand($k_id_band) {
        $this->k_id_band = $k_id_band;
    }

    public function getKIdBand() {
        return $this->k_id_band;
    }

    public function setNNameBand($n_name_band) {
        $this->n_name_band = $n_name_band;
    }

    public function getNNameBand() {
        return $this->n_name_band;
    }

}


text:
<?php
namespace Application\Application\Specification\Zend;

use User\Infrastructure\Persistence\UserRepositoryInterface;

/**
 *
 * @author Nguyen Mau Tri - ngmautri@gmail.com
 *
 */
class IsParentSpecification extends DoctrineSpecification
{

    private $userRepository;

    /**
     *
     * {@inheritdoc}
     * @see \Application\Domain\Shared\Specification\AbstractSpecification::isSatisfiedBy()
     */
    public function isSatisfiedBy($subject)
    {
        $userId1 = null;
        if (isset($subject["userId1"])) {
            $userId1 = $subject["userId1"];
        }

        // var_dump($subject);

        $userId2 = null;
        if (isset($subject["userId2"])) {
            $userId2 = $subject["userId2"];
        }

        if ($this->doctrineEM == null || $userId2 == null || $userId1 == null || $this->userRepository == null)
            return false;

        $criteria = array(
            'id' => $userId1
        );
        $user1 = $this->doctrineEM->getRepository('\Application\Entity\MlaUsers')->findOneBy($criteria);

        $criteria = array(
            'id' => $userId2
        );
        $user2 = $this->doctrineEM->getRepository('\Application\Entity\MlaUsers')->findOneBy($criteria);

        $result = $this->isParent($user1, $user2);

        return ($result["result"]);
    }

    /**
     * to check, if user1 is parent of user2
     *
     * @param \Application\Entity\MlaUsers $user1
     * @param \Application\Entity\MlaUsers $user2
     */
    public function isParent(\Application\Entity\MlaUsers $user1, \Application\Entity\MlaUsers $user2)
    {
        $result = array();

        if (! $user1 instanceof \Application\Entity\MlaUsers or ! $user2 instanceof \Application\Entity\MlaUsers) {

            $result['result'] = 0;
            $result['message'] = ' User not found';
            return $result;
        }

        if ($user1 === $user2) {
            $result['result'] = 1;
            $result['message'] = 'Owner operation';
            return $result;
        }

        $isAdmin = $this->userRepository->isAdministrator($user1);

        if ($isAdmin == true) {
            $result['result'] = 1;
            $result['message'] = 'User is administrator.';
            return $result;
        }

        // Get of User 1
        $criteria = array(
            'user' => $user1
        );

        /**@var \Application\Entity\NmtApplicationAclUserRole $role1 ;*/
        $role1 = $this->doctrineEM->getRepository('\Application\Entity\NmtApplicationAclUserRole')->findOneBy($criteria);

        if ($role1 == null) {
            $result['result'] = 0;
            $result['message'] = ' User not found';
            return $result;
        }

        // Get of User 2
        $criteria = array(
            'user' => $user2
        );
        /**@var \Application\Entity\NmtApplicationAclUserRole $role2 ;*/
        $role2 = $this->doctrineEM->getRepository('\Application\Entity\NmtApplicationAclUserRole')->findOneBy($criteria);
        if ($role2 == null) {
            $result['result'] = 0;
            $result['message'] = ' User not found';
            return $result;
        }

        $path_array = explode("/", $role2->getRole()->getPath());
        $role_level = array();
        $test = '';

        if (count($path_array) > 0) {
            $level = 0;
            foreach ($path_array as $a) {
                $level ++;
                $tmp = array(
                    $a => $level
                );
                $role_level[] = $tmp;

                $test = $test . '/' . $a;
            }
        }

        $ck_level = $this->_isParent($role1->getRole()
            ->getId(), $role_level);

        if ($ck_level > 0 and $ck_level <= $role2->getRole()->getPath()) {
            $result['result'] = 1;
            $result['message'] = $role1->getRole()->getId() . ' allowed ' . $test;
        } else {

            $result['result'] = 0;
            $result['message'] = $role1->getRole()->getId() . ' not allowed ' . $test;
        }

        return $result;
    }

    /**
     *
     * @param int $roleId
     * @param array $roles
     * @return int;
     */
    private function _isParent($roleId, array $role_level)
    {
        if (count($role_level) == 0) {
            return - 1;
        }

        foreach ($role_level as $l) {

            foreach ($l as $k => $v) {

                if ($k == $roleId) {
                    return $v;
                }
            }
        }
        return - 1;
    }

    /**
     *
     * @return mixed
     */
    public function getUserId1()
    {
        return $this->userId1;
    }

    /**
     *
     * @return mixed
     */
    public function getUserId2()
    {
        return $this->userId2;
    }

    /**
     *
     * @param mixed $userId1
     */
    public function setUserId1($userId1)
    {
        $this->userId1 = $userId1;
    }

    /**
     *
     * @param mixed $userId2
     */
    public function setUserId2($userId2)
    {
        $this->userId2 = $userId2;
    }

    /**
     *
     * @return \User\Infrastructure\Persistence\UserRepositoryInterface
     */
    public function getUserRepository()
    {
        return $this->userRepository;
    }

    /**
     *
     * @param UserRepositoryInterface $userRepository
     */
    public function setUserRepository(UserRepositoryInterface $userRepository)
    {
        $this->userRepository = $userRepository;
    }
}


text:
"""Create and read global and user manifests.

:copyright: Copyright (c) 2017 RadiaSoft LLC.  All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function

#: Appears in each directory
BASENAME = "rsmanifest.json"

# POSIT: https://github.com/radiasoft/containers/blob/master/bin/build build_rsmanifest()
#: Written once at build time
CONTAINER_FILE = "/" + BASENAME

#: Format version
FILE_VERSION = "20170217.180000"

#: Read and written multiple times as the run user
USER_FILE = "~/" + BASENAME

# Identifies codes which are not installed in a pyenv
_NO_PYENV = ""

def add_code(name, version, uri, source_d, virtual_env=None, pyenv=None):
    """Add a new code to ~?rsmanifest.json

    Args:
        name (str): name of the package
        version (str): commit or version
        uri (str): repo, source link
        source_d (str): directory containing
        virtual_env (str): DEPRECATED
        pyenv (str): pyenv version
    """
    from pykern import pkcollections
    from pykern import pkio
    from pykern import pkjson
    import datetime
    import json

    fn = pkio.py_path(USER_FILE)
    try:
        values = pkcollections.json_load_any(fn)
    except Exception as e:
        if not (pkio.exception_is_not_found(e) or isinstance(e, ValueError)):
            raise
        values = pkcollections.Dict(
            version=FILE_VERSION,
            codes=pkcollections.Dict({_NO_PYENV: pkcollections.Dict()}),
        )
    if pyenv:
        assert not virtual_env, "only one of pyenv or virtual-env (DEPRECATED)"
    elif virtual_env:
        assert not pyenv, "only one of pyenv or virtual-env (DEPRECATED)"
        pyenv = virtual_env
    if not pyenv:
        pyenv = _NO_PYENV
    v = values.codes.get(pyenv) or pkcollections.Dict()
    v[name.lower()] = pkcollections.Dict(
        installed=datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%SZ"),
        name=name,
        source_d=source_d,
        uri=uri,
        version=version,
    )
    values.codes[pyenv] = v
    pkjson.dump_pretty(values, filename=fn)

def pkunit_setup():
    """Create rsmanifest files"""
    from pykern import pkjson

    pkjson.dump_pretty(
        {
            "version": FILE_VERSION,
            "image": {
                "type": "pkunit",
            },
        },
        filename=CONTAINER_FILE,
    )
    add_code("pkunit", "1.1", "https://pykern.org", "/tmp")

def read_all():
    """Merge all manifests

    Returns:
        dict: merged data
    """
    from pykern import pkio
    from pykern import pkjson

    fn = pkio.py_path(USER_FILE)
    # Both must exist or error
    u = pkjson.load_any(fn)
    c = pkjson.load_any(pkio.py_path(CONTAINER_FILE))
    assert u.version == c.version, "(user.version) {} != {} (container.version)".format(
        u.version, c.version
    )
    # There are "guaranteed" to be no collisions, but if there are
    # we override user.
    c.update(u)
    return c


text:
define({
  "productVersion": "Версия продукта: ",
  "kernelVersion": "Версия ядра: ",
  "_widgetLabel": "Описание"
});


text:
from weapon_class import Weapon
from spell_class import Spell
from hero_class import Hero
# from enemy_class import Enemy
from dungeon_class import Dungeon
# from fight_class import Fight
import sys

def create_hero():
    hero_name = input("Type your hero name: ")
    hero_title = input("Type your hero title: ")

    hero = Hero(hero_name, hero_title)
    return hero

def chooce_weapon():
    weapon0 = Weapon(name="The Axe of Destiny", damage=20)
    weapon1 = Weapon(name="Hammer of Kharas", damage=15)
    weapon2 = Weapon(name="Sword of Kas", damage=21)

    weapons = [weapon0, weapon1, weapon2]
    print (weapons)

    choice = input("Enter the number of weapon you want to equip your hero: ")
    return weapons[int(choice)]

def chooce_spell():
    spell0 = Spell(name="Fireball", damage=30, mana_cost=50, cast_range=2)
    spell1 = Spell(name="Wind Wall", damage=20, mana_cost=50, cast_range=1)

    spells = [spell0, spell1]
    print (spells)

    choice = input("Enter the number of spell you want to equip your hero: ")
    return spells[int(choice)]

def main():
    print ("Welcome to my game called Dungeons and Pythons!")
    print (30 * '*')
    print ("First, you'll create your hero:")
    my_hero = create_hero()
    print (30 * '~')
    print ("Good job. Now, chooce one weapon from the list:")
    my_weapon = chooce_weapon()
    print (30 * '~')
    print ("If you wish, You can learn one of the spells below")
    my_spell = chooce_spell()
    print (30 * '~')

    level = input("Yeah, It's the final step bro. Enter the level you want to play: ")
    print ("Enjoy the game :)")

    my_hero.equip(my_weapon)
    my_hero.learn(my_spell)

    current_map = Dungeon(level)
    current_map.spawn(my_hero)

    print (30 * '<>')

    print ("The game is started. Menu of options: ")
    print ("1. Print the current map")
    print ("2. Move UP")
    print ("3. Move DOWN")
    print ("4. Move RIGHT")
    print ("5. Move LEFT")
    print ("0. Exit the game")

    while True:
        choice = input("Enter your choice: ")

        if choice is '1':
            current_map.print_map()
            print (20 * '-')
        elif choice is '2':
            current_map.move_hero("up")
        elif choice is '3':
            current_map.move_hero("down")
        elif choice is '4':
            current_map.move_hero("right")
        elif choice is '5':
            current_map.move_hero("left")
        else:
            sys.exit()

if __name__ == '__main__':
    main()