text:
/**
 * Autogenerated by Avro
 *
 * DO NOT EDIT DIRECTLY
 */
package org.apache.hadoop.mapreduce.jobhistory;
@SuppressWarnings("all")
@org.apache.avro.specific.AvroGenerated
public class TaskAttemptStarted extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"TaskAttemptStarted\",\"namespace\":\"org.apache.hadoop.mapreduce.jobhistory\",\"fields\":[{\"name\":\"taskid\",\"type\":\"string\"},{\"name\":\"taskType\",\"type\":\"string\"},{\"name\":\"attemptId\",\"type\":\"string\"},{\"name\":\"startTime\",\"type\":\"long\"},{\"name\":\"trackerName\",\"type\":\"string\"},{\"name\":\"httpPort\",\"type\":\"int\"},{\"name\":\"shufflePort\",\"type\":\"int\"},{\"name\":\"containerId\",\"type\":\"string\"},{\"name\":\"locality\",\"type\":[\"null\",\"string\"],\"default\":null},{\"name\":\"avataar\",\"type\":[\"null\",\"string\"],\"default\":null}]}");
  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
  @Deprecated public java.lang.CharSequence taskid;
  @Deprecated public java.lang.CharSequence taskType;
  @Deprecated public java.lang.CharSequence attemptId;
  @Deprecated public long startTime;
  @Deprecated public java.lang.CharSequence trackerName;
  @Deprecated public int httpPort;
  @Deprecated public int shufflePort;
  @Deprecated public java.lang.CharSequence containerId;
  @Deprecated public java.lang.CharSequence locality;
  @Deprecated public java.lang.CharSequence avataar;

  /**
   * Default constructor.  Note that this does not initialize fields
   * to their default values from the schema.  If that is desired then
   * one should use newBuilder().
   */
  public TaskAttemptStarted() {}

  /**
   * All-args constructor.
   */
  public TaskAttemptStarted(java.lang.CharSequence taskid, java.lang.CharSequence taskType, java.lang.CharSequence attemptId, java.lang.Long startTime, java.lang.CharSequence trackerName, java.lang.Integer httpPort, java.lang.Integer shufflePort, java.lang.CharSequence containerId, java.lang.CharSequence locality, java.lang.CharSequence avataar) {
    this.taskid = taskid;
    this.taskType = taskType;
    this.attemptId = attemptId;
    this.startTime = startTime;
    this.trackerName = trackerName;
    this.httpPort = httpPort;
    this.shufflePort = shufflePort;
    this.containerId = containerId;
    this.locality = locality;
    this.avataar = avataar;
  }

  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
  // Used by DatumWriter.  Applications should not call.
  public java.lang.Object get(int field$) {
    switch (field$) {
    case 0: return taskid;
    case 1: return taskType;
    case 2: return attemptId;
    case 3: return startTime;
    case 4: return trackerName;
    case 5: return httpPort;
    case 6: return shufflePort;
    case 7: return containerId;
    case 8: return locality;
    case 9: return avataar;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }
  // Used by DatumReader.  Applications should not call.
  @SuppressWarnings(value="unchecked")
  public void put(int field$, java.lang.Object value$) {
    switch (field$) {
    case 0: taskid = (java.lang.CharSequence)value$; break;
    case 1: taskType = (java.lang.CharSequence)value$; break;
    case 2: attemptId = (java.lang.CharSequence)value$; break;
    case 3: startTime = (java.lang.Long)value$; break;
    case 4: trackerName = (java.lang.CharSequence)value$; break;
    case 5: httpPort = (java.lang.Integer)value$; break;
    case 6: shufflePort = (java.lang.Integer)value$; break;
    case 7: containerId = (java.lang.CharSequence)value$; break;
    case 8: locality = (java.lang.CharSequence)value$; break;
    case 9: avataar = (java.lang.CharSequence)value$; break;
    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
    }
  }

  /**
   * Gets the value of the 'taskid' field.
   */
  public java.lang.CharSequence getTaskid() {
    return taskid;
  }

  /**
   * Sets the value of the 'taskid' field.
   * @param value the value to set.
   */
  public void setTaskid(java.lang.CharSequence value) {
    this.taskid = value;
  }

  /**
   * Gets the value of the 'taskType' field.
   */
  public java.lang.CharSequence getTaskType() {
    return taskType;
  }

  /**
   * Sets the value of the 'taskType' field.
   * @param value the value to set.
   */
  public void setTaskType(java.lang.CharSequence value) {
    this.taskType = value;
  }

  /**
   * Gets the value of the 'attemptId' field.
   */
  public java.lang.CharSequence getAttemptId() {
    return attemptId;
  }

  /**
   * Sets the value of the 'attemptId' field.
   * @param value the value to set.
   */
  public void setAttemptId(java.lang.CharSequence value) {
    this.attemptId = value;
  }

  /**
   * Gets the value of the 'startTime' field.
   */
  public java.lang.Long getStartTime() {
    return startTime;
  }

  /**
   * Sets the value of the 'startTime' field.
   * @param value the value to set.
   */
  public void setStartTime(java.lang.Long value) {
    this.startTime = value;
  }

  /**
   * Gets the value of the 'trackerName' field.
   */
  public java.lang.CharSequence getTrackerName() {
    return trackerName;
  }

  /**
   * Sets the value of the 'trackerName' field.
   * @param value the value to set.
   */
  public void setTrackerName(java.lang.CharSequence value) {
    this.trackerName = value;
  }

  /**
   * Gets the value of the 'httpPort' field.
   */
  public java.lang.Integer getHttpPort() {
    return httpPort;
  }

  /**
   * Sets the value of the 'httpPort' field.
   * @param value the value to set.
   */
  public void setHttpPort(java.lang.Integer value) {
    this.httpPort = value;
  }

  /**
   * Gets the value of the 'shufflePort' field.
   */
  public java.lang.Integer getShufflePort() {
    return shufflePort;
  }

  /**
   * Sets the value of the 'shufflePort' field.
   * @param value the value to set.
   */
  public void setShufflePort(java.lang.Integer value) {
    this.shufflePort = value;
  }

  /**
   * Gets the value of the 'containerId' field.
   */
  public java.lang.CharSequence getContainerId() {
    return containerId;
  }

  /**
   * Sets the value of the 'containerId' field.
   * @param value the value to set.
   */
  public void setContainerId(java.lang.CharSequence value) {
    this.containerId = value;
  }

  /**
   * Gets the value of the 'locality' field.
   */
  public java.lang.CharSequence getLocality() {
    return locality;
  }

  /**
   * Sets the value of the 'locality' field.
   * @param value the value to set.
   */
  public void setLocality(java.lang.CharSequence value) {
    this.locality = value;
  }

  /**
   * Gets the value of the 'avataar' field.
   */
  public java.lang.CharSequence getAvataar() {
    return avataar;
  }

  /**
   * Sets the value of the 'avataar' field.
   * @param value the value to set.
   */
  public void setAvataar(java.lang.CharSequence value) {
    this.avataar = value;
  }

  /** Creates a new TaskAttemptStarted RecordBuilder */
  public static org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder newBuilder() {
    return new org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder();
  }

  /** Creates a new TaskAttemptStarted RecordBuilder by copying an existing Builder */
  public static org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder newBuilder(org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder other) {
    return new org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder(other);
  }

  /** Creates a new TaskAttemptStarted RecordBuilder by copying an existing TaskAttemptStarted instance */
  public static org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder newBuilder(org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted other) {
    return new org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder(other);
  }

  /**
   * RecordBuilder for TaskAttemptStarted instances.
   */
  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<TaskAttemptStarted>
    implements org.apache.avro.data.RecordBuilder<TaskAttemptStarted> {

    private java.lang.CharSequence taskid;
    private java.lang.CharSequence taskType;
    private java.lang.CharSequence attemptId;
    private long startTime;
    private java.lang.CharSequence trackerName;
    private int httpPort;
    private int shufflePort;
    private java.lang.CharSequence containerId;
    private java.lang.CharSequence locality;
    private java.lang.CharSequence avataar;

    /** Creates a new Builder */
    private Builder() {
      super(org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.SCHEMA$);
    }

    /** Creates a Builder by copying an existing Builder */
    private Builder(org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder other) {
      super(other);
      if (isValidValue(fields()[0], other.taskid)) {
        this.taskid = data().deepCopy(fields()[0].schema(), other.taskid);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.taskType)) {
        this.taskType = data().deepCopy(fields()[1].schema(), other.taskType);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.attemptId)) {
        this.attemptId = data().deepCopy(fields()[2].schema(), other.attemptId);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.startTime)) {
        this.startTime = data().deepCopy(fields()[3].schema(), other.startTime);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.trackerName)) {
        this.trackerName = data().deepCopy(fields()[4].schema(), other.trackerName);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.httpPort)) {
        this.httpPort = data().deepCopy(fields()[5].schema(), other.httpPort);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.shufflePort)) {
        this.shufflePort = data().deepCopy(fields()[6].schema(), other.shufflePort);
        fieldSetFlags()[6] = true;
      }
      if (isValidValue(fields()[7], other.containerId)) {
        this.containerId = data().deepCopy(fields()[7].schema(), other.containerId);
        fieldSetFlags()[7] = true;
      }
      if (isValidValue(fields()[8], other.locality)) {
        this.locality = data().deepCopy(fields()[8].schema(), other.locality);
        fieldSetFlags()[8] = true;
      }
      if (isValidValue(fields()[9], other.avataar)) {
        this.avataar = data().deepCopy(fields()[9].schema(), other.avataar);
        fieldSetFlags()[9] = true;
      }
    }

    /** Creates a Builder by copying an existing TaskAttemptStarted instance */
    private Builder(org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted other) {
            super(org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.SCHEMA$);
      if (isValidValue(fields()[0], other.taskid)) {
        this.taskid = data().deepCopy(fields()[0].schema(), other.taskid);
        fieldSetFlags()[0] = true;
      }
      if (isValidValue(fields()[1], other.taskType)) {
        this.taskType = data().deepCopy(fields()[1].schema(), other.taskType);
        fieldSetFlags()[1] = true;
      }
      if (isValidValue(fields()[2], other.attemptId)) {
        this.attemptId = data().deepCopy(fields()[2].schema(), other.attemptId);
        fieldSetFlags()[2] = true;
      }
      if (isValidValue(fields()[3], other.startTime)) {
        this.startTime = data().deepCopy(fields()[3].schema(), other.startTime);
        fieldSetFlags()[3] = true;
      }
      if (isValidValue(fields()[4], other.trackerName)) {
        this.trackerName = data().deepCopy(fields()[4].schema(), other.trackerName);
        fieldSetFlags()[4] = true;
      }
      if (isValidValue(fields()[5], other.httpPort)) {
        this.httpPort = data().deepCopy(fields()[5].schema(), other.httpPort);
        fieldSetFlags()[5] = true;
      }
      if (isValidValue(fields()[6], other.shufflePort)) {
        this.shufflePort = data().deepCopy(fields()[6].schema(), other.shufflePort);
        fieldSetFlags()[6] = true;
      }
      if (isValidValue(fields()[7], other.containerId)) {
        this.containerId = data().deepCopy(fields()[7].schema(), other.containerId);
        fieldSetFlags()[7] = true;
      }
      if (isValidValue(fields()[8], other.locality)) {
        this.locality = data().deepCopy(fields()[8].schema(), other.locality);
        fieldSetFlags()[8] = true;
      }
      if (isValidValue(fields()[9], other.avataar)) {
        this.avataar = data().deepCopy(fields()[9].schema(), other.avataar);
        fieldSetFlags()[9] = true;
      }
    }

    /**
      * Gets the value of the 'taskid' field.
      */
    public java.lang.CharSequence getTaskid() {
      return taskid;
    }

    /**
      * Sets the value of the 'taskid' field.
      * @param value the value to set.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder setTaskid(java.lang.CharSequence value) {
      validate(fields()[0], value);
      this.taskid = value;
      fieldSetFlags()[0] = true;
      return this;
    }

    /**
      * Checks whether the 'taskid' field has been set.
      */
    public boolean hasTaskid() {
      return fieldSetFlags()[0];
    }

    /**
      * Clears the value of the 'taskid' field.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder clearTaskid() {
      taskid = null;
      fieldSetFlags()[0] = false;
      return this;
    }

    /**
      * Gets the value of the 'taskType' field.
      */
    public java.lang.CharSequence getTaskType() {
      return taskType;
    }

    /**
      * Sets the value of the 'taskType' field.
      * @param value the value to set.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder setTaskType(java.lang.CharSequence value) {
      validate(fields()[1], value);
      this.taskType = value;
      fieldSetFlags()[1] = true;
      return this;
    }

    /**
      * Checks whether the 'taskType' field has been set.
      */
    public boolean hasTaskType() {
      return fieldSetFlags()[1];
    }

    /**
      * Clears the value of the 'taskType' field.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder clearTaskType() {
      taskType = null;
      fieldSetFlags()[1] = false;
      return this;
    }

    /**
      * Gets the value of the 'attemptId' field.
      */
    public java.lang.CharSequence getAttemptId() {
      return attemptId;
    }

    /**
      * Sets the value of the 'attemptId' field.
      * @param value the value to set.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder setAttemptId(java.lang.CharSequence value) {
      validate(fields()[2], value);
      this.attemptId = value;
      fieldSetFlags()[2] = true;
      return this;
    }

    /**
      * Checks whether the 'attemptId' field has been set.
      */
    public boolean hasAttemptId() {
      return fieldSetFlags()[2];
    }

    /**
      * Clears the value of the 'attemptId' field.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder clearAttemptId() {
      attemptId = null;
      fieldSetFlags()[2] = false;
      return this;
    }

    /**
      * Gets the value of the 'startTime' field.
      */
    public java.lang.Long getStartTime() {
      return startTime;
    }

    /**
      * Sets the value of the 'startTime' field.
      * @param value the value to set.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder setStartTime(long value) {
      validate(fields()[3], value);
      this.startTime = value;
      fieldSetFlags()[3] = true;
      return this;
    }

    /**
      * Checks whether the 'startTime' field has been set.
      */
    public boolean hasStartTime() {
      return fieldSetFlags()[3];
    }

    /**
      * Clears the value of the 'startTime' field.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder clearStartTime() {
      fieldSetFlags()[3] = false;
      return this;
    }

    /**
      * Gets the value of the 'trackerName' field.
      */
    public java.lang.CharSequence getTrackerName() {
      return trackerName;
    }

    /**
      * Sets the value of the 'trackerName' field.
      * @param value the value to set.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder setTrackerName(java.lang.CharSequence value) {
      validate(fields()[4], value);
      this.trackerName = value;
      fieldSetFlags()[4] = true;
      return this;
    }

    /**
      * Checks whether the 'trackerName' field has been set.
      */
    public boolean hasTrackerName() {
      return fieldSetFlags()[4];
    }

    /**
      * Clears the value of the 'trackerName' field.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder clearTrackerName() {
      trackerName = null;
      fieldSetFlags()[4] = false;
      return this;
    }

    /**
      * Gets the value of the 'httpPort' field.
      */
    public java.lang.Integer getHttpPort() {
      return httpPort;
    }

    /**
      * Sets the value of the 'httpPort' field.
      * @param value the value to set.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder setHttpPort(int value) {
      validate(fields()[5], value);
      this.httpPort = value;
      fieldSetFlags()[5] = true;
      return this;
    }

    /**
      * Checks whether the 'httpPort' field has been set.
      */
    public boolean hasHttpPort() {
      return fieldSetFlags()[5];
    }

    /**
      * Clears the value of the 'httpPort' field.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder clearHttpPort() {
      fieldSetFlags()[5] = false;
      return this;
    }

    /**
      * Gets the value of the 'shufflePort' field.
      */
    public java.lang.Integer getShufflePort() {
      return shufflePort;
    }

    /**
      * Sets the value of the 'shufflePort' field.
      * @param value the value to set.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder setShufflePort(int value) {
      validate(fields()[6], value);
      this.shufflePort = value;
      fieldSetFlags()[6] = true;
      return this;
    }

    /**
      * Checks whether the 'shufflePort' field has been set.
      */
    public boolean hasShufflePort() {
      return fieldSetFlags()[6];
    }

    /**
      * Clears the value of the 'shufflePort' field.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder clearShufflePort() {
      fieldSetFlags()[6] = false;
      return this;
    }

    /**
      * Gets the value of the 'containerId' field.
      */
    public java.lang.CharSequence getContainerId() {
      return containerId;
    }

    /**
      * Sets the value of the 'containerId' field.
      * @param value the value to set.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder setContainerId(java.lang.CharSequence value) {
      validate(fields()[7], value);
      this.containerId = value;
      fieldSetFlags()[7] = true;
      return this;
    }

    /**
      * Checks whether the 'containerId' field has been set.
      */
    public boolean hasContainerId() {
      return fieldSetFlags()[7];
    }

    /**
      * Clears the value of the 'containerId' field.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder clearContainerId() {
      containerId = null;
      fieldSetFlags()[7] = false;
      return this;
    }

    /**
      * Gets the value of the 'locality' field.
      */
    public java.lang.CharSequence getLocality() {
      return locality;
    }

    /**
      * Sets the value of the 'locality' field.
      * @param value the value to set.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder setLocality(java.lang.CharSequence value) {
      validate(fields()[8], value);
      this.locality = value;
      fieldSetFlags()[8] = true;
      return this;
    }

    /**
      * Checks whether the 'locality' field has been set.
      */
    public boolean hasLocality() {
      return fieldSetFlags()[8];
    }

    /**
      * Clears the value of the 'locality' field.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder clearLocality() {
      locality = null;
      fieldSetFlags()[8] = false;
      return this;
    }

    /**
      * Gets the value of the 'avataar' field.
      */
    public java.lang.CharSequence getAvataar() {
      return avataar;
    }

    /**
      * Sets the value of the 'avataar' field.
      * @param value the value to set.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder setAvataar(java.lang.CharSequence value) {
      validate(fields()[9], value);
      this.avataar = value;
      fieldSetFlags()[9] = true;
      return this;
    }

    /**
      * Checks whether the 'avataar' field has been set.
      */
    public boolean hasAvataar() {
      return fieldSetFlags()[9];
    }

    /**
      * Clears the value of the 'avataar' field.
      */
    public org.apache.hadoop.mapreduce.jobhistory.TaskAttemptStarted.Builder clearAvataar() {
      avataar = null;
      fieldSetFlags()[9] = false;
      return this;
    }

    @Override
    public TaskAttemptStarted build() {
      try {
        TaskAttemptStarted record = new TaskAttemptStarted();
        record.taskid = fieldSetFlags()[0] ? this.taskid : (java.lang.CharSequence) defaultValue(fields()[0]);
        record.taskType = fieldSetFlags()[1] ? this.taskType : (java.lang.CharSequence) defaultValue(fields()[1]);
        record.attemptId = fieldSetFlags()[2] ? this.attemptId : (java.lang.CharSequence) defaultValue(fields()[2]);
        record.startTime = fieldSetFlags()[3] ? this.startTime : (java.lang.Long) defaultValue(fields()[3]);
        record.trackerName = fieldSetFlags()[4] ? this.trackerName : (java.lang.CharSequence) defaultValue(fields()[4]);
        record.httpPort = fieldSetFlags()[5] ? this.httpPort : (java.lang.Integer) defaultValue(fields()[5]);
        record.shufflePort = fieldSetFlags()[6] ? this.shufflePort : (java.lang.Integer) defaultValue(fields()[6]);
        record.containerId = fieldSetFlags()[7] ? this.containerId : (java.lang.CharSequence) defaultValue(fields()[7]);
        record.locality = fieldSetFlags()[8] ? this.locality : (java.lang.CharSequence) defaultValue(fields()[8]);
        record.avataar = fieldSetFlags()[9] ? this.avataar : (java.lang.CharSequence) defaultValue(fields()[9]);
        return record;
      } catch (Exception e) {
        throw new org.apache.avro.AvroRuntimeException(e);
      }
    }
  }
}


