text:
package org.elasticsearch.index.mapper;

import org.apache.lucene.index.Term;
import org.apache.lucene.search.DocValuesFieldExistsQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
import org.elasticsearch.index.query.QueryShardContext;
import org.elasticsearch.test.ESTestCase;

import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

import static java.util.Collections.emptyList;

public class FieldTypeLookupTests extends ESTestCase {

    public void testEmpty() {
        FieldTypeLookup lookup = new FieldTypeLookup();
        assertNull(lookup.get("foo"));
        assertEquals(Collections.emptySet(), lookup.getTypes("foo"));
        Collection<String> names = lookup.simpleMatchToFullName("foo");
        assertNotNull(names);
        assertTrue(names.isEmpty());
        Iterator<MappedFieldType> itr = lookup.iterator();
        assertNotNull(itr);
        assertFalse(itr.hasNext());
    }

    public void testDefaultMapping() {
        FieldTypeLookup lookup = new FieldTypeLookup();
        try {
            lookup.copyAndAddAll(MapperService.DEFAULT_MAPPING, emptyList(), emptyList(), randomBoolean());
            fail();
        } catch (IllegalArgumentException expected) {
            assertEquals("Default mappings should not be added to the lookup", expected.getMessage());
        }
    }

    public void testAddNewField() {
        FieldTypeLookup lookup = new FieldTypeLookup();
        MockFieldMapper f = new MockFieldMapper("foo");
        FieldTypeLookup lookup2 = lookup.copyAndAddAll("type", newList(f), emptyList(), randomBoolean());
        assertNull(lookup.get("foo"));
        assertNull(lookup.get("bar"));
        assertEquals(f.fieldType(), lookup2.get("foo"));
        assertNull(lookup.get("bar"));
        assertEquals(Collections.emptySet(), lookup.getTypes("foo"));
        assertEquals(Collections.emptySet(), lookup.getTypes("bar"));
        assertEquals(Collections.singleton("type"), lookup2.getTypes("foo"));
        assertEquals(Collections.emptySet(), lookup2.getTypes("bar"));
        assertEquals(1, size(lookup2.iterator()));
    }

    public void testAddExistingField() {
        MockFieldMapper f = new MockFieldMapper("foo");
        MockFieldMapper f2 = new MockFieldMapper("foo");
        FieldTypeLookup lookup = new FieldTypeLookup();
        lookup = lookup.copyAndAddAll("type1", newList(f), emptyList(), true);
        FieldTypeLookup lookup2 = lookup.copyAndAddAll("type2", newList(f2), emptyList(), true);

        assertEquals(1, size(lookup2.iterator()));
        assertSame(f.fieldType(), lookup2.get("foo"));
        assertEquals(f2.fieldType(), lookup2.get("foo"));
    }

    public void testMismatchedFieldTypes() {
        FieldMapper f1 = new MockFieldMapper("foo");
        FieldTypeLookup lookup = new FieldTypeLookup();
        lookup = lookup.copyAndAddAll("type", newList(f1), emptyList(), randomBoolean());

        OtherFakeFieldType ft2 = new OtherFakeFieldType();
        ft2.setName("foo");
        FieldMapper f2 = new MockFieldMapper("foo", ft2);
        try {
            lookup.copyAndAddAll("type2", newList(f2), emptyList(), false);
            fail("expected type mismatch");
        } catch (IllegalArgumentException e) {
            assertTrue(e.getMessage().contains("cannot be changed from type [faketype] to [otherfaketype]"));
        }
        // fails even if updateAllTypes == true
        try {
            lookup.copyAndAddAll("type2", newList(f2), emptyList(), true);
            fail("expected type mismatch");
        } catch (IllegalArgumentException e) {
            assertTrue(e.getMessage().contains("cannot be changed from type [faketype] to [otherfaketype]"));
        }
    }

    public void testConflictingFieldTypes() {
        FieldMapper f1 = new MockFieldMapper("foo");
        FieldTypeLookup lookup = new FieldTypeLookup();
        lookup = lookup.copyAndAddAll("type", newList(f1), emptyList(), randomBoolean());

        MappedFieldType ft2 = new MockFieldMapper.FakeFieldType();
        ft2.setName("foo");
        ft2.setBoost(2.0f);
        FieldMapper f2 = new MockFieldMapper("foo", ft2);
        try {
            // different type
            lookup.copyAndAddAll("type2", newList(f2), emptyList(), false);
            fail("expected conflict");
        } catch (IllegalArgumentException e) {
            assertTrue(e.getMessage().contains("to update [boost] across all types"));
        }

        // boost is updateable, so ok since we are implicitly updating all types
        lookup.copyAndAddAll("type", newList(f2), emptyList(), false);
        // boost is updateable, so ok if forcing
        lookup.copyAndAddAll("type2", newList(f2), emptyList(), true);

        // now with a non changeable setting
        MappedFieldType ft3 = new MockFieldMapper.FakeFieldType();
        ft3.setName("foo");
        ft3.setStored(true);
        FieldMapper f3 = new MockFieldMapper("foo", ft3);
        try {
            lookup.copyAndAddAll("type2", newList(f3), emptyList(), false);
            fail("expected conflict");
        } catch (IllegalArgumentException e) {
            assertTrue(e.getMessage().contains("has different [store] values"));
        }
        // even with updateAllTypes == true, incompatible
        try {
            lookup.copyAndAddAll("type2", newList(f3), emptyList(), true);
            fail("expected conflict");
        } catch (IllegalArgumentException e) {
            assertTrue(e.getMessage().contains("has different [store] values"));
        }
    }

    public void testAddFieldAlias() {
        MockFieldMapper field = new MockFieldMapper("foo");
        FieldAliasMapper alias = new FieldAliasMapper("alias", "alias", "foo");

        FieldTypeLookup lookup = new FieldTypeLookup();
        lookup = lookup.copyAndAddAll("type", newList(field), newList(alias), randomBoolean());

        MappedFieldType aliasType = lookup.get("alias");
        assertEquals(field.fieldType(), aliasType);
    }

    public void testUpdateFieldAlias() {
        // Add an alias 'alias' to the concrete field 'foo'.
        MockFieldMapper.FakeFieldType fieldType1 = new MockFieldMapper.FakeFieldType();
        MockFieldMapper field1 = new MockFieldMapper("foo", fieldType1);
        FieldAliasMapper alias1 = new FieldAliasMapper("alias", "alias", "foo");

        FieldTypeLookup lookup = new FieldTypeLookup();
        lookup = lookup.copyAndAddAll("type", newList(field1), newList(alias1), randomBoolean());

        // Check that the alias refers to 'foo'.
        MappedFieldType aliasType1 = lookup.get("alias");
        assertEquals(fieldType1, aliasType1);

        // Update the alias to refer to a new concrete field 'bar'.
        MockFieldMapper.FakeFieldType fieldType2 = new MockFieldMapper.FakeFieldType();
        fieldType2.setStored(!fieldType1.stored());
        MockFieldMapper field2 = new MockFieldMapper("bar", fieldType2);

        FieldAliasMapper alias2 = new FieldAliasMapper("alias", "alias", "bar");
        lookup = lookup.copyAndAddAll("type", newList(field2), newList(alias2), randomBoolean());

        // Check that the alias now refers to 'bar'.
        MappedFieldType aliasType2 = lookup.get("alias");
        assertEquals(fieldType2, aliasType2);
    }

