text:
package org.apache.beam.sdk.io.gcp.spanner;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import com.google.cloud.ByteArray;
import com.google.cloud.Date;
import com.google.cloud.Timestamp;
import com.google.cloud.spanner.Mutation;
import java.math.BigDecimal;
import java.util.Arrays;
import org.apache.beam.vendor.guava.v26_0_jre.com.google.common.collect.ImmutableList;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/** A set of unit tests for {@link MutationSizeEstimator}. */
@RunWith(JUnit4.class)
public class MutationSizeEstimatorTest {

  @Test
  public void primitives() throws Exception {
    Mutation int64 = Mutation.newInsertOrUpdateBuilder("test").set("one").to(1).build();
    Mutation float64 = Mutation.newInsertOrUpdateBuilder("test").set("one").to(2.9).build();
    Mutation bool = Mutation.newInsertOrUpdateBuilder("test").set("one").to(false).build();
    Mutation numeric =
        Mutation.newInsertOrUpdateBuilder("test")
            .set("one")
            .to(new BigDecimal("12345678901234567890.123456789"))
            .build();

    assertThat(MutationSizeEstimator.sizeOf(int64), is(8L));
    assertThat(MutationSizeEstimator.sizeOf(float64), is(8L));
    assertThat(MutationSizeEstimator.sizeOf(bool), is(1L));
    assertThat(MutationSizeEstimator.sizeOf(numeric), is(30L));
  }

  @Test
  public void primitiveArrays() throws Exception {
    Mutation int64 =
        Mutation.newInsertOrUpdateBuilder("test")
            .set("one")
            .toInt64Array(new long[] {1L, 2L, 3L})
            .build();
    Mutation float64 =
        Mutation.newInsertOrUpdateBuilder("test")
            .set("one")
            .toFloat64Array(new double[] {1., 2.})
            .build();
    Mutation bool =
        Mutation.newInsertOrUpdateBuilder("test")
            .set("one")
            .toBoolArray(new boolean[] {true, true, false, true})
            .build();
    Mutation numeric =
        Mutation.newInsertOrUpdateBuilder("test")
            .set("one")
            .toNumericArray(
                ImmutableList.of(
                    new BigDecimal("12345678901234567890.123456789"),
                    new BigDecimal("12345678901234567890123.1234567890123"),
                    new BigDecimal("123456789012345678901234.1234567890123456"),
                    new BigDecimal("1234567890123456789012345.1234567890123456789")))
            .build();

    assertThat(MutationSizeEstimator.sizeOf(int64), is(24L));
    assertThat(MutationSizeEstimator.sizeOf(float64), is(16L));
    assertThat(MutationSizeEstimator.sizeOf(bool), is(4L));
    assertThat(MutationSizeEstimator.sizeOf(numeric), is(153L));
  }

  @Test
  public void nullPrimitiveArrays() throws Exception {
    Mutation int64 =
        Mutation.newInsertOrUpdateBuilder("test").set("one").toInt64Array((long[]) null).build();
    Mutation float64 =
        Mutation.newInsertOrUpdateBuilder("test")
            .set("one")
            .toFloat64Array((double[]) null)
            .build();
    Mutation bool =
        Mutation.newInsertOrUpdateBuilder("test").set("one").toBoolArray((boolean[]) null).build();
    Mutation numeric =
        Mutation.newInsertOrUpdateBuilder("test")
            .set("one")
            .toNumericArray((Iterable<BigDecimal>) null)
            .build();

    assertThat(MutationSizeEstimator.sizeOf(int64), is(0L));
    assertThat(MutationSizeEstimator.sizeOf(float64), is(0L));
    assertThat(MutationSizeEstimator.sizeOf(bool), is(0L));
    assertThat(MutationSizeEstimator.sizeOf(numeric), is(0L));
  }

  @Test
  public void strings() throws Exception {
    Mutation emptyString = Mutation.newInsertOrUpdateBuilder("test").set("one").to("").build();
    Mutation nullString =
        Mutation.newInsertOrUpdateBuilder("test").set("one").to((String) null).build();
    Mutation sampleString = Mutation.newInsertOrUpdateBuilder("test").set("one").to("abc").build();
    Mutation sampleArray =
        Mutation.newInsertOrUpdateBuilder("test")
            .set("one")
            .toStringArray(Arrays.asList("one", "two", null))
            .build();
    Mutation nullArray =
        Mutation.newInsertOrUpdateBuilder("test").set("one").toStringArray(null).build();

    assertThat(MutationSizeEstimator.sizeOf(emptyString), is(0L));
    assertThat(MutationSizeEstimator.sizeOf(nullString), is(0L));
    assertThat(MutationSizeEstimator.sizeOf(sampleString), is(3L));
    assertThat(MutationSizeEstimator.sizeOf(sampleArray), is(6L));
    assertThat(MutationSizeEstimator.sizeOf(nullArray), is(0L));
  }

  @Test
  public void bytes() throws Exception {
    Mutation empty =
        Mutation.newInsertOrUpdateBuilder("test").set("one").to(ByteArray.fromBase64("")).build();
    Mutation nullValue =
        Mutation.newInsertOrUpdateBuilder("test").set("one").to((ByteArray) null).build();
    Mutation sample =
        Mutation.newInsertOrUpdateBuilder("test")
            .set("one")
            .to(ByteArray.fromBase64("abcdabcd"))
            .build();
    Mutation nullArray =
        Mutation.newInsertOrUpdateBuilder("test").set("one").toBytesArray(null).build();

    assertThat(MutationSizeEstimator.sizeOf(empty), is(0L));
    assertThat(MutationSizeEstimator.sizeOf(nullValue), is(0L));
    assertThat(MutationSizeEstimator.sizeOf(sample), is(6L));
    assertThat(MutationSizeEstimator.sizeOf(nullArray), is(0L));
  }

  @Test
  public void dates() throws Exception {
    Mutation timestamp =
        Mutation.newInsertOrUpdateBuilder("test").set("one").to(Timestamp.now()).build();
    Mutation nullTimestamp =
        Mutation.newInsertOrUpdateBuilder("test").set("one").to((Timestamp) null).build();
    Mutation date =
        Mutation.newInsertOrUpdateBuilder("test")
            .set("one")
            .to(Date.fromYearMonthDay(2017, 10, 10))
            .build();
    Mutation nullDate =
        Mutation.newInsertOrUpdateBuilder("test").set("one").to((Date) null).build();
    Mutation timestampArray =
        Mutation.newInsertOrUpdateBuilder("test")
            .set("one")
            .toTimestampArray(Arrays.asList(Timestamp.now(), null))
            .build();
    Mutation dateArray =
        Mutation.newInsertOrUpdateBuilder("test")
            .set("one")
            .toDateArray(
                Arrays.asList(
                    null,
                    Date.fromYearMonthDay(2017, 1, 1),
                    null,
                    Date.fromYearMonthDay(2017, 1, 2)))
            .build();

    Mutation nullTimestampArray =
        Mutation.newInsertOrUpdateBuilder("test").set("one").toTimestampArray(null).build();
    Mutation nullDateArray =
        Mutation.newInsertOrUpdateBuilder("test").set("one").toDateArray(null).build();

    assertThat(MutationSizeEstimator.sizeOf(timestamp), is(12L));
    assertThat(MutationSizeEstimator.sizeOf(date), is(12L));
    assertThat(MutationSizeEstimator.sizeOf(nullTimestamp), is(12L));
    assertThat(MutationSizeEstimator.sizeOf(nullDate), is(12L));
    assertThat(MutationSizeEstimator.sizeOf(timestampArray), is(24L));
    assertThat(MutationSizeEstimator.sizeOf(dateArray), is(48L));
    assertThat(MutationSizeEstimator.sizeOf(nullTimestampArray), is(0L));
    assertThat(MutationSizeEstimator.sizeOf(nullDateArray), is(0L));
  }

  @Test
  public void group() throws Exception {
    Mutation int64 = Mutation.newInsertOrUpdateBuilder("test").set("one").to(1).build();
    Mutation float64 = Mutation.newInsertOrUpdateBuilder("test").set("one").to(2.9).build();
    Mutation bool = Mutation.newInsertOrUpdateBuilder("test").set("one").to(false).build();

    MutationGroup group = MutationGroup.create(int64, float64, bool);

    assertThat(MutationSizeEstimator.sizeOf(group), is(17L));
  }
}


text:
package vsb.fou.kladd.equals;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.junit.Test;

import java.util.Arrays;

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

public class BrukAvEqualsBuilderTest {

    @Test
    public void testIt() {
        VsbDataEqualsB b = new VsbDataEqualsB("Billingstadlia");
        VsbDataEqualsA a = new VsbDataEqualsA("Vegard", b);

        VsbDataEqualsB b2 = new VsbDataEqualsB("Billingstadlia");
        VsbDataEqualsA a2 = new VsbDataEqualsA("Vegard", b2);

        assertFalse(a.equals(a2));
        assertFalse(EqualsBuilder.reflectionEquals(a, a2));
        assertTrue(EqualsBuilder.reflectionEquals(a, a2, Arrays.asList("b")));

    }
}

redpajama_set_name: RedPajamaGithub


text:
package org.apache.hyracks.storage.am.lsm.invertedindex;

