text:
package com.github.dozermapper.protobuf.functional_tests;

import java.util.Arrays;

import com.github.dozermapper.core.DozerBeanMapperBuilder;
import com.github.dozermapper.core.Mapper;
import com.github.dozermapper.protobuf.vo.proto.LiteTestObject;
import com.github.dozermapper.protobuf.vo.proto.LiteTestObjectContainer;
import com.github.dozermapper.protobuf.vo.proto.ObjectWithCollection;
import com.github.dozermapper.protobuf.vo.proto.ProtoTestObjects.ProtoTestObjectWithNestedProtoObject;
import com.github.dozermapper.protobuf.vo.proto.ProtoTestObjects.ProtobufWithSimpleCollection;
import com.github.dozermapper.protobuf.vo.proto.ProtoTestObjects.ProtobufWithSimpleCollectionContainer;
import com.github.dozermapper.protobuf.vo.proto.ProtoTestObjects.SimpleProtoTestObject;

import org.junit.BeforeClass;
import org.junit.Test;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;

public class ProtoBeansDeepMappingTest {

    private static Mapper mapper;

    @BeforeClass
    public static void setUp() {
        mapper = DozerBeanMapperBuilder.create()
                .withMappingFiles("mappings/protoSrcDeepBeansMapping.xml")
                .build();
    }

    @Test
    public void canSrcCopySimpleOneLevelField() {
        SimpleProtoTestObject.Builder simpleProtoTestObjectBuilder = SimpleProtoTestObject.newBuilder();
        simpleProtoTestObjectBuilder.setOne("smthOne");

        ProtoTestObjectWithNestedProtoObject.Builder protoTestObjectWithNestedProtoObjectBuilder = ProtoTestObjectWithNestedProtoObject.newBuilder();
        protoTestObjectWithNestedProtoObjectBuilder.setNestedObject(simpleProtoTestObjectBuilder);
        protoTestObjectWithNestedProtoObjectBuilder.setOne("smthAnother-neverMind");

        ProtoTestObjectWithNestedProtoObject protoTestObjectWithNestedProtoObject = protoTestObjectWithNestedProtoObjectBuilder.build();

        LiteTestObject result = mapper.map(protoTestObjectWithNestedProtoObject, LiteTestObject.class);

        assertNotNull(result);
        assertNotNull(result.getOne());
        assertEquals(protoTestObjectWithNestedProtoObject.getNestedObject().getOne(), result.getOne());
    }

    @Test
    public void canSrcCopyFieldFromListElement() {
        SimpleProtoTestObject.Builder simpleProtoTestObjectBuilder1 = SimpleProtoTestObject.newBuilder();
        simpleProtoTestObjectBuilder1.setOne("smthAnother");

        SimpleProtoTestObject.Builder simpleProtoTestObjectBuilder2 = SimpleProtoTestObject.newBuilder();
        simpleProtoTestObjectBuilder2.setOne("smthOne");

        ProtobufWithSimpleCollection.Builder protobufWithSimpleCollectionBuilder = ProtobufWithSimpleCollection.newBuilder();
        protobufWithSimpleCollectionBuilder.addAllObject(Arrays.asList(simpleProtoTestObjectBuilder1.build(), simpleProtoTestObjectBuilder2.build()));

        ProtobufWithSimpleCollection protobufWithSimpleCollection = protobufWithSimpleCollectionBuilder.build();

        LiteTestObject result = mapper.map(protobufWithSimpleCollection, LiteTestObject.class);

        assertNotNull(result);
        assertNotNull(result.getOne());
        assertEquals(protobufWithSimpleCollection.getObject(1).getOne(), result.getOne());
    }

    @Test
    public void canSrcCopyList() {
        SimpleProtoTestObject.Builder simpleProtoTestObjectBuilder1 = SimpleProtoTestObject.newBuilder();
        simpleProtoTestObjectBuilder1.setOne("smthAnother");

        SimpleProtoTestObject.Builder simpleProtoTestObjectBuilder2 = SimpleProtoTestObject.newBuilder();
        simpleProtoTestObjectBuilder2.setOne("smthOne");

        ProtobufWithSimpleCollection.Builder protoWithCollectionBuilder = ProtobufWithSimpleCollection.newBuilder();
        protoWithCollectionBuilder.addAllObject(Arrays.asList(simpleProtoTestObjectBuilder1.build(), simpleProtoTestObjectBuilder2.build()));

        ProtobufWithSimpleCollectionContainer.Builder protobufWithSimpleCollectionContainerBuilder = ProtobufWithSimpleCollectionContainer.newBuilder();
        protobufWithSimpleCollectionContainerBuilder.setObject(protoWithCollectionBuilder);

        ProtobufWithSimpleCollectionContainer src = protobufWithSimpleCollectionContainerBuilder.build();

        ObjectWithCollection result = mapper.map(src, ObjectWithCollection.class);

        assertNotNull(result);
        assertNotNull(result.getObjects());
        assertEquals(2, result.getObjects().size());
    }

    @Test
    public void canSrcCopyListElement() {
        SimpleProtoTestObject.Builder simpleProtoTestObjectBuilder1 = SimpleProtoTestObject.newBuilder();
        simpleProtoTestObjectBuilder1.setOne("smthAnother");

        SimpleProtoTestObject.Builder simpleProtoTestObjectBuilder2 = SimpleProtoTestObject.newBuilder();
        simpleProtoTestObjectBuilder2.setOne("smthOne");

        ProtobufWithSimpleCollection.Builder builder = ProtobufWithSimpleCollection.newBuilder();
        builder.addAllObject(Arrays.asList(simpleProtoTestObjectBuilder1.build(), simpleProtoTestObjectBuilder2.build()));

        ProtobufWithSimpleCollection protobufWithSimpleCollection = builder.build();

        LiteTestObjectContainer result = mapper.map(protobufWithSimpleCollection, LiteTestObjectContainer.class);

        assertNotNull(result);
        assertNotNull(result.getObject());
        assertNotNull(result.getObject().getOne());
        assertEquals(protobufWithSimpleCollection.getObject(1).getOne(), result.getObject().getOne());
    }

    @Test
    public void canSrcCopyDeepListElement() {
        SimpleProtoTestObject.Builder simpleProtoTestObjectBuilder1 = SimpleProtoTestObject.newBuilder();
        simpleProtoTestObjectBuilder1.setOne("smthOne");

        SimpleProtoTestObject.Builder simpleProtoTestObjectBuilder2 = SimpleProtoTestObject.newBuilder();
        simpleProtoTestObjectBuilder2.setOne("smthAnother");

        ProtobufWithSimpleCollection.Builder protobufWithSimpleCollectionBuilder = ProtobufWithSimpleCollection.newBuilder();
        protobufWithSimpleCollectionBuilder.addAllObject(Arrays.asList(simpleProtoTestObjectBuilder1.build(), simpleProtoTestObjectBuilder2.build()));

        ProtobufWithSimpleCollectionContainer.Builder protobufWithSimpleCollectionContainerBuilder = ProtobufWithSimpleCollectionContainer.newBuilder();
        protobufWithSimpleCollectionContainerBuilder.setObject(protobufWithSimpleCollectionBuilder);

        ProtobufWithSimpleCollectionContainer protobufWithSimpleCollectionContainer = protobufWithSimpleCollectionContainerBuilder.build();

        LiteTestObjectContainer result = mapper.map(protobufWithSimpleCollectionContainer, LiteTestObjectContainer.class);

        assertNotNull(result);
        assertNotNull(result.getObject().getOne());
        assertEquals(protobufWithSimpleCollectionContainer.getObject().getObject(0).getOne(), result.getObject().getOne());
    }
}


