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

<server xmlns="urn:jboss:domain:3.0">

    <extensions>
        <extension module="org.jboss.as.clustering.infinispan"/>
        <extension module="org.jboss.as.connector"/>
        <extension module="org.jboss.as.deployment-scanner"/>
        <extension module="org.jboss.as.ee"/>
        <extension module="org.jboss.as.ejb3"/>
        <extension module="org.jboss.as.jaxrs"/>
        <extension module="org.jboss.as.jdr"/>
        <extension module="org.jboss.as.jmx"/>
        <extension module="org.jboss.as.jpa"/>
        <extension module="org.jboss.as.jsf"/>
        <extension module="org.jboss.as.logging"/>
        <extension module="org.jboss.as.mail"/>
        <extension module="org.jboss.as.naming"/>
        <extension module="org.jboss.as.pojo"/>
        <extension module="org.jboss.as.remoting"/>
        <extension module="org.jboss.as.sar"/>
        <extension module="org.jboss.as.security"/>
        <extension module="org.jboss.teiid"/>
        <extension module="org.jboss.as.transactions"/>
        <extension module="org.jboss.as.webservices"/>
        <extension module="org.jboss.as.weld"/>
        <extension module="org.wildfly.extension.batch"/>
        <extension module="org.wildfly.extension.bean-validation"/>
        <extension module="org.wildfly.extension.io"/>
        <extension module="org.wildfly.extension.request-controller"/>
        <extension module="org.wildfly.extension.security.manager"/>
        <extension module="org.wildfly.extension.undertow"/>
    </extensions>

    <management>
        <security-realms>
            <security-realm name="ManagementRealm">
                <authentication>
                    <local default-user="$local" skip-group-loading="true"/>
                    <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir"/>
                </authentication>
                <authorization map-groups-to-roles="false">
                    <properties path="mgmt-groups.properties" relative-to="jboss.server.config.dir"/>
                </authorization>
            </security-realm>
            <security-realm name="ApplicationRealm">
                <authentication>
                    <local default-user="$local" allowed-users="*" skip-group-loading="true"/>
                    <properties path="application-users.properties" relative-to="jboss.server.config.dir"/>
                </authentication>
                <authorization>
                    <properties path="application-roles.properties" relative-to="jboss.server.config.dir"/>
                </authorization>
            </security-realm>
        </security-realms>
        <audit-log>
            <formatters>
                <json-formatter name="json-formatter"/>
            </formatters>
            <handlers>
                <file-handler name="file" formatter="json-formatter" path="audit-log.log" relative-to="jboss.server.data.dir"/>
            </handlers>
            <logger log-boot="true" log-read-only="false" enabled="false">
                <handlers>
                    <handler name="file"/>
                </handlers>
            </logger>
        </audit-log>
        <management-interfaces>
            <http-interface security-realm="ManagementRealm" http-upgrade-enabled="true">
                <socket-binding http="management-http"/>
            </http-interface>
        </management-interfaces>
        <access-control provider="simple">
            <role-mapping>
                <role name="SuperUser">
                    <include>
                        <user name="$local"/>
                    </include>
                </role>
                <role name="Administrator">
                    <include>
                        <user name="user"/>
                    </include>
                </role>
            </role-mapping>
        </access-control>
    </management>

    <profile>
        <subsystem xmlns="urn:jboss:domain:logging:3.0">
            <console-handler name="CONSOLE">
                <level name="INFO"/>
                <formatter>
                    <named-formatter name="COLOR-PATTERN"/>
                </formatter>
            </console-handler>
            <periodic-rotating-file-handler name="FILE" autoflush="true">
                <formatter>
                    <named-formatter name="PATTERN"/>
                </formatter>
                <file relative-to="jboss.server.log.dir" path="server.log"/>
                <suffix value=".yyyy-MM-dd"/>
                <append value="true"/>
            </periodic-rotating-file-handler>
            <logger category="com.arjuna">
                <level name="WARN"/>
            </logger>
            <logger category="org.apache.tomcat.util.modeler">
                <level name="WARN"/>
            </logger>
            <logger category="org.jboss.as.config">
                <level name="DEBUG"/>
            </logger>
            <logger category="sun.rmi">
                <level name="WARN"/>
            </logger>
            <logger category="jacorb">
                <level name="WARN"/>
            </logger>
            <logger category="jacorb.config">
                <level name="ERROR"/>
            </logger>
            <logger category="org.teiid">
                <level name="INFO"/>
            </logger>
            <logger category="org.teiid.COMMAND_LOG">
                <level name="WARN"/>
            </logger>
            <root-logger>
                <level name="INFO"/>
                <handlers>
                    <handler name="CONSOLE"/>
                    <handler name="FILE"/>
                </handlers>
            </root-logger>
            <formatter name="PATTERN">
                <pattern-formatter pattern="%d{yyyy-MM-dd HH:mm:ss,SSS} %-5p [%c] (%t) %X{teiid-session} %s%e%n"/>
            </formatter>
            <formatter name="COLOR-PATTERN">
                <pattern-formatter pattern="%K{level}%d{HH:mm:ss,SSS} %-5p [%c] (%t) %X{teiid-session} %s%e%n"/>
            </formatter>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:batch:1.0">
            <job-repository>
                <in-memory/>
            </job-repository>
            <thread-pool>
                <max-threads count="10"/>
                <keepalive-time time="30" unit="seconds"/>
            </thread-pool>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:bean-validation:1.0"/>
        <subsystem xmlns="urn:jboss:domain:datasources:3.0">
            <datasources>
                <datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" enabled="true" use-java-context="true">
                    <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url>
                    <driver>h2</driver>
                    <security>
                        <user-name>sa</user-name>
                        <password>sa</password>
                    </security>
                </datasource>
                <datasource jndi-name="java:/BenchmarkDS" pool-name="BenchmarkDS" enabled="true" use-java-context="true">
                    <connection-url>jdbc:mysql://base_mysql:3306/benchmark</connection-url>
                    <driver>mysql</driver>
                    <security>
                        <user-name>root</user-name>
                        <password>password</password>
                    </security>
                </datasource>
                <datasource jndi-name="java:/secondSource" pool-name="javaBenchmark" enabled="true" use-java-context="true">
                    <connection-url>jdbc:mysql://mysql_vertical_mysql2:3306/benchmark</connection-url>
                    <driver>mysql</driver>
                    <security>
                        <user-name>root</user-name>
                        <password>password</password>
                    </security>
                </datasource>
                <drivers>
                    <driver name="h2" module="com.h2database.h2">
                        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
                    </driver>
                    <driver name="mysql" module="com.mysql">
                        <driver-class>com.mysql.jdbc.Driver</driver-class>
                    </driver>
                    <driver name="teiid-local" module="org.jboss.teiid">
                        <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>
                        <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
                    </driver>
                    <driver name="teiid" module="org.jboss.teiid.client">
                        <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>
                        <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
                    </driver>
                </drivers>
            </datasources>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:deployment-scanner:2.0">
            <deployment-scanner path="deployments" relative-to="jboss.server.base.dir" scan-interval="5000" runtime-failure-causes-rollback="${jboss.deployment.scanner.rollback.on.failure:false}"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:ee:3.0">
            <spec-descriptor-property-replacement>false</spec-descriptor-property-replacement>
            <concurrent>
                <context-services>
                    <context-service name="default" jndi-name="java:jboss/ee/concurrency/context/default" use-transaction-setup-provider="true"/>
                </context-services>
                <managed-thread-factories>
                    <managed-thread-factory name="default" jndi-name="java:jboss/ee/concurrency/factory/default" context-service="default"/>
                </managed-thread-factories>
                <managed-executor-services>
                    <managed-executor-service name="default" jndi-name="java:jboss/ee/concurrency/executor/default" context-service="default" hung-task-threshold="60000" core-threads="5" max-threads="25" keepalive-time="5000"/>
                </managed-executor-services>
                <managed-scheduled-executor-services>
                    <managed-scheduled-executor-service name="default" jndi-name="java:jboss/ee/concurrency/scheduler/default" context-service="default" hung-task-threshold="60000" core-threads="2" keepalive-time="3000"/>
                </managed-scheduled-executor-services>
            </concurrent>
            <default-bindings context-service="java:jboss/ee/concurrency/context/default" datasource="java:jboss/datasources/ExampleDS" managed-executor-service="java:jboss/ee/concurrency/executor/default" managed-scheduled-executor-service="java:jboss/ee/concurrency/scheduler/default" managed-thread-factory="java:jboss/ee/concurrency/factory/default"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:ejb3:3.0">
            <session-bean>
                <stateful default-access-timeout="5000" cache-ref="simple" passivation-disabled-cache-ref="simple"/>
                <singleton default-access-timeout="5000"/>
            </session-bean>
            <pools>
                <bean-instance-pools>
                    <strict-max-pool name="slsb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
                    <strict-max-pool name="mdb-strict-max-pool" max-pool-size="20" instance-acquisition-timeout="5" instance-acquisition-timeout-unit="MINUTES"/>
                </bean-instance-pools>
            </pools>
            <caches>
                <cache name="simple"/>
                <cache name="distributable" passivation-store-ref="infinispan" aliases="passivating clustered"/>
            </caches>
            <passivation-stores>
                <passivation-store name="infinispan" cache-container="ejb" max-size="10000"/>
            </passivation-stores>
            <async thread-pool-name="default"/>
            <timer-service thread-pool-name="default" default-data-store="default-file-store">
                <data-stores>
                    <file-data-store name="default-file-store" path="timer-service-data" relative-to="jboss.server.data.dir"/>
                </data-stores>
            </timer-service>
            <remote connector-ref="http-remoting-connector" thread-pool-name="default"/>
            <thread-pools>
                <thread-pool name="default">
                    <max-threads count="10"/>
                    <keepalive-time time="100" unit="milliseconds"/>
                </thread-pool>
            </thread-pools>
            <default-security-domain value="other"/>
            <default-missing-method-permissions-deny-access value="true"/>
            <log-system-exceptions value="true"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:io:1.1">
            <worker name="default"/>
            <buffer-pool name="default"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:infinispan:3.0">
            <cache-container name="server" default-cache="default" module="org.wildfly.clustering.server">
                <local-cache name="default">
                    <transaction mode="BATCH"/>
                </local-cache>
            </cache-container>
            <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
                <local-cache name="passivation">
                    <locking isolation="REPEATABLE_READ"/>
                    <transaction mode="BATCH"/>
                    <file-store passivation="true" purge="false"/>
                </local-cache>
                <local-cache name="persistent">
                    <locking isolation="REPEATABLE_READ"/>
                    <transaction mode="BATCH"/>
                    <file-store passivation="false" purge="false"/>
                </local-cache>
            </cache-container>
            <cache-container name="ejb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan" aliases="sfsb">
                <local-cache name="passivation">
                    <locking isolation="REPEATABLE_READ"/>
                    <transaction mode="BATCH"/>
                    <file-store passivation="true" purge="false"/>
                </local-cache>
                <local-cache name="persistent">
                    <locking isolation="REPEATABLE_READ"/>
                    <transaction mode="BATCH"/>
                    <file-store passivation="false" purge="false"/>
                </local-cache>
            </cache-container>
            <cache-container name="hibernate" default-cache="local-query" module="org.hibernate.infinispan">
                <local-cache name="local-query">
                    <eviction strategy="LRU" max-entries="10000"/>
                    <expiration max-idle="100000"/>
                </local-cache>
                <local-cache name="entity">
                    <transaction mode="NON_XA"/>
                    <eviction strategy="LRU" max-entries="10000"/>
                    <expiration max-idle="100000"/>
                </local-cache>
                <local-cache name="timestamps"/>
            </cache-container>
            <cache-container name="teiid" default-cache="resultset">
                <local-cache name="resultset">
                    <transaction mode="NON_XA"/>
                    <eviction strategy="LIRS" max-entries="1024"/>
                    <expiration lifespan="7200000"/>
                </local-cache>
                <local-cache name="resultset-repl">
                    <transaction mode="NON_XA"/>
                    <eviction strategy="LIRS" max-entries="1024"/>
                    <expiration lifespan="7200000"/>
                </local-cache>
                <local-cache name="preparedplan">
                    <eviction strategy="LIRS" max-entries="512"/>
                    <expiration lifespan="28800"/>
                </local-cache>
            </cache-container>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/>
        <subsystem xmlns="urn:jboss:domain:jca:3.0">
            <archive-validation enabled="true" fail-on-error="true" fail-on-warn="false"/>
            <bean-validation enabled="true"/>
            <default-workmanager>
                <short-running-threads>
                    <core-threads count="50"/>
                    <queue-length count="50"/>
                    <max-threads count="50"/>
                    <keepalive-time time="10" unit="seconds"/>
                </short-running-threads>
                <long-running-threads>
                    <core-threads count="50"/>
                    <queue-length count="50"/>
                    <max-threads count="50"/>
                    <keepalive-time time="10" unit="seconds"/>
                </long-running-threads>
            </default-workmanager>
            <cached-connection-manager/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:jdr:1.0"/>
        <subsystem xmlns="urn:jboss:domain:jmx:1.3">
            <expose-resolved-model/>
            <expose-expression-model/>
            <remoting-connector/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:jpa:1.1">
            <jpa default-datasource="" default-extended-persistence-inheritance="DEEP"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:jsf:1.0"/>
        <subsystem xmlns="urn:jboss:domain:mail:2.0">
            <mail-session name="default" jndi-name="java:jboss/mail/Default">
                <smtp-server outbound-socket-binding-ref="mail-smtp"/>
            </mail-session>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:naming:2.0">
            <remote-naming/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:pojo:1.0"/>
        <subsystem xmlns="urn:jboss:domain:remoting:3.0">
            <endpoint worker="default"/>
            <http-connector name="http-remoting-connector" connector-ref="default" security-realm="ApplicationRealm"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:resource-adapters:3.0">
            <resource-adapters>
                <resource-adapter id="file">
                    <module slot="main" id="org.jboss.teiid.resource-adapter.file"/>
                </resource-adapter>
                <resource-adapter id="google">
                    <module slot="main" id="org.jboss.teiid.resource-adapter.google"/>
                </resource-adapter>
                <resource-adapter id="ldap">
                    <module slot="main" id="org.jboss.teiid.resource-adapter.ldap"/>
                </resource-adapter>
                <resource-adapter id="salesforce">
                    <module slot="main" id="org.jboss.teiid.resource-adapter.salesforce"/>
                </resource-adapter>
                <resource-adapter id="salesforce-34">
                    <module slot="main" id="org.jboss.teiid.resource-adapter.salesforce-34"/>
                </resource-adapter>
                <resource-adapter id="webservice">
                    <module slot="main" id="org.jboss.teiid.resource-adapter.webservice"/>
                </resource-adapter>
                <resource-adapter id="mongodb">
                    <module slot="main" id="org.jboss.teiid.resource-adapter.mongodb"/>
                    <transaction-support>NoTransaction</transaction-support>
                    <connection-definitions>
                        <connection-definition class-name="org.teiid.resource.adapter.mongodb.MongoDBManagedConnectionFactory" jndi-name="java:/mongoDS" enabled="true" use-java-context="true" pool-name="teiid-mongodb-ds">
                            <config-property name="Database">
                                benchmark
                            </config-property>
                            <config-property name="RemoteServerList">
                                mongodb_hybrid_vertical_mongodb:27017
                            </config-property>
                        </connection-definition>
                    </connection-definitions>
                </resource-adapter>
                <resource-adapter id="cassandra">
                    <module slot="main" id="org.jboss.teiid.resource-adapter.cassandra"/>
                </resource-adapter>
                <resource-adapter id="simpledb">
                    <module slot="main" id="org.jboss.teiid.resource-adapter.simpledb"/>
                </resource-adapter>
                <resource-adapter id="accumulo">
                    <module slot="main" id="org.jboss.teiid.resource-adapter.accumulo"/>
                </resource-adapter>
                <resource-adapter id="solr">
                    <module slot="main" id="org.jboss.teiid.resource-adapter.solr"/>
                </resource-adapter>
            </resource-adapters>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:request-controller:1.0"/>
        <subsystem xmlns="urn:jboss:domain:sar:1.0"/>
        <subsystem xmlns="urn:jboss:domain:security-manager:1.0">
            <deployment-permissions>
                <maximum-set>
                    <permission class="java.security.AllPermission"/>
                </maximum-set>
            </deployment-permissions>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:security:1.2">
            <security-domains>
                <security-domain name="other" cache-type="default">
                    <authentication>
                        <login-module code="Remoting" flag="optional">
                            <module-option name="password-stacking" value="useFirstPass"/>
                        </login-module>
                        <login-module code="RealmDirect" flag="required">
                            <module-option name="password-stacking" value="useFirstPass"/>
                        </login-module>
                    </authentication>
                </security-domain>
                <security-domain name="jboss-web-policy" cache-type="default">
                    <authorization>
                        <policy-module code="Delegating" flag="required"/>
                    </authorization>
                </security-domain>
                <security-domain name="jboss-ejb-policy" cache-type="default">
                    <authorization>
                        <policy-module code="Delegating" flag="required"/>
                    </authorization>
                </security-domain>
                <security-domain name="teiid-security" cache-type="default">
                    <authentication>
                        <login-module code="RealmDirect" flag="required">
                            <module-option name="password-stacking" value="useFirstPass"/>
                        </login-module>
                    </authentication>
                </security-domain>
            </security-domains>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:teiid:1.1">
            <policy-decider-module>org.jboss.teiid</policy-decider-module>
            <resultset-cache infinispan-container="teiid"/>
            <preparedplan-cache infinispan-container="teiid"/>
            <transport name="embedded"/>
            <transport name="odata">
                <authentication security-domain="teiid-security"/>
            </transport>
            <transport name="jdbc" socket-binding="teiid-jdbc" protocol="teiid">
                <authentication security-domain="teiid-security"/>
            </transport>
            <transport name="odbc" socket-binding="teiid-odbc" protocol="pg">
                <authentication security-domain="teiid-security"/>
                <ssl mode="disabled"/>
            </transport>
            <translator name="jdbc-simple" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="jdbc-ansi" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="access" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="db2" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="derby" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="h2" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="hsql" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="hana" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="informix" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="metamatrix" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="mysql" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="mysql5" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="oracle" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="postgresql" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="greenplum" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="sqlserver" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="sybase" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="sybaseiq" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="teiid" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="teradata" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="modeshape" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="ingres" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="ingres93" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="intersystems-cache" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="netezza" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="file" module="org.jboss.teiid.translator.file"/>
            <translator name="google-spreadsheet" module="org.jboss.teiid.translator.google"/>
            <translator name="ldap" module="org.jboss.teiid.translator.ldap"/>
            <translator name="loopback" module="org.jboss.teiid.translator.loopback"/>
            <translator name="olap" module="org.jboss.teiid.translator.olap"/>
            <translator name="ws" module="org.jboss.teiid.translator.ws"/>
            <translator name="salesforce" module="org.jboss.teiid.translator.salesforce"/>
            <translator name="salesforce-34" module="org.jboss.teiid.translator.salesforce" slot="34"/>
            <translator name="hive" module="org.jboss.teiid.translator.hive"/>
            <translator name="jpa2" module="org.jboss.teiid.translator.jpa"/>
            <translator name="map-cache" module="org.jboss.teiid.translator.object"/>
            <translator name="odata" module="org.jboss.teiid.translator.odata"/>
            <translator name="sap-gateway" module="org.jboss.teiid.translator.odata"/>
            <translator name="sap-nw-gateway" module="org.jboss.teiid.translator.odata"/>
            <translator name="mongodb" module="org.jboss.teiid.translator.mongodb"/>
            <translator name="cassandra" module="org.jboss.teiid.translator.cassandra"/>
            <translator name="simpledb" module="org.jboss.teiid.translator.simpledb"/>
            <translator name="accumulo" module="org.jboss.teiid.translator.accumulo"/>
            <translator name="solr" module="org.jboss.teiid.translator.solr"/>
            <translator name="excel" module="org.jboss.teiid.translator.excel"/>
            <translator name="impala" module="org.jboss.teiid.translator.hive"/>
            <translator name="prestodb" module="org.jboss.teiid.translator.prestodb"/>
            <translator name="hbase" module="org.jboss.teiid.translator.hbase"/>
            <translator name="ucanaccess" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="vertica" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="actian-vector" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="osisoft-pi" module="org.jboss.teiid.translator.jdbc"/>
            <translator name="odata4" module="org.jboss.teiid.translator.odata4"/>
            <translator name="redshift" module="org.jboss.teiid.translator.jdbc"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:transactions:3.0">
            <core-environment>
                <process-id>
                    <uuid/>
                </process-id>
            </core-environment>
            <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:undertow:2.0">
            <buffer-cache name="default"/>
            <server name="default-server">
                <http-listener name="default" socket-binding="http" redirect-socket="https"/>
                <host name="default-host" alias="localhost">
                    <location name="/" handler="welcome-content"/>
                    <filter-ref name="server-header"/>
                    <filter-ref name="x-powered-by-header"/>
                </host>
            </server>
            <servlet-container name="default">
                <jsp-config/>
                <websockets/>
            </servlet-container>
            <handlers>
                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
            </handlers>
            <filters>
                <response-header name="server-header" header-name="Server" header-value="WildFly/9"/>
                <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
            </filters>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:webservices:2.0">
            <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
            <endpoint-config name="Standard-Endpoint-Config"/>
            <endpoint-config name="Recording-Endpoint-Config">
                <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
                    <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
                </pre-handler-chain>
            </endpoint-config>
            <client-config name="Standard-Client-Config"/>
        </subsystem>
        <subsystem xmlns="urn:jboss:domain:weld:2.0"/>
    </profile>

    <interfaces>
        <interface name="management">
            <inet-address value="${jboss.bind.address.management:127.0.0.1}"/>
        </interface>
        <interface name="public">
            <inet-address value="${jboss.bind.address:127.0.0.1}"/>
        </interface>
        <interface name="unsecure">
            <inet-address value="${jboss.bind.address.unsecure:127.0.0.1}"/>
        </interface>
    </interfaces>

    <socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">
        <socket-binding name="management-http" interface="management" port="${jboss.management.http.port:9990}"/>
        <socket-binding name="management-https" interface="management" port="${jboss.management.https.port:9993}"/>
        <socket-binding name="ajp" port="${jboss.ajp.port:8009}"/>
        <socket-binding name="http" port="${jboss.http.port:8080}"/>
        <socket-binding name="https" port="${jboss.https.port:8443}"/>
        <socket-binding name="txn-recovery-environment" port="4712"/>
        <socket-binding name="txn-status-manager" port="4713"/>
        <socket-binding name="teiid-jdbc" port="31000"/>
        <socket-binding name="teiid-odbc" port="35432"/>
        <outbound-socket-binding name="mail-smtp">
            <remote-destination host="localhost" port="25"/>
        </outbound-socket-binding>
    </socket-binding-group>

