text:
<?xml version="1.0" encoding="UTF-8"?>
<?BlueBerry version="0.1"?>
<plugin>

  <extension point="org.blueberry.ui.views">
    <view id="objectbrowser"
          name="Object Browser"
          class="berry::ObjectBrowserView"
      icon="resources/ObjectBrowser.png" />
  </extension>

</plugin>


text:
Index::Index(std::string name) {
    this->name = name;
}

Index::~Index() {
    this->cols.clear();
}

std::string Index::get_name() {
    return this->name;
}

void Index::add_column(Column *col) {

    this->cols.insert({col->get_name(), col});
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.felix.metatype;

import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Arrays;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Set;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.kxml2.io.KXmlParser;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import bndtools.Plugin;

/**
 * The MetaDataReader provides two methods to read meta type documents according to the MetaType schema
 * (105.8 XML Schema). The {@link #parse(URL)} and {@link #parse(InputStream)} methods may be called multiple times to
 * parse such documents.
 *

 * While reading the XML document java objects are created to hold the data. These objects are created by factory
 * methods. Users of this may extend this class by overwriting the the factory methods to create specialized versions.
 * One notable use of this is the extension of the {@link AD} class to overwrite the {@link AD#validate(String)} method.
 * In this case, the {@link #createAD()} method would be overwritten to return an instance of the extending class.
 *

 * This class is not thread safe. Using instances of this class in multiple threads concurrently is not supported and
 * will fail.
 *
 * @author Felix Project Team
 */
@SuppressWarnings({
    "rawtypes"
})
public class MetaDataReader {

    /**
     * The initial XML Namespace for Metatype 1.1 descriptors. This has been replaced by the v1.1.0 namespace in the
     * Compendium Specification 4.2. We still have to support this namespace for backwards compatibility.
     */
    static final String NAMESPACE_1_0 = "http://www.osgi.org/xmlns/metatype/v1.0.0";

    /**
     * The XML Namespace for Metatype 1.1 descriptors.
     */
    static final String NAMESPACE_1_1 = "http://www.osgi.org/xmlns/metatype/v1.1.0";

    /**
     * The XML Namespace for Metatype 1.2 descriptors.
     */
    static final String NAMESPACE_1_2 = "http://www.osgi.org/xmlns/metatype/v1.2.0";

    /**
     * The XML Namespace for Metatype 1.3 descriptors.
     */
    static final String NAMESPACE_1_3 = "http://www.osgi.org/xmlns/metatype/v1.3.0";

    /** The XML parser used to read the XML documents */
    private final KXmlParser parser = new KXmlParser();
    private String namespace = NAMESPACE_1_0;

    private URL documentURL;

    /** Sets of attributes belonging to XML elements. */
    private static final Set<String> AD_ATTRIBUTES = new HashSet<String>(Arrays.asList(new String[] {
        "name", "description", "id", "type", "cardinality", "min", "max", "default", "required"
    }));
    private static final Set<String> ATTRIBUTE_ATTRIBUTES = new HashSet<String>(Arrays.asList(new String[] {
        "adref", "content"
    }));
    private static final Set<String> DESIGNATE_ATTRIBUTES = new HashSet<String>(Arrays.asList(new String[] {
        "pid", "factoryPid", "bundle", "optional", "merge"
    }));
    private static final Set<String> DESIGNATEOBJECT_ATTRIBUTES = new HashSet<String>(Arrays.asList(new String[] {
        "ocdref"
    }));
    private static final Set<String> METADATA_ATTRIBUTES = new HashSet<String>(Arrays.asList(new String[] {
        "localization"
    }));
    private static final Set<String> OCD_ATTRIBUTES = new HashSet<String>(Arrays.asList(new String[] {
        "name", "description", "id"
    }));

    /**
     * Parses the XML document provided by the url. The XML document must be at the beginning of the stream
     * contents.
     *

     * This method is almost identical to return parse(url.openStream()); but also sets the string
     * representation of the URL as a location helper for error messages.
     *
     * @param url The URL providing access to the XML document.
     * @return A {@link MetaData} providing access to the raw contents of the XML document.
     * @throws IOException If an I/O error occurs accessing the stream or parsing the XML document.
     */
    public MetaData parse(URL url) throws IOException {
        this.documentURL = url;
        try (InputStream ins = url.openStream()) {

            this.parser.setProperty("http://xmlpull.org/v1/doc/properties.html#location", url.toString());
            MetaData md = parse(ins);
            if (md != null) {
                md.setSource(url);
            }
            return md;
        } catch (XmlPullParserException e) {
            throw new IOException("XML parsing exception while reading metadata: " + e.getMessage());
        } finally {
            this.documentURL = null;
        }
    }

    /**
     * Parses the XML document in the given input stream.
     *

     * This method starts reading at the current position of the input stream and returns immediately after completely
     * reading a single meta type document. The stream is not closed by this method.
     *
     * @param ins The InputStream providing the XML document
     * @return A {@link MetaData} providing access to the raw contents of the XML document.
     * @throws IOException If an I/O error occurs accessing the stream or parsing the XML document.
     */
    public MetaData parse(InputStream ins) throws IOException {
        MetaData mti = null;
        try {
            this.parser.setFeature(KXmlParser.FEATURE_PROCESS_NAMESPACES, true);
            // set the parser input, use null encoding to force detection with <?xml?>
            this.parser.setInput(ins, null);

            int eventType = this.parser.getEventType();
            while (eventType != XmlPullParser.END_DOCUMENT) {
                String tagName = this.parser.getName();
                if (eventType == XmlPullParser.START_TAG) {
                    if ("MetaData".equals(tagName)) {
                        mti = readMetaData();
                    } else {
                        ignoreElement();
                    }
                }
                eventType = this.parser.next();
            }
        } catch (XmlPullParserException e) {
            throw new IOException("XML parsing exception while reading metadata: " + e.getMessage());
        }

        return mti;
    }

    /**
     * Checks if this document has a meta type name space.
     *
     * @throws IOException when there the meta type name space is not valid
     */
    private void checkMetatypeNamespace() throws IOException {
        final String namespace = this.parser.getNamespace();
        if (namespace != null && !"".equals(namespace.trim())) {
            if (!NAMESPACE_1_0.equals(namespace) && !NAMESPACE_1_1.equals(namespace) && !NAMESPACE_1_2.equals(namespace) && !NAMESPACE_1_3.equals(namespace)) {
                throw new IOException("Unsupported Namespace: '" + namespace + "'");
            }
            this.namespace = namespace;
        }
    }

    private void readOptionalAttributes(OptionalAttributes entity, Set attributes) {
        int count = this.parser.getAttributeCount();
        for (int i = 0; i < count; i++) {
            String name = this.parser.getAttributeName(i);
            if (!attributes.contains(name)) {
                String value = this.parser.getAttributeValue(i);
                entity.addOptionalAttribute(name, value);
            }
        }
    }

    private MetaData readMetaData() throws IOException, XmlPullParserException {
        checkMetatypeNamespace();

        MetaData mti = createMetaData();
        mti.setNamespace(this.namespace);
        mti.setLocalePrefix(getOptionalAttribute("localization"));

        readOptionalAttributes(mti, METADATA_ATTRIBUTES);

        int eventType = this.parser.next();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            String tagName = this.parser.getName();
            if (eventType == XmlPullParser.START_TAG) {
                if ("OCD".equals(tagName)) {
                    mti.addObjectClassDefinition(readOCD());
                } else if ("Designate".equals(tagName)) {
                    mti.addDesignate(readDesignate());
                } else {
                    ignoreElement();
                }
            } else if (eventType == XmlPullParser.END_TAG) {
                if ("MetaData".equals(tagName)) {
                    break;
                }

                throw unexpectedElement(tagName);
            }
            eventType = this.parser.next();
        }

        return mti;
    }

    private OCD readOCD() throws IOException, XmlPullParserException {
        OCD ocd = createOCD();
        ocd.setId(getRequiredAttribute("id"));
        ocd.setName(getRequiredAttribute("name"));
        ocd.setDescription(getOptionalAttribute("description"));

        readOptionalAttributes(ocd, OCD_ATTRIBUTES);

        int eventType = this.parser.next();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            String tagName = this.parser.getName();
            if (eventType == XmlPullParser.START_TAG) {
                if ("AD".equals(tagName)) {
                    ocd.addAttributeDefinition(readAD());
                } else if ("Icon".equals(tagName)) {
                    String res = getRequiredAttribute("resource");
                    String sizeString = getRequiredAttribute("size");
                    try {
                        Integer size = Integer.decode(sizeString);
                        ocd.addIcon(size, res);
                    } catch (NumberFormatException nfe) {
                        // Activator.log(LogService.LOG_DEBUG, "readOCD: Icon size '" + sizeString + "' is not a valid
                        // number");
                    }
                } else {
                    ignoreElement();
                }
            } else if (eventType == XmlPullParser.END_TAG) {
                if ("OCD".equals(tagName)) {
                    if (getNamespaceVersion() < 12 && ocd.getIcons() != null && ocd.getIcons()
                        .size() > 1) {
                        // Only one icon is allowed in versions 1.0 & 1.1...
                        throw unexpectedElement("Icon");
                    }
                    if (getNamespaceVersion() < 13 && ocd.getAttributeDefinitions() == null) {
                        // Need at least one AD in versions 1.0, 1.1 & 1.2...
                        logMissingElement("AD");
                        ocd = null;
                    }
                    break;
                } else if (!"Icon".equals(tagName)) {
                    throw unexpectedElement(tagName);
                }
            }
            eventType = this.parser.next();
        }

        return ocd;
    }

    private Designate readDesignate() throws IOException, XmlPullParserException {
        final String pid = getOptionalAttribute("pid");
        final String factoryPid = getOptionalAttribute("factoryPid");
        if (pid == null && factoryPid == null) {
            missingAttribute("pid or factoryPid");
        }

        Designate designate = this.createDesignate();
        designate.setPid(pid);
        designate.setFactoryPid(factoryPid);
        designate.setBundleLocation(getOptionalAttribute("bundle"));
        designate.setOptional(getOptionalAttribute("optional", false));
        designate.setMerge(getOptionalAttribute("merge", false));

        readOptionalAttributes(designate, DESIGNATE_ATTRIBUTES);

        int eventType = this.parser.next();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            String tagName = this.parser.getName();
            if (eventType == XmlPullParser.START_TAG) {
                if ("Object".equals(tagName)) {
                    if (designate.getObject() != null) {
                        // Only 1 Object is allowed...
                        throw unexpectedElement(tagName);
                    }

                    designate.setObject(readObject());
                } else {
                    this.ignoreElement();
                }
            } else if (eventType == XmlPullParser.END_TAG) {
                if ("Designate".equals(tagName)) {
                    if (designate.getObject() == null) {
                        // Exactly 1 Object is allowed...
                        logMissingElement("Object");
                        designate = null;
                    }
                    break;
                }

                throw unexpectedElement(tagName);
            }
            eventType = this.parser.next();
        }

        return designate;
    }

    private AD readAD() throws IOException, XmlPullParserException {
        AD ad = createAD();
        ad.setID(getRequiredAttribute("id"));
        ad.setName(getOptionalAttribute("name"));
        ad.setDescription(getOptionalAttribute("description"));
        ad.setType(getRequiredAttribute("type"));
        ad.setCardinality(getOptionalAttribute("cardinality", 0));
        ad.setMin(getOptionalAttribute("min"));
        ad.setMax(getOptionalAttribute("max"));
        ad.setRequired(getOptionalAttribute("required", true));
        String dfltValue = getOptionalAttribute("default");

        readOptionalAttributes(ad, AD_ATTRIBUTES);

        Map<String, String> options = new LinkedHashMap<String, String>();
        int eventType = this.parser.next();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            String tagName = this.parser.getName();
            if (eventType == XmlPullParser.START_TAG) {
                if ("Option".equals(tagName)) {
                    String value = getRequiredAttribute("value");
                    String label = getRequiredAttribute("label");
                    options.put(value, label);
                } else {
                    ignoreElement();
                }
            } else if (eventType == XmlPullParser.END_TAG) {
                if ("AD".equals(tagName)) {
                    break;
                } else if (!"Option".equals(tagName)) {
                    throw unexpectedElement(tagName);
                }
            }
            eventType = this.parser.next();
        }

        ad.setOptions(options);

        // set value as late as possible to force an options check (FELIX-3884, FELIX-4665)...
        if (dfltValue != null) {
            ad.setDefaultValue(dfltValue);
        }

        return ad;
    }

    private DesignateObject readObject() throws IOException, XmlPullParserException {
        DesignateObject oh = createDesignateObject();
        oh.setOcdRef(getRequiredAttribute("ocdref"));

        readOptionalAttributes(oh, DESIGNATEOBJECT_ATTRIBUTES);

        int eventType = this.parser.next();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            String tagName = this.parser.getName();
            if (eventType == XmlPullParser.START_TAG) {
                if ("Attribute".equals(tagName)) {
                    oh.addAttribute(readAttribute());
                } else {
                    ignoreElement();
                }
            } else if (eventType == XmlPullParser.END_TAG) {
                if ("Object".equals(tagName)) {
                    break;
                }

                throw unexpectedElement(tagName);
            }
            eventType = this.parser.next();
        }

        return oh;
    }

    private Attribute readAttribute() throws IOException, XmlPullParserException {
        Attribute ah = createAttribute();
        ah.setAdRef(getRequiredAttribute("adref"));
        ah.addContent(getOptionalAttribute("content"), true);

        readOptionalAttributes(ah, ATTRIBUTE_ATTRIBUTES);

        int eventType = this.parser.next();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            String tagName = this.parser.getName();
            if (eventType == XmlPullParser.START_TAG) {
                if ("Value".equals(tagName)) {
                    ah.addContent(this.parser.nextText(), false);
                    eventType = this.parser.getEventType();
                } else {
                    ignoreElement();
                }
            } else if (eventType == XmlPullParser.END_TAG) {
                if ("Attribute".equals(tagName)) {
                    break;
                } else if (!"Value".equals(tagName)) {
                    throw unexpectedElement(tagName);
                }
            }
            eventType = this.parser.next();
        }

        return ah;
    }

    // ---------- Attribute access helper --------------------------------------

    private String getRequiredAttribute(String attrName) throws XmlPullParserException {
        String attrVal = this.parser.getAttributeValue(null, attrName);
        if (attrVal != null) {
            return attrVal;
        }
        // fail if value is missing
        throw missingAttribute(attrName);
    }

    private String getOptionalAttribute(String attrName) {
        return getOptionalAttribute(attrName, (String) null);
    }

    private String getOptionalAttribute(String attrName, String defaultValue) {
        String attrVal = this.parser.getAttributeValue(null, attrName);
        return (attrVal != null) ? attrVal : defaultValue;
    }

    private boolean getOptionalAttribute(String attrName, boolean defaultValue) {
        String attrVal = this.parser.getAttributeValue(null, attrName);
        return (attrVal != null) ? "true".equalsIgnoreCase(attrVal) : defaultValue;
    }

    private int getOptionalAttribute(String attrName, int defaultValue) {
        String attrVal = this.parser.getAttributeValue(null, attrName);
        if (attrVal != null && !"".equals(attrVal)) {
            try {
                return Integer.decode(attrVal)
                    .intValue();
            } catch (NumberFormatException nfe) {
                // Activator.log(LogService.LOG_DEBUG, "getOptionalAttribute: Value '" + attrVal + "' of attribute " +
                // attrName + " is not a valid number. Using default value " + defaultValue);
            }
        }
        // fallback to default
        return defaultValue;
    }

    private int getNamespaceVersion() {
        if (NAMESPACE_1_0.equals(this.namespace)) {
            return 10;
        } else if (NAMESPACE_1_1.equals(this.namespace)) {
            return 11;
        } else if (NAMESPACE_1_2.equals(this.namespace)) {
            return 12;
        } else if (NAMESPACE_1_3.equals(this.namespace)) {
            return 13;
        }
        // Undetermined...
        return Integer.MAX_VALUE;
    }

    // ---------- Error Handling support ---------------------------------------

    private void ignoreElement() throws IOException, XmlPullParserException {
        String ignoredElement = this.parser.getName();

        int depth = 0; // enable nested ignored elements
        int eventType = this.parser.next();
        while (eventType != XmlPullParser.END_DOCUMENT) {
            if (eventType == XmlPullParser.START_TAG) {
                if (ignoredElement.equals(this.parser.getName())) {
                    depth++;
                }
            } else if (eventType == XmlPullParser.END_TAG) {
                if (ignoredElement.equals(this.parser.getName())) {
                    if (depth <= 0) {
                        return;
                    }

                    depth--;
                }
            }
            eventType = this.parser.next();
        }
    }

    private XmlPullParserException missingAttribute(String attrName) {
        String message = "Missing attribute " + attrName + " in element " + this.parser.getName();
        return new XmlPullParserException(message, this.parser, null);
    }

    private void logMissingElement(final String elementName) {
        String message = "Missing element " + elementName + " in element " + this.parser.getName();
        if (documentURL != null) {
            message = message + " : " + this.documentURL;
        }
        Plugin.getDefault()
            .getLog()
            .log(new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, message, null));
    }

    private XmlPullParserException unexpectedElement(String elementName) {
        String message = "Unexpected element " + elementName;
        return new XmlPullParserException(message, this.parser, null);
    }

    // ---------- Factory methods ----------------------------------------------

    /**
     * Creates a new {@link MetaData} object to hold the contents of the MetaData element.
     *

     * This method may be overwritten to return a customized extension.
     */
    protected MetaData createMetaData() {
        return new MetaData();
    }

    /**
     * Creates a new {@link OCD} object to hold the contents of the OCD element.
     *

     * This method may be overwritten to return a customized extension.
     */
    protected OCD createOCD() {
        return new OCD();
    }

    /**
     * Creates a new {@link AD} object to hold the contents of the AD element.
     *

     * This method may be overwritten to return a customized extension.
     */
    protected AD createAD() {
        return new AD();
    }

    /**
     * Creates a new {@link DesignateObject} object to hold the contents of the Object element.
     *

     * This method may be overwritten to return a customized extension.
     */
    protected DesignateObject createDesignateObject() {
        return new DesignateObject();
    }

    /**
     * Creates a new {@link Attribute} object to hold the contents of the Attribute element.
     *

     * This method may be overwritten to return a customized extension.
     */
    protected Attribute createAttribute() {
        return new Attribute();
    }

    /**
     * Creates a new {@link Designate} object to hold the contents of the Designate element.
     *

     * This method may be overwritten to return a customized extension.
     */
    protected Designate createDesignate() {
        return new Designate();
    }
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.txey</groupId>
  <artifactId>zyqd</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>zyqd Maven Webapp</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <!--junit相关包-->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.12</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <version>1.3</version>
    </dependency>

    <!--shiro相关包-->
    <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-core</artifactId>
      <version>1.2.4</version>
    </dependency>
    <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-web</artifactId>
      <version>1.2.4</version>
    </dependency>
    <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-quartz</artifactId>
      <version>1.2.4</version>
    </dependency>
    <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-spring</artifactId>
      <version>1.2.4</version>
    </dependency>
    <dependency>
      <groupId>org.apache.shiro</groupId>
      <artifactId>shiro-aspectj</artifactId>
      <version>1.2.4</version>
    </dependency>

    <!--mysql数据库连接-->
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>5.1.38</version>
    </dependency>

    <!-- aspectj相关jar包-->
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjrt</artifactId>
      <version>1.8.8</version>
    </dependency>
    <dependency>
      <groupId>org.aspectj</groupId>
      <artifactId>aspectjweaver</artifactId>
      <version>1.8.8</version>
    </dependency>

    <!--spring相关包-->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-test</artifactId>
      <version>4.2.4.RELEASE</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context-support</artifactId>
      <version>4.2.4.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-jdbc</artifactId>
      <version>4.2.4.RELEASE</version>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-tx</artifactId>
      <version>4.2.4.RELEASE</version>
    </dependency>

    <!--springmvc-->
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-webmvc</artifactId>
      <version>4.2.4.RELEASE</version>
    </dependency>

    <!--servlet,jsp,jstl-->
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.0.1</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.2</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>jstl</artifactId>
      <version>1.2</version>
    </dependency>

    <!--mybatis相关包-->
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis-spring</artifactId>
      <version>1.2.4</version>
    </dependency>
    <dependency>
      <groupId>org.mybatis</groupId>
      <artifactId>mybatis</artifactId>
      <version>3.3.1</version>
    </dependency>
    <dependency>
      <groupId>cglib</groupId>
      <artifactId>cglib</artifactId>
      <version>3.2.0</version>
    </dependency>
    <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging</artifactId>
      <version>1.2</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.14</version>
    </dependency>
    <dependency>
      <groupId>log4j</groupId>
      <artifactId>log4j</artifactId>
      <version>1.2.17</version>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>2.3</version>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-log4j12</artifactId>
      <version>1.7.14</version>
    </dependency>
    <dependency>
      <groupId>ognl</groupId>
      <artifactId>ognl</artifactId>
      <version>3.1.2</version>
    </dependency>
    <dependency>
      <groupId>org.javassist</groupId>
      <artifactId>javassist</artifactId>
      <version>3.20.0-GA</version>
    </dependency>

    <!--数据源-->
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-pool2</artifactId>
      <version>2.3</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-dbcp2</artifactId>
      <version>2.1</version>
    </dependency>

    <!--json parser-->
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
      <version>2.6</version>
    </dependency>

    <!--file upload-->
    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
      <version>1.3.1</version>
    </dependency>

  </dependencies>

  <build>
    <finalName>giit</finalName>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
          <include>**/*.properties</include>
          <include>**/*.xml</include>
          <include>**/*.tld</include>
        </includes>
        <filtering>false</filtering>
      </resource>
      <resource>
        <directory>src/main/java</directory>
        <includes>
          <include>**/*.properties</include>
          <include>**/*.xml</include>
          <include>**/*.tld</include>
        </includes>
        <filtering>false</filtering>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-plugin</artifactId>
        <version>8.1.8.v20121106</version>
        <configuration>
          <webAppConfig>
            <contextPath>/${project.build.finalName}</contextPath>
          </webAppConfig>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.cargo</groupId>
        <artifactId>cargo-maven2-plugin</artifactId>
        <version>1.4.18</version>
        <configuration>
          <container>
            <!--tomcat类型 -->
            <containerId>tomcat8x</containerId>
            <!-- 指定tomcat路径 -->
            <home>/home/c0de8ug/software/apache-tomcat-8.0.28</home>
            <timeout>300000</timeout>
          </container>
          <configuration>
            <type>existing</type>
            <!--指定tomcat路径 -->
            <home>/home/c0de8ug/software/apache-tomcat-8.0.28</home>
          </configuration>
        </configuration>
        <executions>
          <execution>
            <id>cargo-start</id>
            <phase>install</phase>
            <goals>
              <goal>start</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>

  </build>