text:
namespace net {

namespace {

// Base64 encode the given |value| string and put it in |dict| with the
// description |key|.
void SetBinaryData(const char* key,
                   base::StringPiece value,
                   base::DictionaryValue* dict) {
  std::string b64_value;
  base::Base64Encode(value, &b64_value);

  dict->SetString(key, b64_value);
}

// Returns a dictionary where each key is a field of the SCT and its value
// is this field's value in the SCT. This dictionary is meant to be used for
// outputting a de-serialized SCT to the NetLog.
std::unique_ptr<base::DictionaryValue> SCTToDictionary(
    const ct::SignedCertificateTimestamp& sct,
    ct::SCTVerifyStatus status) {
  std::unique_ptr<base::DictionaryValue> out(new base::DictionaryValue());

  out->SetString("origin", OriginToString(sct.origin));
  out->SetString("verification_status", StatusToString(status));
  out->SetInteger("version", sct.version);

  SetBinaryData("log_id", sct.log_id, out.get());
  base::TimeDelta time_since_unix_epoch =
      sct.timestamp - base::Time::UnixEpoch();
  out->SetString("timestamp",
      base::Int64ToString(time_since_unix_epoch.InMilliseconds()));
  SetBinaryData("extensions", sct.extensions, out.get());

  out->SetString("hash_algorithm",
                 HashAlgorithmToString(sct.signature.hash_algorithm));
  out->SetString("signature_algorithm",
                 SignatureAlgorithmToString(sct.signature.signature_algorithm));
  SetBinaryData("signature_data", sct.signature.signature_data, out.get());

  return out;
}

// Given a list of SCTs and their statuses, return a ListValue instance where
// each item in the list is a dictionary created by SCTToDictionary.
std::unique_ptr<base::ListValue> SCTListToPrintableValues(
    const SignedCertificateTimestampAndStatusList& sct_and_status_list) {
  std::unique_ptr<base::ListValue> output_scts(new base::ListValue());
  for (const auto& sct_and_status : sct_and_status_list)
    output_scts->Append(
        SCTToDictionary(*(sct_and_status.sct.get()), sct_and_status.status));

  return output_scts;
}

}  // namespace

std::unique_ptr<base::Value> NetLogSignedCertificateTimestampCallback(
    const SignedCertificateTimestampAndStatusList* scts,
    NetLogCaptureMode capture_mode) {
  std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());

  dict->Set("scts", SCTListToPrintableValues(*scts));

  return std::move(dict);
}

std::unique_ptr<base::Value> NetLogRawSignedCertificateTimestampCallback(
    base::StringPiece embedded_scts,
    base::StringPiece sct_list_from_ocsp,
    base::StringPiece sct_list_from_tls_extension,
    NetLogCaptureMode capture_mode) {
  std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());

  SetBinaryData("embedded_scts", embedded_scts, dict.get());
  SetBinaryData("scts_from_ocsp_response", sct_list_from_ocsp, dict.get());
  SetBinaryData("scts_from_tls_extension", sct_list_from_tls_extension,
                dict.get());

  return std::move(dict);
}

}  // namespace net

redpajama_set_name: RedPajamaGithub


text:
#ifndef __CCAntiArtifactSprite_h__
#define __CCAntiArtifactSprite_h__

#include "cocos2d.h"

NS_CC_BEGIN

/**
 * sprite which enables anti-artifact by default. To use
 * this sprite so that you don't need to turn on the compile flag
 * in cocos2d-x config, which affects everything.
 */
class CC_DLL CCAntiArtifactSprite : public CCSprite {
public:
	/**
     * Default constructor
     */
    CCAntiArtifactSprite();

    /**
     * Default destructor
     */
    virtual ~CCAntiArtifactSprite();

	/// @{
    /// @name Creators

    /**
     * Creates an empty sprite without texture. You can call setTexture method subsequently.
     *
     * @return An empty sprite object that is marked as autoreleased.
     */
    static CCAntiArtifactSprite* create();

    /**
     * Creates a sprite with an image filename.
     *
     * After creation, the rect of sprite will be the size of the image,
     * and the offset will be (0,0).
     *
     * @param   pszFileName The string which indicates a path to image file, e.g., "scene1/monster.png".
     * @return  A valid sprite object that is marked as autoreleased.
     */
    static CCAntiArtifactSprite* create(const char *pszFileName);

    /**
     * Creates a sprite with an image filename and a rect.
     *
     * @param   pszFileName The string wich indicates a path to image file, e.g., "scene1/monster.png"
     * @param   rect        Only the contents inside rect of pszFileName's texture will be applied for this sprite.
     * @return  A valid sprite object that is marked as autoreleased.
     */
    static CCAntiArtifactSprite* create(const char *pszFileName, const CCRect& rect);

    /**
     * Creates a sprite with an exsiting texture contained in a CCTexture2D object
     * After creation, the rect will be the size of the texture, and the offset will be (0,0).
     *
     * @param   pTexture    A pointer to a CCTexture2D object.
     * @return  A valid sprite object that is marked as autoreleased.
     */
    static CCAntiArtifactSprite* createWithTexture(CCTexture2D *pTexture);

    /**
     * Creates a sprite with a texture and a rect.
     *
     * After creation, the offset will be (0,0).
     *
     * @param   pTexture    A pointer to an existing CCTexture2D object.
     *                      You can use a CCTexture2D object for many sprites.
     * @param   rect        Only the contents inside the rect of this texture will be applied for this sprite.
     * @return  A valid sprite object that is marked as autoreleased.
     */
    static CCAntiArtifactSprite* createWithTexture(CCTexture2D *pTexture, const CCRect& rect);

    /**
     * Creates a sprite with an sprite frame.
     *
     * @param   pSpriteFrame    A sprite frame which involves a texture and a rect
     * @return  A valid sprite object that is marked as autoreleased.
     */
    static CCAntiArtifactSprite* createWithSpriteFrame(CCSpriteFrame *pSpriteFrame);

    /**
     * Creates a sprite with an sprite frame name.
     *
     * A CCSpriteFrame will be fetched from the CCSpriteFrameCache by pszSpriteFrameName param.
     * If the CCSpriteFrame doesn't exist it will raise an exception.
     *
     * @param   pszSpriteFrameName A null terminated string which indicates the sprite frame name.
     * @return  A valid sprite object that is marked as autoreleased.
     */
    static CCAntiArtifactSprite* createWithSpriteFrameName(const char *pszSpriteFrameName);

    /// @}  end of creators group

protected:
	/// @see CCSprite::setTextureCoords
    virtual void setTextureCoords(CCRect rect);
};

NS_CC_END

#endif // __CCAntiArtifactSprite_h__


text:
package com.luiges90.tiltblocks.generator;

import com.luiges90.tiltblocks.GameField;

public interface GameGeneratorInterface {

    public GameField generate(GeneratorOption opt);

}


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

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>TypeDefinitionStringImpl.CharacterStringValue (Media Authoring with Java API)</title>
<meta name="date" content="2016-02-05">
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Media Authoring with Java API (MAJ)

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

tv.amwa.maj.meta.impl

Class TypeDefinitionStringImpl.CharacterStringValue

java.lang.Object

tv.amwa.maj.meta.impl.TypeDefinitionImpl.PropertyValueImpl

tv.amwa.maj.meta.impl.TypeDefinitionStringImpl.BaseStringValue

tv.amwa.maj.meta.impl.TypeDefinitionStringImpl.CharacterStringValue

All Implemented Interfaces:

PropertyValue

Enclosing class:

TypeDefinitionStringImpl

public static class TypeDefinitionStringImpl.CharacterStringValue
extends TypeDefinitionStringImpl.BaseStringValue
implements PropertyValue

Property value for strings with an underlying element type of
 TypeDefinitionCharacterImpl. These are backed in Java by a
 String value.

Method Summary

All Methods Instance Methods Concrete Methods

Modifier and Type
Method and Description

String
getValue()

Returns the value of the property through a generic Java object interface.

Methods inherited from class tv.amwa.maj.meta.impl.TypeDefinitionStringImpl.BaseStringValue

equals, getType, isDefinedType

Methods inherited from class tv.amwa.maj.meta.impl.TypeDefinitionImpl.PropertyValueImpl

hashCode, toString

Methods inherited from class java.lang.Object

getClass, notify, notifyAll, wait, wait, wait

Methods inherited from interface tv.amwa.maj.industry.PropertyValue

equals, getType, hashCode, toString

Method Detail

getValue

public String getValue()

Description copied from interface: PropertyValue

Returns the value of the property through a generic Java object interface.
 Alternative type-specific access methods are provided in each type definition.

For example, for a property value of a UInt32 type, this method
 returns an Integer. Values will need to be cast to appropriate types by the
 application. The value returned may be null, which may indicate that an optional
 property was not present.

Specified by:

getValue in interface PropertyValue

Returns:

Value of this property.

See Also:

PropertyValue.getValue()

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Media Authoring with Java API (MAJ)

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

(c)2007-2016 Richard Cartwright, all rights reserved. Licensed 						under Apache 2 license and subject to the AMWA IPR policy.


text:
<?php

namespace Ups\Entity;

use DOMDocument;
use DOMElement;
use Ups\NodeInterface;

class InsuredValue implements NodeInterface
{
    /** @deprecated */
    public $CurrencyCode;
    /** @deprecated */
    public $MonetaryValue;

