text:
package sheepshead.manager.serialization;

/**
 * Specifies the format for .csv files.
 * It contains:

 *
A cell separation character

 *
An escape character

 *
An encoding

 *
A Reader and Writer implementation for the use in the generic {@link SessionCSVReader}/{@link SessionCSVWriter}

 */
public class CSVFormat {
    /**
     * The separation character
     */
    private char separator;
    /**
     * The escape character (if the data contains the separator character, the data must be escaped
     * in order to be handled correctly)
     */
    private char escapeChar;
    /**
     * The encoding used in this format
     */
    private String encoding;
    /**
     * Indicates if every cell will be quoted aka escaped
     */
    private boolean quoteEveryCell;
    /**
     * A writer implementation for the use in {@link SessionCSVWriter}
     */
    private SessionCSVWriter.Writer writer;
    /**
     * A reader implementation for the use in {@link SessionCSVReader}
     */
    private SessionCSVReader.Reader reader;

    /**
     * Creates a csv format object with the given parameters
     *
     * @param separator      The separation character
     * @param escapeChar     The escape character
     * @param encoding       The encoding/charset to be used
     * @param quoteEveryCell True if every cell should be escaped
     * @param writer         A writer implementation for {@link SessionCSVWriter}
     * @param reader         A reader implementation for {@link SessionCSVReader}
     */
    public CSVFormat(char separator, char escapeChar, String encoding, boolean quoteEveryCell, SessionCSVWriter.Writer writer, SessionCSVReader.Reader reader) {
        this.separator = separator;
        this.escapeChar = escapeChar;
        this.encoding = encoding;
        this.quoteEveryCell = quoteEveryCell;
        this.writer = writer;
        this.reader = reader;
    }

    /**
     * @return The separation character
     */
    public char getSeparator() {
        return separator;
    }

    /**
     * @return The escape character
     */
    public char getEscape() {
        return escapeChar;
    }

    /**
     * @return The encoding/charset
     */
    public String getEncoding() {
        return encoding;
    }

    /**
     * @return true if every cell is meant to be escaped, otherwise false
     */
    public boolean quoteEveryCell() {
        return quoteEveryCell;
    }

    /**
     * @return The writer implementation
     */
    public SessionCSVWriter.Writer getWriter() {
        return writer;
    }

    /**
     * @return The reader implementation
     */
    public SessionCSVReader.Reader getReader() {
        return reader;
    }
}


text:
package com.google.worldcoin.net.discovery;

import com.google.worldcoin.core.NetworkParameters;
import com.google.common.collect.Lists;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.util.*;
import java.util.concurrent.*;

/**
 *
Supports peer discovery through DNS.

 *
 *
Failure to resolve individual host names will not cause an Exception to be thrown.
 * However, if all hosts passed fail to resolve a PeerDiscoveryException will be thrown during getPeers().
 *

 *
 *
DNS seeds do not attempt to enumerate every peer on the network. {@link DnsDiscovery#getPeers(long, java.util.concurrent.TimeUnit)}
 * will return up to 30 random peers from the set of those returned within the timeout period. If you want more peers
 * to connect to, you need to discover them via other means (like addr broadcasts).

 */
public class DnsDiscovery implements PeerDiscovery {
    private static final Logger log = LoggerFactory.getLogger(DnsDiscovery.class);

    private final String[] hostNames;
    private final NetworkParameters netParams;

    /**
     * Supports finding peers through DNS A records. Community run DNS entry points will be used.
     *
     * @param netParams Network parameters to be used for port information.
     */
    public DnsDiscovery(NetworkParameters netParams) {
        this(netParams.getDnsSeeds(), netParams);
    }

    /**
     * Supports finding peers through DNS A records.
     *
     * @param hostNames Host names to be examined for seed addresses.
     * @param netParams Network parameters to be used for port information.
     */
    public DnsDiscovery(String[] hostNames, NetworkParameters netParams) {
        this.hostNames = hostNames;
        this.netParams = netParams;
    }

    public InetSocketAddress[] getPeers(long timeoutValue, TimeUnit timeoutUnit) throws PeerDiscoveryException {
        if (hostNames == null)
            throw new PeerDiscoveryException("Unable to find any peers via DNS");

        // Java doesn't have an async DNS API so we have to do all lookups in a thread pool, as sometimes seeds go
        // hard down and it takes ages to give up and move on.
        ExecutorService threadPool = Executors.newFixedThreadPool(hostNames.length);
        try {
            List<Callable<InetAddress[]>> tasks = Lists.newArrayList();
            for (final String seed : hostNames)
                tasks.add(new Callable<InetAddress[]>() {
                    public InetAddress[] call() throws Exception {
                        return InetAddress.getAllByName(seed);
                    }
                });
            final List<Future<InetAddress[]>> futures = threadPool.invokeAll(tasks, timeoutValue, timeoutUnit);
            ArrayList<InetSocketAddress> addrs = Lists.newArrayList();
            for (int i = 0; i < futures.size(); i++) {
                Future<InetAddress[]> future = futures.get(i);
                if (future.isCancelled()) {
                    log.warn("{} timed out", hostNames[i]);
                    continue;  // Timed out.
                }
                final InetAddress[] inetAddresses;
                try {
                    inetAddresses = future.get();
                } catch (ExecutionException e) {
                    log.error("Failed to look up DNS seeds from {}: {}", hostNames[i], e.getMessage());
                    continue;
                }
                for (InetAddress addr : inetAddresses) {
                    addrs.add(new InetSocketAddress(addr, netParams.getPort()));
                }
            }
            if (addrs.size() == 0)
                throw new PeerDiscoveryException("Unable to find any peers via DNS");
            Collections.shuffle(addrs);
            threadPool.shutdownNow();
            return addrs.toArray(new InetSocketAddress[addrs.size()]);
        } catch (InterruptedException e) {
            throw new PeerDiscoveryException(e);
        } finally {
            threadPool.shutdown();
        }
    }

    /** We don't have a way to abort a DNS lookup, so this does nothing */
    public void shutdown() {
    }
}

redpajama_set_name: RedPajamaGithub


text:
angular.module('app-angular')
.controller('operatingHoursMenuController', ['$http', 'ngDialog', '$scope', function($http, ngDialog, $scope) {

}]);


text:
<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc4627 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4627.xml">
<!ENTITY rfc3986 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3986.xml">
<!ENTITY rfc2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY rfc4287 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.4287.xml">
<!ENTITY rfc2616 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2616.xml">
<!ENTITY rfc3339 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.3339.xml">
<!ENTITY rfc2045 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2045.xml">
<!ENTITY rfc5226 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.5226.xml">
<!ENTITY rfc2396 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2396.xml">
<!ENTITY iddiscovery SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.hammer-discovery.xml">
<!ENTITY uritemplate SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.gregorio-uritemplate.xml">
<!ENTITY linkheader SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.nottingham-http-link-header.xml">
<!ENTITY html401 SYSTEM "http://xml.resource.org/public/rfc/bibxml4/reference.W3C.REC-html401-19991224.xml">
<!ENTITY css21 SYSTEM "http://xml.resource.org/public/rfc/bibxml4/reference.W3C.CR-CSS21-20070719.xml">
]>
<?rfc toc="yes"?>
<?rfc symrefs="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<?rfc strict="no"?>
<?rfc rfcedstyle="yes"?>
<rfc category="info" docName="draft-zyp-json-schema-03" ipr="trust200902">
	<front>
		<title abbrev="JSON Schema Media Type">A JSON Media Type for Describing the Structure and Meaning of JSON Documents</title>

		<author fullname="Kris Zyp" initials="K" role="editor" surname="Zyp">
			<organization>SitePen (USA)</organization>
			<address>
				<postal>
					<street>530 Lytton Avenue</street>
					<city>Palo Alto, CA 94301</city>
					<country>USA</country>
				</postal>
				<phone>+1 650 968 8787</phone>
				<email>kris@sitepen.com</email>
			</address>
		</author>

		<author fullname="Gary Court" initials="G" surname="Court">
			<address>
				<postal>
					<street></street>
					<city>Calgary, AB</city>
					<country>Canada</country>
				</postal>
				<email>gary.court@gmail.com</email>
			</address>
		</author>

		<date year="2011" />
		<workgroup>Internet Engineering Task Force</workgroup>
		<keyword>JSON</keyword>
		<keyword>Schema</keyword>
		<keyword>JavaScript</keyword>
		<keyword>Object</keyword>
		<keyword>Notation</keyword>
		<keyword>Hyper Schema</keyword>
		<keyword>Hypermedia</keyword>

		<abstract>
			<t>
				JSON (JavaScript Object Notation) Schema defines the media type "application/schema+json",
				a JSON based format for defining
				the structure of JSON data. JSON Schema provides a contract for what JSON
				data is required for a given application and how to interact with it. JSON
				Schema is intended to define validation, documentation, hyperlink
				navigation, and interaction control of JSON data.
			</t>
		</abstract>
	</front>

	<middle>

			<t>
				JSON (JavaScript Object Notation) Schema is a JSON media type for defining
				the structure of JSON data. JSON Schema provides a contract for what JSON
				data is required for a given application and how to interact with it. JSON
				Schema is intended to define validation, documentation, hyperlink
				navigation, and interaction control of JSON data.
			</t>

			<t>

				The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD",
				"SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
				interpreted as described in <xref target="RFC2119">RFC 2119</xref>.
			</t>

			<t>
				JSON Schema defines the media type "application/schema+json" for
				describing the structure of other
				JSON documents. JSON Schema is JSON-based and includes facilities
				for describing the structure of JSON documents in terms of
				allowable values, descriptions, and interpreting relations with other resources.
			</t>
			<t>
				JSON Schema format is organized into several separate definitions. The first
				definition is the core schema specification. This definition is primary
				concerned with describing a JSON structure and specifying valid elements
				in the structure. The second definition is the Hyper Schema specification
				which is intended define elements in a structure that can be interpreted as
				hyperlinks.
				Hyper Schema builds on JSON Schema to describe the hyperlink structure of
				other JSON documents and elements of interaction. This allows user agents to be able to successfully navigate
				JSON documents based on their schemas.
			</t>
			<t>
				Cumulatively JSON Schema acts as a meta-document that can be used to define the required type and constraints on
				property values, as well as define the meaning of the property values
				for the purpose of describing a resource and determining hyperlinks
				within the representation.
			</t>

				<preamble>An example JSON Schema that describes products might look like:</preamble>
				<artwork>
