text:
package org.bouncycastle.asn1.x509;

import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;

import org.bouncycastle.asn1.ASN1Encodable;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1ObjectIdentifier;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.ASN1TaggedObject;
import org.bouncycastle.asn1.DERSequence;

/**
 *

 *     Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
 *
 *     Extension         ::=   SEQUENCE {
 *        extnId            EXTENSION.&id ({ExtensionSet}),
 *        critical          BOOLEAN DEFAULT FALSE,
 *        extnValue         OCTET STRING }
 *

 */
public class Extensions
    extends ASN1Object
{
    private Hashtable extensions = new Hashtable();
    private Vector ordering = new Vector();

    public static Extension getExtension(Extensions extensions, ASN1ObjectIdentifier oid)
    {
        return null == extensions ? null : extensions.getExtension(oid);
    }

    public static ASN1Encodable getExtensionParsedValue(Extensions extensions, ASN1ObjectIdentifier oid)
    {
        return null == extensions ? null : extensions.getExtensionParsedValue(oid);
    }

    public static Extensions getInstance(
        ASN1TaggedObject obj,
        boolean explicit)
    {
        return getInstance(ASN1Sequence.getInstance(obj, explicit));
    }

    public static Extensions getInstance(
        Object obj)
    {
        if (obj instanceof Extensions)
        {
            return (Extensions)obj;
        }
        else if (obj != null)
        {
            return new Extensions(ASN1Sequence.getInstance(obj));
        }

        return null;
    }

    /**
     * Constructor from ASN1Sequence.
     *

     * The extensions are a list of constructed sequences, either with (OID, OctetString) or (OID, Boolean, OctetString)
     *

     */
    private Extensions(
        ASN1Sequence seq)
    {
        Enumeration e = seq.getObjects();

        while (e.hasMoreElements())
        {
            Extension ext = Extension.getInstance(e.nextElement());

            if (extensions.containsKey(ext.getExtnId()))
            {
                throw new IllegalArgumentException("repeated extension found: " + ext.getExtnId());
            }

            extensions.put(ext.getExtnId(), ext);
            ordering.addElement(ext.getExtnId());
        }
    }

    /**
     * Base Constructor
     *
     * @param extension a single extension.
     */
    public Extensions(
        Extension extension)
    {
        this.ordering.addElement(extension.getExtnId());
        this.extensions.put(extension.getExtnId(), extension);
    }

    /**
     * Base Constructor
     *
     * @param extensions an array of extensions.
     */
    public Extensions(
        Extension[] extensions)
    {
        for (int i = 0; i != extensions.length; i++)
        {
            Extension ext = extensions[i];

            this.ordering.addElement(ext.getExtnId());
            this.extensions.put(ext.getExtnId(), ext);
        }
    }

    /**
     * return an Enumeration of the extension field's object ids.
     */
    public Enumeration oids()
    {
        return ordering.elements();
    }

    /**
     * return the extension represented by the object identifier
     * passed in.
     *
     * @return the extension if it's present, null otherwise.
     */
    public Extension getExtension(
        ASN1ObjectIdentifier oid)
    {
        return (Extension)extensions.get(oid);
    }

    /**
     * return the parsed value of the extension represented by the object identifier
     * passed in.
     *
     * @return the parsed value of the extension if it's present, null otherwise.
     */
    public ASN1Encodable getExtensionParsedValue(ASN1ObjectIdentifier oid)
    {
        Extension ext = this.getExtension(oid);

        if (ext != null)
        {
            return ext.getParsedValue();
        }

        return null;
    }

    /**
     *

     *     Extensions        ::=   SEQUENCE SIZE (1..MAX) OF Extension
     *
     *     Extension         ::=   SEQUENCE {
     *        extnId            EXTENSION.&id ({ExtensionSet}),
     *        critical          BOOLEAN DEFAULT FALSE,
     *        extnValue         OCTET STRING }
     *

     */
    public ASN1Primitive toASN1Primitive()
    {
        ASN1EncodableVector vec = new ASN1EncodableVector(ordering.size());

        Enumeration e = ordering.elements();
        while (e.hasMoreElements())
        {
            ASN1ObjectIdentifier oid = (ASN1ObjectIdentifier)e.nextElement();
            Extension ext = (Extension)extensions.get(oid);

            vec.add(ext);
        }

        return new DERSequence(vec);
    }

    public boolean equivalent(
        Extensions other)
    {
        if (extensions.size() != other.extensions.size())
        {
            return false;
        }

        Enumeration e1 = extensions.keys();

        while (e1.hasMoreElements())
        {
            Object key = e1.nextElement();

            if (!extensions.get(key).equals(other.extensions.get(key)))
            {
                return false;
            }
        }

        return true;
    }

    public ASN1ObjectIdentifier[] getExtensionOIDs()
    {
        return toOidArray(ordering);
    }

    public ASN1ObjectIdentifier[] getNonCriticalExtensionOIDs()
    {
        return getExtensionOIDs(false);
    }

    public ASN1ObjectIdentifier[] getCriticalExtensionOIDs()
    {
        return getExtensionOIDs(true);
    }

    private ASN1ObjectIdentifier[] getExtensionOIDs(boolean isCritical)
    {
        Vector oidVec = new Vector();

        for (int i = 0; i != ordering.size(); i++)
        {
            Object oid = ordering.elementAt(i);

            if (((Extension)extensions.get(oid)).isCritical() == isCritical)
            {
                oidVec.addElement(oid);
            }
        }

        return toOidArray(oidVec);
    }

    private ASN1ObjectIdentifier[] toOidArray(Vector oidVec)
    {
        ASN1ObjectIdentifier[] oids = new ASN1ObjectIdentifier[oidVec.size()];

        for (int i = 0; i != oids.length; i++)
        {
            oids[i] = (ASN1ObjectIdentifier)oidVec.elementAt(i);
        }
        return oids;
    }
}


text:
"""
The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, ...

1 is read off as "one 1" or 11.
11 is read off as "two 1s" or 21.
21 is read off as "one 2, then one 1" or 1211.
Given an integer n, generate the nth sequence.

Note: The sequence of integers will be represented as a string.
"""

class Solution:
    # @param {integer} n
    # @return {string}
    def countAndSay(self, n):
        if n < 1:
            return ''
        result = '1'

        i = 2
        while i <= n:
            temp, count, prev = '', 1, result[0]
            j = 1
            while j < len(result):
                if result[j] == prev:
                    count += 1
                else:
                    temp += str(count)
                    temp += prev
                    count = 1
                    prev = result[j]
                j += 1
            temp += str(count)
            temp += prev
            result = temp
            i += 1

        return result

redpajama_set_name: RedPajamaGithub


text:
package so.blacklight.swarm.smtp

/**
  *
  */
case class SMTPConfig(listenPort: Short, ssl: Boolean)


text:
#ifdef HAVE_CONFIG_H
#include "../../../ext_config.h"
#endif

#include <php.h>
#include "../../../php_ext.h"
#include "../../../ext.h"

#include <Zend/zend_operators.h>
#include <Zend/zend_exceptions.h>
#include <Zend/zend_interfaces.h>

#include "kernel/main.h"
#include "kernel/array.h"
#include "kernel/exception.h"
#include "kernel/fcall.h"
#include "kernel/memory.h"
#include "kernel/object.h"
#include "kernel/operators.h"
#include "kernel/concat.h"
#include "kernel/time.h"
#include "kernel/iterator.h"
#include "kernel/hash.h"

/**
 * Phalcon\Cache\Backend\Mongo
 *
 * Allows to cache output fragments, PHP data or raw data to a MongoDb backend
 *
 *
 *
 * // Cache data for 2 days
 * $frontCache = new \Phalcon\Cache\Frontend\Base64(array(
 *		"lifetime" => 172800
 * ));
 *
 * //Create a MongoDB cache
 * $cache = new \Phalcon\Cache\Backend\Mongo($frontCache, array(
 *		'server' => "mongodb://localhost",
 *      'db' => 'caches',
 *		'collection' => 'images'
 * ));
 *
 * //Cache arbitrary data
 * $cache->save('my-data', file_get_contents('some-image.jpg'));
 *
 * //Get data
 * $data = $cache->get('my-data');
 *
 *
 */
ZEPHIR_INIT_CLASS(Phalcon_Cache_Backend_Mongo) {

	ZEPHIR_REGISTER_CLASS_EX(Phalcon\\Cache\\Backend, Mongo, phalcon, cache_backend_mongo, phalcon_cache_backend_ce, phalcon_cache_backend_mongo_method_entry, 0);

	zend_declare_property_null(phalcon_cache_backend_mongo_ce, SL("_collection"), ZEND_ACC_PROTECTED TSRMLS_CC);

	zend_class_implements(phalcon_cache_backend_mongo_ce TSRMLS_CC, 1, phalcon_cache_backendinterface_ce);
	return SUCCESS;

}

/**
 * Phalcon\Cache\Backend\Mongo constructor
 *
 * @param Phalcon\Cache\FrontendInterface frontend
 * @param array options
 */
PHP_METHOD(Phalcon_Cache_Backend_Mongo, __construct) {

	int ZEPHIR_LAST_CALL_STATUS;
	zephir_fcall_cache_entry *_0 = NULL;
	zval *frontend, *options = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &frontend, &options);

	if (!options) {
		options = ZEPHIR_GLOBAL(global_null);
	}

	if (!(zephir_array_isset_string(options, SS("mongo")))) {
		if (!(zephir_array_isset_string(options, SS("server")))) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The parameter 'server' is required", "phalcon/cache/backend/mongo.zep", 70);
			return;
		}
	}
	if (!(zephir_array_isset_string(options, SS("db")))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The parameter 'db' is required", "phalcon/cache/backend/mongo.zep", 75);
		return;
	}
	if (!(zephir_array_isset_string(options, SS("collection")))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The parameter 'collection' is required", "phalcon/cache/backend/mongo.zep", 79);
		return;
	}
	ZEPHIR_CALL_PARENT(NULL, phalcon_cache_backend_mongo_ce, this_ptr, "__construct", &_0, 36, frontend, options);
	zephir_check_call_status();
	ZEPHIR_MM_RESTORE();

}

/**
 * Returns a MongoDb collection based on the backend parameters
 *
 * @return MongoCollection
 */
PHP_METHOD(Phalcon_Cache_Backend_Mongo, _getCollection) {

	int ZEPHIR_LAST_CALL_STATUS;
	zend_bool _0;
	zval *options, *mongo = NULL, *server, *database, *collection, *mongoCollection = NULL, *_1 = NULL;

	ZEPHIR_MM_GROW();

	ZEPHIR_OBS_VAR(mongoCollection);
	zephir_read_property_this(&mongoCollection, this_ptr, SL("_collection"), PH_NOISY_CC);
	if (Z_TYPE_P(mongoCollection) != IS_OBJECT) {
		ZEPHIR_OBS_VAR(options);
		zephir_read_property_this(&options, this_ptr, SL("_options"), PH_NOISY_CC);
		ZEPHIR_OBS_VAR(mongo);
		if (zephir_array_isset_string_fetch(&mongo, options, SS("mongo"), 0 TSRMLS_CC)) {
			if (Z_TYPE_P(mongo) != IS_OBJECT) {
				ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The 'mongo' parameter must be a valid Mongo instance", "phalcon/cache/backend/mongo.zep", 104);
				return;
			}
		} else {
			ZEPHIR_OBS_VAR(server);
			zephir_array_fetch_string(&server, options, SL("server"), PH_NOISY, "phalcon/cache/backend/mongo.zep", 112 TSRMLS_CC);
			_0 = !zephir_is_true(server);
			if (!(_0)) {
				_0 = Z_TYPE_P(server) != IS_STRING;
			}
			if (_0) {
				ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The backend requires a valid MongoDB connection string", "phalcon/cache/backend/mongo.zep", 114);
				return;
			}
			ZEPHIR_INIT_NVAR(mongo);
			object_init_ex(mongo, zephir_get_internal_ce(SS("mongoclient") TSRMLS_CC));
			ZEPHIR_CALL_METHOD(NULL, mongo, "__construct", NULL, 0, server);
			zephir_check_call_status();
		}
		ZEPHIR_OBS_VAR(database);
		zephir_array_fetch_string(&database, options, SL("db"), PH_NOISY, "phalcon/cache/backend/mongo.zep", 123 TSRMLS_CC);
		_0 = !zephir_is_true(database);
		if (!(_0)) {
			_0 = Z_TYPE_P(database) != IS_STRING;
		}
		if (_0) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The backend requires a valid MongoDB db", "phalcon/cache/backend/mongo.zep", 125);
			return;
		}
		ZEPHIR_OBS_VAR(collection);
		zephir_array_fetch_string(&collection, options, SL("collection"), PH_NOISY, "phalcon/cache/backend/mongo.zep", 131 TSRMLS_CC);
		_0 = !zephir_is_true(collection);
		if (!(_0)) {
			_0 = Z_TYPE_P(collection) != IS_STRING;
		}
		if (_0) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The backend requires a valid MongoDB collection", "phalcon/cache/backend/mongo.zep", 133);
			return;
		}
		ZEPHIR_CALL_METHOD(&_1, mongo, "selectdb", NULL, 0, database);
		zephir_check_call_status();
		ZEPHIR_CALL_METHOD(&mongoCollection, _1, "selectcollection", NULL, 0, collection);
		zephir_check_call_status();
		zephir_update_property_this(this_ptr, SL("_collection"), mongoCollection TSRMLS_CC);
	}
	RETURN_CCTOR(mongoCollection);

}