</project>


text:
<title>
Attacked at Ground Zero
</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php include "../../legacy-includes/Script.htmlf" ?>

<?php include "../../legacy-includes/TopLogo.htmlf" ?>

<?php include "../../legacy-includes/TopAd.htmlf" ?>

<?php include "../../legacy-includes/LeftButtons.htmlf" ?>

<?php include "../../legacy-includes/BodyInsert.htmlf" ?>

Giuliani lashes out at the firefighters he praised as "heroes"

Attacked at Ground Zero

November 9, 2001 | Page 2

NEW YORK Mayor Rudolph Giuliani lashed out earlier this month at the very people he's praised as heroes many times since September 11.

Giuliani has made sure that he was on the platform at events to mourn the 353 firefighters who died during rescue operations when the World Trade Center collapsed. But when firefighters stepped out of line earlier this month, Giuliani turned on them--returning to the snarling temper tantrums that made him so hated during his eight years in office.

On November 2, hundreds of firefighters--furious with new restrictions on how many could be at the World Trade Center site to help with recovering the remains of their comrades--marched on "ground zero," clashing with police who tried to bar their way.

The media blamed firefighters for the confrontation, and 12 of the marchers were arrested. But firefighters say police provoked the violence. "We were marching peacefully to ground zero, when suddenly, a handful of police officers waded into a line of marchers and began pulling people out," said Peter Gorman, president of the Uniformed Fire Officers Association.