</server>


text:
using System;
using System.IO;
using System.Xml;
using System.Text;
using System.Collections;
using System.Collections.Specialized;
using System.Security.Cryptography;
using System.Reflection;
using System.Reflection.Emit;
using System.Net;
using Org.Mentalis.Proxy;
using Org.Mentalis.Proxy.Socks.Authentication;

namespace Org.Mentalis.Proxy {
	///
	/// Stores the configuration settings of this proxy server.
	///
	public sealed class ProxyConfig {
		///
		/// Initializes a new ProxyConfig instance.
		///
		/// <param name="parent">The parent of this ProxyCondif instance.</param>
		/// <param name="file">The XML file to read data from and store data to.</param>
		/// <exception cref="ArgumentNullException"><c>file</c> is null -or- <c>parent</c> is null.</exception>
		public ProxyConfig(Proxy parent, string file) {
			if (file == null || parent == null)
				throw new ArgumentNullException();
			m_File = file;
			m_Parent = parent;
		}
		///
		/// Reads a string from the settings section.
		///
		/// <param name="name">The key to read from.</param>
		/// <returns>The string value that corresponds with the specified key, or an empty string if the specified key was not found in the collection.</returns>
		public string ReadString(string name) {
			return ReadString(name, "");
		}
		///
		/// Reads a string from the settings section.
		///
		/// <param name="name">The key to read from.</param>
		/// <param name="def">The default string to return.</param>
		/// <returns>The string value that corresponds with the specified key, or <c>def</c> if the specified key was not found in the collection.</returns>
		public string ReadString(string name, string def) {
			if (name == null)
				return def;
			if (!Settings.ContainsKey(name))
				return def;
			return Settings[name];
		}
		///
		/// Reads a byte array from the settings section.
		///
		/// <param name="name">The key to read from.</param>
		/// <returns>The array of bytes that corresponds with the specified key, or <c>null</c> if the specified key was not found in the collection.</returns>
		public byte[] ReadBytes(string name) {
			string ret = ReadString(name, null);
			if (ret == null)
				return null;
			return Convert.FromBase64String(ret);
		}
		///
		/// Reads an integer from the settings section.
		///
		/// <param name="name">The key to read from.</param>
		/// <returns>The integer that corresponds with the specified key, or 0 if the specified key was not found in the collection.</returns>
		public int ReadInt(string name) {
			return ReadInt(name, 0);
		}
		///
		/// Reads an integer from the settings section.
		///
		/// <param name="name">The key to read from.</param>
		/// <param name="def">The default integer to return.</param>
		/// <returns>The integer that corresponds with the specified key, or <c>def</c> if the specified key was not found in the collection.</returns>
		public int ReadInt(string name, int def) {
			if (name == null)
				return def;
			if (!Settings.ContainsKey(name))
				return def;
			return int.Parse(Settings[name]);
		}
		///
		/// Saves a string to the settings section.
		///
		/// <param name="name">The key of the setting.</param>
		/// <param name="data">The string data of the setting.</param>
		public void SaveSetting(string name, string data) {
			SaveSetting(name, data, true);
		}
		///
		/// Saves a string to the settings section.
		///
		/// <param name="name">The key of the setting.</param>
		/// <param name="data">The string data of the setting.</param>
		/// <param name="saveData">True if the data has to be written to the XML file, false otherwise.</param>
		public void SaveSetting(string name, string data, bool saveData) {
			if (name == null || data == null)
				throw new ArgumentNullException();
			if (Settings.ContainsKey(name))
				Settings[name] = data;
			else
				Settings.Add(name, data);
			if (saveData)
				SaveData();
		}
		///
		/// Saves an integer to the settings section.
		///
		/// <param name="name">The key of the setting.</param>
		/// <param name="data">The integer data of the setting.</param>
		public void SaveSetting(string name, int data) {
			SaveSetting(name, data, true);
		}
		///
		/// Saves an integer to the settings section.
		///
		/// <param name="name">The key of the setting.</param>
		/// <param name="data">The integer data of the setting.</param>
		/// <param name="saveData">True if the data has to be written to the XML file, false otherwise.</param>
		public void SaveSetting(string name, int data, bool saveData) {
			SaveSetting(name, data.ToString(), saveData);
		}
		///
		/// Saves an array of bytes to the settings section.
		///
		/// <param name="name">The key of the setting.</param>
		/// <param name="data">The byte data of the setting.</param>
		public void SaveSetting(string name, byte [] data) {
			SaveSetting(name, data, true);
		}
		///
		/// Saves an array of bytes to the settings section.
		///
		/// <param name="name">The key of the setting.</param>
		/// <param name="data">The byte data of the setting.</param>
		/// <param name="saveData">True if the data has to be written to the XML file, false otherwise.</param>
		public void SaveSetting(string name, byte [] data, bool saveData) {
			if (data == null)
				throw new ArgumentNullException();
			SaveSetting(name, Convert.ToBase64String(data), saveData);
		}
		///
		/// Saves a username and password combination to the authentication list.
		///
		/// <param name="username">The username to add.</param>
		/// <param name="password">The password to add.</param>
		/// <exception cref="ArgumentNullException"><c>username</c> is null -or- <c>password</c> is null.</exception>
		/// <exception cref="ArgumentException">The specified username is invalid.</exception>
		/// <remarks>
If the user already exists in the collection, the old password will be changed to the new one.

The username 'users' is invalid because it is used internally to store the usernames.
</remarks>
		public void SaveUserPass(string username, string password) {
			SaveUserPass(username, password, true);
		}
		///
		/// Saves a username and password combination to the authentication list.
		///
		/// <param name="username">The username to add.</param>
		/// <param name="password">The password to add.</param>
		/// <param name="saveData">True if the data has to be written to the XML file, false otherwise.</param>
		/// <exception cref="ArgumentNullException"><c>username</c> is null -or- <c>password</c> is null.</exception>
		/// <exception cref="ArgumentException">The specified username is invalid.</exception>
		/// <remarks>
If the user already exists in the collection, the old password will be changed to the new one.

The username 'users' is invalid because it is used internally to store the usernames.

The password will be hashed before it is stored in the authentication list.
</remarks>
		public void SaveUserPass(string username, string password, bool saveData) {
			if (username == null || password == null)
				throw new ArgumentNullException();
			if (username.ToLower() == "users" || username == "")
				throw new ArgumentException();
			if (UserList.IsUserPresent(username))
				UserList.RemoveItem(username);
			UserList.AddItem(username, password);
			if (saveData)
				SaveData();
		}
		///
		/// Saves a username and password hash combination to the authentication list.
		///
		/// <param name="username">The username to add.</param>
		/// <param name="passHash">The password hash to add.</param>
		/// <exception cref="ArgumentNullException"><c>username</c> is null -or- <c>passHash</c> is null.</exception>
		/// <exception cref="ArgumentException">The specified username is invalid.</exception>
		/// <remarks>
If the user already exists in the collection, the old password hash will be changed to the new one.

The username 'users' is invalid because it is used internally to store the usernames.

The password will not be hashed before it is stored in the authentication list. The user must make sure it is a valid MD5 hash.
</remarks>
		public void SaveUserHash(string username, string passHash) {
			SaveUserHash(username, passHash, true);
		}
		///
		/// Saves a username and password hash combination to the authentication list.
		///
		/// <param name="username">The username to add.</param>
		/// <param name="passHash">The password hash to add.</param>
		/// <param name="saveData">True if the data has to be written to the XML file, false otherwise.</param>
		/// <exception cref="ArgumentNullException"><c>username</c> is null -or- <c>passHash</c> is null.</exception>
		/// <exception cref="ArgumentException">The specified username is invalid.</exception>
		/// <remarks>
If the user already exists in the collection, the old password hash will be changed to the new one.

The username 'users' is invalid because it is used internally to store the usernames.

The password will not be hashed before it is stored in the authentication list. The user must make sure it is a valid MD5 hash.
</remarks>
		public void SaveUserHash(string username, string passHash, bool saveData) {
			if (username == null || passHash == null)
				throw new ArgumentNullException();
			if (username.ToLower() == "users" || username == "")
				throw new ArgumentException();
			UserList.AddHash(username, passHash);
			if (saveData)
				SaveData();
		}
		///
		/// Removes a user from the authentication list.
		///
		/// <param name="user">The user to remove.</param>
		public void RemoveUser(string user) {
			RemoveUser(user, true);
		}
		///
		/// Removes a user from the authentication list.
		///
		/// <param name="user">The user to remove.</param>
		/// <param name="save">True if the data has to be written to the XML file, false otherwise.</param>
		public void RemoveUser(string user, bool save) {
			if (user == null)
				throw new ArgumentNullException();
			UserList.RemoveItem(user);
			if (save)
				SaveData();
		}
		///
		/// Saves the data in this class to an XML file.
		///
		public void SaveData() {
			XmlTextWriter writer = null;
			try {
				writer = new XmlTextWriter(File, Encoding.ASCII);
				writer.Indentation = 2;
				writer.Formatting = Formatting.Indented;
				writer.WriteStartElement("MentalisProxy");
				// Write the version
				writer.WriteStartElement("Version");
				writer.WriteStartAttribute("", "value", "");
				writer.WriteString(Assembly.GetCallingAssembly().GetName().Version.ToString(2));
				writer.WriteEndAttribute();
				writer.WriteEndElement();
				// Write the settings
				SaveSettings(writer);
				// Write the Authentication list to the file
				SaveUsers(writer);
				// Write the Listeners list to the file
				SaveListeners(writer);
				// Clean up
				writer.WriteEndElement();
			} catch {
			} finally {
				if (writer != null)
					writer.Close();
			}
		}
		///
		/// Saves the settings in this class to an XML writer.
		///
		/// <param name="writer">The XML writer to save the data to.</param>
		private void SaveSettings(XmlTextWriter writer) {
			writer.WriteStartElement("Settings");
			string [] keys = new string[Settings.Count];
			Settings.Keys.CopyTo(keys, 0);
			for (int i = 0; i < keys.Length; i++) {
				writer.WriteStartElement(keys[i]);
				writer.WriteStartAttribute("", "value", "");
				writer.WriteString(Settings[keys[i]]);
				writer.WriteEndAttribute();
				writer.WriteEndElement();
			}
			writer.WriteEndElement();
		}
		///
		/// Saves the authentication list to an XML writer.
		///
		/// <param name="writer">The XML writer to save the users to.</param>
		private void SaveUsers(XmlTextWriter writer) {
			writer.WriteStartElement("Users");
			string [] keys = UserList.Keys;
			string [] hashes = UserList.Hashes;
			for (int i = 0; i < keys.Length; i++) {
				writer.WriteStartElement(keys[i]);
				writer.WriteStartAttribute("", "value", "");
				writer.WriteString(hashes[i]);
				writer.WriteEndAttribute();
				writer.WriteEndElement();
			}
			writer.WriteEndElement();
		}
		///
		/// Saves the listeners to an XML writer.
		///
		/// <param name="writer">The XML writer to save the users to.</param>
		private void SaveListeners(XmlTextWriter writer) {
			writer.WriteStartElement("Listeners");
			lock (Parent) {
				for (int i = 0; i < Parent.ListenerCount; i++) {
					writer.WriteStartElement("listener");
					// Write the type, eg 'Org.Mentalis.Proxy.Http.HttpListener'
					writer.WriteStartAttribute("", "type", "");
					writer.WriteString(Parent[i].GetType().FullName);
					writer.WriteEndAttribute();
					// Write the construction string
					writer.WriteStartAttribute("", "value", "");
					writer.WriteString(Parent[i].ConstructString);
					writer.WriteEndAttribute();
					writer.WriteEndElement();
				}
			}
			writer.WriteEndElement();
		}
		///
		/// Loads the data from an XML file.
		///
		public void LoadData() {
			if (!System.IO.File.Exists(File))
				throw new FileNotFoundException();
			XmlTextReader reader = null;
			try {
				reader = new XmlTextReader(File);
				// Read until we reach the MentalisProxy element
				while (reader.Read() && reader.Name.ToLower() != "mentalisproxy") {}
				// Read until we reach the MentalisProxy element again (the end tag)
				while (reader.Read() && reader.Name.ToLower() != "mentalisproxy") {
					if (!reader.IsEmptyElement) {
						switch(reader.Name.ToLower()) {
							case "settings":
								Settings.Clear();
								LoadSettings(reader);
								break;
							case "users":
								UserList.Clear();
								LoadUsers(reader);
								break;
							case "listeners":
								LoadListeners(reader);
								break;
						}
					}
				}
			} catch {
				throw new XmlException ("Malformed XML initialisation file.", null);
			} finally {
				if (reader != null)
					reader.Close();
			}
		}
		///
		/// Loads the settings from an XML file.
		///
		/// <param name="reader">The XML reader to read the settings from.</param>
		private void LoadSettings(XmlTextReader reader) {
			// Read until we reach the Settings element end tag
			while (reader.Read() && reader.Name.ToLower() != "settings") {
				if (reader.Name != null && reader["value"] != null)
					SaveSetting(reader.Name, reader["value"], false);
			}
		}
		///
		/// Loads the userlist from an XML file.
		///
		/// <param name="reader">The XML reader to read the users from.</param>
		private void LoadUsers(XmlTextReader reader) {
			// Read until we reach the Settings element end tag
			while (reader.Read() && reader.Name.ToLower() != "users") {
				if (reader.Name != null && reader["value"] != null)
					SaveUserHash(reader.Name, reader["value"], false);
			}
		}
		///
		/// Loads the listeners list from an XML file.
		///
		/// <param name="reader">The XML reader to read the users from.</param>
		private void LoadListeners(XmlTextReader reader) {
			// Read until we reach the Listeners element end tag
			Listener listener = null;
			while (reader.Read() && reader.Name.ToLower() != "listeners") {
				if (reader.Name != null && reader["value"] != null && reader["type"] != null) {
					listener = Parent.CreateListener(reader["type"], reader["value"]);
					if (listener != null) {
						try {
							listener.Start();
						} catch {}
						Parent.AddListener(listener);
					}
				}
			}
		}
		///
		/// Gets the full path to the XML data file.
		///
		/// <value>A String that holds the full path to the XML data file.</value>
		public string File {
			get {
				return m_File;
			}
		}
		///
		/// Gets the parent object of this ProxyConfig class.
		///
		/// <value>An instance of the Proxy class.</value>
		public Proxy Parent	{
			get {
				return m_Parent;
			}
		}
		///
		/// Gets the dictionary that holds the settings.
		///
		/// <value>An instance of the StringDictionary class that holds the settings.</value>
		private StringDictionary Settings {
			get {
				return m_Settings;
			}
		}
		///
		/// Gets the userlist.
		///
		/// <value>An instance of the AuthenticationList class that holds all the users and their corresponding password hashes.</value>
		internal AuthenticationList UserList {
			get {
				return m_UserList;
			}
		}
		// private variables
		/// Holds the value of the File property.
		private string m_File;
		/// Holds the value of the Settings property.
		private StringDictionary m_Settings = new StringDictionary();
		/// Holds the value of the UserList property.
		private AuthenticationList m_UserList = new AuthenticationList();
		/// Holds the value of the Parent property.
		private Proxy m_Parent;
	}

}

