text:
package org.linqs.psl.runtime;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import org.linqs.psl.database.ReadableDatabase;
import org.linqs.psl.config.RuntimeOptions;
import org.linqs.psl.evaluation.statistics.ContinuousEvaluator;
import org.linqs.psl.evaluation.statistics.DiscreteEvaluator;
import org.linqs.psl.model.function.ExternalFunction;
import org.linqs.psl.model.term.Constant;
import org.linqs.psl.model.term.ConstantType;
import org.linqs.psl.model.term.UniqueStringID;

import org.junit.Test;

import java.nio.file.Paths;

public class SimpleAcquaintancesTest extends RuntimeTest {
    @Test
    public void testBase() {
        String modelPath = Paths.get(baseModelsDir, "simple-acquaintances.psl").toString();
        String dataPath = Paths.get(baseDataDir, "simple-acquaintances", "base.data").toString();

        runInference(modelPath, dataPath);
    }

    @Test
    public void testEval() {
        String modelPath = Paths.get(baseModelsDir, "simple-acquaintances.psl").toString();
        String dataPath = Paths.get(baseDataDir, "simple-acquaintances", "base.data").toString();

        RuntimeOptions.INFERENCE_EVAL.set(ContinuousEvaluator.class.getName());

        runInference(modelPath, dataPath);
    }

    @Test
    public void testMultipleEval() {
        String modelPath = Paths.get(baseModelsDir, "simple-acquaintances.psl").toString();
        String dataPath = Paths.get(baseDataDir, "simple-acquaintances", "base.data").toString();

        String evals = ContinuousEvaluator.class.getName() + "," + DiscreteEvaluator.class.getName();
        RuntimeOptions.INFERENCE_EVAL.set(evals);

        runInference(modelPath, dataPath);
    }

    @Test
    public void testTypes() {
        String modelPath = Paths.get(baseModelsDir, "simple-acquaintances.psl").toString();
        String dataPath = Paths.get(baseDataDir, "simple-acquaintances", "base_types.data").toString();

        runInference(modelPath, dataPath);
    }

    @Test
    public void testMixedTypes() {
        String modelPath = Paths.get(baseModelsDir, "simple-acquaintances.psl").toString();
        String dataPath = Paths.get(baseDataDir, "simple-acquaintances-mixed", "base.data").toString();

        runInference(modelPath, dataPath);
    }

    @Test
    public void testBlock() {
        String modelPath = Paths.get(baseModelsDir, "simple-acquaintances.psl").toString();
        String dataPath = Paths.get(baseDataDir, "simple-acquaintances", "base_block.data").toString();

        runInference(modelPath, dataPath);
    }

    @Test
    public void testErrorUndeclaredPredicate() {
        String modelPath = Paths.get(baseModelsDir, "simple-acquaintances.psl").toString();
        String dataPath = Paths.get(baseDataDir, "simple-acquaintances", "error_undeclared_predicate.data").toString();

        try {
            runInference(modelPath, dataPath);
            fail("Error not thrown on non-existent predicate.");
        } catch (RuntimeException ex) {
            // Expected.
        }
    }

    @Test
    public void testErrorDataInFunctional() {
        String modelPath = Paths.get(baseModelsDir, "simple-acquaintances.psl").toString();
        String dataPath = Paths.get(baseDataDir, "simple-acquaintances", "error_data_in_functional.data").toString();

        try {
            runInference(modelPath, dataPath);
            fail("Error not thrown on data in a functional predicate.");
        } catch (RuntimeException ex) {
            // Expected.
        }
    }

    @Test
    public void testFunctional() {
        String modelPath = Paths.get(baseModelsDir, "simple-acquaintances-functional.psl").toString();
        String dataPath = Paths.get(baseDataDir, "simple-acquaintances", "base_functional.data").toString();

        runInference(modelPath, dataPath);
    }

    @Test
    public void testErrorBadTopLevelKey() {
        String modelPath = Paths.get(baseModelsDir, "simple-acquaintances.psl").toString();
        String dataPath = Paths.get(baseDataDir, "simple-acquaintances", "error_bad_top_key.data").toString();

        try {
            runInference(modelPath, dataPath);
            fail("Error not thrown on bad top level key.");
        } catch (RuntimeException ex) {
            // Expected.
        }
    }

    @Test
    public void testErrorObservedTargets() {
        String modelPath = Paths.get(baseModelsDir, "simple-acquaintances.psl").toString();
        String dataPath = Paths.get(baseDataDir, "simple-acquaintances", "error_obs_targets.data").toString();

        try {
            runInference(modelPath, dataPath);
            fail("Error not thrown on atoms that are observed and targets.");
        } catch (RuntimeException ex) {
            // Expected.
        }
    }

    @Test
    public void testUnaryDataFile() {
        String modelPath = Paths.get(baseModelsDir, "unary.psl").toString();
        String dataPath = Paths.get(baseDataDir, "simple-acquaintances", "base_unary.data").toString();

        runInference(modelPath, dataPath);
    }

    // Not an actual similarity.
    public static class SimNameExternalFunction implements ExternalFunction {
        @Override
        public double getValue(ReadableDatabase db, Constant... args) {
            String a = ((UniqueStringID)args[0]).getID();
            String b = ((UniqueStringID)args[1]).getID();

            return Math.abs(a.length() - b.length()) / (double)(Math.max(a.length(), b.length()));
        }

        @Override
        public int getArity() {
            return 2;
        }

        @Override
        public ConstantType[] getArgumentTypes() {
            return new ConstantType[] {ConstantType.UniqueStringID, ConstantType.UniqueStringID};
        }
    }
}


text:
<?php

/**
 * Get members from sorted set by min and max score
 *
 * @author Ivan Shumkov
 * @package Rediska
 * @subpackage Commands
 * @version 0.5.6
 * @link http://rediska.geometria-lab.net
 * @license http://www.opensource.org/licenses/bsd-license.php
 */
class Rediska_Command_GetFromSortedSetByScore extends Rediska_Command_Abstract
{
    /**
     * Supported version
     *
     * @var string
     */
    protected $_version = '1.1';

    /**
     * Create command
     *
     * @param string            $key        Key name
     * @param number            $min        Min score
     * @param number            $max        Max score
     * @param boolean[optional] $withScores Get with scores. For default is false
     * @param integer[optional] $limit      Limit. For default is no limit
     * @param integer[optional] $offset     Offset. For default is no offset
     * @return Rediska_Connection_Exec
     */
    public function create($key, $min, $max, $withScores = false, $limit = null, $offset = null)
    {
        $connection = $this->_rediska->getConnectionByKeyName($key);

        $command = array('ZRANGEBYSCORE',
                         $this->_rediska->getOption('namespace') . $key,
                         $min,
                         $max);

        if (!is_null($limit)) {
            if (is_null($offset)) {
                $offset = 0;
            }
            $command[] = 'LIMIT';
            $command[] = $offset;
            $command[] = $limit;
        }

        if ($withScores) {
            $this->_throwExceptionIfNotSupported('1.3.4');

            $command[] = 'WITHSCORES';
        }

        return new Rediska_Connection_Exec($connection, $command);
    }

    /**
     * Parse response
     *
     * @param array $response
     * @return array
     */
    public function parseResponse($response)
    {
        $values = $response;

        if ($this->withScores) {
            $values = Rediska_Command_Response_ValueAndScore::combine($this->_rediska, $values);
        } else {
            $values = array_map(array($this->_rediska->getSerializer(), 'unserialize'), $values);
        }

        return $values;
    }
}

redpajama_set_name: RedPajamaGithub


text:
/*
 * @(#)RemoteSubsystem.java        1.0 09/12/14
 *
 * This file has been auto-generated by JNC, the
 * Java output format plug-in of pyang.
 * Origin: module "hcta-epc", revision: "2014-09-18".
 */

package hctaEpc.mmeSgsn.interface_.ss7;

import Element;

import Epc;

import JNCException;

import com.tailf.jnc.YangElement;
import com.tailf.jnc.YangString;
import com.tailf.jnc.YangUInt32;
import com.tailf.jnc.YangUInt8;

/**
 * This class represents an element from
 * the namespace http://hitachi-cta.com/ns/epc
 * generated to "src/hctaEpc/mmeSgsn/interface_/ss7/remote-subsystem"
 * <p>
 * See line 395 in
 * sigtranCli.yang
 *
 * @version 1.0 2014-12-09
 * @author Auto Generated
 */
public class RemoteSubsystem extends YangElement {

    private static final long serialVersionUID = 1L;

    /**
     * Constructor for an empty RemoteSubsystem object.
     */
    public RemoteSubsystem() {
        super(Epc.NAMESPACE, "remote-subsystem");
    }

    /**
     * Clones this object, returning an exact copy.
     * @return A clone of the object.
     */
    public RemoteSubsystem clone() {
        return (RemoteSubsystem)cloneContent(new RemoteSubsystem());
    }

    /**
     * Clones this object, returning a shallow copy.
     * @return A clone of the object. Children are not included.
     */
    public RemoteSubsystem cloneShallow() {
        return (RemoteSubsystem)cloneShallowContent(new RemoteSubsystem());
    }

    /**
     * @return An array with the identifiers of any key children
     */
    public String[] keyNames() {
        return null;
    }

    /**
     * @return An array with the identifiers of any children, in order.
     */
    public String[] childrenNames() {
        return new String[] {
            "destination-point-code",
            "remote-subsystem-num",
            "location",
            "service",
            "state",
            "ludt-rx",
            "xudt-rx",
            "udts-rx",
            "udt-rx",
            "xudts-tx",
            "xudts-rx",
            "ludts-tx",
            "ludts-rx",
            "udt-tx",
            "udts-tx",
            "xudt-tx",
            "ludt-tx",
            "routing-failures",
            "trans-from-allowed-to-prohib",
        };
    }

    /* Access methods for optional leaf child: "destination-point-code". */

    /**
     * Gets the value for child leaf "destination-point-code".
     * @return The value of the leaf.
     */
    public YangString getDestinationPointCodeValue() throws JNCException {
        return (YangString)getValue("destination-point-code");
    }

    /**
     * Sets the value for child leaf "destination-point-code",
     * using instance of generated typedef class.
     * @param destinationPointCodeValue The value to set.
     * @param destinationPointCodeValue used during instantiation.
     */
    public void setDestinationPointCodeValue(YangString destinationPointCodeValue)
            throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "destination-point-code",
            destinationPointCodeValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "destination-point-code",
     * using a String value.
     * @param destinationPointCodeValue used during instantiation.
     */
    public void setDestinationPointCodeValue(String destinationPointCodeValue)
            throws JNCException {
        setDestinationPointCodeValue(new YangString(destinationPointCodeValue));
    }