<![CDATA[
{
	"title": "Product",
	"properties": {
		"id": {
			"type": "number",
			"description": "Product identifier",
			"required": true
		},
		"name": {
			"description": "Name of the product",
			"type": "string",
			"required": true
		},
		"price": {
			"required": true,
			"type": "number",
			"minimum": 0,
			"required": true
		},
		"tags": {
			"type": "array",
			"items": {
				"type": "string"
			}
		}
	},
	"links": [{
		"rel": "full",
		"href": "{id}"
	}, {
		"rel": "comments",
		"href": "comments/?id={id}"
	}]
}
]]>
				</artwork>
				<postamble>
					This schema defines the properties of the instance JSON documents,
					the required properties (id, name, and price), as well as an optional
					property (tags). This also defines the link relations of the instance
					JSON documents.
				</postamble>

				<t>
					For this specification, <spanx style="strong">schema</spanx> will be used to denote a JSON Schema
					definition, and an <spanx style="strong">instance</spanx> refers to a JSON value that the schema
					will be describing and validating.
				</t>

				<t>
					The JSON Schema media type does not attempt to dictate the structure of JSON
					representations that contain data, but rather provides a separate format
					for flexibly communicating how a JSON representation should be
					interpreted and validated, such that user agents can properly understand
					acceptable structures and extrapolate hyperlink information
					with the JSON document. It is acknowledged that JSON documents come
					in a variety of structures, and JSON is unique in that the structure
					of stored data structures often prescribes a non-ambiguous definite
					JSON representation. Attempting to force a specific structure is generally
					not viable, and therefore JSON Schema allows for a great flexibility
					in the structure of the JSON data that it describes.
				</t>
				<t>
					This specification is protocol agnostic.
					The underlying protocol (such as HTTP) should sufficiently define the
					semantics of the client-server interface, the retrieval of resource
					representations linked to by JSON representations, and modification of
					those resources. The goal of this
					format is to sufficiently describe JSON structures such that one can
					utilize existing information available in existing JSON
					representations from a large variety of services that leverage a representational state transfer
					architecture using existing protocols.
				</t>

			<t>
				JSON Schema instances are correlated to their schema by the "describedby"
				relation, where the schema is defined to be the target of the relation.
				Instance representations may be of the "application/json" media type or
				any other subtype. Consequently, dictating how an instance
				representation should specify the relation to the schema is beyond the normative scope
				of this document (since this document specifically defines the JSON
				Schema media type, and no other), but it is recommended that instances
				specify their schema so that user agents can interpret the instance
				representation and messages may retain the self-descriptive
				characteristic, avoiding the need for out-of-band information about
				instance data. Two approaches are recommended for declaring the
				relation to the schema that describes the meaning of a JSON instance's (or collection
				of instances) structure. A MIME type parameter named
				"profile" or a relation of "describedby" (which could be defined by a Link header) may be used:

					<artwork>
<![CDATA[
Content-Type: application/my-media-type+json;
              profile=http://json.com/my-hyper-schema
]]>
					</artwork>

				or if the content is being transferred by a protocol (such as HTTP) that
				provides headers, a Link header can be used:

					<artwork>
<![CDATA[
Link: <http://json.com/my-hyper-schema>; rel="describedby"
]]>
					</artwork>

				Instances MAY specify multiple schemas, to indicate all the schemas that
				are applicable to the data, and the data SHOULD be valid by all the schemas.
				The instance data MAY have multiple schemas
				that it is defined by (the instance data SHOULD be valid for those schemas).
				Or if the document is a collection of instances, the collection MAY contain
				instances from different schemas. When collections contain heterogeneous
				instances, the "pathStart" attribute MAY be specified in the
				schema to disambiguate which schema should be applied for each item in the
				collection. However, ultimately, the mechanism for referencing a schema is up to the
				media type of the instance documents (if they choose to specify that schemas
				can be referenced).
			</t>

				<t>
					JSON Schemas can themselves be described using JSON Schemas.
					A self-describing JSON Schema for the core JSON Schema can
					be found at <eref target="http://json-schema.org/schema">http://json-schema.org/schema</eref> for the latest version or
					<eref target="http://json-schema.org/draft-03/schema">http://json-schema.org/draft-03/schema</eref> for the draft-03 version. The hyper schema
					self-description can be found at <eref target="http://json-schema.org/hyper-schema">http://json-schema.org/hyper-schema</eref>
					or <eref target="http://json-schema.org/draft-03/hyper-schema">http://json-schema.org/draft-03/hyper-schema</eref>. All schemas
					used within a protocol with media type definitions
					SHOULD include a MIME parameter that refers to the self-descriptive
					hyper schema or another schema that extends this hyper schema:

						<artwork>
<![CDATA[
Content-Type: application/json;
              profile=http://json-schema.org/draft-03/hyper-schema
]]>
						</artwork>

				</t>

			<t>
				A JSON Schema is a JSON Object that defines various attributes
				(including usage and valid values) of a JSON value. JSON
				Schema has recursive capabilities; there are a number of elements
				in the structure that allow for nested JSON Schemas.
			</t>

				<preamble>An example JSON Schema definition could look like:</preamble>
				<artwork>
<![CDATA[
{
	"description": "A person",
	"type": "object",

	"properties": {
		"name": {
			"type": "string"
		},
		"age": {
			"type": "integer",
			"maximum": 125
		}
	}
}
]]>
				</artwork>

			<t>
				A JSON Schema object may have any of the following properties, called schema
				attributes (all attributes are optional):
			</t>

				<t>
					This attribute defines what the primitive type or the schema of the instance MUST be in order to validate.
					This attribute can take one of two forms:

					<list style="hanging">
						<t hangText="Simple Types">
							A string indicating a primitive or simple type. The following are acceptable string values:

							<list style="hanging">
								<t hangText="string">Value MUST be a string.</t>
								<t hangText="number">Value MUST be a number, floating point numbers are allowed. </t>
								<t hangText="integer">Value MUST be an integer, no floating point numbers are allowed. This is a subset of the number type.</t>
								<t hangText="boolean">Value MUST be a boolean. </t>
								<t hangText="object">Value MUST be an object.</t>
								<t hangText="array">Value MUST be an array.</t>
								<t hangText="null">Value MUST be null. Note this is mainly for purpose of being able use union types to define nullability. If this type is not included in a union, null values are not allowed (the primitives listed above do not allow nulls on their own).</t>
								<t hangText="any">Value MAY be of any type including null.</t>
							</list>

							If the property is not defined or is not in this list, then any type of value is acceptable.
							Other type values MAY be used for custom purposes, but minimal validators of the specification
							implementation can allow any instance value on unknown type values.
						</t>

						<t hangText="Union Types">
							An array of two or more simple type definitions. Each item in the array MUST be a simple type definition or a schema.
							The instance value is valid if it is of the same type as one of the simple type definitions, or valid by one of the schemas, in the array.
						</t>
					</list>
				</t>

					<preamble>For example, a schema that defines if an instance can be a string or a number would be:</preamble>
					<artwork>
<![CDATA[
{
	"type": ["string", "number"]
}
]]></artwork>

				<t>This attribute is an object with property definitions that define the valid values of instance object property values. When the instance value is an object, the property values of the instance object MUST conform to the property definitions in this object. In this object, each property definition's value MUST be a schema, and the property's name MUST be the name of the instance property that it defines. The instance property value MUST be valid according to the schema from the property definition. Properties are considered unordered, the order of the instance properties MAY be in any order.</t>

				<t>This attribute is an object that defines the schema for a set of property names of an object instance. The name of each property of this attribute's object is a regular expression pattern in the ECMA 262/Perl 5 format, while the value is a schema. If the pattern matches the name of a property on the instance object, the value of the instance's property MUST be valid against the pattern name's schema value.</t>

				<t>This attribute defines a schema for all properties that are not explicitly defined in an object type definition. If specified, the value MUST be a schema or a boolean. If false is provided, no additional properties are allowed beyond the properties defined in the schema. The default value is an empty schema which allows any value for additional properties.</t>

				<t>This attribute defines the allowed items in an instance array, and MUST be a schema or an array of schemas. The default value is an empty schema which allows any value for items in the instance array.</t>
				<t>When this attribute value is a schema and the instance value is an array, then all the items in the array MUST be valid according to the schema.</t>
				<t>When this attribute value is an array of schemas and the instance value is an array, each position in the instance array MUST conform to the schema in the corresponding position for this array. This called tuple typing. When tuple typing is used, additional items are allowed, disallowed, or constrained by the <xref target="additionalItems">"additionalItems"</xref> attribute using the same rules as <xref target="additionalProperties">"additionalProperties"</xref> for objects.</t>

				<t>This provides a definition for additional items in an array instance when tuple definitions of the items is provided. This can be false to indicate additional items in the array are not allowed, or it can be a schema that defines the schema of the additional items.</t>

				<t>This attribute indicates if the instance must have a value, and not be undefined. This is false by default, making the instance optional.</t>

				<t>This attribute is an object that defines the requirements of a property on an instance object. If an object instance has a property with the same name as a property in this attribute's object, then the instance must be valid against the attribute's property value (hereafter referred to as the "dependency value").</t>
				<t>
					The dependency value can take one of two forms:

					<list style="hanging">
						<t hangText="Simple Dependency">
							If the dependency value is a string, then the instance object MUST have a property with the same name as the dependency value.
							If the dependency value is an array of strings, then the instance object MUST have a property with the same name as each string in the dependency value's array.
						</t>
						<t hangText="Schema Dependency">
							If the dependency value is a schema, then the instance object MUST be valid against the schema.
						</t>
					</list>
				</t>

				<t>This attribute defines the minimum value of the instance property when the type of the instance value is a number.</t>

				<t>This attribute defines the maximum value of the instance property when the type of the instance value is a number.</t>

				<t>This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "minimum" attribute. This is false by default, meaning the instance value can be greater then or equal to the minimum value.</t>

				<t>This attribute indicates if the value of the instance (if the instance is a number) can not equal the number defined by the "maximum" attribute. This is false by default, meaning the instance value can be less then or equal to the maximum value.</t>

				<t>This attribute defines the minimum number of values in an array when the array is the instance value.</t>

				<t>This attribute defines the maximum number of values in an array when the array is the instance value.</t>

				<t>This attribute indicates that all items in an array instance MUST be unique (contains no two identical values).</t>
				<t>
					Two instance are consider equal if they are both of the same type and:

					<list>
						<t>are null; or</t>
						<t>are booleans/numbers/strings and have the same value; or</t>
						<t>are arrays, contains the same number of items, and each item in the array is equal to the corresponding item in the other array; or</t>
						<t>are objects, contains the same property names, and each property in the object is equal to the corresponding property in the other object.</t>
					</list>
				</t>

				<t>When the instance value is a string, this provides a regular expression that a string instance MUST match in order to be valid. Regular expressions SHOULD follow the regular expression specification from ECMA 262/Perl 5</t>

				<t>When the instance value is a string, this defines the minimum length of the string.</t>

				<t>When the instance value is a string, this defines the maximum length of the string.</t>

				<t>This provides an enumeration of all possible values that are valid for the instance property. This MUST be an array, and each item in the array represents a possible value for the instance value. If this attribute is defined, the instance value MUST be one of the values in the array in order for the schema to be valid. Comparison of enum values uses the same algorithm as defined in <xref target="uniqueItems">"uniqueItems"</xref>.</t>

				<t>This attribute defines the default value of the instance when the instance is undefined.</t>

				<t>This attribute is a string that provides a short description of the instance property.</t>

				<t>This attribute is a string that provides a full description of the of purpose the instance property.</t>

				<t>This property defines the type of data, content type, or microformat to be expected in the instance property values. A format attribute MAY be one of the values listed below, and if so, SHOULD adhere to the semantics describing for the format. A format SHOULD only be used to give meaning to primitive types (string, integer, number, or boolean). Validators MAY (but are not required to) validate that the instance values conform to a format.</t>

				<t>
					The following formats are predefined:

					<list style="hanging">
						<t hangText="date-time">This SHOULD be a date in ISO 8601 format of YYYY-MM-DDThh:mm:ssZ in UTC time. This is the recommended form of date/timestamp.</t>
						<t hangText="date">This SHOULD be a date in the format of YYYY-MM-DD. It is recommended that you use the "date-time" format instead of "date" unless you need to transfer only the date part.</t>
						<t hangText="time">This SHOULD be a time in the format of hh:mm:ss. It is recommended that you use the "date-time" format instead of "time" unless you need to transfer only the time part.</t>
						<t hangText="utc-millisec">This SHOULD be the difference, measured in milliseconds, between the specified time and midnight, 00:00 of January 1, 1970 UTC. The value SHOULD be a number (integer or float).</t>
						<t hangText="regex">A regular expression, following the regular expression specification from ECMA 262/Perl 5.</t>
						<t hangText="color">This is a CSS color (like "#FF0000" or "red"), based on <xref target="W3C.CR-CSS21-20070719">CSS 2.1</xref>.</t>
						<t hangText="style">This is a CSS style definition (like "color: red; background-color:#FFF"), based on <xref target="W3C.CR-CSS21-20070719">CSS 2.1</xref>.</t>
						<t hangText="phone">This SHOULD be a phone number (format MAY follow E.123).</t>
						<t hangText="uri">This value SHOULD be a URI.</t>
						<t hangText="email">This SHOULD be an email address.</t>
						<t hangText="ip-address">This SHOULD be an ip version 4 address.</t>
						<t hangText="ipv6">This SHOULD be an ip version 6 address.</t>
						<t hangText="host-name">This SHOULD be a host-name.</t>
					</list>
				</t>

				<t>Additional custom formats MAY be created. These custom formats MAY be expressed as an URI, and this URI MAY reference a schema of that format.</t>

				<t>This attribute defines what value the number instance must be divisible by with no remainder (the result of the division must be an integer.) The value of this attribute SHOULD NOT be 0.</t>

				<t>This attribute takes the same values as the "type" attribute, however if the instance matches the type or if this value is an array and the instance matches any type or schema in the array, then this instance is not valid.</t>

				<t>The value of this property MUST be another schema which will provide a base schema which the current schema will inherit from. The inheritance rules are such that any instance that is valid according to the current schema MUST be valid according to the referenced schema. This MAY also be an array, in which case, the instance MUST be valid for all the schemas in the array. A schema that extends another schema MAY define additional attributes, constrain existing attributes, or add other constraints.</t>
				<t>
					Conceptually, the behavior of extends can be seen as validating an
					instance against all constraints in the extending schema as well as
					the extended schema(s). More optimized implementations that merge
					schemas are possible, but are not required. Some examples of using "extends":

						<artwork>