    public void testUpdateConcreteFieldWithAlias() {
        // Add an alias 'alias' to the concrete field 'foo'.
        FieldAliasMapper alias1 = new FieldAliasMapper("alias", "alias", "foo");
        MockFieldMapper.FakeFieldType fieldType1 = new MockFieldMapper.FakeFieldType();
        fieldType1.setBoost(1.0f);
        MockFieldMapper field1 = new MockFieldMapper("foo", fieldType1);

        FieldTypeLookup lookup = new FieldTypeLookup();
        lookup = lookup.copyAndAddAll("type", newList(field1), newList(alias1), randomBoolean());

        // Check that the alias maps to this field type.
        MappedFieldType aliasType1 = lookup.get("alias");
        assertEquals(fieldType1, aliasType1);

        // Update the boost for field 'foo'.
        MockFieldMapper.FakeFieldType fieldType2 = new MockFieldMapper.FakeFieldType();
        fieldType2.setBoost(2.0f);
        MockFieldMapper field2 = new MockFieldMapper("foo", fieldType2);
        lookup = lookup.copyAndAddAll("type", newList(field2), emptyList(), randomBoolean());

        // Check that the alias maps to the new field type.
        MappedFieldType aliasType2 = lookup.get("alias");
        assertEquals(fieldType2, aliasType2);
    }

    public void testAliasThatRefersToAlias() {
        MockFieldMapper field = new MockFieldMapper("foo");
        FieldAliasMapper alias = new FieldAliasMapper("alias", "alias", "foo");
        FieldTypeLookup lookup = new FieldTypeLookup()
            .copyAndAddAll("type", newList(field), newList(alias), randomBoolean());

        FieldAliasMapper invalidAlias = new FieldAliasMapper("invalid-alias", "invalid-alias", "alias");
        IllegalArgumentException e = expectThrows(IllegalArgumentException.class,
            () -> lookup.copyAndAddAll("type", emptyList(), newList(invalidAlias), randomBoolean()));
        assertEquals("Invalid [path] value [alias] for field alias [invalid-alias]: an alias" +
            " cannot refer to another alias.", e.getMessage());
    }

    public void testAliasThatRefersToItself() {
        FieldAliasMapper invalidAlias = new FieldAliasMapper("invalid-alias", "invalid-alias", "invalid-alias");

        FieldTypeLookup lookup = new FieldTypeLookup();
        IllegalArgumentException e = expectThrows(IllegalArgumentException.class,
            () -> lookup.copyAndAddAll("type", emptyList(), newList(invalidAlias), randomBoolean()));
        assertEquals("Invalid [path] value [invalid-alias] for field alias [invalid-alias]: an alias" +
            " cannot refer to itself.", e.getMessage());
    }

    public void testAliasWithNonExistentPath() {
        FieldAliasMapper invalidAlias = new FieldAliasMapper("invalid-alias", "invalid-alias", "non-existent");

        FieldTypeLookup lookup = new FieldTypeLookup();
        IllegalArgumentException e = expectThrows(IllegalArgumentException.class,
            () -> lookup.copyAndAddAll("type", emptyList(), newList(invalidAlias), randomBoolean()));
        assertEquals("Invalid [path] value [non-existent] for field alias [invalid-alias]: an alias" +
            " must refer to an existing field in the mappings.", e.getMessage());
    }

    public void testAddAliasWithPreexistingField() {
        MockFieldMapper field = new MockFieldMapper("field");
        FieldTypeLookup lookup = new FieldTypeLookup()
            .copyAndAddAll("type", newList(field), emptyList(), randomBoolean());

        MockFieldMapper invalidField = new MockFieldMapper("invalid");
        FieldAliasMapper invalidAlias = new FieldAliasMapper("invalid", "invalid", "field");

        IllegalArgumentException e = expectThrows(IllegalArgumentException.class,
            () -> lookup.copyAndAddAll("type", newList(invalidField), newList(invalidAlias), randomBoolean()));
        assertEquals("The name for field alias [invalid] has already been used to define a concrete field.",
            e.getMessage());
    }

    public void testAddFieldWithPreexistingAlias() {
        MockFieldMapper field = new MockFieldMapper("field");
        FieldAliasMapper invalidAlias = new FieldAliasMapper("invalid", "invalid", "field");

        FieldTypeLookup lookup = new FieldTypeLookup()
            .copyAndAddAll("type", newList(field), newList(invalidAlias), randomBoolean());

        MockFieldMapper invalidField = new MockFieldMapper("invalid");

        IllegalArgumentException e = expectThrows(IllegalArgumentException.class,
            () -> lookup.copyAndAddAll("type", newList(invalidField), emptyList(), randomBoolean()));
        assertEquals("The name for field [invalid] has already been used to define a field alias.",
            e.getMessage());
    }

    public void testSimpleMatchToFullName() {
        MockFieldMapper field1 = new MockFieldMapper("foo");
        MockFieldMapper field2 = new MockFieldMapper("bar");

        FieldAliasMapper alias1 = new FieldAliasMapper("food", "food", "foo");
        FieldAliasMapper alias2 = new FieldAliasMapper("barometer", "barometer", "bar");

        FieldTypeLookup lookup = new FieldTypeLookup();
        lookup = lookup.copyAndAddAll("type",
            newList(field1, field2),
            newList(alias1, alias2),
            true);

        Collection<String> names = lookup.simpleMatchToFullName("b*");

        assertFalse(names.contains("foo"));
        assertFalse(names.contains("food"));

        assertTrue(names.contains("bar"));
        assertTrue(names.contains("barometer"));
    }

    public void testIteratorImmutable() {
        MockFieldMapper f1 = new MockFieldMapper("foo");
        FieldTypeLookup lookup = new FieldTypeLookup();
        lookup = lookup.copyAndAddAll("type", newList(f1), emptyList(), randomBoolean());

        try {
            Iterator<MappedFieldType> itr = lookup.iterator();
            assertTrue(itr.hasNext());
            assertEquals(f1.fieldType(), itr.next());
            itr.remove();
            fail("remove should have failed");
        } catch (UnsupportedOperationException e) {
            // expected
        }
    }

    private static List<FieldMapper> newList(FieldMapper... mapper) {
        return Arrays.asList(mapper);
    }

    private static List<FieldAliasMapper> newList(FieldAliasMapper... mapper) {
        return Arrays.asList(mapper);
    }

    private int size(Iterator<MappedFieldType> iterator) {
        if (iterator == null) {
            throw new NullPointerException("iterator");
        }
        int count = 0;
        while (iterator.hasNext()) {
            count++;
            iterator.next();
        }
        return count;
    }

    static class OtherFakeFieldType extends TermBasedFieldType {
        OtherFakeFieldType() {
        }

        protected OtherFakeFieldType(OtherFakeFieldType ref) {
            super(ref);
        }

        @Override
        public MappedFieldType clone() {
            return new OtherFakeFieldType(this);
        }

        @Override
        public String typeName() {
            return "otherfaketype";
        }

        @Override
        public Query existsQuery(QueryShardContext context) {
            if (hasDocValues()) {
                return new DocValuesFieldExistsQuery(name());
            } else {
                return new TermQuery(new Term(FieldNamesFieldMapper.NAME, name()));
            }
        }
    }
}


text:
<?php
/**
 * The template for displaying 404 pages (Not Found)
 *
 */

include("header.php");
require_once("functions.php");
?>

Error 404

	The page you have loaded for does not exist.

<?php
	include("sidebar.php");
	include("footer.php");
?>

redpajama_set_name: RedPajamaGithub


text:
package com.intellij.openapi.vcs.roots;

import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.*;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.Function;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;

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

/**
 * @author Nadya Zabrodina
 */
public class VcsRootErrorsFinder {
  private final @NotNull Project myProject;
  private final @NotNull ProjectLevelVcsManager myVcsManager;

  public VcsRootErrorsFinder(@NotNull Project project) {
    myProject = project;
    myVcsManager = ProjectLevelVcsManager.getInstance(project);
  }

  @NotNull
  public Collection<VcsRootError> find() {
    List<VcsDirectoryMapping> mappings = myVcsManager.getDirectoryMappings();
    Collection<VcsRoot> vcsRoots = new VcsRootDetector(myProject).detect().getRoots();

    Collection<VcsRootError> errors = new ArrayList<VcsRootError>();
    errors.addAll(findExtraMappings(mappings));
    errors.addAll(findUnregisteredRoots(mappings, vcsRoots));
    return errors;
  }

