text:
import copy

from coala_utils.decorators import (
    enforce_signature, generate_ordering, generate_repr)
from coalib.results.TextPosition import TextPosition

@generate_repr('start', 'end')
@generate_ordering('start', 'end')
class TextRange:

    @enforce_signature
    def __init__(self, start: TextPosition, end: (TextPosition, None)=None):
        """
        Creates a new TextRange.

        :param start:       A TextPosition indicating the start of the range.
                            Can't be ``None``.
        :param end:         A TextPosition indicating the end of the range. If
                            ``None`` is given, the start object will be used
                            here.
        :raises TypeError:  Raised when
                            - start is not of type TextPosition.
                            - end is neither of type TextPosition, nor is it
                              None.
        :raises ValueError: Raised when end position is smaller than start
                            position, because negative ranges are not allowed.
        """

        self._start = start
        self._end = copy.deepcopy(start) if end is None else end

        if self._end < start:
            raise ValueError("End position can't be less than start position.")

    @classmethod
    def from_values(cls,
                    start_line=None,
                    start_column=None,
                    end_line=None,
                    end_column=None):
        """
        Creates a new TextRange.

        :param start_line:   The line number of the start position. The first
                             line is 1.
        :param start_column: The column number of the start position. The first
                             column is 1.
        :param end_line:     The line number of the end position. If this
                             parameter is ``None``, then the end position is set
                             the same like start position and end_column gets
                             ignored.
        :param end_column:   The column number of the end position.
        :return:             A TextRange.
        """
        start = TextPosition(start_line, start_column)
        if end_line is None:
            end = None
        else:
            end = TextPosition(end_line, end_column)

        return cls(start, end)

    @classmethod
    def join(cls, a, b):
        """
        Creates a new TextRange that covers the area of two overlapping ones

        :param a: TextRange (needs to overlap b)
        :param b: TextRange (needs to overlap a)
        :return:  A new TextRange covering the union of the Area of a and b
        """
        if not isinstance(a, cls) or not isinstance(b, cls):
            raise TypeError(
                'only instances of {} can be joined'.format(cls.__name__))

        if not a.overlaps(b):
            raise ValueError(
                '{}s must overlap to be joined'.format(cls.__name__))

        return cls(min(a.start, b.start), max(a.end, b.end))

    @property
    def start(self):
        return self._start

    @property
    def end(self):
        return self._end

    def overlaps(self, other):
        return self.start <= other.end and self.end >= other.start

    def expand(self, text_lines):
        """
        Passes a new TextRange that covers the same area of a file as this one
        would. All values of None get replaced with absolute values.

        values of None will be interpreted as follows:
        self.start.line is None:   -> 1
        self.start.column is None: -> 1
        self.end.line is None:     -> last line of file
        self.end.column is None:   -> last column of self.end.line

        :param text_lines: File contents of the applicable file
        :return:           TextRange with absolute values
        """
        start_line = 1 if self.start.line is None else self.start.line
        start_column = 1 if self.start.column is None else self.start.column
        end_line = len(text_lines) if self.end.line is None else self.end.line
        end_column = (len(text_lines[end_line - 1]) if self.end.column is None
                      else self.end.column)

        return TextRange.from_values(start_line,
                                     start_column,
                                     end_line,
                                     end_column)

    def __contains__(self, item):
        return item.start >= self.start and item.end <= self.end


text:
using System;
using System.Collections.Generic;
using System.Linq;
using HoS_AP.DAL.Dto;
using HoS_AP.Misc;

namespace HoS_AP.BLL.Models
{
    public class CharacterEditModel
    {
        public CharacterEditModel()
        {
        }

        public CharacterEditModel(Character character)
        {
            Id = character.Id;
            Name = character.Name;
            Type = character.Type;
            Price = character.Price;
            Active = character.Active;
            Deleted = character.Deleted;
        }

        public Guid Id { get; set; }

        public string Name { get; set; }

        public CharacterTypes Type { get; set; }

        public decimal Price { get; set; }

        public bool Active { get; set; }

        public bool Deleted { get; set; }

        public IEnumerable<CharacterTypes> Types
        {
            get
            {
                return Enum.GetValues(typeof(CharacterTypes)).Cast<CharacterTypes>().Where(x=> x != CharacterTypes.None);
            }
        }

        public bool DisplayDeleteButton
        {
            get { return Id != Guid.Empty && !Deleted; }
        }