/**
 * Returns a cached content
 *
 * @param int|string keyName
 * @param   long lifetime
 * @return  mixed
 */
PHP_METHOD(Phalcon_Cache_Backend_Mongo, get) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *_1;
	zval *keyName, *lifetime = NULL, *frontend, *prefixedKey, *conditions, *document = NULL, *cachedContent, *_0, *_2, *_3 = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &keyName, &lifetime);

	if (!lifetime) {
		lifetime = ZEPHIR_GLOBAL(global_null);
	}

	ZEPHIR_INIT_VAR(conditions);
	array_init(conditions);
	ZEPHIR_OBS_VAR(frontend);
	zephir_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC);
	_0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC);
	ZEPHIR_INIT_VAR(prefixedKey);
	ZEPHIR_CONCAT_VV(prefixedKey, _0, keyName);
	zephir_update_property_this(this_ptr, SL("_lastKey"), prefixedKey TSRMLS_CC);
	zephir_array_update_string(&conditions, SL("key"), &prefixedKey, PH_COPY | PH_SEPARATE);
	ZEPHIR_INIT_VAR(_1);
	zephir_create_array(_1, 1, 0 TSRMLS_CC);
	ZEPHIR_INIT_VAR(_2);
	zephir_time(_2);
	zephir_array_update_string(&_1, SL("$gt"), &_2, PH_COPY | PH_SEPARATE);
	zephir_array_update_string(&conditions, SL("time"), &_1, PH_COPY | PH_SEPARATE);
	ZEPHIR_CALL_METHOD(&_3, this_ptr, "_getcollection", NULL, 39);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(&document, _3, "findone", NULL, 0, conditions);
	zephir_check_call_status();
	if (Z_TYPE_P(document) == IS_ARRAY) {
		ZEPHIR_OBS_VAR(cachedContent);
		if (zephir_array_isset_string_fetch(&cachedContent, document, SS("data"), 0 TSRMLS_CC)) {
			if (zephir_is_numeric(cachedContent)) {
				RETURN_CCTOR(cachedContent);
			}
			ZEPHIR_RETURN_CALL_METHOD(frontend, "afterretrieve", NULL, 0, cachedContent);
			zephir_check_call_status();
			RETURN_MM();
		} else {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The cache is corrupt", "phalcon/cache/backend/mongo.zep", 173);
			return;
		}
	}
	RETURN_MM_NULL();

}

/**
 * Stores cached content into the file backend and stops the frontend
 *
 * @param int|string keyName
 * @param string content
 * @param long lifetime
 * @param boolean stopBuffer
 */
PHP_METHOD(Phalcon_Cache_Backend_Mongo, save) {

	zval *_1;
	int ZEPHIR_LAST_CALL_STATUS;
	zend_bool stopBuffer;
	zval *keyName = NULL, *content = NULL, *lifetime = NULL, *stopBuffer_param = NULL, *lastkey = NULL, *prefix, *frontend, *cachedContent = NULL, *tmp, *ttl = NULL, *collection = NULL, *timestamp, *conditions, *document = NULL, *preparedContent = NULL, *isBuffering = NULL, *data, *_0, *_2;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 0, 4, &keyName, &content, &lifetime, &stopBuffer_param);

	if (!keyName) {
		keyName = ZEPHIR_GLOBAL(global_null);
	}
	if (!content) {
		content = ZEPHIR_GLOBAL(global_null);
	}
	if (!lifetime) {
		lifetime = ZEPHIR_GLOBAL(global_null);
	}
	if (!stopBuffer_param) {
		stopBuffer = 1;
	} else {
		stopBuffer = zephir_get_boolval(stopBuffer_param);
	}

	ZEPHIR_INIT_VAR(conditions);
	array_init(conditions);
	ZEPHIR_INIT_VAR(data);
	array_init(data);
	if (!(zephir_is_true(keyName))) {
		ZEPHIR_OBS_VAR(lastkey);
		zephir_read_property_this(&lastkey, this_ptr, SL("_lastKey"), PH_NOISY_CC);
	} else {
		ZEPHIR_OBS_VAR(prefix);
		zephir_read_property_this(&prefix, this_ptr, SL("_prefix"), PH_NOISY_CC);
		ZEPHIR_INIT_NVAR(lastkey);
		ZEPHIR_CONCAT_VV(lastkey, prefix, keyName);
	}
	if (!(zephir_is_true(lastkey))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "Cache must be started first", "phalcon/cache/backend/mongo.zep", 205);
		return;
	}
	ZEPHIR_OBS_VAR(frontend);
	zephir_read_property_this(&frontend, this_ptr, SL("_frontend"), PH_NOISY_CC);
	if (!(zephir_is_true(content))) {
		ZEPHIR_CALL_METHOD(&cachedContent, frontend, "getcontent", NULL, 0);
		zephir_check_call_status();
	} else {
		ZEPHIR_CPY_WRT(cachedContent, content);
	}
	if (!(zephir_is_numeric(cachedContent))) {
		ZEPHIR_CALL_METHOD(&preparedContent, frontend, "beforestore", NULL, 0, cachedContent);
		zephir_check_call_status();
	}
	if (!(zephir_is_true(lifetime))) {
		ZEPHIR_OBS_VAR(tmp);
		zephir_read_property_this(&tmp, this_ptr, SL("_lastLifetime"), PH_NOISY_CC);
		if (!(zephir_is_true(tmp))) {
			ZEPHIR_CALL_METHOD(&ttl, frontend, "getlifetime", NULL, 0);
			zephir_check_call_status();
		} else {
			ZEPHIR_CPY_WRT(ttl, tmp);
		}
	} else {
		ZEPHIR_CPY_WRT(ttl, lifetime);
	}
	ZEPHIR_CALL_METHOD(&collection, this_ptr, "_getcollection", NULL, 39);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_0);
	zephir_time(_0);
	ZEPHIR_INIT_VAR(timestamp);
	ZVAL_LONG(timestamp, (zephir_get_numberval(_0) + zephir_get_intval(ttl)));
	zephir_array_update_string(&conditions, SL("key"), &lastkey, PH_COPY | PH_SEPARATE);
	ZEPHIR_CALL_METHOD(&document, collection, "findone", NULL, 0, conditions);
	zephir_check_call_status();
	if (Z_TYPE_P(document) == IS_ARRAY) {
		zephir_array_update_string(&document, SL("time"), &timestamp, PH_COPY | PH_SEPARATE);
		if (!(zephir_is_numeric(cachedContent))) {
			zephir_array_update_string(&document, SL("data"), &preparedContent, PH_COPY | PH_SEPARATE);
		} else {
			zephir_array_update_string(&document, SL("data"), &cachedContent, PH_COPY | PH_SEPARATE);
		}
		ZEPHIR_INIT_VAR(_1);
		zephir_create_array(_1, 1, 0 TSRMLS_CC);
		ZEPHIR_OBS_VAR(_2);
		zephir_array_fetch_string(&_2, document, SL("_id"), PH_NOISY, "phalcon/cache/backend/mongo.zep", 245 TSRMLS_CC);
		zephir_array_update_string(&_1, SL("_id"), &_2, PH_COPY | PH_SEPARATE);
		ZEPHIR_CALL_METHOD(NULL, collection, "update", NULL, 0, _1, document);
		zephir_check_call_status();
	} else {
		zephir_array_update_string(&data, SL("key"), &lastkey, PH_COPY | PH_SEPARATE);
		zephir_array_update_string(&data, SL("time"), &timestamp, PH_COPY | PH_SEPARATE);
		if (!(zephir_is_numeric(cachedContent))) {
			zephir_array_update_string(&data, SL("data"), &preparedContent, PH_COPY | PH_SEPARATE);
		} else {
			zephir_array_update_string(&data, SL("data"), &cachedContent, PH_COPY | PH_SEPARATE);
		}
		ZEPHIR_CALL_METHOD(NULL, collection, "insert", NULL, 0, data);
		zephir_check_call_status();
	}
	ZEPHIR_CALL_METHOD(&isBuffering, frontend, "isbuffering", NULL, 0);
	zephir_check_call_status();
	if (stopBuffer == 1) {
		ZEPHIR_CALL_METHOD(NULL, frontend, "stop", NULL, 0);
		zephir_check_call_status();
	}
	if (ZEPHIR_IS_TRUE_IDENTICAL(isBuffering)) {
		zend_print_zval(cachedContent, 0);
	}
	zephir_update_property_this(this_ptr, SL("_started"), (0) ? ZEPHIR_GLOBAL(global_true) : ZEPHIR_GLOBAL(global_false) TSRMLS_CC);
	ZEPHIR_MM_RESTORE();

}

/**
 * Deletes a value from the cache by its key
 *
 * @param int|string keyName
 * @return boolean
 */
PHP_METHOD(Phalcon_Cache_Backend_Mongo, delete) {

	zval *_1;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *keyName, *_0 = NULL, *_2, *_3, *_4 = NULL;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 0, &keyName);

	ZEPHIR_CALL_METHOD(&_0, this_ptr, "_getcollection", NULL, 39);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_1);
	zephir_create_array(_1, 1, 0 TSRMLS_CC);
	_2 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC);
	ZEPHIR_INIT_VAR(_3);
	ZEPHIR_CONCAT_VV(_3, _2, keyName);
	zephir_array_update_string(&_1, SL("key"), &_3, PH_COPY | PH_SEPARATE);
	ZEPHIR_CALL_METHOD(NULL, _0, "remove", NULL, 0, _1);
	zephir_check_call_status();
	ZEPHIR_CALL_FUNCTION(&_4, "rand", NULL, 40);
	zephir_check_call_status();
	if (zephir_safe_mod_long_long(zephir_get_intval(_4), 100 TSRMLS_CC) == 0) {
		ZEPHIR_CALL_METHOD(NULL, this_ptr, "gc", NULL, 0);
		zephir_check_call_status();
	}
	RETURN_MM_BOOL(1);

}

/**
 * Query the existing cached keys
 *
 * @param string prefix
 * @return array
 */