  @NotNull
  private Collection<VcsRootError> findUnregisteredRoots(@NotNull List<VcsDirectoryMapping> mappings,
                                                         @NotNull Collection<VcsRoot> vcsRoots) {
    Collection<VcsRootError> errors = new ArrayList<VcsRootError>();
    List<String> mappedPaths = mappingsToPathsWithSelectedVcs(mappings);
    for (VcsRoot root : vcsRoots) {
      VirtualFile virtualFileFromRoot = root.getPath();
      if (virtualFileFromRoot == null) {
        continue;
      }
      String vcsPath = virtualFileFromRoot.getPath();
      if (!mappedPaths.contains(vcsPath) && root.getVcs() != null) {
        errors.add(new VcsRootError(VcsRootError.Type.UNREGISTERED_ROOT, vcsPath, root.getVcs().getName()));
      }
    }
    return errors;
  }

  @NotNull
  private Collection<VcsRootError> findExtraMappings(@NotNull List<VcsDirectoryMapping> mappings) {
    Collection<VcsRootError> errors = new ArrayList<VcsRootError>();
    for (VcsDirectoryMapping mapping : mappings) {
      if (!hasVcsChecker(mapping.getVcs())) {
        continue;
      }
      if (mapping.isDefaultMapping()) {
        if (!isRoot(mapping)) {
          errors.add(new VcsRootError(VcsRootError.Type.EXTRA_MAPPING, VcsDirectoryMapping.PROJECT_CONSTANT, mapping.getVcs()));
        }
      }
      else {
        String mappedPath = mapping.systemIndependentPath();
        if (!isRoot(mapping)) {
          errors.add(new VcsRootError(VcsRootError.Type.EXTRA_MAPPING, mappedPath, mapping.getVcs()));
        }
      }
    }
    return errors;
  }

  private static boolean hasVcsChecker(String vcs) {
    if (StringUtil.isEmptyOrSpaces(vcs)) {
      return false;
    }
    VcsRootChecker[] checkers = Extensions.getExtensions(VcsRootChecker.EXTENSION_POINT_NAME);
    for (VcsRootChecker checker : checkers) {
      if (vcs.equalsIgnoreCase(checker.getSupportedVcs().getName())) {
        return true;
      }
    }
    return false;
  }

  @NotNull
  public static Collection<VirtualFile> vcsRootsToVirtualFiles(@NotNull Collection<VcsRoot> vcsRoots) {
    return ContainerUtil.map(vcsRoots, new Function<VcsRoot, VirtualFile>() {
      @Override
      public VirtualFile fun(VcsRoot root) {
        return root.getPath();
      }
    });
  }

  private List<String> mappingsToPathsWithSelectedVcs(@NotNull List<VcsDirectoryMapping> mappings) {
    List<String> paths = new ArrayList<String>();
    for (VcsDirectoryMapping mapping : mappings) {
      if (StringUtil.isEmptyOrSpaces(mapping.getVcs())) {
        continue;
      }
      if (!mapping.isDefaultMapping()) {
        paths.add(mapping.systemIndependentPath());
      }
      else {
        String basePath = myProject.getBasePath();
        if (basePath != null) {
          paths.add(FileUtil.toSystemIndependentName(basePath));
        }
      }
    }
    return paths;
  }

  public static VcsRootErrorsFinder getInstance(Project project) {
    return new VcsRootErrorsFinder(project);
  }

  private boolean isRoot(@NotNull final VcsDirectoryMapping mapping) {
    VcsRootChecker[] checkers = Extensions.getExtensions(VcsRootChecker.EXTENSION_POINT_NAME);
    final String pathToCheck = mapping.isDefaultMapping() ? myProject.getBasePath() : mapping.getDirectory();
    return ContainerUtil.find(checkers, new Condition<VcsRootChecker>() {
      @Override
      public boolean value(VcsRootChecker checker) {
        return checker.getSupportedVcs().getName().equalsIgnoreCase(mapping.getVcs()) && checker.isRoot(pathToCheck);
      }
    }) != null;
  }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.ai.formrecognizer.training.models;

import com.azure.ai.formrecognizer.implementation.TrainingDocumentInfoHelper;
import com.azure.ai.formrecognizer.models.FormRecognizerError;

import java.util.Collections;
import java.util.List;

/**
 * The TrainingDocumentInfo model.
 */
public final class TrainingDocumentInfo {

    /*
     * Training document name.
     */
    private final String name;

    /*
     * Status of the training operation.
     */
    private final TrainingStatus status;

    /*
     * Total number of pages trained.
     */
    private final int pageCount;

    /*
     * List of errors.
     */
    private final List<FormRecognizerError> errors;

    private String modelId;

    static {
        TrainingDocumentInfoHelper.setAccessor(new TrainingDocumentInfoHelper.TrainingDocumentInfoAccessor() {
            @Override
            public void setModelId(TrainingDocumentInfo documentInfo, String modelId) {
                documentInfo.setModelId(modelId);
            }
        });
    }

    /**
     * Constructs a TrainingDocumentInfo object.
     *
     * @param name the training document name.
     * @param status the status of the training operation for that document.
     * @param pageCount the total number of pages trained.
     * @param errors the list of errors.
     */
    public TrainingDocumentInfo(final String name, final TrainingStatus status, final int pageCount,
                                final List<FormRecognizerError> errors) {
        this.name = name;
        this.status = status;
        this.pageCount = pageCount;
        this.errors = errors == null ? null : Collections.unmodifiableList(errors);
    }

    /**
     * Get the training document name.
     *
     * @return the training document name.
     */
    public String getName() {
        return this.name;
    }

    /**
     * Get the status of the training operation.
     *
     * @return the status of the training operation.
     */
    public TrainingStatus getStatus() {
        return this.status;
    }

    /**
     * Get the total number of pages trained.
     *
     * @return the total number of pages trained.
     */
    public int getPageCount() {
        return this.pageCount;
    }

    /**
     * Get the list of errors.
     *
     * @return the unmodifiable list of errors.
     */
    public List<FormRecognizerError> getErrors() {
        return this.errors;
    }

    /**
     * Get the Model identifier.
     *
     * @return the {@code modelId} value.
     */
    public String getModelId() {
        return this.modelId;
    }

    /**
     * The private setter to set the modelId property
     * via {@link TrainingDocumentInfoHelper.TrainingDocumentInfoAccessor}.
     *
     * @param modelId The the unique identifier of the model.
     */
    private void setModelId(String modelId) {
        this.modelId = modelId;
    }
}


text:
package warriors.orc;

import warriors.common.Archer;

/**
 * Created by dovbysh on 23.02.2015.
 */
public class OrcArcher extends Archer{
    @Override
    public String getWarriorClass(){
        return this.getClass().getSimpleName();
    }
}


text:
package com.twitter.finagle.netty4.http.handler

import com.twitter.conversions.storage._
import com.twitter.finagle.http.Fields
import io.netty.buffer.Unpooled
import io.netty.channel.{ChannelHandlerContext, ChannelOutboundHandlerAdapter, ChannelPromise}
import io.netty.channel.embedded.EmbeddedChannel
import io.netty.handler.codec.http._
import java.nio.channels.ClosedChannelException
import org.junit.runner.RunWith
import org.scalatest.FunSuite
import org.scalatest.junit.JUnitRunner

@RunWith(classOf[JUnitRunner])
class PayloadSizeHandlerTest extends FunSuite {

  object SuppressClose extends ChannelOutboundHandlerAdapter {
    override def close(ctx: ChannelHandlerContext, promise: ChannelPromise): Unit = ()
  }