import org.apache.hyracks.storage.am.lsm.invertedindex.common.AbstractInvertedIndexLoadTest;
import org.apache.hyracks.storage.am.lsm.invertedindex.util.LSMInvertedIndexTestContext.InvertedIndexType;

public class LSMInvertedIndexInsertTest extends AbstractInvertedIndexLoadTest {

    public LSMInvertedIndexInsertTest() {
        super(InvertedIndexType.LSM, false);
    }
}


text:
require "bio-ucsc"
require "pp"

describe "Bio::Ucsc::CavPor3" do

  before(:all) do
    Bio::Ucsc::CavPor3::DBConnection.connect
  end

  describe "Bio::Ucsc::CavPor3::All_est" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::All_est.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::All_mrna" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::All_mrna.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Author" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Author.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::BlastHg18KG" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::BlastHg18KG.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Cds" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Cds.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Cell" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Cell.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChainGalGal3" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChainGalGal3.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChainGalGal3Link" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChainGalGal3Link.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChainHg19" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChainHg19.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChainHg19Link" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChainHg19Link.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChainMm9" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChainMm9.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChainMm9Link" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChainMm9Link.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChainMonDom4" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChainMonDom4.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChainMonDom4Link" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChainMonDom4Link.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChainOryCun2" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChainOryCun2.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChainOryCun2Link" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChainOryCun2Link.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChainRn4" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChainRn4.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChainRn4Link" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChainRn4Link.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ChromInfo" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ChromInfo.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::CpgIslandExt" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::CpgIslandExt.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Description" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Description.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Development" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Development.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::EnsGene" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::EnsGene.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::EnsGtp" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::EnsGtp.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::EnsPep" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::EnsPep.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::EstOrientInfo" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::EstOrientInfo.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Gap" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Gap.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::GbCdnaInfo" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::GbCdnaInfo.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::GbExtFile" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::GbExtFile.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::GbLoaded" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::GbLoaded.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::GbMiscDiff" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::GbMiscDiff.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::GbSeq" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::GbSeq.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::GbStatus" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::GbStatus.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::GbWarn" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::GbWarn.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Gc5Base" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Gc5Base.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::GeneName" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::GeneName.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Genscan" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Genscan.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::GenscanPep" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::GenscanPep.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::GenscanSubopt" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::GenscanSubopt.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Gold" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Gold.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Grp" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Grp.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::HgFindSpec" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::HgFindSpec.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::History" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::History.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ImageClone" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ImageClone.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::IntronEst" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::IntronEst.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Keyword" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Keyword.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Library" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Library.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::MrnaClone" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::MrnaClone.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::MrnaOrientInfo" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::MrnaOrientInfo.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::NestedRepeats" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::NestedRepeats.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::NetGalGal3" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::NetGalGal3.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::NetHg19" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::NetHg19.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::NetMm9" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::NetMm9.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::NetMonDom4" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::NetMonDom4.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::NetOryCun2" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::NetOryCun2.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::NetRn4" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::NetRn4.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::NscanGene" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::NscanGene.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::NscanPep" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::NscanPep.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Organism" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Organism.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::ProductName" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::ProductName.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Quality" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Quality.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::RefFlat" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::RefFlat.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::RefGene" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::RefGene.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::RefLink" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::RefLink.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::RefSeqAli" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::RefSeqAli.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::RefSeqStatus" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::RefSeqStatus.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::RefSeqSummary" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::RefSeqSummary.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Rmsk" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Rmsk.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Sex" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Sex.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::SimpleRepeat" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::SimpleRepeat.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Source" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Source.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::TableDescriptions" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::TableDescriptions.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::Tissue" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::Tissue.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::TrackDb" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::TrackDb.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::TransMapAlnMRna" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::TransMapAlnMRna.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::TransMapAlnRefSeq" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::TransMapAlnRefSeq.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::TransMapAlnSplicedEst" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::TransMapAlnSplicedEst.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::TransMapAlnUcscGenes" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::TransMapAlnUcscGenes.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::TransMapInfoMRna" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::TransMapInfoMRna.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::TransMapInfoRefSeq" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::TransMapInfoRefSeq.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::TransMapInfoSplicedEst" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::TransMapInfoSplicedEst.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::TransMapInfoUcscGenes" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::TransMapInfoUcscGenes.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::WindowmaskerSdust" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::WindowmaskerSdust.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::XenoMrna" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::XenoMrna.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::XenoRefFlat" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::XenoRefFlat.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::XenoRefGene" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::XenoRefGene.first
        pp result
        result.should be_true
      end
    end
  end

  describe "Bio::Ucsc::CavPor3::XenoRefSeqAli" do
    context ".first" do
      it 'returns the first records' do
        result = Bio::Ucsc::CavPor3::XenoRefSeqAli.first
        pp result
        result.should be_true
      end
    end
  end

end


text:
using OpenProtocolInterpreter.Converters;
using System.Collections.Generic;

namespace OpenProtocolInterpreter.Tool
{
    /// <summary>
    /// Enable tool
    /// <para>Message sent by: Integrator</para>
    /// <para>Answer: <see cref="Communication.Mid0005"/> Command accepted</para>
    /// </summary>
    public class Mid0043 : Mid, ITool, IIntegrator
    {
        private readonly IValueConverter<int> _intConverter;

        private const int LAST_REVISION = 2;
        public const int MID = 43;

        public int ToolNumber
        {
            get => GetField(2, (int)DataFields.TOOL_NUMBER).GetValue(_intConverter.Convert);
            set => GetField(2, (int)DataFields.TOOL_NUMBER).SetValue(_intConverter.Convert, value);
        }

        public Mid0043() : this(LAST_REVISION)
        {

        }

        public Mid0043(int revision = LAST_REVISION) : base(MID, revision)
        {
            _intConverter = new Int32Converter();
        }

        /// <summary>
        /// Revision 2 constructor
        /// </summary>
        /// <param name="toolNumber">The number of the tool to disable. It is the same number as the tool numbers sent in <see cref="Mid0701"/> (Tool List Upload)</param>
        /// <param name="revision">Revision</param>
        public Mid0043(int toolNumber, int revision = 2) : this(revision)
        {
            ToolNumber = toolNumber;
        }

        protected override Dictionary<int, List<DataField>> RegisterDatafields()
        {
            return new Dictionary<int, List<DataField>>()
            {
                {
                    2, new List<DataField>()
                            {
                                new DataField((int)DataFields.TOOL_NUMBER, 20, 4, '0', DataField.PaddingOrientations.LEFT_PADDED),
                            }
                },
            };
        }

        public enum DataFields
        {
            TOOL_NUMBER,
            DISABLE_TYPE
        }
    }
}


text:
'use strict';
console.log();
console.log('Azure Cosmos DB Node.js Samples');
console.log('================================');
console.log();
console.log('USER MANAGEMENT');
console.log('================');
console.log();

var DocumentDBClient = require('documentdb').DocumentClient
    , DocumentBase = require('documentdb').DocumentBase
    , async = require('async')
    , config = require('../Shared/config')
    , fs = require('fs')
    , utils = require('../Shared/utils')
    , databaseId = config.names.database
    , dbLink

var host = config.connection.endpoint;
var masterKey = config.connection.authKey;

// Establish a new instance of the DocumentDBClient to be used throughout this demo
var client = new DocumentDBClient(host, { masterKey: masterKey });

init(function (data) {

    //Callback called when all the required data is ready.

    //attempt admin operation. It should fail as the user does have only read access
    attemptAdminOperations(data.col1, data.user1, data.user1Col1ReadPermission)

    //attempts to write a document on a collection where user has access to read only
    attemptWriteWithReadPermissionAsync(data.col1, data.user1, data.user1Col1ReadPermission);

    //attempts to read from 2 collections.
    attemptReadFromTwoCollections(data.col1, data.col2, data.user1, data.user1Col1ReadPermission, data.user1ReadCol2Permission)

});

