text:
package org.globus.gsi;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.globus.gsi.util.CertificateUtil;

import org.globus.gsi.trustmanager.X509ProxyCertPathValidator;

import org.globus.gsi.stores.ResourceCertStoreParameters;
import org.globus.gsi.stores.ResourceSigningPolicyStore;
import org.globus.gsi.stores.ResourceSigningPolicyStoreParameters;

import org.globus.gsi.provider.GlobusProvider;
import org.globus.gsi.provider.KeyStoreParametersFactory;

import java.io.File;
import java.security.cert.CertStore;
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.cert.X509Certificate;
import java.security.cert.CertificateEncodingException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Serializable;
import org.globus.common.ChainedIOException;
import org.globus.common.CoGProperties;
import org.globus.gsi.bc.BouncyCastleUtil;

/**
 * Provides a Java object representation of Globus credential which can include the proxy file or host
 * certificates.
 * @deprecated
 */
public class GlobusCredential implements Serializable {

	private Log logger = LogFactory.getLog(getClass());
    private X509Credential cred;
    private static GlobusCredential defaultCred;
    private static transient long credentialLastModified = -1;
    // indicates if default credential was explicitely set
    // and if so - if the credential expired it try
    // to load the proxy from a file.
    private static transient boolean credentialSet = false;
    private static transient File credentialFile = null;

    static {
        new ProviderLoader();
    }

    /**
     * Creates a GlobusCredential from a private key and a certificate chain.
     *
     * @param key
     *            the private key
     * @param certs
     *            the certificate chain
     */
    public GlobusCredential(PrivateKey key, X509Certificate[] certs) {
        cred = new X509Credential(key, certs);
    }

    /**
     * Creates a GlobusCredential from a proxy file.
     *
     * @param proxyFile
     *            the file to load the credential from.
     * @exception GlobusCredentialException
     *                if the credential failed to load.
     */
    public GlobusCredential(String proxyFile) throws GlobusCredentialException {
        try {
            cred = new X509Credential(proxyFile);
        } catch (Exception e) {
            throw new GlobusCredentialException(GlobusCredentialException.FAILURE, e.getMessage(), e);
        }
    }

    /**
     * Creates a GlobusCredential from certificate file and a unencrypted key file.
     *
     * @param certFile
     *            the file containing the certificate
     * @param unencryptedKeyFile
     *            the file containing the private key. The key must be unencrypted.
     * @exception GlobusCredentialException
     *                if something goes wrong.
     */
    public GlobusCredential(String certFile, String unencryptedKeyFile) throws GlobusCredentialException {

        if (certFile == null || unencryptedKeyFile == null) {
            throw new IllegalArgumentException();
        }

        try {
            cred = new X509Credential(certFile, unencryptedKeyFile);
        } catch (Exception e) {
            throw new GlobusCredentialException(GlobusCredentialException.FAILURE, e.getMessage(), e);
        }
    }

    /**
     * Creates a GlobusCredential from an input stream.
     *
     * @param input
     *            the stream to load the credential from.
     * @exception GlobusCredentialException
     *                if the credential failed to load.
     */
    public GlobusCredential(InputStream input) throws GlobusCredentialException {

        try {
            cred = new X509Credential(input);
        } catch (Exception e) {
            throw new GlobusCredentialException(GlobusCredentialException.FAILURE, e.getMessage(), e);
        }
    }

    /**
     * Saves the credential into a specified output stream. The self-signed certificates in the certificate
     * chain will not be saved. The output stream should always be closed after calling this function.
     *
     * @param out
     *            the output stream to write the credential to.
     * @exception IOException
     *                if any error occurred during saving.
     */
    public void save(OutputStream out) throws IOException {

        try {
            cred.save(out);
        } catch (CertificateEncodingException e) {
            throw new ChainedIOException(e.getMessage(), e);
        }
    }

    /**
     * Verifies the validity of the credentials. All certificate path validation is performed using trusted
     * certificates in default locations.
     *
     * @exception GlobusCredentialException
     *                if one of the certificates in the chain expired or if path validiation fails.
     */
    public void verify() throws GlobusCredentialException {
        try {
            String caCertsLocation = "file:" + CoGProperties.getDefault().getCaCertLocations();
            String crlPattern = caCertsLocation + "/*.r*";
            String sigPolPattern = caCertsLocation + "/*.signing_policy";
            KeyStore keyStore = KeyStore.getInstance(GlobusProvider.KEYSTORE_TYPE, GlobusProvider.PROVIDER_NAME);
            CertStore crlStore = CertStore.getInstance(GlobusProvider.CERTSTORE_TYPE, new ResourceCertStoreParameters(null,crlPattern));
            ResourceSigningPolicyStore sigPolStore = new ResourceSigningPolicyStore(new ResourceSigningPolicyStoreParameters(sigPolPattern));
            keyStore.load(KeyStoreParametersFactory.createTrustStoreParameters(caCertsLocation));
            X509ProxyCertPathParameters parameters = new X509ProxyCertPathParameters(keyStore, crlStore, sigPolStore, false);
            X509ProxyCertPathValidator validator = new X509ProxyCertPathValidator();
            validator.engineValidate(CertificateUtil.getCertPath(this.cred.getCertificateChain()), parameters);
        } catch (Exception e) {
        	e.printStackTrace();
            throw new GlobusCredentialException(GlobusCredentialException.FAILURE, e.getMessage(), e);
        }
    }

    /**
     * Returns the identity certificate of this credential. The identity certificate is the first certificate
     * in the chain that is not an impersonation proxy certificate.
     *
     * @return X509Certificate the identity cert. Null, if unable to get the identity certificate
     *         (an error occurred)
     */
    public X509Certificate getIdentityCertificate() {
        return cred.getIdentityCertificate();
    }

    /**
     * Returns the path length constraint. The shortest length in the chain of certificates is returned as the
     * credential's path length.
     *
     * @return The path length constraint of the credential. -1 is any error occurs.
     */
    public int getPathConstraint() {
        return cred.getPathConstraint();
    }

    /**
     * Returns the identity of this credential.
     *
     * @see #getIdentityCertificate()
     *
     * @return The identity cert in Globus format (e.g. /C=US/..). Null, if unable to get the identity (an
     *         error occurred)
     */
    public String getIdentity() {
        return cred.getIdentity();
    }

    /**
     * Returns the private key of this credential.
     *
     * @return PrivateKey the private key
     */
    public PrivateKey getPrivateKey() {
        try {
            return (PrivateKey) cred.getPrivateKey();
        } catch (Exception e) {
            return null;
        }
    }

    /**
     * Returns the certificate chain of this credential.
     *
     * @return X509Certificate [] the certificate chain
     */
    public X509Certificate[] getCertificateChain() {
        return cred.getCertificateChain();
    }

    /**
     * Returns the number of certificates in the credential without the self-signed certificates.
     *
     * @return number of certificates without counting self-signed certificates
     */
    public int getCertNum() {
        return cred.getCertNum();
    }

    /**
     * Returns strength of the private/public key in bits.
     *
     * @return strength of the key in bits. Returns -1 if unable to determine it.
     */
    public int getStrength() {
        try {
            return cred.getStrength();
        } catch (Exception e) {
            return -1;
        }
    }

    /**
     * Returns the subject DN of the first certificate in the chain.
     *
     * @return subject DN.
     */
    public String getSubject() {
        return cred.getSubject();
    }

    /**
     * Returns the issuer DN of the first certificate in the chain.
     *
     * @return issuer DN.
     */
    public String getIssuer() {
        return cred.getIssuer();
    }

    /**
     * Returns the certificate type of the first certificate in the chain. Returns -1 if unable to determine
     * the certificate type (an error occurred)
     *
     * @see BouncyCastleUtil#getCertificateType(X509Certificate)
     *
     * @return the type of first certificate in the chain. -1 if unable to determine the certificate type.
     */
    public int getProxyType() {
        return cred.getProxyType().getCode();
    }

    /**
     * Returns time left of this credential. The time left of the credential is based on the certificate with
     * the shortest validity time.
     *
     * @return time left in seconds. Returns 0 if the certificate has expired.
     */
    public long getTimeLeft() {
        return cred.getTimeLeft();
    }

    /**
     * Returns the default credential. The default credential is usually the user proxy certificate.

     * The credential will be loaded on the initial call. It must not be expired. All subsequent calls to this
     * function return cached credential object. Once the credential is cached, and the underlying file
     * changes, the credential will be reloaded.
     *
     * @return the default credential.
     * @exception GlobusCredentialException
     *                if the credential expired or some other error with the credential.
     */
    public synchronized static GlobusCredential getDefaultCredential() throws GlobusCredentialException {
        if (defaultCred == null) {
            reloadDefaultCredential();
        } else if (!credentialSet) {
            if (credentialFile.lastModified() == credentialLastModified) {
                defaultCred.verify();
            } else {
                defaultCred = null;
                reloadDefaultCredential();
            }
        }
        return defaultCred;
    }

    private static void reloadDefaultCredential()
        throws GlobusCredentialException {
        String proxyLocation = CoGProperties.getDefault().getProxyFile();
        defaultCred = new GlobusCredential(proxyLocation);
        credentialFile = new File(proxyLocation);
        credentialLastModified = credentialFile.lastModified();
        defaultCred.verify();
    }

    /**
     * Sets default credential.
     *
     * @param cred
     *            the credential to set a default.
     */
    public synchronized static void setDefaultCredential(GlobusCredential cred) {
        credentialSet = (cred != null);
    }

    public String toString() {
        return cred.toString();
    }

}


text:
<?php

/**
 * Login form.
 *
 * Used in both admin and front end
 *
 * @package    App
 * @subpackage Form
 * @author     spekkionu
 * @license    New BSD http://www.opensource.org/licenses/bsd-license.php
 */
class Form_Login extends App_Form
{

    public function loadDefaultDecorators()
    {
        $this->setDecorators(array(
          'FormElements',
          array('Description', array('tag' => 'p', 'class' => 'form-help')),
          array('Fieldset', array('legend' => 'Login')),
          array('Form', array('id' => 'form-login', 'class' => 'validate form-horizontal', 'accept-charset' => 'utf-8'))
        ));
    }