  test("fixed length oversize messages generate 413") {
    val payload = new PayloadSizeHandler(10.bytes)
    val channel: EmbeddedChannel = new EmbeddedChannel(payload)
    val content = Unpooled.wrappedBuffer(new Array[Byte](11))
    assert(content.refCnt() == 1)
    val req = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/", content)
    HttpUtil.setContentLength(req, content.readableBytes)
    assert(
      false == channel.writeInbound(req)
    )

    // oversize request's buffer is released
    assert(req.refCnt() == 0)

    val resp = channel.readOutbound[HttpResponse]()
    assert(resp.status == HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE)
    assert(resp.headers().get(Fields.Connection) == "close")
  }

  test("streamed oversize messages generate 413") {
    val payload = new PayloadSizeHandler(10.bytes)
    val channel: EmbeddedChannel = new EmbeddedChannel(payload, SuppressClose)
    val req = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/")
    HttpUtil.setContentLength(req, 22)
    assert(
      false == channel.writeInbound(req)
    )

    val resp = channel.readOutbound[HttpResponse]()
    assert(resp.status() == HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE)
    assert(resp.headers().get(Fields.Connection) == "close")

    // subsequent chunks are rejected
    val content1 = Unpooled.wrappedBuffer(new Array[Byte](11))
    val content2 = Unpooled.wrappedBuffer(new Array[Byte](11))
    assert(content1.refCnt() == 1)
    assert(content2.refCnt() == 1)
    assert(false == channel.writeInbound(new DefaultHttpContent(content1)))
    assert(false == channel.writeInbound(new DefaultHttpContent(content2)))

    // rejected chunks are released
    assert(content1.refCnt() == 0)
    assert(content2.refCnt() == 0)
  }

  test("oversize messages can close the channel") {
    val payload = new PayloadSizeHandler(10.bytes)
    val channel: EmbeddedChannel = new EmbeddedChannel(payload)
    val req = new DefaultHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.POST, "/")
    HttpUtil.setContentLength(req, 22)
    assert(
      false == channel.writeInbound(req)
    )

    val resp = channel.readOutbound[HttpResponse]()
    assert(resp.status() == HttpResponseStatus.REQUEST_ENTITY_TOO_LARGE)
    assert(resp.headers().get(Fields.Connection) == "close")

    // subsequent chunks are rejected
    intercept[ClosedChannelException] {
      channel.writeInbound(new DefaultHttpContent(Unpooled.wrappedBuffer(new Array[Byte](11))))
    }
  }
}


text:
var fs = require('fs'),
    https = require('https'),
    exec = require('child_process').exec,
    eventStream = require('event-stream'),
    gulp = require('gulp'),
    chmod = require('gulp-chmod'),
    zip = require('gulp-zip'),
    tar = require('gulp-tar'),
    gzip = require('gulp-gzip'),
    rename = require('gulp-rename');

    var config = {
        getComposerUrl: 'https://getcomposer.org/installer',
        phpBin: 'php -d "suhosin.executor.include.whitelist = phar" -d "memory_limit=512M"'
    }

// Get and install PHP Composer
gulp.task('get-composer', function(callback) {
    // Check if Composer already in place
    if (fs.existsSync('./composer.phar')) {
        callback(null);

        return;
    }

    // Get installer from the internet
    https.get(config.getComposerUrl, function(response) {
        // Run PHP to install Composer
        var php = exec(config.phpBin, function(error, stdout, stderr) {
            callback(error ? stderr : null);
        });
        // Pass installer code to PHP via STDIN
        response.pipe(php.stdin);
    });
});

// Install Composer dependencies
gulp.task('composer-install', gulp.series('get-composer', function(callback) {
    exec(config.phpBin + ' composer.phar install --no-dev', function(error, stdout, stderr) {
        callback(error ? stderr : null);
    });
}));

gulp.task('prepare-release', gulp.series('composer-install', function() {
    var version = require('./package.json').version;

    return eventStream.merge(
        getSources()
            .pipe(zip('geo-ip-plugin-' + version + '.zip')),
        getSources()
            .pipe(tar('geo-ip-plugin-' + version + '.tar'))
            .pipe(gzip())
    )
    .pipe(chmod(0644))
    .pipe(gulp.dest('release'));
}));

// Builds and packs plugins sources
gulp.task('default', gulp.series('prepare-release'));

/**
 * Returns files stream with the plugin sources.
 *
 * @returns {Object} Stream with VinylFS files.
 */
var getSources = function() {
    return gulp.src([
            'Plugin.php',
            'README.md',
            'LICENSE',
            'db/.htaccess',
            'vendor/**/*.*'
        ],
        {base: './'}
    )
    .pipe(rename(function(path) {
        path.dirname = 'Mibew/Mibew/Plugin/GeoIp/' + path.dirname;
    }));
}


text:
<?php

namespace HostBox\Api\PayU\Requests;

class PaymentCancelRequest extends PaymentInfoRequest
{

	/** @inheritdoc */
	public function getType()
	{
		return Request::CANCEL_PAYMENT;
	}

}


text:
SYNONYM

#### According to
GRIN Taxonomy for Plants

#### Published in
Handb. Conif. 14. 1887

#### Original name
null

### Remarks
null


text:
package edu.gemini.itc.niri;

import edu.gemini.itc.base.DatFile;
import edu.gemini.itc.base.Disperser;
import edu.gemini.itc.base.Instrument;
import edu.gemini.itc.base.TransmissionElement;
import edu.gemini.itc.operation.Slit;

import java.util.*;

/**
 * This represents the transmission of the Grism optics.
 */
public final class GrismOptics extends TransmissionElement implements Disperser {

    private static final String JGRISM = "J-grism";
    private static final String HGRISM = "H-grism";
    private static final String KGRISM = "K-grism";
    private static final String LGRISM = "L-grism";
    private static final String MGRISM = "M-grism";

    // === static code for caching of coverage and resolution data files
    private static final class Coverage {
        final double start;
        final double end;
        final double pixelWidth;
        Coverage(final double start, final double end, final double pixelWidth) {
            this.start = start;
            this.end = end;
            this.pixelWidth = pixelWidth;
        }
    }
    private static final Map<String, List<Integer>> resolutions = new HashMap<>();
    private static final Map<String, List<Coverage>> coverages = new HashMap<>();

    private static List<Integer> loadResolutions(final String file) {
        final List<Integer> resolvingPower = new ArrayList<>();
        try (final Scanner scan = DatFile.scanFile(file)) {
            while (scan.hasNext()) {
                resolvingPower.add(scan.nextInt());
            }
        }
        return resolvingPower;
    }
    private static synchronized List<Integer> getResolution(final String file) {
        if (!resolutions.containsKey(file)) {
            resolutions.put(file, loadResolutions(file));
        }
        return resolutions.get(file);
    }

    private static List<Coverage> loadCoverages(final String file) {
        final List<Coverage> coverages = new ArrayList<>();
        try (final Scanner scan = DatFile.scanFile(file)) {
            while (scan.hasNext()) {
                final double start = scan.nextDouble();
                final double end   = scan.nextDouble();
                final double pixW  = scan.nextDouble();
                coverages.add(new Coverage(start, end, pixW));
            }
        }
        return coverages;
    }
    private static synchronized List<Coverage> getCoverage(final String file) {
        if (!coverages.containsKey(file)) {
            coverages.put(file, loadCoverages(file));
        }
        return coverages.get(file);
    }

    // == non static stuff
    private final List<Coverage> coverage;
    private final List<Integer> resolution;
    private final String grismName;

    public GrismOptics(final String directory,
                       final String grismName,
                       final String cameraName,
                       final String focalPlaneMaskOffset,
                       final String stringSlitWidth) {

        super(directory + Niri.getPrefix() + grismName + "_" + cameraName + Instrument.getSuffix());

        final String grismFile    = directory + Niri.getPrefix() + "grism-resolution-" + stringSlitWidth + "_" + cameraName + Instrument.getSuffix();
        final String coverageFile = directory + Niri.getPrefix() + "grism-coverage-" + focalPlaneMaskOffset + Instrument.getSuffix();

        this.grismName  = grismName;
        this.resolution = getResolution(grismFile);
        this.coverage   = getCoverage(coverageFile);
    }