PHP_METHOD(Phalcon_Cache_Backend_Mongo, queryKeys) {

	HashTable *_6;
	HashPosition _5;
	zend_object_iterator *_4;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *keys, *conditions, *_2, *_3;
	zval *prefix = NULL, *collection = NULL, *key = NULL, *item = NULL, *items = NULL, *value = NULL, *_0 = NULL, *_1, **_7;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 0, 1, &prefix);

	if (!prefix) {
		prefix = ZEPHIR_GLOBAL(global_null);
	}
	ZEPHIR_INIT_VAR(keys);
	array_init(keys);
	ZEPHIR_INIT_VAR(conditions);
	array_init(conditions);

	if (zephir_is_true(prefix)) {
		ZEPHIR_INIT_VAR(_0);
		object_init_ex(_0, zephir_get_internal_ce(SS("mongoregex") TSRMLS_CC));
		ZEPHIR_INIT_VAR(_1);
		ZEPHIR_CONCAT_SVS(_1, "/^", prefix, "/");
		ZEPHIR_CALL_METHOD(NULL, _0, "__construct", NULL, 0, _1);
		zephir_check_call_status();
		zephir_array_update_string(&conditions, SL("key"), &_0, PH_COPY | PH_SEPARATE);
	}
	ZEPHIR_INIT_VAR(_2);
	zephir_create_array(_2, 1, 0 TSRMLS_CC);
	ZEPHIR_INIT_NVAR(_0);
	zephir_time(_0);
	zephir_array_update_string(&_2, SL("$gt"), &_0, PH_COPY | PH_SEPARATE);
	zephir_array_update_string(&conditions, SL("time"), &_2, PH_COPY | PH_SEPARATE);
	ZEPHIR_CALL_METHOD(&collection, this_ptr, "_getcollection", NULL, 39);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_3);
	zephir_create_array(_3, 1, 0 TSRMLS_CC);
	add_assoc_long_ex(_3, SS("key"), 1);
	ZEPHIR_CALL_METHOD(&items, collection, "find", NULL, 0, conditions, _3);
	zephir_check_call_status();
	_4 = zephir_get_iterator(items TSRMLS_CC);
	_4->funcs->rewind(_4 TSRMLS_CC);
	for (;_4->funcs->valid(_4 TSRMLS_CC) == SUCCESS && !EG(exception); _4->funcs->move_forward(_4 TSRMLS_CC)) {
		{
			zval **ZEPHIR_TMP_ITERATOR_PTR;
			_4->funcs->get_current_data(_4, &ZEPHIR_TMP_ITERATOR_PTR TSRMLS_CC);
			ZEPHIR_CPY_WRT(item, (*ZEPHIR_TMP_ITERATOR_PTR));
		}
		zephir_is_iterable(item, &_6, &_5, 0, 0, "phalcon/cache/backend/mongo.zep", 317);
		for (
		  ; zephir_hash_get_current_data_ex(_6, (void**) &_7, &_5) == SUCCESS
		  ; zephir_hash_move_forward_ex(_6, &_5)
		) {
			ZEPHIR_GET_HMKEY(key, _6, _5);
			ZEPHIR_GET_HVALUE(value, _7);
			if (ZEPHIR_IS_STRING(key, "key")) {
				zephir_array_append(&keys, value, PH_SEPARATE, "phalcon/cache/backend/mongo.zep", 314);
			}
		}
	}
	_4->funcs->dtor(_4 TSRMLS_CC);
	RETURN_CTOR(keys);

}

/**
 * Checks if cache exists and it isn't expired
 *
 * @param string keyName
 * @param   long lifetime
 * @return boolean
 */
PHP_METHOD(Phalcon_Cache_Backend_Mongo, exists) {

	zval *_3, *_4;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *keyName = NULL, *lifetime = NULL, *lastKey = NULL, *_0, *_1 = NULL, *_2 = NULL, *_5;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 0, 2, &keyName, &lifetime);

	if (!keyName) {
		keyName = ZEPHIR_GLOBAL(global_null);
	}
	if (!lifetime) {
		lifetime = ZEPHIR_GLOBAL(global_null);
	}

	if (Z_TYPE_P(keyName) == IS_NULL) {
		ZEPHIR_OBS_VAR(lastKey);
		zephir_read_property_this(&lastKey, this_ptr, SL("_lastKey"), PH_NOISY_CC);
	} else {
		_0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC);
		ZEPHIR_INIT_NVAR(lastKey);
		ZEPHIR_CONCAT_VV(lastKey, _0, keyName);
	}
	if (zephir_is_true(lastKey)) {
		ZEPHIR_CALL_METHOD(&_1, this_ptr, "_getcollection", NULL, 39);
		zephir_check_call_status();
		ZEPHIR_INIT_VAR(_3);
		zephir_create_array(_3, 2, 0 TSRMLS_CC);
		zephir_array_update_string(&_3, SL("key"), &lastKey, PH_COPY | PH_SEPARATE);
		ZEPHIR_INIT_VAR(_4);
		zephir_create_array(_4, 1, 0 TSRMLS_CC);
		ZEPHIR_INIT_VAR(_5);
		zephir_time(_5);
		zephir_array_update_string(&_4, SL("$gt"), &_5, PH_COPY | PH_SEPARATE);
		zephir_array_update_string(&_3, SL("time"), &_4, PH_COPY | PH_SEPARATE);
		ZEPHIR_CALL_METHOD(&_2, _1, "count", NULL, 0, _3);
		zephir_check_call_status();
		RETURN_MM_BOOL(ZEPHIR_GT_LONG(_2, 0));
	}
	RETURN_MM_BOOL(0);

}

/**
 * gc
 * @return collection->remove(...)
 */
PHP_METHOD(Phalcon_Cache_Backend_Mongo, gc) {

	zval *_1, *_2;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *_0 = NULL, *_3;

	ZEPHIR_MM_GROW();

	ZEPHIR_CALL_METHOD(&_0, this_ptr, "_getcollection", NULL, 39);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_1);
	zephir_create_array(_1, 1, 0 TSRMLS_CC);
	ZEPHIR_INIT_VAR(_2);
	zephir_create_array(_2, 1, 0 TSRMLS_CC);
	ZEPHIR_INIT_VAR(_3);
	zephir_time(_3);
	zephir_array_update_string(&_2, SL("$lt"), &_3, PH_COPY | PH_SEPARATE);
	zephir_array_update_string(&_1, SL("time"), &_2, PH_COPY | PH_SEPARATE);
	ZEPHIR_RETURN_CALL_METHOD(_0, "remove", NULL, 0, _1);
	zephir_check_call_status();
	RETURN_MM();

}

/**
 * Increment of a given key by $value
 *
 * @param int|string keyName
 * @param   long value
 * @return  mixed
 */
PHP_METHOD(Phalcon_Cache_Backend_Mongo, increment) {

	zval *_2;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *keyName, *value = NULL, *prefixedKey, *document = NULL, *modifiedTime, *cachedContent, *incremented, *_0, *_1 = NULL, *_3;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &keyName, &value);

	if (!value) {
		ZEPHIR_INIT_VAR(value);
		ZVAL_LONG(value, 1);
	}

	_0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC);
	ZEPHIR_INIT_VAR(prefixedKey);
	ZEPHIR_CONCAT_VV(prefixedKey, _0, keyName);
	zephir_update_property_this(this_ptr, SL("_lastKey"), prefixedKey TSRMLS_CC);
	ZEPHIR_CALL_METHOD(&_1, this_ptr, "_getcollection", NULL, 39);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_2);
	zephir_create_array(_2, 1, 0 TSRMLS_CC);
	zephir_array_update_string(&_2, SL("key"), &prefixedKey, PH_COPY | PH_SEPARATE);
	ZEPHIR_CALL_METHOD(&document, _1, "findone", NULL, 0, _2);
	zephir_check_call_status();
	ZEPHIR_OBS_VAR(modifiedTime);
	if (!(zephir_array_isset_string_fetch(&modifiedTime, document, SS("time"), 0 TSRMLS_CC))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The cache is currupted", "phalcon/cache/backend/mongo.zep", 373);
		return;
	}
	ZEPHIR_INIT_VAR(_3);
	zephir_time(_3);
	if (ZEPHIR_LT(_3, modifiedTime)) {
		ZEPHIR_OBS_VAR(cachedContent);
		if (!(zephir_array_isset_string_fetch(&cachedContent, document, SS("data"), 0 TSRMLS_CC))) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The cache is currupted", "phalcon/cache/backend/mongo.zep", 382);
			return;
		}
		if (zephir_is_numeric(cachedContent)) {
			ZEPHIR_INIT_VAR(incremented);
			zephir_add_function_ex(incremented, cachedContent, value TSRMLS_CC);
			ZEPHIR_CALL_METHOD(NULL, this_ptr, "save", NULL, 0, prefixedKey, incremented);
			zephir_check_call_status();
			RETURN_CCTOR(incremented);
		}
	}
	RETURN_MM_NULL();

}

/**
 * Decrement of a given key by $value
 *
 * @param int|string $keyName
 * @param   long $value
 * @return  mixed
 */
PHP_METHOD(Phalcon_Cache_Backend_Mongo, decrement) {

	zval *_2;
	int ZEPHIR_LAST_CALL_STATUS;
	zval *keyName, *value = NULL, *prefixedKey, *document = NULL, *modifiedTime, *cachedContent, *decremented, *_0, *_1 = NULL, *_3;

	ZEPHIR_MM_GROW();
	zephir_fetch_params(1, 1, 1, &keyName, &value);

	if (!value) {
		ZEPHIR_INIT_VAR(value);
		ZVAL_LONG(value, 1);
	}

	_0 = zephir_fetch_nproperty_this(this_ptr, SL("_prefix"), PH_NOISY_CC);
	ZEPHIR_INIT_VAR(prefixedKey);
	ZEPHIR_CONCAT_VV(prefixedKey, _0, keyName);
	zephir_update_property_this(this_ptr, SL("_lastKey"), prefixedKey TSRMLS_CC);
	ZEPHIR_CALL_METHOD(&_1, this_ptr, "_getcollection", NULL, 39);
	zephir_check_call_status();
	ZEPHIR_INIT_VAR(_2);
	zephir_create_array(_2, 1, 0 TSRMLS_CC);
	zephir_array_update_string(&_2, SL("key"), &prefixedKey, PH_COPY | PH_SEPARATE);
	ZEPHIR_CALL_METHOD(&document, _1, "findone", NULL, 0, _2);
	zephir_check_call_status();
	ZEPHIR_OBS_VAR(modifiedTime);
	if (!(zephir_array_isset_string_fetch(&modifiedTime, document, SS("time"), 0 TSRMLS_CC))) {
		ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The cache is currupted", "phalcon/cache/backend/mongo.zep", 412);
		return;
	}
	ZEPHIR_INIT_VAR(_3);
	zephir_time(_3);
	if (ZEPHIR_LT(_3, modifiedTime)) {
		ZEPHIR_OBS_VAR(cachedContent);
		if (!(zephir_array_isset_string_fetch(&cachedContent, document, SS("data"), 0 TSRMLS_CC))) {
			ZEPHIR_THROW_EXCEPTION_DEBUG_STR(phalcon_cache_exception_ce, "The cache is currupted", "phalcon/cache/backend/mongo.zep", 421);
			return;
		}
		if (zephir_is_numeric(cachedContent)) {
			ZEPHIR_INIT_VAR(decremented);
			sub_function(decremented, cachedContent, value TSRMLS_CC);
			ZEPHIR_CALL_METHOD(NULL, this_ptr, "save", NULL, 0, prefixedKey, decremented);
			zephir_check_call_status();
			RETURN_CCTOR(decremented);
		}
	}
	RETURN_MM_NULL();

}

/**
 * Immediately invalidates all existing items.
 */
PHP_METHOD(Phalcon_Cache_Backend_Mongo, flush) {

	int ZEPHIR_LAST_CALL_STATUS;
	zval *_0 = NULL, *_1 = NULL;

	ZEPHIR_MM_GROW();

	ZEPHIR_CALL_METHOD(&_0, this_ptr, "_getcollection", NULL, 39);
	zephir_check_call_status();
	ZEPHIR_CALL_METHOD(NULL, _0, "remove", NULL, 0);
	zephir_check_call_status();
	ZEPHIR_CALL_FUNCTION(&_1, "rand", NULL, 40);
	zephir_check_call_status();
	if (zephir_safe_mod_long_long(zephir_get_intval(_1), 100 TSRMLS_CC) == 0) {
		ZEPHIR_CALL_METHOD(NULL, this_ptr, "gc", NULL, 0);
		zephir_check_call_status();
	}
	RETURN_MM_BOOL(1);

}


text:
{% extends "layout_multi_sections-lcc.html" %}

{% block page_title %}
	Maintenance programme
{% endblock %}

  {% block css_register %}
         <link href="{{ asset_path }}stylesheets/application.css" rel="stylesheet">
   {% endblock %}

{% block header %}
    Maintenance programme
{% endblock%}

 {% block main_nav %}
 {% endblock %}

 {% block sectionOneTop %}
{% endblock %}

{% block sectionOneFull%}
{% endblock %}

 {% block breadcrumb %}

        Home

Maintenance programme

 {% endblock %}

{% block sectionOneContent %}

{% endblock %}