function init(callback)
{
    //--------------------------------------------------------------------------------------------------
    // We need a Database, Two Collections, Two Users, and some permissions for this sample,
    // So let's go ahead and set these up initially
    //--------------------------------------------------------------------------------------------------
    utils.getOrCreateDatabase(client, databaseId, function (err,db) {

        if (err)
        {
            handleError(err);
        } else
        {
            var databaseLink = 'dbs/' + databaseId;
            var col1Name = "COL1";
            var col2Name = "COL2";
            var user1Name = "Thomas Andersen";
            var user2Name = "Robin Wakefield";
            var doc1Name = "doc1";
            var doc2Name = "doc2";
            var doc3Name = "doc3";

            utils.getOrCreateCollection(client, databaseLink, col1Name, function (err, col1)
            {
                if (err) {
                    handleError(err);
                } else {

                    utils.getOrCreateCollection(client, databaseLink, col2Name, function (err, col2) {

                        if (err) {
                            handleError(err);
                        } else {

                            var col1Link = databaseLink + '/colls/' + col1Name;
                            var col2Link = databaseLink + '/colls/' + col2Name;

                            var docDef = { id: doc1Name };

                            var userDef = { id: user1Name };

                            var permissionDef;

                            client.upsertDocument(col1Link, docDef, function (err, doc1) {
                                if (err) {
                                    handleError(err)
                                } else {

                                    console.log(doc1Name + 'Created in ' + col1Name + ' !');

                                    docDef = { id: doc2Name };

                                    client.upsertDocument(col1Link, docDef, function (err, doc2) {

                                        if (err){
                                            handleError(err)
                                        } else {

                                            console.log(doc2Name + 'Created in ' +  col1Name + ' !');

                                            docDef = { id: doc3Name };

                                            client.upsertDocument(col2Link, docDef, function (err, doc3) {

                                                if (err) {
                                                    handleError(err);
                                                } else {
                                                    console.log(doc3Name + ' Created in ' + col2Name + ' !');

                                                    client.upsertUser(databaseLink, userDef, function (err, user1) {

                                                        if (err){
                                                            handleError(err);
                                                        } else {

                                                            console.log(user1Name + ' created!');

                                                            userDef = { id: user2Name };

                                                            client.upsertUser(databaseLink, userDef, function (err, user2) {

                                                                console.log(user2Name + ' created!');

                                                                // Read Permission on col1 for user1
                                                                permissionDef = { id : "p1", permissionMode: 'Read', resource: col1Link };

                                                                client.upsertPermission(user1._self, permissionDef, function (err, user1Col1ReadPermission) {

                                                                    if (err){
                                                                        handleError(err)
                                                                    } else {

                                                                        console.log('Read only permission assigned to Thomas Andersen on col1!');

                                                                        permissionDef = { id: "p2", permissionMode: 'All', resource: doc1._self };

                                                                        // All Permissions on Doc1 for user1
                                                                        client.upsertPermission(user1._self, permissionDef, function (err, user1AllDoc1Permission) {

                                                                            if (err) {
                                                                                handleError(err);
                                                                            } else {
                                                                                console.log('All permission assigned to Thomas Andersen on doc1!');

                                                                                permissionDef = { id: "p3", permissionMode: 'Read', resource: col2Link };

                                                                                // Read Permissions on Col2 for user1
                                                                                client.upsertPermission(user1._self, permissionDef, function (err, user1ReadCol2Permission) {
                                                                                if (err) {

                                                                                handleError(err);
                                                                                } else {

                                                                                console.log('Read permission assigned to Thomas Andersen on col2!');

                                                                                permissionDef = { id: "p4", permissionMode: 'All', resource: col2Link };

                                                                                client.upsertPermission(user2._self, permissionDef, function (err, user2ReadCol2Permission) {

                                                                                if (err){

                                                                                handleError(err);
                                                                                } else {

                                                                                console.log('All permission assigned to Robin Wakefield on col2!');

                                                                                client.readPermissions(user1._self).toArray(function (err, permissions) {

                                                                                if (err){
                                                                                handleError(err);
                                                                                } else{
                                                                                console.log("Fetched permission for Thomas Andersen. Count is : " + permissions.length);

                                                                                var dataToReturn = new function () { };

                                                                                dataToReturn.user1 = user1;
                                                                                dataToReturn.user2 = user2;
                                                                                dataToReturn.user1Permissions = permissions;
                                                                                dataToReturn.col1 = col1;
                                                                                dataToReturn.col2 = col2;
                                                                                dataToReturn.user1Col1ReadPermission = user1Col1ReadPermission;
                                                                                dataToReturn.user1AllDoc1Permission = user1AllDoc1Permission;
                                                                                dataToReturn.user1ReadCol2Permission = user1ReadCol2Permission;
                                                                                dataToReturn.user2ReadCol2Permission = user2ReadCol2Permission;

                                                                                callback(dataToReturn);
                                                                                }

                                                                                });

                                                                                }

                                                                                });

                                                                                }
                                                                                });

                                                                            }
                                                                        });

                                                                    }

                                                                });

                                                            });
                                                        }
                                                    });

                                                }
                                            });

                                        }
                                    });
                                }
                            });
                        }
                    });
                }
            });
        }

    });
};

//handle error
function handleError(error) {
    console.log();
    console.log('An error with code \'' + error.code + '\' has occurred:');
    console.log('\t' + JSON.parse(error.body).message);
    console.log();

    finish();
}

function finish() {
    console.log();
    console.log('End of demo.');
}

//Attempt to do admin operations when user only has Read on a collection
function attemptAdminOperations(collection1Link,user1,user1Col1ReadPermission) {

    var resourceTokens = {};
    resourceTokens[(collection1Link._rid)] = (user1Col1ReadPermission._token);

    var client = new DocumentDBClient(host, {
        resourceTokens: resourceTokens
    });

    client.readDocuments(collection1Link._self).toArray(function (err, documents) {

        if (err) {
            handleError(err);
        } else {
            console.log(user1.id + ' able to perform read operation on collection 1');
        }
    });

    client.readDatabases().toArray(function (err, databases) {
        if (err) {
            console.log('Expected error occurred as ' + user1.id + ' does not have access to get the list of databases. Error code : ' + err.code);
        } else {
            console.log('It should never come here as ' + user1.id + ' has read only permission on COL1');
        }
    });

}

//attempts to write in collection 1 with user 1 permission. It fails as the user1 has read only permission on col1
function attemptWriteWithReadPermissionAsync(collection1Link, user1, user1Col1ReadPermission)
{
    var resourceTokens = {};
    resourceTokens[(collection1Link._rid)] = (user1Col1ReadPermission._token);

    var client = new DocumentDBClient(host, {
        resourceTokens: resourceTokens
    });

    var docDef = { id: 'not allowed' };

    client.upsertDocument(collection1Link._self, docDef, function (err, doc2) {
        if (err) {
            console.log('Expected error occurred as ' + user1.id + ' does not have access to insert a document in COL1. Error code : ' + err.code);
        } else {
            console.log('It should never come here as ' + user1.id + ' has read only permission on COL1');
        }
    });

}

//attempts to read from both the collections as the user has read permission
function attemptReadFromTwoCollections(collection1Link, collection2Link, user1, user1Col1ReadPermission, user1ReadCol2Permission)
{
    var resourceTokens = {};
    resourceTokens[(collection1Link._rid)] = (user1Col1ReadPermission._token);
    resourceTokens[(collection2Link._rid)] = (user1ReadCol2Permission._token);

    var client = new DocumentDBClient(host, {
        resourceTokens: resourceTokens
    });

    client.readDocuments(collection1Link._self).toArray(function (err, documents) {

        if (err) {
            handleError(err);
        } else {
            console.log(user1.id + ' able to read documents from COL1. Document count is ' + documents.length);
        }

    });

    client.readDocuments(collection2Link._self).toArray(function (err, documents) {

        if (err) {
            handleError(err);
        } else {
            console.log(user1.id + ' able to read documents from COL2. Document count is ' + documents.length);
        }

    });

    var docDef = { id: 'not allowed' };

    client.upsertDocument(collection2Link._self, docDef, function (err, doc2) {
        if (err) {
            console.log('Expected error occurred as ' + user1.id + ' does not have access to insert a document in COL2. Error code : ' + err.code);
        } else {
            console.log('It should never come here as ' + user1.id + ' has read only permission on COL2');
        }
    });

}


text:
package org.marketcetera.util.log;

import java.io.Serializable;
import java.util.Locale;
import org.apache.log4j.Level;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * @author tlerios@marketcetera.com
 * @since 0.5.0
 * @version $Id: TI18NMessage4PTest.java 16154 2012-07-14 16:34:05Z colin $
 */

/* $License$ */