City officials claim that the new restrictions at ground zero are for safety reasons--that firefighters could be exposed to dangerous chemicals or injured by heavy equipment. But firefighters say they think the decision has more to do with serving the mayor's rich pals.

What's more, the announcement of the restrictions came shortly after hundreds of millions of dollars worth of gold, silver and other precious metals were located in the rubble. Finding the vaults of the Bank of Nova Scotia, one of the world's biggest precious metals traders, was obviously a top priority for city officials.

Firefighters now fear that Giuliani will turn the cleanup into a "scoop-and-dump" operation--to get the work done as quickly as possible. The behavior of city officials confirmed firefighters fears.

For example, the Giuliani administration fueled the disgusting rumor that firefighters organized the protest because they want the overtime. Anyone who has heard firefighters talk about the pain they feel at the loss of so many coworkers knows that this is a crock.

But for Giuliani and the corporate fat cats he serves, the most important part of the salvage operation--finding the money--is over. They could care less about the firefighters that they praise as the "real heroes" of September 11.

<?php include "../../legacy-includes/BottomNavLinks.htmlf" ?>

<?php include "../../legacy-includes/RightAdFolder.htmlf" ?>


text:
<?php

// Enrico Simonetti
// 2017-03-09
//
// POST based Bulk API for Sugar, that completes SQL based lookups based on external system's unique keys and inserts or updates multiple beans per HTTP request at once

require_once('custom/include/bulkimport/BulkImport.php');

if (!defined('sugarEntry') || !sugarEntry) {
    die('Not A Valid Entry Point');
}

class BulkImportApi extends SugarApi
{
    private $bulkImportObject;

    public function registerApiRest()
    {
        return [
            [
                'reqType' => ['POST', 'PUT'],
                'path' => ['BulkImport', 'records', '?'],
                'pathVars' => ['', '', 'module'],
                'method' => 'bulkImport',
                'minVersion' => 10,
                //'maxVersion' => 11,
                'shortHelp' => 'Admin Only - POST BulkImport/records/:module post a list of {"records":[]}',
            ],
            [
                'reqType' => ['POST', 'PUT'],
                'path' => ['BulkImport', 'relationships', '?', '?'],
                'pathVars' => ['', '', 'module', 'linkfield'],
                'method' => 'bulkImportRelationship',
                'minVersion' => 10,
                //'maxVersion' => 11,
                'shortHelp' => 'Admin Only - POST BulkImport/relationships/:module/:linkfield post a list of {"records":[]} with left external key and right external key',
            ],
        ];
    }

    protected function bulk() {
        if (empty($this->bulkImportObject)) {
            $this->bulkImportObject = new BulkImport();
        }
        return $this->bulkImportObject;
    }

    public function bulkImport($api, $args)
    {
        $total_t_start = microtime(true);
        global $current_user;

        $this->bulk()->checkIfCurrentUserIsAdmin();

        // disable activity stream
        Activity::disable();
        // pause tracker
        TrackerManager::getInstance()->pause();

        $GLOBALS['log']->info('Bulk Import - resource: ' . $args['__sugar_url']);

        $this->bulk()->checkImportArgsForModules($args);

        // one bean for all the lookup loop
        $samplebean = BeanFactory::getBean($args['module']);

        if (!isset($samplebean)) {
            $this->bulk()->parameterError('Lookup Bean ' . $args['module'] . ' load failed');
        }

        if (!empty($args['records'] && is_array($args['records']))) {
            if (count($args['records']) > $this->bulk()->getRecordLimit()) {
                $this->bulk()->parameterError('The request contains too many records. Please provide less than ' . $this->bulk()->getRecordLimit() . ' records per call');
            }

            // do we need to impersonate?
            if (!empty($args['save_as_user_id'])) {
                $this->bulk()->impersonateUserById($args['save_as_user_id']);
            }

            foreach ($args['records'] as $record) {
                $this->bulk()->handleRecordSave($record, $samplebean, $args);
            }

            // restore user (only happens if it was impersonated)
            $this->bulk()->restoreApiUser();
        } else {
            $this->bulk()->parameterError('An array of records is required as input');
        }

        $this->bulk()->logExecutionTime((microtime(true) - $total_t_start));

        $GLOBALS['log']->info('Bulk Import - API records processed in : ' . (microtime(true) - $total_t_start) . ' seconds. '. print_r($this->bulk()->getResponseArray(), true));

        return $this->bulk()->getResponseArray();
    }

    public function bulkImportRelationship($api, $args)
    {
        $total_t_start = microtime(true);
        global $current_user;

        $this->bulk()->checkIfCurrentUserIsAdmin();

        // disable activity stream
        Activity::disable();
        // pause tracker
        TrackerManager::getInstance()->pause();

        $GLOBALS['log']->info('Bulk Import - resource: ' . $args['__sugar_url']);

        if (empty($args['linkfield']) || empty($args['module']) || empty($args['records'])) {
            $this->bulk()->parameterError(
                'The following parameters are empty: ' .
                (empty($args['module']) ? 'Module' : '') .
                (empty($args['linkfield']) ? 'Link Field' : '') .
                (empty($args['records']) ? ', Records' : '')
            );
        }

        if (!in_array($args['module'], $this->bulk()->getAllowedRelationshipModules())) {
            $this->bulk()->parameterError('Relationship\'s module ' . $args['module'] . ' not allowed');
        }

        if (!in_array($args['linkfield'], $this->bulk()->getAllowedRelationshipLinkfields($args['module']))) {
            $this->bulk()->parameterError('Relationship\'s linkfield ' . $args['linkfield'] . ' not allowed');
        }

        // one bean for all the lookup loop
        $sampleleftbean = BeanFactory::getBean($args['module']);
        if (!isset($sampleleftbean)) {
            $this->bulk()->parameterError('Relationship left lookup bean: ' . $args['module'] . ' load failed');
        }

        // find the right side bean and load it
        $sampleleftbean->load_relationship($args['linkfield']);
        if (!empty($sampleleftbean->{$args['linkfield']})) {
            if ($sampleleftbean->{$args['linkfield']}->getRelationshipObject()->getRHSModule() == $args['module']) {
                $right_module = $sampleleftbean->{$args['linkfield']}->getRelationshipObject()->getLHSModule();
            } else {
                $right_module = $sampleleftbean->{$args['linkfield']}->getRelationshipObject()->getRHSModule();
            }
            $samplerightbean = BeanFactory::getBean($right_module);
        }

        if (!isset($samplerightbean)) {
            $this->bulk()->parameterError('Relationship right lookup bean failed for module '.$args['module'].' with link field '.$args['linkfield']);
        }

        if (!empty($args['records'] && is_array($args['records']))) {
            if (count($args['records']) > $this->bulk()->getRecordLimit()) {
                $this->bulk()->parameterError('The request contains too many records. Please provide less than ' . $this->bulk()->getRecordLimit() . ' records per call');
            }

            // do we need to impersonate?
            if (!empty($args['save_as_user_id'])) {
                $this->bulk()->impersonateUserById($args['save_as_user_id']);
            }

            foreach ($args['records'] as $record) {
                $this->bulk()->handleRelationshipSave($record, $sampleleftbean, $samplerightbean, $args);
            }

            // restore user (only happens if it was impersonated)
            $this->bulk()->restoreApiUser();
        } else {
            $this->bulk()->parameterError('An array of records is required as input');
        }

        $this->bulk()->logExecutionTime((microtime(true) - $total_t_start));

        $GLOBALS['log']->info('Bulk Import - API records processed in : ' . (microtime(true) - $total_t_start) . ' seconds. '. print_r($this->bulk()->getResponseArray(), true));

        return $this->bulk()->getResponseArray();
    }
}


text:
<?php

namespace Guzzle\Plugin\Cookie;

use Guzzle\Common\ToArrayInterface;

/**
 * Set-Cookie object
 */
class Cookie implements ToArrayInterface
{
    /** @var array Cookie data */
    protected $data;

    /**
     * @var string ASCII codes not valid for for use in a cookie name
     *
     * Cookie names are defined as 'token', according to RFC 2616, Section 2.2
     * A valid token may contain any CHAR except CTLs (ASCII 0 - 31 or 127)
     * or any of the following separators
     */
    protected static $invalidCharString;

    /**
     * Gets an array of invalid cookie characters
     *
     * @return array
     */
    protected static function getInvalidCharacters()
    {
        if (!self::$invalidCharString) {
            self::$invalidCharString = implode('', array_map('chr', array_merge(
                range(0, 32),
                array(34, 40, 41, 44, 47),
                array(58, 59, 60, 61, 62, 63, 64, 91, 92, 93, 123, 125, 127)
            )));
        }

        return self::$invalidCharString;
    }