    public double getStart() {
        return coverage.get(getGrismNumber()).start;
    }

    public double getEnd() {
        return coverage.get(getGrismNumber()).end;
    }

    public double getEffectiveWavelength() {
        return (getStart() + getEnd()) / 2;
    }

    public double getPixelWidth() {
        return coverage.get(getGrismNumber()).pixelWidth;
    }

    public int getGrismNumber() {
        switch (grismName) {
            case JGRISM:    return 0;
            case HGRISM:    return 1;
            case KGRISM:    return 2;
            case LGRISM:    return 3;
            case MGRISM:    return 4;
            default:        throw new Error();
        }
    }

    // For NIRI we can not use the extrapolation from the half arcsec slit as we do for other instruments.
    // Therefore this method is undefined and must not be used for NIRI!
    public double resolutionHalfArcsecSlit() {
        throw new Error("not implemented for NIRI");
    }

    // Calculates the resolution for the current grism and wavelength.
    public double resolution(final Slit slit) {
        return getEffectiveWavelength() / resolution.get(getGrismNumber());
    }

    // Calculates the resolution for the current grism and wavelength. The image quality is not taken into account;
    // for NIRI the resolution in the files assumes that the target fills the slit (IQ>slit width).
    public double resolution(final Slit slit, final double imgQuality) {
        return resolution(slit);
    }

    public double dispersion() {
        return coverage.get(getGrismNumber()).pixelWidth;
    }

    public String toString() {
        return "Grism Optics: " + grismName;
    }

}


text:
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;

class Solution {

	private static class Node {

		private final Integer id;
		private final Set<Node> adjacentNodes;

		private Node(Integer id) {
			this.id = id;
			this.adjacentNodes = new HashSet<>();
		}

		public Integer getId() {
			return id;
		}

		public void addAdjacentNode(Node adjacentNodeId) {
			adjacentNodes.add(adjacentNodeId);
		}

		public void removeAdjacentNode(Node adjacentNodeId) {
			adjacentNodes.remove(adjacentNodeId);
		}

		public void removeFromAdjacentNodes() {
			adjacentNodes.stream().forEach(adjacentNode -> adjacentNode.removeAdjacentNode(this));
		}

		public boolean isLeaf() {
			return adjacentNodes.size() == 1;
		}

	}

    public static void main(String args[]) {

        Scanner in = new Scanner(System.in);
        int n = in.nextInt(); // the number of adjacency relations

        Map<Integer, Node> graph = new HashMap<>();
        for (int i = 0; i < n; i++) {
        	Integer xi = Integer.valueOf(in.nextInt()); // the ID of a person which is adjacent to yi
        	Integer yi = Integer.valueOf(in.nextInt()); // the ID of a person which is adjacent to xi
        	Node xiNode = graph.computeIfAbsent(xi, key -> new Node(key));
        	Node yiNode = graph.computeIfAbsent(yi, key -> new Node(key));
        	xiNode.addAdjacentNode(yiNode);
        	yiNode.addAdjacentNode(xiNode);
        }

        System.out.println(calculateMinimumPropagationSteps(graph)); // The minimal amount of steps required to completely propagate the advertisement
    }

    private static int calculateMinimumPropagationSteps(Map<Integer, Node> graph) {
    	int minimumPropagationSteps = 0;
    	while (graph.size() > 1) {
    		removeLeaves(graph);
    		minimumPropagationSteps++;
    	}
    	return minimumPropagationSteps;
    }

    private static void removeLeaves(Map<Integer, Node> graph) {
    	Set<Node> leaves = graph.values().stream().filter(Node::isLeaf).collect(Collectors.toSet());
    	leaves.stream().forEach(leaf -> {
    		graph.remove(leaf.getId());
    		leaf.removeFromAdjacentNodes();
		});
    }

}


text:
from designate.objects import base
from designate.objects import fields

@base.DesignateRegistry.register
class ZoneTransferRequest(base.DictObjectMixin, base.PersistentObjectMixin,
                          base.DesignateObject, ):
    fields = {
        'key': fields.StringFields(nullable=True, maxLength=160),
        'zone_id': fields.UUIDFields(nullable=True),
        'description': fields.StringFields(nullable=True, maxLength=160),
        'tenant_id': fields.StringFields(nullable=True),
        'target_tenant_id': fields.StringFields(nullable=True),
        'status': fields.EnumField(nullable=True, valid_values=[
            "ACTIVE", "PENDING", "DELETED", "ERROR", "COMPLETE"]),
        'zone_name': fields.StringFields(nullable=True, maxLength=255),
    }

    STRING_KEYS = [
        'id', 'zone_id', 'zone_name', 'target_tenant_id'
    ]

@base.DesignateRegistry.register
class ZoneTransferRequestList(base.ListObjectMixin, base.DesignateObject):
    LIST_ITEM_TYPE = ZoneTransferRequest
    fields = {
        'objects': fields.ListOfObjectsField('ZoneTransferRequest'),
    }


text:
<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:background="?attr/window_background_color">

    <android.support.v7.widget.SwitchCompat
        android:id="@+id/system_language_switch"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_margin="12dp"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="@string/preference_system_language_toggle" />

    <org.wikipedia.views.PlainPasteEditText
            android:id="@+id/preference_languages_filter"
            android:layout_width="match_parent"
            android:layout_height="48dp"
            android:hint="@string/preference_languages_filter_hint"
            android:imeOptions="actionDone|flagNoExtractUi"
            android:singleLine="true"
            android:layout_marginLeft="8dp"
            android:layout_marginRight="8dp"
            />
    <ListView android:id="@+id/preference_languages_list"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
              android:choiceMode="singleChoice"
               />
</LinearLayout>


text:
# -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