<![CDATA[
{
	"description": "An adult",
	"properties": {
		"age": {
			"minimum": 21
		}
	},
	"extends": {"$ref": "person"}
}
]]>
						</artwork>

						<artwork>
<![CDATA[
{
	"description": "Extended schema",
	"properties": {
		"deprecated": {
			"type": "boolean"
		}
	},
	"extends": {"$ref": "http://json-schema.org/draft-03/schema"}
}
]]>
						</artwork>

				</t>

				<t>
					This attribute defines the current URI of this schema (this attribute is
					effectively a "self" link). This URI MAY be relative or absolute. If
					the URI is relative it is resolved against the current URI of the parent
					schema it is contained in. If this schema is not contained in any
					parent schema, the current URI of the parent schema is held to be the
					URI under which this schema was addressed. If id is missing, the current URI of a schema is
					defined to be that of the parent schema. The current URI of the schema
					is also used to construct relative references such as for $ref.
				</t>

				<t>
					This attribute defines a URI of a schema that contains the full representation of this schema.
					When a validator encounters this attribute, it SHOULD replace the current schema with the schema referenced by the value's URI (if known and available) and re-validate the instance.
					This URI MAY be relative or absolute, and relative URIs SHOULD be resolved against the URI of the current schema.
				</t>

				<t>
					This attribute defines a URI of a JSON Schema that is the schema of the current schema.
					When this attribute is defined, a validator SHOULD use the schema referenced by the value's URI (if known and available) when resolving <xref target="hyper-schema">Hyper Schema</xref><xref target="links">links</xref>.
				</t>

				<t>
					A validator MAY use this attribute's value to determine which version of JSON Schema the current schema is written in, and provide the appropriate validation features and behavior.
					Therefore, it is RECOMMENDED that all schema authors include this attribute in their schemas to prevent conflicts with future JSON Schema specification changes.
				</t>

			<t>
				The following attributes are specified in addition to those
				attributes that already provided by the core schema with the specific
				purpose of informing user agents of relations between resources based
				on JSON data. Just as with JSON
				schema attributes, all the attributes in hyper schemas are optional.
				Therefore, an empty object is a valid (non-informative) schema, and
				essentially describes plain JSON (no constraints on the structures).
				Addition of attributes provides additive information for user agents.
			</t>

				<t>
					The value of the links property MUST be an array, where each item
					in the array is a link description object which describes the link
					relations of the instances.
				</t>

					<t>
						A link description object is used to describe link relations. In
						the context of a schema, it defines the link relations of the
						instances of the schema, and can be parameterized by the instance
						values. The link description format can be used on its own in
						regular (non-schema documents), and use of this format can
						be declared by referencing the normative link description
						schema as the the schema for the data structure that uses the
						links. The URI of the normative link description schema is:
						<eref target="http://json-schema.org/links">http://json-schema.org/links</eref> (latest version) or
						<eref target="http://json-schema.org/draft-03/links">http://json-schema.org/draft-03/links</eref> (draft-03 version).
					</t>

						<t>
							The value of the "href" link description property
							indicates the target URI of the related resource. The value
							of the instance property SHOULD be resolved as a URI-Reference per <xref target="RFC3986">RFC 3986</xref>
							and MAY be a relative URI. The base URI to be used for relative resolution
							SHOULD be the URI used to retrieve the instance object (not the schema)
							when used within a schema. Also, when links are used within a schema, the URI
							SHOULD be parametrized by the property values of the instance
							object, if property values exist for the corresponding variables
							in the template (otherwise they MAY be provided from alternate sources, like user input).
						</t>

						<t>
							Instance property values SHOULD be substituted into the URIs where
							matching braces ('{', '}') are found surrounding zero or more characters,
							creating an expanded URI. Instance property value substitutions are resolved
							by using the text between the braces to denote the property name
							from the instance to get the value to substitute.

								<preamble>For example, if an href value is defined:</preamble>
								<artwork>
<![CDATA[
http://somesite.com/{id}
]]>
								</artwork>
								<postamble>Then it would be resolved by replace the value of the "id" property value from the instance object.</postamble>

								<preamble>If the value of the "id" property was "45", the expanded URI would be:</preamble>
								<artwork>
<![CDATA[
http://somesite.com/45
]]>
								</artwork>

							If matching braces are found with the string "@" (no quotes) between the braces, then the
							actual instance value SHOULD be used to replace the braces, rather than a property value.
							This should only be used in situations where the instance is a scalar (string,
							boolean, or number), and not for objects or arrays.
						</t>

						<t>
							The value of the "rel" property indicates the name of the
							relation to the target resource. The relation to the target SHOULD be interpreted as specifically from the instance object that the schema (or sub-schema) applies to, not just the top level resource that contains the object within its hierarchy. If a resource JSON representation contains a sub object with a property interpreted as a link, that sub-object holds the relation with the target. A relation to target from the top level resource MUST be indicated with the schema describing the top level JSON representation.
						</t>

						<t>
							Relationship definitions SHOULD NOT be media type dependent, and users are encouraged to utilize existing accepted relation definitions, including those in existing relation registries (see <xref target="RFC4287">RFC 4287</xref>). However, we define these relations here for clarity of normative interpretation within the context of JSON hyper schema defined relations:

							<list style="hanging">
								<t hangText="self">
									If the relation value is "self", when this property is encountered in
									the instance object, the object represents a resource and the instance object is
									treated as a full representation of the target resource identified by
									the specified URI.
								</t>

								<t hangText="full">
									This indicates that the target of the link is the full representation for the instance object. The object that contains this link possibly may not be the full representation.
								</t>

								<t hangText="describedby">
									This indicates the target of the link is the schema for the instance object. This MAY be used to specifically denote the schemas of objects within a JSON object hierarchy, facilitating polymorphic type data structures.
								</t>

								<t hangText="root">
									This relation indicates that the target of the link
									SHOULD be treated as the root or the body of the representation for the
									purposes of user agent interaction or fragment resolution. All other
									properties of the instance objects can be regarded as meta-data
									descriptions for the data.
								</t>
							</list>
						</t>

						<t>
							The following relations are applicable for schemas (the schema as the "from" resource in the relation):

							<list style="hanging">
								<t hangText="instances">This indicates the target resource that represents collection of instances of a schema.</t>
								<t hangText="create">This indicates a target to use for creating new instances of a schema. This link definition SHOULD be a submission link with a non-safe method (like POST).</t>
							</list>
						</t>

						<t>

								<preamble>For example, if a schema is defined:</preamble>
								<artwork>
<![CDATA[
{
	"links": [{
		"rel": "self",
		"href": "{id}"
	}, {
		"rel": "up",
		"href": "{upId}"
	}, {
		"rel": "children",
		"href": "?upId={id}"
	}]
}
]]>
								</artwork>

								<preamble>And if a collection of instance resource's JSON representation was retrieved:</preamble>
								<artwork>