public class TI18NMessage4PTest
    extends I18NMessageTestBase
{
    private static final String TEST_MSG_EN=
        "P4 msg (expected) en "+TEST_P1+" "+TEST_P2+" "+TEST_P3+" "+TEST_P4;
    private static final String TEST_TTL_EN=
        "P4 ttl (expected) en "+TEST_P1+" "+TEST_P2+" "+TEST_P3+" "+TEST_P4;
    private static final String TEST_MSG_FR=
        "P4 msg (expected) fr "+TEST_P1+" "+TEST_P2+" "+TEST_P3+" "+TEST_P4;
    private static final String TEST_TTL_FR=
        "P4 ttl (expected) fr "+TEST_P1+" "+TEST_P2+" "+TEST_P3+" "+TEST_P4;
    private static final String TEST_LOCATION=
        TI18NMessage4PTest.class.getName();

    private static void castOverride
        (I18NMessage4P m) {}

    @Test
    public void basic()
    {
        unboundTests
            (4,
             new I18NMessage4P(TestMessages.LOGGER,TEST_MSG_ID,TEST_ENTRY_ID),
             new I18NMessage4P(TestMessages.LOGGER,TEST_MSG_ID,TEST_ENTRY_ID),
             new I18NMessage[] {
                new I18NMessage4P
                (TEST_LOGGER_D,TEST_MSG_ID,TEST_ENTRY_ID),
                new I18NMessage4P
                (TestMessages.LOGGER,TEST_MSG_ID_D,TEST_ENTRY_ID),
                new I18NMessage4P
                (TestMessages.LOGGER,TEST_MSG_ID,TEST_ENTRY_ID_D),
                new I18NMessage0P
                (TestMessages.LOGGER,TEST_MSG_ID,TEST_ENTRY_ID)
             },
             new I18NMessage4P(TestMessages.LOGGER,TEST_MSG_ID));
    }

    @Test
    public void messageProvider()
    {
        assertEquals
            (TEST_MSG_EN,TestMessages.P4_MSG.getText
             (TEST_P1,TEST_P2,TEST_P3,TEST_P4));
        assertEquals
            (TEST_TTL_EN,TestMessages.P4_TTL.getText
             (TEST_P1,TEST_P2,TEST_P3,TEST_P4));
        assertEquals
            (TEST_MSG_FR,TestMessages.P4_MSG.getText
             (Locale.FRENCH,TEST_P1,TEST_P2,TEST_P3,TEST_P4));
        assertEquals
            (TEST_TTL_FR,TestMessages.P4_TTL.getText
             (Locale.FRENCH,TEST_P1,TEST_P2,TEST_P3,TEST_P4));
    }

    @Test
    public void loggerProxy()
    {
        TestMessages.P4_MSG.error
            (TEST_CATEGORY,TEST_THROWABLE,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.ERROR,TEST_CATEGORY,TEST_MSG_EN,TEST_LOCATION);
        TestMessages.P4_MSG.error
            (TEST_CATEGORY,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.ERROR,TEST_CATEGORY,TEST_MSG_EN,TEST_LOCATION);

        TestMessages.P4_TTL.error
            (TEST_CATEGORY,TEST_THROWABLE,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.ERROR,TEST_CATEGORY,TEST_TTL_EN,TEST_LOCATION);
        TestMessages.P4_TTL.error
            (TEST_CATEGORY,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.ERROR,TEST_CATEGORY,TEST_TTL_EN,TEST_LOCATION);

        TestMessages.P4_MSG.warn
            (TEST_CATEGORY,TEST_THROWABLE,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.WARN,TEST_CATEGORY,TEST_MSG_EN,TEST_LOCATION);
        TestMessages.P4_MSG.warn
            (TEST_CATEGORY,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.WARN,TEST_CATEGORY,TEST_MSG_EN,TEST_LOCATION);

        TestMessages.P4_TTL.warn
            (TEST_CATEGORY,TEST_THROWABLE,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.WARN,TEST_CATEGORY,TEST_TTL_EN,TEST_LOCATION);
        TestMessages.P4_TTL.warn
            (TEST_CATEGORY,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.WARN,TEST_CATEGORY,TEST_TTL_EN,TEST_LOCATION);

        TestMessages.P4_MSG.info
            (TEST_CATEGORY,TEST_THROWABLE,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.INFO,TEST_CATEGORY,TEST_MSG_EN,TEST_LOCATION);
        TestMessages.P4_MSG.info
            (TEST_CATEGORY,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.INFO,TEST_CATEGORY,TEST_MSG_EN,TEST_LOCATION);

        TestMessages.P4_TTL.info
            (TEST_CATEGORY,TEST_THROWABLE,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.INFO,TEST_CATEGORY,TEST_TTL_EN,TEST_LOCATION);
        TestMessages.P4_TTL.info
            (TEST_CATEGORY,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.INFO,TEST_CATEGORY,TEST_TTL_EN,TEST_LOCATION);

        TestMessages.P4_MSG.debug
            (TEST_CATEGORY,TEST_THROWABLE,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.DEBUG,TEST_CATEGORY,TEST_MSG_EN,TEST_LOCATION);
        TestMessages.P4_MSG.debug
            (TEST_CATEGORY,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.DEBUG,TEST_CATEGORY,TEST_MSG_EN,TEST_LOCATION);

        TestMessages.P4_TTL.debug
            (TEST_CATEGORY,TEST_THROWABLE,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.DEBUG,TEST_CATEGORY,TEST_TTL_EN,TEST_LOCATION);
        TestMessages.P4_TTL.debug
            (TEST_CATEGORY,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.DEBUG,TEST_CATEGORY,TEST_TTL_EN,TEST_LOCATION);

        TestMessages.P4_MSG.trace
            (TEST_CATEGORY,TEST_THROWABLE,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.TRACE,TEST_CATEGORY,TEST_MSG_EN,TEST_LOCATION);
        TestMessages.P4_MSG.trace
            (TEST_CATEGORY,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.TRACE,TEST_CATEGORY,TEST_MSG_EN,TEST_LOCATION);

        TestMessages.P4_TTL.trace
            (TEST_CATEGORY,TEST_THROWABLE,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.TRACE,TEST_CATEGORY,TEST_TTL_EN,TEST_LOCATION);
        TestMessages.P4_TTL.trace
            (TEST_CATEGORY,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        assertSingleEvent(Level.TRACE,TEST_CATEGORY,TEST_TTL_EN,TEST_LOCATION);
    }

    @Test
    public void bound()
    {
        Serializable[] params=new Serializable[]
            {TEST_P1,TEST_P2,TEST_P3,TEST_P4};
        I18NBoundMessage4P m=new I18NBoundMessage4P
            (TestMessages.P4_MSG,TEST_P1,TEST_P2,TEST_P3,TEST_P4);
        boundTests(m,new I18NBoundMessage4P
                   (TestMessages.P4_MSG,TEST_P1,TEST_P2,TEST_P3,TEST_P4),
                   new I18NBoundMessage[] {
                       new I18NBoundMessage4P
                       (TestMessages.P4_MSG,TEST_P1,TEST_P2,TEST_P3,TEST_P1),
                       new I18NBoundMessage4P
                       (TestMessages.P4_TTL,TEST_P1,TEST_P2,TEST_P3,TEST_P4),
                       TestMessages.P0_MSG
                   },params,TestMessages.P4_MSG,TEST_MSG_EN,TEST_MSG_FR);
        castOverride(m.getMessage());
        boundTests(new I18NBoundMessage4P
                   (TestMessages.P4_TTL,TEST_P1,TEST_P2,TEST_P3,TEST_P4),
                   new I18NBoundMessage4P
                   (TestMessages.P4_TTL,TEST_P1,TEST_P2,TEST_P3,TEST_P4),
                   new I18NBoundMessage[] {
                       new I18NBoundMessage4P
                       (TestMessages.P4_TTL,TEST_P1,TEST_P2,TEST_P3,TEST_P1),
                       new I18NBoundMessage4P
                       (TestMessages.P4_MSG,TEST_P1,TEST_P2,TEST_P3,TEST_P4),
                       TestMessages.P0_TTL
                   },params,TestMessages.P4_TTL,
                   TEST_TTL_EN,TEST_TTL_FR);
        assertEquals(TEST_P1,m.getParam1());
        assertEquals(TEST_P2,m.getParam2());
        assertEquals(TEST_P3,m.getParam3());
        assertEquals(TEST_P4,m.getParam4());
    }
}


text:
using System.Collections.Generic;

namespace Dota2Handbook.Utilities
{
    public class GroupInfoList : List<object>
    {
        public char Key { get; set; }
    }
}


text:
package org.marketcetera.photon.internal.strategy.engine.embedded;

import org.marketcetera.photon.strategy.engine.embedded.EmbeddedEngine;
import org.marketcetera.photon.strategy.engine.model.core.ConnectionState;
import org.marketcetera.photon.strategy.engine.model.core.impl.StrategyEngineImpl;
import org.marketcetera.util.misc.ClassVersion;

/* $License$ */

/**
 * The embedded engine implementation. See
 * {@link EmbeddedEngine#createEngine(java.util.concurrent.ExecutorService, boolean)}
 * .
 *
 * @author Will Horn
 * @version $Id: EmbeddedEngineImpl.java 16154 2012-07-14 16:34:05Z colin $
 * @since 2.0.0
 */
@ClassVersion("$Id: EmbeddedEngineImpl.java 16154 2012-07-14 16:34:05Z colin $")
public class EmbeddedEngineImpl extends StrategyEngineImpl {

    /**
     * Constructor.
     */
    public EmbeddedEngineImpl() {
        setConnectionState(ConnectionState.CONNECTED);
        setName(Messages.EMBEDDED_ENGINE_IMPL__NAME.getText());
        setDescription(Messages.EMBEDDED_ENGINE_IMPL__DESCRIPTION.getText());
        setReadOnly(true);
    }
}


text:
using System.Collections.Generic;
using Aurora.Framework;
using Aurora.Services.DataService;
using Nini.Config;
using OpenMetaverse;

namespace Aurora.Modules
{
    public class IWCProfileConnector : ConnectorBase, IProfileConnector
    {
        protected LocalProfileConnector m_localService;

        #region IProfileConnector Members

        public void Initialize(IGenericData unneeded, IConfigSource source, IRegistryCore simBase,
                               string defaultConnectionString)
        {
            if (source.Configs["AuroraConnectors"].GetString("ProfileConnector", "LocalConnector") == "IWCConnector")
            {
                m_localService = new LocalProfileConnector();
                m_localService.Initialize(unneeded, source, simBase, defaultConnectionString);
                m_registry = simBase;
                DataManager.DataManager.RegisterPlugin(this);
                Init(simBase, Name);
            }
        }

        public string Name
        {
            get { return "IProfileConnector"; }
        }

        [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
        public IUserProfileInfo GetUserProfile(UUID agentID)
        {
            IUserProfileInfo profile = m_localService.GetUserProfile(agentID);
            if (profile == null)
                profile = (IUserProfileInfo)DoRemoteForced(agentID);
            return profile;
        }

        [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
        public bool UpdateUserProfile(IUserProfileInfo Profile)
        {
            bool success = m_localService.UpdateUserProfile(Profile);
            if (!success)
                success = (bool)DoRemoteForced(Profile);
            return success;
        }

        [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Full)]
        public void CreateNewProfile(UUID UUID)
        {
            m_localService.CreateNewProfile(UUID);
        }

        [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
        public bool AddClassified(Classified classified)
        {
            bool success = m_localService.AddClassified(classified);
            if (!success)
                success = (bool)DoRemoteForced(classified);
            return success;
        }

        [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
        public Classified GetClassified(UUID queryClassifiedID)
        {
            Classified Classified = m_localService.GetClassified(queryClassifiedID);
            if (Classified == null)
                Classified = (Classified)DoRemoteForced(queryClassifiedID);
            return Classified;
        }

        [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
        public List<Classified> GetClassifieds(UUID ownerID)
        {
            List<Classified> Classifieds = m_localService.GetClassifieds(ownerID);
            if (Classifieds == null)
                Classifieds = (List<Classified>)DoRemoteForced(ownerID);
            return Classifieds;
        }

        [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
        public void RemoveClassified(UUID queryClassifiedID)
        {
            m_localService.RemoveClassified(queryClassifiedID);
            DoRemoteForced(queryClassifiedID);
        }

        [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
        public bool AddPick(ProfilePickInfo pick)
        {
            bool success = m_localService.AddPick(pick);
            if (!success)
                success = (bool)DoRemoteForced(pick);
            return success;
        }

        [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
        public ProfilePickInfo GetPick(UUID queryPickID)
        {
            ProfilePickInfo pick = m_localService.GetPick(queryPickID);
            if (pick == null)
                pick = (ProfilePickInfo)DoRemoteForced(queryPickID);
            return pick;
        }

        [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
        public List<ProfilePickInfo> GetPicks(UUID ownerID)
        {
            List<ProfilePickInfo> picks = m_localService.GetPicks(ownerID);
            if (picks == null)
                picks = (List<ProfilePickInfo>)DoRemoteForced(ownerID);
            return picks;
        }

        [CanBeReflected(ThreatLevel = OpenSim.Services.Interfaces.ThreatLevel.Low)]
        public void RemovePick(UUID queryPickID)
        {
            m_localService.RemovePick(queryPickID);
            DoRemoteForced(queryPickID);
        }

        #endregion

        public void Dispose()
        {
        }
    }
}


text:
__all__ = ['Error', 'MalformedMKVError', 'ParserError', 'ReadError', 'SizeError']

class Error(Exception):
    """Base class for enzyme exceptions"""
    pass

class MalformedMKVError(Error):
    """Wrong or malformed element found"""
    pass

class ParserError(Error):
    """Base class for exceptions in parsers"""
    pass

class ReadError(ParserError):
    """Unable to correctly read"""
    pass

class SizeError(ParserError):
    """Mismatch between the type of the element and the size of its data"""
    pass


text:
package com.diamondq.common.storage.kv;

import java.util.List;

import org.checkerframework.checker.nullness.qual.Nullable;
import org.javatuples.Pair;

public interface Query {

  /**
   * Returns the name of the 'object type' that this Query is attached to (usually the StructureDefinition name)
   *
   * @return the name
   */
  public String getDefinitionName();

  /**
   * Returns a name for this query
   *
   * @return the query name
   */
  public String getQueryName();

  /**
   * Returns the where list
   *
   * @return the list
   */
  public List<WhereInfo> getWhereList();

  /**
   * If this query refers to a parent, then returns the name in the parameters that will contain the parent
   *
   * @return the optional parent param key name
   */
  public @Nullable String getParentParamKey();

  /**
   * If this query refers to a parent, then returns the name of the parent definition.
   *
   * @return the parent name
   */
  public @Nullable String getParentName();

  /**
   * Returns the sort order (each pair is the name and true for ascending or false for descending)
   *
   * @return the sort order
   */
  public List<Pair<String, Boolean>> getSortList();

  /**
   * Returns the limit key (or null if there is no limit)
   *
   * @return the limit key
   */
  public @Nullable String getLimitKey();

}


text:
module Hedwig
  module Api
    # Exposes convenience methods for requesting the TripAdvisor
    # location/:id/hotels and map/:lat,:long/hotels API endpoints.
    module Hotels
      include Api::Methods

      def self.resource_name
        'hotels'
      end
    end
  end
end


text:
module M where
import qualified Prelude (map)
x = Prelude.Left 'a'


text:
X-axis : k
Y axis = Percentage Error

X-axis : k
Y axis = Percentage Error

X-axis : k
Y axis = Percentage Error

X-axis : k
Y axis = Percentage Error

X-axis : k
Y axis = Percentage Error

X-axis : k
Y axis = Percentage Error

X-axis : k
Y axis = Percentage Error


text:
package org.jkiss.dbeaver.ui.editors.sql.syntax;

import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Position;
import org.eclipse.jface.text.reconciler.DirtyRegion;
import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
import org.eclipse.jface.text.reconciler.IReconcilingStrategyExtension;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.projection.ProjectionAnnotation;
import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel;
import org.jkiss.code.NotNull;
import org.jkiss.code.Nullable;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.model.sql.SQLScriptElement;
import org.jkiss.dbeaver.ui.editors.EditorUtils;
import org.jkiss.dbeaver.ui.editors.sql.SQLEditorBase;
import org.jkiss.dbeaver.ui.editors.sql.internal.SQLEditorActivator;

import org.jkiss.utils.CommonUtils;

import java.util.*;
import java.util.stream.Collectors;

public class SQLReconcilingStrategy implements IReconcilingStrategy, IReconcilingStrategyExtension {
    private static final Log log = Log.getLog(SQLReconcilingStrategy.class);

    private static final QualifiedName COLLAPSED_ANNOTATIONS =
            new QualifiedName(SQLEditorActivator.PLUGIN_ID, SQLReconcilingStrategy.class.getName() + ".collapsedFoldingAnnotations");

    private final NavigableSet<SQLScriptElementImpl> cache = new TreeSet<>();

    private final SQLEditorBase editor;

    private IDocument document;

    public SQLReconcilingStrategy(SQLEditorBase editor) {
        this.editor = editor;
    }

    @Override
    public void setDocument(IDocument document) {
        this.document = document;
        this.cache.clear();
    }

    @Override
    public void setProgressMonitor(IProgressMonitor monitor) {
        //todo use monitor
    }

    @Override
    public void reconcile(DirtyRegion dirtyRegion, IRegion subRegion) {
        if (DirtyRegion.INSERT.equals(dirtyRegion.getType())) {
            reconcile(subRegion.getOffset(), subRegion.getLength(), false);
        } else {
            reconcile(subRegion.getOffset(), 0, false);
        }
    }

    @Override
    public void reconcile(IRegion partition) {
        reconcile(0, document.getLength(), false);
    }

    @Override
    public void initialReconcile() {
        reconcile(0, document.getLength(), true);
    }

    private Set<Integer> getSavedCollapsedAnnotationsOffsets() {
        IResource resource = getResource();
        if (resource == null) {
            return Collections.emptySet();
        }
        String data;
        try {
            data = resource.getPersistentProperty(COLLAPSED_ANNOTATIONS);
        } catch (CoreException e) {
            log.warn("Core Exception caught while reading saved collapsed folding positions", e);
            return Collections.emptySet();
        }
        if (data == null) {
            return Collections.emptySet();
        }

        Set<Integer> collapsedPositionsOffsets = new HashSet<>();
        String[] offsets = data.split(";");
        for (String offset: offsets) {
            int offsetValue = CommonUtils.toInt(offset, -1);
            if (offsetValue == -1) {
                log.warn("Illegal offset parsed while reading saved collapsed annotation offsets. offset=" + offset);
                continue;
            }
            collapsedPositionsOffsets.add(offsetValue);
        }

        return collapsedPositionsOffsets;
    }

    //format: "offset_1;offset_2;...offset_n"
    public void saveState() {
        IResource resource = getResource();
        ProjectionAnnotationModel annotationModel = editor.getProjectionAnnotationModel();
        if (resource == null || annotationModel == null) {
            return;
        }
        StringJoiner stringJoiner = new StringJoiner(";");
        for (SQLScriptElementImpl position: cache) {
            ProjectionAnnotation annotation = position.getAnnotation();
            if (annotation != null && annotation.isCollapsed()) {
                stringJoiner.add(Integer.toString(position.getOffset()));
            }
        }
        String value;
        if (stringJoiner.length() == 0) {
            value = null;
        } else {
            value = stringJoiner.toString();
        }
        try {
            resource.setPersistentProperty(COLLAPSED_ANNOTATIONS, value);
        } catch (CoreException e) {
            log.warn("Core Exception caught while persisting saved collapsed folding positions", e);
        }
    }

    @Nullable
    private IResource getResource() {
        return EditorUtils.getFileFromInput(editor.getEditorInput());
    }

    public void onDataSourceChange() {
        if (document == null) {
            return;
        }
        reconcile(0, document.getLength(), true);
    }

    private void reconcile(int damagedRegionOffset, int damagedRegionLength, boolean restoreCollapsedAnnotations) {
        if (!editor.isFoldingEnabled()) {
            cache.clear(); // underlying annotation model being cleared, so reset the cache too
            return;
        }
        ProjectionAnnotationModel model = editor.getProjectionAnnotationModel();
        if (model == null) {
            return;
        }

        SQLScriptElementImpl leftBound = cache.lower(new SQLScriptElementImpl(damagedRegionOffset, damagedRegionLength));
        if (leftBound != null) {
            leftBound = cache.lower(leftBound);
        }
        SQLScriptElementImpl rightBound = cache.ceiling(new SQLScriptElementImpl(damagedRegionOffset + damagedRegionLength, 0));
        if (leftBound == null) {
            damagedRegionOffset = 0;
        } else {
            damagedRegionOffset = leftBound.getOffset() + leftBound.getLength();
        }
        if (rightBound == null) {
            damagedRegionLength = document.getLength();
        } else {
            damagedRegionLength = rightBound.getOffset() + rightBound.getLength() - damagedRegionOffset;
        }

        List<SQLScriptElement> parsedQueries = extractQueries(damagedRegionOffset, damagedRegionLength);
        if (parsedQueries == null) {
            return;
        }

        if (rightBound != null && !parsedQueries.isEmpty()) {
            SQLScriptElement rightmostParsedQuery = parsedQueries.get(parsedQueries.size() - 1);
            if (!rightBound.equals(getExpandedScriptElement(rightmostParsedQuery))) {
                parsedQueries = extractQueries(damagedRegionOffset, document.getLength());
                if (parsedQueries == null) {
                    return;
                }
                rightBound = null;
            }
        }

        Collection<SQLScriptElementImpl> cachedQueries;
        if (leftBound == null && rightBound == null) {
            cachedQueries = Collections.unmodifiableNavigableSet(cache);
        } else if (leftBound == null) {
            cachedQueries = Collections.unmodifiableNavigableSet(cache.headSet(rightBound, true));
        } else if (rightBound == null) {
            cachedQueries = Collections.unmodifiableNavigableSet(cache.tailSet(leftBound, false));
        } else {
            cachedQueries = Collections.unmodifiableNavigableSet(cache.subSet(leftBound, false, rightBound, true));
        }

        Collection<SQLScriptElementImpl> parsedElements = parsedQueries.stream()
                .filter(this::deservesFolding)
                .map(this::getExpandedScriptElement)
                .collect(Collectors.toSet());
        Map<Annotation, SQLScriptElementImpl> additions = new HashMap<>();
        Set<Integer> savedCollapsedAnnotationsOffsets = restoreCollapsedAnnotations ? getSavedCollapsedAnnotationsOffsets() : Collections.emptySet();
        for (SQLScriptElementImpl element: parsedElements) {
            if (!cachedQueries.contains(element)) {
                ProjectionAnnotation annotation = new ProjectionAnnotation();
                element.setAnnotation(annotation);
                additions.put(annotation, element);
                if (savedCollapsedAnnotationsOffsets.contains(element.getOffset())) {
                    annotation.markCollapsed();
                }
            }
        }
        Collection<SQLScriptElementImpl> deletedPositions = cachedQueries.stream()
                .filter(element -> !parsedElements.contains(element))
                .collect(Collectors.toList());
        Annotation[] deletions = deletedPositions.stream()
                .map(SQLScriptElementImpl::getAnnotation)
                .toArray(Annotation[]::new);
        model.modifyAnnotations(deletions, additions, null);
        cache.removeAll(deletedPositions);
        cache.addAll(additions.values());
    }

    @Nullable
    private List<SQLScriptElement> extractQueries(int offset, int length) {
        return editor.extractScriptQueries(offset, length, false, true, false);
    }

    private boolean deservesFolding(SQLScriptElement element) {
        int numberOfLines = getNumberOfLines(element);
        if (numberOfLines == 1) {
            return false;
        }
        if (element.getOffset() + element.getLength() != document.getLength() && expandQueryLength(element) == element.getLength()) {
            return numberOfLines > 2;
        }
        return true;
    }

    private int getNumberOfLines(SQLScriptElement element) {
        try {
            return document.getLineOfOffset(element.getOffset() + element.getLength()) - document.getLineOfOffset(element.getOffset()) + 1;
        } catch (BadLocationException e) {
            throw new SQLReconcilingStrategyException(e);
        }
    }

    //expands query to the end of the line if there are only whitespaces after it. Returns desired length.
    private int expandQueryLength(SQLScriptElement element) { //todo simplify
        int position = element.getOffset() + element.getLength();
        while (position < document.getLength()) {
            char c = unsafeGetChar(position);
            if (c == '\n') {
                if (position + 1 < document.getLength()) {
                    position++;
                    break;
                }
            }
            if (Character.isWhitespace(c)) {
                position++;
            } else {
                return element.getLength();
            }
        }
        return position - element.getOffset();
    }

    @NotNull
    private SQLScriptElementImpl getExpandedScriptElement(@NotNull SQLScriptElement element) {
        return new SQLScriptElementImpl(element.getOffset(), expandQueryLength(element));
    }

    private char unsafeGetChar(int index) {
        try {
            return document.getChar(index);
        } catch (BadLocationException e) {
            throw new SQLReconcilingStrategyException(e);
        }
    }

    private static class SQLReconcilingStrategyException extends RuntimeException {
        private SQLReconcilingStrategyException(Throwable cause) {
            super(cause);
        }
    }

    private static class SQLScriptElementImpl extends Position implements SQLScriptElement, Comparable<SQLScriptElementImpl> {
        @Nullable
        private ProjectionAnnotation annotation;

        SQLScriptElementImpl(int offset, int length) {
            super(offset, length);
        }

        @Nullable
        public ProjectionAnnotation getAnnotation() {
            return annotation;
        }

        public void setAnnotation(@Nullable ProjectionAnnotation annotation) {
            this.annotation = annotation;
        }

        @Override
        public int compareTo(@NotNull SQLScriptElementImpl o) {
            int diff = getOffset() - o.getOffset();
            if (diff != 0) {
                return diff;
            }
            return getLength() - o.getLength();
        }

        @Override
        public boolean equals(Object o) {
            if (o instanceof Position) {
                Position p = (Position) o;
                return equals(p.getOffset(), p.getLength());
            }
            if (o instanceof SQLScriptElement) {
                SQLScriptElement e = (SQLScriptElement) o;
                return equals(e.getOffset(), e.getLength());
            }
            return false;
        }

        private boolean equals(int offset, int length) {
            return getOffset() == offset && getLength() == length;
        }

        @Override
        public int hashCode() {
            return Objects.hash(getOffset(), getLength());
        }

        @NotNull
        @Override
        public String getOriginalText() {
            return "";
        }

        @NotNull
        @Override
        public String getText() {
            return "";
        }

        @Override
        public Object getData() {
            return "";
        }

        @Override
        public void setData(Object data) {
            //do nothing
        }

        @Override
        public void reset() {
            //do nothing
        }
    }
}


text:
namespace net {
class HttpRequestHeaders;
}

namespace data_reduction_proxy {

// Interface to determine if a request should be made for a low fidelity version
// of the resource.
class LoFiDecider {
 public:
  virtual ~LoFiDecider() {}

  // Returns true when Lo-Fi mode is on for the given |request|. This means the
  // Lo-Fi header should be added to the given request.
  virtual bool IsUsingLoFiMode(const net::URLRequest& request) const = 0;

  // Returns true when Lo-Fi mode is on for the given |request|. If the
  // |request| is using Lo-Fi mode, adds the "q=low" directive to the |headers|.
  // If the |request| is using Lo-Fi preview mode, and it is a main frame
  // request adds the "q=preview" and it is a main frame request directive to
  // the |headers|. If the user is in the experiment control group and Lo-Fi is
  // on, adds the experiment directive "exp=lofi_active_control".
  virtual bool MaybeAddLoFiDirectiveToHeaders(
      const net::URLRequest& request,
      net::HttpRequestHeaders* headers) const = 0;
};

}  // namespace data_reduction_proxy

#endif  // COMPONENTS_DATA_REDUCTION_PROXY_CORE_BROWSER_LOFI_DECIDER_H_


text:
<?php

namespace App\Listeners;

use App\Events\MessageSent;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Support\Facades\Mail;

class SendConfirmation
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param  MessageSent  $event
     * @return void
     */
    public function handle(MessageSent $event)
    {
        $contact_message = $event->message;
        Mail::send('email.contact-message-confirmation', ['contact_message' => $contact_message], function($m) use ($contact_message){
          $m->from('info@laravel-udemy-course.com', 'Laravel Udemy Course');
          $m->to($contact_message->email, $contact_message->sender);
          $m->subject('We received your message');
        });
    }
}


text:
import {ServerSettingsProvider} from "../class/ServerSettingsProvider";

export const globalServerSettings = new ServerSettingsProvider();
export const GlobalServerSettings = globalServerSettings;


text:
namespace Nine.Application
{
    using System;
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using System.Threading.Tasks;
    using Android.App;
    using Android.Content;
    using Android.Graphics;
    using Android.Media;
    using Android.OS;
    using Android.Provider;
    using Stream = System.IO.Stream;

    public class MediaLibrary : IMediaLibrary
    {
        private const int ImagePickerCode = 90001;

        private static TaskCompletionSource<Stream> imageChooserTcs;

        private int _maxSize;
        private Android.Net.Uri _imagePath;
        private Android.Net.Uri _compressedPath;

        private readonly Func<Context> contextFactory;

        public MediaLibrary(Context context) : this(() => context) { }
        public MediaLibrary(Func<Context> contextFactory)
        {
            if (contextFactory == null) throw new ArgumentNullException(nameof(contextFactory));

            this.contextFactory = contextFactory;
        }

        public Task<Stream> PickImage(ImageLocation location = ImageLocation.All, int maxSize = int.MaxValue)
        {
            var activity = contextFactory() as Activity;
            if (activity == null) return Task.FromResult<Stream>(null);

            var root = new Java.IO.File(Android.OS.Environment.ExternalStorageDirectory + "/temp");
            root.Mkdirs();

            _imagePath = Android.Net.Uri.FromFile(new Java.IO.File(root, Guid.NewGuid().ToString("N") + ".jpg"));
            _compressedPath = Android.Net.Uri.FromFile(new Java.IO.File(root, Guid.NewGuid().ToString("N") + ".jpg"));

            _maxSize = maxSize;

            // File system.
            var galleryIntent = new Intent();
            galleryIntent.SetType("image/*");
            galleryIntent.SetAction(Intent.ActionGetContent);

            var chooserIntent = Intent.CreateChooser(galleryIntent, "");

            // Camera.
            if (location.HasFlag(ImageLocation.Camera))
            {
                var cameraIntents = new List<Intent>();
                var captureIntent = new Intent(MediaStore.ActionImageCapture);
                foreach (var res in activity.PackageManager.QueryIntentActivities(captureIntent, 0))
                {
                    var intent = new Intent(captureIntent);
                    intent.SetComponent(new ComponentName(res.ActivityInfo.PackageName, res.ActivityInfo.Name));
                    intent.SetPackage(res.ActivityInfo.PackageName);
                    intent.PutExtra(MediaStore.ExtraOutput, _imagePath);
                    cameraIntents.Add(intent);
                }
                chooserIntent.PutExtra(Intent.ExtraInitialIntents, cameraIntents.Cast<IParcelable>().ToArray());
            }

            imageChooserTcs = new TaskCompletionSource<Stream>();
            activity.StartActivityForResult(chooserIntent, ImagePickerCode);

            GC.Collect();
            Java.Lang.Runtime.GetRuntime().Gc();

            return imageChooserTcs.Task;
        }

        public void SetActivityResult(int requestCode, Result resultCode, Intent data)
        {
            var context = contextFactory();
            if (context == null) return;

            if (requestCode == ImagePickerCode)
            {
                if (imageChooserTcs == null) return;
                if (resultCode != Result.Ok)
                {
                    imageChooserTcs.TrySetResult(null); return;
                }

                var selectedImageUri = data?.Data ?? _imagePath;
                if (selectedImageUri == null)
                {
                    imageChooserTcs.TrySetResult(null); return;
                }

                try
                {
                    using (var input = new DelegateStream(() => context.ContentResolver.OpenInputStream(selectedImageUri)))
                    using (var output = context.ContentResolver.OpenOutputStream(_compressedPath, "w"))
                    using (var bitmap = CreateBitmap(input, _maxSize))
                    {
                        if (bitmap == null)
                        {
                            imageChooserTcs.TrySetResult(null);
                            return;
                        }

                        try
                        {
                            if (!bitmap.Compress(Bitmap.CompressFormat.Jpeg, 80, output))
                            {
                                imageChooserTcs.TrySetResult(null);
                                return;
                            }
                        }
                        finally
                        {
                            bitmap.Recycle();
                        }
                    }

                    var compressed = _compressedPath;

                    imageChooserTcs.TrySetResult(new DelegateStream(
                        () => context.ContentResolver.OpenInputStream(compressed),
                        () => new Java.IO.File(compressed.Path).Delete()));
                }
                catch
                {
                    imageChooserTcs.TrySetResult(null);
                }
                finally
                {
                    if (_imagePath == selectedImageUri)
                    {
                        new Java.IO.File(selectedImageUri.Path).Delete();
                    }

                    GC.Collect();
                    Java.Lang.Runtime.GetRuntime().Gc();
                }
            }
        }

        public static Bitmap CreateBitmap(Stream stream, int maxPixelSize)
        {
            try
            {
                var op = new BitmapFactory.Options { InJustDecodeBounds = true };
                BitmapFactory.DecodeStream(stream, null, op);
                stream.Seek(0, SeekOrigin.Begin);
                var sampleSize = ComputeSampleSize(op, -1, maxPixelSize * maxPixelSize);
                return BitmapFactory.DecodeStream(stream, null, new BitmapFactory.Options { InSampleSize = sampleSize });
            }
            catch
            {
                return null;
            }
        }

        public static Bitmap CreateBitmap(string file, int maxPixelSize)
        {
            try
            {
                var op = new BitmapFactory.Options { InJustDecodeBounds = true };
                BitmapFactory.DecodeFile(file, op);
                var sampleSize = ComputeSampleSize(op, -1, maxPixelSize * maxPixelSize);
                return BitmapFactory.DecodeFile(file, new BitmapFactory.Options { InSampleSize = sampleSize });
            }
            catch
            {
                return null;
            }
        }

        private static int ComputeSampleSize(BitmapFactory.Options options, int minSideLength, int maxNumOfPixels)
        {
            int initialSize = ComputeInitialSampleSize(options, minSideLength, maxNumOfPixels);
            int roundedSize;
            if (initialSize <= 8)
            {
                roundedSize = 1;
                while (roundedSize < initialSize)
                {
                    roundedSize <<= 1;
                }
            }
            else
            {
                roundedSize = (initialSize + 7) / 8 * 8;
            }

            return roundedSize;
        }

        private static int ComputeInitialSampleSize(BitmapFactory.Options options, int minSideLength, int maxNumOfPixels)
        {
            double w = options.OutWidth;
            double h = options.OutHeight;

            int lowerBound = (maxNumOfPixels == -1) ? 1 : (int)Math.Ceiling(Math.Sqrt(w * h / maxNumOfPixels));
            int upperBound = (minSideLength == -1) ? 128 : (int)Math.Min(Math.Floor(w / minSideLength), Math.Floor(h / minSideLength));

            if (upperBound < lowerBound)
            {
                // return the larger one when there is no overlapping zone.
                return lowerBound;
            }

            if ((maxNumOfPixels == -1) && (minSideLength == -1))
            {
                return 1;
            }
            else if (minSideLength == -1)
            {
                return lowerBound;
            }
            else
            {
                return upperBound;
            }
        }

        public async Task<string> SaveImageToLibrary(Stream image, string filename)
        {
            var context = contextFactory();
            if (context == null) return null;
            if (string.IsNullOrEmpty(filename)) throw new ArgumentException(nameof(filename));

            var root = Android.OS.Environment.ExternalStorageDirectory;
            var imagePath = System.IO.Path.Combine(root.AbsolutePath, filename);
            var directory = System.IO.Path.GetDirectoryName(imagePath);
            if (!Directory.Exists(directory)) Directory.CreateDirectory(directory);
            var imageFile = new Java.IO.File(imagePath);
            if (!imageFile.Exists()) imageFile.CreateNewFile();

            using (var file = new Java.IO.FileOutputStream(imageFile))
            {
                var bytes = new byte[image.Length];
                image.Read(bytes, 0, bytes.Length);
                file.Write(bytes, 0, bytes.Length);
                file.Flush();
            }

            image.Seek(0, SeekOrigin.Begin);
            var bitmap = await BitmapFactory.DecodeStreamAsync(image);

            MediaStore.Images.Media.InsertImage(context.ContentResolver, bitmap, imageFile.Name, "");
            context.SendBroadcast(new Intent(Intent.ActionMediaScannerScanFile, Android.Net.Uri.Parse("file://" + root)));

            return imageFile.AbsolutePath;
        }

        private bool _trimAudioZeros;
        private AudioRecord _recorder;
        private MemoryStream _audioCaptureStream;
        private byte[] _audioBuffer = new byte[10240];
        private static readonly string _recorderFile = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments) + "LastRecorded.wav";

        public Task<bool> BeginCaptureAudio()
        {
            if (_recorder != null)
            {
                _recorder.Release();
                _recorder.Dispose();
            }

            _audioCaptureStream = new MemoryStream();
            MediaHelper.WriteWavHeader(_audioCaptureStream, MediaHelper.DefaultAudioSamplingRate);

            _recorder = new AudioRecord(AudioSource.Mic, MediaHelper.DefaultAudioSamplingRate, ChannelIn.Mono, Encoding.Pcm16bit, _audioBuffer.Length);

            if (_recorder.State != State.Initialized)
            {
                _recorder = null;
                return Task.FromResult(false);
            }

            _recorder.StartRecording();
            _trimAudioZeros = true;

            ReadAudioBufferAsync();
            return Task.FromResult(true);
        }

        private async void ReadAudioBufferAsync()
        {
            try
            {
                while (_recorder != null)
                {
                    // Ensure we are on the UI thread.
                    var read = await _recorder.ReadAsync(_audioBuffer, 0, _audioBuffer.Length);

                    if (read <= 0 || _audioCaptureStream == null) break;

                    var offset = TrimAudioZeros(read);
                    if (read > offset)
                    {
                        _audioCaptureStream.Write(_audioBuffer, offset, read - offset);
                    }
                }
            }
            catch { }
        }

        private int TrimAudioZeros(int read)
        {
            var offset = 0;
            if (_trimAudioZeros)
            {
                _trimAudioZeros = false;
                while (offset < read && _audioBuffer[offset] == 0) offset++;
            }
            return offset;
        }

        public Stream EndCaptureAudio()
        {
            if (_recorder != null)
            {
                var read = _recorder.Read(_audioBuffer, 0, _audioBuffer.Length);
                var offset = TrimAudioZeros(read);

                _recorder.Stop();

                var audioStream = _audioCaptureStream;
                _audioCaptureStream = null;

                if (read > offset) audioStream.Write(_audioBuffer, offset, read - offset);

                _recorder.Release();
                _recorder.Dispose();
                _recorder = null;

                MediaHelper.UpdateWavHeader(audioStream);

                audioStream.Seek(0, SeekOrigin.Begin);
                return audioStream;
            }
            return null;
        }

        private MediaPlayer _player;
        private TaskCompletionSource<bool> _playerTcs;

        public Task PlaySound(string uri)
        {
            StopSound();

            var player = new MediaPlayer();
            var playerTcs = new TaskCompletionSource<bool>();

            player.Error += (sender, e) => StopSound();
            player.Completion += (sender, e) => { playerTcs.TrySetResult(false); StopSound(); };
            player.Prepared += (sender, e) => player.Start();

            player.SetDataSource(uri);
            player.PrepareAsync();

            _player = player;
            _playerTcs = playerTcs;

            return playerTcs.Task;
        }

        public void StopSound()
        {
            if (_player != null)
            {
                _playerTcs.TrySetResult(true);
                _player.Stop();
                _player.Release();
                _player.Dispose();
                _player = null;
            }
        }
    }
}


text:
class API::V1::ListItemsController < ApplicationController

  # GET /list_items
  def index
    @list_items = ListItem.all
    render json: @list_items
  end

  # POST /lists/:list_id
  def create
    @list = List.find(params[:list_id])
    @list_item = @list.list_items.build(list_item_params)

    if @list.save

      #firehose pub
      #rely on AMS to create our JSON response properly. Since we need AMS outside of the render: json call we use the Serializer call directly
      json = ListItemSerializer.new(@list_item).to_json
      json = JSON.parse(json)
      #can't figure out how to get AMS to remove the root (i.e. root: false) when calling the Serializer method directly. Brute force remove the root here
      json = json["list_item"]
      #add our customer attributes that are only used by the Firehose clients
      json["action"] = "add"
      json["cid"] = params[:cid]
      json = json.to_json
      #configure the Firehose Producer
      firehose = Firehose::Client::Producer::Http.new('//127.0.0.1:7474')
      #fire the pub to the specific list using the list_id. The JS clients will only sub to this specific list_id (i.e. channel)
      firehose.publish(json).to("/live_list/"+params[:list_id])

      render json: json, status: :created
    else
      render json: @list.errors, status: :unprocessable_entity
    end
  end

  # PATCH /lists/:list_id/:list_item_id
  def update

    @list = List.find(params[:list_id])
    p = list_item_params
    action_id = SecureRandom.uuid

    # hack to not update the "selected" attribute in the DB, just communicate it to the clients
    if(params[:selected])
      message = {cid: params[:cid], action: "select", id: params[:list_item_id]}
      json = message.to_json
      firehose = Firehose::Client::Producer::Http.new('//127.0.0.1:7474')
      firehose.publish(json).to("/live_list/"+params[:list_id])
    else
      p[:id] = params[:list_item_id]
      #random uuid for this particular action. This is used because Firehose will send the most recent message when you reload the page and if we include the ID upon page reload we don't reapply an update that has already been applied.
      p[:action_id] = action_id
      @list.list_items_attributes = [p]

      if @list.save
        p[:cid] = params[:cid]
        p[:action] = "update"
        json = p.to_json
        firehose = Firehose::Client::Producer::Http.new('//127.0.0.1:7474')
        firehose.publish(json).to("/live_list/"+params[:list_id])

        render json: p, status: :created
      else
        render json: {response: "error"}, status: :unprocessable_entity
      end
    end

  end

  # DELETE /list/:list_id/:list_item_id
  def delete

    @list = List.find(params[:list_id])
    p = list_item_params
    p[:id] = params[:list_item_id]
    p[:_destroy] = 1

    @list.list_items_attributes = [ p ]

    if @list.save
      p[:cid] = params[:cid]
      p[:action] = "delete"
      json = p.to_json
      firehose = Firehose::Client::Producer::Http.new('//127.0.0.1:7474')
      firehose.publish(json).to("/live_list/"+params[:list_id])

      head :no_content
    else
      render json: {response: "error"}, status: :unprocessable_entity
    end
  end

  # PATCH /lists/:list_id/:list_item_id/control
  def update_control
    @list = List.find(params[:list_id])

    #action_id = SecureRandom.uuid
    action = Hash.new
    updated_items = []

    #if(@list.active_list_item != params[:list_item_id])
      if(!@list.active_list_item.blank?)
        @prev_item = @list.list_items.where(id: @list.active_list_item).first
        #render json: @prev_item and return
      else #previously active item is blank meaning this list was just created. So assign the index 1 as previousl active.
        #this line find the lowest index in the list. Since there should always be an index 1 we don't need this now
        #@prev_item = @list.list_items.min(:index)
        #instead just assume that index one is the "previous active"
        @prev_item = @list.list_items.where(index: 1).first

      end
    #end

    @active_item = @list.list_items.where(id: params[:list_item_id]).first
    @active_item.state = params[:state]

    #set the high level active list item
    @list.update_attributes(active_list_item: params[:list_item_id])

    updated_items.push({id: @active_item.id, state: params[:state]})

    if(@prev_item.index < @active_item.index)
      state = "post_active"
      #find items between prev_active and newly active
      @in_between_items = @list.list_items.gte(index: @prev_item.index).lt(index: @active_item.index)
    elsif(@prev_item.index > @active_item.index)
      state = "pre_active"
      #find items between prev_active and newly active
      @in_between_items = @list.list_items.lte(index: @prev_item.index).gt(index: @active_item.index)
    end

    if(!@in_between_items.blank?)
      render json: @in_between_items and return
      @in_between_items.each do |item|
        updated_items << {id: item.id, state: state}
      end

      #random uuid for this particular action. This is used because Firehose will send the most recent message when you reload the page and if we include the ID upon page reload we don't reapply an update that has already been applied.
      #p[:action_id] = action_id
      @list.list_items_attributes = updated_items
    end

    if @list.save
      action[:cid] = params[:cid]
      action[:action] = "update_control"
      action[:updated_items] = updated_items
      json = action.to_json
      firehose = Firehose::Client::Producer::Http.new('//127.0.0.1:7474')
      firehose.publish(json).to("/live_list/"+params[:list_id])

      render json: action, status: :created
    else
      render json: {response: "error"}, status: :unprocessable_entity
    end

  end

  private

    def list_item_params
      params.permit(:index, :order, :title, :list_type, :id, :state)
    end

end


text:
/*
 * ScriptImageComparison.java
 *
 * Created on December 14, 2008, 7:08 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package scripteditor;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

/**
 *
 * @author Ben
 */
public class ScriptImageComparison extends IQImageComparison {
    String mScriptName;
    String mSessionName;
    String mScriptFileName;

    /** Creates a new instance of ScriptImageComparison */
    public ScriptImageComparison(Component parentForm, JLabel displayLabel, String[][] fileNames, double delay, String taxLevel,
                String[] taxa, JPanel p, ActionListener al, String name, boolean test_mode, ImageCollection ic, ProgressClass pc,
                String ScriptName, String SessionName, String scriptFileName) {
        super (parentForm, displayLabel, fileNames, delay, taxLevel, taxa, p, al, name, test_mode, ic, pc);
        mScriptName = ScriptName;
        mSessionName = SessionName;
        mScriptFileName = scriptFileName;
    }

    @Override
       public void SaveResult(){
        ScriptResult rs;

        rs = new ScriptResult("Image Comparison", mTaxLevel, mTaxa, mUserName,
                    mGrade.getGradeInstance().FinalGrade(), mScriptName, mSessionName,  mGrade.getGradeInstance().TotalQuestions(),
                    myCollection.NumberOfImages()/ 2, mScriptFileName);
        rs.writeResults();
    }
}


text:
SYNONYM

#### According to
IRMNG Homonym List

#### Published in
in Engler & Prantl, Nat. Pflanzenfam. (Leipzig), Teil. <b>I</b> 1**: 284 (1898)

#### Original name
Clathrella E. Fischer in Engler & Prantl, 1898

### Remarks
null