    /**
     * @var string
     */
    private $currencyCode;

    /**
     * @var float
     */
    private $monetaryValue;

    public function __construct($response = null)
    {
        if (null !== $response) {
            if (isset($response->CurrencyCode)) {
                $this->setCurrencyCode($response->CurrencyCode);
            }
            if (isset($response->MonetaryValue)) {
                $this->setMonetaryValue($response->MonetaryValue);
            }
        }
    }

    /**
     * @param null|DOMDocument $document
     *
     * @return DOMElement
     */
    public function toNode(DOMDocument $document = null)
    {
        if (null === $document) {
            $document = new DOMDocument();
        }

        $node = $document->createElement('InsuredValue');
        $node->appendChild($document->createElement('CurrencyCode', $this->getCurrencyCode()));
        $node->appendChild($document->createElement('MonetaryValue', $this->getMonetaryValue()));

        return $node;
    }

    /**
     * @return string|null
     */
    public function getCurrencyCode()
    {
        return $this->currencyCode;
    }

    /**
     * @param $var string
     */
    public function setCurrencyCode($var)
    {
        $this->CurrencyCode = $var;
        $this->currencyCode = $var;
    }

    /**
     * @return float|null
     */
    public function getMonetaryValue()
    {
        return $this->monetaryValue;
    }

    /**
     * @param $var float
     */
    public function setMonetaryValue($var)
    {
        $this->MonetaryValue = $var;
        $this->monetaryValue = $var;
    }
}


text:
"""

Module :mod:`pyesgf.search.context`
===================================

Defines the :class:`SearchContext` class which represents each ESGF search
query.

"""

import os
import sys
import copy

from webob.multidict import MultiDict

from .constraints import GeospatialConstraint
from .consts import (TYPE_DATASET, TYPE_FILE, TYPE_AGGREGATION,
                     QUERY_KEYWORD_TYPES, DEFAULT_BATCH_SIZE)
from .results import ResultSet
from .exceptions import EsgfSearchException

class SearchContext(object):
    """Instances of this class represent the state of a current search.
    It exposes what facets are available to select and the facet counts
    if they are available.

    Subclasses of this class can restrict the search options.  For instance
    FileSearchContext, DatasetSerachContext or CMIP5SearchContext

    SearchContext instances are connected to SearchConnection instances.  You
    normally create SearchContext instances via one of:
    1. Calling SearchConnection.new_context()
    2. Calling SearchContext.constrain()

    :ivar constraints: A dictionary of facet constraints currently in effect.
        ``constraint[facet_name] = [value, value, ...]``

    :ivar facets: A string containing a comma-separated list of facets to be
        returned (for example ``'source_id,ensemble_id'``). If set, this will
        be used to select which facet counts to include, as returned in the
        ``facet_counts`` dictionary.  Defaults to including all available
        facets, but with distributed searches (where the SearchConnection
        instance was created with ``distrib=True``), some results may be
        missing for server-side reasons when requesting all facets, so a
        warning message will be issued. This contains further details.
    :property facet_counts: A dictionary of available hits with each
        facet value for the search as currently constrained.
        This property returns a dictionary of dictionaries where
        ``facet_counts[facet][facet_value] == hit_count``
    :property hit_count: The total number of hits available with current
                         constraints.

    """

    DEFAULT_SEARCH_TYPE = NotImplemented

    def __init__(self, connection, constraints, search_type=None,
                 latest=None, facets=None, fields=None,
                 from_timestamp=None, to_timestamp=None,
                 replica=None, shards=None):
        """

        :param connection: The SearchConnection
        :param constraints: A dictionary of initial constraints
        :param search_type: One of TYPE_* constants defining the document
            type to search for.  Overrides SearchContext.DEFAULT_SEARCH_TYPE
        :param facets: The list of facets for which counts will be retrieved
            and constraints be validated against.  Or None to represent all
            facets.
        :param fields: A list of field names to return in search responses
        :param replica: A boolean defining whether to return master records
            or replicas, or None to return both.
        :param latest: A boolean defining whether to return only latest
            versions or only non-latest versions, or None to return both.
        :param shards: list of shards to restrict searches to.  Should be from
            the list self.connection.get_shard_list()
        :param from_timestamp: Date-time string to specify start of search
            range (e.g. "2000-01-01T00:00:00Z").
        :param to_timestamp: Date-time string to specify end of search range
            (e.g. "2100-12-31T23:59:59Z").

        """

        self.connection = connection
        self.__facet_counts = None
        self.__hit_count = None
        self._did_facets_star_warning = False
        if search_type is None:
            search_type = self.DEFAULT_SEARCH_TYPE

        #  Constraints
        self.freetext_constraint = None
        self.facet_constraints = MultiDict()
        self.temporal_constraint = [from_timestamp, to_timestamp]
        self.geospatial_constraint = None

        self._update_constraints(constraints)

        # Search configuration parameters
        self.timestamp_range = (from_timestamp, to_timestamp)

        search_types = [TYPE_DATASET, TYPE_FILE, TYPE_AGGREGATION]
        if search_type not in search_types:
            raise EsgfSearchException('search_type must be one of %s'
                                      % ','.join(search_types))
        self.search_type = search_type

        self.latest = latest
        self.facets = facets
        self.fields = fields
        self.replica = replica
        self.shards = shards

    # -------------------------------------------------------------------------
    # Functional search interface
    # These do not change the constraints on self.

    def search(self, batch_size=DEFAULT_BATCH_SIZE, ignore_facet_check=False,
               **constraints):
        """
        Perform the search with current constraints returning a set of results.

        :batch_size: The number of results to get per HTTP request.
        :ignore_facet_check: Do not make an extra HTTP request to populate
            :py:attr:`~facet_counts` and :py:attr:`~hit_count`.
        :param constraints: Further constraints for this query.  Equivalent
            to calling ``self.constrain(**constraints).search()``
        :return: A ResultSet for this query

        """
        if constraints:
            sc = self.constrain(**constraints)
        else:
            sc = self

        if not ignore_facet_check:
            sc.__update_counts()

        return ResultSet(sc, batch_size=batch_size)

    def constrain(self, **constraints):
        """
        Return a *new* instance with the additional constraints.

        """
        new_sc = copy.deepcopy(self)
        new_sc._update_constraints(constraints)
        return new_sc

    def get_download_script(self, **constraints):
        """
        Download a script for downloading all files in the set of results.

        :param constraints: Further constraints for this query. Equivalent
            to calling ``self.constrain(**constraints).get_download_script()``
        :return: A string containing the script
        """
        if constraints:
            sc = self.constrain(**constraints)
        else:
            sc = self

        sc.__update_counts()

        query_dict = sc._build_query()

        # !TODO: allow setting limit
        script = sc.connection.send_wget(query_dict,
                                         shards=self.shards)

        return script

    @property
    def facet_counts(self):
        self.__update_counts()
        return self.__facet_counts

    @property
    def hit_count(self):
        self.__update_counts()
        return self.__hit_count

    def get_facet_options(self):
        """
        Return a dictionary of facet counts filtered to remove all
        facets that are completely constrained.  This method is
        similar to the property ``facet_counts`` except facet values
        which are not relevant for further constraining are removed.

        """
        facet_options = {}
        hits = self.hit_count
        for facet, counts in list(self.facet_counts.items()):
            # filter out counts that match total hits
            counts = dict(items for items in list(counts.items())
                          if items[1] < hits)
            if len(counts) > 1:
                facet_options[facet] = counts

        return facet_options

    def __update_counts(self):
        # If hit_count is set the counts are already retrieved
        if self.__hit_count is not None:
            return

        self.__facet_counts = {}
        self.__hit_count = None
        query_dict = self._build_query()

        if self.facets:
            query_dict['facets'] = self.facets
        else:
            query_dict['facets'] = '*'
            if self.connection.distrib:
                self._do_facets_star_warning()

        response = self.connection.send_search(query_dict, limit=0)
        for facet, counts in (list(response['facet_counts']['facet_fields'].items())):
            d = self.__facet_counts[facet] = {}
            while counts:
                d[counts.pop()] = counts.pop()

        self.__hit_count = response['response']['numFound']

    def _do_facets_star_warning(self):
        env_var_name = 'ESGF_PYCLIENT_NO_FACETS_STAR_WARNING'
        if env_var_name in os.environ:
            return
        if not self._did_facets_star_warning:
            sys.stderr.write(f'''
-------------------------------------------------------------------------------
Warning - defaulting to search with facets=*

This behavior is kept for backward-compatibility, but ESGF indexes might not
successfully perform a distributed search when this option is used, so some
results may be missing.  For full results, it is recommended to pass a list of
facets of interest when instantiating a context object.  For example,

      ctx = conn.new_context(facets='project,experiment_id')

Only the facets that you specify will be present in the facets_counts dictionary.

This warning is displayed when a distributed search is performed while using the
facets=* default, a maximum of once per context object.  To suppress this warning,
set the environment variable {env_var_name} to any value
or explicitly use  conn.new_context(facets='*')

-------------------------------------------------------------------------------
''')
            self._did_facets_star_warning = True

    # -------------------------------------------------------------------------
    # Constraint mutation interface
    # These functions update the instance in-place.
    # Use constrain() and search() to generate new contexts with tighter
    # constraints.

    def _update_constraints(self, constraints):
        """
        Update the constraints in-place by calling _constrain_*() methods.

        """
        constraints_split = self._split_constraints(constraints)
        self._constrain_facets(constraints_split['facet'])
        if 'query' in constraints_split['freetext']:
            new_freetext = constraints_split['freetext']['query']
            self._constrain_freetext(new_freetext)

        # !TODO: implement temporal and geospatial constraints
        if 'from_timestamp' in constraints_split['temporal']:
            self.temporal_constraint[0] = (constraints_split['temporal']
                                           ['from_timestamp'])
        if 'to_timestamp' in constraints_split['temporal']:
            self.temporal_constraint[1] = (constraints_split['temporal']
                                           ['to_timestamp'])
        # self._constrain_geospatial()

        # reset cached values
        self.__hit_count = None
        self.__facet_counts = None

    def _constrain_facets(self, facet_constraints):
        for key, values in list(facet_constraints.mixed().items()):
            current_values = self.facet_constraints.getall(key)
            if isinstance(values, list):
                for value in values:
                    if value not in current_values:
                        self.facet_constraints.add(key, value)
            else:
                if values not in current_values:
                    self.facet_constraints.add(key, values)

    def _constrain_freetext(self, query):
        self.freetext_constraint = query

    def _constrain_geospatial(self, lat=None, lon=None, bbox=None,
                              location=None, radius=None, polygon=None):
        self.geospatial_constraint = GeospatialConstraint(
                                            lat, lon, bbox, location,
                                            radius, polygon)

        raise NotImplementedError

    # -------------------------------------------------------------------------

    def _split_constraints(self, constraints):
        """
        Divide a constraint dictionary into 4 types of constraints:
        1. Freetext query
        2. Facet constraints
        3. Temporal constraints
        4. Geospatial constraints

        :return: A dictionary of the 4 types of constraint.

        """
        # local import to prevent circular importing
        from .connection import query_keyword_type

        constraints_split = dict((kw, MultiDict()) for kw
                                 in QUERY_KEYWORD_TYPES)

        for kw, val in list(constraints.items()):
            constraint_type = query_keyword_type(kw)
            constraints_split[constraint_type][kw] = val

        return constraints_split

    def _build_query(self):
        """
        Build query string parameters as a dictionary.

        """

        query_dict = MultiDict({"query": self.freetext_constraint,
                                "type": self.search_type,
                                "latest": self.latest,
                                "facets": self.facets,
                                "fields": self.fields,
                                "replica": self.replica})

        query_dict.extend(self.facet_constraints)

        # !TODO: encode datetime
        start, end = self.temporal_constraint
        query_dict.update(start=start, end=end)

        return query_dict