        public bool DisplayRecoverButton
        {
            get { return Id != Guid.Empty && Deleted; }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
/**
 * @author: @AngularClass
 */

// Look in ./config for karma.conf.js
module.exports = require('./config/karma.conf.js');


text:
package org.apache.hadoop.hive.metastore.metrics;

public class MetricsConstants {
  public static final String ACTIVE_CALLS = "active_calls_";
  public static final String API_PREFIX = "api_";
  public static final String COMPACTION_STATUS_PREFIX = "compaction_num_";
  public static final String COMPACTION_OLDEST_ENQUEUE_AGE = "compaction_oldest_enqueue_age_in_sec";
  public static final String COMPACTION_INITIATOR_CYCLE = "compaction_initiator_cycle";
  public static final String COMPACTION_INITIATOR_FAILURE_COUNTER = "compaction_initiator_failure_counter";
  public static final String COMPACTION_CLEANER_CYCLE = "compaction_cleaner_cycle";
  public static final String COMPACTION_CLEANER_FAILURE_COUNTER = "compaction_cleaner_failure_counter";
  public static final String COMPACTION_WORKER_CYCLE = "compaction_worker_cycle";

  public static final String OLDEST_OPEN_REPL_TXN_ID = "oldest_open_repl_txn_id";
  public static final String OLDEST_OPEN_NON_REPL_TXN_ID = "oldest_open_non_repl_txn_id";
  public static final String OLDEST_OPEN_REPL_TXN_AGE = "oldest_open_repl_txn_age_in_sec";
  public static final String OLDEST_OPEN_NON_REPL_TXN_AGE = "oldest_open_non_repl_txn_age_in_sec";
  // number of aborted txns in TXNS table
  public static final String NUM_ABORTED_TXNS = "num_aborted_transactions";
  public static final String OLDEST_ABORTED_TXN_ID = "oldest_aborted_txn_id";
  public static final String OLDEST_ABORTED_TXN_AGE = "oldest_aborted_txn_age_in_sec";

  public static final String COMPACTION_NUM_OBSOLETE_DELTAS = COMPACTION_STATUS_PREFIX + "obsolete_deltas";
  public static final String COMPACTION_NUM_DELTAS = COMPACTION_STATUS_PREFIX + "active_deltas";
  public static final String COMPACTION_NUM_SMALL_DELTAS = COMPACTION_STATUS_PREFIX + "small_deltas";

  public static final String NUM_LOCKS = "num_locks";
  public static final String OLDEST_LOCK_AGE = "oldest_lock_age_in_sec";

  public static final String NUM_TXN_TO_WRITEID = MetricsConstants.COMPACTION_STATUS_PREFIX + "txn_to_writeid";
  public static final String NUM_COMPLETED_TXN_COMPONENTS = MetricsConstants.COMPACTION_STATUS_PREFIX + "completed_txn_components";

  public static final String COMPACTION_NUM_INITIATORS = COMPACTION_STATUS_PREFIX + "initiators";
  public static final String COMPACTION_NUM_WORKERS = COMPACTION_STATUS_PREFIX + "workers";
  public static final String COMPACTION_NUM_INITIATOR_VERSIONS = COMPACTION_STATUS_PREFIX + "initiator_versions";
  public static final String COMPACTION_NUM_WORKER_VERSIONS = COMPACTION_STATUS_PREFIX + "worker_versions";

  public static final String TOTAL_API_CALLS = "total_api_calls";

  public static final String CREATE_TOTAL_DATABASES = "create_total_count_dbs";
  public static final String CREATE_TOTAL_TABLES = "create_total_count_tables";
  public static final String CREATE_TOTAL_PARTITIONS = "create_total_count_partitions";

  public static final String DELETE_TOTAL_DATABASES = "delete_total_count_dbs";
  public static final String DELETE_TOTAL_TABLES = "delete_total_count_tables";
  public static final String DELETE_TOTAL_PARTITIONS = "delete_total_count_partitions";

  public static final String DIRECTSQL_ERRORS = "directsql_errors";

  public static final String JVM_PAUSE_INFO = "jvm.pause.info-threshold";
  public static final String JVM_PAUSE_WARN = "jvm.pause.warn-threshold";
  public static final String JVM_EXTRA_SLEEP = "jvm.pause.extraSleepTime";

  public static final String NUM_OPEN_TXNS = "num_open_transactions";
  public static final String NUM_OPEN_REPL_TXNS = "num_open_repl_transactions";
  public static final String NUM_OPEN_NON_REPL_TXNS = "num_open_non_repl_transactions";
  public static final String TOTAL_NUM_ABORTED_TXNS = "total_num_aborted_transactions";
  public static final String TOTAL_NUM_COMMITTED_TXNS = "total_num_committed_transactions";
  public static final String TOTAL_NUM_TIMED_OUT_TXNS = "total_num_timed_out_transactions";

  public static final String OPEN_CONNECTIONS = "open_connections";

  public static final String TOTAL_DATABASES = "total_count_dbs";
  public static final String TOTAL_TABLES = "total_count_tables";
  public static final String TOTAL_PARTITIONS = "total_count_partitions";

  public static final String TABLES_WITH_X_ABORTED_TXNS = "tables_with_x_aborted_transactions";

  public static final String WRITES_TO_DISABLED_COMPACTION_TABLE = "num_writes_to_disabled_compaction_table";

  public static final String OLDEST_READY_FOR_CLEANING_AGE = "oldest_ready_for_cleaning_age_in_sec";
}


text:
module GoatOS
end


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

import com.google.common.collect.ImmutableList;
import io.prestosql.spi.PrestoException;
import io.prestosql.spi.connector.SchemaNotFoundException;
import io.prestosql.spi.connector.SchemaTableName;
import org.apache.kudu.ColumnSchema;
import org.apache.kudu.Schema;
import org.apache.kudu.Type;
import org.apache.kudu.client.CreateTableOptions;
import org.apache.kudu.client.Delete;
import org.apache.kudu.client.Insert;
import org.apache.kudu.client.KuduClient;
import org.apache.kudu.client.KuduException;
import org.apache.kudu.client.KuduScanner;
import org.apache.kudu.client.KuduSession;
import org.apache.kudu.client.KuduTable;
import org.apache.kudu.client.RowResult;
import org.apache.kudu.client.RowResultIterator;
import org.apache.kudu.client.SessionConfiguration;
import org.apache.kudu.client.Upsert;

import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.List;

import static io.prestosql.plugin.kudu.KuduClientSession.DEFAULT_SCHEMA;
import static io.prestosql.spi.StandardErrorCode.GENERIC_INTERNAL_ERROR;
import static io.prestosql.spi.StandardErrorCode.GENERIC_USER_ERROR;

public class SchemaEmulationByTableNameConvention
        implements SchemaEmulation
{
    private final String commonPrefix;
    private final String rawSchemasTableName;
    private KuduTable rawSchemasTable;

    public SchemaEmulationByTableNameConvention(String commonPrefix)
    {
        this.commonPrefix = commonPrefix;
        this.rawSchemasTableName = commonPrefix + "$schemas";
    }

    @Override
    public void createSchema(KuduClient client, String schemaName)
    {
        if (DEFAULT_SCHEMA.equals(schemaName)) {
            throw new SchemaAlreadyExistsException(schemaName);
        }
        else {
            try {
                KuduTable schemasTable = getSchemasTable(client);
                KuduSession session = client.newSession();
                try {
                    Upsert upsert = schemasTable.newUpsert();
                    upsert.getRow().addString(0, schemaName);
                    session.apply(upsert);
                }
                finally {
                    session.close();
                }
            }
            catch (KuduException e) {
                throw new PrestoException(GENERIC_INTERNAL_ERROR, e);
            }
        }
    }

    @Override
    public boolean existsSchema(KuduClient client, String schemaName)
    {
        if (DEFAULT_SCHEMA.equals(schemaName)) {
            return true;
        }
        else {
            List<String> schemas = listSchemaNames(client);
            return schemas.contains(schemaName);
        }
    }

    @Override
    public void dropSchema(KuduClient client, String schemaName)
    {
        if (DEFAULT_SCHEMA.equals(schemaName)) {
            throw new PrestoException(GENERIC_USER_ERROR, "Deleting default schema not allowed.");
        }
        else {
            try {
                String prefix = getPrefixForTablesOfSchema(schemaName);
                for (String name : client.getTablesList(prefix).getTablesList()) {
                    client.deleteTable(name);
                }

                KuduTable schemasTable = getSchemasTable(client);
                KuduSession session = client.newSession();
                try {
                    Delete delete = schemasTable.newDelete();
                    delete.getRow().addString(0, schemaName);
                    session.apply(delete);
                }
                finally {
                    session.close();
                }
            }
            catch (KuduException e) {
                throw new PrestoException(GENERIC_INTERNAL_ERROR, e);
            }
        }
    }

    @Override
    public List<String> listSchemaNames(KuduClient client)
    {
        try {
            if (rawSchemasTable == null) {
                if (!client.tableExists(rawSchemasTableName)) {
                    createAndFillSchemasTable(client);
                }
                rawSchemasTable = getSchemasTable(client);
            }

            KuduScanner scanner = client.newScannerBuilder(rawSchemasTable).build();
            RowResultIterator iterator = scanner.nextRows();
            ArrayList<String> result = new ArrayList<>();
            while (iterator != null) {
                for (RowResult row : iterator) {
                    result.add(row.getString(0));
                }
                iterator = scanner.nextRows();
            }
            return result;
        }
        catch (KuduException e) {
            throw new PrestoException(GENERIC_INTERNAL_ERROR, e);
        }
    }

    private KuduTable getSchemasTable(KuduClient client)
            throws KuduException
    {
        if (rawSchemasTable == null) {
            rawSchemasTable = client.openTable(rawSchemasTableName);
        }
        return rawSchemasTable;
    }

    private void createAndFillSchemasTable(KuduClient client)
            throws KuduException
    {
        List<String> existingSchemaNames = listSchemaNamesFromTablets(client);
        ColumnSchema schemaColumnSchema = new ColumnSchema.ColumnSchemaBuilder("schema", Type.STRING)
                .key(true).build();
        Schema schema = new Schema(ImmutableList.of(schemaColumnSchema));
        CreateTableOptions options = new CreateTableOptions();
        options.addHashPartitions(ImmutableList.of(schemaColumnSchema.getName()), 2);
        KuduTable schemasTable = client.createTable(rawSchemasTableName, schema, options);
        KuduSession session = client.newSession();
        try {
            session.setFlushMode(SessionConfiguration.FlushMode.AUTO_FLUSH_BACKGROUND);
            for (String schemaName : existingSchemaNames) {
                Insert insert = schemasTable.newInsert();
                insert.getRow().addString(0, schemaName);
                session.apply(insert);
            }
        }
        finally {
            session.close();
        }
    }

    private List<String> listSchemaNamesFromTablets(KuduClient client)
            throws KuduException
    {
        List<String> tables = client.getTablesList().getTablesList();
        LinkedHashSet<String> schemas = new LinkedHashSet<>();
        schemas.add(DEFAULT_SCHEMA);
        for (String table : tables) {
            SchemaTableName schemaTableName = fromRawName(table);
            if (schemaTableName != null) {
                schemas.add(schemaTableName.getSchemaName());
            }
        }
        return ImmutableList.copyOf(schemas);
    }

    @Override
    public String toRawName(SchemaTableName schemaTableName)
    {
        if (DEFAULT_SCHEMA.equals(schemaTableName.getSchemaName())) {
            if (commonPrefix.isEmpty()) {
                if (schemaTableName.getTableName().indexOf('.') != -1) {
                    // in default schema table name must not contain dots if common prefix is empty
                    throw new PrestoException(GENERIC_USER_ERROR, "Table name conflicts with schema emulation settings. No '.' allowed for tables in schema 'default'.");
                }
            }
            else {
                if (schemaTableName.getTableName().startsWith(commonPrefix)) {
                    // in default schema table name must not start with common prefix
                    throw new PrestoException(GENERIC_USER_ERROR, "Table name conflicts with schema emulation settings. Table name must not start with '" + commonPrefix + "'.");
                }
            }
        }
        else if (schemaTableName.getSchemaName().indexOf('.') != -1) {
            // schema names with dots are not possible
            throw new SchemaNotFoundException(schemaTableName.getSchemaName());
        }

        if (DEFAULT_SCHEMA.equals(schemaTableName.getSchemaName())) {
            return schemaTableName.getTableName();
        }
        else {
            return commonPrefix + schemaTableName.getSchemaName() + "." + schemaTableName.getTableName();
        }
    }

    @Override
    public SchemaTableName fromRawName(String rawName)
    {
        if (commonPrefix.isEmpty()) {
            int dotIndex = rawName.indexOf('.');
            if (dotIndex == -1) {
                return new SchemaTableName(DEFAULT_SCHEMA, rawName);
            }
            if (dotIndex == 0 || dotIndex == rawName.length() - 1) {
                return null; // illegal rawName ignored
            }
            return new SchemaTableName(rawName.substring(0, dotIndex), rawName.substring(dotIndex + 1));
        }
        if (rawName.startsWith(commonPrefix)) {
            int start = commonPrefix.length();
            int dotIndex = rawName.indexOf('.', start);
            if (dotIndex == -1 || dotIndex == start || dotIndex == rawName.length() - 1) {
                return null; // illegal rawName ignored
            }
            String schema = rawName.substring(start, dotIndex);
            if (DEFAULT_SCHEMA.equalsIgnoreCase(schema)) {
                return null; // illegal rawName ignored
            }
            return new SchemaTableName(schema, rawName.substring(dotIndex + 1));
        }
        return new SchemaTableName(DEFAULT_SCHEMA, rawName);
    }

    @Override
    public String getPrefixForTablesOfSchema(String schemaName)
    {
        if (DEFAULT_SCHEMA.equals(schemaName)) {
            return "";
        }
        else {
            return commonPrefix + schemaName + ".";
        }
    }
}


text:
package org.elasticsearch.common.io.stream;

import java.io.IOException;

/**
 * Implementers can be written to a {@linkplain StreamOutput} and read from a {@linkplain StreamInput}. This allows them to be "thrown
 * across the wire" using Elasticsearch's internal protocol. If the implementer also implements equals and hashCode then a copy made by
 * serializing and deserializing must be equal and have the same hashCode. It isn't required that such a copy be entirely unchanged. For
 * example, {@link org.elasticsearch.common.unit.TimeValue} converts the time to nanoseconds for serialization.
 * {@linkplain org.elasticsearch.common.unit.TimeValue} actually implements {@linkplain Streamable} not {@linkplain Writeable} but it has
 * the same contract.
 *
 * Prefer implementing this interface over implementing {@link Streamable} where possible. Lots of code depends on {@linkplain Streamable}
 * so this isn't always possible.
 *
 * The fact that this interface extends {@link StreamableReader} should be consider vestigial. Instead of using its
 * {@link #readFrom(StreamInput)} method you should prefer using the Reader interface as a reference to a constructor that takes
 * {@link StreamInput}. The reasoning behind this is that most "good" readFrom implementations just delegated to such a constructor anyway
 * and they required an unsightly PROTOTYPE object.
 */
public interface Writeable<T> extends StreamableReader<T> { // TODO remove extends StreamableReader<T> from this interface, and remove <T>
    /**
     * Write this into the {@linkplain StreamOutput}.
     */
    void writeTo(StreamOutput out) throws IOException;

    @Override
    default T readFrom(StreamInput in) throws IOException {
        // See class javadoc for reasoning
        throw new UnsupportedOperationException(
                "Prefer calling a constructor or static method that takes a StreamInput to calling readFrom.");
    }

    /**
     * Reference to a method that can read some object from a stream. By convention this is a constructor that takes
     * {@linkplain StreamInput} as an argument for most classes and a static method for things like enums. Returning null from one of these
     * is always wrong - for that we use methods like {@link StreamInput#readOptionalWriteable(Reader)}.
     */
    @FunctionalInterface
    interface Reader<R> {
        /**
         * Read R from a stream.
         */
        R read(StreamInput in) throws IOException;
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.storage.blob.implementation.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.DateTimeRfc1123;
import com.azure.core.util.CoreUtils;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
import java.time.OffsetDateTime;

/**
 * Defines headers for AppendBlockFromUrl operation.
 */
@JacksonXmlRootElement(localName = "AppendBlob-AppendBlockFromUrl-Headers")
@Fluent
public final class AppendBlobAppendBlockFromUrlHeaders {
    /*
     * The ETag contains a value that you can use to perform operations
     * conditionally. If the request version is 2011-08-18 or newer, the ETag
     * value will be in quotes.
     */
    @JsonProperty(value = "ETag")
    private String eTag;

    /*
     * Returns the date and time the container was last modified. Any operation
     * that modifies the blob, including an update of the blob's metadata or
     * properties, changes the last-modified time of the blob.
     */
    @JsonProperty(value = "Last-Modified")
    private DateTimeRfc1123 lastModified;

    /*
     * If the blob has an MD5 hash and this operation is to read the full blob,
     * this response header is returned so that the client can check for
     * message content integrity.
     */
    @JsonProperty(value = "Content-MD5")
    private byte[] contentMD5;

    /*
     * This header is returned so that the client can check for message content
     * integrity. The value of this header is computed by the Blob service; it
     * is not necessarily the same value specified in the request headers.
     */
    @JsonProperty(value = "x-ms-content-crc64")
    private byte[] xMsContentCrc64;

    /*
     * This header uniquely identifies the request that was made and can be
     * used for troubleshooting the request.
     */
    @JsonProperty(value = "x-ms-request-id")
    private String requestId;

    /*
     * Indicates the version of the Blob service used to execute the request.
     * This header is returned for requests made against version 2009-09-19 and
     * above.
     */
    @JsonProperty(value = "x-ms-version")
    private String version;

    /*
     * UTC date/time value generated by the service that indicates the time at
     * which the response was initiated
     */
    @JsonProperty(value = "Date")
    private DateTimeRfc1123 dateProperty;

    /*
     * This response header is returned only for append operations. It returns
     * the offset at which the block was committed, in bytes.
     */
    @JsonProperty(value = "x-ms-blob-append-offset")
    private String blobAppendOffset;

    /*
     * The number of committed blocks present in the blob. This header is
     * returned only for append blobs.
     */
    @JsonProperty(value = "x-ms-blob-committed-block-count")
    private Integer blobCommittedBlockCount;

    /*
     * The SHA-256 hash of the encryption key used to encrypt the block. This
     * header is only returned when the block was encrypted with a
     * customer-provided key.
     */
    @JsonProperty(value = "x-ms-encryption-key-sha256")
    private String encryptionKeySha256;

    /*
     * The value of this header is set to true if the contents of the request
     * are successfully encrypted using the specified algorithm, and false
     * otherwise.
     */
    @JsonProperty(value = "x-ms-request-server-encrypted")
    private Boolean isServerEncrypted;

    /*
     * The errorCode property.
     */
    @JsonProperty(value = "x-ms-error-code")
    private String errorCode;

    /**
     * Get the eTag property: The ETag contains a value that you can use to
     * perform operations conditionally. If the request version is 2011-08-18
     * or newer, the ETag value will be in quotes.
     *
     * @return the eTag value.
     */
    public String getETag() {
        return this.eTag;
    }

    /**
     * Set the eTag property: The ETag contains a value that you can use to
     * perform operations conditionally. If the request version is 2011-08-18
     * or newer, the ETag value will be in quotes.
     *
     * @param eTag the eTag value to set.
     * @return the AppendBlobAppendBlockFromUrlHeaders object itself.
     */
    public AppendBlobAppendBlockFromUrlHeaders setETag(String eTag) {
        this.eTag = eTag;
        return this;
    }

    /**
     * Get the lastModified property: Returns the date and time the container
     * was last modified. Any operation that modifies the blob, including an
     * update of the blob's metadata or properties, changes the last-modified
     * time of the blob.
     *
     * @return the lastModified value.
     */
    public OffsetDateTime getLastModified() {
        if (this.lastModified == null) {
            return null;
        }
        return this.lastModified.getDateTime();
    }

    /**
     * Set the lastModified property: Returns the date and time the container
     * was last modified. Any operation that modifies the blob, including an
     * update of the blob's metadata or properties, changes the last-modified
     * time of the blob.
     *
     * @param lastModified the lastModified value to set.
     * @return the AppendBlobAppendBlockFromUrlHeaders object itself.
     */
    public AppendBlobAppendBlockFromUrlHeaders setLastModified(OffsetDateTime lastModified) {
        if (lastModified == null) {
            this.lastModified = null;
        } else {
            this.lastModified = new DateTimeRfc1123(lastModified);
        }
        return this;
    }

    /**
     * Get the contentMD5 property: If the blob has an MD5 hash and this
     * operation is to read the full blob, this response header is returned so
     * that the client can check for message content integrity.
     *
     * @return the contentMD5 value.
     */
    public byte[] getContentMD5() {
        return CoreUtils.clone(this.contentMD5);
    }

    /**
     * Set the contentMD5 property: If the blob has an MD5 hash and this
     * operation is to read the full blob, this response header is returned so
     * that the client can check for message content integrity.
     *
     * @param contentMD5 the contentMD5 value to set.
     * @return the AppendBlobAppendBlockFromUrlHeaders object itself.
     */
    public AppendBlobAppendBlockFromUrlHeaders setContentMD5(byte[] contentMD5) {
        this.contentMD5 = CoreUtils.clone(contentMD5);
        return this;
    }

    /**
     * Get the xMsContentCrc64 property: This header is returned so that the
     * client can check for message content integrity. The value of this header
     * is computed by the Blob service; it is not necessarily the same value
     * specified in the request headers.
     *
     * @return the xMsContentCrc64 value.
     */
    public byte[] getXMsContentCrc64() {
        return CoreUtils.clone(this.xMsContentCrc64);
    }

    /**
     * Set the xMsContentCrc64 property: This header is returned so that the
     * client can check for message content integrity. The value of this header
     * is computed by the Blob service; it is not necessarily the same value
     * specified in the request headers.
     *
     * @param xMsContentCrc64 the xMsContentCrc64 value to set.
     * @return the AppendBlobAppendBlockFromUrlHeaders object itself.
     */
    public AppendBlobAppendBlockFromUrlHeaders setXMsContentCrc64(byte[] xMsContentCrc64) {
        this.xMsContentCrc64 = CoreUtils.clone(xMsContentCrc64);
        return this;
    }

    /**
     * Get the requestId property: This header uniquely identifies the request
     * that was made and can be used for troubleshooting the request.
     *
     * @return the requestId value.
     */
    public String getRequestId() {
        return this.requestId;
    }

    /**
     * Set the requestId property: This header uniquely identifies the request
     * that was made and can be used for troubleshooting the request.
     *
     * @param requestId the requestId value to set.
     * @return the AppendBlobAppendBlockFromUrlHeaders object itself.
     */
    public AppendBlobAppendBlockFromUrlHeaders setRequestId(String requestId) {
        this.requestId = requestId;
        return this;
    }

    /**
     * Get the version property: Indicates the version of the Blob service used
     * to execute the request. This header is returned for requests made
     * against version 2009-09-19 and above.
     *
     * @return the version value.
     */
    public String getVersion() {
        return this.version;
    }

    /**
     * Set the version property: Indicates the version of the Blob service used
     * to execute the request. This header is returned for requests made
     * against version 2009-09-19 and above.
     *
     * @param version the version value to set.
     * @return the AppendBlobAppendBlockFromUrlHeaders object itself.
     */
    public AppendBlobAppendBlockFromUrlHeaders setVersion(String version) {
        this.version = version;
        return this;
    }

    /**
     * Get the dateProperty property: UTC date/time value generated by the
     * service that indicates the time at which the response was initiated.
     *
     * @return the dateProperty value.
     */
    public OffsetDateTime getDateProperty() {
        if (this.dateProperty == null) {
            return null;
        }
        return this.dateProperty.getDateTime();
    }

    /**
     * Set the dateProperty property: UTC date/time value generated by the
     * service that indicates the time at which the response was initiated.
     *
     * @param dateProperty the dateProperty value to set.
     * @return the AppendBlobAppendBlockFromUrlHeaders object itself.
     */
    public AppendBlobAppendBlockFromUrlHeaders setDateProperty(OffsetDateTime dateProperty) {
        if (dateProperty == null) {
            this.dateProperty = null;
        } else {
            this.dateProperty = new DateTimeRfc1123(dateProperty);
        }
        return this;
    }

    /**
     * Get the blobAppendOffset property: This response header is returned only
     * for append operations. It returns the offset at which the block was
     * committed, in bytes.
     *
     * @return the blobAppendOffset value.
     */
    public String getBlobAppendOffset() {
        return this.blobAppendOffset;
    }

    /**
     * Set the blobAppendOffset property: This response header is returned only
     * for append operations. It returns the offset at which the block was
     * committed, in bytes.
     *
     * @param blobAppendOffset the blobAppendOffset value to set.
     * @return the AppendBlobAppendBlockFromUrlHeaders object itself.
     */
    public AppendBlobAppendBlockFromUrlHeaders setBlobAppendOffset(String blobAppendOffset) {
        this.blobAppendOffset = blobAppendOffset;
        return this;
    }

    /**
     * Get the blobCommittedBlockCount property: The number of committed blocks
     * present in the blob. This header is returned only for append blobs.
     *
     * @return the blobCommittedBlockCount value.
     */
    public Integer getBlobCommittedBlockCount() {
        return this.blobCommittedBlockCount;
    }

    /**
     * Set the blobCommittedBlockCount property: The number of committed blocks
     * present in the blob. This header is returned only for append blobs.
     *
     * @param blobCommittedBlockCount the blobCommittedBlockCount value to set.
     * @return the AppendBlobAppendBlockFromUrlHeaders object itself.
     */
    public AppendBlobAppendBlockFromUrlHeaders setBlobCommittedBlockCount(Integer blobCommittedBlockCount) {
        this.blobCommittedBlockCount = blobCommittedBlockCount;
        return this;
    }

    /**
     * Get the encryptionKeySha256 property: The SHA-256 hash of the encryption
     * key used to encrypt the block. This header is only returned when the
     * block was encrypted with a customer-provided key.
     *
     * @return the encryptionKeySha256 value.
     */
    public String getEncryptionKeySha256() {
        return this.encryptionKeySha256;
    }

    /**
     * Set the encryptionKeySha256 property: The SHA-256 hash of the encryption
     * key used to encrypt the block. This header is only returned when the
     * block was encrypted with a customer-provided key.
     *
     * @param encryptionKeySha256 the encryptionKeySha256 value to set.
     * @return the AppendBlobAppendBlockFromUrlHeaders object itself.
     */
    public AppendBlobAppendBlockFromUrlHeaders setEncryptionKeySha256(String encryptionKeySha256) {
        this.encryptionKeySha256 = encryptionKeySha256;
        return this;
    }

    /**
     * Get the isServerEncrypted property: The value of this header is set to
     * true if the contents of the request are successfully encrypted using the
     * specified algorithm, and false otherwise.
     *
     * @return the isServerEncrypted value.
     */
    public Boolean isServerEncrypted() {
        return this.isServerEncrypted;
    }

    /**
     * Set the isServerEncrypted property: The value of this header is set to
     * true if the contents of the request are successfully encrypted using the
     * specified algorithm, and false otherwise.
     *
     * @param isServerEncrypted the isServerEncrypted value to set.
     * @return the AppendBlobAppendBlockFromUrlHeaders object itself.
     */
    public AppendBlobAppendBlockFromUrlHeaders setIsServerEncrypted(Boolean isServerEncrypted) {
        this.isServerEncrypted = isServerEncrypted;
        return this;
    }

    /**
     * Get the errorCode property: The errorCode property.
     *
     * @return the errorCode value.
     */
    public String getErrorCode() {
        return this.errorCode;
    }

    /**
     * Set the errorCode property: The errorCode property.
     *
     * @param errorCode the errorCode value to set.
     * @return the AppendBlobAppendBlockFromUrlHeaders object itself.
     */
    public AppendBlobAppendBlockFromUrlHeaders setErrorCode(String errorCode) {
        this.errorCode = errorCode;
        return this;
    }
}


text:
You'll need the fonts Lato and Source Code Pro installed to edit this
file. These may be obtained at
https://www.google.com/fonts#UsePlace:use/Collection:Lato and
https://www.google.com/fonts#UsePlace:use/Collection:Source+Code+Pro respectively.


text:
extern const struct UnitAttributes {
	__unsafe_unretained NSString *centimeter;
	__unsafe_unretained NSString *date;
	__unsafe_unretained NSString *identifier;
} UnitAttributes;

extern const struct UnitRelationships {
	__unsafe_unretained NSString *person;
} UnitRelationships;

extern const struct UnitFetchedProperties {
} UnitFetchedProperties;

@class Person;

@interface UnitID : NSManagedObjectID {}
@end

@interface _Unit : ManagedMappingObject {}
+ (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_;
+ (NSString*)entityName;
+ (NSEntityDescription*)entityInManagedObjectContext:(NSManagedObjectContext*)moc_;
- (UnitID*)objectID;

@property (nonatomic, strong) NSNumber* centimeter;

@property double centimeterValue;
- (double)centimeterValue;
- (void)setCentimeterValue:(double)value_;

//- (BOOL)validateCentimeter:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) NSDate* date;

//- (BOOL)validateDate:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) NSString* identifier;

//- (BOOL)validateIdentifier:(id*)value_ error:(NSError**)error_;

@property (nonatomic, strong) Person *person;

//- (BOOL)validatePerson:(id*)value_ error:(NSError**)error_;

@end

@interface _Unit (CoreDataGeneratedAccessors)

@end

@interface _Unit (CoreDataGeneratedPrimitiveAccessors)

- (NSNumber*)primitiveCentimeter;
- (void)setPrimitiveCentimeter:(NSNumber*)value;

- (double)primitiveCentimeterValue;
- (void)setPrimitiveCentimeterValue:(double)value_;

- (NSDate*)primitiveDate;
- (void)setPrimitiveDate:(NSDate*)value;

- (NSString*)primitiveIdentifier;
- (void)setPrimitiveIdentifier:(NSString*)value;

- (Person*)primitivePerson;
- (void)setPrimitivePerson:(Person*)value;

@end


text:
/**
 * Adopted from FastDom
 * https://github.com/wilsonpage/fastdom
 * MIT License
 */
import { Injectable } from '@angular/core';
import { Platform } from './platform';
import { removeArrayItem } from '../util/util';

/**
 * @hidden
 */
export class DomDebouncer {

  private writeTask: Function = null;
  private readTask: Function = null;

  constructor(private dom: DomController) { }

  read(fn: DomCallback): Function {
    if (this.readTask) {
      return;
    }
    return this.readTask = this.dom.read((t) => {
      this.readTask = null;
      fn(t);
    });
  }

  write(fn: DomCallback): Function {
    if (this.writeTask) {
      return;
    }

    return this.writeTask = this.dom.write((t) => {
      this.writeTask = null;
      fn(t);
    });
  }

  cancel() {
    const writeTask = this.writeTask;
    writeTask && this.dom.cancel(writeTask);

    const readTask = this.readTask;
    readTask && this.dom.cancel(readTask);
    this.readTask = this.writeTask = null;
  }
}

/**
 * @hidden
 */
@Injectable()
export class DomController {
  private r: Function[] = [];
  private w: Function[] = [];
  private q: boolean;

  constructor(public plt: Platform) {}

  debouncer(): DomDebouncer {
    return new DomDebouncer(this);
  }

  read(fn: DomCallback, timeout?: number): any {
    if (timeout) {
      (<any>fn).timeoutId = this.plt.timeout(() => {
        this.r.push(fn);
        this._queue();
      }, timeout);

    } else {
      this.r.push(fn);
      this._queue();
    }
    return fn;
  }

  write(fn: DomCallback, timeout?: number): any {
    if (timeout) {
      (<any>fn).timeoutId = this.plt.timeout(() => {
        this.w.push(fn);
        this._queue();
      }, timeout);

    } else {
      this.w.push(fn);
      this._queue();
    }
    return fn;
  }

  cancel(fn: any): void {
    if (fn) {
      if (fn.timeoutId) {
        this.plt.cancelTimeout(fn.timeoutId);
      }
      removeArrayItem(this.r, fn) || removeArrayItem(this.w, fn);
    }
  }

  private _queue() {
    const self = this;
    if (!self.q) {
      self.q = true;
      self.plt.raf(function rafCallback(timeStamp) {
        self._flush(timeStamp);
      });
    }
  }

  private _flush(timeStamp: number) {
    let err: any;

    try {
      dispatch(timeStamp, this.r, this.w);
    } catch (e) {
      err = e;
    }

    this.q = false;

    if (this.r.length || this.w.length) {
      this._queue();
    }

    if (err) {
      throw err;
    }
  }

}

function dispatch(timeStamp: number, r: Function[], w: Function[]) {
  let fn: Function;

  // ******** DOM READS ****************
  while (fn = r.shift()) {
    fn(timeStamp);
  }

  // ******** DOM WRITES ****************
  while (fn = w.shift()) {
    fn(timeStamp);
  }
}

/**
 * @hidden
 */
export type DomCallback = { (timeStamp?: number): void };


text:
namespace Sequencing.WeatherApp.Models
{
    using System;
    using System.Collections.Generic;

    public partial class Condition
    {
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
        public Condition()
        {
            this.Recommendations = new HashSet<Recommendation>();
            this.SendForecasts = new HashSet<SendForecast>();
        }

        public long Id { get; set; }
        public string WeatherCond { get; set; }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<Recommendation> Recommendations { get; set; }
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public virtual ICollection<SendForecast> SendForecasts { get; set; }
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements. See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership. The ASF licenses this file
  to you 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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
  xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
  xsi:schemaLocation="http://www.springframework.org/schema/beans
                        http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
                         http://www.springframework.org/schema/tx
       http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
       http://www.springframework.org/schema/aop
       http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
                                 http://www.springframework.org/schema/context
                                          http://www.springframework.org/schema/context/spring-context-3.0.xsd">
  <context:annotation-config />
  <context:component-scan base-package="org.apache.cloudstack.storage" />
  <context:component-scan base-package="org.apache.cloudstack.engine.subsystem.api.storage" />
  <context:component-scan base-package="com.cloud.utils.db" />
  <context:component-scan base-package="com.cloud.utils.component" />
  <context:component-scan base-package="com.cloud.host.dao" />
  <context:component-scan base-package="com.cloud.dc.dao" />

   <context:component-scan base-package=" com.cloud.upgrade.dao" />
   <tx:annotation-driven transaction-manager="transactionManager" />
  <bean id="aopTestBean" class="org.apache.cloudstack.storage.test.AopTestAdvice"/>
  <aop:config proxy-target-class="true" >
    <aop:aspect id="AopTestAdvice" ref="aopTestBean">
    <aop:pointcut id="aoptest"
      expression="@annotation(com.cloud.utils.db.DB)" />
      <aop:around pointcut-ref="aoptest" method="AopTestMethod"/>
    </aop:aspect>
  </aop:config>

  <bean class="org.apache.cloudstack.storage.test.ChildTestConfiguration" />

</beans>


text:
class JavaScriptObjectProxy;

// This class handles the execution of arbitrary JavaScript, preparing it for
// execution, and parsing its result (in JSON). It keeps track of all returned
// JavaScript objects.
class JavaScriptExecutionController
    : public base::SupportsWeakPtr<JavaScriptExecutionController> {
 public:
  JavaScriptExecutionController();
  virtual ~JavaScriptExecutionController();

  // Executes |script| and parse the return value. Returns whether the
  // execution and parsing succeeded.
  template <typename T>
  bool ExecuteJavaScriptAndGetReturn(const std::string& script, T* result) {
    scoped_ptr<Value> returnValue;
    if (!ExecuteAndParseHelper(WrapJavaScript(script), &returnValue))
      return false;
    return ValueConversionTraits<T>::SetFromValue(returnValue.get(), result);
  }

  // Similar to above, except that it does not get the return value.
  bool ExecuteJavaScript(const std::string& script);

  // Executes |script|, waits for it to send a JSON response, and parses the
  // return value. This call itself blocks, but the JavaScript responds
  // asynchronously. Returns whether the execution and parsing succeeded.
  // Will return false on timeouts.
  template <typename T>
  bool ExecuteAsyncJavaScriptAndGetReturn(const std::string& script,
                                          T* result) {
    scoped_ptr<Value> returnValue;
    if (!ExecuteAndParseHelper(WrapAsyncJavaScript(script), &returnValue))
      return false;
    return ValueConversionTraits<T>::SetFromValue(returnValue.get(), result);
  }

  // Similar to above, except that it does not get the return value.
  bool ExecuteAsyncJavaScript(const std::string& script);

  // Returns the proxy associated with |handle|, creating one if necessary.
  // The proxy must be inherit JavaScriptObjectProxy.
  template<class JavaScriptObject>
  JavaScriptObject* GetObjectProxy(int handle) {
    JavaScriptObject* obj = NULL;
    HandleToObjectMap::const_iterator iter = handle_to_object_.find(handle);
    if (iter == handle_to_object_.end()) {
      obj = new JavaScriptObject(this, handle);
      if (handle_to_object_.empty())
        FirstObjectAdded();
      handle_to_object_.insert(std::make_pair(handle, obj));
    } else {
      obj = static_cast<JavaScriptObject*>(iter->second);
    }
    return obj;
  }

  // Sets a timeout to be used for all JavaScript methods in which a response
  // is returned asynchronously.
  static void set_timeout(int timeout_ms) { timeout_ms_ = timeout_ms; }

 protected:
  // Executes |script| and sets the JSON response |json|. Returns true
  // on success.
  virtual bool ExecuteJavaScriptAndGetJSON(const std::string& script,
                                           std::string* json) = 0;

  // Called when this controller is tracking its first object. Used by
  // reference counted subclasses.
  virtual void FirstObjectAdded() {}

  // Called when this controller is no longer tracking any objects. Used by
  // reference counted subclasses.
  virtual void LastObjectRemoved() {}

 private:
  typedef std::map<int, JavaScriptObjectProxy*> HandleToObjectMap;

  friend class JavaScriptObjectProxy;
  // Called by JavaScriptObjectProxy on destruction.
  void Remove(int handle);

  // Helper method for executing JavaScript and parsing the JSON response.
  // If successful, returns true and sets |returnValue| as the script's return
  // value.
  bool ExecuteAndParseHelper(const std::string& script,
                             scoped_ptr<Value>* returnValue);

  // Returns |script| wrapped and prepared for proper JavaScript execution,
  // via the JavaScript function domAutomation.evaluateJavaScript.
  std::string WrapJavaScript(const std::string& script);

  // Returns |script| wrapped and prepared for proper JavaScript execution
  // via the JavaScript function domAutomation.evaluateAsyncJavaScript.
  std::string WrapAsyncJavaScript(const std::string& script);

  // Timeout to use for all asynchronous methods.
  static int timeout_ms_;

  // Weak pointer to all the object proxies that we create.
  HandleToObjectMap handle_to_object_;

  DISALLOW_COPY_AND_ASSIGN(JavaScriptExecutionController);
};

#endif  // CHROME_TEST_AUTOMATION_JAVASCRIPT_EXECUTION_CONTROLLER_H_


text:
function round(params) {
    let number = params[0];
    let precision = params[1];

    var factor = Math.pow(10, precision);
    return Math.round(number * factor) / factor;
}

console.log(round([3.1415926535897932384626433832795, 2]));
console.log(round([10.5, 3]));


text:
<?xml version="1.0" encoding="utf-8" ?>
<xsd:schema targetNamespace="http://von-und-fuer-lau.de/gpsplot/1/0" elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://von-und-fuer-lau.de/gpsplot/1/0">

    <xsd:annotation>
        <xsd:documentation>
            gpsplot configuration file schema version 1.0 - Mehr Informationen unter http://von-und-fuer-lau.de/gpsplot.html
        </xsd:documentation>
    </xsd:annotation>

    <xsd:element name="config" type="configType">
        <xsd:annotation>
            <xsd:documentation>CONFIG is the root element in the XML file.</xsd:documentation>
        </xsd:annotation>
    </xsd:element>

    <xsd:complexType name="generalParametersType">
        <xsd:sequence>
        	<xsd:element name="title" type="xsd:string" maxOccurs="1"
        		minOccurs="0">
        		<xsd:annotation>
        			<xsd:documentation>
        				Dieser Text erscheint als Überschrift in der
        				erzeugten Grafik.
        			</xsd:documentation>
        		</xsd:annotation>
        	</xsd:element>
        	<xsd:element name="url" type="xsd:string" maxOccurs="1"
        		minOccurs="0">
        	</xsd:element>
        	<xsd:element name="author" type="authorType" maxOccurs="1"
        		minOccurs="0">
        	</xsd:element>
        	<xsd:element name="encoding" type="xsd:string" maxOccurs="1" minOccurs="0"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="authorType">
        <xsd:annotation>
            <xsd:documentation>
                Informationen über den Sammler der GPS-Daten.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="name" type="xsd:string"></xsd:element>
            <xsd:element name="email" type="xsd:string"></xsd:element>
            <xsd:element name="url" type="xsd:string"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="configType">
        <xsd:annotation>
            <xsd:documentation>gpsplot-Konfiguration.</xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="general" type="generalParametersType" maxOccurs="1" minOccurs="1"></xsd:element>
            <xsd:element name="input" type="inputType" maxOccurs="1" minOccurs="1"></xsd:element>
            <xsd:element name="calculations" type="calculationsType" maxOccurs="1" minOccurs="0"></xsd:element>
            <xsd:element name="gnuplot" type="gnuplotType" maxOccurs="1" minOccurs="1"></xsd:element>
            <xsd:element name="dump" type="dumpType" maxOccurs="1" minOccurs="0"></xsd:element>
            <xsd:element name="kml" type="kmlType" maxOccurs="1" minOccurs="0"></xsd:element>
            <xsd:element name="googlemaps" type="googlemapsType" maxOccurs="1" minOccurs="0"></xsd:element>
        </xsd:sequence>

        <xsd:attribute name="version" type="xsd:string" use="required" fixed="1.0">
            <xsd:annotation>
                <xsd:documentation>
                    Das CONFIG-Element muss die Versionsbezeichnung "1.0" tragen.
                </xsd:documentation>
            </xsd:annotation>
        </xsd:attribute>
    </xsd:complexType>

    <xsd:complexType name="inputType">
        <xsd:sequence>
            <xsd:element name="default" type="defaultFileType" maxOccurs="1" minOccurs="1"></xsd:element>
            <xsd:element name="merge" type="mergeFileType" maxOccurs="unbounded" minOccurs="0"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="defaultFileType">
        <xsd:sequence>
            <xsd:element name="file" type="xsd:string" maxOccurs="1" minOccurs="1">
                <xsd:annotation>
                    <xsd:documentation>
                        Pfad und Name der Datei, aus der die Daten
                        gelesen werden sollen. Der Pfad kann absolut
                        oder relativ sein.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
            <xsd:element name="offset" type="timeOffsetType" maxOccurs="1" minOccurs="0">
                <xsd:annotation>
                    <xsd:documentation>
                        Zeitstempel um das angegebene Maß in die Zukunft
                        oder die Vergangenheit verschieben.
                    </xsd:documentation>
                </xsd:annotation>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="timeOffsetType">
        <xsd:annotation>
            <xsd:documentation>
                Format des Zeitstempeloffsets.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:pattern value="[+\-]\d{2}:\d{2}:\d{2}"></xsd:pattern>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="calculationsType">
        <xsd:sequence>
            <xsd:element name="smoothing" type="smoothingsType" maxOccurs="unbounded" minOccurs="0"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="smoothingsType">
        <xsd:sequence>
            <xsd:element name="algorithm" type="algorithmType" maxOccurs="1" minOccurs="0"></xsd:element>
            <xsd:element name="param" type="xsd:decimal" maxOccurs="1" minOccurs="0"></xsd:element>
            <xsd:element name="draw" type="xsd:boolean" maxOccurs="1" minOccurs="1"></xsd:element>
            <xsd:element name="gnuplotOption" type="xsd:string" maxOccurs="1" minOccurs="0"></xsd:element>
        </xsd:sequence>
        <xsd:attribute name="id" type="xsd:string"></xsd:attribute>
    </xsd:complexType>

    <xsd:simpleType name="algorithmType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="threshold"></xsd:enumeration>
            <xsd:enumeration value="douglas_peucker"></xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="gnuplotType">
        <xsd:annotation>
            <xsd:documentation>Parameter für gnuplot.</xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
        	<xsd:element name="executable" type="xsd:string"
        		maxOccurs="1" minOccurs="1">
        	</xsd:element>
        	<xsd:element name="format" type="xsd:string" maxOccurs="1"
        		minOccurs="1">
        	</xsd:element>
        	<xsd:element name="suffix" type="xsd:string" maxOccurs="1"
        		minOccurs="1">
        	</xsd:element>
        	<xsd:element name="xaxis" type="xaxisType" maxOccurs="1"
        		minOccurs="1">
        	</xsd:element>
        	<xsd:element name="speedInterval" type="speedIntervalType"
        		maxOccurs="1" minOccurs="1">
        	</xsd:element>
        	<xsd:element name="legend" type="xsd:boolean" maxOccurs="1"
        		minOccurs="1">
        	</xsd:element>
        	<xsd:element name="elevation" type="dimensionsType"
        		maxOccurs="1" minOccurs="1">
        	</xsd:element>
        	<xsd:element name="speed" type="dimensionsAndSourceType"
        		maxOccurs="1" minOccurs="0">
        	</xsd:element>
        	<xsd:element name="hr" type="dimensionsType" maxOccurs="1"
        		minOccurs="0">
        	</xsd:element>
        	<xsd:element name="slope" type="dimensionsAndSourceType"
        		maxOccurs="1" minOccurs="0">
        	</xsd:element>
        	<xsd:element name="padding" type="xsd:boolean" maxOccurs="1" minOccurs="0"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:simpleType name="xaxisType">
        <xsd:annotation>
            <xsd:documentation>Skalierung der x-Achse.</xsd:documentation>
        </xsd:annotation>
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="distance"></xsd:enumeration>
            <xsd:enumeration value="datetime"></xsd:enumeration>
            <xsd:enumeration value="duration"></xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="speedIntervalType">
        <xsd:simpleContent>
            <xsd:extension base="xsd:int">
                <xsd:attribute name="unit" type="intervalUnitType"></xsd:attribute>
            </xsd:extension>
        </xsd:simpleContent>
    </xsd:complexType>

    <xsd:simpleType name="intervalUnitType">
        <xsd:restriction base="xsd:string">
            <xsd:enumeration value="seconds"></xsd:enumeration>
            <xsd:enumeration value="meters"></xsd:enumeration>
        </xsd:restriction>
    </xsd:simpleType>

    <xsd:complexType name="dimensionsType">
        <xsd:annotation>
            <xsd:documentation>Größe und Darstellungsparameter der einzelnen Plot-Abschnitte.</xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="height" maxOccurs="1" minOccurs="1">
                <xsd:simpleType>
                    <xsd:restriction base="xsd:int">
                        <xsd:minInclusive value="0"></xsd:minInclusive>
                        <xsd:maxInclusive value="100"></xsd:maxInclusive>
                    </xsd:restriction>
                </xsd:simpleType>
            </xsd:element>
            <xsd:element name="range" type="rangeType" maxOccurs="1" minOccurs="0"></xsd:element>
            <xsd:element name="average" type="xsd:boolean" maxOccurs="1" minOccurs="0"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="rangeType">
        <xsd:sequence>
            <xsd:element name="lo" type="xsd:decimal" minOccurs="0" maxOccurs="1"></xsd:element>
            <xsd:element name="hi" type="xsd:decimal" minOccurs="0" maxOccurs="1"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="dimensionsAndSourceType">
        <xsd:complexContent>
            <xsd:extension base="dimensionsType">
                <xsd:sequence>
                    <xsd:element name="source" type="xsd:string" maxOccurs="1" minOccurs="1"></xsd:element>
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>

    <xsd:complexType name="dumpType">
        <xsd:sequence>
            <xsd:element name="file" type="xsd:string" maxOccurs="1" minOccurs="1"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="kmlType">
        <xsd:sequence>
            <xsd:element name="file" type="xsd:string" maxOccurs="1" minOccurs="1"></xsd:element>
            <xsd:element name="start" type="xsd:boolean" maxOccurs="1" minOccurs="0"></xsd:element>
            <xsd:element name="finish" type="xsd:boolean" maxOccurs="1" minOccurs="0"></xsd:element>
            <xsd:element name="ticks" type="xsd:positiveInteger" maxOccurs="1" minOccurs="0"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="googlemapsType">
        <xsd:annotation>
            <xsd:documentation>
                Einstellungen der JavaScript-Datei, um den Track mit
                Hilfe des Google-Maps-API in der eigenen Webseite
                darzustellen.
            </xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="file" type="xsd:string" maxOccurs="1" minOccurs="1"></xsd:element>
        </xsd:sequence>
    </xsd:complexType>

    <xsd:complexType name="mergeFileType">
    	<xsd:sequence>
    		<xsd:element name="file" type="xsd:string" maxOccurs="1"
    			minOccurs="1">
    		</xsd:element>
    		<xsd:element name="offset" type="timeOffsetType"
    			maxOccurs="1" minOccurs="0">
    		</xsd:element>
    		<xsd:element name="use">
    			<xsd:simpleType>
    				<xsd:restriction base="xsd:string">
    					<xsd:enumeration value="heartrate"></xsd:enumeration>
    					<xsd:enumeration value="elevation"></xsd:enumeration>
    					<xsd:enumeration value="geocoords"></xsd:enumeration>
    				</xsd:restriction>
    			</xsd:simpleType>
    		</xsd:element>
    	</xsd:sequence>
    </xsd:complexType>
</xsd:schema>


text:
sleep
=====

Add [`sleep()`][1] and [`usleep()`][2] to Node.js, via a C++ binding.

This is mainly useful for debugging.

**These calls will block execution of all JavaScript by halting Node.js' event loop!**

Usage
-----

    var sleep = require('sleep');

* `sleep.sleep(n)`: sleep for `n` seconds
* `sleep.usleep(n)`: sleep for `n` microseconds (1 second is 1000000 microseconds)

You can also install this as global dependency:

    npm install -g
    sleep 1
    usleep 1000

On unices or when you have already installed `sleep` and `usleep`, this
installation will not override those. You can instead then use the CLI by
running `sleepuv 1` and `usleepuv 1000`.

[1]: http://linux.die.net/man/3/sleep
[2]: http://linux.die.net/man/3/usleep


text:
get '/surveys/new' do
  erb :create
end

post '/surveys/create' do
  p params
  num_of_questions = params.length - 1
  question_number = 1
  p params["1"][1]
  survey = Survey.create(title: params[:title], creator_id: current_user.id)
  num_of_questions.times do
    question = Question.create(content: params[question_number.to_s][0], survey_id: survey.id)
    params[question_number.to_s][1].each do |index, content|
      Choice.create(content: content, question_id: question.id)
    end
    question_number += 1
  end

  redirect '/users/surveys'
end

get '/surveys/:id' do
  @survey = Survey.find(params[:id])
  erb :survey
end

get '/surveys/:id/questions' do
  questions = Survey.find(params[:id]).questions
  content_type :json
  [Survey.find(params[:id]).title, questions].to_json
end

post '/surveys/:id/finish' do
  questions = JSON.parse(params[:qs], {:symbolize_names => true})
  current_user.saveResponses(params[:id],questions)
  status 200
end

delete '/surveys/:id' do
  survey = Survey.find(params[:id])
  survey.destroy
  redirect '/users/surveys'
end


text:
<?php

namespace yiiunit\framework\db\pgsql;

use yiiunit\framework\db\ConnectionTest;

class PostgreSQLConnectionTest extends ConnectionTest {

	public function setUp() {
		$this->driverName = 'pgsql';
		parent::setUp();
	}

	public function testConnection() {
		$connection = $this->getConnection(true);
	}

	function testQuoteValue() {
		$connection = $this->getConnection(false);
		$this->assertEquals(123, $connection->quoteValue(123));
		$this->assertEquals("'string'", $connection->quoteValue('string'));
		$this->assertEquals("'It''s interesting'", $connection->quoteValue("It's interesting"));
	}

	function testQuoteTableName()
	{
		$connection = $this->getConnection(false);
		$this->assertEquals('"table"', $connection->quoteTableName('table'));
		$this->assertEquals('"table"', $connection->quoteTableName('"table"'));
		$this->assertEquals('"schema"."table"', $connection->quoteTableName('schema.table'));
		$this->assertEquals('"schema"."table"', $connection->quoteTableName('schema."table"'));
		$this->assertEquals('"schema"."table"', $connection->quoteTableName('"schema"."table"'));
		$this->assertEquals('{{table}}', $connection->quoteTableName('{{table}}'));
		$this->assertEquals('(table)', $connection->quoteTableName('(table)'));
	}

	function testQuoteColumnName()
	{
		$connection = $this->getConnection(false);
		$this->assertEquals('"column"', $connection->quoteColumnName('column'));
		$this->assertEquals('"column"', $connection->quoteColumnName('"column"'));
		$this->assertEquals('"table"."column"', $connection->quoteColumnName('table.column'));
		$this->assertEquals('"table"."column"', $connection->quoteColumnName('table."column"'));
		$this->assertEquals('"table"."column"', $connection->quoteColumnName('"table"."column"'));
		$this->assertEquals('[[column]]', $connection->quoteColumnName('[[column]]'));
		$this->assertEquals('{{column}}', $connection->quoteColumnName('{{column}}'));
		$this->assertEquals('(column)', $connection->quoteColumnName('(column)'));
	}

}


text:
<!DOCTYPE html>
<title>CSS RefTest Reference</title>
<link rel="author" title="Adobe" href="http://html.adobe.com/">
<link rel="author" title="Bem Jones-Bey" href="mailto:bjonesbe@adobe.com">
<meta name="flags" content="ahem">

Test passes if you see two black rectangle boxes with a smaller white rectangle in one corner.

        X

        X

        X

        XXX

        X

        X

        X

        XXX


text:
package com.tom.storage.tileentity.inventory;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;

import com.tom.api.inventory.IStorageInventory.BasicFilter.Mode;
import com.tom.api.inventory.SlotPhantom;
import com.tom.storage.multipart.PartStorageBus;

import com.tom.core.tileentity.inventory.ContainerTomsMod;

public class ContainerStorageBus extends ContainerTomsMod {
	//private PartStorageBus part;

	public ContainerStorageBus(PartStorageBus bus, InventoryPlayer inventory) {
		//this.part = bus;
		for (int i = 0;i < 4;++i) {
			for (int j = 0;j < 9;++j) {
				addSlotToContainer(new SlotPhantom(bus.filterInv, j + i * 9, 8 + j * 18, 11 + i * 18));
			}
		}
		addPlayerSlots(inventory, 8, 94);
		syncHandler.registerBoolean(0, bus::isWhiteList, bus::setWhiteList);
		syncHandler.registerBoolean(1, bus::isCheckMeta, bus::setCheckMeta);
		syncHandler.registerBoolean(2, bus::isCheckNBT, bus::setCheckNBT);
		syncHandler.registerBoolean(3, bus::isCheckMod, bus::setCheckMod);
		syncHandler.registerBoolean(4, bus::isCanViewAll, bus::setCanViewAll);
		syncHandler.registerEnum(5, bus::getMode, bus::setMode, Mode.VALUES);
		syncHandler.setReceiver(bus);
	}

	@Override
	public boolean canInteractWith(EntityPlayer playerIn) {
		return true;
	}
}


text:
const { EventEmitter } = require('events')
const { expect } = require('code')
const Lab = require('lab')
const Proxyquire = require('proxyquire')
const Sinon = require('sinon')

let SpawnStub = {}
const Tar = Proxyquire('../src/tar', {
  'child_process': SpawnStub
})

const { beforeEach, describe, it } = exports.lab = Lab.script()

describe('src/tar', () => {
  let datetime, emitter, options

  beforeEach((done) => {
    datetime = new Date()
    emitter = new EventEmitter()
    SpawnStub.spawn = Sinon.stub().returns(emitter)
    options = { output: process.cwd(), datetime }

    done()
  })

  it('builds tar arguments', (done) => {
    const tarArgs = [
      '-czvf',
      `${process.cwd()}/${datetime}.tar.gz`,
      `${process.cwd()}/${datetime}`
    ]

    Tar(options)(() => {
      expect(SpawnStub.spawn.calledWith('tar', tarArgs)).to.be.true()
      done()
    })

    emitter.emit('close', 0)
  })

  it('yields an error when emitted', (done) => {
    const errMessage = new Error('emitter error')
    Tar(options)((err) => {
      expect(err).to.equal(err)
      done()
    })

    emitter.emit('error', errMessage)
  })

  it('yields an error on non zero exit code', (done) => {
    Tar(options)((err) => {
      expect(err.message).to.equal('Tar directory failed')
      done()
    })

    emitter.emit('close', 1)
  })
})


text:
package de.escidocng.integration.fs.authorize;

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

import java.util.ArrayList;
import java.util.List;

import de.escidocng.integration.fs.helpers.AuthConfigurer;
import de.escidocng.integration.fs.helpers.AuthConfigurer.MissingPermission;
import de.escidocng.integration.fs.helpers.AuthConfigurer.RoleRestriction;
import de.escidocng.test.util.Fixtures;

import org.apache.http.HttpResponse;
import org.apache.http.util.EntityUtils;
import org.junit.Before;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpMethod;

import de.escidocng.model.security.role.AdminRole;
import de.escidocng.model.security.role.Level1AdminRole;
import de.escidocng.model.security.role.Right;
import de.escidocng.model.security.role.Role;
import de.escidocng.model.security.role.UserAdminRole;
import de.escidocng.model.security.role.UserRole;
import de.escidocng.model.security.role.Role.RoleRight;

public class AuthorizeRoleControllerIT extends AbstractAuthorizeEscidocngIT {

    private static final Logger log = LoggerFactory.getLogger(AuthorizeRoleControllerIT.class);

    private static int methodCounter = 0;

    private static String username;

    private static Role userRole;

    private static Role adminRole;

    private static Role userAdminRole;

    private static Role level1AdminRole;

    @Before
    public void initialize() throws Exception {
        if (methodCounter == 0) {
            prepareLevel2();
            prepareRoles();
            methodCounter++;
        }
    }

    @Test
    public void testCreateRoles() throws Exception {
        List<Role> userRoles = new ArrayList<Role>();
        userRoles.add(adminRole);

        testUserRoleAuth(new AuthConfigurer.AuthConfigurerBuilder(
                HttpMethod.POST, userUrl + username + "/roles")
                .body(this.mapper.writeValueAsString(userRoles))
                .roleRestriction(RoleRestriction.ADMIN)
                .build());

        // level1 admin
        userRoles.remove(adminRole);
        userRoles.add(level1AdminRole);
        HttpResponse resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/roles", this.mapper
                        .writeValueAsString(userRoles),
                        level1AdminRoleUsernames.get("ROLE_LEVEL1_ADMIN" + level1Id1)[0], level1AdminRoleUsernames
                                .get("ROLE_LEVEL1_ADMIN" + level1Id1)[1], false);
        String response = EntityUtils.toString(resp.getEntity());
        assertEquals(403, resp.getStatusLine().getStatusCode());

        resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/roles", this.mapper
                        .writeValueAsString(userRoles),
                        level1AdminRoleUsernames.get("ROLE_LEVEL1_ADMIN" + Fixtures.LEVEL1_ID)[0], level1AdminRoleUsernames
                                .get("ROLE_LEVEL1_ADMIN" + Fixtures.LEVEL1_ID)[1], false);
        response = EntityUtils.toString(resp.getEntity());
        assertEquals(403, resp.getStatusLine().getStatusCode());

        userRoles.remove(level1AdminRole);
        userRoles.add(userRole);
        resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/roles", this.mapper
                        .writeValueAsString(userRoles),
                        level1AdminRoleUsernames.get("ROLE_LEVEL1_ADMIN" + Fixtures.LEVEL1_ID)[0], level1AdminRoleUsernames
                                .get("ROLE_LEVEL1_ADMIN" + Fixtures.LEVEL1_ID)[1], false);
        response = EntityUtils.toString(resp.getEntity());
        assertEquals(403, resp.getStatusLine().getStatusCode());

        resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/roles", this.mapper
                        .writeValueAsString(userRoles),
                        level1AdminRoleUsernames.get("ROLE_LEVEL1_ADMIN" + level1Id1)[0], level1AdminRoleUsernames
                                .get("ROLE_LEVEL1_ADMIN" + level1Id1)[1], false);
        response = EntityUtils.toString(resp.getEntity());
        assertEquals(403, resp.getStatusLine().getStatusCode());

        // userAdmin
        resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/roles", this.mapper
                        .writeValueAsString(userRoles),
                        userAdminRoleUsernames.get("ROLE_USER_ADMIN")[0], userAdminRoleUsernames
                                .get("ROLE_USER_ADMIN")[1], false);
        response = EntityUtils.toString(resp.getEntity());
        assertEquals(403, resp.getStatusLine().getStatusCode());

    }

    @Test
    public void testSetRight() throws Exception {
        testUserRoleAuth(new AuthConfigurer.AuthConfigurerBuilder(
                HttpMethod.POST, userUrl + username + "/role/role_user_admin/rights/" + username)
                .body(this.mapper.writeValueAsString(userAdminRole.getRight("").getRoleRights()))
                .roleRestriction(RoleRestriction.ADMIN)
                .build());

        // level1 admin
        HttpResponse resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/role/role_level1_admin/rights/" + level1Id1,
                        this.mapper.writeValueAsString(level1AdminRole.getRight(level1Id1).getRoleRights()),
                        level1AdminRoleUsernames.get("ROLE_LEVEL1_ADMIN" + level1Id1)[0], level1AdminRoleUsernames
                                .get("ROLE_LEVEL1_ADMIN" + level1Id1)[1], false);
        String response = EntityUtils.toString(resp.getEntity());
        assertTrue(resp.getStatusLine().getStatusCode() < 400);

        resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/role/role_admin/rights/", "{}",
                        level1AdminRoleUsernames.get("ROLE_LEVEL1_ADMIN" + Fixtures.LEVEL1_ID)[0], level1AdminRoleUsernames
                                .get("ROLE_LEVEL1_ADMIN" + Fixtures.LEVEL1_ID)[1], false);
        response = EntityUtils.toString(resp.getEntity());
        assertEquals(403, resp.getStatusLine().getStatusCode());

        resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/role/role_level1_admin/rights/" + level1Id1, this.mapper
                        .writeValueAsString(level1AdminRole.getRight(level1Id1).getRoleRights()),
                        level1AdminRoleUsernames.get("ROLE_LEVEL1_ADMIN" + Fixtures.LEVEL1_ID)[0], level1AdminRoleUsernames
                                .get("ROLE_LEVEL1_ADMIN" + Fixtures.LEVEL1_ID)[1], false);
        response = EntityUtils.toString(resp.getEntity());
        assertEquals(403, resp.getStatusLine().getStatusCode());

        resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/role/role_user/rights/" + level2Id, this.mapper
                        .writeValueAsString(userRole.getRight(level2Id).getRoleRights()),
                        level1AdminRoleUsernames.get("ROLE_LEVEL1_ADMIN" + Fixtures.LEVEL1_ID)[0], level1AdminRoleUsernames
                                .get("ROLE_LEVEL1_ADMIN" + Fixtures.LEVEL1_ID)[1], false);
        response = EntityUtils.toString(resp.getEntity());
        assertTrue(resp.getStatusLine().getStatusCode() < 400);

        resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/role/role_user/rights/" + level2Id, this.mapper
                        .writeValueAsString(userRole.getRight(level2Id).getRoleRights()),
                        level1AdminRoleUsernames.get("ROLE_LEVEL1_ADMIN" + level1Id1)[0], level1AdminRoleUsernames
                                .get("ROLE_LEVEL1_ADMIN" + level1Id1)[1], false);
        response = EntityUtils.toString(resp.getEntity());
        assertEquals(403, resp.getStatusLine().getStatusCode());

        // userAdmin
        resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/role/role_user/rights/" + level2Id, this.mapper
                        .writeValueAsString(userRole.getRight(level2Id).getRoleRights()),
                        userAdminRoleUsernames.get("ROLE_USER_ADMIN")[0], userAdminRoleUsernames
                                .get("ROLE_USER_ADMIN")[1], false);
        response = EntityUtils.toString(resp.getEntity());
        assertEquals(403, resp.getStatusLine().getStatusCode());

        resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/role/role_admin/rights/", "{}",
                        userAdminRoleUsernames.get("ROLE_USER_ADMIN")[0], userAdminRoleUsernames
                        .get("ROLE_USER_ADMIN")[1], false);
        response = EntityUtils.toString(resp.getEntity());
        assertEquals(403, resp.getStatusLine().getStatusCode());

        // user
        resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/role/role_user/rights/" + level2Id, this.mapper
                        .writeValueAsString(userRole.getRight(level2Id).getRoleRights()),
                        userRoleUsernames.get(MissingPermission.READ_PENDING_BINARY)[0], userRoleUsernames
                                .get(MissingPermission.READ_PENDING_BINARY)[1], false);
        response = EntityUtils.toString(resp.getEntity());
        assertTrue(resp.getStatusLine().getStatusCode() < 400);

        resp =
                this.executeAsUser(HttpMethod.POST, userUrl + username + "/role/role_admin/rights/", "{}",
                        userRoleUsernames.get(MissingPermission.WRITE_PERMISSION)[0], userRoleUsernames
                        .get(MissingPermission.WRITE_PERMISSION)[1], false);
        response = EntityUtils.toString(resp.getEntity());
        assertEquals(403, resp.getStatusLine().getStatusCode());

    }

    private void prepareRoles() throws Exception {
        // create user
        username = createUser(null, userPassword);

        // create level1-admin role
        level1AdminRole = new Level1AdminRole();
        List<RoleRight> level1AdminRoleRights = new ArrayList<RoleRight>();
        for (RoleRight roleRight : level1AdminRole.allowedRights()) {
            level1AdminRoleRights.add(roleRight);
        }
        if (!level1AdminRoleRights.isEmpty()) {
            List<Right> newRights = new ArrayList<Right>();
            newRights.add(new Right(level1Id1, level1AdminRoleRights));
            level1AdminRole.setRights(newRights);
        }

        // create user-admin role
        userAdminRole = new UserAdminRole();
        List<RoleRight> userAdminRoleRights = new ArrayList<RoleRight>();
        for (RoleRight roleRight : userAdminRole.allowedRights()) {
            userAdminRoleRights.add(roleRight);
        }
        if (!userAdminRoleRights.isEmpty()) {
            List<Right> newRights = new ArrayList<Right>();
            newRights.add(new Right("", userAdminRoleRights));
            userAdminRole.setRights(newRights);
        }

        // create user role
        userRole = new UserRole();
        List<RoleRight> userRoleRights = new ArrayList<RoleRight>();
        for (RoleRight roleRight : userRole.allowedRights()) {
            userRoleRights.add(roleRight);
        }
        if (!userRoleRights.isEmpty()) {
            List<Right> newRights = new ArrayList<Right>();
            newRights.add(new Right(level2Id, userRoleRights));
            userRole.setRights(newRights);
        }

        // create admin role
        adminRole = new AdminRole();

    }

}