text:
package org.cats.giftcertificate.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;

@Entity
public class FundSource {
    @Id
    @Column(name = "fund_source_id")
    private Long id;
    private String name;
    private String description;

    FundSource(){}

    public FundSource(String name, String description){
        this.name = name;
        this.description = description;
    }

    public Long getId() {
        return id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.springframework.boot.maven;

import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

import org.apache.maven.artifact.Artifact;
import org.apache.maven.shared.artifact.filter.collection.ArtifactFilterException;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;

/**
 * Tests for {@link ExcludeFilter}.
 *
 * @author Stephane Nicoll
 * @author David Turanski
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public class ExcludeFilterTests {

	@Test
	public void excludeSimple() throws ArtifactFilterException {
		ExcludeFilter filter = new ExcludeFilter(
				Arrays.asList(createExclude("com.foo", "bar")));
		Set result = filter
				.filter(Collections.singleton(createArtifact("com.foo", "bar")));
		assertThat(result).isEmpty();
	}

	@Test
	public void excludeGroupIdNoMatch() throws ArtifactFilterException {
		ExcludeFilter filter = new ExcludeFilter(
				Arrays.asList(createExclude("com.foo", "bar")));
		Artifact artifact = createArtifact("com.baz", "bar");
		Set result = filter.filter(Collections.singleton(artifact));
		assertThat(result).hasSize(1);
		assertThat(result.iterator().next()).isSameAs(artifact);
	}

	@Test
	public void excludeArtifactIdNoMatch() throws ArtifactFilterException {
		ExcludeFilter filter = new ExcludeFilter(
				Arrays.asList(createExclude("com.foo", "bar")));
		Artifact artifact = createArtifact("com.foo", "biz");
		Set result = filter.filter(Collections.singleton(artifact));
		assertThat(result).hasSize(1);
		assertThat(result.iterator().next()).isSameAs(artifact);
	}

	@Test
	public void excludeClassifier() throws ArtifactFilterException {
		ExcludeFilter filter = new ExcludeFilter(
				Arrays.asList(createExclude("com.foo", "bar", "jdk5")));
		Set result = filter
				.filter(Collections.singleton(createArtifact("com.foo", "bar", "jdk5")));
		assertThat(result).isEmpty();
	}

	@Test
	public void excludeClassifierNoTargetClassifier() throws ArtifactFilterException {
		ExcludeFilter filter = new ExcludeFilter(
				Arrays.asList(createExclude("com.foo", "bar", "jdk5")));
		Artifact artifact = createArtifact("com.foo", "bar");
		Set result = filter.filter(Collections.singleton(artifact));
		assertThat(result).hasSize(1);
		assertThat(result.iterator().next()).isSameAs(artifact);
	}

	@Test
	public void excludeClassifierNoMatch() throws ArtifactFilterException {
		ExcludeFilter filter = new ExcludeFilter(
				Arrays.asList(createExclude("com.foo", "bar", "jdk5")));
		Artifact artifact = createArtifact("com.foo", "bar", "jdk6");
		Set result = filter.filter(Collections.singleton(artifact));
		assertThat(result).hasSize(1);
		assertThat(result.iterator().next()).isSameAs(artifact);
	}

	@Test
	public void excludeMulti() throws ArtifactFilterException {
		ExcludeFilter filter = new ExcludeFilter(Arrays.asList(
				createExclude("com.foo", "bar"), createExclude("com.foo", "bar2"),
				createExclude("org.acme", "app")));
		Set<Artifact> artifacts = new HashSet<Artifact>();
		artifacts.add(createArtifact("com.foo", "bar"));
		artifacts.add(createArtifact("com.foo", "bar"));
		Artifact anotherAcme = createArtifact("org.acme", "another-app");
		artifacts.add(anotherAcme);
		Set result = filter.filter(artifacts);
		assertThat(result).hasSize(1);
		assertThat(result.iterator().next()).isSameAs(anotherAcme);
	}

	private Exclude createExclude(String groupId, String artifactId) {
		return createExclude(groupId, artifactId, null);
	}

	private Exclude createExclude(String groupId, String artifactId, String classifier) {
		Exclude exclude = new Exclude();
		exclude.setGroupId(groupId);
		exclude.setArtifactId(artifactId);
		if (classifier != null) {
			exclude.setClassifier(classifier);
		}
		return exclude;
	}

	private Artifact createArtifact(String groupId, String artifactId,
			String classifier) {
		Artifact a = mock(Artifact.class);
		given(a.getGroupId()).willReturn(groupId);
		given(a.getArtifactId()).willReturn(artifactId);
		given(a.getClassifier()).willReturn(classifier);
		return a;
	}

	private Artifact createArtifact(String groupId, String artifactId) {
		return createArtifact(groupId, artifactId, null);
	}

}


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

namespace Microsoft.Azure.Commands.Management.DeviceProvisioningServices
{
    using System;
    using System.Collections.Generic;
    using System.Management.Automation;
    using Microsoft.Azure.Commands.Management.DeviceProvisioningServices.Models;
    using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters;
    using Microsoft.Azure.Management.DeviceProvisioningServices.Models;

    [Cmdlet("Get", ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "IoTDeviceProvisioningServiceLinkedHub", DefaultParameterSetName = ResourceParameterSet)]
    [Alias("Get-" + ResourceManager.Common.AzureRMConstants.AzureRMPrefix + "IoTDpsHub")]
    [OutputType(typeof(PSIotHubDefinitionDescription), typeof(PSIotHubDefinitions))]
    public class GetAzureRmIoTDeviceProvisioningServiceLinkedHub : IotDpsBaseCmdlet
    {
        private const string ResourceIdParameterSet = "ResourceIdSet";
        private const string ResourceParameterSet = "ResourceSet";
        private const string InputObjectParameterSet = "InputObjectSet";

        [Parameter(
            Position = 0,
            Mandatory = true,
            ParameterSetName = InputObjectParameterSet,
            ValueFromPipeline = true,
            HelpMessage = "IoT Device Provisioning Service Object")]
        [ValidateNotNullOrEmpty]
        public PSProvisioningServiceDescription DpsObject { get; set; }

        [Parameter(
            Position = 0,
            Mandatory = true,
            ParameterSetName = ResourceIdParameterSet,
            ValueFromPipelineByPropertyName = true,
            HelpMessage = "IoT Device Provisioning Service Resource Id")]
        [ValidateNotNullOrEmpty]
        public string ResourceId { get; set; }

        [Parameter(
            Position = 0,
            Mandatory = true,
            ParameterSetName = ResourceParameterSet,
            HelpMessage = "Name of the Resource Group")]
        [ResourceGroupCompleter]
        [ValidateNotNullOrEmpty]
        public string ResourceGroupName { get; set; }

        [Parameter(
            Position = 1,
            Mandatory = true,
            ParameterSetName = ResourceParameterSet,
            HelpMessage = "Name of the IoT Device Provisioning Service")]
        [ValidateNotNullOrEmpty]
        public string Name { get; set; }

        [Parameter(
            Mandatory = false,
            HelpMessage = "Host name of linked IoT Hub")]
        [ValidateNotNullOrEmpty]
        public string LinkedHubName { get; set; }

        public override void ExecuteCmdlet()
        {
            switch (ParameterSetName)
            {
                case InputObjectParameterSet:
                    this.ResourceGroupName = this.DpsObject.ResourceGroupName;
                    this.Name = this.DpsObject.Name;
                    this.GetIotDpsHubs();
                    break;

                case ResourceIdParameterSet:
                    this.ResourceGroupName = IotDpsUtils.GetResourceGroupName(this.ResourceId);
                    this.Name = IotDpsUtils.GetIotDpsName(this.ResourceId);
                    this.GetIotDpsHubs();
                    break;

                case ResourceParameterSet:
                    this.GetIotDpsHubs();
                    break;

                default:
                    throw new ArgumentException("BadParameterSetName");
            }
        }

        private void WritePSObject(IotHubDefinitionDescription iotDpsHub)
        {
            this.WriteObject(IotDpsUtils.ToPSIotHubDefinitionDescription(iotDpsHub, this.ResourceGroupName, this.Name), false);
        }

        private void WritePSObjects(IList<IotHubDefinitionDescription> iotDpsHubs)
        {
            this.WriteObject(IotDpsUtils.ToPSIotHubDefinitionDescription(iotDpsHubs), true);
        }

        private void GetIotDpsHubs()
        {
            if (!string.IsNullOrEmpty(this.LinkedHubName))
            {
                this.WritePSObject(GetIotDpsHubs(this.ResourceGroupName, this.Name, this.LinkedHubName));
            }
            else
            {
                IList<IotHubDefinitionDescription> iotDpsHubs = GetIotDpsHubs(this.ResourceGroupName, this.Name);
                if (iotDpsHubs.Count == 1)
                {
                    this.WritePSObject(iotDpsHubs[0]);
                }
                else
                {
                    this.WritePSObjects(iotDpsHubs);
                }
            }
        }
    }
}


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

    <string name="app_name">EncryptionExample</string>
    <string name="hello_world">Hello world!</string>
    <string name="action_settings">Settings</string>
    <string name="default_hint">I\'m not typing anything in here! You\'re nuts!</string>

</resources>


text:
@class DZATimer;

@protocol DZATimerDelegate <NSObject>

// this method is called at each timestep
-(void) timer:(DZATimer *) timer timeStepForElapsedTime:(NSTimeInterval) elapsedTime;

// it must returns how long is a timestep
-(NSTimeInterval) timeStepForCallingEventForTimer:(DZATimer *) timer;

@end

@interface DZATimer : NSObject

-(id) init;
// init with a delegate that will be called at each timestep
-(id) initWithDelegate:(id<DZATimerDelegate>) delegate;

// starts the timer
-(void) startTimer;
// pauses the timer
-(void) pauseTimer;
// stops the timer and resets the elapsedTime
-(NSTimeInterval) stopTimer;

// elapsed time from the start time
@property (nonatomic, readonly) NSTimeInterval elapsedTime;
// delegate object to call at each timestep
@property (nonatomic, weak) id<DZATimerDelegate> delegate;
@property (nonatomic, readonly) BOOL isPlaying;

// returns up-time returned from the function mach_absolute_time. This value is dependent from the clock and can't be used directly to show time
+(uint64_t) getMachAbsoluteTime;
// returns the difference in nanoseconds bewtween 2 machAbsoluteTimes
+(uint64_t) nanoSecondsBetweenStartMachAbsoluteTime:(uint64_t) startTime endMachAbsoluteTime:(uint64_t) endTime;

@end


text:
// Given a binary tree, determine if it is height-balanced.
// For this problem, a height-balanced binary tree is defined as a binary tree
// in which the depth of the two subtrees of every node never differ by more
// than 1.

/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     TreeNode *left;
 *     TreeNode *right;
 *     TreeNode(int x) : val(x), left(NULL), right(NULL) {}
 * };
 */
// "depth of a tree" is misleading
// we only have height of a node, height of a tree, and depth of a node
class Solution {
    int height(TreeNode *root) {
        if (!root)
            return 0;

        int l = height(root->left);
        int r = height(root->right);

        if (l < 0 || r < 0 || abs(l - r) > 1)
            return -1; // just a number to mark

        return 1 + max(l, r);
    }

  public:
    bool isBalanced(TreeNode *root) { return height(root) != -1; }
};


text:
module PrintingTest where

import           Data.List
import           Debug.Trace
import           Driving
import           Eval
import           Program.List
import           Program.Num
import           Prelude     hiding (succ)
import           Residualization
import           Program.Sort
import           Stream
import           Syntax
import           Test        hiding (main)
import           Tree
import           Printer.Tree
import           Program.Stlc
import           Program.Programs
import           Text.Printf
import           Util.ConjRetriever
import Util.Miscellaneous
import Printer.Dot

upTo d x =
  -- trace (printf "\nDepth: %s" $ show d) $
  if d == 0 then Fail
  else upToDepth x
  where
    upToDepth (Gen id gen t goal sigma) = Gen id gen (upTo (d-1) t) goal sigma
    upToDepth (Call id t goal sigma) = Call id (upTo (d-1) t) goal sigma
    upToDepth (Split id ts goal sigma) = Split id (map (\t -> upTo (d-1) t) ts) goal sigma
    upToDepth (Or t1 t2 goal sigma) = Or (upTo (d-1) t1) (upTo (d-1) t2)  goal sigma
    upToDepth (Fail) = Fail
    upToDepth (Success s) = Success s
    upToDepth (Rename id g s r ts) = Rename id g s r ts

accumCalls :: Tree -> [[G S]]
accumCalls (Or t1 t2 _ _)    = accumCalls t1 ++ accumCalls t2
accumCalls (Split _ ts _ _)  = concatMap accumCalls ts
accumCalls (Gen _ _ t _ _)   = accumCalls t
accumCalls (Call _ t goal _) = map (\xs -> goal : xs) $ accumCalls t
accumCalls (Prune [g])       = [[g]]
--accumCalls (Prune gs)          = [[conj gs]]
accumCalls _                 = []

showConjStack :: [[G S]] -> String
showConjStack gss = unlines $ map (\gs -> '\n' : '\n' : (unlines $ map (\g -> '\n' : (unwords $ map show $ unconj g)) gs) ) gss where
  unconj (g1 :/\: g2) = unconj g1 ++ unconj g2
  unconj g@(Invoke _ _) = [g]
  unconj _ = error "Here could only be conjunctions"

runTest name goal =
  do
    let tree = snd3 $ drive $ goal
    printTree (printf "%s.dot" name) tree

runTestSimplified name goal =
  do
    putStr $ printf "Running %s\n" name
    let tree = simpl $ snd3 $ drive $ goal
    writeFile (printf "%s.log" name) $ showConjStack $ retrieve tree
    printTree (printf "%s.dot" name) tree
    putStr $ printf "Finished %s\n" name

test_palindromo       = runTestSimplified "palindromo" $ Program palindromo $ fresh ["x"] (call "palindromo" [V "x"])
test_doubleAppendo    = runTestSimplified "doubleAppendo" $ Program doubleAppendo $ fresh ["x", "y", "z", "r"] (call "doubleAppendo" [V "x", V "y", V "z", V "r"])
test_eveno            = runTestSimplified "eveno" $ Program eveno $ fresh ["x"] (call "eveno" [V "x"])
test_doubleo          = runTestSimplified "doubleo" $ Program doubleo $ fresh ["x", "xx"] (call "doubleo" [V "x", V "xx"])
test_empty_appendo    = runTestSimplified "emptyAppendo" $ Program emptyAppendo $ fresh ["x", "y"] (call "emptyAppendo" [V "x", V "y"])
test_singletonReverso = runTestSimplified "singletonReverso" $ Program singletonReverso $ fresh ["x", "y"] (call "singletonReverso" [V "x", V "y"])

tc = drive (Program appendo
              (fresh ["q", "r", "s", "t", "p"]
                 (call "appendo" [V "q", V "r", V "s"] &&&
                  call "appendo" [V "s", V "t", V "p"])
              )
           )

tc'  = drive (Program reverso $ fresh ["q", "r"] (call "reverso" [V "q", V "r"]))
tc'' = drive (Program revAcco $ fresh ["q", "s"] (call "revacco" [V "q", nil, V "s"]))

tree   = snd3 tc
tree'  = snd3 tc'
tree'' = snd3 tc''

main =
  do
--    test_doubleAppendo

    {-printTree "appendo2.dot" tree
    printTree "reverso.dot" tree'
    printTree "revacco.dot" tree''
-}
    {-let (_, t, _) = drive $ sorto $ fresh ["q", "r"] $ call "sorto" [V "q", V "r"]
    printTree "sorto.dot" (simpl t)
-}

    --runTest "evalo" $ evalo $ fresh ["q", "p"] (call "evalo" [V "q", V "p"])

    --test_palindromo
    --test_doubleo

    --test_palindromo
    test_doubleAppendo
    test_eveno
    test_doubleo
    test_empty_appendo
    test_singletonReverso

    {-let (_, t, _) = drive $ smallesto $ fresh ["q", "r", "s"] $ call "smallesto" [V "q", V "r", V "s"]
    putStrLn "\n\n\n"
    putStrLn (intercalate "\n\n" $ map (\x -> intercalate "\n" $ map show x) (accumCalls t))
    printTree "smallesto.dot" (simpl t) -- (upTo 10 t)
-}
    {-
    let (_, t, _) = drive $ sorto $ fresh ["q"] $ call "sorto" [(peanify 0 % (peanify 1 % (peanify 1 % (peanify 0 % nil)))), V "q"]
    printTree "sort.dot" t

    printTree "ehm.dot" tree
-}
    {-let (_, t', _) = drive (reverso $ fresh ["q", "r"] (call "reverso" [V "q", V "r"]))
    let t'' = simpl t'
    printTree "reverso.dot" t'
    printTree "reversoSimple.dot" t''-}
{-
    let ra@(_, t', _) = drive (revAcco $ fresh ["q", "s"] (call "revacco" [V "q", nil, V "s"]))
    let t'' = simpl t'
    printTree "revaccoSimpl.dot" t''
    printTree "revacco.dot" t'
-}


text:
<?php

namespace Symfony\Components\DependencyInjection\Loader;

/*
 * This file is part of the symfony framework.
 *
 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

/**
 * Loader is the abstract class used by all built-in loaders.
 *
 * @package    symfony
 * @subpackage dependency_injection
 * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
 */
abstract class Loader implements LoaderInterface
{
  static protected $extensions = array();

  /**
   * Registers an extension.
   *
   * @param LoaderExtensionInterface $extension An extension instance
   */
  static public function registerExtension(LoaderExtensionInterface $extension)
  {
    static::$extensions[$extension->getAlias()] = static::$extensions[$extension->getNamespace()] = $extension;
  }

  /**
   * Returns an extension by alias or namespace.
   *
   * @param string $name An alias or a namespace
   *
   * @return LoaderExtensionInterface An extension instance
   */
  static public function getExtension($name)
  {
    return isset(static::$extensions[$name]) ? static::$extensions[$name] : null;
  }
}


text:
package org.achartengine.chartdemo.demo.chart;

import org.achartengine.ChartFactory;
import org.achartengine.chart.BarChart.Type;
import org.achartengine.model.RangeCategorySeries;
import org.achartengine.model.XYMultipleSeriesDataset;
import org.achartengine.renderer.SimpleSeriesRenderer;
import org.achartengine.renderer.XYMultipleSeriesRenderer;

import android.content.Context;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.Paint.Align;

/**
 * Temperature demo range chart.
 */
public class TemperatureChart extends AbstractDemoChart {

  /**
   * Returns the chart name.
   *
   * @return the chart name
   */
  public String getName() {
    return "Temperature range chart";
  }

  /**
   * Returns the chart description.
   *
   * @return the chart description
   */
  public String getDesc() {
    return "The monthly temperature (vertical range chart)";
  }

  /**
   * Executes the chart demo.
   *
   * @param context the context
   * @return the built intent
   */
  public Intent execute(Context context) {
    double[] minValues = new double[] { -24, -19, -10, -1, 7, 12, 15, 14, 9, 1, -11, -16 };
    double[] maxValues = new double[] { 7, 12, 24, 28, 33, 35, 37, 36, 28, 19, 11, 4 };

    XYMultipleSeriesDataset dataset = new XYMultipleSeriesDataset();
    RangeCategorySeries series = new RangeCategorySeries("Temperature");
    int length = minValues.length;
    for (int k = 0; k < length; k++) {
      series.add(minValues[k], maxValues[k]);
    }
    dataset.addSeries(series.toXYSeries());
    int[] colors = new int[] { Color.CYAN };
    XYMultipleSeriesRenderer renderer = buildBarRenderer(colors);
    setChartSettings(renderer, "Monthly temperature range", "Month", "Celsius degrees", 0.5, 12.5,
        -30, 45, Color.GRAY, Color.LTGRAY);
    renderer.setBarSpacing(0.5);
    renderer.setXLabels(0);
    renderer.setYLabels(10);
    renderer.addXTextLabel(1, "Jan");
    renderer.addXTextLabel(3, "Mar");
    renderer.addXTextLabel(5, "May");
    renderer.addXTextLabel(7, "Jul");
    renderer.addXTextLabel(10, "Oct");
    renderer.addXTextLabel(12, "Dec");
    renderer.addYTextLabel(-25, "Very cold");
    renderer.addYTextLabel(-10, "Cold");
    renderer.addYTextLabel(5, "OK");
    renderer.addYTextLabel(20, "Nice");
    renderer.setMargins(new int[] {30, 70, 10, 0});
    renderer.setYLabelsAlign(Align.RIGHT);
    SimpleSeriesRenderer r = renderer.getSeriesRendererAt(0);
    r.setDisplayChartValues(true);
    r.setChartValuesTextSize(12);
    r.setChartValuesSpacing(3);
    r.setGradientEnabled(true);
    r.setGradientStart(-20, Color.BLUE);
    r.setGradientStop(20, Color.GREEN);
    return ChartFactory.getRangeBarChartIntent(context, dataset, renderer, Type.DEFAULT,
        "Temperature range");
  }

}


text:
package middlewares

import (
	"fmt"
	"io"
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"testing"

	"github.com/hyperscale/hyperpic/pkg/hyperpic/image"
	"github.com/justinas/alice"
	"github.com/stretchr/testify/assert"
)

func TestContentTypeHandlerWithoutOptionsParserInContext(t *testing.T) {
	handler := func(w http.ResponseWriter, r *http.Request) {
	}

	middleware := alice.New(
		NewContentTypeHandler(),
	)

	req := httptest.NewRequest(http.MethodGet, "http://example.com/foo.jpg?w=420&q=85&dpr=1&fm=jpg", nil)

	w := httptest.NewRecorder()

	middleware.ThenFunc(handler).ServeHTTP(w, req)

	resp := w.Result()

	assert.Equal(t, http.StatusInternalServerError, resp.StatusCode)
}

func TestContentTypeHandler(t *testing.T) {
	tests := []struct {
		url                 string
		accept              string
		expectedBody        string
		expectedCode        int
		expectedContentType string
	}{
		{
			url:                 "http://example.com/foo.jpg?w=420&q=85&dpr=1&fm=jpg",
			accept:              "image/webp",
			expectedBody:        "Format: 1",
			expectedCode:        http.StatusOK,
			expectedContentType: "image/jpeg",
		},
		{
			url:                 "http://example.com/foo.jpg?w=420&q=85&dpr=1",
			accept:              "image/webp",
			expectedBody:        "Format: 2",
			expectedCode:        http.StatusOK,
			expectedContentType: "image/webp",
		},
		{
			url:                 "http://example.com/foo.jpg?w=420&q=85&dpr=1",
			accept:              "image/png",
			expectedBody:        "Format: 3",
			expectedCode:        http.StatusOK,
			expectedContentType: "image/png",
		},
		{
			url:                 "http://example.com/foo.jpg?w=420&q=85&dpr=1",
			accept:              "*/*",
			expectedBody:        "Format: 1",
			expectedCode:        http.StatusOK,
			expectedContentType: "image/jpeg",
		},
		{
			url:                 "http://example.com/foo.jpg?w=420&q=85&dpr=1",
			accept:              "image/flif",
			expectedBody:        "Format: 1",
			expectedCode:        http.StatusOK,
			expectedContentType: "image/jpeg",
		},
	}

	handler := func(w http.ResponseWriter, r *http.Request) {
		options, err := OptionsFromContext(r.Context())
		assert.NoError(t, err)

		io.WriteString(w, fmt.Sprintf("Format: %v", options.Format))
	}

	middleware := alice.New(
		NewOptionsHandler(image.NewOptionParser()),
		NewContentTypeHandler(),
	)

	for i, tc := range tests {
		req := httptest.NewRequest("GET", tc.url, nil)
		req.Header.Set("Accept", tc.accept)

		w := httptest.NewRecorder()

		middleware.ThenFunc(handler).ServeHTTP(w, req)

		resp := w.Result()
		body, err := ioutil.ReadAll(resp.Body)
		assert.NoError(t, err)

		assert.Equal(t, tc.expectedBody, string(body))
		assert.Equal(t, tc.expectedCode, resp.StatusCode)
		assert.Equalf(t, tc.expectedContentType, resp.Header.Get("Content-Type"), "Not equal at %d", i)
	}
}


text:
namespace gfx {
class Point;
}

namespace views {
class MenuRunner;
}

class StatusIconWin : public StatusIcon {
 public:
  // Constructor which provides this icon's unique ID and messaging window.
  StatusIconWin(UINT id, HWND window, UINT message);
  virtual ~StatusIconWin();

  // Handles a click event from the user - if |left_button_click| is true and
  // there is a registered observer, passes the click event to the observer,
  // otherwise displays the context menu if there is one.
  void HandleClickEvent(const gfx::Point& cursor_pos, bool left_button_click);

  // Re-creates the status tray icon now after the taskbar has been created.
  void ResetIcon();

  UINT icon_id() const { return icon_id_; }
  UINT message_id() const { return message_id_; }

  // Overridden from StatusIcon:
  virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE;
  virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE;
  virtual void SetToolTip(const string16& tool_tip) OVERRIDE;
  virtual void DisplayBalloon(const gfx::ImageSkia& icon,
                              const string16& title,
                              const string16& contents) OVERRIDE;

 protected:
  // Overridden from StatusIcon:
  virtual void UpdatePlatformContextMenu(ui::MenuModel* menu) OVERRIDE;

 private:
  void InitIconData(NOTIFYICONDATA* icon_data);

  // The unique ID corresponding to this icon.
  UINT icon_id_;

  // Window used for processing messages from this icon.
  HWND window_;

  // The message identifier used for status icon messages.
  UINT message_id_;

  // The currently-displayed icon for the window.
  base::win::ScopedHICON icon_;

  // The currently-displayed icon for the notification balloon.
  base::win::ScopedHICON balloon_icon_;

  // Not owned.
  ui::MenuModel* menu_model_;

  // Context menu associated with this icon (if any).
  scoped_ptr<views::MenuRunner> menu_runner_;

  DISALLOW_COPY_AND_ASSIGN(StatusIconWin);
};

// Implements status notifications using Windows 8 metro style notifications.
class StatusIconMetro : public StatusIcon {
 public:
  // Constructor which provides this icon's unique ID and messaging window.
  explicit StatusIconMetro(UINT id);
  virtual ~StatusIconMetro();

  // Overridden from StatusIcon:
  virtual void SetImage(const gfx::ImageSkia& image) OVERRIDE;
  virtual void SetPressedImage(const gfx::ImageSkia& image) OVERRIDE;
  virtual void SetToolTip(const string16& tool_tip) OVERRIDE;
  virtual void DisplayBalloon(const gfx::ImageSkia& icon,
                              const string16& title,
                              const string16& contents) OVERRIDE;
 protected:
  virtual void UpdatePlatformContextMenu(ui::MenuModel* menu) OVERRIDE;

 private:
  string16 tool_tip_;
  const UINT id_;

  DISALLOW_COPY_AND_ASSIGN(StatusIconMetro);
};

#endif  // CHROME_BROWSER_UI_VIEWS_STATUS_ICONS_STATUS_ICON_WIN_H_


text:
package com.uber.sdk.rides.samples.servlet;

import com.google.api.client.util.store.MemoryDataStoreFactory;
import com.uber.sdk.core.auth.OAuth2Credentials;
import com.uber.sdk.core.auth.Scope;
import com.uber.sdk.core.client.SessionConfiguration;

import org.eclipse.jetty.servlet.ServletContextHandler;

import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.Properties;

/**
 * Sample server. Before starting, make sure to add the {@code REDIRECT_URI} to your application
 * on developer.uber.com and fill in {@code resources/secrets.properties} with your client
 * ID and secret.
 */
public class Server {

    public static final String USER_SESSION_ID = "userSessionId";

    // Set your server's port and callback URL.
    private static final int PORT = 8181;
    private static final String CALLBACK_URL = "/Callback";

    // IMPORTANT: Before starting the server, make sure to add this redirect URI to your
    // application at developers.uber.com.
    private static final String REDIRECT_URI = "http://localhost:" + PORT + CALLBACK_URL;

    public static void main(String[] args) throws Exception {
        org.eclipse.jetty.server.Server server = new org.eclipse.jetty.server.Server(PORT);

        ServletContextHandler handler = new ServletContextHandler(ServletContextHandler.SESSIONS);
        handler.setContextPath("/");
        server.setHandler(handler);

        handler.addServlet(SampleServlet.class, "/");
        handler.addServlet(OAuth2CallbackServlet.class, CALLBACK_URL);

        server.start();
        System.out.println("Server is running on: http://localhost:" + PORT );
        server.join();
    }

    /**
     * Creates an {@link OAuth2Credentials} object that can be used by any of the servlets.
     *
     * Throws an {@throws IOException} when no client ID or secret found in secrets.properties
     */
     static OAuth2Credentials createOAuth2Credentials(SessionConfiguration config) throws IOException {

        return new OAuth2Credentials.Builder()
                .setCredentialDataStoreFactory(MemoryDataStoreFactory.getDefaultInstance())
                .setRedirectUri(config.getRedirectUri())
                .setScopes(config.getScopes())
                .setClientSecrets(config.getClientId(), config.getClientSecret())
                .build();
    }

    static SessionConfiguration createSessionConfiguration() throws IOException {
        // Load the client ID and secret from a secrets properties file.
        Properties secrets = loadSecretProperties();

        String clientId = secrets.getProperty("clientId");
        String clientSecret = secrets.getProperty("clientSecret");

        if (clientId.equals("INSERT_CLIENT_ID_HERE") || clientSecret.equals("INSERT_CLIENT_SECRET_HERE")) {
            throw new IllegalArgumentException(
                    "Please enter your client ID and secret in the resoures/secrets.properties file.");
        }
        return new SessionConfiguration.Builder()
                .setClientId(clientId)
                .setClientSecret(clientSecret)
                .setRedirectUri(REDIRECT_URI)
                .setScopes(Collections.singletonList(Scope.PROFILE))
                .build();
    }

    /**
     * Loads the application's secrets.
     */
    private static Properties loadSecretProperties() throws IOException {
        Properties properties = new Properties();
        InputStream propertiesStream = Server.class.getClassLoader().getResourceAsStream("secrets.properties");
        if (propertiesStream == null) {
            // Fallback to file access in the case of running from certain IDEs.
            File buildPropertiesFile = new File("src/main/resources/secrets.properties");
            if (buildPropertiesFile.exists()) {
                properties.load(new FileReader(buildPropertiesFile));
            } else {
                buildPropertiesFile = new File("samples/servlet-sample/src/main/resources/secrets.properties");
                if (buildPropertiesFile.exists()) {
                    properties.load(new FileReader(buildPropertiesFile));
                } else {
                    throw new IllegalStateException("Could not find secrets.properties");
                }
            }
        } else {
            properties.load(propertiesStream);
        }
        return properties;
    }
}


text:
This example implements the simple recursive model by Richard Socher.
It requires the preprocessed dataset which is available by running `download.py`.


text:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Web;
using SiteGroupCms.Utils;
using SiteGroupCms.DBUtility;

namespace SiteGroupCms.Dal
{
  public  class FavoriteDal:Common
    {
      public FavoriteDal()
        {
            base.SetupSystemDate();
        }
      /// <summary>
      /// 是否存在记录
      /// </summary>
      /// <param name="_wherestr">条件</param>
      /// <returns></returns>
      public bool Exists(string _wherestr)
      {
          using (DbOperHandler _doh = new Common().Doh())
          {
              int _ext = 0;
              _doh.Reset();
              _doh.ConditionExpress = _wherestr;
              if (_doh.Exist("yy_favoriteinfo"))
                  _ext = 1;
              return (_ext == 1);
          }
      }

      /// <summary>
      /// 彻底删除一条数据
      /// </summary>
      public bool updateishow(string _id,int type)
      {
          using (DbOperHandler _doh = new Common().Doh())
          {
              _doh.Reset();
              _doh.ConditionExpress = "id=@id";
              _doh.AddConditionParameter("@id", _id);
              _doh.AddFieldItem("isshow", type);
              int _update = _doh.Update("yy_favoriteinfo");
              return (_update >= 1);
          }
      }

      /// <summary>
      /// 获得单页内容的单条记录实体
      /// </summary>
      /// <param name="_id"></param>
      public SiteGroupCms.Entity.Favorite GetEntity(string _id)
      {
          SiteGroupCms.Entity.Favorite fav = new SiteGroupCms.Entity.Favorite();

          using (DbOperHandler _doh = new Common().Doh())
          {
              _doh.Reset();
              _doh.SqlCmd = "SELECT * FROM [yy_favoriteinfo] WHERE [Id]=" + _id;
              DataTable dt = _doh.GetDataTable();
              if (dt.Rows.Count > 0)
              {
                  fav.ID =Convert.ToInt32(_id);
                  fav.Title = dt.Rows[0]["title"].ToString();
                  fav.Content = dt.Rows[0]["content"].ToString();
                  fav.Icon = dt.Rows[0]["icon"].ToString();
                  fav.Isshow = dt.Rows[0]["isshow"].ToString() == "0" ? 0 : 1;
                  fav.Rightid =Convert.ToInt32(dt.Rows[0]["rightid"].ToString());
                  fav.Url = dt.Rows[0]["url"].ToString();
              }
              return fav;
          }
      }

      /// <summary>
      /// 获得单页内容的单条记录实体
      /// </summary>
      /// <param name="_id"></param>
      public DataTable GetDT(string where)
      {
          using (DbOperHandler _doh = new Common().Doh())
          {
              _doh.Reset();
              _doh.SqlCmd = "SELECT * FROM [yy_favoriteinfo] WHERE " + where;
              DataTable dt = _doh.GetDataTable();
              if (dt.Rows.Count > 0)
                  return dt;
              else
                  return null;
          }
      }

      public bool addfavorite(SiteGroupCms.Entity.Favorite obj)
      {
          using (DbOperHandler _doh = new Common().Doh())
          {
              SiteGroupCms.Entity.Admin _admin=(SiteGroupCms.Entity.Admin)HttpContext.Current.Session["admin"];
              _doh.Reset();
              _doh.AddFieldItem("title", obj.Title);
              _doh.AddFieldItem("content", obj.Content);
              _doh.AddFieldItem("url", obj.Content);
              _doh.AddFieldItem("content", obj.Content);
              _doh.AddFieldItem("description", obj.Content);
              int _insert = _doh.Insert("yy_roleinfo");
              return _insert>=1;
          }
      }

    }
}


text:
<!DOCTYPE html>

    <meta charset="utf-8" >
    <title>Scocket Counter</title>

    <form id="auth" action="" method="post">
      <input id="input_user" type="text" name="name" value="username"></input>
      <input id="input_pass" type="text" name="name" value="pass"></input>
    </form>
    <button type="button" name="button" onclick="requestAuth();">認証</button>
    <button type="button" name="button" onclick="reset();">リセット</button>

いいね


text:
'use strict';
var path = require('path');
var SweetJSPreprocessor = require('./lib/sweetjs-preprocessor');

function SweetJSAddon(project) {
  this._project = project;
  this.name     = 'Ember CLI SweetJS Addon';
}

/*SweetJSAddon.prototype.blueprintsPath = function() {
  return path.join(__dirname, 'blueprints');
};*/

SweetJSAddon.prototype.included = function(app) {
  this.app = app;

  var plugin = new SweetJSPreprocessor(this.app.options.sweetJSOptions);

  this.app.registry.add('js', plugin);
};

// This is just here because it was required in ember-cli v0.0.37.
// To be removed when compatibility breaks.
SweetJSAddon.prototype.treeFor = function() {};

module.exports = SweetJSAddon;


text:
<!DOCTYPE html>

	<meta charset="UTF-8" />

	<title>Lucky</title>

	<link rel="stylesheet" type="text/css" href="./lib/bootstrap-3.3.2-dist/css/bootstrap.min.css">
	<link rel="stylesheet" type="text/css" href="./lib/font-awesome-4.3.0/css/font-awesome.min.css">

	<link rel="stylesheet" type="text/css" href="./css/luckyone.css" />

Home:

抽奖任务

					任务名
					操作

						<input type="text" id="new-result-name" class="form-control">

						<button id="btn-create" class="btn btn-success">
							 新增任务
						</button>

						<button class="btn btn-primary btn-draw">
							 进入抽奖
						</button>


text:
package com.faceunity.view;

import android.content.Context;
import androidx.annotation.IdRes;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.LinearLayout;

/**
 * Created by tujh on 2018/4/17.
 */
public class CheckGroup extends LinearLayout {
    private static final String LOG_TAG = CheckGroup.class.getSimpleName();

    // holds the checked id; the selection is empty by default
    private int mCheckedId = View.NO_ID;
    // tracks children radio buttons checked state
    private CompoundButton.OnCheckedChangeListener mChildOnCheckedChangeListener;
    // when true, mOnCheckedChangeListener discards events
    private boolean mProtectFromCheckedChange = false;
    private CheckGroup.OnCheckedChangeListener mOnCheckedChangeListener;
    private PassThroughHierarchyChangeListener mPassThroughListener;

    /**
     * {@inheritDoc}
     */
    public CheckGroup(Context context) {
        super(context);
        setOrientation(VERTICAL);
        init();
    }

    /**
     * {@inheritDoc}
     */
    public CheckGroup(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    private void init() {
        mChildOnCheckedChangeListener = new CheckedStateTracker();
        mPassThroughListener = new PassThroughHierarchyChangeListener();
        super.setOnHierarchyChangeListener(mPassThroughListener);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void setOnHierarchyChangeListener(OnHierarchyChangeListener listener) {
        // the user listener is delegated to our pass-through listener
        mPassThroughListener.mOnHierarchyChangeListener = listener;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();

        // checks the appropriate radio button as requested in the XML file
        if (mCheckedId != View.NO_ID) {
            mProtectFromCheckedChange = true;
            setCheckedStateForView(mCheckedId, true);
            mProtectFromCheckedChange = false;
            setCheckedId(mCheckedId);
        }
    }

    @Override
    public void addView(View child, int index, ViewGroup.LayoutParams params) {
        if (child instanceof CheckBox) {
            final CheckBox button = (CheckBox) child;
            if (button.isChecked()) {
                mProtectFromCheckedChange = true;
                if (mCheckedId != View.NO_ID) {
                    setCheckedStateForView(mCheckedId, false);
                }
                mProtectFromCheckedChange = false;
                setCheckedId(button.getId());
            }
        }

        super.addView(child, index, params);
    }

    /**
     *
Sets the selection to the radio button whose identifier is passed in
     * parameter. Using View.NO_ID as the selection identifier clears the selection;
     * such an operation is equivalent to invoking {@link #clearCheck()}.

     *
     * @param id the unique id of the radio button to select in this group
     * @see #getCheckedCheckBoxId()
     * @see #clearCheck()
     */
    public void check(@IdRes int id) {
        // don't even bother
        if (id != View.NO_ID && (id == mCheckedId)) {
            return;
        }

        if (mCheckedId != View.NO_ID) {
            setCheckedStateForView(mCheckedId, false);
        }

        if (id != View.NO_ID) {
            setCheckedStateForView(id, true);
        }

        setCheckedId(id);
    }

    private void setCheckedId(@IdRes int id) {
        mCheckedId = id;
        if (mOnCheckedChangeListener != null) {
            mOnCheckedChangeListener.onCheckedChanged(this, mCheckedId);
        }
    }

    private void setCheckedStateForView(int viewId, boolean checked) {
        View checkedView = findViewById(viewId);
        if (checkedView != null && checkedView instanceof CheckBox) {
            ((CheckBox) checkedView).setChecked(checked);
        }
    }

    /**
     *
Returns the identifier of the selected radio button in this group.
     * Upon empty selection, the returned value is View.NO_ID.

     *
     * @return the unique id of the selected radio button in this group
     * @attr ref android.R.styleable#CheckGroup_checkedButton
     * @see #check(int)
     * @see #clearCheck()
     */
    @IdRes
    public int getCheckedCheckBoxId() {
        return mCheckedId;
    }

    /**
     *
Clears the selection. When the selection is cleared, no radio button
     * in this group is selected and {@link #getCheckedCheckBoxId()} returns
     * null.

     *
     * @see #check(int)
     * @see #getCheckedCheckBoxId()
     */
    public void clearCheck() {
        check(View.NO_ID);
    }

    /**
     *
Register a callback to be invoked when the checked radio button
     * changes in this group.

     *
     * @param listener the callback to call on checked state change
     */
    public void setOnCheckedChangeListener(CheckGroup.OnCheckedChangeListener listener) {
        mOnCheckedChangeListener = listener;
    }

    @Override
    public CharSequence getAccessibilityClassName() {
        return CheckGroup.class.getName();
    }

    /**
     *
Interface definition for a callback to be invoked when the checked
     * radio button changed in this group.

     */
    public interface OnCheckedChangeListener {
        /**
         *
Called when the checked radio button has changed. When the
         * selection is cleared, checkedId is View.NO_ID.

         *
         * @param group     the group in which the checked radio button has changed
         * @param checkedId the unique identifier of the newly checked radio button
         */
        public void onCheckedChanged(CheckGroup group, @IdRes int checkedId);
    }

    private class CheckedStateTracker implements CompoundButton.OnCheckedChangeListener {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            // prevents from infinite recursion
            if (mProtectFromCheckedChange) {
                return;
            }

            int id = buttonView.getId();
            mProtectFromCheckedChange = true;
            if (mCheckedId != View.NO_ID && mCheckedId != id) {
                setCheckedStateForView(mCheckedId, false);
            }
            mProtectFromCheckedChange = false;

            setCheckedId(isChecked ? id : View.NO_ID);
        }
    }

    /**
     *
A pass-through listener acts upon the events and dispatches them
     * to another listener. This allows the table layout to set its own internal
     * hierarchy change listener without preventing the user to setup his.

     */
    private class PassThroughHierarchyChangeListener implements
            OnHierarchyChangeListener {
        private OnHierarchyChangeListener mOnHierarchyChangeListener;

        /**
         * {@inheritDoc}
         */
        @Override
        public void onChildViewAdded(View parent, View child) {
            if (parent == CheckGroup.this && child instanceof CheckBox) {
                int id = child.getId();
                // generates an id if it's missing
                if (id == View.NO_ID) {
                    id = View.generateViewId();
                    child.setId(id);
                }
                ((CheckBox) child).setOnCheckedChangeListener(
                        mChildOnCheckedChangeListener);
            }

            if (mOnHierarchyChangeListener != null) {
                mOnHierarchyChangeListener.onChildViewAdded(parent, child);
            }
        }

        /**
         * {@inheritDoc}
         */
        @Override
        public void onChildViewRemoved(View parent, View child) {
            if (parent == CheckGroup.this && child instanceof CheckBox) {
                ((CheckBox) child).setOnCheckedChangeListener(null);
            }

            if (mOnHierarchyChangeListener != null) {
                mOnHierarchyChangeListener.onChildViewRemoved(parent, child);
            }
        }
    }
}


text:
tags: politics
layout: post
title: "'Perpetually expanding horizons?' Sure..."
---

An Optimist's Legacy - I haven't written much about politics partly because I've been swamped with work. But also because there's just too much to write/think about. It's exhausting.

I wasn't going to say anything about Reagan but then I saw this column by George Will describing his legacy:

The feeling of foreboding -- the sense of shrunken possibilities -- that afflicted Americans 20 years ago has been banished by a new birth of the American belief in perpetually expanding horizons.

Spoken like someone who doesn't know a soul who's living from paycheck to paycheck, or worried to the bone that they'll get hurt or sick while they're skating along without health insurance for "just a few months". That's not to say that horizons aren't expanding -- the horizons of the corporations (and the men who run them) sucking the life out of humanity are growing day by day.