/*
<MentalisProxy>
  <Version value="1.0" />
  <Settings>
    <authorize value="never" />
    <admin_hash value="Gh3JHJBzJcaScd3wyUS8cg==" />
    <config_ip value="localhost" />
    <config_port value="4" />
    <errorlog value="errors.log" />
  </Settings>
  <Users>
    <user value="myhash" />
    <pieter value="WhBei51A4TKXgNYuoiZdig==" />
    <kris value="X03MO1qnZdYdgyfeuILPmQ==" />
  </Users>
  <Listeners>
    <listener type="Org.Mentalis.Proxy.Http.HttpListener" value="host:0.0.0.0;int:100" />
    <listener type="Org.Mentalis.Proxy.Ftp.FtpListener" value="host:0.0.0.0;int:21" />
    <listener type="Org.Mentalis.Proxy.Socks.SocksListener" value="host:0.0.0.0;int:1080;authlist" />
    <listener type="Org.Mentalis.Proxy.PortMap.PortMapListener" value="host:0.0.0.0;int:12345;host:msnews.microsoft.com;int:119" />
  </Listeners>
</MentalisProxy>
*/

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Symfony\Component\Console;

/**
 * Contains all events dispatched by an Application.
 *
 * @author Francesco Levorato <git@flevour.net>
 */