class DatasetSearchContext(SearchContext):
    DEFAULT_SEARCH_TYPE = TYPE_DATASET

class FileSearchContext(SearchContext):
    DEFAULT_SEARCH_TYPE = TYPE_FILE

class AggregationSearchContext(SearchContext):
    DEFAULT_SEARCH_TYPE = TYPE_AGGREGATION


text:
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

//  Authors: Nick Edmonds
//           Andrew Lumsdaine
#ifndef BOOST_GRAPH_DISTRIBUTED_REVERSE_GRAPH_HPP
#define BOOST_GRAPH_DISTRIBUTED_REVERSE_GRAPH_HPP

#ifndef BOOST_GRAPH_USE_MPI
#error "Parallel BGL files should not be included unless <boost/graph/use_mpi.hpp> has been included"
#endif

#include <boost/graph/reverse_graph.hpp>
#include <boost/graph/parallel/container_traits.hpp>

namespace boost {
  namespace graph {
    namespace parallel {
      /// Retrieve the process group from a reverse graph
      template<typename Graph, typename GraphRef>
      struct process_group_type<reverse_graph<Graph, GraphRef> >
        : process_group_type<Graph> { };
    }

  }

  /// Retrieve the process group from a reverse graph
  template<typename Graph, typename GraphRef>
  inline typename graph::parallel::process_group_type<Graph>::type
  process_group(reverse_graph<Graph, GraphRef> const& g) {
    return process_group(g.m_g);
  }
} // namespace boost

#endif


text:
var router = require('koa-route');
var views = require('../../');
var koa = require('koa');
var app = koa();

// Jade.

app.use(views('.', 'jade'));

// Routes.

app.use(router.get('/jade', function *(next) {
  this.body = yield this.render('index');
}));

// Listen

app.listen(3000);
console.log('app running on port 3000');


text:
//
//  AttributedStringUseDemoVC.m
//  RZColorful_Example
//
//  Created by rztime on 2022/1/25.
//  Copyright © 2022 rztime. All rights reserved.
//

#import "AttributedStringUseDemoVC.h"
#import <RZColorful.h>

@interface AttributedStringUseDemoVC ()
@property (nonatomic, strong) UILabel *label;
@end

@implementation AttributedStringUseDemoVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = UIColor.whiteColor;
    _label = [[UILabel alloc] init];
    _label.numberOfLines = 0;
    [self.view addSubview:_label];
    _label.frame = self.view.bounds;
    NSAttributedString *attr = [NSAttributedString rz_colorfulConfer:^(RZColorfulConferrer * _Nullable confer) {
        confer.htmlText(@"标签富文本
").font([UIFont systemFontOfSize:16]);
        confer.text(@"\n正文使用方法:常规 字体 + 颜色\n\n").font([UIFont systemFontOfSize:16]).textColor(UIColor.blackColor);

        confer.text(@"添加本地图片 ").font([UIFont systemFontOfSize:20]).textColor(UIColor.redColor);
        confer.image([UIImage imageNamed:@"image"]).size(CGSizeMake(40, 40), RZHorizontalAlignCenter, [UIFont systemFontOfSize:20]).tapActionByLable(@"2"); // 点击事件
        confer.text(@"  ");
        confer.image([UIImage imageNamed:@"image"]).size(CGSizeMake(40, 40), RZHorizontalAlignCenter, [UIFont systemFontOfSize:20]).custom(NSTapActionByLabelAttributeName, @"3"); // 自定义点击事件
        confer.text(@" 图片可对齐文本\n\n").font([UIFont systemFontOfSize:20]).textColor(UIColor.redColor);

        confer.text(@"\n正文使用方法:斜体").font([UIFont systemFontOfSize:16]).textColor(UIColor.blackColor).italic(@1);
        confer.text(@"\n正文使用方法:删除线").font([UIFont systemFontOfSize:16]).textColor(UIColor.blackColor).strikeThrough(NSUnderlineStyleSingle).strikeThroughColor(UIColor.redColor);
        confer.text(@"\n正文使用方法:下划线").font([UIFont systemFontOfSize:16]).textColor(UIColor.blackColor).underLineStyle(NSUnderlineStyleSingle).underLineColor(UIColor.redColor);
        confer.text(@"\n正文使用方法:描边\n").font([UIFont systemFontOfSize:16]).textColor(UIColor.blackColor).strokeWidth(@1).strokeColor(UIColor.redColor);
        confer.text(@"正文使用方法:背景色").font([UIFont systemFontOfSize:16]).textColor(UIColor.blackColor).backgroundColor(UIColor.lightGrayColor);
        confer.text(@"\n文本的点击事件").font([UIFont systemFontOfSize:16]);
        confer.text(@"可点击文本").textColor(UIColor.redColor).font([UIFont systemFontOfSize:16]).tapActionByLable(@"点击的id");
        confer.text(@"\n");
        confer.text(@"段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置\n段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置段落样式的方法设置\n").font([UIFont systemFontOfSize:16]).textColor(UIColor.blackColor).paragraphStyle.lineSpacing(20).paragraphSpacingBefore(10);
    }];
    _label.attributedText = attr;
    [_label rz_tapAction:^(UILabel * _Nonnull label, NSString * _Nonnull tapActionId, NSRange range) {
        NSLog(@"%@", tapActionId); // print: 点击的id
    }];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end


text:
package com.refinedmods.refinedstorage.render.model;

import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.block.model.BakedQuad;
import net.minecraft.client.renderer.block.model.ItemOverrides;
import net.minecraft.client.renderer.block.model.ItemTransforms;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.resources.model.BakedModel;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.state.BlockState;

import javax.annotation.Nullable;
import java.util.List;
import java.util.Random;

public class DelegateBakedModel implements BakedModel {
    protected final BakedModel base;

    public DelegateBakedModel(BakedModel base) {
        this.base = base;
    }

    @Override
    @SuppressWarnings("deprecation")
    public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
        return base.getQuads(state, side, rand);
    }

    @Override
    public boolean useAmbientOcclusion() {
        return base.useAmbientOcclusion();
    }

    @Override
    public boolean isGui3d() {
        return base.isGui3d();
    }

    @Override
    public boolean usesBlockLight() {
        return base.usesBlockLight();
    }

    @Override
    public boolean isCustomRenderer() {
        return base.isCustomRenderer();
    }

    @Override
    @SuppressWarnings("deprecation")
    public TextureAtlasSprite getParticleIcon() {
        return base.getParticleIcon();
    }

    @Override
    public ItemOverrides getOverrides() {
        return base.getOverrides();
    }

    @Override
    @SuppressWarnings("deprecation")
    public ItemTransforms getTransforms() {
        return base.getTransforms();
    }

    @Override
    @SuppressWarnings("deprecation")
    public BakedModel handlePerspective(ItemTransforms.TransformType cameraTransformType, PoseStack poseStack) {
        return base.handlePerspective(cameraTransformType, poseStack);
    }
}