    /**
     * Unsets the value for child leaf "destination-point-code".
     */
    public void unsetDestinationPointCodeValue() throws JNCException {
        delete("destination-point-code");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "destination-point-code" leaf will not have a value.
     */
    public void addDestinationPointCode() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "destination-point-code",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "destination-point-code" with operation "replace".
     */
    public void markDestinationPointCodeReplace() throws JNCException {
        markLeafReplace("destinationPointCode");
    }

    /**
     * Marks the leaf "destination-point-code" with operation "merge".
     */
    public void markDestinationPointCodeMerge() throws JNCException {
        markLeafMerge("destinationPointCode");
    }

    /**
     * Marks the leaf "destination-point-code" with operation "create".
     */
    public void markDestinationPointCodeCreate() throws JNCException {
        markLeafCreate("destinationPointCode");
    }

    /**
     * Marks the leaf "destination-point-code" with operation "delete".
     */
    public void markDestinationPointCodeDelete() throws JNCException {
        markLeafDelete("destinationPointCode");
    }

    /* Access methods for optional leaf child: "remote-subsystem-num". */

    /**
     * Gets the value for child leaf "remote-subsystem-num".
     * @return The value of the leaf.
     */
    public YangUInt8 getRemoteSubsystemNumValue() throws JNCException {
        return (YangUInt8)getValue("remote-subsystem-num");
    }

    /**
     * Sets the value for child leaf "remote-subsystem-num",
     * using instance of generated typedef class.
     * @param remoteSubsystemNumValue The value to set.
     * @param remoteSubsystemNumValue used during instantiation.
     */
    public void setRemoteSubsystemNumValue(YangUInt8 remoteSubsystemNumValue)
            throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "remote-subsystem-num",
            remoteSubsystemNumValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "remote-subsystem-num",
     * using Java primitive values.
     * @param remoteSubsystemNumValue used during instantiation.
     */
    public void setRemoteSubsystemNumValue(short remoteSubsystemNumValue)
            throws JNCException {
        setRemoteSubsystemNumValue(new YangUInt8(remoteSubsystemNumValue));
    }

    /**
     * Sets the value for child leaf "remote-subsystem-num",
     * using a String value.
     * @param remoteSubsystemNumValue used during instantiation.
     */
    public void setRemoteSubsystemNumValue(String remoteSubsystemNumValue)
            throws JNCException {
        setRemoteSubsystemNumValue(new YangUInt8(remoteSubsystemNumValue));
    }

    /**
     * Unsets the value for child leaf "remote-subsystem-num".
     */
    public void unsetRemoteSubsystemNumValue() throws JNCException {
        delete("remote-subsystem-num");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "remote-subsystem-num" leaf will not have a value.
     */
    public void addRemoteSubsystemNum() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "remote-subsystem-num",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "remote-subsystem-num" with operation "replace".
     */
    public void markRemoteSubsystemNumReplace() throws JNCException {
        markLeafReplace("remoteSubsystemNum");
    }

    /**
     * Marks the leaf "remote-subsystem-num" with operation "merge".
     */
    public void markRemoteSubsystemNumMerge() throws JNCException {
        markLeafMerge("remoteSubsystemNum");
    }

    /**
     * Marks the leaf "remote-subsystem-num" with operation "create".
     */
    public void markRemoteSubsystemNumCreate() throws JNCException {
        markLeafCreate("remoteSubsystemNum");
    }

    /**
     * Marks the leaf "remote-subsystem-num" with operation "delete".
     */
    public void markRemoteSubsystemNumDelete() throws JNCException {
        markLeafDelete("remoteSubsystemNum");
    }

    /* Access methods for optional leaf child: "location". */

    /**
     * Gets the value for child leaf "location".
     * @return The value of the leaf.
     */
    public YangString getLocationValue() throws JNCException {
        return (YangString)getValue("location");
    }

    /**
     * Sets the value for child leaf "location",
     * using instance of generated typedef class.
     * @param locationValue The value to set.
     * @param locationValue used during instantiation.
     */
    public void setLocationValue(YangString locationValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "location",
            locationValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "location",
     * using a String value.
     * @param locationValue used during instantiation.
     */
    public void setLocationValue(String locationValue) throws JNCException {
        setLocationValue(new YangString(locationValue));
    }

    /**
     * Unsets the value for child leaf "location".
     */
    public void unsetLocationValue() throws JNCException {
        delete("location");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "location" leaf will not have a value.
     */
    public void addLocation() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "location",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "location" with operation "replace".
     */
    public void markLocationReplace() throws JNCException {
        markLeafReplace("location");
    }

    /**
     * Marks the leaf "location" with operation "merge".
     */
    public void markLocationMerge() throws JNCException {
        markLeafMerge("location");
    }

    /**
     * Marks the leaf "location" with operation "create".
     */
    public void markLocationCreate() throws JNCException {
        markLeafCreate("location");
    }

    /**
     * Marks the leaf "location" with operation "delete".
     */
    public void markLocationDelete() throws JNCException {
        markLeafDelete("location");
    }

    /* Access methods for optional leaf child: "service". */

    /**
     * Gets the value for child leaf "service".
     * @return The value of the leaf.
     */
    public YangString getServiceValue() throws JNCException {
        return (YangString)getValue("service");
    }

    /**
     * Sets the value for child leaf "service",
     * using instance of generated typedef class.
     * @param serviceValue The value to set.
     * @param serviceValue used during instantiation.
     */
    public void setServiceValue(YangString serviceValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "service",
            serviceValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "service",
     * using a String value.
     * @param serviceValue used during instantiation.
     */
    public void setServiceValue(String serviceValue) throws JNCException {
        setServiceValue(new YangString(serviceValue));
    }

    /**
     * Unsets the value for child leaf "service".
     */
    public void unsetServiceValue() throws JNCException {
        delete("service");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "service" leaf will not have a value.
     */
    public void addService() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "service",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "service" with operation "replace".
     */
    public void markServiceReplace() throws JNCException {
        markLeafReplace("service");
    }

    /**
     * Marks the leaf "service" with operation "merge".
     */
    public void markServiceMerge() throws JNCException {
        markLeafMerge("service");
    }

    /**
     * Marks the leaf "service" with operation "create".
     */
    public void markServiceCreate() throws JNCException {
        markLeafCreate("service");
    }

    /**
     * Marks the leaf "service" with operation "delete".
     */
    public void markServiceDelete() throws JNCException {
        markLeafDelete("service");
    }

    /* Access methods for optional leaf child: "state". */

    /**
     * Gets the value for child leaf "state".
     * @return The value of the leaf.
     */
    public YangString getStateValue() throws JNCException {
        return (YangString)getValue("state");
    }

    /**
     * Sets the value for child leaf "state",
     * using instance of generated typedef class.
     * @param stateValue The value to set.
     * @param stateValue used during instantiation.
     */
    public void setStateValue(YangString stateValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "state",
            stateValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "state",
     * using a String value.
     * @param stateValue used during instantiation.
     */
    public void setStateValue(String stateValue) throws JNCException {
        setStateValue(new YangString(stateValue));
    }

    /**
     * Unsets the value for child leaf "state".
     */
    public void unsetStateValue() throws JNCException {
        delete("state");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "state" leaf will not have a value.
     */
    public void addState() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "state",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "state" with operation "replace".
     */
    public void markStateReplace() throws JNCException {
        markLeafReplace("state");
    }

    /**
     * Marks the leaf "state" with operation "merge".
     */
    public void markStateMerge() throws JNCException {
        markLeafMerge("state");
    }

    /**
     * Marks the leaf "state" with operation "create".
     */
    public void markStateCreate() throws JNCException {
        markLeafCreate("state");
    }

    /**
     * Marks the leaf "state" with operation "delete".
     */
    public void markStateDelete() throws JNCException {
        markLeafDelete("state");
    }

    /* Access methods for optional leaf child: "ludt-rx". */

    /**
     * Gets the value for child leaf "ludt-rx".
     * @return The value of the leaf.
     */
    public YangUInt32 getLudtRxValue() throws JNCException {
        return (YangUInt32)getValue("ludt-rx");
    }

    /**
     * Sets the value for child leaf "ludt-rx",
     * using instance of generated typedef class.
     * @param ludtRxValue The value to set.
     * @param ludtRxValue used during instantiation.
     */
    public void setLudtRxValue(YangUInt32 ludtRxValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "ludt-rx",
            ludtRxValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "ludt-rx",
     * using Java primitive values.
     * @param ludtRxValue used during instantiation.
     */
    public void setLudtRxValue(long ludtRxValue) throws JNCException {
        setLudtRxValue(new YangUInt32(ludtRxValue));
    }

    /**
     * Sets the value for child leaf "ludt-rx",
     * using a String value.
     * @param ludtRxValue used during instantiation.
     */
    public void setLudtRxValue(String ludtRxValue) throws JNCException {
        setLudtRxValue(new YangUInt32(ludtRxValue));
    }

    /**
     * Unsets the value for child leaf "ludt-rx".
     */
    public void unsetLudtRxValue() throws JNCException {
        delete("ludt-rx");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "ludt-rx" leaf will not have a value.
     */
    public void addLudtRx() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "ludt-rx",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "ludt-rx" with operation "replace".
     */
    public void markLudtRxReplace() throws JNCException {
        markLeafReplace("ludtRx");
    }

    /**
     * Marks the leaf "ludt-rx" with operation "merge".
     */
    public void markLudtRxMerge() throws JNCException {
        markLeafMerge("ludtRx");
    }

    /**
     * Marks the leaf "ludt-rx" with operation "create".
     */
    public void markLudtRxCreate() throws JNCException {
        markLeafCreate("ludtRx");
    }

    /**
     * Marks the leaf "ludt-rx" with operation "delete".
     */
    public void markLudtRxDelete() throws JNCException {
        markLeafDelete("ludtRx");
    }

    /* Access methods for optional leaf child: "xudt-rx". */

    /**
     * Gets the value for child leaf "xudt-rx".
     * @return The value of the leaf.
     */
    public YangUInt32 getXudtRxValue() throws JNCException {
        return (YangUInt32)getValue("xudt-rx");
    }

    /**
     * Sets the value for child leaf "xudt-rx",
     * using instance of generated typedef class.
     * @param xudtRxValue The value to set.
     * @param xudtRxValue used during instantiation.
     */
    public void setXudtRxValue(YangUInt32 xudtRxValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "xudt-rx",
            xudtRxValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "xudt-rx",
     * using Java primitive values.
     * @param xudtRxValue used during instantiation.
     */
    public void setXudtRxValue(long xudtRxValue) throws JNCException {
        setXudtRxValue(new YangUInt32(xudtRxValue));
    }

    /**
     * Sets the value for child leaf "xudt-rx",
     * using a String value.
     * @param xudtRxValue used during instantiation.
     */
    public void setXudtRxValue(String xudtRxValue) throws JNCException {
        setXudtRxValue(new YangUInt32(xudtRxValue));
    }

    /**
     * Unsets the value for child leaf "xudt-rx".
     */
    public void unsetXudtRxValue() throws JNCException {
        delete("xudt-rx");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "xudt-rx" leaf will not have a value.
     */
    public void addXudtRx() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "xudt-rx",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "xudt-rx" with operation "replace".
     */
    public void markXudtRxReplace() throws JNCException {
        markLeafReplace("xudtRx");
    }

    /**
     * Marks the leaf "xudt-rx" with operation "merge".
     */
    public void markXudtRxMerge() throws JNCException {
        markLeafMerge("xudtRx");
    }

    /**
     * Marks the leaf "xudt-rx" with operation "create".
     */
    public void markXudtRxCreate() throws JNCException {
        markLeafCreate("xudtRx");
    }

    /**
     * Marks the leaf "xudt-rx" with operation "delete".
     */
    public void markXudtRxDelete() throws JNCException {
        markLeafDelete("xudtRx");
    }

    /* Access methods for optional leaf child: "udts-rx". */

    /**
     * Gets the value for child leaf "udts-rx".
     * @return The value of the leaf.
     */
    public YangUInt32 getUdtsRxValue() throws JNCException {
        return (YangUInt32)getValue("udts-rx");
    }

    /**
     * Sets the value for child leaf "udts-rx",
     * using instance of generated typedef class.
     * @param udtsRxValue The value to set.
     * @param udtsRxValue used during instantiation.
     */
    public void setUdtsRxValue(YangUInt32 udtsRxValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "udts-rx",
            udtsRxValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "udts-rx",
     * using Java primitive values.
     * @param udtsRxValue used during instantiation.
     */
    public void setUdtsRxValue(long udtsRxValue) throws JNCException {
        setUdtsRxValue(new YangUInt32(udtsRxValue));
    }

    /**
     * Sets the value for child leaf "udts-rx",
     * using a String value.
     * @param udtsRxValue used during instantiation.
     */
    public void setUdtsRxValue(String udtsRxValue) throws JNCException {
        setUdtsRxValue(new YangUInt32(udtsRxValue));
    }

    /**
     * Unsets the value for child leaf "udts-rx".
     */
    public void unsetUdtsRxValue() throws JNCException {
        delete("udts-rx");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "udts-rx" leaf will not have a value.
     */
    public void addUdtsRx() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "udts-rx",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "udts-rx" with operation "replace".
     */
    public void markUdtsRxReplace() throws JNCException {
        markLeafReplace("udtsRx");
    }

    /**
     * Marks the leaf "udts-rx" with operation "merge".
     */
    public void markUdtsRxMerge() throws JNCException {
        markLeafMerge("udtsRx");
    }

    /**
     * Marks the leaf "udts-rx" with operation "create".
     */
    public void markUdtsRxCreate() throws JNCException {
        markLeafCreate("udtsRx");
    }

    /**
     * Marks the leaf "udts-rx" with operation "delete".
     */
    public void markUdtsRxDelete() throws JNCException {
        markLeafDelete("udtsRx");
    }

    /* Access methods for optional leaf child: "udt-rx". */

    /**
     * Gets the value for child leaf "udt-rx".
     * @return The value of the leaf.
     */
    public YangUInt32 getUdtRxValue() throws JNCException {
        return (YangUInt32)getValue("udt-rx");
    }

    /**
     * Sets the value for child leaf "udt-rx",
     * using instance of generated typedef class.
     * @param udtRxValue The value to set.
     * @param udtRxValue used during instantiation.
     */
    public void setUdtRxValue(YangUInt32 udtRxValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "udt-rx",
            udtRxValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "udt-rx",
     * using Java primitive values.
     * @param udtRxValue used during instantiation.
     */
    public void setUdtRxValue(long udtRxValue) throws JNCException {
        setUdtRxValue(new YangUInt32(udtRxValue));
    }

    /**
     * Sets the value for child leaf "udt-rx",
     * using a String value.
     * @param udtRxValue used during instantiation.
     */
    public void setUdtRxValue(String udtRxValue) throws JNCException {
        setUdtRxValue(new YangUInt32(udtRxValue));
    }

    /**
     * Unsets the value for child leaf "udt-rx".
     */
    public void unsetUdtRxValue() throws JNCException {
        delete("udt-rx");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "udt-rx" leaf will not have a value.
     */
    public void addUdtRx() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "udt-rx",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "udt-rx" with operation "replace".
     */
    public void markUdtRxReplace() throws JNCException {
        markLeafReplace("udtRx");
    }

    /**
     * Marks the leaf "udt-rx" with operation "merge".
     */
    public void markUdtRxMerge() throws JNCException {
        markLeafMerge("udtRx");
    }

    /**
     * Marks the leaf "udt-rx" with operation "create".
     */
    public void markUdtRxCreate() throws JNCException {
        markLeafCreate("udtRx");
    }

    /**
     * Marks the leaf "udt-rx" with operation "delete".
     */
    public void markUdtRxDelete() throws JNCException {
        markLeafDelete("udtRx");
    }

    /* Access methods for optional leaf child: "xudts-tx". */

    /**
     * Gets the value for child leaf "xudts-tx".
     * @return The value of the leaf.
     */
    public YangUInt32 getXudtsTxValue() throws JNCException {
        return (YangUInt32)getValue("xudts-tx");
    }

    /**
     * Sets the value for child leaf "xudts-tx",
     * using instance of generated typedef class.
     * @param xudtsTxValue The value to set.
     * @param xudtsTxValue used during instantiation.
     */
    public void setXudtsTxValue(YangUInt32 xudtsTxValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "xudts-tx",
            xudtsTxValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "xudts-tx",
     * using Java primitive values.
     * @param xudtsTxValue used during instantiation.
     */
    public void setXudtsTxValue(long xudtsTxValue) throws JNCException {
        setXudtsTxValue(new YangUInt32(xudtsTxValue));
    }

    /**
     * Sets the value for child leaf "xudts-tx",
     * using a String value.
     * @param xudtsTxValue used during instantiation.
     */
    public void setXudtsTxValue(String xudtsTxValue) throws JNCException {
        setXudtsTxValue(new YangUInt32(xudtsTxValue));
    }

    /**
     * Unsets the value for child leaf "xudts-tx".
     */
    public void unsetXudtsTxValue() throws JNCException {
        delete("xudts-tx");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "xudts-tx" leaf will not have a value.
     */
    public void addXudtsTx() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "xudts-tx",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "xudts-tx" with operation "replace".
     */
    public void markXudtsTxReplace() throws JNCException {
        markLeafReplace("xudtsTx");
    }

    /**
     * Marks the leaf "xudts-tx" with operation "merge".
     */
    public void markXudtsTxMerge() throws JNCException {
        markLeafMerge("xudtsTx");
    }

    /**
     * Marks the leaf "xudts-tx" with operation "create".
     */
    public void markXudtsTxCreate() throws JNCException {
        markLeafCreate("xudtsTx");
    }

    /**
     * Marks the leaf "xudts-tx" with operation "delete".
     */
    public void markXudtsTxDelete() throws JNCException {
        markLeafDelete("xudtsTx");
    }

    /* Access methods for optional leaf child: "xudts-rx". */

    /**
     * Gets the value for child leaf "xudts-rx".
     * @return The value of the leaf.
     */
    public YangUInt32 getXudtsRxValue() throws JNCException {
        return (YangUInt32)getValue("xudts-rx");
    }

    /**
     * Sets the value for child leaf "xudts-rx",
     * using instance of generated typedef class.
     * @param xudtsRxValue The value to set.
     * @param xudtsRxValue used during instantiation.
     */
    public void setXudtsRxValue(YangUInt32 xudtsRxValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "xudts-rx",
            xudtsRxValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "xudts-rx",
     * using Java primitive values.
     * @param xudtsRxValue used during instantiation.
     */
    public void setXudtsRxValue(long xudtsRxValue) throws JNCException {
        setXudtsRxValue(new YangUInt32(xudtsRxValue));
    }

    /**
     * Sets the value for child leaf "xudts-rx",
     * using a String value.
     * @param xudtsRxValue used during instantiation.
     */
    public void setXudtsRxValue(String xudtsRxValue) throws JNCException {
        setXudtsRxValue(new YangUInt32(xudtsRxValue));
    }

    /**
     * Unsets the value for child leaf "xudts-rx".
     */
    public void unsetXudtsRxValue() throws JNCException {
        delete("xudts-rx");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "xudts-rx" leaf will not have a value.
     */
    public void addXudtsRx() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "xudts-rx",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "xudts-rx" with operation "replace".
     */
    public void markXudtsRxReplace() throws JNCException {
        markLeafReplace("xudtsRx");
    }

    /**
     * Marks the leaf "xudts-rx" with operation "merge".
     */
    public void markXudtsRxMerge() throws JNCException {
        markLeafMerge("xudtsRx");
    }

    /**
     * Marks the leaf "xudts-rx" with operation "create".
     */
    public void markXudtsRxCreate() throws JNCException {
        markLeafCreate("xudtsRx");
    }

    /**
     * Marks the leaf "xudts-rx" with operation "delete".
     */
    public void markXudtsRxDelete() throws JNCException {
        markLeafDelete("xudtsRx");
    }

    /* Access methods for optional leaf child: "ludts-tx". */

    /**
     * Gets the value for child leaf "ludts-tx".
     * @return The value of the leaf.
     */
    public YangUInt32 getLudtsTxValue() throws JNCException {
        return (YangUInt32)getValue("ludts-tx");
    }

    /**
     * Sets the value for child leaf "ludts-tx",
     * using instance of generated typedef class.
     * @param ludtsTxValue The value to set.
     * @param ludtsTxValue used during instantiation.
     */
    public void setLudtsTxValue(YangUInt32 ludtsTxValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "ludts-tx",
            ludtsTxValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "ludts-tx",
     * using Java primitive values.
     * @param ludtsTxValue used during instantiation.
     */
    public void setLudtsTxValue(long ludtsTxValue) throws JNCException {
        setLudtsTxValue(new YangUInt32(ludtsTxValue));
    }

    /**
     * Sets the value for child leaf "ludts-tx",
     * using a String value.
     * @param ludtsTxValue used during instantiation.
     */
    public void setLudtsTxValue(String ludtsTxValue) throws JNCException {
        setLudtsTxValue(new YangUInt32(ludtsTxValue));
    }

    /**
     * Unsets the value for child leaf "ludts-tx".
     */
    public void unsetLudtsTxValue() throws JNCException {
        delete("ludts-tx");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "ludts-tx" leaf will not have a value.
     */
    public void addLudtsTx() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "ludts-tx",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "ludts-tx" with operation "replace".
     */
    public void markLudtsTxReplace() throws JNCException {
        markLeafReplace("ludtsTx");
    }

    /**
     * Marks the leaf "ludts-tx" with operation "merge".
     */
    public void markLudtsTxMerge() throws JNCException {
        markLeafMerge("ludtsTx");
    }

    /**
     * Marks the leaf "ludts-tx" with operation "create".
     */
    public void markLudtsTxCreate() throws JNCException {
        markLeafCreate("ludtsTx");
    }

    /**
     * Marks the leaf "ludts-tx" with operation "delete".
     */
    public void markLudtsTxDelete() throws JNCException {
        markLeafDelete("ludtsTx");
    }

    /* Access methods for optional leaf child: "ludts-rx". */

    /**
     * Gets the value for child leaf "ludts-rx".
     * @return The value of the leaf.
     */
    public YangUInt32 getLudtsRxValue() throws JNCException {
        return (YangUInt32)getValue("ludts-rx");
    }

    /**
     * Sets the value for child leaf "ludts-rx",
     * using instance of generated typedef class.
     * @param ludtsRxValue The value to set.
     * @param ludtsRxValue used during instantiation.
     */
    public void setLudtsRxValue(YangUInt32 ludtsRxValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "ludts-rx",
            ludtsRxValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "ludts-rx",
     * using Java primitive values.
     * @param ludtsRxValue used during instantiation.
     */
    public void setLudtsRxValue(long ludtsRxValue) throws JNCException {
        setLudtsRxValue(new YangUInt32(ludtsRxValue));
    }

    /**
     * Sets the value for child leaf "ludts-rx",
     * using a String value.
     * @param ludtsRxValue used during instantiation.
     */
    public void setLudtsRxValue(String ludtsRxValue) throws JNCException {
        setLudtsRxValue(new YangUInt32(ludtsRxValue));
    }

    /**
     * Unsets the value for child leaf "ludts-rx".
     */
    public void unsetLudtsRxValue() throws JNCException {
        delete("ludts-rx");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "ludts-rx" leaf will not have a value.
     */
    public void addLudtsRx() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "ludts-rx",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "ludts-rx" with operation "replace".
     */
    public void markLudtsRxReplace() throws JNCException {
        markLeafReplace("ludtsRx");
    }

    /**
     * Marks the leaf "ludts-rx" with operation "merge".
     */
    public void markLudtsRxMerge() throws JNCException {
        markLeafMerge("ludtsRx");
    }

    /**
     * Marks the leaf "ludts-rx" with operation "create".
     */
    public void markLudtsRxCreate() throws JNCException {
        markLeafCreate("ludtsRx");
    }

    /**
     * Marks the leaf "ludts-rx" with operation "delete".
     */
    public void markLudtsRxDelete() throws JNCException {
        markLeafDelete("ludtsRx");
    }

    /* Access methods for optional leaf child: "udt-tx". */

    /**
     * Gets the value for child leaf "udt-tx".
     * @return The value of the leaf.
     */
    public YangUInt32 getUdtTxValue() throws JNCException {
        return (YangUInt32)getValue("udt-tx");
    }

    /**
     * Sets the value for child leaf "udt-tx",
     * using instance of generated typedef class.
     * @param udtTxValue The value to set.
     * @param udtTxValue used during instantiation.
     */
    public void setUdtTxValue(YangUInt32 udtTxValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "udt-tx",
            udtTxValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "udt-tx",
     * using Java primitive values.
     * @param udtTxValue used during instantiation.
     */
    public void setUdtTxValue(long udtTxValue) throws JNCException {
        setUdtTxValue(new YangUInt32(udtTxValue));
    }

    /**
     * Sets the value for child leaf "udt-tx",
     * using a String value.
     * @param udtTxValue used during instantiation.
     */
    public void setUdtTxValue(String udtTxValue) throws JNCException {
        setUdtTxValue(new YangUInt32(udtTxValue));
    }

    /**
     * Unsets the value for child leaf "udt-tx".
     */
    public void unsetUdtTxValue() throws JNCException {
        delete("udt-tx");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "udt-tx" leaf will not have a value.
     */
    public void addUdtTx() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "udt-tx",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "udt-tx" with operation "replace".
     */
    public void markUdtTxReplace() throws JNCException {
        markLeafReplace("udtTx");
    }

    /**
     * Marks the leaf "udt-tx" with operation "merge".
     */
    public void markUdtTxMerge() throws JNCException {
        markLeafMerge("udtTx");
    }

    /**
     * Marks the leaf "udt-tx" with operation "create".
     */
    public void markUdtTxCreate() throws JNCException {
        markLeafCreate("udtTx");
    }

    /**
     * Marks the leaf "udt-tx" with operation "delete".
     */
    public void markUdtTxDelete() throws JNCException {
        markLeafDelete("udtTx");
    }

    /* Access methods for optional leaf child: "udts-tx". */

    /**
     * Gets the value for child leaf "udts-tx".
     * @return The value of the leaf.
     */
    public YangUInt32 getUdtsTxValue() throws JNCException {
        return (YangUInt32)getValue("udts-tx");
    }

    /**
     * Sets the value for child leaf "udts-tx",
     * using instance of generated typedef class.
     * @param udtsTxValue The value to set.
     * @param udtsTxValue used during instantiation.
     */
    public void setUdtsTxValue(YangUInt32 udtsTxValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "udts-tx",
            udtsTxValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "udts-tx",
     * using Java primitive values.
     * @param udtsTxValue used during instantiation.
     */
    public void setUdtsTxValue(long udtsTxValue) throws JNCException {
        setUdtsTxValue(new YangUInt32(udtsTxValue));
    }

    /**
     * Sets the value for child leaf "udts-tx",
     * using a String value.
     * @param udtsTxValue used during instantiation.
     */
    public void setUdtsTxValue(String udtsTxValue) throws JNCException {
        setUdtsTxValue(new YangUInt32(udtsTxValue));
    }

    /**
     * Unsets the value for child leaf "udts-tx".
     */
    public void unsetUdtsTxValue() throws JNCException {
        delete("udts-tx");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "udts-tx" leaf will not have a value.
     */
    public void addUdtsTx() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "udts-tx",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "udts-tx" with operation "replace".
     */
    public void markUdtsTxReplace() throws JNCException {
        markLeafReplace("udtsTx");
    }

    /**
     * Marks the leaf "udts-tx" with operation "merge".
     */
    public void markUdtsTxMerge() throws JNCException {
        markLeafMerge("udtsTx");
    }

    /**
     * Marks the leaf "udts-tx" with operation "create".
     */
    public void markUdtsTxCreate() throws JNCException {
        markLeafCreate("udtsTx");
    }

    /**
     * Marks the leaf "udts-tx" with operation "delete".
     */
    public void markUdtsTxDelete() throws JNCException {
        markLeafDelete("udtsTx");
    }

    /* Access methods for optional leaf child: "xudt-tx". */

    /**
     * Gets the value for child leaf "xudt-tx".
     * @return The value of the leaf.
     */
    public YangUInt32 getXudtTxValue() throws JNCException {
        return (YangUInt32)getValue("xudt-tx");
    }

    /**
     * Sets the value for child leaf "xudt-tx",
     * using instance of generated typedef class.
     * @param xudtTxValue The value to set.
     * @param xudtTxValue used during instantiation.
     */
    public void setXudtTxValue(YangUInt32 xudtTxValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "xudt-tx",
            xudtTxValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "xudt-tx",
     * using Java primitive values.
     * @param xudtTxValue used during instantiation.
     */
    public void setXudtTxValue(long xudtTxValue) throws JNCException {
        setXudtTxValue(new YangUInt32(xudtTxValue));
    }

    /**
     * Sets the value for child leaf "xudt-tx",
     * using a String value.
     * @param xudtTxValue used during instantiation.
     */
    public void setXudtTxValue(String xudtTxValue) throws JNCException {
        setXudtTxValue(new YangUInt32(xudtTxValue));
    }

    /**
     * Unsets the value for child leaf "xudt-tx".
     */
    public void unsetXudtTxValue() throws JNCException {
        delete("xudt-tx");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "xudt-tx" leaf will not have a value.
     */
    public void addXudtTx() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "xudt-tx",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "xudt-tx" with operation "replace".
     */
    public void markXudtTxReplace() throws JNCException {
        markLeafReplace("xudtTx");
    }

    /**
     * Marks the leaf "xudt-tx" with operation "merge".
     */
    public void markXudtTxMerge() throws JNCException {
        markLeafMerge("xudtTx");
    }

    /**
     * Marks the leaf "xudt-tx" with operation "create".
     */
    public void markXudtTxCreate() throws JNCException {
        markLeafCreate("xudtTx");
    }

    /**
     * Marks the leaf "xudt-tx" with operation "delete".
     */
    public void markXudtTxDelete() throws JNCException {
        markLeafDelete("xudtTx");
    }

    /* Access methods for optional leaf child: "ludt-tx". */

    /**
     * Gets the value for child leaf "ludt-tx".
     * @return The value of the leaf.
     */
    public YangUInt32 getLudtTxValue() throws JNCException {
        return (YangUInt32)getValue("ludt-tx");
    }

    /**
     * Sets the value for child leaf "ludt-tx",
     * using instance of generated typedef class.
     * @param ludtTxValue The value to set.
     * @param ludtTxValue used during instantiation.
     */
    public void setLudtTxValue(YangUInt32 ludtTxValue) throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "ludt-tx",
            ludtTxValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "ludt-tx",
     * using Java primitive values.
     * @param ludtTxValue used during instantiation.
     */
    public void setLudtTxValue(long ludtTxValue) throws JNCException {
        setLudtTxValue(new YangUInt32(ludtTxValue));
    }

    /**
     * Sets the value for child leaf "ludt-tx",
     * using a String value.
     * @param ludtTxValue used during instantiation.
     */
    public void setLudtTxValue(String ludtTxValue) throws JNCException {
        setLudtTxValue(new YangUInt32(ludtTxValue));
    }

    /**
     * Unsets the value for child leaf "ludt-tx".
     */
    public void unsetLudtTxValue() throws JNCException {
        delete("ludt-tx");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "ludt-tx" leaf will not have a value.
     */
    public void addLudtTx() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "ludt-tx",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "ludt-tx" with operation "replace".
     */
    public void markLudtTxReplace() throws JNCException {
        markLeafReplace("ludtTx");
    }

    /**
     * Marks the leaf "ludt-tx" with operation "merge".
     */
    public void markLudtTxMerge() throws JNCException {
        markLeafMerge("ludtTx");
    }

    /**
     * Marks the leaf "ludt-tx" with operation "create".
     */
    public void markLudtTxCreate() throws JNCException {
        markLeafCreate("ludtTx");
    }

    /**
     * Marks the leaf "ludt-tx" with operation "delete".
     */
    public void markLudtTxDelete() throws JNCException {
        markLeafDelete("ludtTx");
    }

    /* Access methods for optional leaf child: "routing-failures". */

    /**
     * Gets the value for child leaf "routing-failures".
     * @return The value of the leaf.
     */
    public YangUInt32 getRoutingFailuresValue() throws JNCException {
        return (YangUInt32)getValue("routing-failures");
    }

    /**
     * Sets the value for child leaf "routing-failures",
     * using instance of generated typedef class.
     * @param routingFailuresValue The value to set.
     * @param routingFailuresValue used during instantiation.
     */
    public void setRoutingFailuresValue(YangUInt32 routingFailuresValue)
            throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "routing-failures",
            routingFailuresValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "routing-failures",
     * using Java primitive values.
     * @param routingFailuresValue used during instantiation.
     */
    public void setRoutingFailuresValue(long routingFailuresValue)
            throws JNCException {
        setRoutingFailuresValue(new YangUInt32(routingFailuresValue));
    }

    /**
     * Sets the value for child leaf "routing-failures",
     * using a String value.
     * @param routingFailuresValue used during instantiation.
     */
    public void setRoutingFailuresValue(String routingFailuresValue)
            throws JNCException {
        setRoutingFailuresValue(new YangUInt32(routingFailuresValue));
    }

    /**
     * Unsets the value for child leaf "routing-failures".
     */
    public void unsetRoutingFailuresValue() throws JNCException {
        delete("routing-failures");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "routing-failures" leaf will not have a value.
     */
    public void addRoutingFailures() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "routing-failures",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "routing-failures" with operation "replace".
     */
    public void markRoutingFailuresReplace() throws JNCException {
        markLeafReplace("routingFailures");
    }

    /**
     * Marks the leaf "routing-failures" with operation "merge".
     */
    public void markRoutingFailuresMerge() throws JNCException {
        markLeafMerge("routingFailures");
    }

    /**
     * Marks the leaf "routing-failures" with operation "create".
     */
    public void markRoutingFailuresCreate() throws JNCException {
        markLeafCreate("routingFailures");
    }

    /**
     * Marks the leaf "routing-failures" with operation "delete".
     */
    public void markRoutingFailuresDelete() throws JNCException {
        markLeafDelete("routingFailures");
    }

    /* Access methods for optional leaf child: "trans-from-allowed-to-prohib". */

    /**
     * Gets the value for child leaf "trans-from-allowed-to-prohib".
     * @return The value of the leaf.
     */
    public YangUInt32 getTransFromAllowedToProhibValue() throws JNCException {
        return (YangUInt32)getValue("trans-from-allowed-to-prohib");
    }

    /**
     * Sets the value for child leaf "trans-from-allowed-to-prohib",
     * using instance of generated typedef class.
     * @param transFromAllowedToProhibValue The value to set.
     * @param transFromAllowedToProhibValue used during instantiation.
     */
    public void setTransFromAllowedToProhibValue(YangUInt32 transFromAllowedToProhibValue)
            throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "trans-from-allowed-to-prohib",
            transFromAllowedToProhibValue,
            childrenNames());
    }

    /**
     * Sets the value for child leaf "trans-from-allowed-to-prohib",
     * using Java primitive values.
     * @param transFromAllowedToProhibValue used during instantiation.
     */
    public void setTransFromAllowedToProhibValue(long transFromAllowedToProhibValue)
            throws JNCException {
        setTransFromAllowedToProhibValue(new YangUInt32(transFromAllowedToProhibValue));
    }

    /**
     * Sets the value for child leaf "trans-from-allowed-to-prohib",
     * using a String value.
     * @param transFromAllowedToProhibValue used during instantiation.
     */
    public void setTransFromAllowedToProhibValue(String transFromAllowedToProhibValue)
            throws JNCException {
        setTransFromAllowedToProhibValue(new YangUInt32(transFromAllowedToProhibValue));
    }

    /**
     * Unsets the value for child leaf "trans-from-allowed-to-prohib".
     */
    public void unsetTransFromAllowedToProhibValue() throws JNCException {
        delete("trans-from-allowed-to-prohib");
    }

    /**
     * This method is used for creating a subtree filter.
     * The added "trans-from-allowed-to-prohib" leaf will not have a value.
     */
    public void addTransFromAllowedToProhib() throws JNCException {
        setLeafValue(Epc.NAMESPACE,
            "trans-from-allowed-to-prohib",
            null,
            childrenNames());
    }

    /**
     * Marks the leaf "trans-from-allowed-to-prohib" with operation "replace".
     */
    public void markTransFromAllowedToProhibReplace() throws JNCException {
        markLeafReplace("transFromAllowedToProhib");
    }

    /**
     * Marks the leaf "trans-from-allowed-to-prohib" with operation "merge".
     */
    public void markTransFromAllowedToProhibMerge() throws JNCException {
        markLeafMerge("transFromAllowedToProhib");
    }

    /**
     * Marks the leaf "trans-from-allowed-to-prohib" with operation "create".
     */
    public void markTransFromAllowedToProhibCreate() throws JNCException {
        markLeafCreate("transFromAllowedToProhib");
    }

    /**
     * Marks the leaf "trans-from-allowed-to-prohib" with operation "delete".
     */
    public void markTransFromAllowedToProhibDelete() throws JNCException {
        markLeafDelete("transFromAllowedToProhib");
    }

    /**
     * Support method for addChild.
     * Adds a child to this object.
     *
     * @param child The child to add
     */
    public void addChild(Element child) {
        super.addChild(child);
    }

}


text:
layout: post
title:  "Symfony 3 base project with some common bundles installed"
description: "A Symfony 3 base project with common bundles already installed"
date:   2016-01-11 10:00:00 +0100
tags: [ symfony, project, bundles, library ]
comments: true
author: itrascastro
---

- [GitHub](https://github.com/itrascastro/Symfony-3-Base-Project)
- [Packagist](https://packagist.org/packages/itrascastro/symfony-3-base-project)

I have created a Symfony 3 base project with many common bundles and other stuff already installed and configured.

After creating many new projects for my Symfony Classroom, I realized that, almost always, those bundles and the rest of stuff were been always also installed.

This base project comes with:

- FriendsOfSymfony/FOSUserBundle
- Your own UserBundle to extend from FosUserBundle (with createdAt and updatedAt extra fields added)
- KnpLabs/KnpPaginatorBundle
- Bootstrap 3 with horizontal login
- Form templates
- Symfony Reverse Proxy configured to allow esi parts
- phpunit/phpunit (with a symbolic link under your bin folder. Simply run './bin/phpunit')
- Atlantic18/DoctrineExtensions (Slug generation)
- twig/extensions (time_diff)
- translation enabled in config
- symfony/assetic-bundle installed and configured
- doctrine/doctrine-fixtures-bundle
- vich/uploader-bundle installed and configured (with an example)

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

PHP >= 5.5.9 required

## Installing Composer

Composer is the dependency manager used by modern PHP applications and it can also be used to create new applications.

Download the installer from [getcomposer.org/download](https://getcomposer.org/download/), execute it and follow the instructions.

## Creating a new project with Composer

  ```
  php composer.phar create-project itrascastro/symfony-3-base-project my_project_name
  ```

If you did a global install and do not have the composer.phar in that directory run this instead:

  ```
  composer create-project itrascastro/symfony-3-base-project my_project_name
  ```

## Initial Setup

  ```
  php bin/console doctrine:database:create
  ```

  ```
  php bin/console doctrine:schema:create
  ```

  ```
  php bin/console doctrine:fixtures:load
  ```

  ```
  php bin/console server:run
  ```

Now you can login with 'admin' user and '1234' password. Default users are under 'src/AppBundle/DataFixtures/ORM/LoadData.php'

If you want to test VichUploaderBundle, you can go to http://localhost/upload
and submit an image. Do not forget to give 777 permissions to 'web/images/upload'
folder:

  ```
  cd my_project_name
  ```

  ```
  chmod -R 777 web/images/upload
  ```


text:
(function(mod) {
    if (typeof exports == 'object' && typeof module == 'object')
        // CommonJS
        mod(require('../../lib/codemirror'), require('./foldcode'));
    else if (typeof define == 'function' && define.amd)
        // AMD
        define(['../../lib/codemirror', './foldcode'], mod); // Plain browser env
    else mod(CodeMirror);
})(function(CodeMirror) {
    'use strict';

    CodeMirror.defineOption('foldGutter', false, function(cm, val, old) {
        if (old && old != CodeMirror.Init) {
            cm.clearGutter(cm.state.foldGutter.options.gutter);
            cm.state.foldGutter = null;
            cm.off('gutterClick', onGutterClick);
            cm.off('change', onChange);
            cm.off('viewportChange', onViewportChange);
            cm.off('fold', onFold);
            cm.off('unfold', onFold);
            cm.off('swapDoc', updateInViewport);
        }
        if (val) {
            cm.state.foldGutter = new State(parseOptions(val));
            updateInViewport(cm);
            cm.on('gutterClick', onGutterClick);
            cm.on('change', onChange);
            cm.on('viewportChange', onViewportChange);
            cm.on('fold', onFold);
            cm.on('unfold', onFold);
            cm.on('swapDoc', updateInViewport);
        }
    });

    var Pos = CodeMirror.Pos;

    function State(options) {
        this.options = options;
        this.from = this.to = 0;
    }

    function parseOptions(opts) {
        if (opts === true) opts = {};
        if (opts.gutter == null) opts.gutter = 'CodeMirror-foldgutter';
        if (opts.indicatorOpen == null)
            opts.indicatorOpen = 'CodeMirror-foldgutter-open';
        if (opts.indicatorFolded == null)
            opts.indicatorFolded = 'CodeMirror-foldgutter-folded';
        return opts;
    }

    function isFolded(cm, line) {
        var marks = cm.findMarksAt(Pos(line));
        for (var i = 0; i < marks.length; ++i)
            if (marks[i].__isFold && marks[i].find().from.line == line)
                return true;
    }

    function marker(spec) {
        if (typeof spec == 'string') {
            var elt = document.createElement('div');
            elt.className = spec + ' CodeMirror-guttermarker-subtle';
            return elt;
        } else {
            return spec.cloneNode(true);
        }
    }

    function updateFoldInfo(cm, from, to) {
        var opts = cm.state.foldGutter.options,
            cur = from;
        var minSize = cm.foldOption(opts, 'minFoldSize');
        var func = cm.foldOption(opts, 'rangeFinder');
        cm.eachLine(from, to, function(line) {
            var mark = null;
            if (isFolded(cm, cur)) {
                mark = marker(opts.indicatorFolded);
            } else {
                var pos = Pos(cur, 0);
                var range = func && func(cm, pos);
                if (range && range.to.line - range.from.line >= minSize)
                    mark = marker(opts.indicatorOpen);
            }
            cm.setGutterMarker(line, opts.gutter, mark);
            ++cur;
        });
    }

    function updateInViewport(cm) {
        var vp = cm.getViewport(),
            state = cm.state.foldGutter;
        if (!state) return;
        cm.operation(function() {
            updateFoldInfo(cm, vp.from, vp.to);
        });
        state.from = vp.from;
        state.to = vp.to;
    }

    function onGutterClick(cm, line, gutter) {
        var state = cm.state.foldGutter;
        if (!state) return;
        var opts = state.options;
        if (gutter != opts.gutter) return;
        cm.foldCode(Pos(line, 0), opts.rangeFinder);
    }

    function onChange(cm) {
        var state = cm.state.foldGutter;
        if (!state) return;
        var opts = state.options;
        state.from = state.to = 0;
        clearTimeout(state.changeUpdate);
        state.changeUpdate = setTimeout(function() {
            updateInViewport(cm);
        }, opts.foldOnChangeTimeSpan || 600);
    }

    function onViewportChange(cm) {
        var state = cm.state.foldGutter;
        if (!state) return;
        var opts = state.options;
        clearTimeout(state.changeUpdate);
        state.changeUpdate = setTimeout(function() {
            var vp = cm.getViewport();
            if (
                state.from == state.to ||
                vp.from - state.to > 20 ||
                state.from - vp.to > 20
            ) {
                updateInViewport(cm);
            } else {
                cm.operation(function() {
                    if (vp.from < state.from) {
                        updateFoldInfo(cm, vp.from, state.from);
                        state.from = vp.from;
                    }
                    if (vp.to > state.to) {
                        updateFoldInfo(cm, state.to, vp.to);
                        state.to = vp.to;
                    }
                });
            }
        }, opts.updateViewportTimeSpan || 400);
    }

    function onFold(cm, from) {
        var state = cm.state.foldGutter;
        if (!state) return;
        var line = from.line;
        if (line >= state.from && line < state.to)
            updateFoldInfo(cm, line, line + 1);
    }
});


text:
define("ghost/routes/settings",
  ["ghost/routes/authenticated","ghost/mixins/style-body","ghost/mixins/loading-indicator","exports"],
  function(__dependency1__, __dependency2__, __dependency3__, __exports__) {
    "use strict";
    var AuthenticatedRoute = __dependency1__["default"];

    var styleBody = __dependency2__["default"];

    var loadingIndicator = __dependency3__["default"];

    var SettingsRoute = AuthenticatedRoute.extend(styleBody, loadingIndicator, {
        titleToken: 'Settings',

        classNames: ['settings']
    });

    __exports__["default"] = SettingsRoute;
  });


text:
#ifndef CONTINENTS_H
#define CONTINENTS_H

extern char *continents_id[];
extern char *continents_names[];

#endif /* CONTINENTS */


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

namespace Microsoft.VisualStudio.Project {
    using Microsoft.Build.BuildEngine;

    class BuildItemShim {
        private BuildItem _buildItem;

        public BuildItemShim(BuildItem buildItem) {
            _buildItem = buildItem;
        }
        public string FinalItemSpec { get { return _buildItem.FinalItemSpec; } }

        public  string Name { get { return _buildItem.Name; } }
    }
}


text:
@implementation IMHomeModelView

@end


text:
There are 2 aspects to way solutions are managed in arete. First there is a local `solutions.yaml` file that tracks all solutions that have been added to arete from either the global GitHub solutions library or by calling `arete solution get`.

---
*ALPHA NOTE:* Right now the GitHub repo is private and thusly you need to add your GitHub personal access token to the config file. See: [Config Doc](config.md)

---

 ## Listing available solutions ##

 If you wish to see which solutions have been added and / or are available to arete, simple run the command `arete solution list`

 ## Adding a solution ##

 If you wish to add a solution that is not listed in the global GitHub solution library you can create your own GitHub repo but a couple of required elements must exist:

 1. There must be a `solution.yaml` file stored at the root of the GitHub path provided that meets the [solution.yaml](solution.md) yaml spec.
 2. There must be a `Kptfile` in the root of the GitHub path provided. (arete uses [kpt](https://kpt.dev) to render and apply solutions)

 Once your solution is structured correctly you can simple call: `arete solution get https:/github.com/<GIT-USER>/<REPO-NAME>`

 - NOTE: If your solution is stored in a sub-folder of your repo, then use the --sub-folder flag to provide the path. Also, if the solution is in a different branch then provide the branch name with the --branch flag

## Solution.yaml ##

See [solution.yaml](solution.md) spec

 ### Removing a solution ###

 If you wish to remove a solution from the arete list then you will need to modify the locally cached `solutions.yaml` file. Find the file (defaults to your local home directory in a folder called `.arete`) and remove the solution from the yaml list

 ## Prompting the user ##

Since arete uses kpt to render the final deployments before applying the solutions we rely on the `Kptfile` pipeline process to determine if there is any information needed to be updated by user input. The `Kptfile` pipeline allows for mutators that can use a ConfigPath to a YAML file for setting values through out the solution.

Arete will search the YAML file listed in the ConfigPath for any single line comment pattern. This process looks simliar to the kpt setters function pattern.

If you want to prompt a user to update the value of templated value then add the comment `# arete-prompt` to the end of the key/value pair in any of your kpt mutators.


text:
package net.nemerosa.ontrack.extension.git.model;

import lombok.Data;

@Data
public class GitBuildInfo {

    public static final GitBuildInfo INSTANCE = new GitBuildInfo();

    /**
     * This field is not used
     */
    private final String placeholder = "";

}


text:
package store

import (
	"bytes"
	"io"
	"io/ioutil"
	"os"

	"github.com/uber/kraken/core"
	"github.com/uber/kraken/utils/testutil"
)

// MockFileReadWriter is a mock FileReadWriter that is backed by a
// physical file. This is preferred to a gomock struct because read/write
// operations are greatly simplified.
type MockFileReadWriter struct {
	*os.File
	Committed bool
}

// Commit implements FileReadWriter.Commit
func (f *MockFileReadWriter) Commit() error { panic("commit not implemented") }

// Cancel implements FileReadWriter.Cancel
func (f *MockFileReadWriter) Cancel() error { panic("cancel not implemented") }

// Size implements FileReadWriter.Size
func (f *MockFileReadWriter) Size() int64 { panic("size not implemented") }

var _ FileReadWriter = (*MockFileReadWriter)(nil)

// NewMockFileReadWriter returns a new MockFileReadWriter and a cleanup function.
func NewMockFileReadWriter(content []byte) (*MockFileReadWriter, func()) {
	cleanup := new(testutil.Cleanup)
	defer cleanup.Recover()

	tmp, err := ioutil.TempFile("", "")
	if err != nil {
		panic(err)
	}
	name := tmp.Name()
	cleanup.Add(func() { os.Remove(name) })

	if _, err := tmp.Write(content); err != nil {
		panic(err)
	}
	if err := tmp.Close(); err != nil {
		panic(err)
	}

	// Open fresh file.
	f, err := os.OpenFile(name, os.O_RDWR, 0775)
	if err != nil {
		panic(err)
	}

	return &MockFileReadWriter{File: f}, cleanup.Run
}

// RunDownload downloads content to cads.
func RunDownload(cads *CADownloadStore, d core.Digest, content []byte) error {
	if err := cads.CreateDownloadFile(d.Hex(), int64(len(content))); err != nil {
		return err
	}
	w, err := cads.GetDownloadFileReadWriter(d.Hex())
	if err != nil {
		return err
	}
	if _, err := io.Copy(w, bytes.NewReader(content)); err != nil {
		return err
	}
	return cads.MoveDownloadFileToCache(d.Hex())
}


text:
module AnalyzeTasksHelper
  def labels
    @search_query.summary.map {|x| x.value.name}.join('##')
    end

  def graph_data
    @search_query.summary.map {|x| x.name}.join('##')
  end
end


text:
module Interfactura
  module Ruby
    class Response
      include HappyMapper

      tag ''
      element :street, String, :tag => 'street'
      element :postcode, String, :tag => 'postcode'
      element :housenumber, Integer, :tag => 'housenumber'
      element :city, String, :tag => 'city'
      element :country, String, :tag => 'country'
    end
  end
end


text:
<?php

class ReverbAttributes
{
    const ORIGIN_MANUAL_SYNC_SINGLE = 'manual_sync_single';
    const ORIGIN_MANUAL_SYNC_MULTIPLE = 'manual_sync_multiple';
    const ORIGIN_PRODUCT_UPDATE = 'product_update';
    const ORIGIN_ORDER = 'order';
    const ORIGIN_CRON = 'cron';

    protected $module;

    /**
     * ReverbSync constructor.
     * @param Reverb $module_instance
     */
    public function __construct(\Reverb $module_instance)
    {
        $this->module = $module_instance;
    }

    /**
     * Get product Reverb attributes
     * @param integer $productId
     * @return array
     */
    public function getAttributes($productId)
    {
        $sql = new DbQuery();
        $sql->select('*')
            ->from('reverb_attributes', 'ra')
            ->where('ra.id_product = ' . $productId)
            ->where('ra.id_lang = ' . $this->module->language_id);

        $result = Db::getInstance()->getRow($sql);

        return $result;
    }

    /**
     * Get product Reverb shipping methods
     * @param integer $attributeId
     * @return array
     */
    public function getShippingMethods($attributeId)
    {
        if (isset($attributeId) && !empty($attributeId)) {
            $sql = new DbQuery();
            $sql->select('rsm.*')
                ->from('reverb_shipping_methods', 'rsm')
                ->where('rsm.id_attribute = ' . $attributeId);
            $result = Db::getInstance()->executeS($sql);

            return $result;
        } else {
            return null;
        }
    }
}


text:
package api

import (
	"bytes"
	"crypto/tls"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net"
	"net/http"
	"net/url"
	"os"
	"strings"
	"time"

	"github.com/iron-io/iron_go3/config"
)

type DefaultResponseBody struct {
	Msg string `json:"msg"`
}

type URL struct {
	URL      url.URL
	Settings config.Settings
}

var (
	Debug            bool
	DebugOnErrors    bool
	DefaultCacheSize = 8192

	// HttpClient is the client used by iron_go to make each http request. It is exported in case
	// the client would like to modify it from the default behavior from http.DefaultClient.
	// This uses the DefaultTransport modified to enable TLS Session Client caching.
	HttpClient = &http.Client{
		Transport: &http.Transport{
			Proxy: http.ProxyFromEnvironment,
			Dial: (&net.Dialer{
				Timeout:   30 * time.Second,
				KeepAlive: 30 * time.Second,
			}).Dial,
			MaxIdleConnsPerHost: 512,
			TLSHandshakeTimeout: 10 * time.Second,
			TLSClientConfig: &tls.Config{
				ClientSessionCache: tls.NewLRUClientSessionCache(DefaultCacheSize),
			},
		},
	}
)

func dbg(v ...interface{}) {
	if Debug {
		log.Println(v...)
	}
}

func dbgerr(v ...interface{}) {
	if DebugOnErrors && !Debug {
		log.Println(v...)
	}
}

func init() {
	if os.Getenv("IRON_API_DEBUG") != "" {
		Debug = true
		dbg("debugging of api enabled")
	}
	if os.Getenv("IRON_API_DEBUG_ON_ERRORS") != "" {
		DebugOnErrors = true
		dbg("debugging of api on errors enabled")
	}
}

func Action(cs config.Settings, prefix string, suffix ...string) *URL {
	parts := append([]string{prefix}, suffix...)
	return ActionEndpoint(cs, strings.Join(parts, "/"))
}

func ActionEndpoint(cs config.Settings, endpoint string) *URL {
	u := &URL{Settings: cs, URL: url.URL{}}
	u.URL.Scheme = cs.Scheme
	u.URL.Host = fmt.Sprintf("%s:%d", cs.Host, cs.Port)
	u.URL.Path = fmt.Sprintf("/%s/projects/%s/%s", cs.ApiVersion, cs.ProjectId, endpoint)
	return u
}

func VersionAction(cs config.Settings) *URL {
	u := &URL{Settings: cs, URL: url.URL{Scheme: cs.Scheme}}
	u.URL.Host = fmt.Sprintf("%s:%d", cs.Host, cs.Port)
	u.URL.Path = "/version"
	return u
}

func (u *URL) QueryAdd(key string, format string, value interface{}) *URL {
	query := u.URL.Query()
	query.Add(key, fmt.Sprintf(format, value))
	u.URL.RawQuery = query.Encode()
	return u
}

func (u *URL) Req(method string, in, out interface{}) error {
	if in == nil {
		in = &struct{}{}
	}
	data, err := json.Marshal(in)
	if err != nil {
		return err
	}
	dbg("request body:", in)

	response, err := u.req(method, data)
	if response != nil && response.Body != nil {
		defer response.Body.Close()
	}
	if err != nil {
		dbg("ERROR!", err, err.Error())
		body := "<empty>"
		if response != nil && response.Body != nil {
			binary, _ := ioutil.ReadAll(response.Body)
			body = string(binary)
		}
		dbgerr("ERROR!", err, err.Error(), "Request:", string(data), " Response:", body)
		return err
	}
	dbg("response:", response)
	if out != nil {
		return json.NewDecoder(response.Body).Decode(out)
	}

	// throw it away
	io.Copy(ioutil.Discard, response.Body)
	return nil
}

// returned body must be closed by caller if non-nil
func (u *URL) Request(method string, body io.Reader) (response *http.Response, err error) {
	var bytes []byte
	if body != nil {
		bytes, err = ioutil.ReadAll(body)
		if err != nil {
			return nil, err
		}
	}
	return u.req(method, bytes)
}

var MaxRequestRetries = 5

func (u *URL) req(method string, body []byte) (response *http.Response, err error) {
	request, err := http.NewRequest(method, u.URL.String(), nil)
	if err != nil {
		return nil, err
	}

	request.ContentLength = int64(len(body))
	request.Header.Set("Authorization", "OAuth "+u.Settings.Token)
	request.Header.Set("Accept", "application/json")
	request.Header.Set("Accept-Encoding", "gzip/deflate")
	request.Header.Set("User-Agent", u.Settings.UserAgent)

	if body != nil {
		request.Header.Set("Content-Type", "application/json")
	}

	dbg("URL:", request.URL.String())
	dbg("request:", fmt.Sprintf("%#v\n", request))

	for tries := 0; tries < MaxRequestRetries; tries++ {
		request.Body = ioutil.NopCloser(bytes.NewReader(body)) // because Readers are only useful once
		response, err = HttpClient.Do(request)
		if err != nil {
			if response != nil && response.Body != nil {
				response.Body.Close() // make sure to close since we won't return it
			}
			if err == io.EOF {
				continue
			}
			return nil, err
		}

		if response.StatusCode == http.StatusServiceUnavailable {
			delay := (tries + 1) * 10 // smooth out delays from 0-2
			time.Sleep(time.Duration(delay*delay) * time.Millisecond)
			continue
		}

		break
	}

	if err != nil { // for that one lucky case where io.EOF reaches MaxRetries
		return nil, err
	}

	if err = ResponseAsError(response); err != nil {
		return nil, err
	}

	return response, nil
}

var HTTPErrorDescriptions = map[int]string{
	http.StatusUnauthorized:     "The OAuth token is either not provided or invalid",
	http.StatusNotFound:         "The resource, project, or endpoint being requested doesn't exist.",
	http.StatusMethodNotAllowed: "This endpoint doesn't support that particular verb",
	http.StatusNotAcceptable:    "Required fields are missing",
}

func ResponseAsError(response *http.Response) HTTPResponseError {
	if response.StatusCode == http.StatusOK || response.StatusCode == http.StatusCreated {
		return nil
	}

	if response == nil {
		return resErr{statusCode: http.StatusTeapot, error: fmt.Sprint("response nil but no errors. beware unicorns, this shouldn't happen")}
	}

	if response.Body != nil {
		defer response.Body.Close()
	}

	var out DefaultResponseBody
	err := json.NewDecoder(response.Body).Decode(&out)
	if err != nil {
		return resErr{statusCode: response.StatusCode, error: fmt.Sprint(response.Status, ": ", err.Error())}
	}
	if out.Msg != "" {
		return resErr{statusCode: response.StatusCode, error: fmt.Sprint(response.Status, ": ", out.Msg)}
	}

	return resErr{statusCode: response.StatusCode, error: response.Status + ": Unknown API Response"}
}

type HTTPResponseError interface {
	Error() string
	StatusCode() int
}

type resErr struct {
	error      string
	statusCode int
}

func (h resErr) Error() string   { return h.error }
func (h resErr) StatusCode() int { return h.statusCode }


text:
<?php

 // Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.

Please make sure IN_MYBB is defined.");
}

/**
 * SMTP mail handler class.
 */

if(!defined('MYBB_SSL'))
{
	define('MYBB_SSL', 1);
}

if(!defined('MYBB_TLS'))
{
	define('MYBB_TLS', 2);
}

class SmtpMail extends MailHandler
{
	/**
	 * The SMTP connection.
	 *
	 * @var resource
	 */
	public $connection;

	/**
	 * SMTP username.
	 *
	 * @var string
	 */
	public $username = '';

	/**
	 * SMTP password.
	 *
	 * @var string
	 */
	public $password = '';

	/**
	 * Hello string sent to the smtp server with either HELO or EHLO.
	 *
	 * @var string
	 */
	public $helo = 'localhost';

	/**
	 * User authenticated or not.
	 *
	 * @var boolean
	 */
	public $authenticated = false;

	/**
	 * How long before timeout.
	 *
	 * @var integer
	 */
	public $timeout = 5;

	/**
	 * SMTP status.
	 *
	 * @var integer
	 */
	public $status = 0;

	/**
	 * SMTP default port.
	 *
	 * @var integer
	 */
	public $port = 25;

	/**
	 * SMTP default secure port.
	 *
	 * @var integer
	 */
	public $secure_port = 465;

	/**
	 * SMTP host.
	 *
	 * @var string
	 */
	public $host = '';

	/**
	 * The last received response from the SMTP server.
	 *
	 * @var string
	 */
	public $data = '';

	/**
	 * The last received response code from the SMTP server.
	 *
	 * @var string
	 */
	public $code = 0;

	/**
	 * The last received error message from the SMTP server.
	 *
	 * @var string
	 */
	public $last_error = '';

	/**
	 * Are we keeping the connection to the SMTP server alive?
	 *
	 * @var boolean
	 */
	public $keep_alive = false;

	/**
	 * Whether to use TLS encryption.
	 *
	 * @var boolean
	 */
	public $use_tls = false;

	function __construct()
	{
		global $mybb;

		$protocol = '';
		switch($mybb->settings['secure_smtp'])
		{
			case MYBB_SSL:
				$protocol = 'ssl://';
				break;
			case MYBB_TLS:
				$this->use_tls = true;
				break;
		}

		if(empty($mybb->settings['smtp_host']))
		{
			$this->host = @ini_get('SMTP');
		}
		else
		{
			$this->host = $mybb->settings['smtp_host'];
		}

		$local = array('127.0.0.1', '::1', 'localhost');
		if(!in_array($this->host, $local))
		{
			if(function_exists('gethostname') && gethostname() !== false)
			{
				$this->helo = gethostname();
			}
			elseif(function_exists('php_uname'))
			{
				$helo = php_uname('n');
				if(!empty($helo))
				{
					$this->helo = $helo;
				}
			}
			elseif(!empty($_SERVER['SERVER_NAME']))
			{
				$this->helo = $_SERVER['SERVER_NAME'];
			}
		}

		$this->host = $protocol . $this->host;

		if(empty($mybb->settings['smtp_port']) && !empty($protocol) && !@ini_get('smtp_port'))
		{
			$this->port = $this->secure_port;
		}
		else if(empty($mybb->settings['smtp_port']) && @ini_get('smtp_port'))
		{
			$this->port = @ini_get('smtp_port');
		}
		else if(!empty($mybb->settings['smtp_port']))
		{
			$this->port = $mybb->settings['smtp_port'];
		}

		$this->password = $mybb->settings['smtp_pass'];
		$this->username = $mybb->settings['smtp_user'];
	}

	/**
	 * Sends the email.
	 *
	 * @return true/false whether or not the email got sent or not.
	 */
	function send()
	{
		global $lang, $mybb;

		if(!$this->connected())
		{
			if(!$this->connect())
			{
				$this->close();
			}
		}

		if($this->connected())
		{
			if(!$this->send_data('MAIL FROM:<'.$this->from.'>', '250'))
			{
				$this->fatal_error("The mail server does not understand the MAIL FROM command. Reason: ".$this->get_error());
				return false;
			}

			// Loop through recipients
			$emails = explode(',', $this->to);
			foreach($emails as $to)
			{
				$to = trim($to);
				if(!$this->send_data('RCPT TO:<'.$to.'>', '250'))
				{
					$this->fatal_error("The mail server does not understand the RCPT TO command. Reason: ".$this->get_error());
					return false;
				}
			}

			if($this->send_data('DATA', '354'))
			{
				$this->send_data('Date: ' . gmdate('r'));
				$this->send_data('To: ' . $this->to);

				$this->send_data('Subject: ' . $this->subject);

				// Only send additional headers if we've got any
				if(trim($this->headers))
				{
					$this->send_data(trim($this->headers));
				}

				$this->send_data("");

				// Queue the actual message
				$this->message = str_replace("\n.", "\n..", $this->message);
				$this->send_data($this->message);
			}
			else
			{
				$this->fatal_error("The mail server did not understand the DATA command");
				return false;
			}

			$this->send_data('.', '250');

			if(!$this->keep_alive)
			{
				$this->close();
			}
			return true;
		}
		else
		{
			return false;
		}
	}

	/**
	 * Connect to the SMTP server.
	 *
	 * @return boolean True if connection was successful
	 */
	function connect()
	{
		global $lang, $mybb;

		$this->connection = @fsockopen($this->host, $this->port, $error_number, $error_string, $this->timeout);

		// DIRECTORY_SEPARATOR checks if running windows
		if(function_exists('stream_set_timeout') && DIRECTORY_SEPARATOR != '\\')
		{
			@stream_set_timeout($this->connection, $this->timeout, 0);
		}

		if(is_resource($this->connection))
		{
			$this->status = 1;
			$this->get_data();
			if(!$this->check_status('220'))
			{
				$this->fatal_error("The mail server is not ready, it did not respond with a 220 status message.");
				return false;
			}

			if($this->use_tls || (!empty($this->username) && !empty($this->password)))
			{
				$helo = 'EHLO';
			}
			else
			{
				$helo = 'HELO';
			}

			$data = $this->send_data("{$helo} {$this->helo}", '250');
			if(!$data)
			{
				$this->fatal_error("The server did not understand the {$helo} command");
				return false;
			}

			if($this->use_tls && preg_match("#250( |-)STARTTLS#mi", $data))
			{
				if(!$this->send_data('STARTTLS', '220'))
				{
						$this->fatal_error("The server did not understand the STARTTLS command. Reason: ".$this->get_error());
					return false;
				}
				if(!@stream_socket_enable_crypto($this->connection, true, STREAM_CRYPTO_METHOD_TLS_CLIENT))
				{
					$this->fatal_error("Failed to start TLS encryption");
					return false;
				}
				// Resend EHLO to get updated service list
				$data = $this->send_data("{$helo} {$this->helo}", '250');
				if(!$data)
				{
					$this->fatal_error("The server did not understand the EHLO command");
					return false;
				}
			}

			if(!empty($this->username) && !empty($this->password))
			{
				preg_match("#250( |-)AUTH( |=)(.+)$#mi", $data, $matches);
				if(!$this->auth($matches[3]))
				{
					return false;
				}
			}
			return true;
		}
		else
		{
			$this->fatal_error("Unable to connect to the mail server with the given details. Reason: {$error_number}: {$error_string}");
			return false;
		}
	}

	/**
	 * Authenticate against the SMTP server.
	 *
	 * @param string A list of authentication methods supported by the server
	 * @return boolean True on success
	 */
	function auth($auth_methods)
	{
		global $lang, $mybb;

		$auth_methods = explode(" ", trim($auth_methods));

		if(in_array("LOGIN", $auth_methods))
		{
			if(!$this->send_data("AUTH LOGIN", 334))
			{
				if($this->code == 503)
				{
					return true;
				}
				$this->fatal_error("The SMTP server did not respond correctly to the AUTH LOGIN command");
				return false;
			}

			if(!$this->send_data(base64_encode($this->username), '334'))
			{
				$this->fatal_error("The SMTP server rejected the supplied SMTP username. Reason: ".$this->get_error());
				return false;
			}

			if(!$this->send_data(base64_encode($this->password), '235'))
			{
				$this->fatal_error("The SMTP server rejected the supplied SMTP password. Reason: ".$this->get_error());
				return false;
			}
		}
		else if(in_array("PLAIN", $auth_methods))
		{
			if(!$this->send_data("AUTH PLAIN", '334'))
			{
				if($this->code == 503)
				{
					return true;
				}
				$this->fatal_error("The SMTP server did not respond correctly to the AUTH PLAIN command");
				return false;
			}
			$auth = base64_encode(chr(0).$this->username.chr(0).$this->password);
			if(!$this->send_data($auth, 235))
			{
				$this->fatal_error("The SMTP server rejected the supplied login username and password. Reason: ".$this->get_error());
				return false;
			}
		}
		else
		{
			$this->fatal_error("The SMTP server does not support any of the AUTH methods that MyBB supports");
			return false;
		}

		// Still here, we're authenticated
		return true;
	}

	/**
	 * Fetch data from the SMTP server.
	 *
	 * @return string The data from the SMTP server
	 */
	function get_data()
	{
		$string = '';

		while((($line = fgets($this->connection, 515)) !== false))
		{
			$string .= $line;
			if(substr($line, 3, 1) == ' ')
			{
				break;
			}
		}
		$string = trim($string);
		$this->data = $string;
		$this->code = substr($this->data, 0, 3);
		return $string;
	}

	/**
	 * Check if we're currently connected to an SMTP server
	 *
	 * @return boolean true if connected
	 */
	function connected()
	{
		if($this->status == 1)
		{
			return true;
		}
		return false;
	}

	/**
	 * Send data through to the SMTP server.
	 *
	 * @param string The data to be sent
	 * @param int The response code expected back from the server (if we have one)
	 * @return boolean True on success
	 */
	function send_data($data, $status_num = false)
	{
		if($this->connected())
		{
			if(fwrite($this->connection, $data."\r\n"))
			{
				if($status_num != false)
				{
					$rec = $this->get_data();
					if($this->check_status($status_num))
					{
						return $rec;
					}
					else
					{
						$this->set_error($rec);
						return false;
					}
				}
				return true;
			}
			else
			{
				$this->fatal_error("Unable to send the data to the SMTP server");
				return false;
			}
		}
		return false;
	}

	/**
	 * Checks if the received status code matches the one we expect.
	 *
	 * @param int The status code we expected back from the server
	 * @param boolean True if it matches
	 */
	function check_status($status_num)
	{
		if($this->code == $status_num)
		{
			return $this->data;
		}
		else
		{
			return false;
		}
	}

	/**
	 * Close the connection to the SMTP server.
	 */
	function close()
	{
		if($this->status == 1)
		{
			$this->send_data('QUIT');
			fclose($this->connection);
			$this->status = 0;
		}
	}

	/**
	 * Get the last error message response from the SMTP server
	 *
	 * @return string The error message response from the SMTP server
	 */
	function get_error()
	{
		if(!$this->last_error)
		{
			$this->last_error = "N/A";
		}

		return $this->last_error;
	}

	/**
	 * Set the last error message response from the SMTP server
	 *
	 * @param string The error message response
	 */
	function set_error($error)
	{
		$this->last_error = $error;
	}
}
?>


text:
<!DOCTYPE html>

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    <link href="vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="vendor/bootstrap-select/css/bootstrap-select.min.css" rel="stylesheet"/>
    <link href="styles/main.css" rel="stylesheet"/>


text: Folder to host 2021 2^5 code


text:
"use strict";

var defaultConfig = require("./default-config");
var cliOptions    = require("./cli-options");
var info          = require("./cli-info");

var program       = require("commander");
var merge         = require("opt-merger").merge;

module.exports.allowedOptions = ["host", "server", "proxy"];

/**
 * Handle command-line usage with 'start'
 * @param args
 * @param cb
 */
module.exports.startFromCommandLine = function (args, cb) {

    var userConfig;

    // First look for provided --config option
    if (args.config) {
        userConfig = info._getConfigFile(args.config);
    }

    var options = merge(defaultConfig, userConfig || {}, cliOptions.callbacks);

    cb(null, {
        files: options.files || [],
        config: options
    });
};

/**
 * @param {String} version
 * @param {Object} args - optimist object
 * @param {Object} argv
 * @param {Function} cb
 */
module.exports.parse = function (version, args, argv, cb) {

    program
        .version(version)
        .usage("<command> [options]")
        .option("--files",     "File paths to watch")
        .option("--exclude",   "File patterns to ignore")
        .option("--server",    "Run a Local server (uses your cwd as the web root)")
        .option("--directory", "Show a directory listing for the server")
        .option("--proxy",     "Proxy an existing server")
        .option("--xip",       "Use xip.io domain routing")
        .option("--tunnel",    "Use a public URL")
        .option("--config",    "Specify a path to a bs-config.js file")
        .option("--host",      "Specify a hostname to use")
        .option("--logLevel",  "Set the logger output level (silent, info or debug)")
        .option("--port",      "Specify a port to use")
        .option("--no-open",   "Don't open a new browser window")
        .option("--no-ghost",  "Disable Ghost Mode")
        .option("--no-online", "Force offline usage");

    program
        .on("--help", function(){
            console.log("  Server Example:");
            console.log("  ---------------");
            console.log("    Use current directory as root & watch CSS files");
            console.log("");
            console.log("    $ browser-sync start --server --files=\"css/*.css\"");
            console.log("");
            console.log("  Proxy Example:");
            console.log("  --------------");
            console.log("    Proxy `localhost:8080` & watch CSS files");
            console.log("");
            console.log("    $ browser-sync start --proxy=\"localhost:8080\" --files=\"css/*.css\"");
            console.log("");
        });

    program
        .command("init")
        .description("Creates a default config file")
        .action(function() {
            cb(null, {configFile: true});
        });

    program
        .command("start")
        .description("Start Browser Sync")
        .action(exports.startFromCommandLine.bind(null, args, cb));

    program.parse(argv);

    if (!args._.length) {
        program.help();
    }
};


text:
package io.quarkus.smallrye.graphql.client.runtime;

import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.OptionalInt;

import io.quarkus.runtime.annotations.ConfigGroup;
import io.quarkus.runtime.annotations.ConfigItem;

@ConfigGroup
public class GraphQLClientConfig {

    /**
     * The URL location of the target GraphQL service.
     */
    @ConfigItem
    public Optional<String> url;

    /**
     * HTTP headers to add when communicating with the target GraphQL service.
     */
    @ConfigItem(name = "header")
    public Map<String, String> headers;

    /**
     * WebSocket subprotocols that should be supported by this client for running GraphQL operations over websockets.
     * Allowed values are:
     * - `graphql-ws` for the deprecated Apollo protocol
     * - `graphql-transport-ws` for the newer GraphQL over WebSocket protocol (default value)
     * If multiple protocols are provided, the actual protocol to be used will be subject to negotiation with
     * the server.
     */
    @ConfigItem(defaultValue = "graphql-transport-ws")
    public Optional<List<String>> subprotocols;

    /**
     * If true, then queries and mutations will run over the websocket transport rather than pure HTTP.
     * Off by default, because it has higher overhead.
     */
    @ConfigItem
    public Optional<Boolean> executeSingleResultOperationsOverWebsocket;

    /**
     * Maximum time in milliseconds that will be allowed to wait for the server to acknowledge a websocket connection
     * (send a subprotocol-specific ACK message).
     */
    @ConfigItem
    public OptionalInt websocketInitializationTimeout;

    /**
     * The trust store location. Can point to either a classpath resource or a file.
     */
    @ConfigItem
    public Optional<String> trustStore;

    /**
     * The trust store password.
     */
    @ConfigItem
    public Optional<String> trustStorePassword;

    /**
     * The type of the trust store. Defaults to "JKS".
     */
    @ConfigItem
    public Optional<String> trustStoreType;

    /**
     * The key store location. Can point to either a classpath resource or a file.
     */
    @ConfigItem
    public Optional<String> keyStore;

    /**
     * The key store password.
     */
    @ConfigItem
    public Optional<String> keyStorePassword;

    /**
     * The type of the key store. Defaults to "JKS".
     */
    @ConfigItem
    public Optional<String> keyStoreType;

    /**
     * Hostname of the proxy to use.
     */
    @ConfigItem
    public Optional<String> proxyHost;

    /**
     * Port number of the proxy to use.
     */
    @ConfigItem
    public OptionalInt proxyPort;

    /**
     * Username for the proxy to use.
     */
    @ConfigItem
    public Optional<String> proxyUsername;

    /**
     * Password for the proxy to use.
     */
    @ConfigItem
    public Optional<String> proxyPassword;

    /**
     * Maximum number of redirects to follow.
     */
    @ConfigItem
    public OptionalInt maxRedirects;

    /**
     * Additional payload sent on websocket initialization.
     */
    @ConfigItem(name = "init-payload")
    public Map<String, String> initPayload;
}


text:
export function isInjected(tabId) {
  return chrome.tabs.executeScriptAsync(tabId, {
    code: 'var injected = window.reactExampleInjected; window.reactExampleInjected = true; injected;',
    runAt: 'document_start'
  });
}

export function loadScript(name, tabId, cb) {
  if (__DEVELOPMENT__) {
    // dev: async fetch bundle
    fetch(`https://localhost:3000/js/${name}.bundle.js`).then(response => {
      return response.text();
    }).then(response => {
      chrome.tabs.executeScript(tabId, { code: response, runAt: 'document_start' }, () => cb());
    });
  } else {
    // prod
    chrome.tabs.executeScript(tabId, { file: `/js/${name}.bundle.js`, runAt: 'document_start' }, () => cb());
  }
}


text:
import * as React from 'react'

import { VISIT_DELAY_RANGE } from '../constants'
import { Checkbox, CheckboxToggle } from '../../../common-ui/components'
const styles = require('./settings.css')

export interface Props {
    bookmarks: boolean
    memexLinks: boolean
    stubs: boolean
    screenshots: boolean
    visits: boolean
    visitDelay: number
    visitDelayMin?: number
    visitDelayMax?: number
    toggleBookmarks: CheckboxToggle
    toggleLinks: CheckboxToggle
    toggleStubs: CheckboxToggle
    toggleScreenshots: CheckboxToggle
    toggleVisits: CheckboxToggle
    handleVisitDelayChange: (e: React.SyntheticEvent<HTMLInputElement>) => void
}

class IndexingPrefs extends React.PureComponent<Props> {
    static defaultProps: Partial<Props> = {
        visitDelayMin: VISIT_DELAY_RANGE.MIN,
        visitDelayMax: VISIT_DELAY_RANGE.MAX,
    }

    render() {
        return (

Indexing Preferences

                    Define which pages you would like to search.

                <Checkbox
                    id="index-stubs"
                    isChecked={this.props.stubs}
                    handleChange={this.props.toggleStubs}
                >
                    Make title and URL of every visit searchable
                </Checkbox>

                    Make websites full-text searchable that I...?

                <Checkbox
                    id="index-visits"
                    isChecked={this.props.visits}
                    handleChange={this.props.toggleVisits}
                >
                    visited for this many seconds{' '}
                    <input
                        type="number"
                        value={this.props.visitDelay}
                        onChange={this.props.handleVisitDelayChange}
                        min={this.props.visitDelayMin}
                        max={this.props.visitDelayMax}
                    />
                </Checkbox>
                <Checkbox
                    id="index-bookmarks"
                    isChecked={this.props.bookmarks}
                    handleChange={this.props.toggleBookmarks}
                >
                    bookmarked, tagged, or sorted into collections
                </Checkbox>
                <Checkbox
                    id="index-links"
                    isChecked={this.props.memexLinks}
                    handleChange={this.props.toggleLinks}
                >
                    annotated or added notes to
                </Checkbox>

        )
    }
}

export default IndexingPrefs