    /**
     * @param array $data Array of cookie data provided by a Cookie parser
     */
    public function __construct(array $data = array())
    {
        static $defaults = array(
            'name'        => '',
            'value'       => '',
            'domain'      => '',
            'path'        => '/',
            'expires'     => null,
            'max_age'     => 0,
            'comment'     => null,
            'comment_url' => null,
            'port'        => array(),
            'version'     => null,
            'secure'      => false,
            'discard'     => false,
            'http_only'   => false
        );

        $this->data = array_merge($defaults, $data);
        // Extract the expires value and turn it into a UNIX timestamp if needed
        if (!$this->getExpires() && $this->getMaxAge()) {
            // Calculate the expires date
            $this->setExpires(time() + (int) $this->getMaxAge());
        } elseif ($this->getExpires() && !is_numeric($this->getExpires())) {
            $this->setExpires(strtotime($this->getExpires()));
        }
    }

    /**
     * Get the cookie as an array
     *
     * @return array
     */
    public function toArray()
    {
        return $this->data;
    }

    /**
     * Get the cookie name
     *
     * @return string
     */
    public function getName()
    {
        return $this->data['name'];
    }

    /**
     * Set the cookie name
     *
     * @param string $name Cookie name
     *
     * @return Cookie
     */
    public function setName($name)
    {
        return $this->setData('name', $name);
    }

    /**
     * Get the cookie value
     *
     * @return string
     */
    public function getValue()
    {
        return $this->data['value'];
    }

    /**
     * Set the cookie value
     *
     * @param string $value Cookie value
     *
     * @return Cookie
     */
    public function setValue($value)
    {
        return $this->setData('value', $value);
    }

    /**
     * Get the domain
     *
     * @return string|null
     */
    public function getDomain()
    {
        return $this->data['domain'];
    }

    /**
     * Set the domain of the cookie
     *
     * @param string $domain
     *
     * @return Cookie
     */
    public function setDomain($domain)
    {
        return $this->setData('domain', $domain);
    }

    /**
     * Get the path
     *
     * @return string
     */
    public function getPath()
    {
        return $this->data['path'];
    }

    /**
     * Set the path of the cookie
     *
     * @param string $path Path of the cookie
     *
     * @return Cookie
     */
    public function setPath($path)
    {
        return $this->setData('path', $path);
    }

    /**
     * Maximum lifetime of the cookie in seconds
     *
     * @return int|null
     */
    public function getMaxAge()
    {
        return $this->data['max_age'];
    }

    /**
     * Set the max-age of the cookie
     *
     * @param int $maxAge Max age of the cookie in seconds
     *
     * @return Cookie
     */
    public function setMaxAge($maxAge)
    {
        return $this->setData('max_age', $maxAge);
    }

    /**
     * The UNIX timestamp when the cookie expires
     *
     * @return mixed
     */
    public function getExpires()
    {
        return $this->data['expires'];
    }

    /**
     * Set the unix timestamp for which the cookie will expire
     *
     * @param int $timestamp Unix timestamp
     *
     * @return Cookie
     */
    public function setExpires($timestamp)
    {
        return $this->setData('expires', $timestamp);
    }

    /**
     * Version of the cookie specification. RFC 2965 is 1
     *
     * @return mixed
     */
    public function getVersion()
    {
        return $this->data['version'];
    }

    /**
     * Set the cookie version
     *
     * @param string|int $version Version to set
     *
     * @return Cookie
     */
    public function setVersion($version)
    {
        return $this->setData('version', $version);
    }

    /**
     * Get whether or not this is a secure cookie
     *
     * @return null|bool
     */
    public function getSecure()
    {
        return $this->data['secure'];
    }

    /**
     * Set whether or not the cookie is secure
     *
     * @param bool $secure Set to true or false if secure
     *
     * @return Cookie
     */
    public function setSecure($secure)
    {
        return $this->setData('secure', (bool) $secure);
    }

    /**
     * Get whether or not this is a session cookie
     *
     * @return null|bool
     */
    public function getDiscard()
    {
        return $this->data['discard'];
    }

    /**
     * Set whether or not this is a session cookie
     *
     * @param bool $discard Set to true or false if this is a session cookie
     *
     * @return Cookie
     */
    public function setDiscard($discard)
    {
        return $this->setData('discard', $discard);
    }

    /**
     * Get the comment
     *
     * @return string|null
     */
    public function getComment()
    {
        return $this->data['comment'];
    }

    /**
     * Set the comment of the cookie
     *
     * @param string $comment Cookie comment
     *
     * @return Cookie
     */
    public function setComment($comment)
    {
        return $this->setData('comment', $comment);
    }

    /**
     * Get the comment URL of the cookie
     *
     * @return string|null
     */
    public function getCommentUrl()
    {
        return $this->data['comment_url'];
    }

    /**
     * Set the comment URL of the cookie
     *
     * @param string $commentUrl Cookie comment URL for more information
     *
     * @return Cookie
     */
    public function setCommentUrl($commentUrl)
    {
        return $this->setData('comment_url', $commentUrl);
    }

    /**
     * Get an array of acceptable ports this cookie can be used with
     *
     * @return array
     */
    public function getPorts()
    {
        return $this->data['port'];
    }

    /**
     * Set a list of acceptable ports this cookie can be used with
     *
     * @param array $ports Array of acceptable ports
     *
     * @return Cookie
     */
    public function setPorts(array $ports)
    {
        return $this->setData('port', $ports);
    }

    /**
     * Get whether or not this is an HTTP only cookie
     *
     * @return bool
     */
    public function getHttpOnly()
    {
        return $this->data['http_only'];
    }

    /**
     * Set whether or not this is an HTTP only cookie
     *
     * @param bool $httpOnly Set to true or false if this is HTTP only
     *
     * @return Cookie
     */
    public function setHttpOnly($httpOnly)
    {
        return $this->setData('http_only', $httpOnly);
    }

    /**
     * Get an array of extra cookie data
     *
     * @return array
     */
    public function getAttributes()
    {
        return $this->data['data'];
    }

    /**
     * Get a specific data point from the extra cookie data
     *
     * @param string $name Name of the data point to retrieve
     *
     * @return null|string
     */
    public function getAttribute($name)
    {
        return array_key_exists($name, $this->data['data']) ? $this->data['data'][$name] : null;
    }

    /**
     * Set a cookie data attribute
     *
     * @param string $name  Name of the attribute to set
     * @param string $value Value to set
     *
     * @return Cookie
     */
    public function setAttribute($name, $value)
    {
        $this->data['data'][$name] = $value;

        return $this;
    }

    /**
     * Check if the cookie matches a path value
     *
     * @param string $path Path to check against
     *
     * @return bool
     */
    public function matchesPath($path)
    {
        return !$this->getPath() || 0 === stripos($path, $this->getPath());
    }

    /**
     * Check if the cookie matches a domain value
     *
     * @param string $domain Domain to check against
     *
     * @return bool
     */
    public function matchesDomain($domain)
    {
        // Remove the leading '.' as per spec in RFC 6265: http://tools.ietf.org/html/rfc6265#section-5.2.3
        $cookieDomain = ltrim($this->getDomain(), '.');

        // Domain not set or exact match.
        if (!$cookieDomain || !strcasecmp($domain, $cookieDomain)) {
            return true;
        }

        // Matching the subdomain according to RFC 6265: http://tools.ietf.org/html/rfc6265#section-5.1.3
        if (filter_var($domain, FILTER_VALIDATE_IP)) {
            return false;
        }

        return (bool) preg_match('/\.' . preg_quote($cookieDomain) . '$/i', $domain);
    }

    /**
     * Check if the cookie is compatible with a specific port
     *
     * @param int $port Port to check
     *
     * @return bool
     */
    public function matchesPort($port)
    {
        return count($this->getPorts()) == 0 || in_array($port, $this->getPorts());
    }

    /**
     * Check if the cookie is expired
     *
     * @return bool
     */
    public function isExpired()
    {
        return $this->getExpires() && time() > $this->getExpires();
    }

    /**
     * Check if the cookie is valid according to RFC 6265
     *
     * @return bool|string Returns true if valid or an error message if invalid
     */
    public function validate()
    {
        // Names must not be empty, but can be 0
        $name = $this->getName();
        if (empty($name) && !is_numeric($name)) {
            return 'The cookie name must not be empty';
        }

        // Check if any of the invalid characters are present in the cookie name
        if (strpbrk($name, self::getInvalidCharacters()) !== false) {
            return 'The cookie name must not contain invalid characters: ' . $name;
        }

        // Value must not be empty, but can be 0
        $value = $this->getValue();
        if (empty($value) && !is_numeric($value)) {
            return 'The cookie value must not be empty';
        }

        // Domains must not be empty, but can be 0
        // A "0" is not a valid internet domain, but may be used as server name in a private network
        $domain = $this->getDomain();
        if (empty($domain) && !is_numeric($domain)) {
            return 'The cookie domain must not be empty';
        }

        return true;
    }

    /**
     * Set a value and return the cookie object
     *
     * @param string $key   Key to set
     * @param string $value Value to set
     *
     * @return Cookie
     */
    private function setData($key, $value)
    {
        $this->data[$key] = $value;

        return $this;
    }
}


text:
influxdb-docker
===============

Test build

    docker build -t skalera/influxdb .

This container requires a data directory mount on `/data`,

    mkdir -p ~/data
    docker run --name influxdb -v ~/data:/data skalera/influxdb

## Verification

    curl -G http://localhost:8086/query --data-urlencode "q=CREATE DATABASE test"
    curl -X POST 'http://localhost:8086/write' -d '{"database":"test","points":[{"name":"test","tags":{"tag1":"value1"},"fields":{"value":1.2}}]}'
    curl -G 'http://localhost:8086/query' --data-urlencode "db=test" --data-urlencode "q=SELECT value FROM test WHERE tag1='value1'"


text:
package com.bbva.kltt.apirest.core.generator.output.exceptions;

import org.junit.Test;

import com.bbva.kltt.apirest.core.generator.output.language.MyOutputLanguageNaming;
import com.bbva.kltt.apirest.core.util.APIRestGeneratorException;
import com.bbva.kltt.apirest.core.util.ConstantsTest;

/**
 * ------------------------------------------------
 * @author Francisco Manuel Benitez Chico
 * ------------------------------------------------
 */
public class OutputCommonExceptionTest
{
	@Test
	public void fullTest() throws APIRestGeneratorException
	{
		final OutputCommonException outputCommonException = new OutputCommonException(new MyOutputLanguageNaming()) ;

		outputCommonException.getAsClassName() ;
		outputCommonException.getAsMethodName(ConstantsTest.OPERATION_ID) ;

		outputCommonException.getOutputLanguageNaming() ;
	}
}


text:
@implementation UIView (JKDraggable)

- (void)setJk_panGesture:(UIPanGestureRecognizer*)panGesture
{
    objc_setAssociatedObject(self, @selector(jk_panGesture), panGesture, OBJC_ASSOCIATION_RETAIN);
}

- (UIPanGestureRecognizer*)jk_panGesture
{
    return objc_getAssociatedObject(self, @selector(jk_panGesture));
}