text:
class Game {
public:
	Character *avatar;
	int action = IDLE;

	void startMenu();
	void selectAvatar();
	void mapMenu();
	void setNextStage();
	void playStage();

private:
	int nextStage;
	int clearedStage = 0;

	Output graphic;	//°ÔÀÓ È¸é Ãâ·ÂÀ» À§ÇÑ °´Ã¼
	Map *antarctica = new Map(graphic.getBoard());
	Ground *land;
	Hole *pit;

	void update();
	void moveCloser();
	void wipeInfo();
	void readyScreen();
	void printCurrentInfo();
	void printMapInfo();
	void makeHoles();

	int destination;
	int distance;
	int rest;
	int speed=30;
	int timer;
	int score;
};

#endif //!__GAME_H__


text:
class PrintManager
{
private:
    static PrintManager* m_instance;    // Singleton instance
    HDC                  m_hdc;         // Device context of printer
    int                  m_ncopies;     // Number of copies to print
    bool                 m_landscape;   // Print in landscape?

	PRINTDLG             m_pinfo;       // Printer info from PrintDlg
    PAGESETUPDLG         m_pgsetup;     // Page Setup info from PageSetupDlg
    DEVMODE              m_devmode;     // Device mode structure
    TCHAR                m_driver[128]; // Printer driver name
    TCHAR                m_device[33];  // Printer device name
    bool                 m_use_pgsetup; // User has chosen page setup