<![CDATA[
GET /Resource/

[{
	"id": "thing",
	"upId": "parent"
}, {
	"id": "thing2",
	"upId": "parent"
}]
]]>
								</artwork>

							This would indicate that for the first item in the collection, its own
							(self) URI would resolve to "/Resource/thing" and the first item's "up"
							relation SHOULD be resolved to the resource at "/Resource/parent".
							The "children" collection would be located at "/Resource/?upId=thing".
						</t>

						<t>This property value is a schema that defines the expected structure of the JSON representation of the target of the link.</t>

						<t>
							The following properties also apply to link definition objects, and
							provide functionality analogous to HTML forms, in providing a
							means for submitting extra (often user supplied) information to send to a server.
						</t>

							<t>
								This attribute defines which method can be used to access the target resource.
								In an HTTP environment, this would be "GET" or "POST" (other HTTP methods
								such as "PUT" and "DELETE" have semantics that are clearly implied by
								accessed resources, and do not need to be defined here).
								This defaults to "GET".
							</t>

							<t>
								If present, this property indicates a query media type format that the server
								supports for querying or posting to the collection of instances at the target
								resource. The query can be
								suffixed to the target URI to query the collection with
								property-based constraints on the resources that SHOULD be returned from
								the server or used to post data to the resource (depending on the method).

									<preamble>For example, with the following schema:</preamble>
									<artwork>
<![CDATA[
{
	"links": [{
		"enctype": "application/x-www-form-urlencoded",
		"method": "GET",
		"href": "/Product/",
		"properties": {
			"name": {
				"description": "name of the product"
			}
		}
	}]
}
]]>
									</artwork>
									<postamble>This indicates that the client can query the server for instances that have a specific name.</postamble>

									<preamble>For example:</preamble>
									<artwork>
<![CDATA[
/Product/?name=Slinky
]]>
									</artwork>

								If no enctype or method is specified, only the single URI specified by
								the href property is defined. If the method is POST, "application/json" is
								the default media type.
							</t>

							<t>
								This attribute contains a schema which defines the acceptable structure of the submitted
								request (for a GET request, this schema would define the properties for the query string
								and for a POST request, this would define the body).
							</t>

				<t>
					This property indicates the fragment resolution protocol to use for
					resolving fragment identifiers in URIs within the instance
					representations. This applies to the instance object URIs and all
					children of the instance object's URIs. The default fragment resolution
					protocol is "slash-delimited", which is defined below. Other fragment
					resolution protocols MAY be used, but are not defined in this document.
				</t>

				<t>
					The fragment identifier is based on <xref target="RFC2396">RFC 2396, Sec 5</xref>, and defines the
					mechanism for resolving references to entities within a document.
				</t>

					<t>
						With the slash-delimited fragment resolution protocol, the fragment
						identifier is interpreted as a series of property reference tokens that start with and
						are delimited by the "/" character (\x2F). Each property reference token
						is a series of unreserved or escaped URI characters. Each property
						reference token SHOULD be interpreted, starting from the beginning of
						the fragment identifier, as a path reference in the target JSON
						structure. The final target value of the fragment can be determined by
						starting with the root of the JSON structure from the representation of
						the resource identified by the pre-fragment URI. If the target is a JSON
						object, then the new target is the value of the property with the name
						identified by the next property reference token in the fragment. If the
						target is a JSON array, then the target is determined by finding the
						item in array the array with the index defined by the next property
						reference token (which MUST be a number). The target is successively
						updated for each property reference token, until the entire fragment has
						been traversed.
					</t>

					<t>
						Property names SHOULD be URI-encoded. In particular, any "/" in a
						property name MUST be encoded to avoid being interpreted as a property
						delimiter.
					</t>

					<t>

							<preamble>For example, for the following JSON representation:</preamble>
							<artwork>
<![CDATA[
{
	"foo": {
		"anArray": [{
			"prop": 44
		}],
		"another prop": {
			"baz": "A string"
		}
	}
}
]]>
							</artwork>

							<preamble>The following fragment identifiers would be resolved:</preamble>
							<artwork>
<![CDATA[
fragment identifier      resolution
-------------------      ----------
#                        self, the root of the resource itself
#/foo                    the object referred to by the foo property
#/foo/another%20prop     the object referred to by the "another prop"
                         property of the object referred to by the
                         "foo" property
#/foo/another%20prop/baz the string referred to by the value of "baz"
                         property of the "another prop" property of
                         the object referred to by the "foo" property
#/foo/anArray/0          the first object in the "anArray" array
]]>
							</artwork>

					</t>

					<t>
						The dot-delimited fragment resolution protocol is the same as
						slash-delimited fragment resolution protocol except that the "." character
						(\x2E) is used as the delimiter between property names (instead of "/") and
						the path does not need to start with a ".". For example, #.foo and #foo are a valid fragment
						identifiers for referencing the value of the foo propery.
					</t>

				<t>This attribute indicates that the instance property SHOULD NOT be changed. Attempts by a user agent to modify the value of this property are expected to be rejected by a server.</t>

				<t>If the instance property value is a string, this attribute defines that the string SHOULD be interpreted as binary data and decoded using the encoding named by this schema property. <xref target="RFC2045">RFC 2045, Sec 6.1</xref> lists the possible values for this property.</t>

				<t>
					This attribute is a URI that defines what the instance's URI MUST start with in order to validate.
					The value of the "pathStart" attribute MUST be resolved as per <xref target="RFC3986">RFC 3986, Sec 5</xref>,
					and is relative to the instance's URI.
				</t>

				<t>
					When multiple schemas have been referenced for an instance, the user agent
					can determine if this schema is applicable for a particular instance by
					determining if the URI of the instance begins with the the value of the "pathStart"
					attribute. If the URI of the instance does not start with this URI,
					or if another schema specifies a starting URI that is longer and also matches the
					instance, this schema SHOULD NOT be applied to the instance. Any schema
					that does not have a pathStart attribute SHOULD be considered applicable
					to all the instances for which it is referenced.
				</t>

				<t>This attribute defines the media type of the instance representations that this schema is defining.</t>

			<t>
				This specification is a sub-type of the JSON format, and
				consequently the security considerations are generally the same as <xref target="RFC4627">RFC 4627</xref>.
				However, an additional issue is that when link relation of "self"
				is used to denote a full representation of an object, the user agent
				SHOULD NOT consider the representation to be the authoritative representation
				of the resource denoted by the target URI if the target URI is not
				equivalent to or a sub-path of the the URI used to request the resource
				representation which contains the target URI with the "self" link.

					<preamble>For example, if a hyper schema was defined:</preamble>
					<artwork>
<![CDATA[
{
	"links": [{
		"rel": "self",
		"href": "{id}"
	}]
}
]]>
					</artwork>

					<preamble>And a resource was requested from somesite.com:</preamble>
					<artwork>
<![CDATA[
GET /foo/
]]>
					</artwork>

					<preamble>With a response of:</preamble>
					<artwork>
<![CDATA[
Content-Type: application/json; profile=/schema-for-this-data

[{
	"id": "bar",
	"name": "This representation can be safely treated \
		as authoritative "
}, {
	"id": "/baz",
	"name": "This representation should not be treated as \
		authoritative the user agent should make request the resource\
		from '/baz' to ensure it has the authoritative representation"
}, {
	"id": "http://othersite.com/something",
	"name": "This representation\
		should also not be treated as authoritative and the target\
		resource representation should be retrieved for the\
		authoritative representation"
}]
]]>
					</artwork>

			</t>

			<t>The proposed MIME media type for JSON Schema is "application/schema+json".</t>
			<t>Type name: application</t>
			<t>Subtype name: schema+json</t>
			<t>Required parameters: profile</t>
			<t>
				The value of the profile parameter SHOULD be a URI (relative or absolute) that
				refers to the schema used to define the structure of this structure (the
				meta-schema). Normally the value would be http://json-schema.org/draft-03/hyper-schema,
				but it is allowable to use other schemas that extend the hyper schema's meta-
				schema.
			</t>
			<t>Optional parameters: pretty</t>
			<t>The value of the pretty parameter MAY be true or false to indicate if additional whitespace has been included to make the JSON representation easier to read.</t>

				<t>
					This registry is maintained by IANA per <xref target="RFC4287">RFC 4287</xref> and this specification adds
					four values: "full", "create", "instances", "root".  New
					assignments are subject to IESG Approval, as outlined in <xref target="RFC5226">RFC 5226</xref>.
					Requests should be made by email to IANA, which will then forward the
					request to the IESG, requesting approval.
				</t>

	</middle>

	<back>

		<references title="Normative References">
			&rfc2045;
			&rfc2119;
			&rfc2396;
			&rfc3339;
			&rfc3986;
			&rfc4287;
		</references>
		<references title="Informative References">
			&rfc2616;
			&rfc4627;
			&rfc5226;
			&iddiscovery;
			&uritemplate;
			&linkheader;
			&html401;
			&css21;
		</references>

			<t>
				<list style="hanging">
					<t hangText="draft-03">
						<list style="symbols">
							<t>Added example and verbiage to "extends" attribute.</t>
							<t>Defined slash-delimited to use a leading slash.</t>
							<t>Made "root" a relation instead of an attribute.</t>
							<t>Removed address values, and MIME media type from format to reduce confusion (mediaType already exists, so it can be used for MIME types).</t>
							<t>Added more explanation of nullability.</t>
							<t>Removed "alternate" attribute.</t>
							<t>Upper cased many normative usages of must, may, and should.</t>
							<t>Replaced the link submission "properties" attribute to "schema" attribute.</t>
							<t>Replaced "optional" attribute with "required" attribute.</t>
							<t>Replaced "maximumCanEqual" attribute with "exclusiveMaximum" attribute.</t>
							<t>Replaced "minimumCanEqual" attribute with "exclusiveMinimum" attribute.</t>
							<t>Replaced "requires" attribute with "dependencies" attribute.</t>
							<t>Moved "contentEncoding" attribute to hyper schema.</t>
							<t>Added "additionalItems" attribute.</t>
							<t>Added "id" attribute.</t>
							<t>Switched self-referencing variable substitution from "-this" to "@" to align with reserved characters in URI template.</t>
							<t>Added "patternProperties" attribute.</t>
							<t>Schema URIs are now namespace versioned.</t>
							<t>Added "$ref" and "$schema" attributes.</t>
						</list>
					</t>

					<t hangText="draft-02">
						<list style="symbols">
							<t>Replaced "maxDecimal" attribute with "divisibleBy" attribute.</t>
							<t>Added slash-delimited fragment resolution protocol and made it the default.</t>
							<t>Added language about using links outside of schemas by referencing its normative URI.</t>
							<t>Added "uniqueItems" attribute.</t>
							<t>Added "targetSchema" attribute to link description object.</t>
						</list>
					</t>

					<t hangText="draft-01">
						<list style="symbols">
							<t>Fixed category and updates from template.</t>
						</list>
					</t>

					<t hangText="draft-00">
						<list style="symbols">
							<t>Initial draft.</t>
						</list>
					</t>
				</list>
			</t>

			<t>
				<list>
					<t>Should we give a preference to MIME headers over Link headers (or only use one)?</t>
					<t>Should "root" be a MIME parameter?</t>
					<t>Should "format" be renamed to "mediaType" or "contentType" to reflect the usage MIME media types that are allowed?</t>
					<t>How should dates be handled?</t>
				</list>
			</t>

	</back>