- (void)setJk_cagingArea:(CGRect)cagingArea
{
    if (CGRectEqualToRect(cagingArea, CGRectZero) ||
        CGRectContainsRect(cagingArea, self.frame)) {
        NSValue *cagingAreaValue = [NSValue valueWithCGRect:cagingArea];
        objc_setAssociatedObject(self, @selector(jk_cagingArea), cagingAreaValue, OBJC_ASSOCIATION_RETAIN);
    }
}

- (CGRect)jk_cagingArea
{
    NSValue *cagingAreaValue = objc_getAssociatedObject(self, @selector(jk_cagingArea));
    return [cagingAreaValue CGRectValue];
}

- (void)setJk_handle:(CGRect)handle
{
    CGRect relativeFrame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
    if (CGRectContainsRect(relativeFrame, handle)) {
        NSValue *handleValue = [NSValue valueWithCGRect:handle];
        objc_setAssociatedObject(self, @selector(jk_handle), handleValue, OBJC_ASSOCIATION_RETAIN);
    }
}

- (CGRect)jk_handle
{
    NSValue *handleValue = objc_getAssociatedObject(self, @selector(jk_handle));
    return [handleValue CGRectValue];
}

- (void)setJk_shouldMoveAlongY:(BOOL)newShould
{
    NSNumber *shouldMoveAlongYBool = [NSNumber numberWithBool:newShould];
    objc_setAssociatedObject(self, @selector(jk_shouldMoveAlongY), shouldMoveAlongYBool, OBJC_ASSOCIATION_RETAIN );
}

- (BOOL)jk_shouldMoveAlongY
{
    NSNumber *moveAlongY = objc_getAssociatedObject(self, @selector(jk_shouldMoveAlongY));
    return (moveAlongY) ? [moveAlongY boolValue] : YES;
}

- (void)setJk_shouldMoveAlongX:(BOOL)newShould
{
    NSNumber *shouldMoveAlongXBool = [NSNumber numberWithBool:newShould];
    objc_setAssociatedObject(self, @selector(jk_shouldMoveAlongX), shouldMoveAlongXBool, OBJC_ASSOCIATION_RETAIN );
}

- (BOOL)jk_shouldMoveAlongX
{
    NSNumber *moveAlongX = objc_getAssociatedObject(self, @selector(jk_shouldMoveAlongX));
    return (moveAlongX) ? [moveAlongX boolValue] : YES;
}

- (void)setJk_draggingStartedBlock:(void (^)(void))draggingStartedBlock
{
    objc_setAssociatedObject(self, @selector(jk_draggingStartedBlock), draggingStartedBlock, OBJC_ASSOCIATION_RETAIN);
}

- (void (^)(void))jk_draggingStartedBlock
{
    return objc_getAssociatedObject(self, @selector(jk_draggingStartedBlock));
}

- (void)setJk_draggingEndedBlock:(void (^)(void))draggingEndedBlock
{
    objc_setAssociatedObject(self, @selector(jk_draggingEndedBlock), draggingEndedBlock, OBJC_ASSOCIATION_RETAIN);
}

- (void (^)(void))jk_draggingEndedBlock
{
    return objc_getAssociatedObject(self, @selector(jk_draggingEndedBlock));
}

- (void)jk_handlePan:(UIPanGestureRecognizer*)sender
{
    // Check to make you drag from dragging area
    CGPoint locationInView = [sender locationInView:self];
    if (!CGRectContainsPoint(self.jk_handle, locationInView)) {
        return;
    }

    [self jk_adjustAnchorPointForGestureRecognizer:sender];

    if (sender.state == UIGestureRecognizerStateBegan && self.jk_draggingStartedBlock) {
        self.jk_draggingStartedBlock();
    }

    if (sender.state == UIGestureRecognizerStateEnded && self.jk_draggingEndedBlock) {
        self.jk_draggingEndedBlock();
    }

    CGPoint translation = [sender translationInView:[self superview]];

    CGFloat newXOrigin = CGRectGetMinX(self.frame) + (([self jk_shouldMoveAlongX]) ? translation.x : 0);
    CGFloat newYOrigin = CGRectGetMinY(self.frame) + (([self jk_shouldMoveAlongY]) ? translation.y : 0);

    CGRect cagingArea = self.jk_cagingArea;

    CGFloat cagingAreaOriginX = CGRectGetMinX(cagingArea);
    CGFloat cagingAreaOriginY = CGRectGetMinY(cagingArea);

    CGFloat cagingAreaRightSide = cagingAreaOriginX + CGRectGetWidth(cagingArea);
    CGFloat cagingAreaBottomSide = cagingAreaOriginY + CGRectGetHeight(cagingArea);

    if (!CGRectEqualToRect(cagingArea, CGRectZero)) {

        // Check to make sure the view is still within the caging area
        if (newXOrigin <= cagingAreaOriginX ||
            newYOrigin <= cagingAreaOriginY ||
            newXOrigin + CGRectGetWidth(self.frame) >= cagingAreaRightSide ||
            newYOrigin + CGRectGetHeight(self.frame) >= cagingAreaBottomSide) {

            // Don't move
            newXOrigin = CGRectGetMinX(self.frame);
            newYOrigin = CGRectGetMinY(self.frame);
        }
    }

    [self setFrame:CGRectMake(newXOrigin,
                              newYOrigin,
                              CGRectGetWidth(self.frame),
                              CGRectGetHeight(self.frame))];

    [sender setTranslation:(CGPoint){0, 0} inView:[self superview]];
}

- (void)jk_adjustAnchorPointForGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
{
    if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
        UIView *piece = self;
        CGPoint locationInView = [gestureRecognizer locationInView:piece];
        CGPoint locationInSuperview = [gestureRecognizer locationInView:piece.superview];

        piece.layer.anchorPoint = CGPointMake(locationInView.x / piece.bounds.size.width, locationInView.y / piece.bounds.size.height);
        piece.center = locationInSuperview;
    }
}

- (void)jk_setDraggable:(BOOL)draggable
{
    [self.jk_panGesture setEnabled:draggable];
}

- (void)jk_enableDragging
{
    self.jk_panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(jk_handlePan:)];
    [self.jk_panGesture setMaximumNumberOfTouches:1];
    [self.jk_panGesture setMinimumNumberOfTouches:1];
    [self.jk_panGesture setCancelsTouchesInView:NO];
    [self setJk_handle:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
    [self addGestureRecognizer:self.jk_panGesture];
}

@end


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="shortcut icon" href="https://igv.org/web/img/favicon.ico">

    <title>IGV Examples - Load Session</title>

Blank browser to demonstrate loading igv sessions and files from html links

See demos/igv-links.html


text:
package org.apache.storm.cassandra.trident;

import com.datastax.driver.core.Cluster;
import com.datastax.driver.core.DataType;
import com.datastax.driver.core.Session;
import com.datastax.driver.core.querybuilder.QueryBuilder;
import com.datastax.driver.core.querybuilder.Truncate;
import com.datastax.driver.core.schemabuilder.Create;
import com.datastax.driver.core.schemabuilder.SchemaBuilder;
import org.apache.cassandra.locator.SimpleStrategy;
import org.apache.storm.Config;
import org.apache.storm.LocalCluster;
import org.apache.storm.LocalDRPC;
import org.apache.storm.cassandra.client.CassandraConf;
import org.apache.storm.cassandra.testtools.EmbeddedCassandraResource;
import org.apache.storm.cassandra.trident.state.MapStateFactoryBuilder;
import org.apache.storm.trident.TridentState;
import org.apache.storm.trident.TridentTopology;
import org.apache.storm.trident.operation.builtin.Count;
import org.apache.storm.trident.operation.builtin.FilterNull;
import org.apache.storm.trident.operation.builtin.MapGet;
import org.apache.storm.trident.operation.builtin.Sum;
import org.apache.storm.trident.state.StateFactory;
import org.apache.storm.trident.testing.FixedBatchSpout;
import org.apache.storm.trident.testing.Split;
import org.apache.storm.tuple.Fields;
import org.apache.storm.tuple.Values;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.junit.*;

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

import static org.junit.Assert.assertEquals;

public class MapStateTest {

    @ClassRule
    public static final EmbeddedCassandraResource cassandra = new EmbeddedCassandraResource();

    private static Logger logger = LoggerFactory.getLogger(MapStateTest.class);
    private static Cluster cluster;
    private Session session;

    @Test
    public void nonTransactionalStateTest() throws Exception {
        StateFactory factory = MapStateFactoryBuilder.nontransactional(getCassandraConfig())
                .withTable("words_ks", "words_table")
                .withKeys("word")
                .withJSONBinaryState("state")
                .build();

        wordsTest(factory);
    }

    @Test
    public void transactionalStateTest() throws Exception {

        Map config = new HashMap();
        StateFactory factory = MapStateFactoryBuilder.transactional(getCassandraConfig())
                .withTable("words_ks", "words_table")
                .withKeys("word")
                .withJSONBinaryState("state")
                .build();

        wordsTest(factory);
    }

    @Test
    public void opaqueStateTest() throws Exception {

        Map config = new HashMap();
        StateFactory factory = MapStateFactoryBuilder.opaque(getCassandraConfig())
                .withTable("words_ks", "words_table")
                .withKeys("word")
                .withJSONBinaryState("state")
                .build();

        wordsTest(factory);
    }

    public void wordsTest(StateFactory factory) throws Exception {

        FixedBatchSpout spout = new FixedBatchSpout(
                new Fields("sentence"), 3,
                new Values("the cow jumped over the moon"),
                new Values("the man went to the store and bought some candy"),
                new Values("four score and seven years ago"),
                new Values("how many apples can you eat"));
        spout.setCycle(false);

        TridentTopology topology = new TridentTopology();

        TridentState wordCounts = topology.newStream("spout1", spout)
                .each(new Fields("sentence"), new Split(), new Fields("word"))
                .groupBy(new Fields("word"))
                .persistentAggregate(factory, new Count(), new Fields("state"))
                .parallelismHint(1);

        LocalDRPC client = new LocalDRPC();
        topology.newDRPCStream("words", client)
                .each(new Fields("args"), new Split(), new Fields("word"))
                .groupBy(new Fields("word"))
                .stateQuery(wordCounts, new Fields("word"), new MapGet(), new Fields("state"))
                .each(new Fields("state"), new FilterNull())
                .aggregate(new Fields("state"), new Sum(), new Fields("sum"));

        LocalCluster cluster = new LocalCluster();
        logger.info("Submitting topology.");
        cluster.submitTopology("test", new HashMap(), topology.build());

        logger.info("Waiting for something to happen.");
        int count;
        do {
            Thread.sleep(2000);
            count = session.execute(QueryBuilder.select().all().from("words_ks", "words_table"))
                    .getAvailableWithoutFetching();
            logger.info("Found {} records", count);
        } while (count < 24);

        logger.info("Starting queries.");
        assertEquals("[[5]]", client.execute("words", "cat dog the man")); // 5
        assertEquals("[[0]]", client.execute("words", "cat")); // 0
        assertEquals("[[0]]", client.execute("words", "dog")); // 0
        assertEquals("[[4]]", client.execute("words", "the")); // 4
        assertEquals("[[1]]", client.execute("words", "man")); // 1

        cluster.shutdown();

    }