    PrintManager();

	bool SetupPrintFromDialog(HWND parent);
	bool SetupPrintExisting(void);
	bool SetupPrintDefault(void);

public:
	typedef enum { k_UseDefault, k_PromptUser, k_UseExisting } PrinterChoice;

    ~PrintManager();

	// Access to the singleton
    CoreExport static PrintManager* Instance(void);

	// Query methods
	CoreExport HDC GetPrinterDC(PrinterChoice getfrom = k_PromptUser);
    CoreExport HDC GetDefaultPrinterDC(void) { return GetPrinterDC(k_UseDefault); }
    CoreExport HDC GetExistingPrinterDC(void) { return GetPrinterDC(k_UseExisting); }
    CoreExport void ReleasePrinterDC(HDC hdc);
    CoreExport int NumberCopies(void) { return m_ncopies; }
    CoreExport bool DoLandscape(void) { return m_landscape; }

    // The standard print methods interface
    CoreExport bool OnPageSetup(HWND parent);
};


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.

using System;
using Microsoft.Common.Core.Shell;

namespace Microsoft.R.LanguageServer.Services {
    internal sealed class Application : IApplication, IDisposable {
        public string Name => "VsCode-R";
        public int LocaleId => 1033;
        public void Dispose() => Terminating?.Invoke(this, EventArgs.Empty);