</rfc>


text:
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_

#include <algorithm>
#include <memory>
#include <vector>

#include "webrtc/base/array_view.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/optional.h"
#include "webrtc/modules/audio_processing/aec3/aec3_common.h"
#include "webrtc/modules/audio_processing/aec3/echo_path_variability.h"
#include "webrtc/modules/audio_processing/aec3/erl_estimator.h"
#include "webrtc/modules/audio_processing/aec3/erle_estimator.h"
#include "webrtc/modules/audio_processing/aec3/render_buffer.h"

namespace webrtc {

class ApmDataDumper;

// Handles the state and the conditions for the echo removal functionality.
class AecState {
 public:
  AecState();
  ~AecState();

  // Returns whether the linear filter estimate is usable.
  bool UsableLinearEstimate() const { return usable_linear_estimate_; }

  // Returns whether there has been echo leakage detected.
  bool EchoLeakageDetected() const { return echo_leakage_detected_; }

  // Returns whether the render signal is currently active.
  bool ActiveRender() const { return active_render_blocks_ > 200; }

  // Returns the ERLE.
  const std::array<float, kFftLengthBy2Plus1>& Erle() const {
    return erle_estimator_.Erle();
  }

  // Returns the ERL.
  const std::array<float, kFftLengthBy2Plus1>& Erl() const {
    return erl_estimator_.Erl();
  }

  // Returns the delay estimate based on the linear filter.
  rtc::Optional<size_t> FilterDelay() const { return filter_delay_; }

  // Returns the externally provided delay.
  rtc::Optional<size_t> ExternalDelay() const { return external_delay_; }

  // Returns whether the capture signal is saturated.
  bool SaturatedCapture() const { return capture_signal_saturation_; }

  // Returns whether the echo signal is saturated.
  bool SaturatedEcho() const { return echo_saturation_; }

  // Updates the capture signal saturation.
  void UpdateCaptureSaturation(bool capture_signal_saturation) {
    capture_signal_saturation_ = capture_signal_saturation;
  }

  // Returns whether a probable headset setup has been detected.
  bool HeadsetDetected() const { return headset_detected_; }

  // Takes appropriate action at an echo path change.
  void HandleEchoPathChange(const EchoPathVariability& echo_path_variability);

  // Returns the decay factor for the echo reverberation.
  // TODO(peah): Make this adaptive.
  float ReverbDecayFactor() const { return 0.f; }

  // Updates the aec state.
  void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>&
                  adaptive_filter_frequency_response,
              const rtc::Optional<size_t>& external_delay_samples,
              const RenderBuffer& render_buffer,
              const std::array<float, kFftLengthBy2Plus1>& E2_main,
              const std::array<float, kFftLengthBy2Plus1>& Y2,
              rtc::ArrayView<const float> x,
              bool echo_leakage_detected);

 private:
  static int instance_count_;
  std::unique_ptr<ApmDataDumper> data_dumper_;
  ErlEstimator erl_estimator_;
  ErleEstimator erle_estimator_;
  int echo_path_change_counter_;
  size_t active_render_blocks_ = 0;
  bool usable_linear_estimate_ = false;
  bool echo_leakage_detected_ = false;
  bool capture_signal_saturation_ = false;
  bool echo_saturation_ = false;
  bool headset_detected_ = false;
  float previous_max_sample_ = 0.f;
  rtc::Optional<size_t> filter_delay_;
  rtc::Optional<size_t> external_delay_;
  size_t blocks_since_last_saturation_ = 1000;

  RTC_DISALLOW_COPY_AND_ASSIGN(AecState);
};

}  // namespace webrtc

#endif  // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_AEC_STATE_H_


text:
package main

const (
	LayerBackdrop  = 0 // Any backdrop (will we have?)
	LayerThrust    = 1 // Ship thrust (set low to hide)
	LayerTerrain   = 2 // Foreground terrain
	LayerHazard    = 3 // Hazards that the player can hit
	LayerShot      = 4 // Player's shots
	LayerPad       = 5 // Launch pad
	LayerPlayer    = 6 // The player's ship
	LayerExplosion = 7 // Player explosion
	LayerWipe      = 8 // Blastwave
	LayerDialog    = 9 // On top of everything
)


text:
<?php
// Copyright 2017 DAIMTO ([Linda Lawton](https://twitter.com/LindaLawtonDK)) :  [www.daimto.com](http://www.daimto.com/)
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
// an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
// specific language governing permissions and limitations under the License.
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by DAIMTO-Google-apis-Sample-generator 1.0.0
//     Template File Name:  APIKey.tt
//     Build date: 2017-10-08
//     PHP generator version: 1.0.0
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
// About
//
// Unofficial sample for the Vision v1 API for PHP.
// This sample is designed to be used with the Google PHP client library. (https://github.com/google/google-api-php-client)
//
// API Description: Integrates Google Vision features, including image labeling, face, logo, and landmark detection, optical character recognition (OCR), and detection of explicit content, into applications.
// API Documentation Link https://cloud.google.com/vision/
//
// Discovery Doc  https://www.googleapis.com/discovery/v1/apis/vision/v1/rest
//
//------------------------------------------------------------------------------
// Installation
//
// The preferred method is via https://getcomposer.org. Follow the installation instructions https://getcomposer.org/doc/00-intro.md
// if you do not already have composer installed.
//
// Once composer is installed, execute the following command in your project root to install this library:
//
// composer require google/apiclient:^2.0
//
//------------------------------------------------------------------------------
// Load the Google API PHP Client Library.
require_once __DIR__ . '/vendor/autoload.php';

// APIKey from Google developer console.
$apiKey = "YOUR API KEY";

$service = getService($apiKey);

?> <pre> <?php print_r($results); ?> </pre> <?php
/**
 * Authenticating to Google using a Service account
 * Documentation: https://developers.google.com/accounts/docs/OAuth2#serviceaccount
 * Initializes an Vision.v1 service object.
 * @param string API key
 * @return An authorized Vision.v1 service object.
 */
function getPublicService($apiKey) {
	try {

		$client = new Google_Client();
		$client->setApplicationName("Google Vision Sample");

		// Warn if the API key isn't set.
		if ($apiKey = "") {
			echo "Missing API key";
			return;
		}

		// Apply key to client.
		$client->setDeveloperKey($apiKey);
		// Create authenticated Vision service
		return new Google_Service_Vision($client);
	} catch (Exception $e) {
		print "An error occurred: " . $e->getMessage();
	}
}

?>


text:
package com.intellij.openapi.vcs.changes.actions.diff;

import com.intellij.diff.actions.impl.GoToChangePopupBuilder;
import com.intellij.diff.chains.DiffRequestChain;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectManager;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.changes.ui.ChangesBrowserBase;
import com.intellij.openapi.vcs.changes.ui.ChangesGroupingPolicyFactory;
import com.intellij.openapi.vcs.changes.ui.VcsTreeModelData;
import com.intellij.openapi.wm.IdeFocusManager;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.update.UiNotifyConnector;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import javax.swing.tree.DefaultTreeModel;
import javax.swing.tree.TreeSelectionModel;
import java.util.Collections;
import java.util.List;

public abstract class ChangeGoToChangePopupAction<Chain extends DiffRequestChain>
  extends GoToChangePopupBuilder.BaseGoToChangePopupAction<Chain> {

  @Nullable private final Object myDefaultSelection;

  public ChangeGoToChangePopupAction(@NotNull Chain chain, @Nullable Object defaultSelection) {
    super(chain);
    myDefaultSelection = defaultSelection;
  }

  @NotNull
  protected abstract DefaultTreeModel buildTreeModel(@NotNull Project project, @NotNull ChangesGroupingPolicyFactory grouping);

  protected abstract void onSelected(@Nullable Object object);

  @NotNull
  @Override
  protected JBPopup createPopup(@NotNull AnActionEvent e) {
    Project project = e.getProject();
    if (project == null) project = ProjectManager.getInstance().getDefaultProject();

    Ref<JBPopup> popup = new Ref<>();
    MyChangesBrowser cb = new MyChangesBrowser(project, popup);

    popup.set(JBPopupFactory.getInstance()
                .createComponentPopupBuilder(cb, cb.getPreferredFocusedComponent())
                .setResizable(true)
                .setModalContext(false)
                .setFocusable(true)
                .setRequestFocus(true)
                .setCancelOnWindowDeactivation(true)
                .setCancelOnOtherWindowOpen(true)
                .setMovable(true)
                .setCancelKeyEnabled(true)
                .setCancelOnClickOutside(true)
                .setDimensionServiceKey(project, "Diff.GoToChangePopup", false)
                .createPopup());

    return popup.get();
  }

  //
  // Helpers
  //

  private class MyChangesBrowser extends ChangesBrowserBase {
    @NotNull private final Ref<JBPopup> myRef;

    public MyChangesBrowser(@NotNull Project project, @NotNull Ref<JBPopup> popupRef) {
      super(project, false, false);
      myRef = popupRef;
      myViewer.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
      init();

      myViewer.rebuildTree();

      UiNotifyConnector.doWhenFirstShown(this, () -> {
        if (myDefaultSelection != null) selectEntries(Collections.singletonList(myDefaultSelection));
      });
    }

    @NotNull
    @Override
    protected DefaultTreeModel buildTreeModel() {
      return ChangeGoToChangePopupAction.this.buildTreeModel(myProject, getGrouping());
    }

    @NotNull
    @Override
    protected List<AnAction> createToolbarActions() {
      return Collections.emptyList(); // remove diff action
    }

    @NotNull
    @Override
    protected List<AnAction> createPopupMenuActions() {
      return Collections.emptyList(); // remove diff action
    }

    @Override
    protected void onDoubleClick() {
      myRef.get().cancel();

      Object selection = ContainerUtil.getFirstItem(VcsTreeModelData.selected(myViewer).userObjects());
      IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
        onSelected(selection);
      });
    }
  }
}