text:
require "rspec"

RSpec.describe "Google::Apis::SecuritycenterV1beta2" do
  # Minimal test just to ensure no syntax errors in generated code
  it "should load" do
    expect do
      require "google/apis/securitycenter_v1beta2"
    end.not_to raise_error
    expect do
      Google::Apis::SecuritycenterV1beta2::SecurityCommandCenterService.new
    end.not_to raise_error
  end
end


text:
import tcm

from clot import bencode, torrent

LETTER_BE = '\N{CYRILLIC CAPITAL LETTER BE}'

class CreateTestCase(tcm.TestCase):
    def test_new_torrent_has_none_in_all_fields(self):
        t = torrent.new()

        self.assertDictEqual(t.data, {})
        self.assertIsNone(t.file_path)

        self.assertIsNone(t.info)
        self.assertIsNone(t.announce)
        self.assertIsNone(t.announce_list)
        self.assertIsNone(t.creation_date)
        self.assertIsNone(t.comment)
        self.assertIsNone(t.created_by)
        self.assertIsNone(t.encoding)
        self.assertIsNone(t.publisher)
        self.assertIsNone(t.publisher_url)
        self.assertIsNone(t.nodes)
        self.assertIsNone(t.url_list)
        self.assertIsNone(t.private)
        self.assertIsNone(t.codepage)

    def test_mapping_is_parsed_into_correct_fields(self):
        raw_bytes = bencode.encode({
            'info': {},
            'announce': 'http://tracker/announce',
            'announce-list': [['http://tracker'], ['http://backup1'], ['http://backup2']],
            'creation date': 0,
            'comment': 'a trivial comment',
            'created by': 'clot/0.0.0',
            'encoding': 'UTF-8',
            'publisher': 'torrent creator',
            'publisher-url': 'http://creator.site/and/path',
            'nodes': [['host-a', 123], ['host-b', 456]],
            'url-list': ['http://mirror.com/pub', 'http://another.com/pub'],
            'private': 1,
            'codepage': 437,

            'unknown to clot': 'stays in data dict',
        })

        t = torrent.parse(raw_bytes)

        self.assertDictEqual(t.data, {'unknown to clot': b'stays in data dict'})
        self.assertIsNone(t.file_path)

        self.assertDictEqual(t.info, {})
        self.assertEqual(t.announce, 'http://tracker/announce')
        self.assertListEqual(list(list(x) for x in t.announce_list),    # pylint: disable=not-an-iterable
                             [['http://tracker'], ['http://backup1'], ['http://backup2']])
        self.assertEqual(t.creation_date.isoformat(), '1970-01-01T00:00:00+00:00')
        self.assertEqual(t.comment, 'a trivial comment')
        self.assertEqual(t.created_by, 'clot/0.0.0')
        self.assertEqual(t.encoding, 'UTF-8')
        self.assertEqual(t.publisher, 'torrent creator')
        self.assertEqual(t.publisher_url, 'http://creator.site/and/path')
        self.assertListEqual(list(t.nodes), ['host-a:123', 'host-b:456'])
        self.assertListEqual(list(t.url_list), ['http://mirror.com/pub', 'http://another.com/pub'])
        self.assertEqual(t.private, 1)
        self.assertEqual(t.codepage, 437)

    def test_fields_can_be_lazy_loaded(self):
        raw_bytes = bencode.encode({
            'comment': 'a trivial comment',
        })

        t = torrent.parse(raw_bytes, lazy=True)

        self.assertDictEqual(t.data, {'comment': b'a trivial comment'})
        self.assertFalse(hasattr(t, '_comment'))
        self.assertEqual(t.comment, 'a trivial comment')
        self.assertTrue(hasattr(t, '_comment'))

    def test_fallback_encoding_is_used(self):
        t = torrent.new()

        t.data['comment'] = LETTER_BE.encode('cp1251')

        self.assertIsNone(t.fallback_encoding)
        with self.assertRaises(ValueError) as outcome:
            t.load_fields()     # pylint: disable=no-member
        message = outcome.exception.args[0]
        self.assertEqual(message, r"comment: cannot decode b'\xc1' as UTF-8")

        t.fallback_encoding = 'cp1251'
        t.load_fields()         # pylint: disable=no-member
        self.assertEqual(t.comment, LETTER_BE)


text:
namespace Geosnap.ApiClient.Requests
{
    internal sealed class LoginRequest
    {
        public string Username { get; }
        public string Password { get; }

        public LoginRequest(string username, string password)
        {
            Username = username;
            Password = password;
        }
    }
}


text:
@interface FLActivityLogViewController : FLTextViewController {
@private
    id<FLActivityLog> _activityLog;
}

@property (readwrite, strong, nonatomic) id<FLActivityLog> activityLog;

@end


text:
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context="com.singhgurjit.babycare.babycare.Dashboard"
    tools:showIn="@layout/app_bar_dashboard">

</android.support.constraint.ConstraintLayout>


text:
/**
 * Created by magloire on 09/06/2016.
 */
(function () {

    //var footerHeight = $(".erating-footer").height();
    //
    //var mainContainerHeight=height-bannerHeight-footerHeight;
    //
    //$('.erating-midle-row').height(mainContainerHeight);

    Ext.Loader.setPath("Ext", baseUrl + "resources/vendor/touch/src");
    Ext.Loader.setPath("Xfr", baseUrl + "resources/vendor/xfr/src");
    Ext.Loader.setPath("JS", baseUrl + "bundles/jsapp/app");

    //console.log("Loading translations");

    Xfr.loadTranslations('fr');

    //console.log("creating app");

    var opt = {};
    opt.size = 64;
    opt.backgroundColor = "#898513";

    Xfr.Mask.show('Chargement...', opt, ".body");

    var height = document.documentElement.clientHeight;

    var bannerHeight = $(".loadmask-msg").height();

    var top = (height - bannerHeight) / 2;

    $(".loadmask-msg").css({
        position: "absolute",
        top: top + "px"
    });

    $.ajax({
        url: Routing.generate('get_app_config'),
        type: "GET",
        data: {},
        dataType: "json",
        success: function (response, textStatus, jqXHR) {
            //console.log(response);
            //console.log(textStatus);
            //console.log(jqXHR);
            //if (response.status==200) {
            //ERating.App.user=response.user;

            Xfr.Component.loadedTpls=response.tpls;
            console.log("Current Page Class from script", currentPageConfig);
            Ext.create("JS.App", {
                renderTo: "",
                user: response.user,
                currentPageConfig: currentPageConfig //"JS.utilisateur.Registration"
            });

            //Remove active class and current-page classes on menu items
            $("ul.nav.side-menu li.current-page").removeClass("current-page");
            $(".body").unmask();
            //} else {
            //
            //}

        },
        error: function (jqXHR, textStatus, errorThrown) {
            console.log("erreur lors du chargement des configurations de l'application", "Error ajax script.js");
            Xfr.log([textStatus,jqXHR,  errorThrown], "Error ajax script.js");
        }
    });

})();