    @Before
    public void setUp() throws Exception {

        Cluster.Builder clusterBuilder = Cluster.builder();

        // Add cassandra cluster contact points
        clusterBuilder.addContactPoint(cassandra.getHost());
        clusterBuilder.withPort(cassandra.getNativeTransportPort());

        // Build cluster and connect
        cluster = clusterBuilder.build();
        session = cluster.connect();

        createKeyspace("words_ks");
        createTable("words_ks", "words_table",
                column("word", DataType.varchar()),
                column("state", DataType.blob()));

    }

    @After
    public void tearDown() {
        truncateTable("words_ks", "words_table");
        session.close();
    }

    protected void createKeyspace(String keyspace) throws Exception {
        // Create keyspace not supported in the current datastax driver
        String createKeyspace = "CREATE KEYSPACE IF NOT EXISTS "
                + keyspace
                + " WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };";
        logger.info(createKeyspace);
        if (!session.execute(createKeyspace)
            .wasApplied()) {
            throw new Exception("Did not create keyspace " + keyspace);
        }
    }

    protected Config getCassandraConfig() {
        Config cassandraConf = new Config();
        cassandraConf.put(CassandraConf.CASSANDRA_NODES, cassandra.getHost());
        cassandraConf.put(CassandraConf.CASSANDRA_PORT, cassandra.getNativeTransportPort());
        cassandraConf.put(CassandraConf.CASSANDRA_KEYSPACE, "words_ks");
        return cassandraConf;
    }

    protected void truncateTable(String keyspace, String table) {
        Truncate truncate = QueryBuilder.truncate(keyspace, table);
        session.execute(truncate);
    }

    protected void createTable(String keyspace, String table, Column key, Column... fields) {
        Map<String, Object> replication = new HashMap<>();
        replication.put("class", SimpleStrategy.class.getSimpleName());
        replication.put("replication_factor", 1);

        Create createTable = SchemaBuilder.createTable(keyspace, table)
                .ifNotExists()
                .addPartitionKey(key.name, key.type);
        for (Column field : fields) {
            createTable.addColumn(field.name, field.type);
        }
        logger.info(createTable.toString());
        session.execute(createTable);
    }

    protected static Column column(String name, DataType type) {
        Column column = new Column();
        column.name = name;
        column.type = type;
        return column;
    }

    protected static class Column {
        public String name;
        public DataType type;
    }

}


text:
<?php

namespace AppBundle\Repository;

/**
 * ThumbRubroRepository
 *
 * This class was generated by the Doctrine ORM. Add your own custom
 * repository methods below.
 */
class ThumbRubroRepository extends \Doctrine\ORM\EntityRepository
{
}


text:
<!--
Copyright 2017 Next Century Corporation

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

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

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

<dom-module id="list-styles">
  <template>
    <style>
      paginated-list {
        /* Max Height = Height of 50 Single Records */
        --paginated-list-max-height: 3000px;
      }

      .item-with-border:first-of-type {
        border-top-style: solid;
        border-top-width: 1px;
        border-top-color: var(--primary-background-color);
      }

      .item-with-border {
        border-bottom-style: solid;
        border-bottom-width: 1px;
        border-bottom-color: var(--primary-background-color);
      }
    </style>
  </template>
</dom-module>


text:
int pi_2_dht_read(int sensor, int pin, float* humidity, float* temperature);

#endif


text:
/*
 * Dummy function to avoid compiler error
 */
void _init() {

}
void _fini() {

}


text:
This is a simple API that allows us to handle interactions from any landing page we develop

### Prerequisites
* NodeJS
* Any code editor

### Installing
After cloning the repo navigate into project's folder
```
cd landing-api
```

Install all dependencies
```
npm install
```

Run it!
```
npm start
```


text:
package com.github.wuic.test.engine;

import com.github.wuic.engine.EngineRequest;
import com.github.wuic.engine.impl.embedded.AbstractCacheEngine;
import com.github.wuic.engine.impl.embedded.MemoryMapCacheEngine;
import com.github.wuic.nut.Nut;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import org.mockito.Mockito;

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

/**
 * <p>
 * {@link MemoryMapCacheEngineTest} test.
 * </p>
 *
 * @author Guillaume DROUET
 * @version 1.1
 * @since 0.4.3
 */
@RunWith(JUnit4.class)
public class MemoryMapCacheEngineTest {

    /**
     * Add an element then clears the cache.
     *
     * @throws Exception if test fails
     */
    @Test
    public void addThenClearTest() throws Exception {
        final EngineRequest.Key req = new EngineRequest.Key("wid", Arrays.asList(Mockito.mock(Nut.class)));
        final MemoryMapCacheEngine engine = new MemoryMapCacheEngine(true, -1, false);
        final Map<String, Nut> nuts = new HashMap<String, Nut>();
        nuts.put("", Mockito.mock(Nut.class));
        AbstractCacheEngine.CacheResult result = new AbstractCacheEngine.CacheResult(null, nuts);
        engine.putToCache(req, result);
        engine.clearCache();
        Assert.assertNull(engine.getFromCache(req));
    }

    /**
     * Add an element then removes the cache.
     *
     * @throws Exception if test fails
     */
    @Test
    public void addThenRemoveTest() throws Exception {
        final EngineRequest.Key req = new EngineRequest.Key("wid", Arrays.asList(Mockito.mock(Nut.class)));
        final MemoryMapCacheEngine engine = new MemoryMapCacheEngine(true, -1, false);
        final Map<String, Nut> nuts = new HashMap<String, Nut>();
        nuts.put("", Mockito.mock(Nut.class));
        AbstractCacheEngine.CacheResult result = new AbstractCacheEngine.CacheResult(null, nuts);
        engine.putToCache(req, result);
        engine.removeFromCache(req);
        Assert.assertNull(engine.getFromCache(req));
    }
}


text:
{{define "body"}}

Contact Us

Please fill out the form below

Tell us about your business. How can we help? Do you want a quote? Whatever your message, we'd love to hear from you.

            <form method="post" class="contact-form">
                <input type="text" name="name" placeholder="Please tell us your name :)" required />
                <input type="email" name="email" placeholder="What's your email address?" required/>
                <input type="tel" pattern="\d*" name="contactNumber" placeholder="What number is best to call you on?" required />
                <textarea name="content" rows="7">Ask us anything!</textarea>
                <select name="heardvia">
                    <option value="search-engine">Search Engine</option>
                    <option value="referral">Referral</option>
                    <option value="word-of-mouth">Word of Mouth</option>
                </select>
                <fieldset>
                    <legend>What would you like to know more about?</legend>
                    <input id="chkWebsite" name="require[website]" type="checkbox" value="website" />Mobile-friendly websites

                    <input id="chkMobile" name="require[mobileapps]" type="checkbox" value="mobile" />Mobile Apps

                    <input id="chkDevelopers" name="require[developers]" type="checkbox" value="mobile" />Contract Developers

                    <input id="chkBespoke" name="require[bespoke]" type="checkbox" value="website" />Bespoke Website Devlopment
                </fieldset>
                <input type="submit" value="Send Message" />
            </form>

Looking for our number? Call us on 01400 318326.

{{ end }}


text:
import { Component, OnInit } from '@angular/core';

import { Hero } from './hero';
import { HeroService } from './hero.service';

@Component({
  selector: 'my-dashboard',
  templateUrl: 'app/dashboard.component.html',
})
export class DashboardComponent implements OnInit {
	heroes: Hero[] = [];

    constructor(private heroService: HeroService) { }

	ngOnInit(): void{}

	gotoDetail(hero: Hero): void { /* not implemented yet */}
}


text:
package tabletmanager

import (
	"fmt"

	"vitess.io/vitess/go/vt/vterrors"

	"context"

	"vitess.io/vitess/go/tb"
	"vitess.io/vitess/go/vt/callinfo"
	"vitess.io/vitess/go/vt/log"
	"vitess.io/vitess/go/vt/topo/topoproto"
)

// This file contains the RPC method helpers for the tablet manager.

//
// Utility functions for RPC service
//

// lock is used at the beginning of an RPC call, to acquire the
// action semaphore. It returns ctx.Err() if the context expires.
func (tm *TabletManager) lock(ctx context.Context) error {
	if tm.actionSema.AcquireContext(ctx) {
		return nil
	}
	return ctx.Err()
}

// tryLock will return immediately, true on success and false on failure.
func (tm *TabletManager) tryLock() bool {
	return tm.actionSema.TryAcquire()
}

// unlock is the symmetrical action to lock.
func (tm *TabletManager) unlock() {
	tm.actionSema.Release()
}

// HandleRPCPanic is part of the RPCTM interface.
func (tm *TabletManager) HandleRPCPanic(ctx context.Context, name string, args, reply any, verbose bool, err *error) {
	// panic handling
	if x := recover(); x != nil {
		log.Errorf("TabletManager.%v(%v) on %v panic: %v\n%s", name, args, topoproto.TabletAliasString(tm.tabletAlias), x, tb.Stack(4))
		*err = fmt.Errorf("caught panic during %v: %v", name, x)
		return
	}

	// quick check for fast path
	if !verbose && *err == nil {
		return
	}

	// we gotta log something, get the source
	from := ""
	ci, ok := callinfo.FromContext(ctx)
	if ok {
		from = ci.Text()
	}

	if *err != nil {
		// error case
		log.Warningf("TabletManager.%v(%v)(on %v from %v) error: %v", name, args, topoproto.TabletAliasString(tm.tabletAlias), from, (*err).Error())
		*err = vterrors.Wrapf(*err, "TabletManager.%v on %v error: %v", name, topoproto.TabletAliasString(tm.tabletAlias), (*err).Error())
	} else {
		// success case
		log.Infof("TabletManager.%v(%v)(on %v from %v): %#v", name, args, topoproto.TabletAliasString(tm.tabletAlias), from, reply)
	}
}

// RegisterTabletManager is used to delay registration of RPC servers until we have all the objects.
type RegisterTabletManager func(*TabletManager)

// RegisterTabletManagers is a list of functions to call when the delayed registration is triggered.
var RegisterTabletManagers []RegisterTabletManager

// registerTabletManager will register all the instances.
func (tm *TabletManager) registerTabletManager() {
	for _, f := range RegisterTabletManagers {
		f(tm)
	}
}


text:
import { normalize, schema } from '../index'

const data = { owner: { id: 1, type: 'user' } };

const user = new schema.Entity('users');
const group = new schema.Entity('groups');
const unionSchema = new schema.Union(
  {
    user: user,
    group: group
  },
  'type'
);

const normalizedData = normalize(data, { owner: unionSchema });


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>database</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/simple-sidebar.css" rel="stylesheet">

                        S4DS

                    Infraestructura

                    Bases de datos

                    Estabilizacion

                    Contabilidad

                    Test

                    Generar War

                    JavaMelody Back

                    JavaMelody Backnew

                    Github

        </div

Bases de datos Dev

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Odio esse voluptate at sed laudantium, omnis minus voluptatem dolores aliquam soluta debitis eligendi ducimus hic temporibus voluptas adipisci saepe tempora ullam.

                        <button type="button" class="btn btn-success btn-xs">Encender</button>
                        <button type="button" class="btn btn-danger btn-xs">Apagar</button>

                           Ocultar