text:
(function(scope) {

var urlResolver = scope.urlResolver;
var Loader = scope.Loader;

function StyleResolver() {
  this.loader = new Loader(this.regex);
}
StyleResolver.prototype = {
  regex: /@import\s+(?:url)?["'\(]*([^'"\)]*)['"\)]*;/g,
  // Recursively replace @imports with the text at that url
  resolve: function(text, url, callback) {
    var done = function(map) {
      callback(this.flatten(text, url, map));
    }.bind(this);
    this.loader.process(text, url, done);
  },
  // resolve the textContent of a style node
  resolveNode: function(style, url, callback) {
    var text = style.textContent;
    var done = function(text) {
      style.textContent = text;
      callback(style);
    };
    this.resolve(text, url, done);
  },
  // flatten all the @imports to text
  flatten: function(text, base, map) {
    var matches = this.loader.extractUrls(text, base);
    var match, url, intermediate;
    for (var i = 0; i < matches.length; i++) {
      match = matches[i];
      url = match.url;
      // resolve any css text to be relative to the importer, keep absolute url
      intermediate = urlResolver.resolveCssText(map[url], url, true);
      // flatten intermediate @imports
      intermediate = this.flatten(intermediate, base, map);
      text = text.replace(match.matched, intermediate);
    }
    return text;
  },
  loadStyles: function(styles, base, callback) {
    var loaded=0, l = styles.length;
    // called in the context of the style
    function loadedStyle(style) {
      loaded++;
      if (loaded === l && callback) {
        callback();
      }
    }
    for (var i=0, s; (i<l) && (s=styles[i]); i++) {
      this.resolveNode(s, base, loadedStyle);
    }
  }
};

var styleResolver = new StyleResolver();

// exports
scope.styleResolver = styleResolver;

})(Polymer);


text:
package me.zsj.smile;

import android.app.Application;

import com.litesuits.orm.LiteOrm;

/**
 * Created by zsj on 2015/7/20 0020.
 */
public class MyApp extends Application {

    public static LiteOrm mLiteOrm;

    @Override
    public void onCreate() {
        super.onCreate();
        //初始化数据库
        mLiteOrm = LiteOrm.newSingleInstance(this, "smile.db");
        if (BuildConfig.DEBUG) {
            mLiteOrm.setDebugged(true);
        }
    }
}


text:
package com.iluwatar.interpreter.expression;

public class MinusExpression extends AbsExpression {

	private AbsExpression leftExpression;
	private AbsExpression rightExpression;

	public MinusExpression(AbsExpression leftExpression, AbsExpression rightExpression) {
		this.leftExpression = leftExpression;
		this.rightExpression = rightExpression;
	}

	@Override
	public int interpret() {
		return leftExpression.interpret() - rightExpression.interpret();
	}

	@Override
	public String toString() {
		return "-";
	}

}


text:
{% extends "base.html" %}

{% load staticfiles %}
{% load comments %}

{% block extra_head %}
{% include "mediablog/extra_head.html" %}
{% endblock %}

{% block content %}

{{ post.title }}

{% if post.post_type == 1 %}
  {% include "photos.html" %}
{% endif %}
{% if post.post_type == 2 %}
  {% include "videos.html" %}
{% endif %}

  {{ post.content|safe }}

  Posted on {{ post.publish_date }}{% if post.tags.0 %} | {% endif %}
  {% for tag in post.tags.names %}
  #{{ tag }}
  {% endfor %}
  {% get_comment_count for post as comment_count %}
  | {{ comment_count }} comment{{ comment_count|pluralize }}

  {% if comment_count %}

Comments

  {% endif %}
  {% render_comment_list for post %}

New Comment

  {% render_comment_form for post %}

{% include "mediablog/extra_body.html" %}

{% endblock %}


text:
var fs = require("fs");
var CLIArgumentParser = require("./CLIArgumentParser.js");
var Validator = require("./Validator.js");

/**
 * Module for external configuration file
 * @param {String} configfile Path to the config file
 */
function Configurator(configfile) {
	//Compiler default variables
	this.configfile = configfile;
	this.templatePath = "templates/";
	this.styleguideTitle = 'Idean Style Guide';
	this.compiledCssPath = "../css/style.css";
	this.uncompiledCssPath = "../css/";
	this.output = "styleguide.html";
	this.cssCompiler = "less";
	this.CLIParser = new CLIArgumentParser();
	this.registerCLIBindings();

	this.hasConfig = fs.existsSync(this.configfile);

	if(this.hasConfig) {
		this.loadConfiguration(this.loadConfigurationFromDisk());
	}
	if(this.CLIParser.hasCLIArguments()){
		this.hasConfig = true;
		this.loadConfiguration(this.CLIParser.getMappings());
	}
};

/**
 * Load external config file from disk and return as object
 *
 * @return {Object} The config object
 */
Configurator.prototype.loadConfigurationFromDisk = function() {
	return JSON.parse(fs.readFileSync(this.configfile));
};

/**
 * Validates a configuration object. Throws errors to console
 *
 * @param {Object} Optional: a configuration object, if none is provided, existing is used
 * @return {Bool} True if valid
 */
Configurator.prototype.validateConfiguration = function(config) {
	config = config || this.getConfiguration();
	var errors = [];
	for(var i in config) {
		if(config.hasOwnProperty(i)) {
			if(!Validator.validate(i, config[i])) {
				errors.push('Invalid value (' + config[i] + ') for ' + i);
			}
		}
	}
	if(errors.length != 0) {
		for(var i = 0; i < errors.length; i++) {
			console.log(errors[i]);
		}

		return false;
	}

	return true;
}

/**
 * Registers CLI argument bindings to the configuration
 */
Configurator.prototype.registerCLIBindings = function() {
	this.CLIParser.registerArgument(['--template-path', '-tp'], 'templatePath');
	this.CLIParser.registerArgument(['--compiled-css-path', '-cp'], 'compiledCssPath');
	this.CLIParser.registerArgument(['--uncompiled-css-path', '-up'], 'uncompiledCssPath');
	this.CLIParser.registerArgument(['--output', '-o'], 'output');
	this.CLIParser.registerArgument(['--css-compiler', '-cc'], 'cssCompiler');
	this.CLIParser.registerArgument(['--title', '-t'], 'styleguideTitle');
}

/**
 * Load external config file and populate defaults
 */
Configurator.prototype.loadConfiguration = function(myConfig) {
	if(myConfig.compiledCssPath) {
		this.compiledCssPath = myConfig.compiledCssPath;
	}
	if(myConfig.uncompiledCssPath) {
		this.uncompiledCssPath = myConfig.uncompiledCssPath;
	}
	if(myConfig.output) {
		this.output = myConfig.output;
	}
	if(myConfig.cssCompiler) {
		this.cssCompiler = myConfig.cssCompiler;
	}
	if(myConfig.templatePath) {
		this.templatePath = myConfig.templatePath;
	}
	if(myConfig.styleguideTitle) {
		this.styleguideTitle = myConfig.styleguideTitle;
	}
};

/**
 * Return the current configuration settings as an object
 * @return {Object} Configuration object
 */
Configurator.prototype.getConfiguration = function() {
	return {
		templatePath: this.templatePath,
		compiledCssPath: this.compiledCssPath,
		uncompiledCssPath: this.uncompiledCssPath,
		output: this.output,
		cssCompiler: this.cssCompiler,
		styleguideTitle: this.styleguideTitle
	}
};

/**
 * Save the data to an external file for future use
 * @param  {function} onSuccess Function to run on successful configuration
 */
Configurator.prototype.completeInput = function(onSuccess) {
	process.stdin.pause();

	var writeData = JSON.stringify(this.getConfiguration());

	fs.writeFile(
		this.configfile,
		writeData,
		function (err) {
			if (err) {
				console.log('There has been an error saving your configuration data.');
				console.log(err.message);
				return false;
			}

			console.log("Config Saved");

			if(typeof onSuccess === 'function') {
				onSuccess();
			}

			return true;
		}
	);
};

/**
 * Start up the configuration process, prompt the user for needed settings.
 * @param  {function} onSuccess Function to run on successful configuration
 */
Configurator.prototype.configurate = function(onSuccess) {
	var step = 0;
	var steps = [
		"Path to the compiled CSS file",
		"Path to root folder of uncompiled CSS",
		"output file name",
		"css compiler: less, sass or stylus",
		"Path to templates",
		"Title of the style guide"
	];
	var stepVal = [
		this.compiledCssPath,
		this.uncompiledCssPath,
		this.output,
		this.cssCompiler,
		this.templatePath,
		this.styleguideTitle
	];

	console.log(steps[0]+" Default:"+stepVal[step]);
	process.stdin.resume();
	process.stdin.setEncoding('utf8');

	process.stdin.on(
		'data',
		function (text) {
			var pass = false;
			text = text.replace("\r\n", "").replace("\n","").trim();
			switch(step){
				case 0:
					if(text === '') {
						text = this.compiledCssPath;
					}
					if(Validator.validate('compiledCssPath', text)) {
						console.log("Compiled CSS file set to: " + text);
						this.compiledCssPath = text;
						pass = true;
					}
				break;
				case 1:
					if(text === '') {
						text = this.uncompiledCssPath;
					}
					if(Validator.validate('uncompiledCssPath', text)) {
						console.log("Uncompiled folder set to: " + text);
						this.uncompiledCssPath = text;
						pass = true;
					}
				break;
				case 2:
					if(text === '') {
						text = this.output;
					}
					if(Validator.validate('output', text)) {
						console.log("Output file set to: " + text);
						this.output = text;
						pass = true;
					}
				break;
				case 3:
					if(text === '') {
						text = this.cssCompiler;
					}
					if(Validator.validate('cssCompiler', text)) {
						console.log("Compiler set to: " + text);
						this.cssCompiler = text;
						pass = true;
					}
				break;
				case 4:
					if(text === '') {
						text = this.templatePath;
					}
					if(Validator.validate('templatePath', text)) {
						console.log("Template path set to: " + text);
						this.templatePath = text;
						pass = true;
					}
				break;
				case 5:
					if(text === '') {
						text = this.styleguideTitle;
					}
					if(Validator.validate('styleguideTitle', text)) {
						console.log("Styleguide title set to: " + text);
						this.styleguideTitle = text;
						pass = true;
					}
				break;
				default:
					pass = false;
				break;
			}

			if(pass) {
				step ++;
				if(step >= steps.length){
					this.completeInput(onSuccess);
				} else {
					console.log(steps[step]+" Default: "+stepVal[step]);
				}
			}
		}.bind(this)
	);
};

module.exports = Configurator;


text:
package com.thesecretserver.service;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for anonymous complex type.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *
 *

 * <complexType>
 *   <complexContent>
 *     <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       <sequence>
 *         <element name="AddUserResult" type="{urn:thesecretserver.com}WebServiceResult" minOccurs="0"/>
 *       </sequence>
 *     </restriction>
 *   </complexContent>
 * </complexType>
 *

 *
 *
 */
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
    "addUserResult"
})
@XmlRootElement(name = "AddUserResponse")
public class AddUserResponse {

    @XmlElement(name = "AddUserResult")
    protected WebServiceResult addUserResult;