var ERATING_MAX_PAGE_SIZE = 10;

var select2AjaxConfig = function (url, urlParam) {
    if (urlParam == undefined) {
        urlParam = {_locale: "fr"};
    }
    return {
        url: Routing.generate(url, urlParam),
        dataType: 'json',
        delay: 250,
        data: function (params) {
            params.page = params.page || 1
            return {
                q: params.term, // search term
                page: params.page,
                length: ERATING_MAX_PAGE_SIZE
            };
        },
        processResults: function (data, params) {
            params.page = params.page || 1
            return {
                results: data.data,
                pagination: {
                    more: params.page * ERATING_MAX_PAGE_SIZE < data.recordsTotal
                }
            };
        },
        cache: true
    }
};

var getDefaultSelect2Options = function () {
    return {
        // escapeMarkup: function(markup) {
        //     return markup;
        // },
        //minimumInputLength: 1,
        ajax: {
            dataType: 'json',
            delay: 250,
            data: function (params, extraParams) {
                //console.log("extraParams on data load");
                //                         console.log(params);
                //console.log(extraParams);
                // console.log(elt);
                var result = {};
                if (!Ext.isEmpty(extraParams)) {
                    Ext.merge(result, extraParams);
                }
                return Ext.merge(result, {
                    "page": params.page,
                    "search[value]": params.term,
                    "length": 10
                });
            },
            // data: function(params) {
            //     console.log("Params");
            //     console.log(params);
            //     return {
            //         "page": params.page,
            //         "search[value]": params.term,
            //         "length": CAPV_MAX_PAGE_SIZE
            //     };
            // },
            processResults: function (data, params) {
                // console.log("prossResults");
                // console.log(data);
                // console.log(params);
                params.page = params.page || 1;
                return {
                    results: data.data,
                    pagination: {
                        more: (params.page * ERATING_MAX_PAGE_SIZE) < data.recordsFiltered
                    }
                };
            },
            cache: true
        }
    }
};

var addToList=function(liste, object){
    if(liste && liste.length>0){
        var found=false;
        for(var i=0;i<liste.length;i++){
            if(liste[i].id==object.id){
                found=true;
                break;
            }
        }
        if(!found){
            liste.push(object);
        }
    }
    else{
        liste.push(object);
    }

};

var removeFromList=function(liste, object){
    if(liste && liste.length>0){

        for(var i=0;i<liste.length;i++){
            if(liste[i].id==object.id){
                liste.splice(i,1);
                break;
            }
        }
    }

};


text:
package mks.dms.model;

import java.io.Serializable;

/**
 * @author ThachLN
 */
public class UpdateCommentModel implements Serializable {
    private Integer requestId;
    private Integer commentId;

    /** Content of new comment . */
    private String value;

    /**
     * Get value of requestId.
     *
     * @return the requestId
     */
    public Integer getRequestId() {
        return requestId;
    }

    /**
     * Set the value for requestId.
     *
     * @param requestId the requestId to set
     */
    public void setRequestId(Integer requestId) {
        this.requestId = requestId;
    }

    /**
     * Get value of commentId.
     *
     * @return the commentId
     */
    public Integer getCommentId() {
        return commentId;
    }

    /**
     * Set the value for commentId.
     *
     * @param commentId the commentId to set
     */
    public void setCommentId(Integer commentId) {
        this.commentId = commentId;
    }

    /**
     * Get value of value.
     *
     * @return the value
     */
    public String getValue() {
        return value;
    }

    /**
     * Set the value for value.
     *
     * @param value the value to set
     */
    public void setValue(String value) {
        this.value = value;
    }

    /**
     * Get value of name.
     *
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * Set the value for name.
     *
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Get value of pk.
     *
     * @return the pk
     */
    public String getPk() {
        return pk;
    }

    /**
     * Set the value for pk.
     *
     * @param pk the pk to set
     */
    public void setPk(String pk) {
        this.pk = pk;
    }

    /** Reserved . */
    private String name;

    /** Reserved . */
    private String pk;
}


text:
var fastcgiConnector = require('fastcgi-client');
module.exports = phpfpm;
var urlencode = require('urlencode-for-php');

/**
 * phpfpm
 * @param  options
 *
 * default options will be  { host:127.0.0.1, port:9000 }
 */
function phpfpm(options)
{
	options = options || {};
	!options.host && (options.host = '127.0.0.1');
	!options.port && (options.port = 9000);
	!options.documentRoot && (options.documentRoot = '');

	this.options = options;
	var self = this;
	options.skipCheckServer = true;
	this.client = fastcgiConnector(options);
	this.ready = false;
	this.client.on('ready', function()
	{
		self.ready = true;
		self._clearQueue();
	});
	this.queue = [];
}

/**
 * clear the queued tasks after connected to phpfpm
 */
phpfpm.prototype._clearQueue = function()
{
	var evt;
	while(evt = this.queue.shift())
	{
		this.run(evt.info, evt.cb);
	}
};

/**
 * send command to phpfpm to run a php script
 */