        #pragma warning disable 67
        public event EventHandler Terminating;
        public event EventHandler Started;
    }
}


text:
'use strict';

var React = require('react');
var assign = require('react/lib/Object.assign');
var Scroller = require('scroller');
var Group = require('./Group');
var clamp = require('./clamp');
var ListView = React.createClass({

  propTypes: {
    style: React.PropTypes.object,
    numberOfItemsGetter: React.PropTypes.func.isRequired,
    itemHeightGetter: React.PropTypes.func.isRequired,
    itemGetter: React.PropTypes.func.isRequired,
    snapping: React.PropTypes.bool,
    scrollingDeceleration: React.PropTypes.number,
    scrollingPenetrationAcceleration: React.PropTypes.number,
    onScroll: React.PropTypes.func
  },

  getDefaultProps: function () {
    return {
      style: { left: 0, top: 0, width: 0, height: 0 },
      snapping: false,
      scrollingDeceleration: 0.95,
      scrollingPenetrationAcceleration: 0.08
    };
  },

  getInitialState: function () {
    return {
      scrollTop: 0
    };
  },

  componentDidMount: function () {
    this.createScroller();
    this.updateScrollingDimensions();
  },

  render: function () {
    console.log('this is listView rendering');
    var items = this.getVisibleItemIndexes().map(this.renderItem);
    return (
      React.createElement(Group, {
        style: this.props.style,
        onTouchStart: this.handleTouchStart,
        onTouchMove: this.handleTouchMove,
        onTouchEnd: this.handleTouchEnd,
        onTouchCancel: this.handleTouchEnd},
        items
      )
    );
  },

  renderItem: function (itemIndex) {
    console.log('listView',itemIndex);
    var item = this.props.itemGetter(itemIndex, this.state.scrollTop);
    var itemHeight = this.props.itemHeightGetter();
    var style = {
      top: 0,
      left: 0,
      width: this.props.style.width,
      height: itemHeight,
      translateY: (itemIndex * itemHeight) - this.state.scrollTop,
      zIndex: itemIndex
    };

    return (
      React.createElement(Group, {style: style, key: itemIndex},
        item
      )
    );
  },

  // Events
  // ======

  handleTouchStart: function (e) {
    if (this.scroller) {
      this.scroller.doTouchStart(e.touches, e.timeStamp);
    }
  },

  handleTouchMove: function (e) {
    if (this.scroller) {
      e.preventDefault();
      this.scroller.doTouchMove(e.touches, e.timeStamp, e.scale);
    }
  },

  handleTouchEnd: function (e) {
    if (this.scroller) {
      this.scroller.doTouchEnd(e.timeStamp);
      if (this.props.snapping) {
        this.updateScrollingDeceleration();
      }
    }
  },

  handleScroll: function (left, top) {
    // console.log('this is listView handleScroll');
    this.setState({ scrollTop: top });
    if (this.props.onScroll) {
      this.props.onScroll(top);
    }
  },

  // Scrolling
  // =========

  createScroller: function () {
    var options = {
      scrollingX: false,
      scrollingY: true,
      paging: true,
      penetrationDeceleration : 0.68,
      decelerationRate: this.props.scrollingDeceleration,
      penetrationAcceleration: this.props.scrollingPenetrationAcceleration,
    };
    this.scroller = new Scroller(this.handleScroll, options);
  },

  updateScrollingDimensions: function () {
    var width = this.props.style.width;
    var height = this.props.style.height;
    var scrollWidth = width;
    var scrollHeight = this.props.numberOfItemsGetter() * this.props.itemHeightGetter();
    // console.log('update scrolling',width,height,scrollHeight);
  //this.scroller.setDimensions(container.clientWidth, container.clientHeight, content.offsetWidth, content.offsetHeight);

  // console.log('listView props',this.props);
    this.scroller.setDimensions(width, height, scrollWidth, scrollHeight);
  },

  getVisibleItemIndexes: function () {
    var itemIndexes = [];
    var itemHeight = this.props.itemHeightGetter();
    var itemCount = this.props.numberOfItemsGetter();
    var scrollTop = this.state.scrollTop;
    var itemScrollTop = 0;

    for (var index=0; index < itemCount; index++) {
      itemScrollTop = (index * itemHeight) - scrollTop;

      // Item is completely off-screen bottom
      if (itemScrollTop >= this.props.style.height) {
        continue;
      }

      // Item is completely off-screen top
      if (itemScrollTop <= -this.props.style.height) {
        continue;
      }

      // Part of item is on-screen.
      itemIndexes.push(index);
    }

    return itemIndexes;
  },

  updateScrollingDeceleration: function () {
    var currVelocity = this.scroller.__decelerationVelocityY;
    var currScrollTop = this.state.scrollTop;
    var targetScrollTop = 0;
    var estimatedEndScrollTop = currScrollTop;

    while (Math.abs(currVelocity).toFixed(6) > 0) {
      estimatedEndScrollTop += currVelocity;
      currVelocity *= this.props.scrollingDeceleration;
    }

    // Find the page whose estimated end scrollTop is closest to 0.
    var closestZeroDelta = Infinity;
    var pageHeight = this.props.itemHeightGetter();
    var pageCount = this.props.numberOfItemsGetter();
    var pageScrollTop;

    for (var pageIndex=0, len=pageCount; pageIndex < len; pageIndex++) {
      pageScrollTop = (pageHeight * pageIndex) - estimatedEndScrollTop;
      if (Math.abs(pageScrollTop) < closestZeroDelta) {
        closestZeroDelta = Math.abs(pageScrollTop);
        targetScrollTop = pageHeight * pageIndex;
      }
    }
// console.log('deceleration',targetScrollTop);
   // this.scroller.__minDecelerationScrollTop = targetScrollTop;
    //this.scroller.__maxDecelerationScrollTop = targetScrollTop;
  }

});