    public function init()
    {
        parent::init();

        $element = new Zend_Form_Element_Text('username');
        $element->setLabel('Username:');
        $element->setDescription("Enter your username.");
        $element->setRequired(true);
        $element->addValidator('NotEmpty', true, array('messages' => array(
            Zend_Validate_NotEmpty::INVALID => "Invalid type given. String, integer or float expected",
            Zend_Validate_NotEmpty::IS_EMPTY => "Username is required."
          )));
        $element->setFilters(array('StringTrim', 'StripTags'));
        $element->setDecorators($this->field);
        $element->setAttribs(array(
          'maxlength' => 20,
          'autofocus' => 'autofocus',
          'data' => Zend_Json::encode(array('validate' => array(
              'required' => true,
              'alphanumeric' => true,
              'messages' => array(
                'required' => 'Username is required.',
                'alphanumeric' => 'May only contain letters and numbers.'
              )
            )))
        ));
        $this->addElement($element);

        $element = new Zend_Form_Element_Password('password');
        $element->setLabel('Password:');
        $element->setDescription("Enter your password.");
        $element->setRequired(true);
        $element->addValidator('NotEmpty', true, array('messages' => array(
            Zend_Validate_NotEmpty::INVALID => "Invalid type given. String, integer or float expected",
            Zend_Validate_NotEmpty::IS_EMPTY => "Password is required."
          )));
        $element->setFilters(array('StringTrim'));
        $element->setDecorators($this->field);
        $element->setAttribs(array(
          'maxlength' => 20,
          'data' => Zend_Json::encode(array('validate' => array(
              'required' => true,
              //'nowhitespace' => true,
              'messages' => array(
                'required' => 'Password is required.',
              // 'nowhitespace' => 'Cannot contain spaces.'
              )
            )))
        ));
        $this->addElement($element);

        $element = new Zend_Form_Element_Submit('login');
        $element->setLabel('Login');
        $element->setDecorators($this->buttonOpen);
        $element->setIgnore(true);
        $element->setAttrib('class', 'btn btn-primary');
        $this->addElement($element);

        $element = new App_Form_Element_LinkButton('forgot_password');
        $element->setLabel('Forgot Password?');
        $element->setDecorators($this->buttonClose);
        $element->setAttrib('class', 'btn cancel');
        $element->setIgnore(true);
        $this->addElement($element);

        $this->addElement('hash', 'csrf', array('ignore' => true, 'decorators' => $this->hidden));
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.sshd.common.future;

/**
 * An {@link SshFuture} for asynchronous close requests.
 *
 * @author Apache MINA SSHD Project
 */
public interface CloseFuture extends SshFuture<CloseFuture> {

    /**
     * @return <tt>true</tt> if the close request is finished and the target is closed.
     */
    boolean isClosed();

    /**
     * Marks this future as closed and notifies all threads waiting for this future. This method is invoked by SSHD
     * internally. Please do not call this method directly.
     */
    void setClosed();

}


text:
<?php

/**
 */
require_once 'Opus11/AbstractComparable.php';
require_once 'Opus11/Box.php';
require_once 'Opus11/Exceptions.php';

//{
/**
 * Represents a (key, value) pair.
 *
 * @package Opus11
 */
class Association
    extends AbstractComparable
{
    /**
     * @var object IComparable The key.
     */
    protected $key = NULL;
    /**
     * @var object IComparable The value.
     */
    protected $value = NULL;

//}@head

//{
//!    // ...
//!}
//}@tail

//{
    /**
     * Constructs an Associationwith the specified key and value.
     *
     * @param object IComparable $key The desired key.
     * @param mixed value The desired value.
     */
    public function __construct(IComparable $key, $value = NULL)
    {
        parent::__construct();
        $this->key = $key;
        $this->value = $value;
    }

    /**
     * Destructor.
     */
    public function __destruct()
    {
        $this->key = NULL;
        $this->value = NULL;
        parent::__destruct();
    }

    /**
     * Key getter.
     *
     * @return object IComparable The key of this association.
     */
    public function getKey()
    {
        return $this->key;
    }

    /**
     * Value getter.
     *
     * @return mixed The value of this association.
     */
    public function getValue()
    {
        return $this->value;
    }

    /**
     * Value setter.
     *
     * @param object IComparable $value A value.
     */
    public function setValue(IComparable $value)
    {
        $this->value = $value;
    }

    /**
     * Value unsetter.
     */
    public function unsetValue()
    {
        $this->value = NULL;
    }
//}>b

//{
    /**
     * Compares this association with the specified comparable object.
     * The specified comparable object is assumed to be an Association instance.
     * The two associations are compared by comparing just their keys.
     *
     * @param object IComparable $obj
     * The object with which this object is compared.
     * @return integer A number less than zero if the key of this association
     * is less than the key of the specified one;
     * a number greater than zero if the key of this association
     * is greater than the key of the specified one;
     * zero if the keys of both associations are equal.
     */
    protected function compareTo(IComparable $obj)
    {
        return $this->key->compare($obj->getKey());
    }

    /**
     * Returns a textual representation of this association.
     *
     * @return string A string.
     */
    public function __toString()
    {
        $result = 'Association{' . str($this->key);
        if ($this->value !== NULL)
            $result .= ', ' . str($this->value);
        return $result . '}';
    }
//}>c

//{
    /**
     * Returns a hashcode for this association.
     * The hashcode of an this association
     * is just the hashcode of the key.
     *
     * @return integer A hashcode for this association.
     */
    public function getHashCode()
    {
        return $this->key->getHashCode();
    }
//}>d

    /**
     * Main program.
     *
     * @param array $args Command-line arguments.
     * @return integer Zero on success; non-zero on failure.
     */
    public static function main($args)
    {
        printf("Association main program.\n");
        $status = 0;
        $a1 = new Association(box(1), NULL);
        printf("%s\n", str($a1));
        $a2 = new Association(box(2), box(4));
        printf("%s\n", str($a2));
        return $status;
    }
}

if (realpath($argv[0]) == realpath(__FILE__))
{
    exit(Association::main(array_slice($argv, 1)));
}
?>


text:
module Server.ProgramOptions where

import Server.Types

import System.Environment (lookupEnv)

import Options.Applicative

data ProgramOptions = ProgramOptions
  { ffmpegPath :: String
  , dataDirectory :: String
  , indexFileName :: String
  , twitchClientID :: String
  , streamInfoTimeout :: Int
  , proxyTimeout :: Int
  , tsSegmentLength :: Int
  , tsSegmentCount :: Int
  , webPort :: Int
  } deriving (Show)

parseOptions :: IO ProgramOptions
parseOptions = do
  defaults <- getDefaultOptions

  execParser $
    info (helper <*> (programOptionsParser defaults))
    (  fullDesc
    <> progDesc "Backend application for twitch-cast (https://datcoloc.com/twitch-cast)"
    <> header   "twitch-cast streamer"
    )

  where
    getDefaultOptions :: IO ProgramOptions
    getDefaultOptions = ProgramOptions
      <$> env id     "FFMPEG_PATH"         ""
      <*> env id     "DATA_DIRECTORY"      "/tmp/video"
      <*> env id     "INDEX_FILE_NAME"     "index.m3u8"
      <*> env id     "TWITCH_CLIENT_ID"    ""
      <*> env read   "STREAM_INFO_TIMEOUT" 30
      <*> env read   "PROXY_TIMEOUT"       60
      <*> env read   "TS_SEGMENT_LENGTH"   4
      <*> env read   "TS_SEGMENT_COUNT"    4
      <*> return                           8000

    env :: (String -> a) -> String -> a -> IO a
    env transform key defaultValue = do
      envValue <- lookupEnv key
      return $ maybe defaultValue transform envValue

programOptionsParser :: ProgramOptions -> Parser ProgramOptions
programOptionsParser defaults = ProgramOptions
  <$> strOption
      (  long "ffmpeg-path" <> short 'f'
      <> value (ffmpegPath defaults)
      <> metavar "PATH"
      <> help "Path to the ffmpeg binary"
      )
  <*> strOption
      (  long "data-dir" <> short 'd'
      <> value (dataDirectory defaults)
      <> metavar "DIR"
      <> help "Root directory to dump video data in"
      )
  <*> strOption
      (  long "index-file-name" <> short 'i'
      <> value (indexFileName defaults)
      <> metavar "NAME"
      <> help "Name of the playlist files"
      )
  <*> strOption
      (  long "twitch-client-id" <> short 't'
      <> value (twitchClientID defaults)
      <> metavar "ID"
      <> help "The ID of your registered twitch application"
      )
  <*> option auto
      (  long "stream-info-timeout" <> short 's'
      <> value (streamInfoTimeout defaults)
      <> metavar "SECONDS"
      <> help "The minimum lifetime in seconds of stream information in the cache"
      )
  <*> option auto
      (  long "proxy-timeout" <> short 'p'
      <> value (proxyTimeout defaults)
      <> metavar "SECONDS"
      <> help "The maximum lifetime of an unused video proxy"
      )
  <*> option auto
      (  long "ts-length"
      <> value (tsSegmentLength defaults)
      <> metavar "SECONDS"
      <> help "The length in seconds of proxied video data segments"
      )
  <*> option auto
      (  long "ts-count"
      <> value (tsSegmentCount defaults)
      <> metavar "NUM"
      <> help "The number of proxied video data segments referenced in the playlist"
      )
  <*> option auto
      (  long "web-port"
      <> value (webPort defaults)
      <> metavar "PORT"
      <> help "The port used by the web server to listen on"
      )


text:
<?php

namespace Doctrine\Tests\ORM\Query;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Expr\Comparison as CriteriaComparison;
use Doctrine\Common\Collections\Expr\Value;
use Doctrine\Common\Collections\ExpressionBuilder as CriteriaBuilder;
use Doctrine\ORM\Query\Expr as QueryBuilder;
use Doctrine\ORM\Query\Parameter;
use Doctrine\ORM\Query\QueryExpressionVisitor;
use PHPUnit\Framework\TestCase;

/**
 * Test for QueryExpressionVisitor
 *
 * @author Kirill chEbba Chebunin <iam@chebba.org>
 */
class QueryExpressionVisitorTest extends TestCase
{
    /**
     * @var QueryExpressionVisitor
     */
    private $visitor;

    /**
     * {@inheritDoc}
     */
    protected function setUp()
    {
        $this->visitor = new QueryExpressionVisitor(['o','p']);
    }

    /**
     * @param CriteriaComparison     $criteriaExpr
     * @param QueryBuilder\Comparison|string $queryExpr
     * @param Parameter              $parameter
     *
     * @dataProvider comparisonData
     */
    public function testWalkComparison(CriteriaComparison $criteriaExpr, $queryExpr, Parameter $parameter = null)
    {
        $this->assertEquals($queryExpr, $this->visitor->walkComparison($criteriaExpr));
        if ($parameter) {
            $this->assertEquals(new ArrayCollection([$parameter]), $this->visitor->getParameters());
        }
    }

    public function comparisonData()
    {
        $cb = new CriteriaBuilder();
        $qb = new QueryBuilder();

        return [
            [$cb->eq('field', 'value'), $qb->eq('o.field', ':field'), new Parameter('field', 'value')],
            [$cb->neq('field', 'value'), $qb->neq('o.field', ':field'), new Parameter('field', 'value')],
            [$cb->eq('field', null), $qb->isNull('o.field')],
            [$cb->neq('field', null), $qb->isNotNull('o.field')],
            [$cb->isNull('field'), $qb->isNull('o.field')],

            [$cb->gt('field', 'value'), $qb->gt('o.field', ':field'), new Parameter('field', 'value')],
            [$cb->gte('field', 'value'), $qb->gte('o.field', ':field'), new Parameter('field', 'value')],
            [$cb->lt('field', 'value'), $qb->lt('o.field', ':field'), new Parameter('field', 'value')],
            [$cb->lte('field', 'value'), $qb->lte('o.field', ':field'), new Parameter('field', 'value')],

            [$cb->in('field', ['value']), $qb->in('o.field', ':field'), new Parameter('field', ['value'])],
            [$cb->notIn('field', ['value']), $qb->notIn('o.field', ':field'), new Parameter('field', ['value'])],

            [$cb->contains('field', 'value'), $qb->like('o.field', ':field'), new Parameter('field', '%value%')],

            [$cb->startsWith('field', 'value'), $qb->like('o.field', ':field'), new Parameter('field', 'value%')],
            [$cb->endsWith('field', 'value'), $qb->like('o.field', ':field'), new Parameter('field', '%value')],

            // Test parameter conversion
            [$cb->eq('object.field', 'value'), $qb->eq('o.object.field', ':object_field'), new Parameter('object_field', 'value')],

            // Test alternative rootAlias
            [$cb->eq('p.field', 'value'), $qb->eq('p.field', ':p_field'), new Parameter('p_field', 'value')],
            [$cb->eq('p.object.field', 'value'), $qb->eq('p.object.field', ':p_object_field'), new Parameter('p_object_field', 'value')],
        ];
    }

    public function testWalkAndCompositeExpression()
    {
        $cb = new CriteriaBuilder();
        $expr = $this->visitor->walkCompositeExpression(
            $cb->andX(
                $cb->eq("foo", 1),
                $cb->eq("bar", 1)
            )
        );

        $this->assertInstanceOf(QueryBuilder\Andx::class, $expr);
        $this->assertCount(2, $expr->getParts());
    }

    public function testWalkOrCompositeExpression()
    {
        $cb = new CriteriaBuilder();
        $expr = $this->visitor->walkCompositeExpression(
            $cb->orX(
                $cb->eq("foo", 1),
                $cb->eq("bar", 1)
            )
        );

        $this->assertInstanceOf(QueryBuilder\Orx::class, $expr);
        $this->assertCount(2, $expr->getParts());
    }

    public function testWalkValue()
    {
        $this->assertEquals('value', $this->visitor->walkValue(new Value('value')));
    }

    public function testClearParameters()
    {
        $this->visitor->getParameters()->add(new Parameter('field', 'value'));

        $this->visitor->clearParameters();

        $this->assertCount(0, $this->visitor->getParameters());
    }
}


text:
package com.intel.icecp.node.security.crypto.key.asymmetric.raw;

import com.intel.icecp.node.security.crypto.key.raw.RawBytesKey;

/**
 * Public Key as bytes
 *
 */
public class RawBytesPublicKey extends RawBytesKey {

    public RawBytesPublicKey(byte[] publicKey) {
        super(publicKey);
    }

}


text:
<?php
/**
 * BuddyPress - Groups Requests Loop
 *
 * @package BuddyPress
 * @subpackage bp-legacy
 */

?>

<?php if ( bp_group_has_membership_requests( bp_ajax_querystring( 'membership_requests' ) ) ) : ?>

			<?php bp_group_requests_pagination_count(); ?>

			<?php bp_group_requests_pagination_links(); ?>

		<?php while ( bp_group_membership_requests() ) : bp_group_the_membership_request(); ?>

<?php bp_group_request_user_avatar_thumb(); ?>

<?php bp_group_request_user_link(); ?>

					<?php bp_group_request_time_since_requested(); ?>

<?php bp_group_request_comment(); ?>

					<?php

					/**
					 * Fires inside the groups membership request list loop.
					 *
					 * @since 1.1.0
					 */
					do_action( 'bp_group_membership_requests_admin_item' ); ?>

					<?php bp_button( array( 'id' => 'group_membership_accept', 'component' => 'groups', 'wrapper_class' => 'accept', 'link_href' => bp_get_group_request_accept_link(), 'link_text' => __( 'Accept', 'buddypress' ) ) ); ?>

					<?php bp_button( array( 'id' => 'group_membership_reject', 'component' => 'groups', 'wrapper_class' => 'reject', 'link_href' => bp_get_group_request_reject_link(), 'link_text' => __( 'Reject', 'buddypress' ) ) ); ?>

					<?php

					/**
					 * Fires inside the list of membership request actions.
					 *
					 * @since 1.1.0
					 */
					do_action( 'bp_group_membership_requests_admin_item_action' ); ?>

		<?php endwhile; ?>

			<?php bp_group_requests_pagination_count(); ?>

			<?php bp_group_requests_pagination_links(); ?>

	<?php else: ?>

<?php _e( 'There are no pending membership requests.', 'buddypress' ); ?>

	<?php endif; ?>


text:
@interface UIApplication (LJC)

+(CGSize) currentSize;

@end


text:
@echo off
pushd %~dp0
"%VS120COMNTOOLS%..\IDE\mstest" /test:Microsoft.Protocols.TestSuites.MS_FSSHTTP_FSSHTTPB.MS_FSSHTTP_FSSHTTPB_S04_ExclusiveLock.TestCase_S04_TC02_GetExclusiveLock_InvalidArgument /testcontainer:..\..\MS-FSSHTTP-FSSHTTPB\TestSuite\bin\Debug\MS-FSSHTTP-FSSHTTPB_TestSuite.dll /runconfig:..\..\MS-FSSHTTP-FSSHTTPB\MS-FSSHTTP-FSSHTTPB.testsettings /unique
pause


text:
/**
 * Servlet filters.
 */
package org.dictionary.web.filter;


text:
namespace google {
namespace cloud {
namespace notebooks_internal {
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN

NotebookServiceMetadata::NotebookServiceMetadata(
    std::shared_ptr<NotebookServiceStub> child)
    : child_(std::move(child)),
      api_client_header_(
          google::cloud::internal::ApiClientHeader("generator")) {}

StatusOr<google::cloud::notebooks::v1::ListInstancesResponse>
NotebookServiceMetadata::ListInstances(
    grpc::ClientContext& context,
    google::cloud::notebooks::v1::ListInstancesRequest const& request) {
  SetMetadata(context, "parent=" + request.parent());
  return child_->ListInstances(context, request);
}

StatusOr<google::cloud::notebooks::v1::Instance>
NotebookServiceMetadata::GetInstance(
    grpc::ClientContext& context,
    google::cloud::notebooks::v1::GetInstanceRequest const& request) {
  SetMetadata(context, "name=" + request.name());
  return child_->GetInstance(context, request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncCreateInstance(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::CreateInstanceRequest const& request) {
  SetMetadata(*context, "parent=" + request.parent());
  return child_->AsyncCreateInstance(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncRegisterInstance(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::RegisterInstanceRequest const& request) {
  SetMetadata(*context, "parent=" + request.parent());
  return child_->AsyncRegisterInstance(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncSetInstanceAccelerator(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::SetInstanceAcceleratorRequest const&
        request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncSetInstanceAccelerator(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncSetInstanceMachineType(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::SetInstanceMachineTypeRequest const&
        request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncSetInstanceMachineType(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncUpdateInstanceConfig(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::UpdateInstanceConfigRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncUpdateInstanceConfig(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncUpdateShieldedInstanceConfig(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::UpdateShieldedInstanceConfigRequest const&
        request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncUpdateShieldedInstanceConfig(cq, std::move(context),
                                                   request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncSetInstanceLabels(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::SetInstanceLabelsRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncSetInstanceLabels(cq, std::move(context), request);
}

StatusOr<google::cloud::notebooks::v1::UpdateInstanceMetadataItemsResponse>
NotebookServiceMetadata::UpdateInstanceMetadataItems(
    grpc::ClientContext& context,
    google::cloud::notebooks::v1::UpdateInstanceMetadataItemsRequest const&
        request) {
  SetMetadata(context, "name=" + request.name());
  return child_->UpdateInstanceMetadataItems(context, request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncDeleteInstance(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::DeleteInstanceRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncDeleteInstance(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncStartInstance(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::StartInstanceRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncStartInstance(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncStopInstance(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::StopInstanceRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncStopInstance(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncResetInstance(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::ResetInstanceRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncResetInstance(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncReportInstanceInfo(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::ReportInstanceInfoRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncReportInstanceInfo(cq, std::move(context), request);
}

StatusOr<google::cloud::notebooks::v1::IsInstanceUpgradeableResponse>
NotebookServiceMetadata::IsInstanceUpgradeable(
    grpc::ClientContext& context,
    google::cloud::notebooks::v1::IsInstanceUpgradeableRequest const& request) {
  SetMetadata(context, "notebook_instance=" + request.notebook_instance());
  return child_->IsInstanceUpgradeable(context, request);
}

StatusOr<google::cloud::notebooks::v1::GetInstanceHealthResponse>
NotebookServiceMetadata::GetInstanceHealth(
    grpc::ClientContext& context,
    google::cloud::notebooks::v1::GetInstanceHealthRequest const& request) {
  SetMetadata(context, "name=" + request.name());
  return child_->GetInstanceHealth(context, request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncUpgradeInstance(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::UpgradeInstanceRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncUpgradeInstance(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncRollbackInstance(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::RollbackInstanceRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncRollbackInstance(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncUpgradeInstanceInternal(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::UpgradeInstanceInternalRequest const&
        request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncUpgradeInstanceInternal(cq, std::move(context), request);
}

StatusOr<google::cloud::notebooks::v1::ListEnvironmentsResponse>
NotebookServiceMetadata::ListEnvironments(
    grpc::ClientContext& context,
    google::cloud::notebooks::v1::ListEnvironmentsRequest const& request) {
  SetMetadata(context, "parent=" + request.parent());
  return child_->ListEnvironments(context, request);
}

StatusOr<google::cloud::notebooks::v1::Environment>
NotebookServiceMetadata::GetEnvironment(
    grpc::ClientContext& context,
    google::cloud::notebooks::v1::GetEnvironmentRequest const& request) {
  SetMetadata(context, "name=" + request.name());
  return child_->GetEnvironment(context, request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncCreateEnvironment(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::CreateEnvironmentRequest const& request) {
  SetMetadata(*context, "parent=" + request.parent());
  return child_->AsyncCreateEnvironment(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncDeleteEnvironment(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::DeleteEnvironmentRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncDeleteEnvironment(cq, std::move(context), request);
}

StatusOr<google::cloud::notebooks::v1::ListSchedulesResponse>
NotebookServiceMetadata::ListSchedules(
    grpc::ClientContext& context,
    google::cloud::notebooks::v1::ListSchedulesRequest const& request) {
  SetMetadata(context, "parent=" + request.parent());
  return child_->ListSchedules(context, request);
}

StatusOr<google::cloud::notebooks::v1::Schedule>
NotebookServiceMetadata::GetSchedule(
    grpc::ClientContext& context,
    google::cloud::notebooks::v1::GetScheduleRequest const& request) {
  SetMetadata(context, "name=" + request.name());
  return child_->GetSchedule(context, request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncDeleteSchedule(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::DeleteScheduleRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncDeleteSchedule(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncCreateSchedule(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::CreateScheduleRequest const& request) {
  SetMetadata(*context, "parent=" + request.parent());
  return child_->AsyncCreateSchedule(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncTriggerSchedule(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::TriggerScheduleRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncTriggerSchedule(cq, std::move(context), request);
}

StatusOr<google::cloud::notebooks::v1::ListExecutionsResponse>
NotebookServiceMetadata::ListExecutions(
    grpc::ClientContext& context,
    google::cloud::notebooks::v1::ListExecutionsRequest const& request) {
  SetMetadata(context, "parent=" + request.parent());
  return child_->ListExecutions(context, request);
}

StatusOr<google::cloud::notebooks::v1::Execution>
NotebookServiceMetadata::GetExecution(
    grpc::ClientContext& context,
    google::cloud::notebooks::v1::GetExecutionRequest const& request) {
  SetMetadata(context, "name=" + request.name());
  return child_->GetExecution(context, request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncDeleteExecution(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::DeleteExecutionRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncDeleteExecution(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncCreateExecution(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::cloud::notebooks::v1::CreateExecutionRequest const& request) {
  SetMetadata(*context, "parent=" + request.parent());
  return child_->AsyncCreateExecution(cq, std::move(context), request);
}

future<StatusOr<google::longrunning::Operation>>
NotebookServiceMetadata::AsyncGetOperation(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::longrunning::GetOperationRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncGetOperation(cq, std::move(context), request);
}

future<Status> NotebookServiceMetadata::AsyncCancelOperation(
    google::cloud::CompletionQueue& cq,
    std::unique_ptr<grpc::ClientContext> context,
    google::longrunning::CancelOperationRequest const& request) {
  SetMetadata(*context, "name=" + request.name());
  return child_->AsyncCancelOperation(cq, std::move(context), request);
}

void NotebookServiceMetadata::SetMetadata(grpc::ClientContext& context,
                                          std::string const& request_params) {
  context.AddMetadata("x-goog-request-params", request_params);
  SetMetadata(context);
}

void NotebookServiceMetadata::SetMetadata(grpc::ClientContext& context) {
  context.AddMetadata("x-goog-api-client", api_client_header_);
  auto const& options = internal::CurrentOptions();
  if (options.has<UserProjectOption>()) {
    context.AddMetadata("x-goog-user-project",
                        options.get<UserProjectOption>());
  }
  auto const& authority = options.get<AuthorityOption>();
  if (!authority.empty()) context.set_authority(authority);
}

GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
}  // namespace notebooks_internal
}  // namespace cloud
}  // namespace google


text:
/*
 * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
 * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 *
 */

package javax.management.relation;

/**
 * Role value is invalid.
 * This exception is raised when, in a role, the number of referenced MBeans
 * in given value is less than expected minimum degree, or the number of
 * referenced MBeans in provided value exceeds expected maximum degree, or
 * one referenced MBean in the value is not an Object of the MBean
 * class expected for that role, or an MBean provided for that role does not
 * exist.
 *
 * @since 1.5
 */
public class InvalidRoleValueException extends RelationException {

    /* Serial version */
    private static final long serialVersionUID = -2066091747301983721L;

    /**
     * Default constructor, no message put in exception.
     */
    public InvalidRoleValueException() {
        super();
    }

    /**
     * Constructor with given message put in exception.
     *
     * @param message the detail message.
     */
    public InvalidRoleValueException(String message) {
        super(message);
    }
}


text:
{{^includesConsent}}
{{^includesGeo}}
<amp-geo layout="nodisplay">

</amp-geo>

<amp-consent id="consent" layout="nodisplay">

      ✕

        We use cookies to understand how you use our site and to improve your experience. By continuing to use our site, you accept our use of cookies and privacy policy.

      OK

</amp-consent>
{{/includesGeo}}
{{/includesConsent}}


text:
#ifndef  STACK_H
#define  STACK_H

#ifndef RESULT_H
#include "Result.h"
#endif // RESULT_H

namespace Calculator {

  class StackItem;
  class StackIteratorPimpl;
  class StackPimpl;
  class VariableSet;

  /*
   * StackIterator
   */

  /** \class StackIterator
   * \brief Iterator over a Stack from top to bottom
   */
  class StackIterator {
  private:
    typedef std::shared_ptr<StackIteratorPimpl> PimplPtr;

  public:
    /** Equivalent of StackItem::Ptr; */
    typedef std::shared_ptr<StackItem> StackItemPtr;

    /** Hint for accessing the value at an iterator */
    enum class Hint {
      /** Dereference the next read */
      DEREFERENCE_NEXT,
	/** Do not dereference the next read */
	NO_DEREFERENCE_NEXT
	};

    ~StackIterator() = default;

    /** Create with reference to the variables and the implementint iterator.
     *
     * @param thePimpl initial data for the StackIterator
     */
    StackIterator(std::shared_ptr<StackIteratorPimpl> thePimpl);

    StackIterator() = delete;
    StackIterator(const StackIterator&);
    StackIterator(StackIterator&&) = default;
    StackIterator& operator=(const StackIterator&);
    StackIterator& operator=(StackIterator&&) = default;

    /** Pre-increment: Move to the next position away from the top.
     *
     * @return this iterator
     */
    StackIterator& operator++();

    /** Post-increment: Move to the next position away from the top, but return the
     * a copy of this iterator without the modification.
     *
     * @return a copy of this iterator before the increment.
     */
    StackIterator operator++(int);

    /** Return true if this iterator is the same position as rhs.
     *
     * @param rhs to compare this iterator to
     *
     * @return true if this iterator and rhs refer to the same position, otherwise
     * false
     */
    bool operator==(const StackIterator& rhs) const;

    /** Return true if this iterator is not the same position as rhs.
     *
     * @param rhs to compare this iterator to
     *
     * @return false if this iterator and rhs refer to the same position, otherwise
     * true
     */
    bool operator!=(const StackIterator& rhs) const;

    /** @return false if any errors have been reported, otherwise true */
    operator bool() const;

    /** @return the object at the current position as per the current hint and reset
     * the hint for the next read to Hint::DEREFERENCE_NEXT
     */
    StackItemPtr operator*();

    /** @return the current item without dereferencing, ignoring the hint entirely
     */
    StackItemPtr noDereference();

    /** Set the current hint for reading the value to theHint.
     *
     * @param theHint to set the hint for the next read to
     *
     * @return this iterator
     */
    StackIterator& setHint(Hint theHint);

    /** Convenience method to read the current value by operator->* (respecting the
     * current hint) and return it to a T::Ptr by std::dynamic_pointer_cast.  If
     * the cast fails, the returned value is empty
     *
     * @tparam T desired type to cast the value to
     * @param required if true, conversion failure is logged as a positional
     * message in the Result.
     *
     * @return the current value from operator* as a T::Ptr, which may be empty if
     * the cast failed
     */
    template<typename T>
      auto as(bool required = true) -> typename T::Ptr {
      typename T::Ptr asT = std::dynamic_pointer_cast<T, StackItem>(this->operator*());
      if(required && !asT) {
	addError(std::string("Value is not ") + T::indef_type_string());
      }
      return asT;
    }

    /** @return Errors, such as conversion and variable, thus far, if any */
    const Result& getResult() const;

    /** Add error message at position
     *
     * @param position in the stack the error occurred
     * @param message describing the error
     */
    void addError(unsigned int position, const std::string& message);

    /** Add error message at current position
     *
     * @param message describing the error
     */
    void addError(const std::string& message);

    /** @return the private implementation */
    PimplPtr getPimpl();

  private:
    /** The private implementation */
    PimplPtr pimpl;
  };

  /** Set the iter's hint and return the iter.
   *
   * @param iter to set hint on
   * @param hint to set
   *
   * @return iter
   */
  StackIterator& operator>>(StackIterator& iter, StackIterator::Hint hint);

  /** Set t to *iter and return iter.
   *
   * @param iter to read from
   * @param t to set *iter into
   *
   * @return iter
   */
  StackIterator& operator>>(StackIterator& iter, std::shared_ptr<StackItem>& t);

  /** Convenience function to read the current value of iter by the template as()
   * (respecting the current hint) and set to t. If the cast fails in t, the set
   *  value is empty
   *
   * @tparam T desired type to cast the value to
   *
   * @param iter to read from
   * @param t to set iter.as<T>() into
   *
   * @return iter
   */
  template<typename T>
    StackIterator& operator>>(StackIterator& iter, T& t) {
    t = iter.template as<typename T::element_type>();
    ++iter;
    return iter;
  }

  /*
   * Stack
   */

  /** Stack of values to process from.
   *
   * Contains StackItem::Ptr objects.
   *
   * \todo Provide load / save operations.
   * Provide the ability to write and read Calculator.txt files which will
   * restore the existing state.
   */
  class Stack {
  private:
    typedef std::shared_ptr<StackPimpl> PimplPtr;
    typedef std::shared_ptr<StackItem> StackItemPtr;

  public:
    /** Count of StackItems */
    typedef unsigned int Count;

    Stack();
    Stack(const Stack& rhs) = delete;
    Stack(Stack&& rhs) = delete;
    Stack& operator=(const Stack& rhs) = delete;
    Stack& operator=(Stack&& rhs) = delete;

    /** @return number of StackItems on the Stack */
    Count getDepth() const;

    /** @return the VariableSet */
    VariableSet& getVariables();

    /** Reset the stack including pop all variables and reset the variables */
    void reset();

    /** Pop all items from the stack */
    void popAll();

    /** @return StackIterator at the top of the Stack
     *
     * \note This should be a const method; however, the underlying
     * implementation (STL) would only provide a const_iterator.  This would be
     * just fine for its use; however, std::vector::erase requires a non-const
     * iterator, which means this must be non-const.  I could const cast around
     * this, but I'll go simpler.
     */
    StackIterator begin();

    /** @return StackIterator after the bottom of the Stack
     *
     * \note This should be a const method; however, the underlying
     * implementation (STL) would only provide a const_iterator.  This would be
     * just fine for its use; however, std::vector::erase requires a non-const
     * iterator, which means this must be non-const.  I could const cast around
     * this, but I'll go simpler.
     */
    StackIterator end();

    /** Pop all items after iter on the Stack */
    void popAfter(StackIterator& iter);

    /** Push item onto the stack
     *
     * @param item to push
     */
    void push(StackItemPtr item);

    /** Create string representation of the current contents of the Stack */
    std::string toString() const;

  private:
    /** The Private Implementation */
    PimplPtr pimpl;
  };

} // namespace Calculator

#endif //  STACK_H


text:
package org.apache.commons.math3.stat.descriptive;

import org.apache.commons.math3.exception.MathIllegalArgumentException;
import org.apache.commons.math3.stat.descriptive.moment.Mean;
import org.junit.Assert;
import org.junit.Test;

/**
 * Tests for AbstractUnivariateStatistic
 *
 */
public class AbstractUnivariateStatisticTest {

    protected double[] testArray = {0, 1, 2, 3, 4, 5};
    protected double[] testWeightsArray = {0.3, 0.2, 1.3, 1.1, 1.0, 1.8};
    protected double[] testNegativeWeightsArray = {-0.3, 0.2, -1.3, 1.1, 1.0, 1.8};
    protected double[] nullArray = null;
    protected double[] singletonArray = {0};
    protected Mean testStatistic = new Mean();

    @Test
    public void testTestPositive() {
        for (int j = 0; j < 6; j++) {
            for (int i = 1; i < (7 - j); i++) {
                Assert.assertTrue(testStatistic.test(testArray, 0, i));
            }
        }
        Assert.assertTrue(testStatistic.test(singletonArray, 0, 1));
        Assert.assertTrue(testStatistic.test(singletonArray, 0, 0, true));
    }

    @Test
    public void testTestNegative() {
        Assert.assertFalse(testStatistic.test(singletonArray, 0, 0));
        Assert.assertFalse(testStatistic.test(testArray, 0, 0));
        try {
            testStatistic.test(singletonArray, 2, 1);  // start past end
            Assert.fail("Expecting MathIllegalArgumentException");
        } catch (MathIllegalArgumentException ex) {
            // expected
        }
        try {
            testStatistic.test(testArray, 0, 7);  // end past end
            Assert.fail("Expecting MathIllegalArgumentException");
        } catch (MathIllegalArgumentException ex) {
            // expected
        }
        try {
            testStatistic.test(testArray, -1, 1);  // start negative
            Assert.fail("Expecting MathIllegalArgumentException");
        } catch (MathIllegalArgumentException ex) {
            // expected
        }
        try {
            testStatistic.test(testArray, 0, -1);  // length negative
            Assert.fail("Expecting MathIllegalArgumentException");
        } catch (MathIllegalArgumentException ex) {
            // expected
        }
        try {
            testStatistic.test(nullArray, 0, 1);  // null array
            Assert.fail("Expecting MathIllegalArgumentException");
        } catch (MathIllegalArgumentException ex) {
            // expected
        }
        try {
            testStatistic.test(testArray, nullArray, 0, 1);  // null weights array
            Assert.fail("Expecting MathIllegalArgumentException");
        } catch (MathIllegalArgumentException ex) {
            // expected
        }
        try {
            testStatistic.test(singletonArray, testWeightsArray, 0, 1);  // weights.length != value.length
            Assert.fail("Expecting MathIllegalArgumentException");
        } catch (MathIllegalArgumentException ex) {
            // expected
        }
        try {
            testStatistic.test(testArray, testNegativeWeightsArray, 0, 6);  // can't have negative weights
            Assert.fail("Expecting MathIllegalArgumentException");
        } catch (MathIllegalArgumentException ex) {
            // expected
        }
    }
}


text:
var config = require('../config'),
    twilio = require('../index');

describe('The Twilio REST Client Accounts resource', function () {
    //create a client with a valid account SID and authToken for live testing
    var client = new twilio.RestClient(config.accountSid, config.authToken);

    it('gets an unfiltered list of Accounts associated with this master account', function (done) {
        client.accounts.list(function (err, data, response) {
            expect(data.accounts.length).toBeGreaterThan(0);
            done();
        });
    });

    var newAccountSidOne, newAccountSidTwo; //store so we can close them after creation

    it('allows for the creation of subaccounts', function (done) {
        client.accounts.create({
            friendlyName:'TestAccountUno'
        }, function (err, data, response) {
            expect(data.friendly_name).toBe('TestAccountUno');
            newAccountSidOne = data.sid;

            //Create a second account using the "post" function, and an uppercased name
            client.accounts.post({
                FriendlyName:'TestAccountDos'
            }, function (err2, data2, response2) {
                expect(data2.friendly_name).toBe('TestAccountDos');
                newAccountSidTwo = data2.sid;
                done();
            });
        });
    });

    it('provides a means of getting account details for a specific sid', function (done) {
        client.accounts(newAccountSidOne).get(function (err, data) {
            expect(data.sid).toBe(newAccountSidOne);
            done();
        });
    });

    it('provdes a means of updating and closing subaccounts', function (done) {
        client.accounts(newAccountSidOne).put({
            Status:'closed'
        }, function (err, data) {
            expect(data.sid).toBe(newAccountSidOne);
            expect(data.status).toBe('closed');

            client.accounts(newAccountSidTwo).update({
                status:'closed'
            }, function (err2, data2) {
                expect(data2.sid).toBe(newAccountSidTwo);
                expect(data2.status).toBe('closed');
                done();
            });
        });
    });

});


text:
package com.api.manager;

import java.awt.Font;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Properties;

import org.apache.log4j.Logger;

import com.api.manager.worker.http.HttpSender.Method;
import com.api.manager.worker.tool.reader.PropertiesReader;

/**
 * 配置
 *
 * @author ASLai
 *
 */
public class Config {

	/**
	 * 图标资源
	 */
	public enum Icon {
		/** logo */
		logo("image/logo.png"),
		/** 新增按钮 */
		add("image/add.png"),
		/** 删除按钮 */
		delete("image/delete.png"),
		/** 清空按钮 */
		clear("image/clear.png"),
		/** 清空按钮 */
		up("image/up.png"),
		/** 文件夹 */
		folder("image/folder.png"),
		/** 文件夹-打开 */
		folder_open("image/folder_open.png"),
		/** 叶子节点 */
		leaf("image/leaf.png");

		/** 图片路径 */
		public final String path;

		private Icon(String path) {

			this.path = path;
		}
	}

	private static Logger logger = Logger.getLogger(Config.class);

	private static final String CONFIG_PATH = "/properties/config.properties";
	private static final String VERSION_PATH = "/version/version.properties";
	private static final String VERSION_TEXT_PATH = "/version/version.txt";

	private static final String ATTR_NAME = "manager.name";
	private static final String ATTR_SINGLETON = "manager.singleton";
	private static final String ATTR_CHARTSET = "manager.charset";
	private static final String ATTR_CONFIG_DIR = "manager.config.dir";
	private static final String ATTR_CONFIG_FILE_BASE = "manager.config.file.base";
	private static final String ATTR_CONFIG_FILE_STYLE = "manager.config.file.style";
	private static final String ATTR_CONFIG_FILE_HISTORY = "manager.config.file.history";
	private static final String ATTR_CONFIG_FILE_FAVORITES = "manager.config.file.favorites";
	private static final String ATTR_CONFIG_SUFFIX = "manager.config.suffix";
	private static final String ATTR_CONFIG_AUTO = "manager.config.auto";
	private static final String ATTR_CONFIG_AUTO_TIME = "manager.config.auto.time";
	private static final String ATTR_FONT_NAME = "manager.font.name";
	private static final String ATTR_FONT_SIZE = "manager.font.size";
	private static final String ATTR_THEME = "manager.theme";
	private static final String ATTR_THEME_DEFAULT = "manager.theme.default";
	private static final String ATTR_METHOD_DEFAULT = "manager.method.default";
	private static final String ATTR_HISTORY_MAX = "manager.history.max";
	private static final String ATTR_HISTORY_SAVE = "manager.history.save";
	private static final String ATTR_HTTP_TIMEOUT = "manager.http.time.out";
	private static final String ATTR_VERSION = "manager.version";
	private static final String ATTR_VERSION_NUMBER = "manager.version.number";
	private static final String ATTR_VERSION_DATE = "manager.version.date";

	/** 名称 */
	public String name;
	/** 是否为单例 */
	public Boolean singleton;
	/** 编码 */
	public String charset;
	/** 用户配置路径 */
	public String config_dir;
	/** 基础配置文件 */
	public String config_file_base;
	/** 主题样式配置文件 */
	public String config_file_style;
	/** 历史记录配置文件 */
	public String config_file_history;
	/** 收藏夹配置文件 */
	public String config_file_favorites;
	/** 配置默认后缀 */
	public String config_suffix;
	/** 是否开启配置自动保存 */
	public Boolean config_auto;
	/** 自动保存配置间隔时间 */
	public Integer config_auto_time;
	/** 默认字体 */
	public Font font;
	/** 图标 */
	public Map<String, String> icons;
	/** 主题 */
	public Map<String, String> themes;
	/** 默认主题 */
	public String default_themes;
	/** 默认调用方式 */
	public Method default_method;
	/** 历史记录最大条数 */
	public Integer max_history;
	/** 是否保存历史记录 */
	public Boolean save_history;
	/** 连接超时时间 */
	public Integer time_out;
	/** 版本 */
	public String version;
	/** 版本序号 */
	public Integer version_number;
	/** 版本构建事件 */
	public String version_date;

	/**
	 * 初始化配置
	 */
	public void init() {

		long start = System.currentTimeMillis();
		logger.info("读取系统配置");

		Properties prop = PropertiesReader.getResourceProp(CONFIG_PATH);
		initBase(prop);
		initTheme(prop);
		initFont(prop);
		initMethod(prop);

		prop = PropertiesReader.getResourceProp(VERSION_PATH);
		initVersion(prop);

		logger.info("读取系统配置 -完毕- " + (System.currentTimeMillis() - start) + "ms");
	}

	/**
	 * 初始化基础配置
	 *
	 * @param prop 配置
	 */
	private void initBase(Properties prop) {

		name = (String) prop.get(ATTR_NAME);
		singleton = Boolean.valueOf((String) prop.get(ATTR_SINGLETON));
		max_history = Integer.valueOf((String) prop.get(ATTR_HISTORY_MAX));
		save_history = Boolean.valueOf((String) prop.get(ATTR_HISTORY_SAVE));
		time_out = Integer.valueOf((String) prop.get(ATTR_HTTP_TIMEOUT));
		config_dir = (String) prop.get(ATTR_CONFIG_DIR);
		config_file_base = (String) prop.get(ATTR_CONFIG_FILE_BASE);
		config_file_style = (String) prop.get(ATTR_CONFIG_FILE_STYLE);
		config_file_history = (String) prop.get(ATTR_CONFIG_FILE_HISTORY);
		config_file_favorites = (String) prop.get(ATTR_CONFIG_FILE_FAVORITES);
		config_suffix = (String) prop.get(ATTR_CONFIG_SUFFIX);
		config_auto = Boolean.valueOf((String) prop.get(ATTR_CONFIG_AUTO));
		config_auto_time = Integer.valueOf((String) prop.get(ATTR_CONFIG_AUTO_TIME));
		charset = (String) prop.get(ATTR_CHARTSET);
	}

	/**
	 * 初始化主体配置
	 *
	 * @param prop 配置
	 */
	private void initTheme(Properties prop) {

		themes = new LinkedHashMap<String, String>();
		// 主题类型
		String[] types = ((String) prop.get(ATTR_THEME)).split("\\|");
		for (String type : types) {
			// 主题类型信息
			String[] themeTypeInfo = type.split("_");
			// 主题类型名称
			String name = themeTypeInfo[0];
			// 获取主题
			for (String theme : themeTypeInfo[1].split(",")) {
				StringBuilder attr = new StringBuilder();
				// 配置参数名称
				attr.append(ATTR_THEME).append(".").append(name).append(".").append(theme);
				// 添加主题信息
				String[] themeInfo = prop.get(attr.toString()).toString().split(",");
				themes.put(themeInfo[0], themeInfo[1]);
			}
		}
		default_themes = (String) prop.get(ATTR_THEME_DEFAULT);
	}

	/**
	 * 初始化字体
	 *
	 * @param prop 配置
	 */
	private void initFont(Properties prop) {

		String font_name = (String) prop.get(ATTR_FONT_NAME);
		Integer font_size = Integer.valueOf((String) prop.get(ATTR_FONT_SIZE));
		font = new Font(font_name, Font.PLAIN, font_size);
	}

	/**
	 * 初始化默认调用方式
	 *
	 * @param prop 配置
	 */
	private void initMethod(Properties prop) {

		String method = (String) prop.get(ATTR_METHOD_DEFAULT);
		default_method = Method.valueOf(method);
	}

	private void initVersion(Properties prop) {

		version = (String) prop.get(ATTR_VERSION);
		version_number = Integer.valueOf((String) prop.get(ATTR_VERSION_NUMBER));
		version_date = (String) prop.get(ATTR_VERSION_DATE);
	}

	/**
	 * 读取版本信息
	 *
	 * @return 版本信息
	 */
	public String readVersion() {

		// 读取版本信息文件流
		InputStream is = Object.class.getResourceAsStream(VERSION_TEXT_PATH);
		// 读取器
		BufferedReader reader = null;
		try {
			reader = new BufferedReader(new InputStreamReader(is));
			// 版本信息
			StringBuilder version = new StringBuilder();
			// 行字符串
			String str = null;
			// 是否为起始行
			boolean start = true;
			// 读取文件
			while ((str = reader.readLine()) != null) {
				if (start) {
					start = false;
				} else {
					version.append("\r\n");
				}
				version.append(new String(str.getBytes(), charset));
			}
			return version.toString();
		} catch (IOException e) {
			throw new RuntimeException(e);
		} finally {
			// 关闭流
			if (reader != null) {
				try {
					reader.close();
				} catch (IOException e) {
				}
			}
			try {
				is.close();
			} catch (IOException e) {
			}
		}
	}
}


text:
let args = require('argly')
  .createParser({
    '--help': {
      type: 'string',
      description: 'Show this help message'
    },
    '--directory -d': {
      type: 'string',
      description: 'Directory to download the facets images to. Defaults to present working directory.'
    },
    '--wallpaper -w': {
      type: 'string',
      description: 'Downloads wallpaper facets images'
    }
  })
  .usage('Usage: facets-downloader [options]')
  .example(
    'Standard image download',
    'facets-downloader --directory ~/Pictures/')
  .example(
    'Wallpaper download',
    'facets-downloader --directory ~/Pictures/ --wallpaper')
  .validate(function(result) {
    if (result.help) {
      this.printUsage();
      process.exit(0);
    }
  })
  .onError(function(err) {
    this.printUsage();
    console.error(err);
    process.exit(1);
  })
  .parse();

require('../').download({
  directory: args.directory,
  wallpaper: args.wallpaper
});


text:
def meal
  return 'Breakfast'
  'Dinner'
  puts 'Dinner'
end

puts meal
p meal


text:
// -*- c++ -*-
// Generated by gmmproc 2.44.0 -- DO NOT MODIFY!
#ifndef _GTKMM_LISTBOXROW_H
#define _GTKMM_LISTBOXROW_H

#include <glibmm/ustring.h>
#include <sigc++/sigc++.h>

#include <gtkmm/bin.h>

#ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct _GtkListBoxRow GtkListBoxRow;
typedef struct _GtkListBoxRowClass GtkListBoxRowClass;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

#ifndef DOXYGEN_SHOULD_SKIP_THIS
namespace Gtk
{ class ListBoxRow_Class; } // namespace Gtk
#endif //DOXYGEN_SHOULD_SKIP_THIS

namespace Gtk
{

/** See the description of ListBox.
 *
 * @ingroup Widgets
 * @ingroup Containers
 *
 * @newin{3,10}
 */

class ListBoxRow : public Bin
{
  public:
#ifndef DOXYGEN_SHOULD_SKIP_THIS
  typedef ListBoxRow CppObjectType;
  typedef ListBoxRow_Class CppClassType;
  typedef GtkListBoxRow BaseObjectType;
  typedef GtkListBoxRowClass BaseClassType;
#endif /* DOXYGEN_SHOULD_SKIP_THIS */

  virtual ~ListBoxRow();

#ifndef DOXYGEN_SHOULD_SKIP_THIS

private:
  friend class ListBoxRow_Class;
  static CppClassType listboxrow_class_;

  // noncopyable
  ListBoxRow(const ListBoxRow&);
  ListBoxRow& operator=(const ListBoxRow&);

protected:
  explicit ListBoxRow(const Glib::ConstructParams& construct_params);
  explicit ListBoxRow(GtkListBoxRow* castitem);

#endif /* DOXYGEN_SHOULD_SKIP_THIS */

public:

  /** Get the GType for this class, for use with the underlying GObject type system.
   */
  static GType get_type()      G_GNUC_CONST;

#ifndef DOXYGEN_SHOULD_SKIP_THIS

  static GType get_base_type() G_GNUC_CONST;
#endif

  ///Provides access to the underlying C GtkObject.
  GtkListBoxRow*       gobj()       { return reinterpret_cast<GtkListBoxRow*>(gobject_); }

  ///Provides access to the underlying C GtkObject.
  const GtkListBoxRow* gobj() const { return reinterpret_cast<GtkListBoxRow*>(gobject_); }

public:
  //C++ methods used to invoke GTK+ virtual functions:

protected:
  //GTK+ Virtual Functions (override these to change behaviour):

  //Default Signal Handlers::

private:

public:
  ListBoxRow();

  /** Sets the current header of the ListBoxRow. This is only allowed to be called
   * from a ListBox::SlotUpdateHeader. It will replace any existing
   * header in the row, and be shown in front of the row in the ListBox.
   *
   * @newin{3,10}
   *
   * @param header The header.
   */
  void set_header(Widget& header);

  /** Removes the current header, if any. This is only allowed to be called
   * from a ListBox::SlotUpdateHeader.
   *
   * @newin{3,10}
   */
  void unset_header();

  /** Returns the current header of the ListBoxRow. This can be used
   * in a ListBox::SlotUpdateHeader to see if there is a header
   * set already, and if so to update the state of it.
   *
   * @newin{3,10}
   *
   * @return The current header, or <tt>0</tt> if none.
   */
  Widget* get_header();

  /** Returns the current header of the ListBoxRow. This can be used
   * in a ListBox::SlotUpdateHeader to see if there is a header
   * set already, and if so to update the state of it.
   *
   * @newin{3,10}
   *
   * @return The current header, or <tt>0</tt> if none.
   */
  const Widget* get_header() const;

  /** Gets the current index of the @a row in its Gtk::ListBox container.
   *
   * @newin{3,10}
   *
   * @return The index of the @a row, or -1 if the @a row is not in a listbox.
   */
  int get_index() const;

  /** Marks @a row as changed, causing any state that depends on this
   * to be updated. This affects sorting, filtering and headers.
   *
   * Note that calls to this method must be in sync with the data
   * used for the row functions. For instance, if the list is
   * mirroring some external data set, and *two* rows changed in the
   * external data set then when you call changed()
   * on the first row the sort function must only read the new data
   * for the first of the two changed rows, otherwise the resorting
   * of the rows will be wrong.
   *
   * This generally means that if you don't fully control the data
   * model you have to duplicate the data that affects the listbox
   * row functions into the row widgets themselves. Another alternative
   * is to call invalidate_sort() on any model change,
   * but that is more expensive.
   *
   * @newin{3,10}
   *
   */
  void changed();

  /** Returns whether the child is currently selected in its
   * Gtk::ListBox container.
   *
   * @newin{3,14}
   *
   * @return <tt>true</tt> if @a row is selected.
   */
  bool is_selected() const;

  /** Set the Gtk::ListBoxRow::property_selectable() property for this row.
   *
   * @newin{3,14}
   *
   * @param selectable <tt>true</tt> to mark the row as selectable.
   */
  void set_selectable(bool selectable =  true);

  /** Gets the value of the Gtk::ListBoxRow::property_selectable() property
   * for this row.
   *
   * @newin{3,14}
   *
   * @return <tt>true</tt> if the row is selectable.
   */
  bool get_selectable() const;

  /** Set the Gtk::ListBoxRow::property_activatable() property for this row.
   *
   * @newin{3,14}
   *
   * @param activatable <tt>true</tt> to mark the row as activatable.
   */
  void set_activatable(bool activatable =  true);

  /** Gets the value of the Gtk::ListBoxRow::property_activatable() property
   * for this row.
   *
   * @newin{3,14}
   *
   * @return <tt>true</tt> if the row is activatable.
   */
  bool get_activatable() const;

  /** Whether this row can be selected.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the value of the property,
   * or receive notification when the value of the property changes.
   */
  Glib::PropertyProxy< bool > property_selectable() ;

/** Whether this row can be selected.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
   * or receive notification when the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly< bool > property_selectable() const;

  /** Whether this row can be activated.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy that allows you to get or set the value of the property,
   * or receive notification when the value of the property changes.
   */
  Glib::PropertyProxy< bool > property_activatable() ;

/** Whether this row can be activated.
   *
   * You rarely need to use properties because there are get_ and set_ methods for almost all of them.
   * @return A PropertyProxy_ReadOnly that allows you to get the value of the property,
   * or receive notification when the value of the property changes.
   */
  Glib::PropertyProxy_ReadOnly< bool > property_activatable() const;

   // Action signal

};

} // namespace Gtk

namespace Glib
{
  /** A Glib::wrap() method for this object.
   *
   * @param object The C instance.
   * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
   * @result A C++ instance that wraps this C instance.
   *
   * @relates Gtk::ListBoxRow
   */
  Gtk::ListBoxRow* wrap(GtkListBoxRow* object, bool take_copy = false);
} //namespace Glib

#endif /* _GTKMM_LISTBOXROW_H */


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" type="text/css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" type="text/css">
    <link rel="stylesheet" href="./resources/prism/prism.css" type="text/css">
    <link rel="stylesheet" href="../css/ol.css" type="text/css">
    <link rel="stylesheet" href="./resources/layout.css" type="text/css">

    <title>Layer Swipe</title>

           OpenLayers 3 Examples

Docs

Examples

API

Code

Layer Swipe

<input id="swipe" type="range" style="width: 100%">

Example of a Layer swipe map.

Example of a Layer swipe map.

Related API documentation:

ol.Map
,
ol.View
,
ol.control
,
ol.layer.Tile
,
ol.source.BingMaps
,
ol.source.OSM

           Copy
           Edit

        <form method="POST" id="jsfiddle-form" target="_blank" action="http://jsfiddle.net/api/post/library/pure/">
          <textarea class="hidden" name="js">var osm = new ol.layer.Tile({
  source: new ol.source.OSM()
});
var bing = new ol.layer.Tile({
  source: new ol.source.BingMaps({
    key: 'Your Bing Maps Key from http://bingmapsportal.com/ here',
    imagerySet: 'Aerial'
  })
});

var map = new ol.Map({
  layers: [osm, bing],
  target: 'map',
  controls: ol.control.defaults({
    attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
      collapsible: false
    })
  }),
  view: new ol.View({
    center: [0, 0],
    zoom: 2
  })
});

var swipe = document.getElementById('swipe');

bing.on('precompose', function(event) {
  var ctx = event.context;
  var width = ctx.canvas.width * (swipe.value / 100);

  ctx.save();
  ctx.beginPath();
  ctx.rect(width, 0, ctx.canvas.width - width, ctx.canvas.height);
  ctx.clip();
});

bing.on('postcompose', function(event) {
  var ctx = event.context;
  ctx.restore();
});

swipe.addEventListener('input', function() {
  map.render();
}, false);
</textarea>
          <textarea class="hidden" name="css"></textarea>
          <textarea class="hidden" name="html"><div id="map" class="map"></div>
<input id="swipe" type="range" style="width: 100%">
</textarea>
          <input type="hidden" name="wrap" value="l">
          <input type="hidden" name="resources" value="http://openlayers.org/en/v3.14.2/css/ol.css,http://openlayers.org/en/v3.14.2/build/ol.js">
        </form>

<!DOCTYPE html>
<html>
  <head>
    <title>Layer Swipe</title>
    <link rel="stylesheet" href="http://openlayers.org/en/v3.14.2/css/ol.css" type="text/css">
    <script src="http://openlayers.org/en/v3.14.2/build/ol.js"></script>
  </head>
  <body>
    <div id="map" class="map"></div>
    <input id="swipe" type="range" style="width: 100%">
    <script>
      var osm = new ol.layer.Tile({
        source: new ol.source.OSM()
      });
      var bing = new ol.layer.Tile({
        source: new ol.source.BingMaps({
          key: 'Your Bing Maps Key from http://bingmapsportal.com/ here',
          imagerySet: 'Aerial'
        })
      });

      var map = new ol.Map({
        layers: [osm, bing],
        target: 'map',
        controls: ol.control.defaults({
          attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
            collapsible: false
          })
        }),
        view: new ol.View({
          center: [0, 0],
          zoom: 2
        })
      });

      var swipe = document.getElementById('swipe');

      bing.on('precompose', function(event) {
        var ctx = event.context;
        var width = ctx.canvas.width * (swipe.value / 100);

        ctx.save();
        ctx.beginPath();
        ctx.rect(width, 0, ctx.canvas.width - width, ctx.canvas.height);
        ctx.clip();
      });

      bing.on('postcompose', function(event) {
        var ctx = event.context;
        ctx.restore();
      });

      swipe.addEventListener('input', function() {
        map.render();
      }, false);
    </script>
  </body>
</html>


text:
package db

import (
	sparql "github.com/gtfierro/hod/lang/ast"
	"github.com/gtfierro/hod/turtle"
	"time"
)

func (db *DB) handleInsert(insert sparql.InsertClause, result QueryResult) (queryStats, error) {
	insertStart := time.Now()
	var additions turtle.DataSet
	var stats queryStats
	for _, insertTerm := range insert.Terms {
		if result.Count == 0 {
			additions.AddTripleURIs(insertTerm.Subject, insertTerm.Predicates[0].Predicate, insertTerm.Object)
		} else {
			for _, row := range result.Rows {
				newterm := insertTerm.Copy()
				// replace all variables with content from query
				if newterm.Subject.IsVariable() {
					if value, found := row[newterm.Subject.Value]; found {
						newterm.Subject = value
					}
				}
				pred := newterm.Predicates[0].Predicate
				if pred.IsVariable() {
					if value, found := row[pred.Value]; found {
						newterm.Predicates[0].Predicate = value
					}
				}
				if newterm.Object.IsVariable() {
					if value, found := row[newterm.Object.Value]; found {
						newterm.Object = value
					}
				}
				additions.AddTripleURIs(newterm.Subject, newterm.Predicates[0].Predicate, newterm.Object)
				stats.NumInserted += 1
			}
		}
	}

	tx, err := db.openTransaction()
	if err != nil {
		tx.discard()
		return stats, err
	}
	if err := tx.addTriples(additions); err != nil {
		tx.discard()
		return stats, err
	}
	if err := tx.done(); err != nil {
		tx.discard()
		return stats, err
	}
	if err := db.buildTextIndex(additions); err != nil {
		return stats, err
	}
	err = db.saveIndexes()
	if err != nil {
		return stats, err
	}
	stats.InsertTime = time.Since(insertStart)
	return stats, nil
}


text:
package create

import (
	"log"
	"os"
	"path/filepath"

	"github.com/kubernetes-incubator/apiserver-builder/cmd/apiserver-boot/boot/util"
	"github.com/spf13/cobra"
	"strings"
)

var createGroupCmd = &cobra.Command{
	Use:   "group",
	Short: "Creates an API group",
	Long:  `Creates an API group.`,
	Run:   RunCreateGroup,
}

var groupName string
var ignoreGroupExists bool = false

func AddCreateGroup(cmd *cobra.Command) {
	createGroupCmd.Flags().StringVar(&groupName, "group", "", "name of the API group to create")

	cmd.AddCommand(createGroupCmd)
	AddCreateVersion(createGroupCmd)
}

func RunCreateGroup(cmd *cobra.Command, args []string) {
	if _, err := os.Stat("pkg"); err != nil {
		log.Fatalf("could not find 'pkg' directory.  must run apiserver-boot init before creating resources")
	}

	util.GetDomain()
	if len(groupName) == 0 {
		log.Fatalf("Must specify --group")
	}

	if strings.ToLower(groupName) != groupName {
		log.Fatalf("--group must be lowercase was (%s)", groupName)
	}

	createGroup(util.GetCopyright(copyright))
}

func createGroup(boilerplate string) {
	dir, err := os.Getwd()
	if err != nil {
		log.Fatal(err)
	}

	a := groupTemplateArgs{
		boilerplate,
		util.Domain,
		groupName,
	}

	path := filepath.Join(dir, "pkg", "apis", groupName, "doc.go")
	created := util.WriteIfNotFound(path, "group-template", groupTemplate, a)

	path = filepath.Join(dir, "pkg", "apis", groupName, "install", "doc.go")
	created = util.WriteIfNotFound(path, "install-template", installTemplate, a)
	if !created && !ignoreGroupExists {
		log.Fatalf("API group %s already exists.", groupName)
	}
}

type groupTemplateArgs struct {
	BoilerPlate string
	Domain      string
	Name        string
}

var groupTemplate = `
{{.BoilerPlate}}

// +k8s:deepcopy-gen=package,register
// +groupName={{.Name}}.{{.Domain}}

// Package api is the internal version of the API.
package {{.Name}}

`

var installTemplate = `
{{.BoilerPlate}}

package install

`


text:
<?php

namespace Alcyon\CoreBundle\Component\ListHelper\Element;

use Alcyon\CoreBundle\Component\ListHelper\ElementInterface;
use Alcyon\CoreBundle\Component\ListHelper\Util\StringUtil;
use Alcyon\CoreBundle\Component\ListHelper\Options\AbstractOptions;
use Symfony\Component\OptionsResolver\Options;
use Symfony\Component\OptionsResolver\OptionsResolver;

abstract class BaseElement extends AbstractElement
{
	/**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        parent::configureOptions($resolver);

        $resolver->setDefaults([
                    'disabled'  => false,
                    'class'     => "",
                    'attr'      => [],
                    'tags'      => '',
                    ])
        ;

        // Set allowed values
        $resolver->setAllowedValues('disabled', [true, false]);

        // Set allowed types
        $resolver->setAllowedTypes('class', 'string')
                 ->setAllowedTypes('attr', 'array')
                 ->setAllowedTypes('tags', ['string','array']);

        $resolver->setNormalizer('attr', function (Options $options, $attr) {

                // Verify all attr are string => string
                foreach($attr as $key => $value) {
                    if(!is_string($key) || !is_string($value))
                        throw new UnexpectedTypeException($attr, 'array of string => string');
                }

                return $attr;
            })
            ->setNormalizer('tags', function (Options $options, $tags) {

                if(is_string($tags))
                    $tags = array($tags);

                // Verify all tags are string => string
                foreach($tags as $key => $value) {
                    if(!is_string($key) || !is_string($value))
                        throw new UnexpectedTypeException($attr, 'array of string');
                }

                return $tags;
        })
        ;
    }
}


text:
import Status from "./status"
import Article from "./article"
import Articles from "./articles"
import Artwork from "./artwork"
import Artworks from "./artworks"
import Artist from "./artist"
import Artists from "./artists"
import Collection from "./collection"
import ExternalPartner from "./external_partner"
import Fair from "./fair"
import Fairs from "./fairs"
import Gene from "./gene"
import GeneFamilies from "./gene_families"
import GeneFamily from "./gene_family"
import HomePage from "./home"
import OrderedSet from "./ordered_set"
import OrderedSets from "./ordered_sets"
import Profile from "./profile"
import Partner from "./partner"
import Partners from "./partners"
import FilterPartners from "./filter_partners"
import filterArtworks from "./filter_artworks"
import FilterSaleArtworks from "./filter_sale_artworks"
import FollowArtist from "./me/follow_artist"
import PartnerCategory from "./partner_category"
import PartnerCategories from "./partner_categories"
import PartnerShow from "./partner_show"
import PartnerShows from "./partner_shows"
import Sale from "./sale/index"
import Sales from "./sales"
import SaleArtwork from "./sale_artwork"
import Search from "./search"
import Show from "./show"
import Tag from "./tag"
import TrendingArtists from "./trending"
import MatchArtist from "./match/artist"
import Me from "./me"
import UpdateConversation from "./me/update_conversation"
import AppendConversationThread from "./me/append_conversation_thread"
import UpdateCollectorProfile from "./me/update_collector_profile"
import SaveArtwork from "./me/save_artwork"
import CausalityJWT from "./causality_jwt"
import ObjectIdentification from "./object_identification"
import { GraphQLSchema, GraphQLObjectType } from "graphql"

const rootFields = {
  article: Article,
  articles: Articles,
  artwork: Artwork,
  artworks: Artworks,
  artist: Artist,
  artists: Artists,
  causality_jwt: CausalityJWT,
  collection: Collection,
  external_partner: ExternalPartner,
  fair: Fair,
  fairs: Fairs,
  filter_partners: FilterPartners,
  filter_artworks: filterArtworks(),
  filter_sale_artworks: FilterSaleArtworks,
  gene: Gene,
  gene_families: GeneFamilies,
  gene_family: GeneFamily,
  home_page: HomePage,
  match_artist: MatchArtist,
  me: Me,
  node: ObjectIdentification.NodeField,
  ordered_set: OrderedSet,
  ordered_sets: OrderedSets,
  partner: Partner,
  partner_categories: PartnerCategories,
  partner_category: PartnerCategory,
  partner_show: PartnerShow,
  partner_shows: PartnerShows,
  partners: Partners,
  profile: Profile,
  sale: Sale,
  sale_artwork: SaleArtwork,
  sales: Sales,
  search: Search,
  show: Show,
  status: Status,
  tag: Tag,
  trending_artists: TrendingArtists,
}

const ViewerType = new GraphQLObjectType({
  name: "Viewer",
  description: "A wildcard used to support complex root queries in Relay",
  fields: rootFields,
})

const Viewer = {
  type: ViewerType,
  description: "A wildcard used to support complex root queries in Relay",
  resolve: x => x,
}

const schema = new GraphQLSchema({
  mutation: new GraphQLObjectType({
    name: "Mutation",
    fields: {
      followArtist: FollowArtist,
      updateCollectorProfile: UpdateCollectorProfile,
      updateConversation: UpdateConversation,
      appendConversationThread: AppendConversationThread,
      saveArtwork: SaveArtwork,
    },
  }),
  query: new GraphQLObjectType({
    name: "Query",
    fields: {
      ...rootFields,
      viewer: Viewer,
    },
  }),
})

export default schema


text:
/* vim: set et sw=4 ts=4: */

/*
   fib.h

   Header file for calculating Fibonacci numbers

*/

#ifndef FIB_H
#define FIB_H

#include <gmp.h>

unsigned fib_naive (unsigned n);

void fib (mpz_t res, unsigned n);

void fib_iter (mpz_t res, unsigned n);

#endif


text:
'use strict'

module.exports = function (myId, highlightId) {
  if (myId && highlightId) {
    return myId.toString() === highlightId.toString() ? 'highlight-me' : ''
  } else {
    return ''
  }
}


text:
package org.seasar.doma.jdbc.query;

import java.sql.Connection;
import java.sql.NClob;
import java.sql.SQLException;

/**
 * @author taedium
 *
 */
public class NClobCreateQuery extends AbstractCreateQuery<NClob> {

    @Override
    public NClob create(Connection connection) throws SQLException {
        return connection.createNClob();
    }

}


text:
Sub-Units

       {{'Add New Sub-Unit' | translate}}

        <input type="text" value="{{subdepartment.name}}" ng-model="subdepartment.name" class="form-control col-lg-6" placeholder="{{'Add New Sub-Department' | translate}}" />

        <select class="form-control col-lg-6" ng-options="department.name | translate for department in departments track by department.id"  ng-model="subdepartment.department"></select>

        <button class="btn btn-primary" type="button" ng-click="save(subdepartment)" translate>Add</button>

        Name
        Unit

        {{subdepartment.name}}
        {{subdepartment.department.name}}


text:
<?php

namespace GitList\Controller;

use Silex\Application;
use Silex\ControllerProviderInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;

class MainController implements ControllerProviderInterface
{
    public function connect(Application $app)
    {
        $route = $app['controllers_factory'];

        $route->get('/', function() use ($app) {
            $repositories = $app['git']->getRepositories($app['git.repos']);

            return $app['twig']->render('index.twig', array(
                'repositories'   => $repositories,
            ));
        })->bind('homepage');

        $route->get('/refresh', function(Request $request) use ($app ) {
            # Go back to calling page
            return $app->redirect($request->headers->get('Referer'));
        })->bind('refresh');

        $route->get('{repo}/stats/{branch}', function($repo, $branch) use ($app) {
            $repository = $app['git']->getRepositoryFromName($app['git.repos'], $repo);

            if ($branch === null) {
                $branch = $repository->getHead();
            }

            $stats = $repository->getStatistics($branch);
            $authors = $repository->getAuthorStatistics($branch);

            return $app['twig']->render('stats.twig', array(
                'repo'           => $repo,
                'branch'         => $branch,
                'branches'       => $repository->getBranches(),
                'tags'           => $repository->getTags(),
                'stats'          => $stats,
                'authors'        => $authors,
            ));
        })->assert('repo', $app['util.routing']->getRepositoryRegex())
          ->assert('branch', $app['util.routing']->getBranchRegex())
          ->value('branch', null)
          ->bind('stats');

        $route->get('{repo}/{branch}/rss/', function($repo, $branch) use ($app) {
            $repository = $app['git']->getRepositoryFromName($app['git.repos'], $repo);

            if ($branch === null) {
                $branch = $repository->getHead();
            }

            $commits = $repository->getPaginatedCommits($branch);

            $html = $app['twig']->render('rss.twig', array(
                'repo'           => $repo,
                'branch'         => $branch,
                'commits'        => $commits,
            ));

            return new Response($html, 200, array('Content-Type' => 'application/rss+xml'));
        })->assert('repo', $app['util.routing']->getRepositoryRegex())
          ->assert('branch', $app['util.routing']->getBranchRegex())
          ->value('branch', null)
          ->bind('rss');

        return $route;
    }
}


text:
package org.mafagafogigante.dungeon.gui;

import org.mafagafogigante.dungeon.game.DungeonString;

import org.junit.Assert;
import org.junit.Test;

import javax.swing.JTextPane;
import javax.swing.text.Document;

public class SwappingStyledDocumentTest {

  @Test
  public void testWriteShouldSwapBetweenTwoDocuments() throws Exception {
    JTextPane jTextPane = new JTextPane();
    SwappingStyledDocument swappingStyledDocument = new SwappingStyledDocument(jTextPane);
    Document firstDocument = jTextPane.getStyledDocument();
    swappingStyledDocument.write(new DungeonString("A"), new WritingSpecifications(false, 0));
    Document secondDocument = jTextPane.getStyledDocument();
    swappingStyledDocument.write(new DungeonString("B"), new WritingSpecifications(false, 0));
    Document thirdDocument = jTextPane.getStyledDocument();
    Assert.assertNotEquals(firstDocument, secondDocument);
    Assert.assertEquals(firstDocument, thirdDocument);
  }

  @Test
  public void testClearShouldEraseEverythingInTheTextPane() throws Exception {
    JTextPane jTextPane = new JTextPane();
    SwappingStyledDocument swappingStyledDocument = new SwappingStyledDocument(jTextPane);
    swappingStyledDocument.write(new DungeonString("."), new WritingSpecifications(false, 0));
    Assert.assertNotEquals(jTextPane.getText().length(), 0);
    swappingStyledDocument.clear();
    Assert.assertEquals(jTextPane.getText().length(), 0);
  }

}


text:
from __future__ import print_function

import os
import sys
import time
from collections import defaultdict

import pytest
from process_tests import dump_on_error
from process_tests import TestProcess
from process_tests import wait_for_strings
from redis import StrictRedis

from redis_lock import Lock, AlreadyAcquired, NotAcquired, InterruptableThread
from redis_lock import reset_all

from conf import TIMEOUT
from conf import UDS_PATH
from conf import HELPER

@pytest.yield_fixture
def redis_server(scope='module'):
    try:
        os.unlink(UDS_PATH)
    except OSError:
        pass
    with TestProcess('redis-server', '--port', '0', '--unixsocket', UDS_PATH) as process:
        wait_for_strings(process.read, TIMEOUT, "Running")
        yield process

@pytest.fixture(scope='function')
def conn(redis_server):
    return StrictRedis(unix_socket_path=UDS_PATH)

def test_simple(redis_server):
    with TestProcess(sys.executable, HELPER, 'test_simple') as proc:
        with dump_on_error(proc.read):
            name = 'lock:foobar'
            wait_for_strings(
                proc.read, TIMEOUT,
                'Getting %r ...' % name,
                'Got lock for %r.' % name,
                'Releasing %r.' % name,
                'UNLOCK_SCRIPT not cached.',
                'DIED.',
            )

def test_no_block(conn):
    with Lock(conn, "foobar"):
        with TestProcess(sys.executable, HELPER, 'test_no_block') as proc:
            with dump_on_error(proc.read):
                name = 'lock:foobar'
                wait_for_strings(
                    proc.read, TIMEOUT,
                    'Getting %r ...' % name,
                    'Failed to get %r.' % name,
                    'acquire=>False',
                    'DIED.',
                )

def test_expire(conn):
    with Lock(conn, "foobar", expire=TIMEOUT/4):
        with TestProcess(sys.executable, HELPER, 'test_expire') as proc:
            with dump_on_error(proc.read):
                name = 'lock:foobar'
                wait_for_strings(
                    proc.read, TIMEOUT,
                    'Getting %r ...' % name,
                    'Got lock for %r.' % name,
                    'Releasing %r.' % name,
                    'UNLOCK_SCRIPT not cached.',
                    'DIED.',
                )
    lock = Lock(conn, "foobar")
    try:
        assert lock.acquire(blocking=False) == True
    finally:
        lock.release()

def test_double_acquire(conn):
    lock = Lock(conn, "foobar")
    with lock:
        pytest.raises(RuntimeError, lock.acquire)
        pytest.raises(AlreadyAcquired, lock.acquire)

def test_plain(conn):
    with Lock(conn, "foobar"):
        time.sleep(0.01)

def test_no_overlap(redis_server):
    with TestProcess(sys.executable, HELPER, 'test_no_overlap') as proc:
        with dump_on_error(proc.read):
            name = 'lock:foobar'
            wait_for_strings(proc.read, TIMEOUT, 'Getting %r ...' % name)
            wait_for_strings(proc.read, TIMEOUT, 'Got lock for %r.' % name)
            wait_for_strings(proc.read, TIMEOUT, 'Releasing %r.' % name)
            wait_for_strings(proc.read, TIMEOUT, 'UNLOCK_SCRIPT not cached.')
            wait_for_strings(proc.read, 10*TIMEOUT, 'DIED.')

            class Event(object):
                pid = start = end = '?'

                def __str__(self):
                    return "Event(%s; %r => %r)" % (self.pid, self.start, self.end)

            events = defaultdict(Event)
            for line in proc.read().splitlines():
                try:
                    pid, time, junk = line.split(' ', 2)
                    pid = int(pid)
                except ValueError:
                    continue
                if 'Got lock for' in junk:
                    events[pid].pid = pid
                    events[pid].start = time
                if 'Releasing' in junk:
                    events[pid].pid = pid
                    events[pid].end = time
            assert len(events) == 125

            for event in events.values():
                for other in events.values():
                    if other is not event:
                        try:
                            if other.start < event.start < other.end or \
                               other.start < event.end < other.end:
                                pytest.fail('%s overlaps %s' % (event, other))
                        except:
                            print("[%s/%s]" % (event, other))
                            raise

def test_reset(conn):
    with Lock(conn, "foobar") as lock:
        lock.reset()
        new_lock = Lock(conn, "foobar")
        new_lock.acquire(blocking=False)
        new_lock.release()

def test_reset_all(conn):
    lock1 = Lock(conn, "foobar1")
    lock2 = Lock(conn, "foobar2")
    lock1.acquire(blocking=False)
    lock2.acquire(blocking=False)
    reset_all(conn)
    lock1 = Lock(conn, "foobar1")
    lock2 = Lock(conn, "foobar2")
    lock1.acquire(blocking=False)
    lock2.acquire(blocking=False)
    lock1.release()
    lock2.release()

def test_owner_id(conn):
    unique_identifier = b"foobar-identifier"
    lock = Lock(conn, "foobar-tok", expire=TIMEOUT/4, id=unique_identifier)
    lock_id = lock.id
    assert lock_id == unique_identifier
    lock.acquire(blocking=False)
    assert lock.get_owner_id() == unique_identifier
    lock.release()

def test_token(conn):
    lock = Lock(conn, "foobar-tok")
    tok = lock.id
    assert conn.get(lock._name) is None
    lock.acquire(blocking=False)
    assert conn.get(lock._name) == tok

def test_bogus_release(conn):
    lock = Lock(conn, "foobar-tok")
    pytest.raises(NotAcquired, lock.release)
    lock.release(force=True)

def test_release_from_nonblocking_leaving_garbage(conn):
    for _ in range(10):
        lock = Lock(conn, 'release_from_nonblocking')
        lock.acquire(blocking=False)
        lock.release()
        assert conn.llen('lock-signal:release_from_nonblocking') == 1

def test_no_auto_renewal(conn):
    lock = Lock(conn, 'lock_renewal', expire=3, auto_renewal=False)
    assert lock._lock_renewal_interval is None
    lock.acquire()
    assert lock._lock_renewal_thread is None, "No lock refresh thread should have been spawned"

def test_auto_renewal_bad_values(conn):
    with pytest.raises(ValueError):
        Lock(conn, 'lock_renewal', expire=None, auto_renewal=True)

def test_auto_renewal(conn):
    lock = Lock(conn, 'lock_renewal', expire=3, auto_renewal=True)
    lock.acquire()

    assert isinstance(lock._lock_renewal_thread, InterruptableThread)
    assert not lock._lock_renewal_thread.should_exit
    assert lock._lock_renewal_interval == 2

    time.sleep(3)
    assert conn.get(lock._name) == lock.id, "Key expired but it should have been getting renewed"

    lock.release()
    assert lock._lock_renewal_thread is None


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Ann. Rep. N. Y. St. Mus. 46: 135 (1894)

#### Original name
Psilocybe squalidella var. caespitosa Peck

### Remarks
null