    /**
     * Gets the value of the addUserResult property.
     *
     * @return
     *     possible object is
     *     {@link WebServiceResult }
     *
     */
    public WebServiceResult getAddUserResult() {
        return addUserResult;
    }

    /**
     * Sets the value of the addUserResult property.
     *
     * @param value
     *     allowed object is
     *     {@link WebServiceResult }
     *
     */
    public void setAddUserResult(WebServiceResult value) {
        this.addUserResult = value;
    }

}


text:
from fnmatch import fnmatch
import logging
from urlparse import urlparse

from appengine_url_fetcher import AppEngineUrlFetcher
from caching_file_system import CachingFileSystem
from caching_rietveld_patcher import CachingRietveldPatcher
from chained_compiled_file_system import ChainedCompiledFileSystem
from compiled_file_system import  CompiledFileSystem
from environment import IsDevServer
from host_file_system_provider import HostFileSystemProvider
from instance_servlet import InstanceServlet
from render_servlet import RenderServlet
from rietveld_patcher import RietveldPatcher, RietveldPatcherError
from object_store_creator import ObjectStoreCreator
from patched_file_system import PatchedFileSystem
from server_instance import ServerInstance
from servlet import Request, Response, Servlet
import svn_constants
import url_constants

class _PatchServletDelegate(RenderServlet.Delegate):
  def __init__(self, issue, delegate):
    self._issue = issue
    self._delegate = delegate

  def CreateServerInstance(self):
    # start_empty=False because a patch can rely on files that are already in
    # SVN repository but not yet pulled into data store by cron jobs (a typical
    # example is to add documentation for an existing API).
    object_store_creator = ObjectStoreCreator(start_empty=False)

    unpatched_file_system = self._delegate.CreateHostFileSystemProvider(
        object_store_creator).GetTrunk()

    rietveld_patcher = CachingRietveldPatcher(
        RietveldPatcher(svn_constants.EXTENSIONS_PATH,
                        self._issue,
                        AppEngineUrlFetcher(url_constants.CODEREVIEW_SERVER)),
        object_store_creator)

    patched_file_system = PatchedFileSystem(unpatched_file_system,
                                            rietveld_patcher)

    patched_host_file_system_provider = (
        self._delegate.CreateHostFileSystemProvider(
            object_store_creator,
            # The patched file system needs to be online otherwise it'd be
            # impossible to add files in the patches.
            offline=False,
            # The trunk file system for this creator should be the patched one.
            default_trunk_instance=patched_file_system))

    combined_compiled_fs_factory = ChainedCompiledFileSystem.Factory(
        [unpatched_file_system], object_store_creator)

    branch_utility = self._delegate.CreateBranchUtility(object_store_creator)

    server_instance = ServerInstance(
        object_store_creator,
        combined_compiled_fs_factory,
        branch_utility,
        patched_host_file_system_provider,
        self._delegate.CreateGithubFileSystemProvider(object_store_creator),
        base_path='/_patch/%s/' % self._issue)

    # HACK: if content_providers.json changes in this patch then the cron needs
    # to be re-run to pull in the new configuration.
    _, _, modified = rietveld_patcher.GetPatchedFiles()
    if svn_constants.CONTENT_PROVIDERS_PATH in modified:
      server_instance.content_providers.Cron().Get()

    return server_instance

class PatchServlet(Servlet):
  '''Servlet which renders patched docs.
  '''
  def __init__(self, request, delegate=None):
    self._request = request
    self._delegate = delegate or InstanceServlet.Delegate()

  def Get(self):
    if (not IsDevServer() and
        not fnmatch(urlparse(self._request.host).netloc, '*.appspot.com')):
      # Only allow patches on appspot URLs; it doesn't matter if appspot.com is
      # XSS'ed, but it matters for chrome.com.
      redirect_host = 'https://chrome-apps-doc.appspot.com'
      logging.info('Redirecting from XSS-able host %s to %s' % (
          self._request.host, redirect_host))
      return Response.Redirect(
          '%s/_patch/%s' % (redirect_host, self._request.path))

    path_with_issue = self._request.path.lstrip('/')
    if '/' in path_with_issue:
      issue, path_without_issue = path_with_issue.split('/', 1)
    else:
      return Response.NotFound('Malformed URL. It should look like ' +
          'https://developer.chrome.com/_patch/12345/extensions/...')

    try:
      response = RenderServlet(
          Request(path_without_issue,
                  self._request.host,
                  self._request.headers),
          _PatchServletDelegate(issue, self._delegate)).Get()
      # Disable cache for patched content.
      response.headers.pop('cache-control', None)
    except RietveldPatcherError as e:
      response = Response.NotFound(e.message, {'Content-Type': 'text/plain'})

    redirect_url, permanent = response.GetRedirect()
    if redirect_url is not None:
      response = Response.Redirect('/_patch/%s%s' % (issue, redirect_url),
                                   permanent)
    return response


text:
/**
 * Created by larjo on 18/10/2016.
 */
import {
  ChangeDetectionStrategy, ViewEncapsulation,
  Component, Input, ElementRef,
  AfterViewInit, ViewChild, Injector
} from '@angular/core';
import { ChangeDetectorRef} from '@angular/core';
import * as d3 from 'd3';
import * as $ from 'jquery';
import * as _ from 'lodash';
import {AnalysisVisualization} from '../visualization';

@Component({
  selector: 'analytics-histogram',
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None,
  templateUrl: './histogram.html',
  styles: [`

 .axis path,
.axis .line {
  fill: none;
  stroke: #000;
  shape-rendering: crispEdges;
}

.x.axis path {
  display: none;
}

  `]
})
export class HistogramVisualization implements AfterViewInit {
  get values(): any {
    return this._values;
  }

  @Input()
  set values(value: any) {
    this._values = value;

    this.ref.detectChanges();
  }

  ngAfterViewInit(): void {

    if (this.values)
      this.init(this.values);

  }

  @ViewChild('vizCanvas') vizCanvas: any;

  private _values: any;
  @Input()
  public label_x: string;

  @Input()
  public label_y: string;
  private generateBarChart(data: any) {
    const margin = {top: 20, right: 50, bottom: 70, left: 80};

    const color = d3.scaleOrdinal(d3.schemeCategory10);

    const viewerWidth = $(this.vizCanvas.nativeElement).width() - margin.left - margin.right - 50;
    const viewerHeight = $(this.vizCanvas.nativeElement).height() - margin.top - margin.bottom;

    const lineData = [];
    for (let i = 0; i < data.cuts.length; i++) {
      lineData.push({
        x: data['normal.curve.x'][i],
        y: data['normal.curve.y'][i]
      });
    }

    const boxData = [];
    for (let i = 0; i < data.density.length; i++){
      boxData.push({
        from: data.cuts[i],
        to: data.cuts[i + 1],
        frequency : data.density[i]
      });
    }

    const max: number = d3.max([d3.max(data.density as number[]), d3.max(data['normal.curve.y'] as number[])]);
    const min: number = d3.min([d3.min(data.density as number[]) , d3.min(data['normal.curve.y'] as number[]) ]);

    const x_max: number = d3.max(data.cuts as number[]);
    const x_min: number = d3.min(data.cuts as number[]);

    const x = d3.scaleLinear()
      .range([0, viewerWidth]);

    const y = d3.scaleLinear()
      .range([viewerHeight, 0]);

    const xAxis = d3.axisBottom(x).tickFormat(d3.format(",.2r"))
      /*.tickFormat(function(d){
       return d3.time.format('%Y')(new Date(d));
       })*/;

    const yAxis = d3.axisLeft(y).tickFormat(d3.format(",.2r")).ticks(10).tickSize(-viewerWidth);

    const line = d3.line()
      .x(function (d: any) {
        return x(d.x);
      })
      .y(function (d: any) {
        return y(d.y);
      });

    const svg = d3.select(this.vizCanvas.nativeElement).append('svg')
      .attr('width', viewerWidth + margin.left + margin.right)
      .attr('height', viewerHeight + margin.top + margin.bottom)
      .append('g')
      .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')');

    x.domain([x_min, x_max]);

    y.domain([min, max]);

    svg.append('g')
      .attr('class', 'x axis')
      .attr('transform', 'translate(0,' + viewerHeight + ')')
      .call(xAxis)
      .selectAll('text')
      .attr('y', 0)
      .attr('x', 9)
      .attr('dy', '.35em')
      .attr('transform', 'rotate(45)')
      .style('text-anchor', 'start');

    svg.append('g')
      .attr('class', 'y axis grid')
      .call(yAxis)
      .append('text')
      .attr('transform', 'rotate(-90)')
      .attr('y', 6)
      .attr('dy', '.71em')
      .attr('dx', '-0.71em')
      .style('text-anchor', 'end')
      .text('Amount');

    svg.selectAll('.box')
      .data(boxData)
      .enter().append('rect')
      .style('fill', function(d: any) { return color(y(d.frequency).toString()); } )
      .style('stroke', 'transparent')
      .attr('class', 'box')
      .attr('x', function(d: any) { return x(d.from); })
      .attr('y', function(d: any) { return y( d.frequency); })
      .attr('width', function(d: any) { return Math.abs(x(d.to) - x(d.from)); })
      .attr('height', function(d: any) { return viewerHeight -  y(d.frequency); });

    svg.append('path')
      .datum(lineData)
      .attr('class', 'line')
      .attr('d', line);

   /* svg.append("path")
      .datum(_.filter(data, function (d) {
        return _.has(d, "low95")
      }))
      .attr("class", "lineLow95")
      .attr("d", lineLow95).attr("data-legend","Lower limit for 95% prediction interval");

*/
    svg.append('rect')
      .attr('x', 0)
      .attr('y', 0)
      .attr('height', viewerHeight)
      .attr('width', viewerWidth)
      .style('stroke', 'black')
      .style('fill', 'none')
      .style('stroke-width', '1');

    svg.append('svg:line')
      .attr('x1', 0)
      .attr('x2', viewerWidth)
      .attr('y1', y(0))
      .attr('y2', y(0))
      .style('stroke', 'black');

    // text label for the x axis
    svg.append("text")
      .attr("transform",
        "translate(" + (viewerWidth/2) + " ," +
        (viewerHeight + margin.top + 40) + ")")
      .style("text-anchor", "middle")
      .style("font-weight", "bold")
      .text(this.label_x);

    svg.append("text")
      .attr("transform", "rotate(-90)")
      .attr("y", 0 - margin.left)
      .attr("x",0 - (viewerHeight / 2))
      .attr("dy", "1em")
      .style("text-anchor", "middle")
      .style("font-weight", "bold")
      .text(this.label_y);

  }
  @Input()
  legend = false;

  init(values: any) {

    const that = this;

    d3.select(that.vizCanvas.nativeElement).html('');

  //  this.vizCanvas = this.elementRef;

    this.generateBarChart(values);

  }

  static type(d: any) {
    d.amount = +d.amount;
    return d;
  }

  constructor(private elementRef: ElementRef, private ref: ChangeDetectorRef) {
    setInterval(() => {
      // the following is required, otherwise the view will not be updated
      this.ref.markForCheck();
    }, 5000);
  }

}