module.exports = ListView;


text:
class AddLoginToEducatorsTable < ActiveRecord::Migration[5.2]
  def change
    add_column :educators, :login_name, :text, null: true

    Educator.all.each do |educator|
      login_name = educator.email.split('@').first
      educator.update!(login_name: login_name)
    end

    change_column :educators, :login_name, :text, null: false
  end
end


text:
var expect    = require('expect.js')
  , Support   = require(__dirname + '/support')
  , helpers   = require(__dirname + '/support/helpers')
  , gulp      = require('gulp')
  ;

([
  "help",
  "h",
  ""
]).forEach(function(flag) {
  describe(Support.getTestDialectTeaser(flag), function() {
    it("prints the help", function(done) {
      gulp
        .src(process.cwd())
        .pipe(helpers.runCli(flag, { pipeStdout: true }))
        .pipe(helpers.ensureContent("Usage\n  sequelize [task]"))
        .pipe(helpers.teardown(done))
    })
  })
})


text: Wercker Box for OpenCV + MySQL 5.7 + RVM


text:
#ifndef LIB_OBJECTPOOL_H_
#define LIB_OBJECTPOOL_H_

#include <algorithm>
#include <mutex>
#include <memory>

namespace pulsar {

template <typename T, int MaxSize>
class Allocator {
   public:
    // Allocator must be stateless, so put everything in this static
    class Impl {
       public:
        // cheap lock to acquire
        static std::mutex mutex_;