const gXPInstallObserver = {
  _findChildShell: function (aDocShell, aSoughtShell)
  {
    if (aDocShell == aSoughtShell)
      return aDocShell;

    var node = aDocShell.QueryInterface(Components.interfaces.nsIDocShellTreeNode);
    for (var i = 0; i < node.childCount; ++i) {
      var docShell = node.getChildAt(i);
      docShell = this._findChildShell(docShell, aSoughtShell);
      if (docShell == aSoughtShell)
        return docShell;
    }
    return null;
  },

  _getBrowser: function (aDocShell)
  {
    for (let browser of gBrowser.browsers) {
      if (this._findChildShell(browser.docShell, aDocShell))
        return browser;
    }
    return null;
  },

  observe: function (aSubject, aTopic, aData)
  {
    var brandBundle = document.getElementById("bundle_brand");
    var installInfo = aSubject.QueryInterface(Components.interfaces.amIWebInstallInfo);
    var win = installInfo.originatingWindow;
    var shell = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
                   .getInterface(Components.interfaces.nsIWebNavigation)
                   .QueryInterface(Components.interfaces.nsIDocShell);
    var browser = this._getBrowser(shell);
    if (!browser)
      return;
    const anchorID = "addons-notification-icon";
    var messageString, action;
    var brandShortName = brandBundle.getString("brandShortName");

    var notificationID = aTopic;
    // Make notifications persist a minimum of 30 seconds
    var options = {
      timeout: Date.now() + 30000
    };

    switch (aTopic) {
    case "addon-install-disabled":
      notificationID = "xpinstall-disabled"

      if (gPrefService.prefIsLocked("xpinstall.enabled")) {
        messageString = gNavigatorBundle.getString("xpinstallDisabledMessageLocked");
        buttons = [];
      }
      else {
        messageString = gNavigatorBundle.getString("xpinstallDisabledMessage");

        action = {
          label: gNavigatorBundle.getString("xpinstallDisabledButton"),
          accessKey: gNavigatorBundle.getString("xpinstallDisabledButton.accesskey"),
          callback: function editPrefs() {
            gPrefService.setBoolPref("xpinstall.enabled", true);
          }
        };
      }

      PopupNotifications.show(browser, notificationID, messageString, anchorID,
                              action, null, options);
      break;
    case "addon-install-blocked":
      messageString = gNavigatorBundle.getFormattedString("xpinstallPromptWarning",
                        [brandShortName, installInfo.originatingURI.host]);

      let secHistogram = Components.classes["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry).getHistogramById("SECURITY_UI");
      action = {
        label: gNavigatorBundle.getString("xpinstallPromptAllowButton"),
        accessKey: gNavigatorBundle.getString("xpinstallPromptAllowButton.accesskey"),
        callback: function() {
          secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_ADDON_ASKING_PREVENTED_CLICK_THROUGH);
          installInfo.install();
        }
      };

      secHistogram.add(Ci.nsISecurityUITelemetry.WARNING_ADDON_ASKING_PREVENTED);
      PopupNotifications.show(browser, notificationID, messageString, anchorID,
                              action, null, options);
      break;
    case "addon-install-started":
      function needsDownload(aInstall) {
        return aInstall.state != AddonManager.STATE_DOWNLOADED;
      }
      // If all installs have already been downloaded then there is no need to
      // show the download progress
      if (!installInfo.installs.some(needsDownload))
        return;
      notificationID = "addon-progress";
      messageString = gNavigatorBundle.getString("addonDownloading");
      messageString = PluralForm.get(installInfo.installs.length, messageString);
      options.installs = installInfo.installs;
      options.contentWindow = browser.contentWindow;
      options.sourceURI = browser.currentURI;
      options.eventCallback = function(aEvent) {
        if (aEvent != "removed")
          return;
        options.contentWindow = null;
        options.sourceURI = null;
      };
      PopupNotifications.show(browser, notificationID, messageString, anchorID,
                              null, null, options);
      break;
    case "addon-install-failed":
      // TODO This isn't terribly ideal for the multiple failure case
      for (let install of installInfo.installs) {
        let host = (installInfo.originatingURI instanceof Ci.nsIStandardURL) &&
                   installInfo.originatingURI.host;
        if (!host)
          host = (install.sourceURI instanceof Ci.nsIStandardURL) &&
                 install.sourceURI.host;

        let error = (host || install.error == 0) ? "addonError" : "addonLocalError";
        if (install.error != 0)
          error += install.error;
        else if (install.addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED)
          error += "Blocklisted";
        else
          error += "Incompatible";

        messageString = gNavigatorBundle.getString(error);
        messageString = messageString.replace("#1", install.name);
        if (host)
          messageString = messageString.replace("#2", host);
        messageString = messageString.replace("#3", brandShortName);
        messageString = messageString.replace("#4", Services.appinfo.version);

        PopupNotifications.show(browser, notificationID, messageString, anchorID,
                                action, null, options);
      }
      break;
    case "addon-install-complete":
      var needsRestart = installInfo.installs.some(function(i) {
        return i.addon.pendingOperations != AddonManager.PENDING_NONE;
      });

      if (needsRestart) {
        messageString = gNavigatorBundle.getString("addonsInstalledNeedsRestart");
        action = {
          label: gNavigatorBundle.getString("addonInstallRestartButton"),
          accessKey: gNavigatorBundle.getString("addonInstallRestartButton.accesskey"),
          callback: function() {
            Application.restart();
          }
        };
      }
      else {
        messageString = gNavigatorBundle.getString("addonsInstalled");
        action = null;
      }

      messageString = PluralForm.get(installInfo.installs.length, messageString);
      messageString = messageString.replace("#1", installInfo.installs[0].name);
      messageString = messageString.replace("#2", installInfo.installs.length);
      messageString = messageString.replace("#3", brandShortName);

      // Remove notificaion on dismissal, since it's possible to cancel the
      // install through the addons manager UI, making the "restart" prompt
      // irrelevant.
      options.removeOnDismissal = true;

      PopupNotifications.show(browser, notificationID, messageString, anchorID,
                              action, null, options);
      break;
    }
  }
};

/*
 * When addons are installed/uninstalled, check and see if the number of items
 * on the add-on bar changed:
 * - If an add-on was installed, incrementing the count, show the bar.
 * - If an add-on was uninstalled, and no more items are left, hide the bar.
 */
let AddonsMgrListener = {
  get addonBar() document.getElementById("addon-bar"),
  get statusBar() document.getElementById("status-bar"),
  getAddonBarItemCount: function() {
    // Take into account the contents of the status bar shim for the count.
    var itemCount = this.statusBar.childNodes.length;

    var defaultOrNoninteractive = this.addonBar.getAttribute("defaultset")
                                      .split(",")
                                      .concat(["separator", "spacer", "spring"]);
    for (let item of this.addonBar.currentSet.split(",")) {
      if (defaultOrNoninteractive.indexOf(item) == -1)
        itemCount++;
    }

    return itemCount;
  },
  onInstalling: function(aAddon) {
    this.lastAddonBarCount = this.getAddonBarItemCount();
  },
  onInstalled: function(aAddon) {
    if (this.getAddonBarItemCount() > this.lastAddonBarCount)
      setToolbarVisibility(this.addonBar, true);
  },
  onUninstalling: function(aAddon) {
    this.lastAddonBarCount = this.getAddonBarItemCount();
  },
  onUninstalled: function(aAddon) {
    if (this.getAddonBarItemCount() == 0)
      setToolbarVisibility(this.addonBar, false);
  },
  onEnabling: function(aAddon) this.onInstalling(),
  onEnabled: function(aAddon) this.onInstalled(),
  onDisabling: function(aAddon) this.onUninstalling(),
  onDisabled: function(aAddon) this.onUninstalled(),
};