text:
Go-influx functions are written to make using influx easy.

For more information, see [the Godoc](https://godoc.org/github.com/DramaFever/go-influx).

## Go Version

The current version supports go1.8

## Examples

Using the `context` pattern, you want to inject an `influx.Client` into the context.

```
config := client.UDPConfig{Addr: "localhost:8089"}
myClient, _ := client.NewUDPClient(config)
ctx := influx.WithClient(context.Background(), myClient)

myTags := map[string]string {
	"host": "1",
	"zone": "us-east-1a",
}
ctx = influx.AddTags(ctx, myTags)

data := make(map[string]interface{})
data["data"] = 5
data["other"] = 6
myBatchPointsConfig := &client.BatchPointsConfig{Database: "test", Precision: "ms"}

err = influx.Write(ctx, "mypoint", nil, data, myBatchPointsConfig)
if err != nil {
	log.Printf("Error writing point err=%v\n", err)
}
```


text:
namespace libj {
namespace node {

TEST(GTestUrl, TestParse1) {
    String::CPtr urlStr = str("/foo/bar?abc=123&pqr=xyz#fr");
    JsObject::Ptr url = url::parse(urlStr);
    ASSERT_TRUE(url->getCPtr<String>(url::HREF)->equals(urlStr));
    ASSERT_TRUE(url->getCPtr<String>(url::PATHNAME)->equals(
        str("/foo/bar")));
    ASSERT_TRUE(url->getCPtr<String>(url::QUERY)->equals(
        str("abc=123&pqr=xyz")));
    ASSERT_TRUE(url->getCPtr<String>(url::HASH)->equals(
        str("#fr")));
    ASSERT_TRUE(url->getCPtr<String>(url::PATH)->equals(
        str("/foo/bar?abc=123&pqr=xyz")));
}

TEST(GTestUrl, TestParse2) {
    String::CPtr urlStr = str(
        "http://user1:passwd2@www.gtest.com:8888/foo/bar?abc=123&pqr=xyz#fr");
    JsObject::Ptr url = url::parse(urlStr);
    ASSERT_TRUE(url->getCPtr<String>(url::HREF)->equals(urlStr));
    ASSERT_TRUE(url->getCPtr<String>(url::PROTOCOL)->equals(
        str("http:")));
    ASSERT_TRUE(url->getCPtr<String>(url::HOST)->equals(
        str("www.gtest.com:8888")));
    ASSERT_TRUE(url->getCPtr<String>(url::AUTH)->equals(
        str("user1:passwd2")));
    ASSERT_TRUE(url->getCPtr<String>(url::HOSTNAME)->equals(
        str("www.gtest.com")));
    ASSERT_TRUE(url->getCPtr<String>(url::PORT)->equals(
        str("8888")));
    ASSERT_TRUE(url->getCPtr<String>(url::PATHNAME)->equals(
        str("/foo/bar")));
    ASSERT_TRUE(url->getCPtr<String>(url::QUERY)->equals(
        str("abc=123&pqr=xyz")));
    ASSERT_TRUE(url->getCPtr<String>(url::HASH)->equals(
        str("#fr")));
    ASSERT_TRUE(url->getCPtr<String>(url::PATH)->equals(
        str("/foo/bar?abc=123&pqr=xyz")));
}

}  // namespace node
}  // namespace libj


text:
package com.googlecode.transloader.test.fixture;

public class WithMethods extends NonCommonJavaObject implements NonCommonJavaTypeWithMethods {
	private String stringField;

	public String getStringField() {
		return stringField;
	}

	public void setStringField(String stringFieldValue) {
		stringField = stringFieldValue;
	}

	public String concatenate(NonCommonJavaType first, NonCommonJavaType second) {
		return first.toString() + second.toString();
	}
}


text:
using System;
using System.Security.Cryptography;
using System.Text;

namespace Kaliido.QuickBlox
{
    public static class GlobalHelper
    {

        public static readonly Encoding encoding = Encoding.ASCII;

        public static int getNonce()
        {
            return new Random().Next(1, 10000);
        }

        public static string getTimestamp()
        {
            long ticks = DateTime.UtcNow.Ticks - DateTime.Parse("01/01/1970 00:00:00").Ticks;
            ticks /= 10000000;

            return ticks.ToString();
        }

        public static byte[] getHash(string inputString, string key)
        {
            var keyByte = encoding.GetBytes(key);
            using (var hmacsha1 = new HMACSHA1(keyByte))
            {
                hmacsha1.ComputeHash(encoding.GetBytes(inputString));

                //Console.WriteLine("Result: {0}", ByteToString(hmacsha256.Hash));
                return hmacsha1.Hash;
            }

        }

    }
}


text:
package com.github.tomakehurst.wiremock;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.util.Arrays;

import com.github.tomakehurst.wiremock.client.WireMock;
import com.github.tomakehurst.wiremock.common.ProxySettings;
import com.github.tomakehurst.wiremock.core.WireMockConfiguration;
import com.github.tomakehurst.wiremock.testsupport.TestHttpHeader;
import com.github.tomakehurst.wiremock.testsupport.WireMockResponse;
import com.github.tomakehurst.wiremock.testsupport.WireMockTestClient;
import com.github.tomakehurst.wiremock.verification.LoggedRequest;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;

import org.apache.http.entity.ByteArrayEntity;
import org.hamcrest.Matchers;
import org.junit.After;
import org.junit.Test;

import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static com.github.tomakehurst.wiremock.testsupport.TestHttpHeader.withHeader;
import static com.google.common.collect.Iterables.getLast;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertThat;

public class ProxyAcceptanceTest {

    private String targetServiceBaseUrl;
    private String targetServiceBaseHttpsUrl;

    WireMockServer targetService;
	WireMock targetServiceAdmin;

    WireMockServer proxyingService;
    WireMock proxyingServiceAdmin;

    WireMockTestClient testClient;

	void init(WireMockConfiguration proxyingServiceOptions) {
		targetService = new WireMockServer(wireMockConfig().dynamicPort().dynamicHttpsPort());
		targetService.start();
		targetServiceAdmin = new WireMock("localhost", targetService.port());

        targetServiceBaseUrl = "http://localhost:" + targetService.port();
        targetServiceBaseHttpsUrl = "https://localhost:" + targetService.httpsPort();

        proxyingServiceOptions.dynamicPort();
        proxyingService = new WireMockServer(proxyingServiceOptions);
        proxyingService.start();
        proxyingServiceAdmin = new WireMock(proxyingService.port());
        testClient = new WireMockTestClient(proxyingService.port());

        WireMock.configureFor(targetService.port());
	}

    void initWithDefaultConfig() {
        init(wireMockConfig());
    }

	@After
	public void stop() {
		targetService.stop();
        proxyingService.stop();
	}

    @Test
	public void successfullyGetsResponseFromOtherServiceViaProxy() {
        initWithDefaultConfig();

		targetServiceAdmin.register(get(urlEqualTo("/proxied/resource?param=value"))
                .willReturn(aResponse()
                        .withStatus(200)
                        .withHeader("Content-Type", "text/plain")
                        .withBody("Proxied content")));

        proxyingServiceAdmin.register(any(urlEqualTo("/proxied/resource?param=value")).atPriority(10)
				.willReturn(aResponse()
				.proxiedFrom(targetServiceBaseUrl)));

		WireMockResponse response = testClient.get("/proxied/resource?param=value");

		assertThat(response.content(), is("Proxied content"));
		assertThat(response.firstHeader("Content-Type"), is("text/plain"));
	}

	@Test
	public void successfullyGetsResponseFromOtherServiceViaProxyWhenInjectingAddtionalRequestHeaders() {
        initWithDefaultConfig();

        proxyingServiceAdmin.register(any(urlEqualTo("/additional/headers")).atPriority(10)
				.willReturn(aResponse()
				.proxiedFrom(targetServiceBaseUrl)
                        .withAdditionalRequestHeader("a", "b")
                        .withAdditionalRequestHeader("c", "d")));

        testClient.get("/additional/headers");

		targetServiceAdmin.verifyThat(getRequestedFor(urlEqualTo("/additional/headers"))
                .withHeader("a", equalTo("b"))
                .withHeader("c", equalTo("d")));
	}

	@Test
	public void successfullyGetsResponseFromOtherServiceViaProxyInjectingHeadersOverridingSentHeaders() {
        initWithDefaultConfig();

		targetServiceAdmin.register(get(urlEqualTo("/proxied/resource?param=value"))
				.withHeader("a", equalTo("b"))
                .willReturn(aResponse()
                        .withStatus(200)
                        .withBody("Proxied content")));

        proxyingServiceAdmin.register(any(urlEqualTo("/proxied/resource?param=value")).atPriority(10)
				.willReturn(aResponse()
				.proxiedFrom(targetServiceBaseUrl)
				.withAdditionalRequestHeader("a", "b")));

		WireMockResponse response = testClient.get("/proxied/resource?param=value",
				TestHttpHeader.withHeader("a", "doh"));

		assertThat(response.content(), is("Proxied content"));
	}

	@Test
	public void successfullyPostsResponseToOtherServiceViaProxy() {
        initWithDefaultConfig();

        targetServiceAdmin.register(post(urlEqualTo("/proxied/resource"))
                .willReturn(aResponse()
                        .withStatus(204)));

        proxyingServiceAdmin.register(any(urlEqualTo("/proxied/resource")).atPriority(10)
				.willReturn(aResponse()
				.proxiedFrom(targetServiceBaseUrl)));

		WireMockResponse response = testClient.postWithBody("/proxied/resource", "Post content", "text/plain", "utf-8");

		assertThat(response.statusCode(), is(204));
		targetServiceAdmin.verifyThat(postRequestedFor(urlEqualTo("/proxied/resource")).withRequestBody(matching("Post content")));
	}

	@Test
	public void successfullyGetsResponseFromOtherServiceViaProxyWithEscapeCharsInUrl() {
        initWithDefaultConfig();

        targetServiceAdmin.register(get(urlEqualTo("/%26%26The%20Lord%20of%20the%20Rings%26%26"))
                .willReturn(aResponse()
                        .withStatus(200)));

        proxyingServiceAdmin.register(any(urlEqualTo("/%26%26The%20Lord%20of%20the%20Rings%26%26")).atPriority(10)
                .willReturn(aResponse()
                        .proxiedFrom(targetServiceBaseUrl)));

		WireMockResponse response = testClient.get("/%26%26The%20Lord%20of%20the%20Rings%26%26");

		assertThat(response.statusCode(), is(200));
	}

	@Test
	public void successfullyGetsResponseBinaryResponses() throws IOException {
        initWithDefaultConfig();

        final byte[] bytes = new byte[] {0x10, 0x49, 0x6e, (byte)0xb7, 0x46, (byte)0xe6, 0x52, (byte)0x95, (byte)0x95, 0x42};
		HttpServer server = HttpServer.create(new InetSocketAddress(0), 0);
		server.createContext("/binary", new HttpHandler() {
			@Override
			public void handle(HttpExchange exchange) throws IOException {
				InputStream request = exchange.getRequestBody();

				byte[] buffy = new byte[10];
				request.read(buffy);

				if (Arrays.equals(buffy, bytes)) {
					exchange.sendResponseHeaders(200, bytes.length);

					OutputStream out = exchange.getResponseBody();
					out.write(bytes);
					out.close();
				} else {
					exchange.sendResponseHeaders(500, 0);
					exchange.close();
				}
			}
		});
		server.start();

        proxyingServiceAdmin.register(post(urlEqualTo("/binary")).willReturn(aResponse().proxiedFrom("http://localhost:" + server.getAddress().getPort()).withBody(bytes)));

        WireMockResponse post = testClient.post("/binary", new ByteArrayEntity(bytes));
		assertThat(post.statusCode(), is(200));
		assertThat(post.binaryContent(), Matchers.equalTo(bytes));
	}

    @Test
    public void sendsContentLengthHeaderWhenPostingIfPresentInOriginalRequest() {
        initWithDefaultConfig();

        targetServiceAdmin.register(post(urlEqualTo("/with/length")).willReturn(aResponse().withStatus(201)));
        proxyingServiceAdmin.register(post(urlEqualTo("/with/length")).willReturn(aResponse().proxiedFrom(targetServiceBaseUrl)));

        testClient.postWithBody("/with/length", "TEST", "application/x-www-form-urlencoded", "utf-8");

        targetServiceAdmin.verifyThat(postRequestedFor(urlEqualTo("/with/length")).withHeader("Content-Length", equalTo("4")));
    }

    @Test
    public void sendsTransferEncodingChunkedWhenPostingIfPresentInOriginalRequest() {
        initWithDefaultConfig();

        targetServiceAdmin.register(post(urlEqualTo("/chunked")).willReturn(aResponse().withStatus(201)));
        proxyingServiceAdmin.register(post(urlEqualTo("/chunked")).willReturn(aResponse().proxiedFrom(targetServiceBaseUrl)));

        testClient.postWithChunkedBody("/chunked", "TEST".getBytes());

        targetServiceAdmin.verifyThat(postRequestedFor(urlEqualTo("/chunked"))
                .withHeader("Transfer-Encoding", equalTo("chunked")));
    }

    @Test
    public void preservesHostHeaderWhenSpecified() {
        init(wireMockConfig().preserveHostHeader(true));

        targetServiceAdmin.register(get(urlEqualTo("/preserve-host-header")).willReturn(aResponse().withStatus(200)));
        proxyingServiceAdmin.register(get(urlEqualTo("/preserve-host-header")).willReturn(aResponse().proxiedFrom(targetServiceBaseUrl)));

        testClient.get("/preserve-host-header", withHeader("Host", "my.host"));

        proxyingServiceAdmin.verifyThat(getRequestedFor(urlEqualTo("/preserve-host-header")).withHeader("Host", equalTo("my.host")));
        targetServiceAdmin.verifyThat(getRequestedFor(urlEqualTo("/preserve-host-header")).withHeader("Host", equalTo("my.host")));
    }

    @Test
    public void usesProxyUrlBasedHostHeaderWhenPreserveHostHeaderNotSpecified() throws Exception {
        init(wireMockConfig().preserveHostHeader(false));

        targetServiceAdmin.register(get(urlEqualTo("/host-header")).willReturn(aResponse().withStatus(200)));
        proxyingServiceAdmin.register(get(urlEqualTo("/host-header")).willReturn(aResponse().proxiedFrom(targetServiceBaseUrl)));

        testClient.get("/host-header", withHeader("Host", "my.host"));

        proxyingServiceAdmin.verifyThat(getRequestedFor(urlEqualTo("/host-header")).withHeader("Host", equalTo("my.host")));
        targetServiceAdmin.verifyThat(getRequestedFor(urlEqualTo("/host-header")).withHeader("Host", equalTo("localhost:"+targetService.port())));
    }

    @Test
    public void proxiesPatchRequestsWithBody() {
        initWithDefaultConfig();

        targetServiceAdmin.register(patch(urlEqualTo("/patch")).willReturn(aResponse().withStatus(200)));
        proxyingServiceAdmin.register(patch(urlEqualTo("/patch")).willReturn(aResponse().proxiedFrom(targetServiceBaseUrl)));

        testClient.patchWithBody("/patch", "Patch body", "text/plain", "utf-8");

        targetServiceAdmin.verifyThat(patchRequestedFor(urlEqualTo("/patch")).withRequestBody(equalTo("Patch body")));
    }

    @Test
    public void addsSpecifiedHeadersToResponse() {
        initWithDefaultConfig();

        targetServiceAdmin.register(get(urlEqualTo("/extra/headers"))
                .willReturn(aResponse()
                        .withStatus(200)
                        .withHeader("Content-Type", "text/plain")
                        .withBody("Proxied content")));

        proxyingServiceAdmin.register(any(urlEqualTo("/extra/headers"))
                .willReturn(aResponse()
                        .withHeader("X-Additional-Header", "Yep")
                        .proxiedFrom(targetServiceBaseUrl)));

        WireMockResponse response = testClient.get("/extra/headers");

        assertThat(response.firstHeader("Content-Type"), is("text/plain"));
        assertThat(response.firstHeader("X-Additional-Header"), is("Yep"));
    }

    @Test
    public void doesNotDuplicateCookieHeaders() {
        initWithDefaultConfig();

        targetServiceAdmin.register(get(urlEqualTo("/duplicate/cookies"))
                .willReturn(aResponse()
                        .withStatus(200)
                        .withHeader("Set-Cookie", "session=1234")));
        proxyingServiceAdmin.register(get(urlEqualTo("/duplicate/cookies")).willReturn(aResponse().proxiedFrom(targetServiceBaseUrl)));

        testClient.get("/duplicate/cookies");
        testClient.get("/duplicate/cookies", withHeader("Cookie", "session=1234"));

        LoggedRequest lastRequest = getLast(targetServiceAdmin.find(getRequestedFor(urlEqualTo("/duplicate/cookies"))));
        assertThat(lastRequest.getHeaders().getHeader("Cookie").values().size(), is(1));
    }

    //TODO: This is passing even when it probably shouldn't - investigate
    @Test
    public void doesNotDuplicateConnectionHeader() {
        initWithDefaultConfig();
        register200StubOnProxyAndTarget("/duplicate/connection-header");

        testClient.get("/duplicate/connection-header");
        LoggedRequest lastRequest = getLast(targetServiceAdmin.find(getRequestedFor(urlEqualTo("/duplicate/connection-header"))));
        assertThat(lastRequest.getHeaders().getHeader("Connection").values().size(), is(1));
    }

    @Test
    public void acceptsSelfSignedSslCertFromProxyTarget() {
        initWithDefaultConfig();
        register200StubOnProxyAndTarget("/ssl-cert");

        assertThat(testClient.get("/ssl-cert").statusCode(), is(200));
    }

    @Test
    public void canProxyViaAForwardProxy() throws Exception {
        WireMockServer forwardProxy = new WireMockServer(wireMockConfig().dynamicPort().enableBrowserProxying(true));
        forwardProxy.start();
        init(wireMockConfig().proxyVia(new ProxySettings("localhost", forwardProxy.port())));

        register200StubOnProxyAndTarget("/proxy-via");

        assertThat(testClient.get("/proxy-via").statusCode(), is(200));
    }

    @Test
    public void doesNotAddAcceptEncodingHeaderToProxyRequest() {
        initWithDefaultConfig();
        register200StubOnProxyAndTarget("/no-accept-encoding-header");

        testClient.get("/no-accept-encoding-header");
        LoggedRequest lastRequest = getLast(targetServiceAdmin.find(getRequestedFor(urlEqualTo("/no-accept-encoding-header"))));
        assertFalse("Accept-Encoding header should not be present",
                lastRequest.getHeaders().getHeader("Accept-Encoding").isPresent());
    }

    private void register200StubOnProxyAndTarget(String url) {
        targetServiceAdmin.register(get(urlEqualTo(url)).willReturn(aResponse().withStatus(200)));
        proxyingServiceAdmin.register(get(urlEqualTo(url)).willReturn(aResponse().proxiedFrom(targetServiceBaseUrl)));
    }
}


text:
package de.renebergelt.quiterables.iterators;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;

import de.renebergelt.quiterables.Equivalence;
import de.renebergelt.quiterables.Predicate;
import de.renebergelt.quiterables.Queriable;
import de.renebergelt.quiterables.Query;

/**
 * Iterable which returns the elements of a source iterable
 * but filters duplicates either by using the equals() method of
 * the objects or a custom equality comparer
 * @param <T> Type of the elements in this Iterable
 * @author René Bergelt
 */
public class LazyDistinctIterable<T> implements Iterable<T> {

	Iterable<T> wrapped;
	Equivalence<T> equalityComparer;

	/**
	 * Create a new lazy distinct iterable which wraps the given iterable
	 * @param _wrapped The wrapped iterable
	 */
	public LazyDistinctIterable(Iterable<T> _wrapped) {
		wrapped = _wrapped;
	}

	/**
	 * Create a new lazy distinct iterable which wraps the given iterable
	 * using teh given equality comparer
	 * @param _wrapped The wrapped iterable
	 * @param _equalityComparer Comparer to decide if two elements are equal
	 */
	public LazyDistinctIterable(Iterable<T> _wrapped, Equivalence<T> _equalityComparer) {
		wrapped = _wrapped;
		equalityComparer = _equalityComparer;
	}

	@Override
	public Iterator<T> iterator() {
		if (equalityComparer == null)
			return new LazyDistinctIterator<T>(wrapped.iterator());
		else
			return new LazyDistinctWithEquivalenceIterator<T>(wrapped.iterator(), equalityComparer);
	}

}

class LazyDistinctIterator<T> extends LazyIterator<T> {

	Iterator<T> wrapped;

	// keep track of already used items
	HashSet<T> usedItems = new HashSet<T>();

	public LazyDistinctIterator(Iterator<T> _wrapped) {
		wrapped = _wrapped;
	}

	@Override
	protected T findNextElement() {

		while (wrapped.hasNext()) {
			T element = wrapped.next();
			if (!usedItems.contains(element)) {
				usedItems.add(element);
				return element;
			}
		}

		// iteration ended
		usedItems.clear();
		return null;
	}
}

class LazyDistinctWithEquivalenceIterator<T> extends LazyIterator<T> {

	Iterator<T> wrapped;
	Equivalence<T> equalityComparer;

	// keep track of already used items
	List<T> usedItems = new ArrayList<T>();
	Queriable<T> qList = Query.list(usedItems);

	public LazyDistinctWithEquivalenceIterator(Iterator<T> _wrapped, Equivalence<T> _equalityComparer) {
		wrapped = _wrapped;
		equalityComparer = _equalityComparer;
	}

	@Override
	protected T findNextElement() {

		while (wrapped.hasNext()) {
			final T element = wrapped.next();

			if (!qList.exists(new Predicate<T>() {public boolean evaluate(T item) {return equalityComparer.areEqual(item, element);}})) {
				usedItems.add(element);
				return element;
			}
		}

		// iteration ended
		usedItems.clear();
		return null;
	}

}