@Component({
  selector: 'analytics-histogram-chart-descriptive',
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None,
  template: `   <analytics-histogram *ngFor="let item of data.histogram"   [label_y]="Frequency" [label_x]="Dimension" [values]="item"></analytics-histogram>`,
  styles: [`

  .line {
  fill: none;
  stroke: #82bf5e;
  shape-rendering: crispEdges;
}

.x.axis path {
  display: none;
}

  `]
})
export class HistogramDescriptive  extends AnalysisVisualization {
  @Input()
  public data: any;

  constructor(elementRef: ElementRef, ref: ChangeDetectorRef, injector: Injector) {
    super(elementRef, ref, injector);

  }

}


text:
package com.github.horrorho.liquiddonkey.settings.config;

import com.github.horrorho.liquiddonkey.util.Props;
import com.github.horrorho.liquiddonkey.settings.Property;
import java.util.Properties;
import net.jcip.annotations.Immutable;
import net.jcip.annotations.ThreadSafe;

/**
 * Printer configuration.
 *
 * @author Ahseya
 */
@Immutable
@ThreadSafe
public final class ClientConfig {

    public static ClientConfig from(Properties properties) {
        Props<Property> props = Props.from(properties);

        return from(props.getProperty(Property.CLIENT_LIST_LIMIT, props::asInteger));
    }

    public static ClientConfig from(int listLimit) {
        return new ClientConfig(listLimit);
    }

    private final int listLimit;

    ClientConfig(int listLimit) {
        this.listLimit = listLimit;
    }

    public int listLimit() {
        return listLimit;
    }

    @Override
    public String toString() {
        return "ClientConfig{" + "listLimit=" + listLimit + '}';
    }
}


text:
import fs from 'fs';
import koa from 'koa';
import router from 'koa-route';
import bodyParser from 'koa-bodyparser';

import log from '../utils/log';
import registerAPI from './API';
import config from '../../config';
import webpackDevServer from './webpack/webpackDevServer';
import deleteDatabase from './database/utils/deleteDatabase';
import populateDatabase from './database/utils/populateDatabase';
import initializeDatabase from './database/utils/initializeDatabase';
import { openConnection, closeConnection } from './database/utils/connect';

console.log('Node', process.version, process.cwd());

const WDSURI = `http://${config.publicIp}:${config.WDSPort}/`;
const html = fs.readFileSync('src/server/index.html', 'utf8').replace('</body>',
  `<script src="${WDSURI}webpack-dev-server.js"></script>` +
  `<script src="${WDSURI}static/bundle.js"></script>`
);

const app = new koa();
app.use(bodyParser());
registerAPI(app, router);

let n = 0;

app.use(router.get('/images/:x', (ctx, x) => {
  n++;
  log(n, 'image', x, 'from', ctx.request.ip);

  if (!x) return;
  const a = x.split('.');

  switch (a[a.length - 1].toLowerCase()) {
    case 'jpg':
      ctx.set('content-type', 'image/jpeg');
      ctx.body = fs.readFileSync(__dirname + '/images/' + x);
      break;
    case 'png':
      ctx.set('content-type', 'image/png');
      ctx.body = fs.readFileSync(__dirname + '/images/' + x);
      break;

    default:
      return;
  }
}));

app.use(router.get('/tiles/:x', (ctx, x) => {
  n++;
  log(n, 'tile', x, 'from', ctx.request.ip);

  if (!x) return;
  ctx.set('content-type', 'image/png');
  ctx.body = fs.readFileSync(__dirname + '/images/tiles/' + x);
}));

app.use(router.get('*', (ctx, next) => {
  n++;
  log(n, ctx.method, ctx.url, 'from', ctx.request.ip);
  ctx.body = html;
}));

Promise.resolve()
// .then(openConnection.bind(0, config.rethinkdb))
// .then(deleteDatabase)
// .then(initializeDatabase)
// .then(populateDatabase)
// .then(closeConnection)
.then(
  () => {
    app.listen(config.webServerPort);
    log(`Web server listening on port ${config.webServerPort}`);
  },
  console.error
);

webpackDevServer();

const unhandledRejections = new Map();
process.on('unhandledRejection', (reason, p) => {
  unhandledRejections.set(p, reason);
  log('!!! unhandledRejection', p, reason);
});
process.on('rejectionHandled', p => {
  unhandledRejections.delete(p);
});


text:
(function() {
  var Crawler, c, checkForQueue, counter, error, error2, first, fs, l, last, multi, output, queued, r, records, sub, visited, _i, _j, _k, _len, _len1, _len2, _ref;

  Crawler = require("crawler").Crawler;

  fs = require('fs');

  checkForQueue = function(url) {
    if (visited[url] === void 0) {
      c.queue(encodeURI(url));
      queued++;
    }
  };

  c = new Crawler({
    "maxConnections": 5,
    "skipDuplicates": true,
    "onDrain": function() {
      fs.appendFile("output.json", "]\n");
      return console.log("Finished: " + new Date());
    },
    "callback": function(error, result, $) {
      var isMain, record, _ref;
      queued--;
      record = {};
      try {
        if (error !== null) {
          console.log("" + (new Date()) + ": " + error.message);
          return;
        }
        record.uri = "http://www.yivoencyclopedia.org" + result.req.path;
        try {
          record.id = /id=([0-9]+)/g.exec($("#ctl00_placeHolderMain_linkEmailArticle").attr("href"))[1];
        } catch (_error) {
          error = _error;
          console.log("Error (" + record.uri + "): " + error.message);
          fs.appendFile("error.txt", "" + (new Date()) + " Error (" + record.uri + "): " + error.message + "\n");
          return;
        }
        visited[record.uri] = "http://www.yivoencyclopedia.org/article.aspx?id=" + record.id;
        visited["http://www.yivoencyclopedia.org/article.aspx?id=" + record.id] = record.uri;
        record.title = $("h1").text();
        record.abstract = $(".articleblockconteiner p").first().text();
        record.images = [];
        $("img.mbimg").each(function(index, img) {
          var image;
          image = {};
          image.thumbUrl = "http://www.yivoencyclopedia.org" + ($(img).attr("src"));
          image.viewerUrl = /(http.*)&article/g.exec($(img).parent().attr("href"))[1];
          image.imgDesc = $(img).parent().next().text().replace("SEE MEDIA RELATED TO THIS ARTICLE", "").trim();
          return record.images.push(image);
        });
        record.links = [];
        $("#ctl00_placeHolderMain_panelArticleText a[href^='article.aspx/']").each(function(index, a) {
          var link;
          link = {};
          link.href = "http://www.yivoencyclopedia.org/" + ($(a).attr("href"));
          link.text = $(a).text().trim();
          if (link.text.length > 0) {
            record.links.push(link);
          }
          return checkForQueue(link.href);
        });
        record.glossary = [];
        $(".term").each(function(index, span) {
          var term;
          term = $(span).text().trim();
          if (term.length > 0) {
            return record.glossary.push(term);
          }
        });
        record.subrecords = [];
        isMain = true;
        $("#ctl00_placeHolderMain_panelPager a").each(function(index, a) {
          var sr;
          sr = {};
          sr.href = "http://www.yivoencyclopedia.org" + $(a).attr("href");
          sr.page = $(a).text().trim();
          if (index === 0 && sr.href !== record.uri) {
            isMain = false;
          }
          if (!isMain && index === 0) {
            record.parent = sr.href;
            checkForQueue(sr.href);
          }
          if (isMain && index !== 0) {
            record.subrecords.push(sr);
            return checkForQueue(sr.href);
          }
        });
        record.subconcepts = [];
        $("h2.entry").each(function(index, h2) {
          var check, sc, stops;
          sc = $(h2).text().trim();
          if (index === 0 && !isMain) {
            record.title = "" + sc + " (" + record.title + ")";
            return true;
          }
          stops = ["About this Article", "Suggested Reading", "YIVO Archival Resources", "Author", "Translation"];
          check = stops.some(function(word) {
            return sc === word;
          });
          if (check) {
            return false;
          }
          return record.subconcepts.push(sc);
        });
        record.next = (_ref = $("#ctl00_placeHolderMain_linkNextArticle")) != null ? _ref.attr("href") : void 0;
        if (record.next !== void 0) {
          record.next = "http://www.yivoencyclopedia.org/" + record.next;
          checkForQueue(record.next);
        }
        records.push(record);
        fs.appendFile("output.json", (counter++ > 0 ? ",\n" : "") + JSON.stringify(record, null, 1));
        return console.log("" + counter + ". Processed " + record.uri + " (id=" + record.id + ")");
      } catch (_error) {
        error = _error;
        return fs.appendFile("error.txt", "" + (new Date()) + " Error (" + record.uri + "): " + error.message + "\n");
      }
    }
  });

  visited = {};

  counter = 0;

  queued = 0;

  records = [];

  try {
    output = fs.readFileSync("output.json");
    records = JSON.parse(output);
  } catch (_error) {
    error = _error;
    if (error.code !== "ENOENT") {
      try {
        records = JSON.parse(output + "]");
      } catch (_error) {
        error2 = _error;
        console.log(error2.message);
        return;
      }
    }
  }

  counter = records.length;

  for (_i = 0, _len = records.length; _i < _len; _i++) {
    r = records[_i];
    visited[r.uri] = "http://www.yivoencyclopedia.org/article.aspx?id=" + r.id;
    visited["http://www.yivoencyclopedia.org/article.aspx?id=" + r.id] = r.uri;
  }

  for (_j = 0, _len1 = records.length; _j < _len1; _j++) {
    r = records[_j];
    _ref = r.links;
    for (_k = 0, _len2 = _ref.length; _k < _len2; _k++) {
      l = _ref[_k];
      checkForQueue(l.href);
    }
    if (r.next !== void 0) {
      checkForQueue(r.next);
    }
  }

  console.log("Queued URLs: " + queued);

  console.log("Records loaded: " + records.length);

  first = "http://www.yivoencyclopedia.org/article.aspx/Abeles_Shimon";

  last = "http://www.yivoencyclopedia.org/article.aspx/Zylbercweig_Zalmen";

  multi = "http://www.yivoencyclopedia.org/article.aspx/Poland";

  error = "http://www.yivoencyclopedia.org/article.aspx?id=497";

  sub = "http://www.yivoencyclopedia.org/article.aspx/Poland/Poland_before_1795";

  if (counter === 0) {
    fs.writeFile("output.json", "[\n");
    c.queue(first);
  }

  console.log(new Date());

}).call(this);