var LightWeightThemeWebInstaller = {
  handleEvent: function (event) {
    switch (event.type) {
      case "InstallBrowserTheme":
      case "PreviewBrowserTheme":
      case "ResetBrowserThemePreview":
        // ignore requests from background tabs
        if (event.target.ownerDocument.defaultView.top != content)
          return;
    }
    switch (event.type) {
      case "InstallBrowserTheme":
        this._installRequest(event);
        break;
      case "PreviewBrowserTheme":
        this._preview(event);
        break;
      case "ResetBrowserThemePreview":
        this._resetPreview(event);
        break;
      case "pagehide":
      case "TabSelect":
        this._resetPreview();
        break;
    }
  },

  get _manager () {
    var temp = {};
    Cu.import("resource://gre/modules/LightweightThemeManager.jsm", temp);
    delete this._manager;
    return this._manager = temp.LightweightThemeManager;
  },

  _installRequest: function (event) {
    var node = event.target;
    var data = this._getThemeFromNode(node);
    if (!data)
      return;

    if (this._isAllowed(node)) {
      this._install(data);
      return;
    }

    var allowButtonText =
      gNavigatorBundle.getString("lwthemeInstallRequest.allowButton");
    var allowButtonAccesskey =
      gNavigatorBundle.getString("lwthemeInstallRequest.allowButton.accesskey");
    var message =
      gNavigatorBundle.getFormattedString("lwthemeInstallRequest.message",
                                          [node.ownerDocument.location.host]);
    var buttons = [{
      label: allowButtonText,
      accessKey: allowButtonAccesskey,
      callback: function () {
        LightWeightThemeWebInstaller._install(data);
      }
    }];

    this._removePreviousNotifications();

    var notificationBox = gBrowser.getNotificationBox();
    var notificationBar =
      notificationBox.appendNotification(message, "lwtheme-install-request", "",
                                         notificationBox.PRIORITY_INFO_MEDIUM,
                                         buttons);
    notificationBar.persistence = 1;
  },

  _install: function (newLWTheme) {
    var previousLWTheme = this._manager.currentTheme;

    var listener = {
      onEnabling: function(aAddon, aRequiresRestart) {
        if (!aRequiresRestart)
          return;

        let messageString = gNavigatorBundle.getFormattedString("lwthemeNeedsRestart.message",
          [aAddon.name], 1);

        let action = {
          label: gNavigatorBundle.getString("lwthemeNeedsRestart.button"),
          accessKey: gNavigatorBundle.getString("lwthemeNeedsRestart.accesskey"),
          callback: function () {
            Application.restart();
          }
        };

        let options = {
          timeout: Date.now() + 30000
        };

        PopupNotifications.show(gBrowser.selectedBrowser, "addon-theme-change",
                                messageString, "addons-notification-icon",
                                action, null, options);
      },

      onEnabled: function(aAddon) {
        LightWeightThemeWebInstaller._postInstallNotification(newLWTheme, previousLWTheme);
      }
    };

    AddonManager.addAddonListener(listener);
    this._manager.currentTheme = newLWTheme;
    AddonManager.removeAddonListener(listener);
  },

  _postInstallNotification: function (newTheme, previousTheme) {
    function text(id) {
      return gNavigatorBundle.getString("lwthemePostInstallNotification." + id);
    }

    var buttons = [{
      label: text("undoButton"),
      accessKey: text("undoButton.accesskey"),
      callback: function () {
        LightWeightThemeWebInstaller._manager.forgetUsedTheme(newTheme.id);
        LightWeightThemeWebInstaller._manager.currentTheme = previousTheme;
      }
    }, {
      label: text("manageButton"),
      accessKey: text("manageButton.accesskey"),
      callback: function () {
        BrowserOpenAddonsMgr("addons://list/theme");
      }
    }];

    this._removePreviousNotifications();

    var notificationBox = gBrowser.getNotificationBox();
    var notificationBar =
      notificationBox.appendNotification(text("message"),
                                         "lwtheme-install-notification", "",
                                         notificationBox.PRIORITY_INFO_MEDIUM,
                                         buttons);
    notificationBar.persistence = 1;
    notificationBar.timeout = Date.now() + 20000; // 20 seconds
  },

  _removePreviousNotifications: function () {
    var box = gBrowser.getNotificationBox();

    ["lwtheme-install-request",
     "lwtheme-install-notification"].forEach(function (value) {
        var notification = box.getNotificationWithValue(value);
        if (notification)
          box.removeNotification(notification);
      });
  },

  _previewWindow: null,
  _preview: function (event) {
    if (!this._isAllowed(event.target))
      return;

    var data = this._getThemeFromNode(event.target);
    if (!data)
      return;

    this._resetPreview();

    this._previewWindow = event.target.ownerDocument.defaultView;
    this._previewWindow.addEventListener("pagehide", this, true);
    gBrowser.tabContainer.addEventListener("TabSelect", this, false);

    this._manager.previewTheme(data);
  },

  _resetPreview: function (event) {
    if (!this._previewWindow ||
        event && !this._isAllowed(event.target))
      return;

    this._previewWindow.removeEventListener("pagehide", this, true);
    this._previewWindow = null;
    gBrowser.tabContainer.removeEventListener("TabSelect", this, false);

    this._manager.resetPreview();
  },

  _isAllowed: function (node) {
    var pm = Services.perms;

    var uri = node.ownerDocument.documentURIObject;
    return pm.testPermission(uri, "install") == pm.ALLOW_ACTION;
  },

  _getThemeFromNode: function (node) {
    return this._manager.parseTheme(node.getAttribute("data-browsertheme"),
                                    node.baseURI);
  }
}


text:
using System.Collections.Generic;
using System.Linq;
using Bytes2you.Validation;
using MeetMe.Data.Contracts;
using MeetMe.Data.Models;
using MeetMe.Services.Contracts;

namespace MeetMe.Services
{
    public class UserService : IUserService
    {
        private readonly IEFRepository<CustomUser> userRepository;
        private readonly IFriendService friendService;
        private readonly IUnitOfWork unitOfWork;
        private readonly IConversationService conversationService;

        public UserService(
            IEFRepository<CustomUser> userRepository,
            IFriendService friendService,
            IUnitOfWork unitOfWork,
            IConversationService conversationService)
        {
            Guard.WhenArgument(userRepository, "UserRepository").IsNull().Throw();
            Guard.WhenArgument(friendService, "FriendService").IsNull().Throw();
            Guard.WhenArgument(unitOfWork, "UnitOfWork").IsNull().Throw();
            Guard.WhenArgument(conversationService, "ConversationService").IsNull().Throw();

            this.userRepository = userRepository;
            this.friendService = friendService;
            this.unitOfWork = unitOfWork;
            this.conversationService = conversationService;
        }

        public void AddFriend(string userId, int friendId)
        {
            var user = this.GetByIndentityId(userId);
            var friendUser = this.userRepository.GetById(friendId);
            this.friendService.AddFriendship(user.Id, friendUser.AspIdentityUserId, friendId);
        }

        public void CreateConversation(string userId, int friendId)
        {
            var friendUser = this.userRepository.GetById(friendId);
            this.conversationService.CreateConversation(userId, friendUser.AspIdentityUserId);
        }

        public CustomUser GetById(int id)
        {
            var user = this.userRepository.GetById(id);
            return user;
        }

        public CustomUser GetByIndentityId(string id)
        {
            var user = this.userRepository
                .All
                .Where(x => x.AspIdentityUserId == id)
                .FirstOrDefault();

            return user;
        }

        public IEnumerable<string> GetUsernames()
        {
            var usernames = this.userRepository.All
                .ToList()
                .Select(x => x.FullName);

            return usernames;
        }

        public IEnumerable<CustomUser> GetAllUsers()
        {
            return this.userRepository.All.ToList();
        }

        public void BanUser(string userId)
        {
            var user = this.GetByIndentityId(userId);
            user.IsBanned = true;
            this.userRepository.Update(user);
            this.unitOfWork.Commit();
        }

        public void UnbanUser(string userId)
        {
            var user = this.GetByIndentityId(userId);
            user.IsBanned = false;
            this.userRepository.Update(user);
            this.unitOfWork.Commit();
        }
    }
}


text:
.. _upgrading-v0_16:

Upgrading to Hasura Platform v0.16 from v0.15
=============================================

Hasura Platform ``v0.16`` includes the open source `GraphQL Engine
<https://github.com/hasura/graphql-engine>`_. Hasura CLI ``v0.4`` onwards packs a
convenient command to make the migration easier.

Step 1: Install/Update Hasura CLI
---------------------------------

If you already have Hasura CLI installed, update it to the latest version:

.. code::

   hasura update-cli

If you don't have the CLI installed, you can find the installation instructions
at :ref:`install-cli`.

Step 2: Execute the upgrade command
-----------------------------------

Once inside a Hasura project directory with the required cluster added, execute
the following command:

.. code::

   hasura platform:upgrade -c <alias>

Replace alias with the alias of the cluster that needs to be upgraded.
The cluster will be upgraded to ``v0.16``.