{% block pageContent %}

    <form>
        <fieldset>
            <legend class="sr-only">Street register search</legend>

                        Show all works

                    OR

                        Show by ward
                        <select class="form-control" id="select-box" name="select-box">
                            <option value="All wards">All wards</option>
                            <option selected="selected" value="Adel and Wharfedale">Adel and Wharfedale</option>
                            <option value="Alwoodley">Alwoodley</option>
                            <option value="Ardsley and Robin Hood">Ardsley and Robin Hood</option>
                            <option value="Armley">Armley</option>
                            <option value="Beeston and Holbeck">Beeston and Holbeck</option>
                            <option value="Bramley and Stanningley">Bramley and Stanningley</option>
                            <option value="Burmantofts and Richmond Hill">Burmantofts and Richmond Hill</option>
                            <option value="Calverley and Farsley">Calverley and Farsley</option>
                            <option value="Chapel Allerton">Chapel Allerton</option>
                            <option value="City and Hunslet">City and Hunslet</option>
                            <option value="Farnley and Wortley">Farnley and Wortley</option>
                            <option value="Garforth and Swillington">Garforth and Swillington</option>
                            <option value="Gipton and Harehills">Gipton and Harehills</option>
                            <option value="Guiseley and Rawdon">Guiseley and Rawdon</option>
                            <option value="Harewood">Harewood</option>
                            <option value="Headingley">Headingley</option>
                            <option value="Horsforth">Horsforth</option>
                            <option value="Hyde Park and Woodhouse">Hyde Park and Woodhouse</option>
                            <option value="Killingbeck and Seacroft">Killingbeck and Seacroft</option>
                            <option value="Kippax and Methley">Kippax and Methley</option>
                            <option value="Kirkstall">Kirkstall</option>
                            <option value="Middleton Park">Middleton Park</option>
                            <option value="Moortown">Moortown</option>
                            <option value="Morley North">Morley North</option>
                            <option value="Morley South">Morley South</option>
                            <option value="Otley and Yeadon">Otley and Yeadon</option>
                            <option value="Pudsey">Pudsey</option>
                            <option value="Rothwell">Rothwell</option>
                            <option value="Roundhay">Roundhay</option>
                            <option value="Temple Newsam">Temple Newsam</option>
                            <option value="Weetwood">Weetwood</option>
                            <option value="Wetherby">Wetherby</option>
                        </select>

                    OR

                            Show by street Enter a street name. For example, 'Main Street'.
                            <input class="form-control" id="full-name-f1" type="text" name="full-name-f1">

                            <button id="showStreet" type="button" class="btn btn-secondary btn-small" value="Search for street">Search by street</button>

                                Promoter
                                Road
                                From - To
                                Nature of Works
                                Start Date
                                Duration

                                    Highways Maintenance
                                    ADEL
                                    Church La To Long Causeway
                                    Surface dressing
                                    Complete

                                    Highways Maintenance
                                    ADEL
                                    Church La To Long Causeway
                                    Surface dressing
                                    Early June
                                    9 weeks

                                    Highways Maintenance
                                    ADEL
                                    Church La To Long Causeway
                                    Surface dressing
                                    Complete

                                    Highways Maintenance
                                    ADEL
                                    Church La To Long Causeway
                                    Surface dressing
                                    Complete

                                    Highways Maintenance
                                    ADEL
                                    Church La To Long Causeway
                                    Surface dressing
                                    Early June
                                    9 weeks

                                Code
                                Treatment
                                Description

                                    C
                                    Carriageway
                                    The carriageway will either be covered with new material or the existing surface will be removed and replaced.

                                    C
                                    Carriageway
                                    The carriageway will either be covered with new material or the existing surface will be removed and replaced.

                                    C
                                    Carriageway
                                    The carriageway will either be covered with new material or the existing surface will be removed and replaced.

                                    C
                                    Carriageway
                                    The carriageway will either be covered with new material or the existing surface will be removed and replaced.

        </fieldset>
    </form>

{% endblock %}

{% block sectionOneFullBottom %}
{% endblock %}

{% block sectionOneRightHandColumn %}

{% endblock %}

{% block sectionOneThirdCol1 %}
 {% endblock %}

 {% block sectionOneThirdCol2 %}
 {% endblock %}

{% block sectionOneThirdCol3 %}
 {% endblock %}

{% block sectionTwoTop %}
{% endblock %}

{% block sectionTwoFull%}
{% endblock %}

{% block sectionTwoContent %}
{% endblock %}

{% block sectionTwoRightHandColumn %}
{% endblock %}

{% block sectionTwoThirdCol1 %}
 {% endblock %}

 {% block sectionTwoThirdCol2 %}
 {% endblock %}

{% block sectionTwoThirdCol3 %}
 {% endblock %}

{% block sectionThreeTop %}
{% endblock %}

{% block sectionThreeFull%}
{% endblock %}

{% block sectionThreeContent %}
{% endblock %}

{% block sectionThreeRightHandColumn %}
{% endblock %}

{% block sectionThreeThirdCol1 %}
 {% endblock %}

 {% block sectionThreeThirdCol2 %}
 {% endblock %}

{% block sectionThreeThirdCol3 %}
 {% endblock %}

{% block sectionFourTop %}
{% endblock %}

{% block sectionFourFull%}

{% endblock %}

{% block sectionFourContent %}
{% endblock %}

{% block sectionFourRightHandColumn %}
{% endblock %}

{% block sectionFourThirdCol1 %}
 {% endblock %}

 {% block sectionFourThirdCol2 %}
 {% endblock %}

{% block sectionFourThirdCol3 %}
 {% endblock %}

{% block sectionFiveTop %}

{% endblock %}

{% block sectionFiveFull%}
{% endblock %}

{% block sectionFiveContent %}
{% endblock %}

{% block sectionFiveRightHandColumn %}
{% endblock %}

{% block sectionFiveThirdCol1 %}
 {% endblock %}

 {% block sectionFiveThirdCol2 %}

 {% endblock %}

{% block sectionFiveThirdCol3 %}
 {% endblock %}

  {% block footer_nav %}
 {% endblock %}

  {% block reusablecontent_footer %}
     {% include "includes/reusable-content-footer.html" %}
 {% endblock %}


text:
package org.activiti.core.common.spring.identity;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;

public class ExtendedInMemoryUserDetailsManager extends InMemoryUserDetailsManager {

    private List<String> users = new ArrayList<>();
    private List<String> groups = new ArrayList<>();

    @Override
    public void createUser(UserDetails user) {
        super.createUser(user);
        users.add(user.getUsername());
        groups = user.getAuthorities().stream()
                .filter(x -> (x.getAuthority().contains("GROUP")))
                .map(x -> (x.getAuthority()))
                .collect(Collectors.toList());
    }

    public List<String> getUsers() {
        return users;
    }

    public List<String> getGroups() {
        return groups;
    }
}


text:
/* -*- Mode: javascript; tab-width: 4; indent-tabs-mode: nil; */

//--------MODULE HEADER----------
(function(GLOBAL) {
    //===============================
    $.Controller.extend("JmvcMachinery.Lid.Controllers.Textarea", {

    },
    {
        init: function(el, schema) {
            var that = this;
            var $el = $(el);
            this.$container = $el;

            var options = {
                name: schema.name,
                title: (schema.title || schema.name),
                rows: schema.lines
            };

            options = JmvcMachinery.Lid.SchemaTools.updateHtmlOptions(options, schema);
            options.Class = JmvcMachinery.Class.Add(JmvcMachinery.Lid.SchemaTools.getClassName(schema), options.Class);

            var viewModel = {
                fieldName: schema.name,
                options: options,
                type: 'text'
            };

            var inputField;
            $el.append("//jmvc_machinery/framework/lid/views/text_area.ejs", viewModel);
            inputField = $el.find('textarea');
            inputField.addClass("ui-corner-right");
            JmvcMachinery.Lid.Controllers.MixIns.ReadOnlyApi.mixIn(this, {
                inputElement: inputField
            });
            JmvcMachinery.Lid.Controllers.MixIns.StandardFocusApi.mixIn(this, {
                inputElement: inputField
            });

            var val = this.val = function(newValue) {
                //return unmasked
                var ret;
                if (newValue !== undefined) {
                    inputField.val(newValue);
                }
                ret = inputField.val();
                return ret.toUpperCase();
            };
            this.valDisplay = _(val).bind(this, undefined);
        }
    });

    //===============================
} (window, (function() {
    return;
} ())));
//===============================


text:
layout: post
title: Oversaturation
categories:  ビデオ アナログ
tags: [Analog, Video, Cable, Chrominance, Color, Hue, Operator Error, Tape Error, Time Base Corrector, Common Artifacts]
lang: 日本語
---

Oversaturation refers to high chrominance amplitude in a video signal, creating the appearance of very intense color in the image. Depending on severity of oversaturation, color in the image may appear to bleed into areas outside of an object's apparent boundaries. Most [NTSC](http://en.wikipedia.org/wiki/NTSC) broadcast standards require that the composite video signal not exceed 120 [IRE](http://en.wikipedia.org/wiki/IRE_(unit)) (flat). SMPTE split field color bars use 75% saturation as the maximum value for calibration, although there are other patterns used for testing which contain 100% saturation values.

## Can it be fixed?

Yes, oversaturation is correctable through retransfer and adjustment of the VTR output using a  processing amplifier to lower the chroma levels.

## Example(s)


text:
package runtime

import (
	"context"
	"testing"

	"github.com/stretchr/testify/assert"
	"github.com/traefik/traefik/v2/pkg/config/dynamic"
)

func TestGetUDPRoutersByEntryPoints(t *testing.T) {
	testCases := []struct {
		desc        string
		conf        dynamic.Configuration
		entryPoints []string
		expected    map[string]map[string]*UDPRouterInfo
	}{
		{
			desc:        "Empty Configuration without entrypoint",
			conf:        dynamic.Configuration{},
			entryPoints: []string{""},
			expected:    map[string]map[string]*UDPRouterInfo{},
		},
		{
			desc:        "Empty Configuration with unknown entrypoints",
			conf:        dynamic.Configuration{},
			entryPoints: []string{"foo"},
			expected:    map[string]map[string]*UDPRouterInfo{},
		},
		{
			desc: "Valid configuration with an unknown entrypoint",
			conf: dynamic.Configuration{
				HTTP: &dynamic.HTTPConfiguration{
					Routers: map[string]*dynamic.Router{
						"foo": {
							EntryPoints: []string{"web"},
							Service:     "foo-service@myprovider",
							Rule:        "Host(`bar.foo`)",
						},
					},
				},
				UDP: &dynamic.UDPConfiguration{
					Routers: map[string]*dynamic.UDPRouter{
						"foo": {
							EntryPoints: []string{"web"},
							Service:     "foo-service@myprovider",
						},
					},
				},
			},
			entryPoints: []string{"foo"},
			expected:    map[string]map[string]*UDPRouterInfo{},
		},
		{
			desc: "Valid configuration with a known entrypoint",
			conf: dynamic.Configuration{
				HTTP: &dynamic.HTTPConfiguration{
					Routers: map[string]*dynamic.Router{
						"foo": {
							EntryPoints: []string{"web"},
							Service:     "foo-service@myprovider",
						},
						"bar": {
							EntryPoints: []string{"webs"},
							Service:     "bar-service@myprovider",
						},
						"foobar": {
							EntryPoints: []string{"web", "webs"},
							Service:     "foobar-service@myprovider",
						},
					},
				},
				UDP: &dynamic.UDPConfiguration{
					Routers: map[string]*dynamic.UDPRouter{
						"foo": {
							EntryPoints: []string{"web"},
							Service:     "foo-service@myprovider",
						},
						"bar": {
							EntryPoints: []string{"webs"},
							Service:     "bar-service@myprovider",
						},
						"foobar": {
							EntryPoints: []string{"web", "webs"},
							Service:     "foobar-service@myprovider",
						},
					},
				},
			},
			entryPoints: []string{"web"},
			expected: map[string]map[string]*UDPRouterInfo{
				"web": {
					"foo": {
						UDPRouter: &dynamic.UDPRouter{
							EntryPoints: []string{"web"},
							Service:     "foo-service@myprovider",
						},
						Status: "enabled",
						Using:  []string{"web"},
					},
					"foobar": {
						UDPRouter: &dynamic.UDPRouter{
							EntryPoints: []string{"web", "webs"},
							Service:     "foobar-service@myprovider",
						},
						Status: "warning",
						Err:    []string{`entryPoint "webs" doesn't exist`},
						Using:  []string{"web"},
					},
				},
			},
		},
		{
			desc: "Valid configuration with multiple known entrypoints",
			conf: dynamic.Configuration{
				HTTP: &dynamic.HTTPConfiguration{
					Routers: map[string]*dynamic.Router{
						"foo": {
							EntryPoints: []string{"web"},
							Service:     "foo-service@myprovider",
						},
						"bar": {
							EntryPoints: []string{"webs"},
							Service:     "bar-service@myprovider",
						},
						"foobar": {
							EntryPoints: []string{"web", "webs"},
							Service:     "foobar-service@myprovider",
						},
					},
				},
				UDP: &dynamic.UDPConfiguration{
					Routers: map[string]*dynamic.UDPRouter{
						"foo": {
							EntryPoints: []string{"web"},
							Service:     "foo-service@myprovider",
						},
						"bar": {
							EntryPoints: []string{"webs"},
							Service:     "bar-service@myprovider",
						},
						"foobar": {
							EntryPoints: []string{"web", "webs"},
							Service:     "foobar-service@myprovider",
						},
					},
				},
			},
			entryPoints: []string{"web", "webs"},
			expected: map[string]map[string]*UDPRouterInfo{
				"web": {
					"foo": {
						UDPRouter: &dynamic.UDPRouter{
							EntryPoints: []string{"web"},
							Service:     "foo-service@myprovider",
						},
						Status: "enabled",
						Using:  []string{"web"},
					},
					"foobar": {
						UDPRouter: &dynamic.UDPRouter{
							EntryPoints: []string{"web", "webs"},
							Service:     "foobar-service@myprovider",
						},
						Status: "enabled",
						Using:  []string{"web", "webs"},
					},
				},
				"webs": {
					"bar": {
						UDPRouter: &dynamic.UDPRouter{
							EntryPoints: []string{"webs"},
							Service:     "bar-service@myprovider",
						},
						Status: "enabled",
						Using:  []string{"webs"},
					},
					"foobar": {
						UDPRouter: &dynamic.UDPRouter{
							EntryPoints: []string{"web", "webs"},
							Service:     "foobar-service@myprovider",
						},
						Status: "enabled",
						Using:  []string{"web", "webs"},
					},
				},
			},
		},
	}

	for _, test := range testCases {
		test := test
		t.Run(test.desc, func(t *testing.T) {
			t.Parallel()
			runtimeConfig := NewConfig(test.conf)
			actual := runtimeConfig.GetUDPRoutersByEntryPoints(context.Background(), test.entryPoints)
			assert.Equal(t, test.expected, actual)
		})
	}
}