        // note: use std::forward_list<> when switching to C++11 mode
        struct Node {
            Node* next;
            explicit Node(Node* n) : next(n) {}
        };
        Node* head_;
        int pushSize_;

        struct GlobalPool {
            Node* node_;
            int nodeCount_;
            GlobalPool* next_;
            explicit GlobalPool(GlobalPool* n) : next_(n) {}
        };
        static struct GlobalPool* globalPool_;
        static int globalNodeCount_;

        Impl(const Impl&);
        void operator=(const Impl&);

        void* pop() {
            if (!head_) {
                // size = 0
                std::lock_guard<std::mutex> lock(mutex_);

                if (!globalPool_) {
                    return NULL;
                }

                GlobalPool* poolEntry = globalPool_;
                head_ = globalPool_->node_;
                pushSize_ += globalPool_->nodeCount_;
                globalNodeCount_ -= globalPool_->nodeCount_;
                globalPool_ = globalPool_->next_;
                delete poolEntry;
            }
            void* result = head_;
            if (result) {
                head_ = head_->next;
                pushSize_--;
            }
            return result;
        }

        bool push(void* p) {
            // Once thread specific entries reaches 10% of max size, push them to GlobalPool
            if (pushSize_ >= MaxSize * 0.1) {
                bool deleteList = true;
                {
                    // Move the entries to global pool
                    std::lock_guard<std::mutex> lock(mutex_);

                    // If total node count reached max allowed cache limit,
                    // skip adding to global pool.
                    if ((globalNodeCount_ + pushSize_) <= MaxSize) {
                        deleteList = false;

                        globalPool_ = new GlobalPool(globalPool_);
                        globalPool_->node_ = head_;
                        globalPool_->nodeCount_ = pushSize_;
                        globalNodeCount_ += pushSize_;
                    }
                }
                if (deleteList) {
                    pushSize_ = 0;
                    deleteLinkedList(head_);
                }
                head_ = new (p) Node(0);
                pushSize_ = 1;
                return true;
            }

            head_ = new (p) Node(head_);
            pushSize_++;
            return true;
        }

        static void deleteLinkedList(Node* head) {
            Node* n = head;
            while (n) {
                void* p = n;
                n = n->next;
                ::operator delete(p);
            }
        }

       public:
        Impl() {
            pushSize_ = 0;
            head_ = 0;
        }

        ~Impl() {
            // No need for mutex for pop
            deleteLinkedList(head_);
        }

        void* allocate() {
            void* result = pop();
            if (!result) {
                result = ::operator new(std::max(sizeof(T), sizeof(Node)));
            }
            return result;
        }

        void deallocate(void* p) {
            if (!push(p)) {
                ::operator delete(p);
            }
        }
    };

    static thread_local std::unique_ptr<Impl> implPtr_;
    typedef T value_type;
    typedef size_t size_type;
    typedef T* pointer;
    typedef const void* const_pointer;

    Allocator() {}

    Allocator(const Allocator& /*other*/) {}

    template <typename Other, int OtherSize>
    Allocator(const Allocator<Other, OtherSize>& /*other*/) {}

    pointer allocate(size_type n, const void* /*hint*/ = 0) {
        Impl* impl = implPtr_.get();
        if (!impl) {
            implPtr_.reset(new Impl);
            impl = implPtr_.get();
        }
        void* p = (n == 1) ? impl->allocate() : operator new(n * sizeof(T));
        return static_cast<T*>(p);
    }

    void deallocate(pointer ptr, size_type n) {
        Impl* impl = implPtr_.get();
        if (!impl) {
            implPtr_.reset(new Impl);
            impl = implPtr_.get();
        }
        if (n == 1)
            impl->deallocate(ptr);
        else
            ::operator delete(ptr);
    }

    template <typename Other>
    struct rebind {
        typedef Allocator<Other, MaxSize> other;
    };
};

// typename Allocator<Type,MaxSize>::Impl is important else the compiler
// doesn't understand that it is a type
template <typename Type, int MaxSize>
thread_local std::unique_ptr<typename Allocator<Type, MaxSize>::Impl> Allocator<Type, MaxSize>::implPtr_;

template <typename Type, int MaxSize>
std::mutex Allocator<Type, MaxSize>::Impl::mutex_;

template <typename Type, int MaxSize>
typename Allocator<Type, MaxSize>::Impl::GlobalPool* Allocator<Type, MaxSize>::Impl::globalPool_;

template <typename Type, int MaxSize>
int Allocator<Type, MaxSize>::Impl::globalNodeCount_;

template <typename Type, int MaxSize>
class ObjectPool {
    typedef std::shared_ptr<Type> TypeSharedPtr;

    Allocator<Type, MaxSize> allocator_;

   public:
    ObjectPool() {}

    TypeSharedPtr create() { return std::allocate_shared<Type>(allocator_); }

    ~ObjectPool() {
        struct Allocator<Type, MaxSize>::Impl::GlobalPool* poolEntry =
            Allocator<Type, MaxSize>::Impl::globalPool_;
        while (poolEntry) {
            Allocator<Type, MaxSize>::Impl::deleteLinkedList(poolEntry->node_);
            struct Allocator<Type, MaxSize>::Impl::GlobalPool* delEntry = poolEntry;
            poolEntry = poolEntry->next_;
            ::operator delete(delEntry);
        }
    }

   private:
    ObjectPool<Type, MaxSize>(const ObjectPool<Type, MaxSize>&);
    ObjectPool<Type, MaxSize>& operator=(const ObjectPool<Type, MaxSize>&);
};
}  // namespace pulsar
#endif /* LIB_OBJECTPOOL_H_ */