text:
<?xml version="1.0" encoding="UTF-8"?>
<form name="frmTemplateDescription" align="client">
	<template name="Descricao">
		<layout align="left" width="$(width)" margins="{right=10}">
			<label align="left" width="90" text="$(text)" horzTextAlign="center"/>
			<edit align="client" field="$(field)" vertTextAlign="center" />
		</layout>
	</template>
	<scrollBox align="client">

		<rectangle left="0" top="0" width="1205" height="105" color="black">
			<label align="top" height="20" text="DESCRIÇÃO"/>

			<layout align="top" height="25">
				<Descricao width="380" text="PASSADO" field="passado"/>
				<Descricao width="380" text="IDADE" field="idade"/>
				<Descricao width="380" text="OLHOS" field="aparenciaOlhos"/>
			</layout>

			<layout align="top" height="25">
				<Descricao width="380" text="ALTURA" field="altura"/>
				<Descricao width="380" text="GÊNERO" field="genero"/>
				<Descricao width="380" text="PELE" field="pele"/>
			</layout>

			<layout align="top" height="25">
				<Descricao width="380" text="PESO" field="peso"/>
				<Descricao width="380" text="OUTROS" field="aparenciaOutros"/>
				<Descricao width="380" text="CABELO" field="cabelo"/>
			</layout>
		</rectangle>

		<layout left="0" top="110" width="375" height="240">
			<rectangle align="client" color="black"/>
			<label left="5" top="1" width="100" height="20" text="APARÊNCIA"/>
			<textEditor left="5" top="25" width="365" height="210" field="aparencia"/>
		</layout>
		<layout left="0" top="355" width="375" height="250">
			<rectangle align="client" color="black"/>
			<label left="5" top="1" width="100" height="20" text="PERSONALIDADE"/>
			<textEditor left="5" top="25" width="365" height="220" field="personalidade"/>
		</layout>
		<layout left="380" top="110" width="825" height="495">
			<rectangle align="client" color="black"/>
			<label left="5" top="1" width="100" height="20" text="HISTORIA"/>
			<richEdit left="5" top="25" width="815" height="465" field="background" backgroundColor="#333333" defaultFontSize="12" defaultFontColor="white"/>
		</layout>
	</scrollBox>
</form>


text:
<?php

use Pyz\Shared\Newsletter\NewsletterConstants;
use Spryker\Shared\Application\ApplicationConstants;
use Spryker\Shared\Collector\CollectorConstants;
use Spryker\Shared\Customer\CustomerConstants;
use Spryker\Shared\Mail\MailConstants;
use Spryker\Shared\ProductManagement\ProductManagementConstants;
use Spryker\Shared\Search\SearchConstants;
use Spryker\Shared\Session\SessionConstants;
use Spryker\Shared\Setup\SetupConstants;
use Spryker\Shared\ZedRequest\ZedRequestConstants;

// ---------- Yves host
$ENV_PROTOCOL_YVES = getenv('YVES_HOST_PROTOCOL'); //'http://'
$ENV_HOST_YVES = getenv('YVES_HOST');
$config[ApplicationConstants::HOST_YVES] = $ENV_HOST_YVES;
$config[ApplicationConstants::PORT_YVES] = '';
$config[ApplicationConstants::PORT_SSL_YVES] = '';
$config[ApplicationConstants::BASE_URL_YVES] = sprintf(
    '%s%s%s',
    $ENV_PROTOCOL_YVES,
    $config[ApplicationConstants::HOST_YVES],
    $config[ApplicationConstants::PORT_YVES]
);
$config[ApplicationConstants::BASE_URL_SSL_YVES] = sprintf(
    'https://%s%s',
    $config[ApplicationConstants::HOST_YVES],
    $config[ApplicationConstants::PORT_SSL_YVES]
);
$config[ProductManagementConstants::BASE_URL_YVES] = $config[ApplicationConstants::BASE_URL_YVES];
$config[NewsletterConstants::BASE_URL_YVES] = $config[ApplicationConstants::BASE_URL_YVES];
$config[CustomerConstants::BASE_URL_YVES] = $config[ApplicationConstants::BASE_URL_YVES];

// ---------- Zed host
$ENV_PROTOCOL_ZED = getenv('ZED_HOST_PROTOCOL'); //'http://'
$ENV_HOST_ZED = getenv('ZED_HOST');
$config[ApplicationConstants::HOST_ZED] = $ENV_HOST_ZED;
$config[ApplicationConstants::PORT_ZED] = '';
$config[ApplicationConstants::PORT_SSL_ZED] = '';
$config[ZedRequestConstants::HOST_ZED_API] = $ENV_HOST_ZED;
$config[ApplicationConstants::BASE_URL_ZED] = sprintf(
    '%s%s%s',
    $ENV_PROTOCOL_ZED,
    $config[ApplicationConstants::HOST_ZED],
    $config[ApplicationConstants::PORT_ZED]
);
$config[ApplicationConstants::BASE_URL_SSL_ZED] = sprintf(
    'https://%s%s',
    $config[ApplicationConstants::HOST_ZED],
    $config[ApplicationConstants::PORT_SSL_ZED]
);
$config[ZedRequestConstants::BASE_URL_ZED_API] = $config[ApplicationConstants::BASE_URL_ZED];
$config[ZedRequestConstants::BASE_URL_SSL_ZED_API] = $config[ApplicationConstants::BASE_URL_SSL_ZED];

// ---------- Assets
$config[ApplicationConstants::BASE_URL_STATIC_ASSETS] = $config[ApplicationConstants::BASE_URL_YVES];
$config[ApplicationConstants::BASE_URL_STATIC_MEDIA] = $config[ApplicationConstants::BASE_URL_YVES];
$config[ApplicationConstants::BASE_URL_SSL_STATIC_ASSETS] = $config[ApplicationConstants::BASE_URL_SSL_YVES];
$config[ApplicationConstants::BASE_URL_SSL_STATIC_MEDIA] = $config[ApplicationConstants::BASE_URL_SSL_YVES];

// ---------- Session
$config[SessionConstants::YVES_SESSION_COOKIE_DOMAIN] = $config[ApplicationConstants::HOST_YVES];
$config[SessionConstants::ZED_SESSION_COOKIE_NAME] = $config[ApplicationConstants::HOST_ZED];

// ---------- Jenkins
$config[SetupConstants::JENKINS_BASE_URL] = 'http://localhost:10007/';

// ---------- Elasticsearch
$ELASTICA_INDEX_NAME = 'de_search';
$config[SearchConstants::ELASTICA_PARAMETER__INDEX_NAME] = $ELASTICA_INDEX_NAME;
$config[CollectorConstants::ELASTICA_PARAMETER__INDEX_NAME] = $ELASTICA_INDEX_NAME;

// ---------- Email
$config[MailConstants::MAILCATCHER_GUI] = 'http://' . $config[ApplicationConstants::HOST_ZED] . ':1080';

// ---------- RabbitMQ
$config[ApplicationConstants::ZED_RABBITMQ_USERNAME] = 'DE_development';
$config[ApplicationConstants::ZED_RABBITMQ_PASSWORD] = 'mate20mg';
$config[ApplicationConstants::ZED_RABBITMQ_VHOST] = '/DE_development_zed';


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Publções Inst. Micol. Recife 56: 282 (1959)

#### Original name
Parapeltella caseariae Bat. & I.H. Lima

### Remarks
null


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="60dp"
    android:gravity="center"
          android:background="#e8e8e8"
       >

    <RelativeLayout
        android:id="@+id/xlistview_header_content"
        android:layout_width="fill_parent"
        android:layout_height="60dp" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:gravity="center"
            android:orientation="vertical" android:id="@+id/xlistview_header_text">

            <TextView
                android:id="@+id/xlistview_header_hint_textview"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center_vertical"
                android:text="@string/xlistview_header_hint_normal" />

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginTop="1dp"
                android:visibility="gone"
                >

                <TextView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="@string/xlistview_header_last_time"
                    android:textSize="12sp" android:visibility="gone" />

                <TextView
                    android:id="@+id/xlistview_header_time"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:textSize="12sp" />
            </LinearLayout>
        </LinearLayout>

        <ImageView
            android:id="@+id/xlistview_header_arrow"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignLeft="@id/xlistview_header_text"
            android:layout_centerVertical="true"
            android:layout_marginLeft="-35dp"
            android:src="@drawable/xlistview_arrow" />

        <ProgressBar
            android:id="@+id/xlistview_header_progressbar"
            android:layout_width="30dp"
            android:layout_height="30dp"
            android:layout_alignLeft="@id/xlistview_header_text"
            android:layout_centerVertical="true"
            android:layout_marginLeft="-40dp"
            android:visibility="invisible" />
    </RelativeLayout>

</LinearLayout>