text:
import React from 'react'

export default React.createClass ({
  render() {
    return (
      <span id="ProgressBar">
        ${this.props.received} out of ${this.props.target} raised!
      </span>
    )
  }
})


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

       Copyright 2009-2012 the original author or authors.

       Licensed under the Apache License, Version 2.0 (the "License");
       you may not use this file except in compliance with the License.
       You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

       Unless required by applicable law or agreed to in writing, software
       distributed under the License is distributed on an "AS IS" BASIS,
       WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
       See the License for the specific language governing permissions and
       limitations under the License.

-->

<!DOCTYPE configuration
    PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
    "http://mybatis.org/dtd/mybatis-3-config.dtd">

<configuration>

    <objectFactory type="org.apache.ibatis.submitted.custom_collection_handling.CustomObjectFactory" />
    <objectWrapperFactory type="org.apache.ibatis.submitted.custom_collection_handling.CustomObjectWrapperFactory" />

    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC">
                <property name="" value="" />
            </transactionManager>
            <dataSource type="UNPOOLED">
                <property name="driver" value="org.hsqldb.jdbcDriver" />
                <property name="url" value="jdbc:hsqldb:mem:reshdrtyp" />
                <property name="username" value="sa" />
            </dataSource>
        </environment>
    </environments>

    <mappers>
        <mapper resource="org/apache/ibatis/submitted/custom_collection_handling/PersonMapper.xml" />
    </mappers>

</configuration>


text:
S3 Data Folder Syncing Tool
=========

Enables `git` integration with `s3cmd` to keep a data folder in sync as changes are made in a repository.