final class ConsoleEvents
{
    /**
     * The COMMAND event allows you to attach listeners before any command is
     * executed by the console. It also allows you to modify the command, input and output
     * before they are handled to the command.
     *
     * @Event("Symfony\Component\Console\Event\ConsoleCommandEvent")
     *
     * @var string
     */
    const COMMAND = 'console.command';

    /**
     * The TERMINATE event allows you to attach listeners after a command is
     * executed by the console.
     *
     * @Event("Symfony\Component\Console\Event\ConsoleTerminateEvent")
     *
     * @var string
     */
    const TERMINATE = 'console.terminate';

    /**
     * The EXCEPTION event occurs when an uncaught exception appears
     * while executing Command#run().
     *
     * This event allows you to deal with the exception or
     * to modify the thrown exception.
     *
     * @Event("Symfony\Component\Console\Event\ConsoleExceptionEvent")
     *
     * @var string
     *
     * @deprecated The console.exception event is deprecated since version 3.3 and will be removed in 4.0. Use the console.error event instead.
     */
    const EXCEPTION = 'console.exception';

    /**
     * The ERROR event occurs when an uncaught exception or error appears.
     *
     * This event allows you to deal with the exception/error or
     * to modify the thrown exception.
     *
     * @Event("Symfony\Component\Console\Event\ConsoleErrorEvent")
     *
     * @var string
     */
    const ERROR = 'console.error';
}


text:
Various verilog tests and examples I've developed/reproduced while learning verilog.

## SimpleCPU
Implementation of a simple RISC CPU with a couple of instructions. In order to use it install iverilog and run `run.sh`.


text:
Checks for array detection and propose to use `isArray` from `@ember/array`

### Usage

```json
{
  "plugins": [
    "ember-cleanup"
  ],
  "rules": {
    "ember-cleanup/no-is-array": 2
  }
}
```

### Valid

```javascript
import {isArray} from '@ember/array';
Component.extend({
  method() {
    return isArray(get(this, 'prop'));
  }
});
```

### Invalid

```javascript
Component.extend({
  method() {
    return Array.isArray(get(this, 'prop'));
  }
});
```

```javascript
import {typeOf} from '@ember/utils';
Component.extend({
  method() {
    return typeOf(get(this, 'prop')) === 'array';
  }
});
```