phpfpm.prototype.run = function(info, cb)
{
	if (typeof info == 'string') info = { method: 'GET', uri: info };
	if (info.url && !info.uri) info.uri = info.url;

	if (!this.ready)
	{
		this.queue.push({info: info, cb:cb});
		return;
	}

	//support form data
	if (info.form && info.method != 'GET')
	{
		info.body = urlencode(info.form);
		info.method = 'POST';
	}

	if (info.form && info.method == 'GET')
	{
		info.body = '';
		var qs = urlencode(info.form);;
		info.uri += (info.uri.indexOf('?') === -1) ? '?' + qs : '&' + qs;
	}

	if (info.body && !info.method) info.method = 'POST';

	//support json data
	if (info.json)
	{
		info.body = JSON.stringify(info.json);
		info.method = 'POST';
		info.contentType = 'application/json';
	}

	!info.method && (info.method = 'GET');
	info.method = info.method.toUpperCase();
	if (info.method == 'POST')
	{
		!info.body && (info.body = '');
		if (typeof info.body === 'string') info.body = new Buffer(info.body, 'utf8');
		!info.contentType && (info.contentType = 'application/x-www-form-urlencoded');
		!info.contentLength && (info.contentLength = info.body.length);
	}

	if (info.uri.match(/\?/))
	{
		var ms = info.uri.match(/^([^\?]+)\?(.*)$/);
		info.queryString = ms[2];
		info.uri = ms[1];
	}

	var phpfile = info.uri;
	if (!phpfile.match(/^\//)) phpfile = this.options.documentRoot + phpfile;

	// Default server vars
	var fastcgiParams = info.fastcgiParams || {
		QUERY_STRING: info.queryString || '',
		REQUEST_METHOD: info.method,
		CONTENT_TYPE: info.contentType || '',
		CONTENT_LENGTH: info.contentLength || '',
		SCRIPT_FILENAME: phpfile,
		SCRIPT_NAME: phpfile.split('/').pop(),
		REQUEST_URI: info.uri,
		DOCUMENT_URI: phpfile,
		DOCUMENT_ROOT: this.options.documentRoot,
		SERVER_PROTOCOL: 'HTTP/1.1',
		GATEWAY_INTERFACE: 'CGI/1.1',
		REMOTE_ADDR: '127.0.0.1',
		REMOTE_PORT: 1234,
		SERVER_ADDR: '127.0.0.1',
		SERVER_PORT: 80,
		SERVER_NAME: '127.0.0.1',
		SERVER_SOFTWARE: 'node-phpfpm',
		REDIRECT_STATUS: 200
	};

	var self = this;

	self.client.request(fastcgiParams, function(err, request)
	{
		if (err)
		{
			cb(99, err.toString(), err.toString());
			return;
		}

		var body = '',errors = '';
		request.stdout.on('data', function(data)
		{
			body += data.toString('utf8');
		});

		request.stderr.on('data', function(data)
		{
			errors += data.toString('utf8');
		});

		request.stdout.on('end', function()
		{
			body = body.replace(/^[\s\S]*?\r\n\r\n/, '');
			cb(false, body, errors);
		});

		if (info.method == 'POST')
		{
			request.stdin._write(info.body, 'utf8');
		}
		request.stdin.end();
	});
};


text:
package org.apache.fluo.accumulo.iterators;

import java.io.IOException;

import org.apache.accumulo.core.client.IteratorSetting;
import org.apache.accumulo.core.data.Range;
import org.apache.accumulo.core.iterators.IteratorEnvironment;
import org.apache.accumulo.core.iterators.IteratorUtil.IteratorScope;
import org.junit.Assert;
import org.junit.Test;

public class PrewriteIteratorTest {

  PrewriteIterator newPI(TestData input, long snapTime, boolean readlock) {
    PrewriteIterator ni = new PrewriteIterator();

    IteratorEnvironment env = TestIteratorEnv.create(IteratorScope.scan, false);

    try {
      IteratorSetting cfg = new IteratorSetting(10, PrewriteIterator.class);
      PrewriteIterator.setSnaptime(cfg, snapTime);
      if (readlock) {
        PrewriteIterator.setReadlock(cfg);
      }
      ni.init(input.getIterator(), cfg.getOptions(), env);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    return ni;
  }

  PrewriteIterator newPI(TestData input, long snapTime) {
    PrewriteIterator ni = new PrewriteIterator();

    IteratorEnvironment env = TestIteratorEnv.create(IteratorScope.scan, false);

    try {
      IteratorSetting cfg = new IteratorSetting(10, PrewriteIterator.class);
      PrewriteIterator.setSnaptime(cfg, snapTime);
      ni.init(input.getIterator(), cfg.getOptions(), env);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    return ni;
  }

  PrewriteIterator newPI(TestData input, long snapTime, long ntfyTime) {
    PrewriteIterator ni = new PrewriteIterator();

    IteratorEnvironment env = TestIteratorEnv.create(IteratorScope.scan, false);

    try {
      IteratorSetting cfg = new IteratorSetting(10, PrewriteIterator.class);
      PrewriteIterator.setSnaptime(cfg, snapTime);
      PrewriteIterator.enableAckCheck(cfg, ntfyTime);
      ni.init(input.getIterator(), cfg.getOptions(), env);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    return ni;
  }

  public void addLots(TestData input) {
    for (int i = 3; i < 100; i += 3) {
      input.add("0 f q TX_DONE " + (i + 1), "" + i);
      input.add("0 f q WRITE " + (i + 1), "" + i);
      input.add("0 f q LOCK " + i, "0 f q");
      input.add("0 f q DATA " + i, "15");
    }
  }

  @Test
  public void testAck() {
    TestData input = new TestData();

    input.add("0 f q WRITE 116", "111");
    input.add("0 f q LOCK 111", "0 f q");
    input.add("0 f q DATA 111", "15");
    input.add("0 f q ACK 111", "");

    for (int i = 0; i < 2; i++) {
      TestData output = new TestData(newPI(input, 117, 100), Range.exact("0", "f", "q"));
      TestData expected = new TestData().add("0 f q ACK 111", "");
      Assert.assertEquals(expected, output);

      output = new TestData(newPI(input, 117, 116), Range.exact("0", "f", "q"));
      Assert.assertEquals(0, output.data.size());

      output = new TestData(newPI(input, 112, 100), Range.exact("0", "f", "q"));
      expected = new TestData().add("0 f q WRITE 116", "111");
      Assert.assertEquals(expected, output);

      addLots(input);
      input.add("0 f q TX_DONE 116", "111");
      for (int j = 3; j < 100; j += 3) {
        input.add("0 f q ACK " + j, "");
      }
    }
  }

  @Test
  public void testLockedCell() throws Exception {
    TestData input = new TestData();

    // the row is locked
    input.add("0 f q WRITE 116", "111");
    input.add("0 f q LOCK 121", "0 f q");
    input.add("0 f q LOCK 111", "0 f q");
    input.add("0 f q DATA 111", "15");

    TestData expected = new TestData().add("0 f q LOCK 121", "0 f q");

    for (long ts : new long[] {117, 122}) {
      TestData output = new TestData(newPI(input, ts), Range.exact("0", "f", "q"));
      Assert.assertEquals(expected, output);
    }

    input.add("0 f q TX_DONE 116", "111");
    for (long ts : new long[] {117, 122}) {
      TestData output = new TestData(newPI(input, ts), Range.exact("0", "f", "q"));
      Assert.assertEquals(expected, output);
    }

    addLots(input);
    for (long ts : new long[] {117, 122}) {
      TestData output = new TestData(newPI(input, ts), Range.exact("0", "f", "q"));
      Assert.assertEquals(expected, output);
    }
  }

  @Test
  public void testWriteAfterStart() throws Exception {
    TestData input = new TestData();

    // the row is locked
    input.add("0 f q WRITE 116", "111");
    input.add("0 f q LOCK 121", "0 f q");
    input.add("0 f q LOCK 111", "0 f q");
    input.add("0 f q DATA 111", "15");

    TestData expected = new TestData().add("0 f q WRITE 116", "111");

    for (long ts : new long[] {108, 112}) {
      TestData output = new TestData(newPI(input, ts), Range.exact("0", "f", "q"));
      Assert.assertEquals(expected, output);
    }

    input.add("0 f q TX_DONE 116", "111");
    for (long ts : new long[] {108, 112}) {
      TestData output = new TestData(newPI(input, ts), Range.exact("0", "f", "q"));
      Assert.assertEquals(expected, output);
    }

    addLots(input);
    for (long ts : new long[] {108, 112}) {
      TestData output = new TestData(newPI(input, ts), Range.exact("0", "f", "q"));
      Assert.assertEquals(expected, output);
    }
  }

  @Test
  public void testDelLock() {
    TestData input = new TestData();

    // the row is locked
    input.add("0 f q DEL_LOCK 111", "ABORT");
    input.add("0 f q LOCK 111", "0 f q");
    input.add("0 f q DATA 111", "15");

    for (int i = 0; i < 2; i++) {

      TestData output = new TestData(newPI(input, 117), Range.exact("0", "f", "q"));
      Assert.assertEquals(new TestData(), output);

      output = new TestData(newPI(input, 108), Range.exact("0", "f", "q"));
      TestData expected = new TestData();
      expected.add("0 f q DEL_LOCK 111", "ABORT");
      Assert.assertEquals(expected, output);

      input.add("0 f q TX_DONE 116", "111");
      output = new TestData(newPI(input, 117), Range.exact("0", "f", "q"));
      Assert.assertEquals(0, output.data.size());

      output = new TestData(newPI(input, 108), Range.exact("0", "f", "q"));
      Assert.assertEquals(expected, output);

      addLots(input);
    }
  }

  @Test
  public void testWriteAndDelLockMax() {
    // ensure the delete lock or write with max timestamp invalidates lock
    TestData input = new TestData();

    input.add("0 f q WRITE 116", "111");
    input.add("0 f q LOCK 111", "0 f q");
    input.add("0 f q DEL_LOCK 108", "ABORT");

    TestData output = new TestData(newPI(input, 117), Range.exact("0", "f", "q"));
    Assert.assertEquals(0, output.data.size());

    output = new TestData(newPI(input, 111), Range.exact("0", "f", "q"));
    TestData expected = new TestData();
    expected.add("0 f q WRITE 116", "111");
    Assert.assertEquals(expected, output);

    input = new TestData();

    input.add("0 f q DEL_LOCK 116", "ABORT");
    input.add("0 f q LOCK 111", "0 f q");
    input.add("0 f q WRITE 108", "100");

    output = new TestData(newPI(input, 117), Range.exact("0", "f", "q"));
    Assert.assertEquals(0, output.data.size());

    output = new TestData(newPI(input, 111), Range.exact("0", "f", "q"));
    expected = new TestData();
    expected.add("0 f q DEL_LOCK 116", "ABORT");
    Assert.assertEquals(expected, output);
  }

  @Test
  public void testWriteInvalidatesLock() {
    TestData input = new TestData();

    // the row is locked
    input.add("0 f q WRITE 116", "111");
    input.add("0 f q LOCK 111", "0 f q");
    input.add("0 f q DATA 111", "15");

    TestData output = new TestData(newPI(input, 117), Range.exact("0", "f", "q"));
    Assert.assertEquals(0, output.data.size());

    input.add("0 f q TX_DONE 116", "111");
    output = new TestData(newPI(input, 117), Range.exact("0", "f", "q"));
    Assert.assertEquals(0, output.data.size());

    addLots(input);
    output = new TestData(newPI(input, 117), Range.exact("0", "f", "q"));
    Assert.assertEquals(0, output.data.size());
  }

  @Test
  public void testReadLockPreventsWriteLock() {

    TestData[] initialInputs = new TestData[4];

    initialInputs[0] = new TestData();

    initialInputs[1] = new TestData();
    initialInputs[1].add("0 f q WRITE 10", "5");
    initialInputs[1].add("0 f q LOCK 5", "0 f q");
    initialInputs[1].add("0 f q DATA 5", "15");

    initialInputs[2] = new TestData();
    initialInputs[2].add("0 f q WRITE 10", "5");
    initialInputs[2].add("0 f q DATA 5", "15");

    initialInputs[3] = new TestData();
    initialInputs[3].add("0 f q DEL_LOCK 5", "ABORT");

    for (TestData input : initialInputs) {

      input.add("0 f q RLOCK 42", "0 f q");

      TestData expected = new TestData();
      expected.add("0 f q RLOCK 42", "0 f q");

      for (int ts : new int[] {40, 45}) {
        TestData output = new TestData(newPI(input, ts), Range.exact("0", "f", "q"));
        Assert.assertEquals(expected, output);
      }

      input.add("0 f q DEL_RLOCK 42", "50");

      expected = new TestData();
      expected.add("0 f q DEL_RLOCK 42", "50");

      for (int ts : new int[] {40, 45}) {
        TestData output = new TestData(newPI(input, ts), Range.exact("0", "f", "q"));
        Assert.assertEquals(expected, output);
      }

      TestData output = new TestData(newPI(input, 117), Range.exact("0", "f", "q"));
      Assert.assertEquals(0, output.data.size());

      input.add("0 f q RLOCK 30", "0 f q");

      expected = new TestData();
      expected.add("0 f q RLOCK 30", "0 f q");

      output = new TestData(newPI(input, 117), Range.exact("0", "f", "q"));
      Assert.assertEquals(expected, output);

      input.add("0 f q DEL_RLOCK 30", "60");

      output = new TestData(newPI(input, 117), Range.exact("0", "f", "q"));
      Assert.assertEquals(0, output.data.size());

      output = new TestData(newPI(input, 55), Range.exact("0", "f", "q"));
      expected = new TestData();
      expected.add("0 f q DEL_RLOCK 30", "60");
      Assert.assertEquals(expected, output);

      expected = new TestData();
      expected.add("0 f q DEL_RLOCK 42", "50");

      for (int ts : new int[] {20, 40, 45}) {
        output = new TestData(newPI(input, ts), Range.exact("0", "f", "q"));
        Assert.assertEquals(expected, output);
      }

    }
  }

  @Test
  public void testOnlyDelReadLocks() {
    // Garbage collection iter may drop read locks and leave del_read_lock entries. Ensure this case
    // works as expected.
    TestData input = new TestData();
    input.add("0 f q DEL_RLOCK 42", "50");
    input.add("0 f q DEL_RLOCK 39", "44");

    input.add("0 f q WRITE 10", "5");
    input.add("0 f q LOCK 5", "0 f q");
    input.add("0 f q DATA 5", "15");

    for (long startTs : new long[] {31, 40, 47}) {
      TestData expected = new TestData();
      expected.add("0 f q DEL_RLOCK 42", "50");

      TestData output = new TestData(newPI(input, startTs), Range.exact("0", "f", "q"));

      Assert.assertEquals(expected, output);
    }

    TestData output = new TestData(newPI(input, 55), Range.exact("0", "f", "q"));
    Assert.assertEquals(0, output.data.size());
  }

  @Test
  public void testWriteLockPreventsReadLock() {
    for (int i = 0; i < 2; i++) {
      TestData input = new TestData();

      if (i == 1) {
        // this should have no impact
        input.add("0 f q RLOCK 13", "0 f q");
      }

      input.add("0 f q LOCK 5", "0 f q");
      input.add("0 f q DATA 5", "15");

      TestData output = new TestData(newPI(input, 117, true), Range.exact("0", "f", "q"));
      TestData expected = new TestData();
      expected.add("0 f q LOCK 5", "0 f q");
      Assert.assertEquals(expected, output);

      input.add("0 f q WRITE 10", "5");
      output = new TestData(newPI(input, 117, true), Range.exact("0", "f", "q"));
      Assert.assertEquals(0, output.data.size());

      output = new TestData(newPI(input, 11, true), Range.exact("0", "f", "q"));
      Assert.assertEquals(0, output.data.size());

      output = new TestData(newPI(input, 7, true), Range.exact("0", "f", "q"));
      expected = new TestData();
      expected.add("0 f q WRITE 10", "5");
      Assert.assertEquals(expected, output);

      output = new TestData(newPI(input, 4, true), Range.exact("0", "f", "q"));
      Assert.assertEquals(expected, output);
    }
  }

  @Test
  public void testManyReadLocks() {
    TestData input = new TestData();

    input.add("0 f q WRITE 10", "5");
    input.add("0 f q DATA 5", "15");

    for (int i = 10; i < 2010; i += 2) {
      input.add("0 f q DEL_RLOCK " + i, "" + (i + 1));
      input.add("0 f q RLOCK " + i, "0 f q");
    }

    TestData output = new TestData(newPI(input, 3000, false), Range.exact("0", "f", "q"));
    // scans all read locks looking for an active lock
    Assert.assertEquals(2001, input.counter.nextCalls);
    Assert.assertEquals(0, output.data.size());

    // read locks do not need to scan for other read locks... this checks that read locks are
    // skipped
    input.counter.reset();
    output = new TestData(newPI(input, 3000, true), Range.exact("0", "f", "q"));
    // read locks should not scan everything looking for a read lock
    Assert.assertEquals(12, input.counter.nextCalls); // skipping will read 11 before seeking
    Assert.assertEquals(0, output.data.size());

    // This write invalidates the 2000 read locks, so should skip read locks
    input.add("0 f q WRITE 2500", "2490");
    input.add("0 f q DATA 2490", "16");
    input.counter.reset();
    output = new TestData(newPI(input, 3000, false), Range.exact("0", "f", "q"));
    Assert.assertEquals(13, input.counter.nextCalls);
    Assert.assertEquals(0, output.data.size());
  }

  @Test
  public void testGarbageCollectedReadLocks() {
    // After a partial compaction the garbage collection iterator will drop read lock entries, but
    // not del_read_locks entries. This test ensures that prewrite works w/ this.

    TestData input = new TestData();

    input.add("0 f q DEL_RLOCK 42", "50");
    input.add("0 f q DEL_RLOCK 44", "51");

    TestData output = new TestData(newPI(input, 47), Range.exact("0", "f", "q"));
    TestData expected = new TestData();

    expected.add("0 f q DEL_RLOCK 44", "51");

    Assert.assertEquals(expected, output);

    output = new TestData(newPI(input, 43), Range.exact("0", "f", "q"));
    Assert.assertEquals(expected, output);
  }

  @Test
  public void testAbortedReadLock() {
    // A read lock that was aborted or rolledback should not prevent a write lock
    TestData input = new TestData();

    input.add("0 f q DEL_RLOCK 55", "ABORT");
    input.add("0 f q DEL_RLOCK 42", "50");

    for (int i = 0; i < 2; i++) {
      for (long startTs : new long[] {31, 40, 47}) {
        TestData expected = new TestData();
        expected.add("0 f q DEL_RLOCK 42", "50");

        TestData output = new TestData(newPI(input, startTs), Range.exact("0", "f", "q"));

        Assert.assertEquals(expected, output);
      }

      for (long startTs : new long[] {51, 55, 56}) {
        TestData output = new TestData(newPI(input, startTs), Range.exact("0", "f", "q"));
        Assert.assertEquals(0, output.data.size());
      }
      // add this for 2nd iteration, should ignore because delete rolls back
      input.add("0 f q RLOCK 55", "0 f q");
    }
  }
}


text:
title: Telerik.Web.UI.GridClientDataService
page_title: Telerik.Web.UI.GridClientDataService
description: Telerik.Web.UI.GridClientDataService
---

# Telerik.Web.UI.GridClientDataService

Class holding settings for setuping the Telerik.Web.UI.RadGrid control binding to a data service.

## Inheritance Hierarchy

* System.Object
* Telerik.Web.UI.ObjectWithState
* Telerik.Web.UI.GridClientDataService

## Properties

###  FilterQueryOption `String`

Gets or set a filter string for the specified ADO.NET DataService. Default is empty string!

###  SortQueryOption `String`

Gets or set a filter string for the specified ADO.NET DataService. Default is empty string!

###  TableName `String`

Gets or set table name for the specified ADO.NET DataService. Default is empty string!

###  Type `GridClientDataServiceType`

Gets or sets the client data service type RadGrid binds to.
            Default is GridClientDataServiceType.ADONet.