# Prereqs

 1. Python 2.7
 2. [`s3cmd`](http://s3tools.org/) installed and configured

# Installation

 1. `git clone` the repo
 2. `cd` into the repo
 3. `pip install -e .` - This will install the package in editable mode so git pulling updates will be used next time you call the module.
 4. `data-sync-s3 install_hooks` Run this in a git repo root if you want git integration for that repo (see below for details)

# Data Project Repository Structure

Repository must have a structure where the `.s3data` configuration file is in a sub-project directly below the root of the git working tree. I.e., `git_root/<sub_project>/.s3data`. You can have multiple sub-projects per single git repository. For example:

```
git_root/
    | ---- sub_project/
        | ---- data_folder/      # this folder should be in .gitignore
        | ---- .s3data           # config for data_folder
        ...
    | ---- sub_project2/         # another project
        | ---- data_folder2/     # this folder should be in .gitignore
        | ---- .s3data           # config for data_folder2
```

# Options for `.s3data` file

```
[s3data]

# should be relative to this configuration file
data_root=data

# must end with trailing slash; if spaces, enclose entire path in quotes
s3_data_root=s3://<FOLDER_TO_SYNC_WITH_DATA>/

# OPTIONAL (use .gitignore conventions)
#exclude_file=<PATH_TO_FILE_WITH_DATA_NOT_TO_SYNC>
```

# Using `data-sync-s3`

You can use `data-sync-s3` from the commandline anywhere where there is an `.s3data` file above your current directory in the working tree. Run this any time that you please.

However, the real goal is not to disrupt your current `git` workflow with additional commands. You can trigger `data-sync-s3` using `git` hooks.

On `git-push` or `git-pull`, we will look at the changes. For every unique sub-project folder in the commit, we will try to sync the data on S3.

To turn on the git hooks, simply:

 1. Navigate to the root of the repo
 2. run `data-sync-s3 install_hooks`


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CSC.CSClassroom.Model.Assignments;
using CSC.CSClassroom.Service.Assignments.QuestionSolvers;
using CSC.CSClassroom.Service.UnitTests.TestDoubles;
using Xunit;

namespace CSC.CSClassroom.Service.UnitTests.Assignments.QuestionSolving
{
	/// <summary>
	/// Unit tests for the AssignmentDueDateRetriever class.
	/// </summary>
	public class AssignmentDueDateRetriever_UnitTests
	{
		/// <summary>
		/// An example due date.
		/// </summary>
		private readonly DateTime DueDate = new DateTime(2017, 1, 2, 0, 0, 0);

		/// <summary>
		/// Ensures that GetUserAssignmentDueDateAsync returns the due date
		/// of the section the user is in.
		/// </summary>
		[Fact]
		public async Task GetUserAssignmentDueDateAsync_UserInSection_ReturnsDueDate()
		{
			var database = GetDatabase().Build();
			var assignmentId = database.Context.Assignments.First().Id;
			var userId = database.Context.Users.Single(u => u.UserName == "User1").Id;
			var dueDateRetriever = new AssignmentDueDateRetriever(database.Context);

			var result = await dueDateRetriever.GetUserAssignmentDueDateAsync
			(
				"Class1",
				assignmentId,
				userId
			);

			Assert.Equal(DueDate, result);
		}

		/// <summary>
		/// Ensures that GetUserAssignmentDueDateAsync returns null for a user
		/// that does not belong to a section with a due date.
		/// </summary>
		[Fact]
		public async Task GetUserAssignmentDueDateAsync_UserNotInSection_ReturnsNull()
		{
			var database = GetDatabase().Build();
			var assignmentId = database.Context.Assignments.First().Id;
			var userId = database.Context.Users.Single(u => u.UserName == "User2").Id;
			var dueDateRetriever = new AssignmentDueDateRetriever(database.Context);

			var result = await dueDateRetriever.GetUserAssignmentDueDateAsync
			(
				"Class1",
				assignmentId,
				userId
			);

			Assert.Null(result);
		}

		/// <summary>
		/// Returns a database builder with pre-added questions.
		/// </summary>
		private TestDatabaseBuilder GetDatabase()
		{
			return new TestDatabaseBuilder()
				.AddClassroom("Class1")
				.AddSection("Class1", "Period1")
				.AddStudent("User1", "Last1", "First1", "Class1", "Period1")
				.AddStudent("User2", "Last2", "First2", "Class1", sectionName: null)
				.AddQuestionCategory("Class1", "Category1")
				.AddQuestion("Class1", "Category1", new MethodQuestion() { Name = "Question1" })
				.AddAssignment
				(
					"Class1",
					"Unit 1",
					"Unit 1a",
					sectionDueDates: new Dictionary<string, DateTime>()
					{
						["Period1"] = DueDate
					},
					questionsByCategory: new Dictionary<string, string[]>()
					{
						["Category1"] = new[]
						{
							"Question1"
						}
					}
				);
		}
	}
}


text:
package io.oasp.module.rest.service.impl.json;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.jsontype.NamedType;

/**
 * A generic factory to {@link #createInstance() create} instances of a Jackson {@link ObjectMapper}. It allows to
 * configure the {@link ObjectMapper} for polymorphic transfer-objects.
 *
 * @see #setBaseClasses(Class...)
 * @see #setSubtypes(NamedType...)
 * @deprecated use {@link io.oasp.module.json.common.base.ObjectMapperFactory} instead.
 */
@Deprecated
public class ObjectMapperFactory extends io.oasp.module.json.common.base.ObjectMapperFactory {

  /**
   * The constructor.
   */
  public ObjectMapperFactory() {

    super();
  }

}


text:
<?php

namespace StingerSoft\GaugePresentationBundle\Services;

use StingerSoft\GaugePresentationBundle\Model\Session\UserSessionInterface;
use StingerSoft\GaugePresentationBundle\Model\SlideInterface;
use StingerSoft\GaugePresentationBundle\Model\VoteInterface;

/**
 * Service to encapsulate the configuration for each slide class.
 */
interface SlideService {

	/**
	 * Gets the class name of the form to be used in the survey mode (frontend)
	 *
	 * @return string
	 */
	public function getUserForm();

	/**
	 * Gets the class name of the form to be used in the configuration mode (backend)
	 *
	 * @return string
	 */
	public function getBackendForm();

	/**
	 * Generates a new configured instance to store the selection of the use (passed as an object to the form type
	 * specified by the getUserForm method).
	 *
	 * @param UserSessionInterface $session
	 * @param SlideInterface $slide
	 * @return VoteInterface
	 */
	public function getVoteInstance(UserSessionInterface $session, SlideInterface $slide);

	/**
	 * Gets the slide interface which is supported by this service
	 *
	 * @return string
	 */
	public function getSupportedSlideType();

	/**
	 * Generates a new instance of the supported slide class.
	 *
	 * @return SlideInterface
	 */
	public function getSlideImplementation();

	/**
	 * Generates a new instance of the supported use vote class.
	 *
	 * @return SlideInterface
	 */
	public function getVoteImplementation();

	/**
	 * Checks whether the user has already voted on the given slide
	 *
	 * @param UserSessionInterface $session
	 * @param SlideInterface $slide
	 */
	public function hasUserVoted(UserSessionInterface $session, SlideInterface $slide);

	/**
	 * Gets the route name to render this slide in the presentation mode.
	 * The ID of the slide will be added to the route as the 'slide' parameter
	 *
	 * @param SlideInterface $slide
	 * @return string
	 */
	public function getPresentationRoute();

	/**
	 * Returns true if this service is configured to handle ORM entities
	 *
	 * @return boolean
	 */
	public function isOrm();

	/**
	 * Returns true if this service is configured to handle ODM documents
	 *
	 * @return boolean
	 */
	public function isOdm();
}


text:
@interface QRUtil : NSObject

+ (CGRect)screenBounds;

+ (AVCaptureVideoOrientation) videoOrientationFromCurrentDeviceOrientation;
@end


text:
using System;
using Rothko.Interfaces.Commands;
using Rothko.Interfaces.Components;
using Rothko.Model;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using Rothko.Enumerators;
using Rothko.Interfaces.Services;

namespace Rothko.Commands
{
	public class MoveCommand : ICommand
	{
		private Map _Map;
		private Unit _Unit;
		private List<Tile> _Tiles;
		private List<Unit> _Units;
		private List<TerrainCost> _TerrainCosts;
		private int _X, _Y;

		public void Execute()
		{
			int terrainCost;

			List<TerrainCost> queryTerrainCosts =
				_TerrainCosts
				.Where (tc =>
					_Tiles
					.Where (t => t.X == _X && t.Y == _Y && t.Active)
					.Any (t => t.IDTileType == tc.IDTileType))
				.Where (tc => tc.IDUnitType == _Unit.IDUnitType)
				.ToList();

			if (!queryTerrainCosts.Any (tc => tc.CanCross))
				return;

			terrainCost =
				queryTerrainCosts
				.Sum (tc => tc.Cost);

			if (_Unit.MovePoints < terrainCost)
				return;

			_Unit.X = _X;
			_Unit.Y = _Y;
			_Unit.MovePoints -= terrainCost;

			_Units
			.Where (u => u.IDUnitCarrier == _Unit.ID)
			.ToList ()
			.ForEach(u =>
			{
				u.X = _Unit.X;
				u.Y = _Unit.Y;
			});
		}

		public MoveCommand (Map map,
							Unit unit,
		                    List<TerrainCost> terrainCosts,
		                    int x, int y)
		{
			_Map = map;
			_Unit = unit;
			_Units = _Map.Units;
			_Tiles = _Map.Tiles;
			_TerrainCosts = terrainCosts;
			_X = x;
			_Y = y;
		}
	}
}


text:
package org.ohdsi.webapi.DIKB;

import com.fasterxml.jackson.annotation.JsonProperty;

public class DrugDBModel {

		  @JsonProperty("DRUG")
		  public String drugName;

}


text:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.uff.ic.archd.service.mining;

import java.util.LinkedList;
import java.util.List;

/**
 *
 * @author wallace
 */
public class RuleOcurrence {
    private int number;
    private List<String> revisions;

    RuleOcurrence(int number){
        this.number = number;
        revisions = new LinkedList();
    }

    RuleOcurrence(){
        this.number = 0;
        revisions = new LinkedList();
    }

    public void addRevision(String revison){
        revisions.add(revison);
    }

    public void addRevisionInHead(String revison){
        revisions.add(0,revison);
    }

    public List<String> getRevisions(){
        return revisions;
    }

    /**
     * @return the number
     */
    public int getNumber() {
        return number;
    }

    /**
     * @param number the number to set
     */
    public void setNumber(int number) {
        this.number = number;
    }
}


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

    Copyright © 2014-2017 EntIT Software LLC, a Micro Focus company (L.P.)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>io.cloudslang</groupId>
        <artifactId>worker-execution</artifactId>
        <version>0.3.283-SNAPSHOT</version>
    </parent>

    <artifactId>score-worker-execution-api</artifactId>

    <dependencies>
        <dependency>
            <groupId>${project.groupId}</groupId>
            <artifactId>score-facade</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>


text:
/*
 * MinIO Cloud Storage, (C) 2018 MinIO, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package event

import (
	"reflect"
	"testing"
)

func TestTargetDString(t *testing.T) {
	testCases := []struct {
		tid            TargetID
		expectedResult string
	}{
		{TargetID{}, ":"},
		{TargetID{"1", "webhook"}, "1:webhook"},
		{TargetID{"httpclient+2e33cdee-fbec-4bdd-917e-7d8e3c5a2531", "localhost:55638"}, "httpclient+2e33cdee-fbec-4bdd-917e-7d8e3c5a2531:localhost:55638"},
	}

	for i, testCase := range testCases {
		result := testCase.tid.String()

		if result != testCase.expectedResult {
			t.Fatalf("test %v: result: expected: %v, got: %v", i+1, testCase.expectedResult, result)
		}
	}
}

func TestTargetDToARN(t *testing.T) {
	tid := TargetID{"1", "webhook"}
	testCases := []struct {
		tid         TargetID
		region      string
		expectedARN ARN
	}{
		{tid, "", ARN{TargetID: tid, region: ""}},
		{tid, "us-east-1", ARN{TargetID: tid, region: "us-east-1"}},
	}

	for i, testCase := range testCases {
		arn := testCase.tid.ToARN(testCase.region)

		if arn != testCase.expectedARN {
			t.Fatalf("test %v: ARN: expected: %v, got: %v", i+1, testCase.expectedARN, arn)
		}
	}
}

func TestTargetDMarshalJSON(t *testing.T) {
	testCases := []struct {
		tid          TargetID
		expectedData []byte
		expectErr    bool
	}{
		{TargetID{}, []byte(`":"`), false},
		{TargetID{"1", "webhook"}, []byte(`"1:webhook"`), false},
		{TargetID{"httpclient+2e33cdee-fbec-4bdd-917e-7d8e3c5a2531", "localhost:55638"}, []byte(`"httpclient+2e33cdee-fbec-4bdd-917e-7d8e3c5a2531:localhost:55638"`), false},
	}

	for i, testCase := range testCases {
		data, err := testCase.tid.MarshalJSON()
		expectErr := (err != nil)

		if expectErr != testCase.expectErr {
			t.Fatalf("test %v: error: expected: %v, got: %v", i+1, testCase.expectErr, expectErr)
		}

		if !testCase.expectErr {
			if !reflect.DeepEqual(data, testCase.expectedData) {
				t.Fatalf("test %v: data: expected: %v, got: %v", i+1, string(testCase.expectedData), string(data))
			}
		}
	}
}

func TestTargetDUnmarshalJSON(t *testing.T) {
	testCases := []struct {
		data             []byte
		expectedTargetID *TargetID
		expectErr        bool
	}{
		{[]byte(`""`), nil, true},
		{[]byte(`"httpclient+2e33cdee-fbec-4bdd-917e-7d8e3c5a2531:localhost:55638"`), nil, true},
		{[]byte(`":"`), &TargetID{}, false},
		{[]byte(`"1:webhook"`), &TargetID{"1", "webhook"}, false},
	}

	for i, testCase := range testCases {
		targetID := &TargetID{}
		err := targetID.UnmarshalJSON(testCase.data)
		expectErr := (err != nil)

		if expectErr != testCase.expectErr {
			t.Fatalf("test %v: error: expected: %v, got: %v", i+1, testCase.expectErr, expectErr)
		}

		if !testCase.expectErr {
			if *targetID != *testCase.expectedTargetID {
				t.Fatalf("test %v: TargetID: expected: %v, got: %v", i+1, testCase.expectedTargetID, targetID)
			}
		}
	}
}


text: Hello {{name}}!


text:
import { createStructuredSelector } from 'reselect';

import {
  menusSelector,
  leftNavOpenSelector,
  appBarDepthSelector,
} from 'selectors';

export default createStructuredSelector({
  menus: menusSelector,
  leftNavOpen: leftNavOpenSelector,
  appBarDepth: appBarDepthSelector,
});


text:
const { RuleTester } = require('eslint')
const rule = require('../../lib/rules/jsx-no-classname')

const rt = new RuleTester({
  parserOptions: {
    ecmaFeatures: {
      jsx: true
    }
  }
})

rt.run('jsx-no-classname', rule, {
  valid: [{ code: '

' }],
  invalid: [
    {
      code: '

',
      errors: [{ message: 'Use `class` instead of `className`' }],
      output: '

'
    }
  ]
})


text:
title: NuGet 2.8.2 Release Notes
description: Release notes for NuGet 2.8.2 including known issues, bug fixes, added features, and DCRs.
author: JonDouglas
ms.author: jodou
ms.date: 11/11/2016
ms.topic: conceptual
---

# NuGet 2.8.2 Release Notes

[NuGet 2.8.1 Release Notes](../release-notes/nuget-2.8.1.md) | [NuGet 2.8.3 Release Notes](../release-notes/nuget-2.8.3.md)

NuGet 2.8.2 was released on May 22, 2014.  This release only included changes to the nuget.exe command-line, the NuGet.Server package and other NuGet packages.  The release did not include an updated Visual Studio extension or WebMatrix extension.

## Notable Updates

The most notable updates were in the nuget.exe command-line and the NuGet.Server package (for self-hosted NuGet feeds).

### Important nuget.exe Bug Fixes

1. [nuget.exe Push fails and keeps retrying](https://nuget.codeplex.com/workitem/4000)
1. [nuget.exe Push does not send Basic Auth credentials correctly](https://nuget.codeplex.com/workitem/4109)
1. [nuget.exe Push won't follow temporary redirect](https://nuget.codeplex.com/workitem/4050)

### Important NuGet.Server Bug Fix

1. [Wrong value of IsAbsoluteLatestVersion returned by NuGet.Server](https://nuget.codeplex.com/workitem/4147)

## Packages Updated

The nuget.exe command-line and NuGet.Server fixes are shipped as NuGet package updates.  There were other packages updated with 2.8.2 as well.

Here's the list of updated packages:

1. [NuGet.Core](https://www.nuget.org/packages/NuGet.Core/)
1. [NuGet.CommandLine](https://www.nuget.org/packages/NuGet.CommandLine/)
1. [NuGet.Server](https://www.nuget.org/packages/NuGet.Server/)
1. [NuGet.Build](https://www.nuget.org/packages/NuGet.Build/)
1. [NuGet.VisualStudio](https://www.nuget.org/packages/NuGet.VisualStudio/) (the package, not the extension)

## All Changes
There were 10 issues addressed in the release. For a full list of the work items fixed in NuGet 2.8.2, please view the [NuGet Issue Tracker for this release](https://nuget.codeplex.com/workitem/list/advanced?keyword=&status=All&type=All&priority=All&release=NuGet%202.8.2&assignedTo=All&component=All&sortField=LastUpdatedDate&sortDirection=Descending&page=0&reasonClosed=All).


text:
<tool id="humann_associate" name="Perform metadata association" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@">
    <description>on HUMAnN generated table</description>
    <macros>
        <import>macros.xml</import>
    </macros>
    <expand macro="edam_ontology"/>
    <expand macro="requirements"/>
    <expand macro="version"/>
    <command detect_errors="exit_code"><![CDATA[
humann_associate
    --input '$input'
    --focal-metadatum '$focal_metadatum'
    --last-metadatum '$last_metadatum'
    --focal-type '$focal_type'
    --fdr $fdr
    --output '$output'
    ]]></command>
    <inputs>
        <param argument="--input" type="data" format="tsv,tabular" label="Gene family or pathway table with metadata rows at the top"/>
        <param argument="--focal-metadatum" type="text" value="" label="Metadatum to test vs. community feature totals">
            <sanitizer invalid_char="">
                <valid initial="string.ascii_letters,string.digits">
                    <add value="_" />
                </valid>
            </sanitizer>
            <validator type="empty_field" />
        </param>
        <param argument="--last-metadatum" type="text" value="" label="End of metadata rows">
            <sanitizer invalid_char="">
                <valid initial="string.ascii_letters,string.digits">
                    <add value="_" />
                </valid>
            </sanitizer>
            <validator type="empty_field" />
        </param>
        <param name="focal_type" argument="--focal-type" type="select" label="Metadatum type">
            <option value="continuous">Continuous</option>
            <option value="categorical">Categorical</option>
        </param>
        <param argument="--fdr" type="float" value="0.2" label="FDR threshold"/>
    </inputs>
    <outputs>
        <data format="tabular" name="output"/>
    </outputs>
    <tests>
        <test expect_num_outputs="1">
            <param name="input" value="hmp_pathabund.txt"/>
            <param name="focal_metadatum" value="STSite"/>
            <param name="last_metadatum" value="STSite"/>
            <param name="focal_type" value="categorical"/>
            <param name="fdr" value="0.2"/>
            <output name="output" ftype="tabular">
                <assert_contents>
                    <has_text text="Feature"/>
                    <has_text text="BRANCHED-CHAIN-AA-SYN-PWY: superpathway of branched amino acid biosynthesis"/>
                    <has_text text="Level means (|ed)"/>
                    <has_text text="P-value"/>
                    <has_text text="Q-value"/>
                    <has_n_columns n="4"/>
                </assert_contents>
            </output>
        </test>
    </tests>
    <help><![CDATA[
@HELP_HEADER@

When associating metadata with HUMAnN features, it is often beneficial to associate with community totals and avoid testing each
individual feature stratification (to improve statistical power).

This is the approach used by this tool, which can compare feature totals across samples with
1) a single continuous metadatum (via the Spearman Correlation) or
2) a single categorical metadatum (via the Kruskal-Wallis H-test).

Notably, this is a naive approach to association, but it is useful for tutorial purposes.
    ]]></help>
    <expand macro="citations"/>
</tool>


text:
package com.asksunny.schema.generator;

import java.math.BigDecimal;
import java.sql.Types;

import com.asksunny.schema.Field;

public class DoubleGenerator implements Generator<BigDecimal> {
	private double maxValue;
	private double minValue;
	private int precision;
	private int scale;
	private Field field;
	private long intDigitsMax = 0L;
	private long decimalDigitsMax = 0L;

	public DoubleGenerator(Field field) {

		this.field = field;
		this.precision = field.getPrecision();
		this.scale = field.getScale();

		this.maxValue = field.getMaxValue() == null ? 0 : Double.valueOf(field.getMaxValue());
		this.minValue = field.getMinValue() == null ? 0 : Double.valueOf(field.getMinValue());

		if (this.maxValue != 0) {
			this.precision = Long.toString((long) this.maxValue).length() + this.scale-1;
		}
		if (this.minValue != 0) {
			String text = Double.toString((double) this.minValue);
			int idx = text.indexOf(".");
			if (idx == -1) {
				this.scale = 2;
			} else {
				this.scale = text.length() - idx - 1;
			}
		}
		if (this.precision == 0) {
			switch (field.getJdbcType()) {
			case Types.DOUBLE:
				this.precision = 10;
				this.scale = 4;
				break;
			case Types.FLOAT:
				this.precision = 6;
				this.scale = 2;
				break;
			case Types.DECIMAL:
			case Types.REAL:
			default:
				this.precision = 8;
				this.scale = 4;
				break;
			}
		}
		decimalDigitsMax = (long) Math.pow(10, this.scale);
		intDigitsMax = (long) Math.pow(10, this.precision - this.scale);

	}

	public String nextStringValue() {
		BigDecimal out = nextValue();

		return out == null ? null : out.toPlainString();
	}

	public BigDecimal nextValue() {
		if (field.isNullable() && RandomUtil.getInstance().isOddEnough()) {
			return null;
		}
		if (this.scale > 0) {
			return new BigDecimal(String.format("%d.%d", RandomUtil.getInstance().getUnsignedLong(intDigitsMax),
					RandomUtil.getInstance().getUnsignedLong(decimalDigitsMax)));
		} else {
			return new BigDecimal(RandomUtil.getInstance().getUnsignedLong(intDigitsMax));

		}
	}

}


text:
package com.ning.metrics.action.hdfs.data;

import com.ning.metrics.action.hdfs.data.parser.RowParser;
import com.ning.metrics.action.hdfs.data.schema.DynamicColumnKey;
import com.ning.metrics.action.hdfs.data.schema.RowSchema;
import com.ning.metrics.action.schema.Registrar;
import org.apache.commons.lang.StringUtils;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

/**
 * Iterator for flat file (can contain binary data)
 */
class RowTextFileContentsIterator extends RowFileContentsIterator
{
    private final InputStream in;
    private BufferedReader reader = null;

    public RowTextFileContentsIterator(final String pathname, final RowParser rowParser, final Registrar registrar, final InputStream in, final boolean rawContents)
    {
        super(pathname, rowParser, registrar, rawContents);
        this.in = in;
    }

    @Override
    public void close()
    {
        if (!readerClosed) {
            try {
                if (reader != null) {
                    reader.close();
                }
                else {
                    in.close();
                }
                readerClosed = true;
            }
            catch (IOException e) {
                log.warn(String.format("Unable to close reader: %s", e));
            }
        }
    }

    /**
     * Read one or more rows
     *
     * @return the next row(s)
     */
    @Override
    Rows readNextRows()
    {
        try {
            if (readerClosed) {
                return null;
            }
            else {
                if (reader == null) {
                    // First time we come here
                    // If the file needs to be read as a whole (e.g. Smile), read the whole thing, otherwise read line by line
                    if (readByLine()) {
                        this.reader = new BufferedReader(new InputStreamReader(in));
                    }
                    else {
                        final Rows rows = rowParser.streamToRows(registrar, pathname, in);
                        close(); // Everything has been deserialized, nothing left to do here
                        return rows;
                    }
                }

                Rows rows = new Rows();
                final String value = reader.readLine();

                if (value == null) {
                    close();
                    return rows;
                }

                if (rawContents) {
                    final List<String> list = new ArrayList<String>();
                    list.add(value);
                    rows.add(RowFactory.getRow(new RowSchema("ad-hoc", new DynamicColumnKey("record")), list));
                }
                else {
                    rows = rowParser.valueToRows(registrar, value);
                }

                return rows;
            }
        }
        catch (IOException e) {
            log.info(String.format("IOException reading file %s, skipping", pathname));

            close();

            return null;
        }
    }

    /**
     * @return true if we can read the file line by line, false otherwise
     */
    private boolean readByLine()
    {
        final String[] tokenizedPathname = StringUtils.split(pathname, ".");
        final String suffix = tokenizedPathname[tokenizedPathname.length - 1];

        return !suffix.equals("smile") && !suffix.equals("thrift");
    }
}


text:
package orm

import (
	"database/sql"
	// "github.com/yosida95/orm/cond"
	"reflect"
)

type Client struct {
	conn   *sql.DB
	tables map[reflect.Type]*table
}

func NewClient(conn *sql.DB) *Client {
	return &Client{
		conn:   conn,
		tables: make(map[reflect.Type]*table),
	}
}

func (c *Client) Session() (s *Session, err error) {
	tx, err := c.conn.Begin()
	if err != nil {
		return
	}

	s = &Session{
		tx:            tx,
		client:        c,
		inTransaction: true,
	}
	return
}

func (c *Client) getTable(modelT reflect.Type) (tbl *table, err error) {
	tbl, ok := c.tables[modelT]
	if ok {
		return
	}

	tbl, err = analyzeTable(modelT)
	if err != nil {
		return
	}
	c.tables[modelT] = tbl

	return
}


text:
#include "config.h"
#include "BusRouteItem.h"

#include "DataBuffer.h"

void
BusRouteItem::save( DataBuffer& dataBuffer, const GenericMap& map ) const
{
   RouteableItem::save( dataBuffer, map );

   dataBuffer.writeNextLong( m_busRouteID );
   dataBuffer.writeNextShort( m_offsetInClosestStreet );
   dataBuffer.writeNextShort( 0 ); // Pad 2 bytes

}

void
BusRouteItem::load( DataBuffer& dataBuffer, GenericMap& theMap )
{
   m_type = ItemTypes::busRouteItem;
   RouteableItem::load(dataBuffer, theMap);
   m_busRouteID = dataBuffer.readNextLong();
   m_offsetInClosestStreet = dataBuffer.readNextShort();
   dataBuffer.readNextShort(); // Pad 2 bytes
}

uint32
BusRouteItem::getMemoryUsage() const {
   uint32 totalSize = RouteableItem::getMemoryUsage()
                      - sizeof(RouteableItem) + sizeof(BusRouteItem);
   return totalSize;
}


text:
Unity UI Controls

## ListBox
![ListBox](Documents/Images/ListBox.png)

### Usage
On your hierarchy view,
right click -> UI/Controls/ListBox .

On added ListBox inspector,

1. Set your ListBox item strings as String[] items.
2. Set "Selected Index" value, that is an index of initial selectd item index.
3. Set callback event "OnSelected", that is called with the selected string argument when clicking the item


text:
package com.bitmastro.playMusicAlarm;

import android.content.Context;
import android.content.res.TypedArray;
import android.preference.DialogPreference;
import android.text.format.DateFormat;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TimePicker;

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class TimePreference extends DialogPreference {
	private Calendar calendar = new GregorianCalendar();
	private TimePicker picker = null;

	public TimePreference(Context ctxt, AttributeSet attrs) {
		super(ctxt, attrs);
		setPositiveButtonText(R.string.done);
		setNegativeButtonText(R.string.cancel);
	}

	@Override
	protected View onCreateDialogView() {
		picker = new TimePicker(getContext());
		picker.setIs24HourView(DateFormat.is24HourFormat(getContext()));
		return (picker);
	}

	@Override
	protected void onBindDialogView(View v) {
		super.onBindDialogView(v);
		picker.setCurrentHour(calendar.get(Calendar.HOUR_OF_DAY));
		picker.setCurrentMinute(calendar.get(Calendar.MINUTE));
	}

	@Override
	protected void onDialogClosed(boolean positiveResult) {
		super.onDialogClosed(positiveResult);

		if (positiveResult) {
			calendar.set(Calendar.HOUR_OF_DAY, picker.getCurrentHour());
			calendar.set(Calendar.MINUTE, picker.getCurrentMinute());

			updateSummary();
			if (callChangeListener(calendar.getTimeInMillis())) {
				persistLong(calendar.getTimeInMillis());
				notifyChanged();
			}
		}
	}

	@Override
	protected Object onGetDefaultValue(TypedArray a, int index) {
		return (a.getString(index));
	}

	@Override
	protected void onSetInitialValue(boolean restoreValue, Object defaultValue) {

		if (restoreValue) {
			if (defaultValue == null) {
				calendar.setTimeInMillis(getPersistedLong(System
						.currentTimeMillis()));
			} else {
				calendar.setTimeInMillis(Long
						.parseLong(getPersistedString((String) defaultValue)));
			}
		} else {
			if (defaultValue == null) {
				calendar.setTimeInMillis(System.currentTimeMillis());
			} else {
				calendar.setTimeInMillis(Long.parseLong((String) defaultValue));
			}
		}
		updateSummary();
	}

	private void updateSummary() {
		setSummary(getSummary());
	}

	@Override
	public CharSequence getSummary() {
		return DateFormat.getTimeFormat(getContext()).format(
				new Date(calendar.getTimeInMillis()));
	}

	public int getHour() {
		return calendar.get(Calendar.HOUR_OF_DAY);
	}

	public int getMinute() {
		return calendar.get(Calendar.MINUTE);
	}

	public void setHour(int hour) {
		calendar.set(Calendar.HOUR_OF_DAY, hour);
		updateSummary();
	}

	public void setMinute(int minute) {
		calendar.set(Calendar.MINUTE, minute);
		updateSummary();
	}

}


text:
package env

import (
	"fmt"
	//"io"
	//"log"
	"encoding/json"
	"os"
	"strconv"
	"strings"
)

// CloudFoundryProvider is an implementation of a EnvReader
type CloudFoundryProvider struct{}

type VCAP struct {
	Services map[string]interface{}
}

func NewVCAPFromJSON(jsonString string) *VCAP {
	var services map[string]interface{}
	json.Unmarshal([]byte(jsonString), &services)
	return &VCAP{Services: services}
}

// Getenv looks for docker specific environment variables and returns
// either the value or empty string, if nothing is found.
func (er *CloudFoundryProvider) Getenv(key string) string {
	cfEnv := extractCloudFoundryEnvironment()
	return cfEnv[key]
}

func getValue(val interface{}) string {
	if val == nil {
		return ""
	}
	switch val.(type) {
	case string:
		return val.(string)
	case int:
		return strconv.Itoa(val.(int))
	default:
		return fmt.Sprintf("%v", val)
	}
}
func buildKey(prefix string, name string) string {
	return fmt.Sprintf("%v_%v", prefix, name)
}

func extractServices(service map[string]interface{}) map[string]string {
	serviceMap := make(map[string]string)

	prefix, ok := service["name"].(string)
	if !ok {
		fmt.Printf("Could not extract service name")
		return serviceMap
	}
	prefix = strings.ToUpper(prefix)

	serviceMap[buildKey(prefix, "LABEL")] = getValue(service["label"])
	serviceMap[buildKey(prefix, "PLAN")] = getValue(service["plan"])

	if credentialMap, ok := service["credentials"].(map[string]interface{}); ok {
		if credentialMap["username"] != nil {
			serviceMap[buildKey(prefix, "USERNAME")] = getValue(credentialMap["username"])
		}
		if credentialMap["password"] != nil {
			serviceMap[buildKey(prefix, "PASSWORD")] = getValue(credentialMap["password"])
		}
		if credentialMap["host"] != nil {
			serviceMap[buildKey(prefix, "HOST")] = getValue(credentialMap["host"])
			serviceMap[buildKey(prefix, "ADDR")] = getValue(credentialMap["host"])
		}
		if credentialMap["port"] != nil {
			serviceMap[buildKey(prefix, "PORT")] = getValue(credentialMap["port"])
		}
		if credentialMap["db"] != nil {
			serviceMap[buildKey(prefix, "NAME")] = getValue(credentialMap["db"])
		}
		if credentialMap["url"] != nil {
			serviceMap[buildKey(prefix, "URL")] = getValue(credentialMap["url"])
		}
		if credentialMap["jdbcurl"] != nil {
			serviceMap[buildKey(prefix, "JDBCURL")] = getValue(credentialMap["jdbcurl"])
			if credentialMap["url"] == nil {
				serviceMap[buildKey(prefix, "URL")] = getValue(credentialMap["jdbcurl"])
			}
		}
		if credentialMap["uri"] != nil {
			serviceMap[buildKey(prefix, "URI")] = getValue(credentialMap["uri"])
			if credentialMap["url"] == nil {
				serviceMap[buildKey(prefix, "URL")] = getValue(credentialMap["uri"])
			}
		}
	}

	return serviceMap
}

func mergeMaps(maps ...map[string]string) map[string]string {
	finalMap := make(map[string]string)
	for _, m := range maps {
		for k, v := range m {
			finalMap[k] = v
		}
	}
	return finalMap
}

func extractCloudFoundryEnvironment() map[string]string {
	normalizedEnvironment := make(map[string]string)

	vcapString := os.Getenv("VCAP_SERVICES")
	if vcapString == "" {
		return normalizedEnvironment
	}

	vcap := NewVCAPFromJSON(vcapString)

	for _, value := range vcap.Services {
		switch value.(type) {
		case map[string]interface{}:
			normalizedEnvironment = mergeMaps(normalizedEnvironment, extractServices(value.(map[string]interface{})))
		case []interface{}:
			valueItem := value.([]interface{})
			for _, slicedValueItem := range valueItem {
				if valueItemMap, ok := slicedValueItem.(map[string]interface{}); ok {
					normalizedEnvironment = mergeMaps(normalizedEnvironment, extractServices(valueItemMap))
				}
			}
		default:
			fmt.Println("--- unknown --- ")
		}
	}

	return normalizedEnvironment
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Text;

namespace SQLite.Net.Builders
{
    public interface ITableBuilder<out T>
    {
	    TColumns PrimaryKey<TColumns>(Func<T, TColumns> columns);

	    TColumns Unique<TColumns>(Func<T, TColumns> columns);

	    TColumns ForeignKey<TColumns>(Func<T, TColumns> columns, string foreignTable, params string[] foreignColumns);
    }
}


text:
package com.bing.excel.converter;

import java.lang.reflect.Type;

import com.bing.excel.core.handler.ConverterHandler;
import com.bing.excel.vo.OutValue;

/**
 * 创建时间:2015-12-15下午2:12:56
 * 项目名称:excel
 * @author shizhongtao
 * @version 1.0
 * 文件名称:FieldValueConverter.java
 * 类说明:  这里面convertor是针对实体类的filed。主要用于扩展转换,目前版本中,convertor中必须有无参的构造方法。
 */
public interface FieldValueConverter extends ConverterMatcher {
	  OutValue toObject(Object source,ConverterHandler converterHandler);
	  Object fromString(String cell,ConverterHandler converterHandler,Type targetType);
}


text:
<?php

namespace Anthem\Core\Task;

use Silex\Application;

/**
 * An interface for task classes, suitable for complex tasks.
 */
interface TaskInterface
{
 /**
  * Gets a short (one line) help string.
  *
  * @abstract
  * @return   string
  */
  function getShortHelp();

 /**
  * Gets a long (multiline) help string.
  *
  * @abstract
  * @return   string
  */
  function getLongHelp();

 /**
  * Runs task.
  *
  * @abstract
  * @param    \Silex\Application $app
  * @param    string[]           $args
  * @return   integer
  */
  function run(Application $app, array $args);
}


text:
ActiveSupport.on_load(:active_record) { include InlineTranslation::Concerns::ActsAsTranslatable }
ActiveSupport.on_load(:action_view)   { include InlineTranslation::Helpers::TranslationsHelper }


text:
<?php
/*\
 | ------------------------------------------------------
 | @file : Radio.php
 | @author : Fabien Beaujean
 | @description : radio validation
 | @version : 3.0 Bêta
 | ------------------------------------------------------
\*/

namespace Gcs\Framework\Core\Form\Validation\Element;

use Gcs\Framework\Core\Lang\Lang;

/**
 * Class Radio
 * @package Gcs\Framework\Core\Form\Validation\Element
 */
class Radio extends Element {
    /**
     * constructor
     * @access public
     * @param $field string
     * @param $label string
     * @return \Gcs\Framework\Core\Form\Validation\Element\Radio
     * @since 3.0
     * @package Gcs\Framework\Core\Form\Validation\Element
     */

    public function __construct($field, $label) {
        parent::__construct($field, $label);

        if (!isset($this->_data[$field])) {
            array_push($this->_errors, ['field' => $this->_label, 'message' => Lang::instance()->lang('.app.system.form.exist')]);

            $this->_exist = false;
        }

        return $this;
    }

    /**
     * check validity
     * @access public
     * @return void
     * @since 3.0
     * @package Gcs\Framework\Core\Form\Validation\Element
     */

    public function check() {
        if ($this->_exist) {
            parent::check();
        }
    }

    /**
     * destructor
     * @access public
     * @since 3.0
     * @package Gcs\Framework\Core\Form\Validation\Element
     */

    public function __destruct() {
    }
}


text:
Description
===========
Installs qt

Requirements
============

## Platform:

* Ubuntu 10.04

Usage
=====

`recipe[qt]` Installs packages for qt development


text:
%%  ENTFORMATION    Computes the entanglement of formation of a bipartite quantum state
%   This function has one required argument:
%     RHO: a density matrix or a pure state vector
%
%   EF = EntFormation(RHO) is the entropy of formation of the bipartite
%   quantum state RHO. Note that this function currently only supports RHO
%   being a pure state or a 2-qubit state: it is not known how to compute
%   the entanglement of formation of higher-dimensional mixed states.
%
%   This function has one optional argument:
%     DIM (default has both subsystems of equal dimension)
%
%   EF = EntFormation(RHO,DIM) is the same as above, where RHO acts on
%   local systems of dimension specified by the 1-by-2 vector DIM.
%
%   URL: http://www.qetlab.com/EntFormation

%   requires: Concurrence.m, Entropy.m, opt_args.m, PartialTrace.m
%   author: Nathaniel Johnston (nathaniel@njohnston.ca)
%   package: QETLAB
%   last updated: February 19, 2016

function ef = EntFormation(rho,varargin)

[m,n] = size(rho);
round_dim = round(sqrt(max(m,n)));

% set optional argument defaults: dim = sqrt(length(dim))
[dim] = opt_args({ round_dim' },varargin{:});

% allow the user to enter a single number for dim
if(length(dim) == 1)
    dim = [dim,max(m,n)/dim];
    if abs(dim(2) - round(dim(2))) >= 2*max(m,n)*eps
        error('EntFormation:InvalidDim','If DIM is a scalar, DIM must evenly divide length(RHO); please provide the DIM array containing the dimensions of the subsystems.');
    end
    dim(2) = round(dim(2));
end

if(prod(dim) ~= max(m,n))
    error('EntFormation:InvalidDim','Please provide local dimensions in the argument DIM that match the size of RHO.');
end

% If RHO is a rank-1 density matrix, turn it into a vector instead so we
% can compute the EoF easily.
tmp_rho = orth(rho); % if RHO has rank 1, this matrix has one column, which is the vector RHO projects onto
if(m == n && size(tmp_rho,2) == 1)
    rho = tmp_rho;
    n = 1;
end

% Finally, start actually computing the EoF.
if(min(m,n) == 1) % it's a pure state vector
    rho = rho(:);
    ef = Entropy(PartialTrace(rho*rho',2,dim));

elseif(m == n) % it's a density matrix
    if(m == 4) % In the two-qubit case, we know how to compute the EoF exactly.
        % Start by computing the concurrence. The EoF is computed based on it.
        C = Concurrence(rho);

        % Now compute the EoF.
        C1 = (1 + sqrt(1 - C^2))/2;
        C2 = (1 - sqrt(1 - C^2))/2;
        ef = -C1*log2(C1) - C2*log2(C2);

    else
        % Hopefully we will replace this error by a numerical method soon.
        error('EntFormation:InvalidDim','We currently only know how to compute the entanglement of formation for two-qubit states (i.e., 4-by-4 density matrices) and pure states.');
    end

else % it's neither
    error('EntFormation:InvalidDim','RHO must be either a vector or a square matrix.');
end


text:
<?php
namespace Editorial\Codemirror\View\Helper;

use Editorial\Core\View\Helper\EditorialHelper;
use Cake\Core\Configure;

class CodemirrorHelper extends EditorialHelper {

/**
 * Default config for the helper.
 *
 * @var array
 */
	protected $_defaultConfig = [
        'block' => 'false',
		'options' => [
			'mode' => 'xml',
			'theme' => 'eclipse',
			'indentUnit' => 4,
			'keymap' => 'sublime',
			'lineNumbers' => true
		]
	];

	public function assets($block = true){
		$assets = '';
        $assets .= $this->Html->css('Editorial/Codemirror.codemirror.css', ['block' => $block]);
		$codemirrorTheme = $this->config('options.theme');
		if(!empty($codemirrorTheme)) {
			$assets .= $this->Html->css('Editorial/Codemirror.theme/'.$codemirrorTheme.'.css', ['block' => $block]);
		}
		$assets .= $this->Html->script('Editorial/Codemirror.codemirror.js', ['block' => $block]);
		$codemirrorMode = $this->config('options.mode');
		if(!empty($codemirrorTheme)) {
			$assets .= $this->Html->script('Editorial/Codemirror.mode/'.$codemirrorMode.'/'.$codemirrorMode.'.js', ['block' => $block]);
		}
		$codemirrorKeymap = $this->config('options.keymap');
		if(!empty($codemirrorKeymap)) {
			$assets .= $this->Html->script('Editorial/Codemirror.keymap/'.$codemirrorKeymap.'.js', ['block' => $block]);
		}
		$assets .= $this->Html->script('Editorial/Codemirror.formatting.min.js', ['block' => $block]);
        if(!$block){
            return $assets;
        }
	}

	public function connect($content = null, $block = true){
		if(empty($content)) {
			return;
		}
		$searchRegex = '/(<textarea.*class\=\".*'
			.Configure::read('Editorial.class').'\"[^>]*>.*<\/textarea>)/isU';
		$js = '';$globals = [];
		if(preg_match_all($searchRegex, $content, $matches)){
			$editorOptions = json_encode($this->config('options'));
			foreach ($matches[0] as $input){
				if(preg_match('/<textarea.*id\=\"(.*)\"[^>]*>.*<\/textarea>/isU', $input, $idMatches)) {
					$js .= "\t cmeditor_".$idMatches[1]." = CodeMirror.fromTextArea(document.getElementById('".$idMatches[1]."'), ".$editorOptions.");\n";
                    $globals[] =" var cmeditor_".$idMatches[1]." = false;";
                }
			}
            if($this->request->is('ajax')){
                $js = "setTimeout(function() { ".$js." }, 200)";
            } else {
                $js = "window.onload = function() {\n".$js."};\n";
            }
            //Globalize Codemirror instance variables as placeholders
            $js = implode("\n", $globals)."\n".$js;
		}
		if(!empty($js)){
			return $this->Html->scriptBlock($js, ['block' => $block]);
		}
        return;
	}
}


text:
namespace PhluffyFotos.Web.ViewModels
{
    using System.ComponentModel.DataAnnotations;

    public class AlbumCreateViewModel
    {
        [Required]
        public string Title { get; set; }
    }
}


text:
package com.swfarm.biz.warehouse.dto;

import java.util.Date;

import org.apache.commons.lang.StringUtils;

import com.swfarm.biz.oa.dto.SearchCriteria;
import com.swfarm.pub.utils.DateUtils;

public class SearchApvShippingCostCriteria extends SearchCriteria{

	private String allocationProductVoucherNo;

	private String shippingForwarderMethod;

	private String shippingForwarderCompany;

	private Date deliverTime;

	private Date startDate;

	private Date endDate;

	public String getAllocationProductVoucherNo() {
		return allocationProductVoucherNo;
	}

	public void setAllocationProductVoucherNo(String allocationProductVoucherNo) {
		this.allocationProductVoucherNo = allocationProductVoucherNo;
	}

	public String getShippingForwarderMethod() {
		return shippingForwarderMethod;
	}

	public void setShippingForwarderMethod(String shippingForwarderMethod) {
		this.shippingForwarderMethod = shippingForwarderMethod;
	}

	public String getShippingForwarderCompany() {
		return shippingForwarderCompany;
	}

	public void setShippingForwarderCompany(String shippingForwarderCompany) {
		this.shippingForwarderCompany = shippingForwarderCompany;
	}

	public Date getDeliverTime() {
		return deliverTime;
	}

	public void setDeliverTime(Date deliverTime) {
		this.deliverTime = deliverTime;
	}

	public String getRecordDateString() {
		if (deliverTime != null) {
			return DateUtils.dateToString(deliverTime, "yyyy/MM/dd");
		} else {
			return StringUtils.EMPTY;
		}
	}

	public Date getStartDate() {
		return startDate;
	}

	public String getStartDateString() {
		if (startDate != null) {
			return DateUtils.dateToString(startDate, "yyyy/MM/dd");
		} else {
			return StringUtils.EMPTY;
		}
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	public Date getEndDate() {
		return endDate;
	}

	public String getEndDateString() {
		if (endDate != null) {
			return DateUtils.dateToString(endDate, "yyyy/MM/dd");
		} else {
			return StringUtils.EMPTY;
		}
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

}