text:
function [pgx,pgy,area,perim] = minboundparallelogram(x, y, metric)
% minboundparallelogram: Compute the minimal bounding parallelogram of points in the plane
% usage: [pgx,pgy,area,perimeter] = minboundparallelogram(x,y,metric)
%
% While minboundrect allows you to choose between a minimal area or
% perimeter, it turns out that the minimal area paralellogram is not
% always unique. However, there will exist a unique parallelogram of
% minimal perimeter.
%
% arguments: (input)
%  x,y - vectors of points, describing points in the plane as
%        (x,y) pairs. x and y must be the same lengths.
%
%  metric - (OPTIONAL) - single letter character flag which
%        denotes the use of minimal area or perimeter as the
%        metric to be minimized. metric may be either 'a' or 'p',
%        capitalization is ignored. Any other contraction of 'area'
%        or 'perimeter' is also accepted.
%
%        DEFAULT: 'a'    ('area')
%
% arguments: (output)
%  pgx,pgy - 5x1 vectors of points that define the minimal
%        bounding parallelogram.
%
%  area - (scalar) area of the minimal parallelogram itself.
%
%  perimeter - (scalar) perimeter of the minimal parallelogram as found
%
%
% Example usage:
%  x = rand(50000,1);
%  y = rand(50000,1);
%  tic,[px,py,area,perim] = minboundparallelogram(x,y);toc
%
%  Elapsed time is 0.083340 seconds.
%
% [px,py]
% ans =
%       8.73336658824275e-05      3.51448852413649e-05
%           1.00002616513798       3.7428827532671e-05
%          0.999923888887252         0.999977663164396
%      -1.49425848464391e-05         0.999975379222104
%       8.73336658824275e-05      3.51448852413649e-05
%
% area
% area =
%          0.999879069698332
%
% perim
% perim =
%            3.9997581420842
%
%
% See also: minboundcircle, minboundtri, minboundrect
%
%
% Author: John D'Errico
% E-mail: woodchips@rochester.rr.com
% Release: 1.0
% Release date: 8/19/2010
%
% modified for IMAGE FEATURE EXTRACTION: 23.04.2015
% by University of Stuttgart, Germany
%

% default for metric
if (nargin<3) || isempty(metric)
  metric = 'a';
elseif ~ischar(metric)
  error('metric must be a character flag if it is supplied.')
else
  % check for 'a' or 'p'
  metric = lower(metric(:)');
  ind = strmatch(metric,{'area','perimeter'});
  if isempty(ind)
    error('metric does not match either ''area'' or ''perimeter''')
  end

  % just keep the first letter.
  metric = metric(1);
end

% preprocess data
x=x(:);
y=y(:);

% not many error checks to worry about
n = length(x);
if n~=length(y)
  error('x and y must be the same sizes')
end

% start out with the convex hull of the points to
% reduce the problem dramatically. Note that any
% points in the interior of the convex hull are
% never needed, so we drop them.
if n>3
  edges = convhull(x,y);

  % exclude those points inside the hull as not relevant
  % also sorts the points into their convex hull as a
  % closed polygon

  x = x(edges(1:(end-1)));
  y = y(edges(1:(end-1)));

  % probably fewer points now, unless the points are fully convex
  nedges = length(x) - 1;

elseif n > 1
  % n must be 2 or 3
  nedges = n;
  x(end+1) = x(1);
  y(end+1) = y(1);
else
  % n must be 0 or 1
  nedges = n;
end

% now we must find the bounding parallelogram of those
% that remain.

% special case small numbers of points. If we trip any
% of these cases, then we are done, so return.
switch nedges
  case 0
    % empty begets empty
    pgx = [];
    pgy = [];
    area = [];
    perimeter = [];
    return
  case 1
    % with one point, the rect is simple.
    pgx = repmat(x,1,5);
    pgy = repmat(y,1,5);
    area = 0;
    perimeter = 0;
    return
  case 2
    % only two points. also simple.
    pgx = x([1 2 2 1 1]);
    pgy = y([1 2 2 1 1]);
    area = 0;
    perimeter = 2*sqrt(diff(x).^2 + diff(y).^2);
    return
end
% 3 or more points.

% will need a 2x2 rotation matrix through an angle theta
Rmat = @(theta) [cos(theta) sin(theta);-sin(theta) cos(theta)];

% get the angle of each edge of the hull polygon.
nx = length(x);
ind1 = 1:nx;
ind2 = circshift(ind1,[0 -1]);
edgeangles = atan2(y(ind2) - y(ind1),x(ind2) - x(ind1));
% move the angle to be in [0,pi).
edgeangles = mod(edgeangles,pi);

% now just check each edge of the convex hull
nang = length(edgeangles);
area = inf;
perim = inf;
met = inf;
xy = [x,y];
for i = 1:nang
  % line that defines the base of the parallelogram
  p1 = xy(i,:);

  % we will rotate and translate the points so this
  % edge lies on the x axis. The rotation matrix is...
  rot = Rmat(-edgeangles(i));
  xyr = (xy - repmat(p1,nx,1))*rot;

  % the height of the parallelogram is
  if max(xyr(:,2)) >= max(-xyr(:,2))
    pgheight = max(xyr(:,2));
  else
    pgheight = min(xyr(:,2));
  end

  % rotate everything, but keep the angles in the interval [0,pi)
  anglesr = mod(edgeangles - edgeangles(i),pi);

  % what are the smallest and largest possible angles of the
  % remaining edges? This will define the limits of where the
  % secondary sides of the bounding parallelogram may lie.
  anglesr(i) = [];
  anglesr(anglesr == 0) = [];
  anglebounds = [min(anglesr), max(anglesr)];

  % use fminbnd to search over the family of parallelograms with
  % the given base.
  sideang = fminbnd(@(ang) pgramobj(ang,xyr,pgheight),anglebounds(1),anglebounds(2));

  % get the final parallelogram
  [pmin,amin,pgxy] = pgramobj(sideang,xyr,pgheight);

  if metric=='a'
    M_i = amin;
  else
    M_i = pmin;
  end

  % A new metric value for the current interval.
  % Is it better than the previous best?
  if M_i < met
    % keep this one
    met = M_i;
    area = amin;
    perim = pmin;

    % recover the parallelogram in the original coordinate system
    pgxy = pgxy*rot' + repmat(p1,5,1);

    pgx = pgxy(:,1);
    pgy = pgxy(:,2);

%    plot(x,y,'kx',pgx,pgy,'-ro')
%    title(num2str([perim,area]))
%    axis equal
%    pause

  end
end

% all done
% plot(x,y,'kx',pgx,pgy,'-ro')
% title(num2str([perim,area]))
% axis equal

% =================================================================
function [perim,area,pgxy] = pgramobj(ang,xyr,pgheight)
%  For a given angle (in radians) computes the bounding
%  parallelogram where the base is assumed to lie on the
%  x axis. Thus the upper face must be parallel to the x axis.

% ang will always be in the open interval (0,pi)

% The vector that points along the sides will be
sidevec = [cos(ang),sin(ang)];

% for this value of ang, what is the normal vector to
% that side of the parallelogram? It always points in
% the positive x direction, by the way it is constructed.
nvec = [sin(ang);-cos(ang)];

% What is the left most point that a side will hit against?
% The rightmost? get that information from a dot product of
% the points with the normal vector of the sides.
dp = xyr*nvec;
leftmost = min(dp);
rightmost = max(dp);

% a point on the line that contains the left side of the
% parallelogram is
leftpoint = leftmost*nvec.';

% and the right hand side line passes through this point.
rightpoint = rightmost*nvec.';

% we can define each line by the parametric equations
%  Pleft(t) = leftpoint + t*sidevec
%  Pright(t) = rightpoint + s*sidevec
%
% now find the values of s and t, such that those lines
% intersect the x axis (thus y == 0)
t0 = -leftpoint(2)./sidevec(2);
s0 = -rightpoint(2)./sidevec(2);

% the actual x axis intercepts are at
x1 = leftpoint(1) + t0*sidevec(1);
x2 = rightpoint(1) + s0*sidevec(1);

% the length of a side of the parallelogram is given by the
% definition of the trig function from triangle sides.
sidelength = pgheight./cos(pi/2 - ang);
baselength = abs(x2 - x1);

% so the perimeter of the parallellogram is given by
perim = 2*(abs(sidelength) + baselength);

% don't bother to do these unless necessary
if nargout > 1
  % the area is also trivial to compute, as
  area = abs(pgheight)*baselength;

  % and the vertices of the parallelogram are
  pgxy = [[x1,0]; [x2,0]; ...
    [x2,0] + sidelength*sidevec ; ...
    [x1,0] + sidelength*sidevec ; ...
    [x1,0]];

end


text:
package org.apache.tamaya.core.internal.converters;

import org.apache.tamaya.spi.ConversionContext;
import org.apache.tamaya.spi.PropertyConverter;
import org.osgi.service.component.annotations.Component;

import java.time.LocalTime;
import java.util.Objects;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * Converter, converting from String to LocalTime.
 */
@Component(service = PropertyConverter.class)
public class LocalTimeConverter implements PropertyConverter<LocalTime> {

    private static final Logger LOG = Logger.getLogger(LocalTimeConverter.class.getName());

    @Override
    public LocalTime convert(String value, ConversionContext ctx) {
        ctx.addSupportedFormats(getClass(), LocalTime.now().toString());
        if(value==null){
            return null;
        }
        try{
            return LocalTime.parse(value);
        }catch(Exception e){
            LOG.log(Level.FINEST, e, () -> "Cannot parse LocalTime: " + value);
            return null;
        }
    }

    @Override
    public boolean equals(Object o){
        return Objects.nonNull(o) && getClass().equals(o.getClass());
    }

    @Override
    public int hashCode(){
        return getClass().hashCode();
    }
}


text:
<?php
if (!(defined('IN_IA')))
{
	exit('Access Denied');
}
class Sign_EweiShopV2Page extends PluginMobilePage
{
	public function main()
	{
		global $_W;
		global $_GPC;
		include $this->template();
	}
}
?>


text:
/* global gb */

gb.texture_transfering_data = function()
{
    gb.resource_transfering_data.call(this);

    this.m_type = gb.resource_transfering_data_type.texture;
    this.m_width = 0;
    this.m_height = 0;
    this.m_data = null;
    this.m_texture_id = -1;

    Object.defineProperty(this, 'width', {
        get: function()
        {
            return this.m_width;
        },
        set: function(value)
        {
            this.m_width = value;
        }
    });

    Object.defineProperty(this, 'height', {
        get: function()
        {
            return this.m_height;
        },
        set: function(value)
        {
            this.m_height = value;
        }
    });

    Object.defineProperty(this, 'texture_id', {
        get: function()
        {
            return this.m_texture_id;
        },
        set: function(value)
        {
            this.m_texture_id = value;
        }
    });

    Object.defineProperty(this, 'data', {
        get: function()
        {
            return this.m_data;
        },
        set: function(value)
        {
            this.m_data = value;
        }
    });
};

gb.texture_transfering_data.prototype = Object.create(gb.resource_transfering_data.prototype);
gb.texture_transfering_data.prototype.constructor = gb.texture_transfering_data;


text:
FROM ubuntu:trusty

WORKDIR /root

######
# Install common dependencies from packages
######
RUN apt-get update && apt-get install --no-install-recommends -y \
    git curl ant make maven \
    cmake gcc g++ \
    protobuf-compiler libprotoc-dev \
    protobuf-c-compiler libprotobuf-dev \
    build-essential libtool \
    zlib1g-dev pkg-config libssl-dev \
    snappy libsnappy-dev \
    bzip2 libbz2-dev \
    libjansson-dev \
    fuse libfuse-dev \
    libcurl4-openssl-dev \
    python python2.7 pylint \
    openjdk-7-jdk doxygen

# Fixing the Apache commons / Maven dependency problem under Ubuntu:
# See http://wiki.apache.org/commons/VfsProblems
RUN cd /usr/share/maven/lib && ln -s ../../java/commons-lang.jar .

#######
# Oracle Java
#######

RUN apt-get install -y software-properties-common
RUN add-apt-repository -y ppa:webupd8team/java
RUN apt-get update

# Auto-accept the Oracle JDK license
RUN echo oracle-java7-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
RUN apt-get install -y oracle-java7-installer

# Auto-accept the Oracle JDK license
RUN echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
RUN apt-get install -y oracle-java8-installer

######
# Install findbugs
######
RUN mkdir -p /opt/findbugs && \
    curl -L https://sourceforge.net/projects/findbugs/files/findbugs/3.0.1/findbugs-noUpdateChecks-3.0.1.tar.gz/download \
         -o /opt/findbugs.tar.gz && \
    tar xzf /opt/findbugs.tar.gz --strip-components 1 -C /opt/findbugs
ENV FINDBUGS_HOME /opt/findbugs

####
# Install shellcheck
####
RUN apt-get install -y cabal-install
RUN cabal update && cabal install shellcheck --global

###
# Avoid out of memory errors in builds
###
ENV MAVEN_OPTS -Xms256m -Xmx512m

###
# Everything past this point is either not needed for testing or breaks Yetus.
# So tell Yetus not to read the rest of the file:
# YETUS CUT HERE
###

####
# Install Forrest (for Apache Hadoop website)
###
RUN mkdir -p /usr/local/apache-forrest ; \
    curl -O http://archive.apache.org/dist/forrest/0.8/apache-forrest-0.8.tar.gz ; \
    tar xzf *forrest* --strip-components 1 -C /usr/local/apache-forrest ; \
    echo 'forrest.home=/usr/local/apache-forrest' > build.properties

# Add a welcome message and environment checks.
ADD hadoop_env_checks.sh /root/hadoop_env_checks.sh
RUN chmod 755 /root/hadoop_env_checks.sh
RUN echo '~/hadoop_env_checks.sh' >> /root/.bashrc


text:
  Villegly est
       un village
       localisé dans le département de l'Aude en Languedoc-Roussillon. On dénombrait 846 habitants en 2008.

À coté de Villegly sont situées les villes de
Bouilhonnac à 5 km, 225 habitants,
Conques-sur-Orbiel à 3 km, 2 245 habitants,
Villeneuve-Minervois localisée à 3 km, 828 habitants,
Bagnoles localisée à 1 km, 177 habitants,
Trassanel à 6 km, 24 habitants,
Laure-Minervois à 6 km, 1 052 habitants,
 entre autres. De plus, Villegly est située à seulement dix km de Carcassonne.

La ville propose de multiples  équipements, elle dispose, entre autres, de un terrain de tennis, un terrain de sport et deux boucles de randonnée.

Si vous pensez venir habiter à Villegly, vous pourrez facilement trouver une maison à vendre.

À Villegly, le prix moyen à la vente d'un appartement se situe à zero € du m² en vente. Le prix moyen d'une maison à l'achat se situe à 1 966 € du m². À la location le prix moyen se situe à 8,26 € du m² mensuel.

Le nombre de logements, à Villegly, était réparti en 2011 en 30 appartements et 492 maisons soit
 un marché relativement équilibré.


text:
package aes

import (
	"crypto/cipher"
	"crypto/subtle"
	"errors"
)

// The following functions are defined in gcm_amd64.s.
func hasGCMAsm() bool

//go:noescape
func aesEncBlock(dst, src *[16]byte, ks []uint32)

//go:noescape
func gcmAesInit(productTable *[256]byte, ks []uint32)

//go:noescape
func gcmAesData(productTable *[256]byte, data []byte, T *[16]byte)

//go:noescape
func gcmAesEnc(productTable *[256]byte, dst, src []byte, ctr, T *[16]byte, ks []uint32)

//go:noescape
func gcmAesDec(productTable *[256]byte, dst, src []byte, ctr, T *[16]byte, ks []uint32)

//go:noescape
func gcmAesFinish(productTable *[256]byte, tagMask, T *[16]byte, pLen, dLen uint64)

const (
	gcmBlockSize         = 16
	gcmTagSize           = 16
	gcmStandardNonceSize = 12
)

var errOpen = errors.New("cipher: message authentication failed")

// aesCipherGCM implements crypto/cipher.gcmAble so that crypto/cipher.NewGCM
// will use the optimised implementation in this file when possible. Instances
// of this type only exist when hasGCMAsm returns true.
type aesCipherGCM struct {
	aesCipher
}

// NewGCM returns the AES cipher wrapped in Galois Counter Mode. This is only
// called by crypto/cipher.NewGCM via the gcmAble interface.
func (c *aesCipherGCM) NewGCM(nonceSize int) (cipher.AEAD, error) {
	g := &gcmAsm{ks: c.enc, nonceSize: nonceSize}
	gcmAesInit(&g.productTable, g.ks)
	return g, nil
}

type gcmAsm struct {
	// ks is the key schedule, the length of which depends on the size of
	// the AES key.
	ks []uint32
	// productTable contains pre-computed multiples of the binary-field
	// element used in GHASH.
	productTable [256]byte
	// nonceSize contains the expected size of the nonce, in bytes.
	nonceSize int
}

func (g *gcmAsm) NonceSize() int {
	return g.nonceSize
}

func (*gcmAsm) Overhead() int {
	return gcmTagSize
}

// sliceForAppend takes a slice and a requested number of bytes. It returns a
// slice with the contents of the given slice followed by that many bytes and a
// second slice that aliases into it and contains only the extra bytes. If the
// original slice has sufficient capacity then no allocation is performed.
func sliceForAppend(in []byte, n int) (head, tail []byte) {
	if total := len(in) + n; cap(in) >= total {
		head = in[:total]
	} else {
		head = make([]byte, total)
		copy(head, in)
	}
	tail = head[len(in):]
	return
}

// Seal encrypts and authenticates plaintext. See the cipher.AEAD interface for
// details.
func (g *gcmAsm) Seal(dst, nonce, plaintext, data []byte) []byte {
	if len(nonce) != g.nonceSize {
		panic("cipher: incorrect nonce length given to GCM")
	}

	var counter, tagMask [gcmBlockSize]byte

	if len(nonce) == gcmStandardNonceSize {
		// Init counter to nonce||1
		copy(counter[:], nonce)
		counter[gcmBlockSize-1] = 1
	} else {
		// Otherwise counter = GHASH(nonce)
		gcmAesData(&g.productTable, nonce, &counter)
		gcmAesFinish(&g.productTable, &tagMask, &counter, uint64(len(nonce)), uint64(0))
	}

	aesEncBlock(&tagMask, &counter, g.ks)

	var tagOut [gcmTagSize]byte
	gcmAesData(&g.productTable, data, &tagOut)

	ret, out := sliceForAppend(dst, len(plaintext)+gcmTagSize)
	if len(plaintext) > 0 {
		gcmAesEnc(&g.productTable, out, plaintext, &counter, &tagOut, g.ks)
	}
	gcmAesFinish(&g.productTable, &tagMask, &tagOut, uint64(len(plaintext)), uint64(len(data)))
	copy(out[len(plaintext):], tagOut[:])

	return ret
}

// Open authenticates and decrypts ciphertext. See the cipher.AEAD interface
// for details.
func (g *gcmAsm) Open(dst, nonce, ciphertext, data []byte) ([]byte, error) {
	if len(nonce) != g.nonceSize {
		panic("cipher: incorrect nonce length given to GCM")
	}

	if len(ciphertext) < gcmTagSize {
		return nil, errOpen
	}
	tag := ciphertext[len(ciphertext)-gcmTagSize:]
	ciphertext = ciphertext[:len(ciphertext)-gcmTagSize]

	// See GCM spec, section 7.1.
	var counter, tagMask [gcmBlockSize]byte

	if len(nonce) == gcmStandardNonceSize {
		// Init counter to nonce||1
		copy(counter[:], nonce)
		counter[gcmBlockSize-1] = 1
	} else {
		// Otherwise counter = GHASH(nonce)
		gcmAesData(&g.productTable, nonce, &counter)
		gcmAesFinish(&g.productTable, &tagMask, &counter, uint64(len(nonce)), uint64(0))
	}

	aesEncBlock(&tagMask, &counter, g.ks)

	var expectedTag [gcmTagSize]byte
	gcmAesData(&g.productTable, data, &expectedTag)

	ret, out := sliceForAppend(dst, len(ciphertext))
	if len(ciphertext) > 0 {
		gcmAesDec(&g.productTable, out, ciphertext, &counter, &expectedTag, g.ks)
	}
	gcmAesFinish(&g.productTable, &tagMask, &expectedTag, uint64(len(ciphertext)), uint64(len(data)))

	if subtle.ConstantTimeCompare(expectedTag[:], tag) != 1 {
		for i := range out {
			out[i] = 0
		}
		return nil, errOpen
	}

	return ret, nil
}


text:
Plugin for Marked 2, a previewer for Markdown files on Mac OS X

### Requirements

 * [Marked 2](http://marked2app.com)

### Usage

 * If `marked` is called without an argument, open Marked

 * If `marked` is passed a file, open it in Marked


text:
import { Observable } from 'rxjs'
import RxResult from './result-rx'
// eslint-disable-next-line no-unused-vars
import Transaction from 'neo4j-driver-core'

/**
 * A reactive transaction, which provides the same functionality as {@link Transaction} but through a Reactive API.
 */
export default class RxTransaction {
  /**
   * @constructor
   * @protected
   * @param {Transaction} txc - The underlying transaction instance to relay requests
   */
  constructor (txc) {
    this._txc = txc
  }

  /**
   * Creates a reactive result that will execute the query in this transaction, with the provided parameters.
   *
   * @public
   * @param {string} query - Query to be executed.
   * @param {Object} parameters - Parameter values to use in query execution.
   * @returns {RxResult} - A reactive result
   */
  run (query, parameters) {
    return new RxResult(
      new Observable(observer => {
        try {
          observer.next(this._txc.run(query, parameters))
          observer.complete()
        } catch (err) {
          observer.error(err)
        }

        return () => {}
      })
    )
  }

  /**
   *  Commits the transaction.
   *
   * @public
   * @returns {Observable} - An empty observable
   */
  commit () {
    return new Observable(observer => {
      this._txc
        .commit()
        .then(() => {
          observer.complete()
        })
        .catch(err => observer.error(err))
    })
  }

  /**
   *  Rolls back the transaction.
   *
   * @public
   * @returns {Observable} - An empty observable
   */
  rollback () {
    return new Observable(observer => {
      this._txc
        .rollback()
        .then(() => {
          observer.complete()
        })
        .catch(err => observer.error(err))
    })
  }

  /**
   * Check if this transaction is active, which means commit and rollback did not happen.
   * @return {boolean} `true` when not committed and not rolled back, `false` otherwise.
   */
  isOpen () {
    return this._txc.isOpen()
  }

  /**
   * Closes the transaction
   *
   * This method will roll back the transaction if it is not already committed or rolled back.
   *
   * @returns {Observable} - An empty observable
   */
  close () {
    return new Observable(observer => {
      this._txc
        .close()
        .then(() => {
          observer.complete()
        })
        .catch(err => observer.error(err))
    })
  }
}


text:
NoFlatlands
===========

A plugin to regenerate flatland chunks automagically


text:
module Licensee
  class Project
    class LicenseFile < Licensee::Project::File
      include Licensee::ContentHelper

      # List of extensions to give preference to
      PREFERRED_EXT = %w(md markdown txt).freeze
      PREFERRED_EXT_REGEX = /\.#{Regexp.union(PREFERRED_EXT)}\z/

      # Regex to match any extension
      ANY_EXT_REGEX = %r{\.[^./]+\z}

      # Regex to match, LICENSE, LICENCE, unlicense, etc.
      LICENSE_REGEX = /(un)?licen[sc]e/i

      # Regex to match COPYING, COPYRIGHT, etc.
      COPYING_REGEX = /copy(ing|right)/i

      # Hash of Regex => score with which to score potential license files
      FILENAME_REGEXES = {
        /\A#{LICENSE_REGEX}\z/                       => 1.0, # LICENSE
        /\A#{LICENSE_REGEX}#{PREFERRED_EXT_REGEX}\z/ => 0.9, # LICENSE.md
        /\A#{COPYING_REGEX}\z/                       => 0.8, # COPYING
        /\A#{COPYING_REGEX}#{PREFERRED_EXT_REGEX}\z/ => 0.7, # COPYING.md
        /\A#{LICENSE_REGEX}#{ANY_EXT_REGEX}\z/       => 0.6, # LICENSE.textile
        /\A#{COPYING_REGEX}#{ANY_EXT_REGEX}\z/       => 0.5, # COPYING.textile
        /#{LICENSE_REGEX}/                           => 0.4, # LICENSE-MIT
        /#{COPYING_REGEX}/                           => 0.3, # COPYING-MIT
        //                                           => 0.0  # Catch all
      }.freeze

      def possible_matchers
        [Matchers::Copyright, Matchers::Exact, Matchers::Dice]
      end

      def attribution
        matches = /^#{Matchers::Copyright::REGEX}$/i.match(content)
        matches[0].strip if matches
      end

      def self.name_score(filename)
        FILENAME_REGEXES.find { |regex, _| filename =~ regex }[1]
      end

      # case-insensitive block to determine if the given file is LICENSE.lesser
      def self.lesser_gpl_score(filename)
        filename.casecmp('copying.lesser').zero? ? 1 : 0
      end
    end
  end
end


text:
package com.querydsl.jpa.domain17;

import java.util.SortedSet;
import java.util.TreeSet;

public abstract class HidaBezGruppe<G extends HidaBezGruppe<G, B>, B extends HidaBez<B, G>> extends CapiBCKeyedByGrundstueck {

    Long id;

    SortedSet<B> bez = new TreeSet<B>();

}


text:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.ServiceModel;
using System.Threading;
using System.Xml;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Hosting.Server.Features;
using Microsoft.Extensions.DependencyInjection;
using Moq;

namespace SoapCore.Tests.RequestArgumentsOrder
{
	public sealed class ServiceFixture<TOriginalParametersOrderService, TReversedParametersOrderService> : IDisposable
		where TOriginalParametersOrderService : class
		where TReversedParametersOrderService : class
	{
		private readonly IWebHost _host;
		private readonly Dictionary<SoapSerializer, TOriginalParametersOrderService> _originalRequestArgumentsOrderClients;
		private readonly Dictionary<SoapSerializer, TReversedParametersOrderService> _reversedRequestArgumentsOrderClients;

		public ServiceFixture()
		{
			var binding = new BasicHttpBinding
			{
				MaxReceivedMessageSize = int.MaxValue,
				ReaderQuotas = XmlDictionaryReaderQuotas.Max
			};

			// start service host
			_host = new WebHostBuilder()
				.ConfigureServices(services =>
				{
					// init service mock
					ServiceMock = new Mock<TOriginalParametersOrderService>();
					services.AddSingleton(ServiceMock.Object);
					services.AddSoapCore();
					services.AddMvc();
				})
				.Configure(appBuilder =>
				{
#if !NETCOREAPP3_0_OR_GREATER
					appBuilder.UseSoapEndpoint<TOriginalParametersOrderService>("/Service.svc", new SoapEncoderOptions(), SoapSerializer.DataContractSerializer);
					appBuilder.UseSoapEndpoint<TOriginalParametersOrderService>("/Service.asmx", new SoapEncoderOptions(), SoapSerializer.XmlSerializer);
					appBuilder.UseMvc();
#else
					appBuilder.UseRouting();

					appBuilder.UseEndpoints(x =>
					{
						x.UseSoapEndpoint<TOriginalParametersOrderService>("/Service.svc", new SoapEncoderOptions(), SoapSerializer.DataContractSerializer);
						x.UseSoapEndpoint<TOriginalParametersOrderService>("/Service.asmx", new SoapEncoderOptions(), SoapSerializer.XmlSerializer);
					});
#endif
				})
				.UseKestrel()
				.UseUrls($"http://127.0.0.1:0")
				.UseContentRoot(Directory.GetCurrentDirectory())
				.Build();

			var task = _host.RunAsync();

			while (true)
			{
				if (_host != null)
				{
					if (task.IsFaulted && task.Exception != null)
					{
						throw task.Exception;
					}

					if (!task.IsCompleted || !task.IsCanceled)
					{
						if (!_host.ServerFeatures.Get<IServerAddressesFeature>().Addresses.First().EndsWith(":0"))
						{
							break;
						}
					}
				}

				Thread.Sleep(2000);
			}

			var addresses = _host.ServerFeatures.Get<IServerAddressesFeature>();
			var address = addresses.Addresses.Single();

			//make clients
			_originalRequestArgumentsOrderClients = InitClients<TOriginalParametersOrderService>(binding, address);
			_reversedRequestArgumentsOrderClients = InitClients<TReversedParametersOrderService>(binding, address);
		}

		public Mock<TOriginalParametersOrderService> ServiceMock { get; private set; }

		public static IEnumerable<object[]> SoapSerializersList()
		{
			foreach (var soapSerializer in Enum.GetValues(typeof(SoapSerializer)))
			{
				yield return new[] { soapSerializer };
			}
		}

		public TOriginalParametersOrderService GetOriginalRequestArgumentsOrderClient(SoapSerializer soapSerializer)
		{
			return _originalRequestArgumentsOrderClients[soapSerializer];
		}

		public TReversedParametersOrderService GetReversedRequestArgumentsOrderClient(SoapSerializer soapSerializer)
		{
			return _reversedRequestArgumentsOrderClients[soapSerializer];
		}

		public void Dispose()
		{
			_host.StopAsync();
			_host.Dispose();
		}

		private Dictionary<SoapSerializer, TService> InitClients<TService>(BasicHttpBinding binding, string address)
		{
			var endpointXml = new EndpointAddress(new Uri($"{address}/Service.asmx"));
			var channelFactoryXml = new ChannelFactory<TService>(binding, endpointXml);
			var serviceClientXml = channelFactoryXml.CreateChannel();

			var endpointDC = new EndpointAddress(new Uri($"{address}/Service.svc"));
			var channelFactoryDC = new ChannelFactory<TService>(binding, endpointDC);
			var serviceClientDc = channelFactoryDC.CreateChannel();

			return new Dictionary<SoapSerializer, TService>
			{
				[SoapSerializer.XmlSerializer] = serviceClientXml,
				[SoapSerializer.DataContractSerializer] = serviceClientDc
			};
		}
	}
}


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

namespace Ivony.Html.Forms
{

  /// <summary>
  /// IFormControl 的抽象实现
  /// </summary>
  public abstract class FormControl : IFormControl
  {

    /// <summary>
    /// 构建 FormControl 实例
    /// </summary>
    /// <param name="form">控件所属表单</param>
    protected FormControl( HtmlForm form )
    {

      Form = form;

    }

    /// <summary>
    /// 控件所属表单
    /// </summary>
    public HtmlForm Form
    {
      get;
      private set;
    }

    /// <summary>
    /// 控件名称
    /// </summary>
    public abstract string Name { get; }

    /// <summary>
    /// 实现 Value 属性,调用 SetValue 和 GetValue 方法
    /// </summary>
    public virtual string Value
    {
      get
      {
        return GetValue();
      }
      set
      {
        EnsureValue( value );
        SetValue( value );
      }
    }

    /// <summary>
    /// 确保设置的值是合法的
    /// </summary>
    /// <param name="value">要设置的值</param>
    protected virtual void EnsureValue( string value )
    {
      string message;
      if ( !CanSetValue( value, out message ) )
        throw new FormValueFormatException( this, message );
    }

    /// <summary>
    /// 派生类实现此方法设置控件值
    /// </summary>
    /// <param name="value">要设置的值</param>
    protected abstract void SetValue( string value );

    /// <summary>
    /// 派生类实现此方法获取控件设置的值
    /// </summary>
    /// <returns>控件设置的值</returns>
    protected abstract string GetValue();

    /// <summary>
    /// 确定能否设置指定的文本值
    /// </summary>
    /// <param name="value">要设置的文本值</param>
    /// <returns>是否能够设置</returns>
    public virtual bool CanSetValue( string value )
    {
      string message = null;
      return CanSetValue( value, out message );
    }

    /// <summary>
    /// 派生类实现此方法确定指定的文本值是否能够被设置
    /// </summary>
    /// <param name="value">要设置的文本值</param>
    /// <param name="message">不能设置的错误信息</param>
    /// <returns>是否能够设置</returns>
    protected abstract bool CanSetValue( string value, out string message );

  }
}


text:
require 'optparse'

begin
  require "slim"
  require "haml"
  require "redcarpet"
rescue LoadError => e
  abort e.to_s
end

module HomeworkReport
  class CommandLineTool

    attr_accessor :options, :template_filepath, :scope

    def initialize(*args)
      args = args.flatten

      self.options = { output: :stdout }

      OptionParser.new do |opts|
        opts.banner = "Usage: #{opts.program_name} [options] TEMPLATE_FILE"
        opts.separator "Outcome: a HTML file/text is generated"
        opts.separator "Options:"

        command_options opts
      end.parse! args

      unless self.template_filepath = args.shift
        raise RuntimeError, "TEMPLATE_FILE is required"
      end

      self.scope = Scope.new
    end

    def run
      lambda {|path, &y|
        case path
        when :stdout then y.call $stdout
        when String then File.open path, "w", &y
        else raise RuntimeError
        end
      }.call options.delete(:output) do |output|
        output << scope.render(template_filepath)
        output << "\n"
      end
    end

    private

    def command_options(opts)
      opts.on("-o", "--output FILE"){|p| options[:output] = p }
    end

  end
end


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

/**
 * Component doc
 */
@Component({})
export class NoParameterComponent {}

/**
 * Component doc
 */
@Component({})
export class ParameterComponent<C> {}

/**
 * Interface doc
 */
@Injectable()
export interface NoParameterInterface {}

/**
 * Interface doc
 */
@Injectable()
export interface ParameterInterface<I = NoParameterInterface> {}

/**
 * Service doc
 */
@Injectable()
export class NoParameterService {}

/**
 * Service doc
 */
@Injectable()
export class ParameterService<S = number> {}


text:
"""
This module contains the classes for configuration of the chemenv package.
"""

import json
from os import makedirs
from os.path import exists, expanduser

from pymatgen.core import SETTINGS
from pymatgen.analysis.chemenv.utils.scripts_utils import strategies_class_lookup

__author__ = "David Waroquiers"
__copyright__ = "Copyright 2012, The Materials Project"
__credits__ = "Geoffroy Hautier"
__version__ = "2.0"
__maintainer__ = "David Waroquiers"
__email__ = "david.waroquiers@gmail.com"
__date__ = "Feb 20, 2016"

class ChemEnvConfig:
    """
    Class used to store the configuration of the chemenv package :
     - Materials project access
     - ICSD database access
     - Default options (strategies, ...)
    """

    DEFAULT_PACKAGE_OPTIONS = {
        "default_strategy": {
            "strategy": "SimplestChemenvStrategy",
            "strategy_options": {
                "distance_cutoff": strategies_class_lookup["SimplestChemenvStrategy"].DEFAULT_DISTANCE_CUTOFF,
                "angle_cutoff": strategies_class_lookup["SimplestChemenvStrategy"].DEFAULT_ANGLE_CUTOFF,
                "additional_condition": strategies_class_lookup["SimplestChemenvStrategy"].DEFAULT_ADDITIONAL_CONDITION,
                "continuous_symmetry_measure_cutoff": strategies_class_lookup[
                    "SimplestChemenvStrategy"
                ].DEFAULT_CONTINUOUS_SYMMETRY_MEASURE_CUTOFF,
            },
        },
        "default_max_distance_factor": 1.5,
    }

    def __init__(self, package_options=None):
        """
        :param package_options:
        """
        if SETTINGS.get("PMG_MAPI_KEY", "") != "":
            self.materials_project_configuration = SETTINGS.get("PMG_MAPI_KEY", "")
        else:
            self.materials_project_configuration = None

        if package_options is None:
            self.package_options = self.DEFAULT_PACKAGE_OPTIONS
        else:
            self.package_options = package_options

    def setup(self):
        """
        Setup the class.
        """
        while True:
            print("\n=> Configuration of the ChemEnv package <=")
            print("Current configuration :")
            if self.has_materials_project_access:
                print(" - Access to materials project is configured (add test ?)")
            else:
                print(" - No access to materials project")
            print(" - Package options :")
            for key, val in self.package_options.items():
                print("     {}   :   {}".format(str(key), str(val)))
            print("\nChoose in the following :")
            print(" <1> + <ENTER> : configuration of the package options (strategy, ...)")
            print(" <q> + <ENTER> : quit without saving configuration")
            test = input(" <S> + <ENTER> : save configuration and quit\n ... ")
            if test == "1":
                self.setup_package_options()
            elif test == "q":
                break
            elif test == "S":
                config_file = self.save()
                break
            else:
                print(" ... wrong key, try again ...")
            print("")
        if test == "S":
            print('Configuration has been saved to file "{}"'.format(config_file))

    @property
    def has_materials_project_access(self):
        """
        Whether MP access is enabled.
        :return:
        """
        return self.materials_project_configuration is not None

    def setup_package_options(self):
        """
        Setup the package options.
        """
        self.package_options = self.DEFAULT_PACKAGE_OPTIONS
        print("Choose between the following strategies : ")
        strategies = list(strategies_class_lookup.keys())
        for istrategy, strategy in enumerate(strategies):
            print(" <{}> : {}".format(str(istrategy + 1), strategy))
        test = input(" ... ")
        self.package_options["default_strategy"] = {
            "strategy": strategies[int(test) - 1],
            "strategy_options": {},
        }
        strategy_class = strategies_class_lookup[strategies[int(test) - 1]]
        if len(strategy_class.STRATEGY_OPTIONS) > 0:
            for option, option_dict in strategy_class.STRATEGY_OPTIONS.items():
                while True:
                    print(
                        '  => Enter value for option "{}" '
                        "(<ENTER> for default = {})\n".format(option, str(option_dict["default"]))
                    )
                    print("     Valid options are :\n")
                    print("       {}".format(option_dict["type"].allowed_values))
                    test = input("     Your choice : ")
                    if test == "":
                        self.package_options["default_strategy"]["strategy_options"][option] = option_dict["type"](
                            strategy_class.STRATEGY_OPTIONS[option]["default"]
                        )
                        break
                    try:
                        self.package_options["default_strategy"]["strategy_options"][option] = option_dict["type"](test)
                        break
                    except ValueError:
                        print("Wrong input for option {}".format(option))

    def package_options_description(self):
        """
        Describe package options.
        """
        out = "Package options :\n"
        out += " - Maximum distance factor : {:.4f}\n".format(self.package_options["default_max_distance_factor"])
        out += ' - Default strategy is "{}" :\n'.format(self.package_options["default_strategy"]["strategy"])
        strategy_class = strategies_class_lookup[self.package_options["default_strategy"]["strategy"]]
        out += "{}\n".format(strategy_class.STRATEGY_DESCRIPTION)
        out += "   with options :\n"
        for option, option_dict in strategy_class.STRATEGY_OPTIONS.items():
            out += "     - {} : {}\n".format(
                option,
                self.package_options["default_strategy"]["strategy_options"][option],
            )
        return out

    def save(self, root_dir=None):
        """
        Save the options.
        :param root_dir:
        """
        if root_dir is None:
            home = expanduser("~")
            root_dir = "{}/.chemenv".format(home)
        if not exists(root_dir):
            makedirs(root_dir)
        config_dict = {"package_options": self.package_options}
        config_file = "{}/config.json".format(root_dir)
        if exists(config_file):
            test = input("Overwrite existing configuration ? (<Y> + <ENTER> to confirm)")
            if test != "Y":
                print("Configuration not saved")
                return config_file
        with open(config_file, "w") as f:
            json.dump(config_dict, f)
        print("Configuration saved")
        return config_file

    @classmethod
    def auto_load(cls, root_dir=None):
        """
        Autoload options.
        :param root_dir:
        """
        if root_dir is None:
            home = expanduser("~")
            root_dir = "{}/.chemenv".format(home)
        config_file = "{}/config.json".format(root_dir)
        try:
            with open(config_file, "r") as f:
                config_dict = json.load(f)
            return ChemEnvConfig(package_options=config_dict["package_options"])

        except IOError:
            print('Unable to load configuration from file "{}" ...'.format(config_file))
            print(" ... loading default configuration")
            return ChemEnvConfig()


text:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<modules>
  <module moduleId="org.eclipse.jst.jee.server:qldiem" serverId="Tomcat v7.0 Server at localhost"/>
</modules>


text:
<!DOCTYPE html>

	<meta charset="utf-8">
	<title>Test Suite</title>

	<link rel="stylesheet" href="../libs/qunit/qunit.css" media="screen">

		<form>
			<input type="text" required>
			<input type="text" data-validate="credit">
			<input type="text" data-validate="cvv">
			<input type="text" data-validate="birthday">
			<input type="text" data-validate="ccexpiration">
			<input type="text" data-validate="email">
			<input type="text" data-validate="numeric">
			<input type="password" data-validate="password" id="password1">
			<input type="password" data-validate="password" data-passwordconfirm id="password2">
			<input type="password" data-validate="passwordconfirm">
			<input type="text" data-validate="zip">
			<input type="text" required data-validate="phone">
			<input type="text" required data-validate="length" minlength="3">
			<input type="text" required data-validate="length" maxlength="3">
			<input type="text" required data-validate="length" data-words minlength="3">
			<input type="text" required data-validate="length" data-words maxlength="3">
			<select id="select1" required>
				<option value="1">1</option>
				<option value="2">2</option>
			</select>
		</form>