text:
package org.apache.lucene.search;

import java.io.IOException;
import java.util.concurrent.atomic.AtomicBoolean;

import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.AtomicReaderContext;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.Term;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
import org.junit.AfterClass;
import org.junit.BeforeClass;

/**
 * Tests coord() computation by BooleanQuery
 */
public class TestBooleanCoord extends LuceneTestCase {
  static Directory dir;
  static DirectoryReader reader;
  static IndexSearcher searcher;

  @BeforeClass
  public static void beforeClass() throws Exception {
    dir = newDirectory();
    IndexWriter iw = new IndexWriter(dir, new IndexWriterConfig(TEST_VERSION_CURRENT, null));

    // we only add two documents for testing:
    // the first document has 3 terms A,B,C (for positive matching). we test scores against this.
    // the second document has 3 negative terms 1,2,3 that exist in the segment (for non-null scorers)
    // to test terms that don't exist (null scorers), we use X,Y,Z

    Document doc = new Document();
    doc.add(new StringField("field", "A", Field.Store.NO));
    doc.add(new StringField("field", "B", Field.Store.NO));
    doc.add(new StringField("field", "C", Field.Store.NO));
    iw.addDocument(doc);

    doc = new Document();
    doc.add(new StringField("field", "1", Field.Store.NO));
    doc.add(new StringField("field", "2", Field.Store.NO));
    doc.add(new StringField("field", "3", Field.Store.NO));
    iw.addDocument(doc);

    iw.close();
    reader = DirectoryReader.open(dir);
    searcher = new IndexSearcher(reader);
    // we set a similarity that just returns 1, the idea is to test coord
    searcher.setSimilarity(new Similarity() {
      @Override
      public float coord(int overlap, int maxOverlap) {
        return overlap / (float)maxOverlap;
      }

      @Override
      public long computeNorm(FieldInvertState state) {
        throw new AssertionError();
      }

      @Override
      public SimWeight computeWeight(float queryBoost, CollectionStatistics collectionStats, TermStatistics... termStats) {
        return new SimWeight() {
          @Override
          public float getValueForNormalization() {
            return 1f;
          }

          @Override
          public void normalize(float queryNorm, float topLevelBoost) {}
        };
      }

      @Override
      public SimScorer simScorer(SimWeight weight, AtomicReaderContext context) throws IOException {
        return new SimScorer() {
          @Override
          public float score(int doc, float freq) {
            return 1;
          }

          @Override
          public float computeSlopFactor(int distance) {
            throw new AssertionError();
          }

          @Override
          public float computePayloadFactor(int doc, int start, int end, BytesRef payload) {
            throw new AssertionError();
          }
        };
      }
    });
  }

  @AfterClass
  public static void afterClass() throws Exception {
    reader.close();
    reader = null;
    dir.close();
    dir = null;
    searcher = null;
  }

  // disjunctions

  public void testDisjunction1TermMatches() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/1f, bq);
  }

  public void testDisjunction2TermMatches() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 1/1f, bq);
  }

  public void testDisjunction1OutOf2() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/2f, bq);
  }

  public void testDisjunction1OutOf2Missing() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/2f, bq);
  }

  public void testDisjunction1OutOf3() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("2"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/3f, bq);
  }

  public void testDisjunction1OutOf3MissingOne() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/3f, bq);
  }

  public void testDisjunction1OutOf3MissingTwo() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("Y"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/3f, bq);
  }

  public void testDisjunction2OutOf3() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 2/3f, bq);
  }

  public void testDisjunction2OutOf3Missing() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 2/3f, bq);
  }

  // disjunctions with coord disabled

  public void testDisjunction1TermMatchesCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testDisjunction2TermMatchesCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  public void testDisjunction1OutOf2CoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testDisjunction1OutOf2MissingCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testDisjunction1OutOf3CoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("2"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testDisjunction1OutOf3MissingOneCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testDisjunction1OutOf3MissingTwoCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("Y"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testDisjunction2OutOf3CoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  public void testDisjunction2OutOf3MissingCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  // minShouldMatch
  public void testMinShouldMatch1TermMatches() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/1f, bq);
  }

  public void testMinShouldMatchn2TermMatches() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 1/1f, bq);
  }

  public void testMinShouldMatch1OutOf2() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/2f, bq);
  }

  public void testMinShouldMatch1OutOf2Missing() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/2f, bq);
  }

  public void testMinShouldMatch1OutOf3() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("2"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/3f, bq);
  }

  public void testMinShouldMatch1OutOf3MissingOne() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/3f, bq);
  }

  public void testMinShouldMatch1OutOf3MissingTwo() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("Y"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/3f, bq);
  }

  public void testMinShouldMatch2OutOf3() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(2);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 2/3f, bq);
  }

  public void testMinShouldMatch2OutOf3Missing() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(2);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 2/3f, bq);
  }

  public void testMinShouldMatch2OutOf4() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(2);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("2"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 2/4f, bq);
  }

  public void testMinShouldMatch2OutOf4Missing() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(2);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 2/4f, bq);
  }

  // minShouldMatch with coord disabled

  public void testMinShouldMatch1TermMatchesCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testMinShouldMatch2TermMatchesCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  public void testMinShouldMatch1OutOf2CoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testMinShouldMatch1OutOf2MissingCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testMinShouldMatch1OutOf3CoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("2"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testMinShouldMatch1OutOf3MissingOneCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testMinShouldMatch1OutOf3MissingTwoCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("Y"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testMinShouldMatch2OutOf3CoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(2);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  public void testMinShouldMatch2OutOf3MissingCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(2);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  public void testMinShouldMatch2OutOf4CoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(2);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("2"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  public void testMinShouldMatch2OutOf4MissingCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(2);
    bq.add(term("A"), BooleanClause.Occur.SHOULD);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  // conjunctions

  public void testConjunction1TermMatches() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.MUST);
    assertScore(1 * 1/1f, bq);
  }

  public void testConjunction1TermMatches1Prohib() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("1"), BooleanClause.Occur.MUST_NOT);
    assertScore(1 * 1/1f, bq);
  }

  public void testConjunction1TermMatches2Prohib() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("1"), BooleanClause.Occur.MUST_NOT);
    bq.add(term("2"), BooleanClause.Occur.MUST_NOT);
    assertScore(1 * 1/1f, bq);
  }

  public void testConjunction2TermMatches() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.MUST);
    assertScore(2 * 1/1f, bq);
  }

  // conjunctions coord disabled

  public void testConjunction1TermMatchesCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    assertScore(1, bq);
  }

  public void testConjunction1TermMatches1ProhibCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("1"), BooleanClause.Occur.MUST_NOT);
    assertScore(1, bq);
  }

  public void testConjunction1TermMatches2ProhibCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("1"), BooleanClause.Occur.MUST_NOT);
    bq.add(term("2"), BooleanClause.Occur.MUST_NOT);
    assertScore(1, bq);
  }

  public void testConjunction2TermMatchesCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.MUST);
    assertScore(2, bq);
  }

  // optional + mandatory mix
  public void testMix2TermMatches() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 2/2f, bq);
  }

  public void testMixMatch1OutOfTwo() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/2f, bq);
  }

  public void testMixMatch1OutOfTwoMissing() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/2f, bq);
  }

  public void testMixMatch1OutOfThree() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("2"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/3f, bq);
  }

  public void testMixMatch1OutOfThreeOneMissing() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/3f, bq);
  }

  public void testMixMatch2OutOfThree() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 2/3f, bq);
  }

  public void testMixMatch2OutOfThreeMissing() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 2/3f, bq);
  }

  public void testMix2TermMatchesCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  public void testMixMatch1OutOfTwoCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testMixMatch1OutOfTwoMissingCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testMixMatch1OutOfThreeCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("2"), BooleanClause.Occur.SHOULD);
    assertScore(1, bq);
  }

  public void testMixMatch1OutOfThreeOneMissingCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(1 * 1/3f, bq);
  }

  public void testMixMatch2OutOfThreeCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  public void testMixMatch2OutOfThreeMissingCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  // min should match + mandatory mix

  public void testMixMinShouldMatch2OutOfThree() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 2/3f, bq);
  }

  public void testMixMinShouldMatch2OutOfThreeMissing() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(2 * 2/3f, bq);
  }

  public void testMixMinShouldMatch3OutOfFour() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(2);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("C"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(3 * 3/4f, bq);
  }

  public void testMixMinShouldMatch3OutOfFourMissing() throws Exception {
    BooleanQuery bq = new BooleanQuery();
    bq.setMinimumNumberShouldMatch(2);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("C"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(3 * 3/4f, bq);
  }

  public void testMixMinShouldMatch2OutOfThreeCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  public void testMixMinShouldMatch2OutOfThreeMissingCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(1);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(2, bq);
  }

  public void testMixMinShouldMatch3OutOfFourCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(2);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("C"), BooleanClause.Occur.SHOULD);
    bq.add(term("1"), BooleanClause.Occur.SHOULD);
    assertScore(3, bq);
  }

  public void testMixMinShouldMatch3OutOfFourMissingCoordDisabled() throws Exception {
    BooleanQuery bq = new BooleanQuery(true);
    bq.setMinimumNumberShouldMatch(2);
    bq.add(term("A"), BooleanClause.Occur.MUST);
    bq.add(term("B"), BooleanClause.Occur.SHOULD);
    bq.add(term("C"), BooleanClause.Occur.SHOULD);
    bq.add(term("Z"), BooleanClause.Occur.SHOULD);
    assertScore(3, bq);
  }

  /** asserts score for our single matching good doc */
  private void assertScore(final float expected, Query query) throws Exception {
    // test in-order
    Weight weight = searcher.createNormalizedWeight(query);
    Scorer scorer = weight.scorer(reader.leaves().get(0), null);
    assertTrue(scorer.docID() == -1 || scorer.docID() == DocIdSetIterator.NO_MORE_DOCS);
    assertEquals(0, scorer.nextDoc());
    assertEquals(expected, scorer.score(), 0.0001f);

    // test out-of-order (if supported)
    if (weight.scoresDocsOutOfOrder()) {
      final AtomicBoolean seen = new AtomicBoolean(false);
      BulkScorer bulkScorer = weight.bulkScorer(reader.leaves().get(0), false, null);
      assertNotNull(bulkScorer);
      bulkScorer.score(new Collector() {
        Scorer scorer;

        @Override
        public void setScorer(Scorer scorer) throws IOException {
          this.scorer = scorer;
        }

        @Override
        public void setNextReader(AtomicReaderContext context) throws IOException {}

        @Override
        public void collect(int doc) throws IOException {
          assertFalse(seen.get());
          assertEquals(0, doc);
          assertEquals(expected, scorer.score(), 0.0001f);
          seen.set(true);
        }

        @Override
        public boolean acceptsDocsOutOfOrder() {
          return true;
        }
      }, 1);
      assertTrue(seen.get());
    }

    // test the explanation
    Explanation expl = weight.explain(reader.leaves().get(0), 0);
    assertEquals(expected, expl.getValue(), 0.0001f);
  }

  private Query term(String s) {
    return new TermQuery(new Term("field", s));
  }
}


text:
/*! Modified from John Doherty's MIT-licensed https://github.com/john-doherty/swiped-events */
(() => {
  'use strict';

  const THRESHOLD = 100;
  const TIMEOUT = 500;

  let downX: number | null = null;
  let downY: number | null = null;
  let diffX = 0;
  let diffY = 0;
  let timeDown: number | null = null;
  let startElement: EventTarget | null = null;

  if (typeof window.CustomEvent !== 'function') {
    // @ts-ignore
    window.CustomEvent = (event: string, params: any) => {
      params = params || { bubbles: false, cancelable: false, detail: undefined };
      const e = document.createEvent('CustomEvent');
      e.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
      return e;
    };

    // @ts-ignore
    window.CustomEvent.prototype = window.Event.prototype;
  }

  function handleTouchEnd(e: TouchEvent) {
    if (startElement !== e.target) return;

    const timeDiff = Date.now() - timeDown!;
    let eventType = '';

    if (Math.abs(diffX) > Math.abs(diffY)) {
      if (Math.abs(diffX) > THRESHOLD && timeDiff < TIMEOUT) {
        if (diffX > 0) {
          eventType = 'swiped-left';
        } else {
          eventType = 'swiped-right';
        }
      }
    } else {
      if (Math.abs(diffY) > THRESHOLD && timeDiff < TIMEOUT) {
        if (diffY > 0) {
          eventType = 'swiped-up';
        } else {
          eventType = 'swiped-down';
        }
      }
    }

    if (eventType) {
      startElement!.dispatchEvent(new CustomEvent(eventType, { bubbles: true, cancelable: true }));
    }

    downX = null;
    downY = null;
    timeDown = null;
  }

  function handleTouchStart(e: TouchEvent) {
    const board = document.getElementById('board');
    if (board && board.contains(e.target! as Node)) return;

    startElement = e.target;

    timeDown = Date.now();
    downX = e.touches[0].clientX;
    downY = e.touches[0].clientY;
    diffX = 0;
    diffY = 0;
  }

  function handleTouchMove(e: TouchEvent) {
    if (!downX || !downY) return;
    diffX = downX - e.touches[0].clientX;
    diffY = downY - e.touches[0].clientY;
  }

  document.addEventListener('touchstart', handleTouchStart, false);
  document.addEventListener('touchmove', handleTouchMove, false);
  document.addEventListener('touchend', handleTouchEnd, false);
})();

redpajama_set_name: RedPajamaGithub


text:
import logging
from django.apps import AppConfig
from slacker import Slacker
from slacker import Error as SlackError
from .models import SharedChannel

logger = logging.getLogger('basicLogger')

class WebsiteConfig(AppConfig):
    def ready(self):
        for ch in SharedChannel.objects.all():
            slack = Slacker(ch.local_team.app_access_token)

            try:
                local_channels = slack.channels.list().body['channels']
            except SlackError as e:
                logger.info('Deleting team "{}": {}'.format(ch.local_team.team_id, e))
                ch.local_team.delete()
                continue

            local_channels = [x['id'] for x in local_channels]

            if ch.channel_id not in local_channels:
                logger.info('Team {} does not have channel "{}"'.format(ch.local_team.team_id, ch.channel_id))
                ch.delete()


text:
import pytest
from selenium import webdriver
from selenium.test.selenium.common import utils
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities

@pytest.fixture(autouse=True)
def server(request):
    utils.start_server(request)

    def fin():
        utils.stop_server(request)
    request.addfinalizer(fin)

@pytest.fixture
def capabilities():
    return DesiredCapabilities.FIREFOX.copy()

@pytest.yield_fixture
def driver(capabilities, profile):
    driver = webdriver.Remote(
        desired_capabilities=capabilities,
        browser_profile=profile)
    yield driver
    driver.quit()

@pytest.fixture
def profile():
    profile = webdriver.FirefoxProfile()
    profile.set_preference('browser.startup.homepage', 'about:')
    profile.update_preferences()
    return profile

def test_profile_is_used(driver):
    assert 'about:' == driver.current_url


text:
#ifndef __TEXUTIL__H

#define __TEXUTIL__H

//
//	Misc. noise functions from Texturing and Modeling A Procedural Approach
//  Perlin, Musgrave...
//

CoreExport float bias(float a, float b);
CoreExport float gain(float a, float b);
CoreExport float clamp(float x, float a, float b);

CoreExport float boxstep(float a, float b, float x); // linear from (a,0) to (b,1)
CoreExport float smoothstep(float a, float b, float x);  // Hermite cubic from (a,0) to (b,1)
CoreExport float mod(float x, float m); // returns x Mod m, handles negatives correctly
CoreExport int mod(int x, int m); // returns x Mod m, handles negatives correctly

// This function makes a sort of straight segment S curve.
// sramp() is a for x < a-d and b for x > b+d.
// for a+d < x < b-d sramp(x) = x
// for a-d < x < a+d sramp makes a smooth transition (parabolic) from
//     sramp' = 0 to sramp' = 1
// for b-d < x < b+d sramp makes a smooth transition (parabolic) from
//     sramp' = 1 to sramp' = 0
CoreExport float sramp(float x,float a, float b, float d);

// returns 0 if x<a, 1 if x>b otherwise x.
CoreExport float threshold(float x,float a, float b);

CoreExport void  setdebug(int i);
CoreExport float noise1(float arg);
CoreExport float noise2(Point2 p);
CoreExport float noise3(Point3 p);
CoreExport float noise4(Point3 p,float time);

// This is 3DStudio's Noise function: its only slightly different from noise3:
//  scaled up by factor of 1.65 and clamped to -1,+1.
CoreExport float noise3DS(Point3 p);

CoreExport float turbulence(Point3& p, float freq);

CoreExport int Perm(int v);

#define MAX_OCTAVES	50
CoreExport float fBm1(float  point, float H, float lacunarity, float octaves);
CoreExport float fBm1(Point2 point, float H, float lacunarity, float octaves);
CoreExport float fBm1(Point3 point, float H, float lacunarity, float octaves);

CoreExport float spline(float x, int nknots, float *knot);

CoreExport Color color_spline(float x, int nknots, Color *knot);

// faster version of floor
inline int FLOOR( float x) { return ((int)(x)-((x)<0.0f)); }

inline float frac(float x) { return x - (float)FLOOR(x); }
inline float fmax(float x, float y) { return x>y?x:y;	}
inline float fmin(float x, float y) { return x<y?x:y;	}

// Macro to map it into interval [0,1]
#define NOISE(p) ((1.0f+noise3DS(p))*.5f)

// alpha-composite ctop on top of cbot, assuming pre-multiplied alpha
inline AColor AComp(AColor cbot, AColor ctop) {
	float ia = 1.0f - ctop.a;
	return (ctop + ia*cbot);
	}

//-----------------------------------------------------------
// Based on: A Cellular Basis Function
//                   Steven Worley
//
// SIGGRAPH 1996 Conference Procedings
//
#define MAX_CELL_LEVELS	20

CoreExport void CellFunction(Point3 v,int n,float *dist,int *celIDs=NULL,Point3 *grads=NULL,float gradSmooth=0.0f);
CoreExport void FractalCellFunction(Point3 v,float iterations, float lacunarity,int n,float *dist,int *celIDs=NULL,Point3 *grads=NULL,float gradSmooth=0.0f);
CoreExport float RandFromCellID(int id);

#endif


text:
name 'rvm_fw'
maintainer 'Steven Haddox'
maintainer_email 'steven.haddox@gmail.com'
license 'MIT'
description 'Installs common ruby packages and RVM via RVM::FW'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
source_url 'https://github.com/stevenhaddox/cookbook-rvm_fw'
issues_url 'https://github.com/stevenhaddox/cookbook-rvm_fw/issues'
version '1.0.0'

recipe 'rvm_fw::default', 'Install RVM via RVM::FW server'

depends 'build-essential'
depends 'apt'

supports 'centos'
supports 'fedora'
supports 'redhat'
supports 'debian'
supports 'ubuntu'
supports 'scientific'


text:
Zoho Invoice API accessor with ActiveResource

## Installation

Add this line to your application's Gemfile:

    gem 'activeresource-zoho_invoice'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install activeresource-zoho_invoice

## Usage

    class Invoice < ZohoInvoiceResource::Invoice
      self.auth_params = {
        apikey:    'apikeyishere',
        authtoken: 'authtokenishere',
        scope:     'invoiceapi'
      }
    end

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
require 'spec_helper'

describe '#533 specify status codes' do
  include_context "#{MODEL_PARSER} swagger example"

  let(:app) do
    Class.new(Grape::API) do
      namespace :issue_533 do
        desc 'Get a list of stuff',
             success: { code: 202, model: Entities::UseResponse, message: 'a changed status code' }
        get do
          status 202
          { foo: 'that is the response' }
        end

        desc 'Post some stuff',
             success: { code: 202, model: Entities::UseResponse, message: 'a changed status code' }
        post do
          status 202
          { foo: 'that is the response' }
        end

        desc 'Post some stuff',
             success: { code: 204, message: 'a changed status code' }
        patch do
          status 204
        end

        desc 'Delete some stuff',
             success: { code: 203 }
        delete do
          status 203
        end
      end

      add_swagger_documentation format: :json
    end
  end

  subject do
    get '/swagger_doc'
    JSON.parse(last_response.body)['paths']['/issue_533']
  end

  let(:get_response) { get '/issue_533' }
  specify { expect(get_response.status).to eql 202 }
  let(:get_response_documentation) { subject['get']['responses'] }
  specify do
    expect(get_response_documentation.keys.first).to eql '202'
    expect(get_response_documentation['202']).to include 'schema'
  end

  let(:post_response) { post '/issue_533' }
  specify { expect(post_response.status).to eql 202 }
  let(:post_response_documentation) { subject['post']['responses'] }
  specify do
    expect(post_response_documentation.keys.first).to eql '202'
    expect(post_response_documentation['202']).to include 'schema'
  end

  let(:patch_response) { patch '/issue_533' }
  specify { expect(patch_response.status).to eql 204 }
  let(:patch_response_documentation) { subject['patch']['responses'] }
  specify do
    expect(patch_response_documentation.keys.first).to eql '204'
    expect(patch_response_documentation['204']).not_to include 'schema'
  end

  let(:delete_response) { delete '/issue_533' }
  specify { expect(delete_response.status).to eql 203 }
  let(:delete_response_documentation) { subject['delete']['responses'] }
  specify do
    expect(delete_response_documentation.keys.first).to eql '203'
    expect(delete_response_documentation['203']).not_to include 'schema'
  end
end


text:
<TITLE>Review for Frequency (2000)</TITLE>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="/ramr.css">

Frequency (2000)

reviewed by
James Sanford

         At one time or another everyone has entertained the idea of
being able to go back and change the past. Usually, these thoughts are
sparked by some kind of regret: "If only I hadn't ordered another
pitcher. . ."; "If only I'd saved my money for tuition instead of buying
that New Kids on the Block box set. . ."; "If only I hadn't moved to
Portage. . ."

 For John Sullivan (Jim Caviezel), the gaping hole in his life
is the absence of his father Frank (Dennis Quaid), a firefighter who
died while battling a blaze 30 years ago. Through a truly cosmic twist
of fate, John gets the opportunity to remedy that, only to learn that
once you start playing with the past, you invariably alter the present
as well.

 That's the premise of "Frequency," a combination
fantasy/tearjerker/thriller with several dizzying twists. It's the first
screenplay of former film industry executive Noah Emmerich, and it all
but overflows with imagination, suspense and big ideas. Ultimately,
Emmerich gets so caught up in his own yarn he writes himself into a
corner, although the flawed finale by no means dampens the rest of the
movie.

 In the same way "The Sixth Sense" managed to be something more
than a spooky horror film, "Frequency" sets itself apart from most
science-fiction by focusing on its human components instead of throwing
a lot of hardware in our faces. If there's no real familial resemblence
between the soft-spoken, dewy-eyed Caviezel (the sensitive,
contemplative soldier in "The Thin Red Line") and the congenial,
devil-may-care Quaid, it's still easy to buy them as father and son
because the actors establish such a wonderful rapport with each other.
Even more impressively, they do this without actually being able to
appear onscreen together: All Caviezel's scenes take place in 1999,
while Quaid's character is still in 1969. They communicate via an old
ham radio set John inherited from Frank.

 As he demonstrated with Edward Norton and Richard Gere in
"Primal Fear," director Gregory Hoblit is not afraid to stand back and
give his performers some room when it's required. Quaid and Caviezel
reward him -- and us -- with thoughtful performances. As realities shift
and relationships change because of John's interference, Hoblit artfully
uses double exposures and slightly blurred images to reflect the
timeline being knocked out of whack.

 The only really objectionable detour in "Frequency" is
Emmerich's inclusion of a plot strand involving a serial killer who
eventually figures prominently in the lives of both heroes. While some
of this is handled innovatively, it eventually overcomplicates an
already tricky storyline and Emmerich is forced to reach into the
reliable old cliche bag to come up with an ending for it. Hoblit adds
insult to injury by slapping a blaring Garth Brooks power-ballad over
top of the final scenes; it's shameless, but it sure isn't "Shameless."

 Those missteps aside, "Frequency" is mostly fun and often
touching. It's surprisingly thought-provoking, too, since it's all but
impossible to leave the theater without asking yourself, "What if I
could reach back in time and save (insert relative or friend of your
choice)?" Maybe he or she could have prevented you from buying that New
Kids collection. James Sanford

The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).

The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.

Please direct comments/criticisms of the review to relevant newsgroups.

Broken URLs inthe reviews are the responsibility of the author.

The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.

Related links: index of all rec.arts.movies.reviews reviews


text:
@echo off
pushd %~dp0
"%VS120COMNTOOLS%..\IDE\mstest" /test:Microsoft.Protocols.TestSuites.MS_WOPI.MS_WOPI_S04_ExclusiveLock.TestCase_S04_TC13_RefreshExclusiveLock_InvalidArgument /testcontainer:..\..\MS-WOPI\TestSuite\bin\Debug\MS-WOPI_TestSuite.dll /runconfig:..\..\MS-WOPI\MS-WOPI.testsettings /unique
pause


text:
function loadTxt()
    {
    var txtLang = document.getElementsByName("txtLang");
    txtLang[0].innerHTML = "Naam";
    txtLang[1].innerHTML = "Waarde";
    txtLang[2].innerHTML = "Standaard";

    var optLang = document.getElementsByName("optLang");
    optLang[0].text = "Ingeschakeld"
    optLang[1].text = "Uitgeschakeld"

    document.getElementById("btnCancel").value = "annuleren";
    document.getElementById("btnInsert").value = "invoegen";
    document.getElementById("btnApply").value = "toepassen";
    document.getElementById("btnOk").value = " ok ";
    }
function writeTitle()
    {
    document.write("<title>Selectievakje</title>")
    }


text:
/**
 * This module is the abstract container for types of output displays. While we plan to make the output display loading
 * mechanism more pluggable, right now, this module serves as the registration output display types and holds the logic
 * for switch between applicable output display through UI.
 */
(function() {
  'use strict';
  var module = angular.module('bk.notebook');

  module.directive('bkCodeCellOutput', function(
      bkUtils, bkOutputDisplayFactory, bkEvaluatorManager) {
    return {
      restrict: "E",
      template: JST["mainapp/components/notebook/codecelloutput"](),
      scope: {
        model: "=",
        evaluatorId: "@"
      },
      controller: function($scope) {
        var _shareMenuItems = [];

        $scope.getOutputResult = function() {
          return $scope.model.result;
        };
        $scope.applicableDisplays = [];
        $scope.$watch('getOutputResult()', function(result) {
          $scope.applicableDisplays = bkOutputDisplayFactory.getApplicableDisplays(result);
          $scope.model.selectedType = $scope.applicableDisplays[0];
        });

        // to be used in bkOutputDisplay
        $scope.outputDisplayModel = {
          getCellModel: function() {
            var result = $scope.getOutputResult();
            if (result && result.type === "BeakerDisplay") {
              return result.object;
            } else {
              return result;
            }
          },
          getDumpState: function() {
            var result = $scope.model.state;
            return result;
          },
          setDumpState: function(s) {
            $scope.model.state = s;
          },
          resetShareMenuItems: function(newItems) {
            _shareMenuItems = newItems;
          },
          getCometdUtil: function() {
            if ($scope.evaluatorId) {
              var evaluator = bkEvaluatorManager.getEvaluator($scope.evaluatorId);
              if (evaluator) {
                return evaluator.cometdUtil;
              }
            }
          }
        };

        $scope.getOutputDisplayType = function() {
          var type = $scope.model.selectedType;
          // if BeakerDisplay, use the inner type instead
          if (type === "BeakerDisplay") {
            var result = $scope.getOutputResult();
            type = result ? result.innertype : "Hidden";
          }
          return type;
        };

        var getElapsedTimeString = function() {
          if ($scope.model.elapsedTime || $scope.model.elapsedTime === 0) {
            var elapsedTime = $scope.model.elapsedTime;
            return "Elapsed time: " + bkUtils.formatTimeString(elapsedTime);
          }
          return "";
        };

        $scope.isShowOutput = function() {
          return $scope.$parent.isShowOutput();
        };

        $scope.toggleExpansion = function() {
          if ($scope.$parent.cellmodel.output.hidden) {
            delete $scope.$parent.cellmodel.output.hidden;
          } else {
            $scope.$parent.cellmodel.output.hidden = true;
          }
        };

        $scope.isExpanded = function() {
          return !$scope.$parent.cellmodel.output.hidden;
        };

        // to be used in output cell menu
        $scope.outputCellMenuModel = (function() {
          var _additionalMenuItems = [
            {
              name: "Share",
              items: function() {
                return _shareMenuItems;
              }
            },
            {
              name: "Toggle Cell Output",
              isChecked: function() {
                $scope.isExpanded();
              },
              action: function() {
                $scope.toggleExpansion();
              }
            },
            {
              name: "Delete",
              action: function() {
                $scope.model.result = undefined;
              }
            },
            {
              name: getElapsedTimeString,
              action: null
            }
          ];
          return {
            getApplicableDisplays: function() {
              return $scope.applicableDisplays;
            },
            getSelectedDisplay: function() {
              return $scope.model.selectedType;
            },
            setSelectedDisplay: function(display) {
              $scope.model.selectedType = display;
            },
            getAdditionalMenuItems: function() {
              return _additionalMenuItems;
            }
          };
        })();
      }
    };
  });

})();


text:
'use strict';

function ignorePost(req, res, next) {}

module.exports = { post: ignorePost };


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.github.davidmoten</groupId>
        <artifactId>sonatype-parent</artifactId>
        <version>0.1</version>
    </parent>

    <artifactId>logan</artifactId>
    <version>0.3.4-SNAPSHOT</version>

    <name>${project.artifactId}</name>
    <description>Log analysis</description>
    <packaging>war</packaging>

    <url>http://github.com/davidmoten/logan</url>

    <properties>
        <scm.url>scm:git:https://github.com/davidmoten/logan.git</scm.url>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <checkstyle.version>3.2.0</checkstyle.version>
        <findbugs.version>3.0.5</findbugs.version>
        <javadoc.version>3.4.1</javadoc.version>
        <pmd.version>3.19.0</pmd.version>
        <jdepend.version>2.0</jdepend.version>
        <javancss.version>2.0</javancss.version>
        <project.info.version>2.4</project.info.version>
        <jxr.version>3.3.0</jxr.version>
        <taglist.version>3.0.0</taglist.version>
        <dashboard.version>1.0.0-beta-1</dashboard.version>
        <m3.site.version>3.12.1</m3.site.version>
        <changelog.version>2.2</changelog.version>
        <coverage.reports.dir>${project.build.directory}/target/coverage-reports</coverage.reports.dir>
        <maven.compiler.target>1.8</maven.compiler.target>
        <jetty.version>9.4.49.v20220914</jetty.version>
        <jetty.stop.port>9998</jetty.stop.port>
        <log.server.url>http://localhost:8080</log.server.url>
        <logan.config>/sample-configuration.xml</logan.config>
        <log.base>/var/logs</log.base>
    </properties>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <ciManagement>
        <system>Travis</system>
        <url>https://travis-ci.org/davidmoten/logan</url>
    </ciManagement>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/davidmoten/logan/issues</url>
    </issueManagement>

    <inceptionYear>2013</inceptionYear>
    <developers>
        <developer>
            <id>dave</id>
            <name>Dave Moten</name>
            <url>https://github.com/davidmoten/</url>
            <roles>
                <role>architect</role>
                <role>developer</role>
            </roles>
            <timezone>+10</timezone>
        </developer>
    </developers>

    <scm>
        <connection>${scm.url}</connection>
        <developerConnection>${scm.url}</developerConnection>
        <url>${scm.url}</url>
        <tag>HEAD</tag>
    </scm>

    <dependencies>
        <dependency>
            <groupId>com.github.davidmoten</groupId>
            <artifactId>bplustree</artifactId>
            <version>0.1.4</version>
        </dependency>

        <dependency>
            <groupId>com.github.davidmoten</groupId>
            <artifactId>jsmaz</artifactId>
            <version>0.1</version>
        </dependency>

        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>23.0</version>
        </dependency>

        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
        </dependency>
        <!-- required for CrossOriginFilter -->
        <!-- <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlets</artifactId>
            <version>${jetty.plugin.version}</version> <scope>provided</scope> </dependency> -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>4.0.1</version>
            <scope>provided</scope>
        </dependency>

        <!-- required for DirectoryScanner -->
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <version>1.10.12</version>
            <exclusions>
                <exclusion>
                    <artifactId>ant-launcher</artifactId>
                    <groupId>org.apache.ant</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>2.1.214</version>
        </dependency>

        <!-- Test Dependencies -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13.2</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>com.github.davidmoten</groupId>
            <artifactId>kool</artifactId>
            <version>0.1.23</version>
        </dependency>

    </dependencies>

    <build>
        <finalName>${project.artifactId}-${project.version}-${git.commit.hash.short}</finalName>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.1</version>
                <configuration>
                    <source>${maven.compiler.target}</source>
                    <target>${maven.compiler.target}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.eclipse.jetty</groupId>
                                    <artifactId>jetty-runner</artifactId>
                                    <version>${jetty.version}</version>
                                    <type>jar</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/</outputDirectory>
                                    <destFileName>jetty-runner.jar</destFileName>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>org.eclipse.jetty</groupId>
                                    <artifactId>jetty-start</artifactId>
                                    <version>${jetty.version}</version>
                                    <type>jar</type>
                                    <overWrite>false</overWrite>
                                    <outputDirectory>${project.build.directory}/</outputDirectory>
                                    <destFileName>start.jar</destFileName>
                                </artifactItem>
                            </artifactItems>
                            <outputDirectory>${project.build.directory}/wars</outputDirectory>
                            <overWriteReleases>false</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.github.davidmoten</groupId>
                <artifactId>git-properties-maven-plugin</artifactId>
                <version>0.2</version>
                <executions>
                    <execution>
                        <id>write-properties</id>
                        <goals>
                            <goal>properties</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>src/assembly/dist.xml</descriptor>
                    </descriptors>
                    <appendAssemblyId>false</appendAssemblyId>
                </configuration>
                <executions>
                    <execution>
                        <id>create-archive</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${javadoc.version}</version>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <failOnError>false</failOnError>
                            <additionalparam>-Xdoclint:none</additionalparam>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty.version}</version>
                <configuration>
                    <scanIntervalSeconds>10</scanIntervalSeconds>
                    <stopKey>foo</stopKey>
                    <stopPort>${jetty.stop.port}</stopPort>
                    <webAppConfig>
                        <contextPath>/</contextPath>
                    </webAppConfig>
                    <systemProperties>
                        <systemProperty>
                            <name>logan.config</name>
                            <value>${logan.config}</value>
                        </systemProperty>
                        <systemProperty>
                            <name>log.base</name>
                            <value>${log.base}</value>
                        </systemProperty>
                        <systemProperty>
                            <name>persist</name>
                            <value>bplustree</value>
                        </systemProperty>
                    </systemProperties>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-site-plugin</artifactId>
                <version>${m3.site.version}</version>
                <executions>
                    <execution>
                        <id>attach-descriptor</id>
                        <goals>
                            <goal>attach-descriptor</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse
                    m2e settings only. It has no influence on the Maven build itself. -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            com.google.code.maven-replacer-plugin
                                        </groupId>
                                        <artifactId>
                                            replacer
                                        </artifactId>
                                        <versionRange>
                                            [1.5.3,)
                                        </versionRange>
                                        <goals>
                                            <goal>replace</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            com.github.davidmoten
                                        </groupId>
                                        <artifactId>
                                            git-properties-maven-plugin
                                        </artifactId>
                                        <versionRange>
                                            [0.1-SNAPSHOT,)
                                        </versionRange>
                                        <goals>
                                            <goal>properties</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <reporting>
        <plugins>
            <!-- this one should go first so that it is available to other
                plugins when they run -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jxr-plugin</artifactId>
                <version>${jxr.version}</version>
                <configuration>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>${checkstyle.version}</version>
                <configuration>
                    <includeTestSourceDirectory>true</includeTestSourceDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-pmd-plugin</artifactId>
                <version>${pmd.version}</version>
                <configuration>
                    <targetJdk>${maven.compiler.target}</targetJdk>
                    <aggregate>true</aggregate>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>${findbugs.version}</version>
                <configuration>
                    <xmlOutput>true</xmlOutput>
                    <effort>Max</effort>
                    <!--<excludeFilterFile>findbugs-exclude-filter-amsa.xml</excludeFilterFile> -->
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jdepend-maven-plugin</artifactId>
                <version>${jdepend.version}</version>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>taglist-maven-plugin</artifactId>
                <version>${taglist.version}</version>
            </plugin>
        </plugins>
    </reporting>
</project>


text:
<?php
namespace Coincheck;

class Account
{
    /** @var Coincheck */
    private $client;

    public function __construct(\Coincheck\Coincheck $client)
    {
        $this->client = $client;
    }

    /**
     * Make sure a balance.
     *
     * @param  mixed
     * @return Json Array
     */
    public function balance($params = array())
    {
        $arr = array();
        $rawResponse = $this->client->request('get', 'api/accounts/balance', $arr);
        return $rawResponse;
    }

    /**
     * Make sure a leverage balance.
     *
     * @param  mixed
     * @return Json Array
     */
    public function leverage_balance($params = array())
    {
        $arr = array();
        $rawResponse = $this->client->request('get', 'api/accounts/leverage_balance', $arr);
        return $rawResponse;
    }

    /**
     * Get account information.
     *
     * @param  mixed
     * @return Json Array
     *
     * */
    public function info($params = array())
    {
        $arr = array();
        $rawResponse = $this->client->request('get', 'api/accounts/balance', $arr);
        return $rawResponse;
    }
}


text:
sample-web
==========

Sample nodejs web server


text:
using RandomForest.Lib;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RandomForest.Lib.Numerical.ItemSet.Feature
{
    class FeatureNumericalManager : RandomIndexer
    {
        Dictionary<string, FeatureNumerical> _features = new Dictionary<string, FeatureNumerical>();

        public event EventHandler<FeatureNumerical> FeatureAdded;
        public event EventHandler<string> FeatureRemoved;
        public event EventHandler FeaturesCleared;

        public bool Add(FeatureNumerical feature)
        {
            _features.Add(feature.Name, feature);
            var featureAdded = FeatureAdded;
            if (featureAdded != null)
                featureAdded(this, feature);
            return true;
        }

        public bool Remove(string featureName)
        {
            _features.Remove(featureName);
            var featureRemoved = FeatureRemoved;
            if (featureRemoved != null)
                featureRemoved(this, featureName);
            return true;
        }

        public FeatureNumerical Get(string featureName)
        {
            if (_features.ContainsKey(featureName))
                return _features[featureName];
            return null;
        }

        public int Count()
        {
            return _features.Count;
        }

        public void Clear()
        {
            _features.Clear();
            var featuresCleared = FeaturesCleared;
            if (featuresCleared != null)
                featuresCleared(this, EventArgs.Empty);
        }

        public List<string> GetFeatureNames()
        {
            return _features.Keys.ToList();
        }

        public List<string> GetFeatureNames(IEnumerable<string> ignore, float subcountRatio = 0)
        {
            List<string> res = new List<string>();
            List<string> ini = null;

            if (ignore != null && ignore.Count() > 0)
            {
                ini = new List<string>();
                foreach(var key in _features.Keys.ToList())
                {
                    if (!ignore.Contains(key))
                        ini.Add(key);
                }
            }
            else
            {
                ini = _features.Keys.ToList();
            }

            if (subcountRatio > 0)
            {
                var idxLst = GetRandomIndeces(ini.Count(), subcountRatio);
                foreach (int idx in idxLst)
                    res.Add(ini[idx]);
            }
            else
            {
                res = ini;
            }

            return res;
        }
    }
}


text:
/*global angular, Image, URL, ImageGrabber, PixelImage, ColorMap, KoalaPicture, Remapper, GraphicModes, ErrorDiffusionDitherer, OrderedDitherers */
angular.module('vicarApp')
    .controller('MainCtrl', [
        '$scope',
        function($scope) {
            'use strict';

            var img = new Image();
            img.src = 'images/eye.png';
            $scope.filename = 'eye';

            // graphic mode selection
            $scope.graphicModes = GraphicModes.all;
            $scope.selectedGraphicMode = $scope.graphicModes[0];

            $scope.selectGraphicMode = function(graphicMode) {
                $scope.selectedGraphicMode = graphicMode;
                convert();
            };

            // ordered dithering selection
            $scope.dithers = OrderedDitherers.all;
            $scope.selectedDither = $scope.dithers[1];

            $scope.selectDither = function(dither) {
                $scope.selectedDither = dither;
                convert();
            };

            // error diffusion dithering selection
            $scope.errorDiffusionDithers = ErrorDiffusionDitherer.all;
            $scope.selectedErrorDiffusionDither = $scope.errorDiffusionDithers[1];

            $scope.selectErrorDiffusionDither = function(errorDiffusionDither) {
                $scope.selectedErrorDiffusionDither = errorDiffusionDither;
                convert();
            };

            // psychedelic mode selection
            $scope.psychedelicModes = [{
                key: 'None',
                value: [1, 1, 1]
            }, {
                key: 'Rainbow',
                value: [1, 0, 0]
            }, {
                key: 'Candy',
                value: [1, 0, 1]
            }, {
                key: 'Forest',
                value: [1, 1, 0]
            }];
            $scope.selectedPsychedelicMode = $scope.psychedelicModes[0];

            $scope.selectPsychedelicMode = function(psychedelicMode) {
                $scope.selectedPsychedelicMode = psychedelicMode;
                convert();
            };

            /**
             * Convert a ColorMap to a PixelImage, for debugging visualisation.
             */

            function toPixelImage(pixelImage, colorMapIndex) {
                var colorMap = pixelImage.colorMaps[colorMapIndex],
                    result = PixelImage.create(colorMap.width, colorMap.height,
                        new ColorMap(colorMap.width, colorMap.height, 1, 1), 1, 1);

                result.pWidth = pixelImage.pWidth;
                result.pHeight = pixelImage.pHeight;
                result.palette = pixelImage.palette;
                result.drawImageData(colorMap.toImageData(result.palette));
                return result;
            }

            /**
             * Convert the current Image to a PixelImage and update the scope.
             * @returns {void}
             */
            function convert() {

                var resultImage = $scope.selectedGraphicMode.value(),
                    grabber = new ImageGrabber(img, resultImage);

                $scope.mainImage = undefined;

                resultImage.dither = $scope.selectedDither.value;
                resultImage.errorDiffusionDither = $scope.selectedErrorDiffusionDither.value;
                resultImage.mappingWeight = $scope.selectedPsychedelicMode.value;

                grabber.grab(
                    function(imageData) {
                        $scope.$evalAsync(function() {
                            new Remapper(resultImage).mapImageData(imageData);
                            $scope.mainImage = resultImage;
                            $scope.download = resultImage.toDownloadUrl();

                            // debug colorMaps
                            $scope.colorMap = [];
                            $scope.colorMap[0] = toPixelImage(resultImage, 0);
                            $scope.colorMap[1] = toPixelImage(resultImage, 1);
                            $scope.colorMap[2] = toPixelImage(resultImage, 2);
                            $scope.colorMap[3] = toPixelImage(resultImage, 3);

                            if ($scope.selectedGraphicMode.key === 'Multicolor') {
                                // make a koala picture to download
                                $scope.koalaLink = KoalaPicture.fromPixelImage(resultImage).toUrl();
                            } else {
                                $scope.koalaLink = undefined;
                            }

                            // debug koala conversion
                            // $scope.koala = KoalaPicture.toPixelImage(koala, resultImage.palette);

                        });
                    }
                );
            }

            $scope.upload = function(file) {
                $scope.filename = file.name;
                img.src = URL.createObjectURL(file);
                img.onload = function() {
                    $scope.$evalAsync(function() {
                        convert();
                    });
                };
            };

            convert();

        }
    ]);


text:
from .__about__ import __version__
from .ecs_fargate import FargateCheck

__all__ = ['__version__', 'FargateCheck']


text:
import http2_base_server

class TestcaseRstStreamDuringData(object):
  """
    In response to an incoming request, this test sends headers, followed by
    some data, followed by a reset stream frame. Client asserts that the RPC
    failed and does not deliver the message to the application.
  """
  def __init__(self):
    self._base_server = http2_base_server.H2ProtocolBaseServer()
    self._base_server._handlers['DataReceived'] = self.on_data_received
    self._base_server._handlers['SendDone'] = self.on_send_done

  def get_base_server(self):
    return self._base_server

  def on_data_received(self, event):
    self._base_server.on_data_received_default(event)
    sr = self._base_server.parse_received_data(event.stream_id)
    if sr:
      response_data = self._base_server.default_response_data(sr.response_size)
      self._ready_to_send = True
      response_len = len(response_data)
      truncated_response_data = response_data[0:response_len/2]
      self._base_server.setup_send(truncated_response_data, event.stream_id)

  def on_send_done(self, stream_id):
    self._base_server.send_reset_stream()
    self._base_server._stream_status[stream_id] = False


text:
<?php
	// index.php
	$homeDir = "../../";
	require_once $homeDir . 'pc_directories.php';
	require_once $root . 'lookup_game.php';
	require_once $root . 'format.php';
	require_once $root . 'format_dlc.php';
	require_once $root . 'format_links.php';

	$pageTitle = "Phantasy Star Online";
	include $homeDir . "pc_header.php";

?>

<?php echo $pageTitle; ?>

			<table cellpadding="3" cellspacing="1" border="0" width="150" bgcolor="<?php echo $tBG; ?>">
				<tr align="center" bgcolor="<?php echo $indexHead; ?>">
					Contents

				<tr align="center" bgcolor="<?php echo $indexSub; ?>">
					Files

				<tr bgcolor="<?php echo ac(); ?>">
					Game Saves

				<tr bgcolor="<?php echo ac(); ?>">
					DLC

				<tr bgcolor="<?php echo ac(); ?>">
					Screenshots

				<tr align="center" bgcolor="<?php echo $indexSub; ?>">
					Websites

				<tr bgcolor="<?php echo ac(); ?>">
					In-Game

				<tr bgcolor="<?php echo ac(); ?>">
					External

				<tr bgcolor="<?php echo ac(); ?>">
					Server

				Phantasy Star Online allows players to meet up in lobbies
				with players from all around the world. It was one of the
				early pioneers with videogame staples such as new game plus,
				world wide multiplayer match making, and downloadable content.

Game Saves

		There are three different save files for this game.
		Click the name links to go to detailed memory maps for each file.

	<table align="center" cellpadding="3" cellspacing="1" border="0" width="90%" bgcolor="<?php echo $tBG; ?>">
		<tr bgcolor="<?php echo $tHead; ?>">
			Name	Size
(Blocks)	Description	Icon

		<tr bgcolor="<?php echo ac(); ?>">
			Main Data
			15
			Save file for the main game character.
			<img src="<?php echo $dirIcons . "75f25c28.gif"?>">

		<tr bgcolor="<?php echo ac(); ?>">
			Guild Card
			30
			Save file for PSO Guild Card.
			<img src="<?php echo $dirIcons . "4f81fe65.gif"?>">

		<tr bgcolor="<?php echo ac(); ?>">
			Screen Image
			195
			Save file for an in-game screenshot.
			<img src="<?php echo $dirIcons . "473ec5d4.gif"?>">

Downloadable Content

		Various downloadable content was released for this
		game. Version 1 quests can be downloaded and used with Version 1
		only. Quests were downloaded in multiple parts. Most of these
		quests are Japanese only. Though other regions can play them by
		changing the language options to Japanese.

	<table align="center" cellpadding="3" cellspacing="1" border="0" width="90%" bgcolor="<?php echo $tBG; ?>">
		<tr bgcolor="<?php echo $tHead; ?>">
			PSO Version 1

	<?php callDLCFunction( PHANTASY_STAR_ONLINE_V1 ); ?>

		Version 2 quests were encrypted and locked to players so no
		downloads can be offered.

	<table align="center" cellpadding="3" cellspacing="1" border="0" width="90%" bgcolor="<?php echo $tBG; ?>">
		<tr bgcolor="<?php echo $tHead; ?>">
			PSO Version 2

		<tr bgcolor="<?php echo $tHead; ?>">
			Size
(Blocks)	File Name	Description	Icon

		<tr bgcolor="<?php echo ac(); ?>">
			??
			???
			Central Dome Fire Swirl
			<img src="<?php echo $dirIcons . "4ff15894.gif"?>">

		<tr bgcolor="<?php echo ac(); ?>">
			??
			???
			Lionel's Letter
			<img src="<?php echo $dirIcons . "4ff15894.gif"?>">

		<tr bgcolor="<?php echo ac(); ?>">
			??
			???
			Soul of a Blacksmith
			<img src="<?php echo $dirIcons . "4ff15894.gif"?>">

		<tr bgcolor="<?php echo ac(); ?>">
			??
			???
			Soul of Steel
			<img src="<?php echo $dirIcons . "4ff15894.gif"?>">

		<tr bgcolor="<?php echo ac(); ?>">
			??
			???
			The Retired Hunter
			<img src="<?php echo $dirIcons . "4ff15894.gif"?>">

Screen Shots

		Phantasy Star Online allows users to take screen
		shots. The following will guide a user through how to do this.

		Supplies needed:

		1. A VMU with 195 free blocks.

		2. An extra controller plugged into Port D, with above VMU
		plugged into Slot 2.

		<table align="center" cellpadding="3" cellspacing="1" border="0" style="min-width:400px;max-width:640px;" bgcolor="<?php echo $tBG; ?>">
			<tr bgcolor="<?php echo $tHead; ?>">
				Shot Type	Instructions

			<tr bgcolor="<?php echo ac(); ?>">
				Closeup of Screen
				On the controller in Port D, Hold X and press Start

			<tr bgcolor="<?php echo ac(); ?>">
				Entire Screen
				On the controller in Port D, Hold A and press Start

		Once pressed the screen will go black and a countdown will appear
		in the top-left corner of the screen.

		When the countdown reaches 0 your image will finish being saved
		to the VMU in Slot 2 of the controller in Port D.

		Note: Taking a screen shot will NOT pause the game. Be
		aware of your surroundings before attempting to take a picture.

<?php callLinkFunction( PHANTASY_STAR_ONLINE_V1 ); ?>

Servers

		Here is the list of servers by region that Phantasy Star Online
		Version 2 connects to.

In the case of USA and Japan, the
		game first attempts to connect to Hunter License servers to check
		that there is an active subscription.

	<table align="center" cellpadding="3" cellspacing="1" border="0" style="min-width:450px;max-width:640px;" bgcolor="<?php echo $tBG; ?>">
		<tr bgcolor="<?php echo $tHead; ?>">
			USA (NTSC-U)

		<tr bgcolor="<?php echo altc(); ?>">
			Hunter License:
			auth01.dricas.com:443

		<tr bgcolor="<?php echo altc(); ?>">
			Game Server:
			game01.st-pso.games.sega.net:9200

		<tr bgcolor="<?php echo $tHead; ?>">
			Europe (PAL)

		<tr bgcolor="<?php echo altc(); ?>">
			Hunter License:
			None

		<tr bgcolor="<?php echo altc(); ?>">
			Game Server:
			pso.dream-key.com:9200

		<tr bgcolor="<?php echo $tHead; ?>">
			Japan (NTSC-J)

		<tr bgcolor="<?php echo altc(); ?>">
			Hunter License:
			auth01.dricas.ne.jp:443

		<tr bgcolor="<?php echo altc(); ?>">
			Game Server:
			pso01.dricas.ne.jp:9200

		Here is the list of ports that Phantasy Star Online
		Version 2 uses.

The odd port numbers when
		read in little endian order rather than network byte order
		read as 4000, 4001, 4002, 4003. The resulting ports are
		most likely a mistake.

	<table align="center" cellpadding="3" cellspacing="1" border="0" style="min-width:450px;max-width:640px;" bgcolor="<?php echo $tBG; ?>">
		<tr bgcolor="<?php echo $tHead; ?>">
			Protocol
			Ports
			Usage

		<tr align="center" bgcolor="<?php echo altc(); ?>">
			UDP
			40975
			Unknown

		<tr align="center" bgcolor="<?php echo altc(); ?>">
			UDP
			41231
			Unknown

		<tr align="center" bgcolor="<?php echo altc(); ?>">
			UDP
			41487
			Unknown

		<tr align="center" bgcolor="<?php echo altc(); ?>">
			UDP
			41743
			Unknown

<?php
	$from = getcwd() . "/index.php";
	include $homeDir . "pc_footer.php";
?>


text:
."$PSScriptRoot\PreInitialize.ps1"
Import-Module -Name "$ClangbuilderRoot\modules\Initialize"
Import-Module -Name "$ClangbuilderRoot\modules\VisualStudio"
Import-Module -Name "$ClangbuilderRoot\modules\Devi" # Package Manager
Import-Module -Name "$ClangbuilderRoot\modules\Utils" # Package Manager

$ret = DevinitializeEnv -ClangbuilderRoot $ClangbuilderRoot
if ($ret -ne 0) {
    # Need vswhere
    exit 1
}
Push-Location $PWD

$ret = DefaultVisualStudio -ClangbuilderRoot $ClangbuilderRoot # initialize default visual studio
if ($ret -ne 0) {
    Write-Host -ForegroundColor Red "Not found valid installed visual studio."
    exit 1
}

try {
    $clexe = (Get-Command -CommandType Application "cl.exe")[0].Source
    if ($null -ne $clexe) {
        $clexeitem = Get-Item -Path $clexe
        $version = $clexeitem.VersionInfo.FileMajorPart*100 + $clexeitem.VersionInfo.FileMinorPart
        Write-Host "cl version: $version"
        if ($version -lt 1923) {
            Write-Host -ForegroundColor Red "Please install Visual Studio 2019 16.3 or Later"
            Read-Host -Prompt "Please entry key to continue"
            exit 1
        }
    }
}
catch {
    Write-Host -ForegroundColor Red "unable found cl.exe error: $_"
    Read-Host -Prompt "Please entry key to continue"
    exit 1
}

if (Test-Path "$ClangbuilderRoot/bin/pkgs/cmake/bin/cmake.exe") {
    $cmakeexe = "$ClangbuilderRoot/bin/pkgs/cmake/bin/cmake.exe"
}

if ($null -eq $cmakeexe) {
    $cmakeexes = Get-Command -Name "cmake.exe" -CommandType Application -ErrorAction SilentlyContinue
    if ($null -eq $cmakeexes) {
        Write-Host -ForegroundColor Red "You should be in VisualStudio select install cmake"
        exit 1
    }
    $cmakeexe = $cmakeexes[0].Source
}

## Add environment
InitializeEnv -ClangbuilderRoot $ClangbuilderRoot
New-Item -ItemType Directory -Force -ErrorAction SilentlyContinue "$ClangbuilderRoot\bin\utils" | Out-Null
$OutDir = "$ClangbuilderRoot\sources\out"
New-Item -ItemType Directory -Force $OutDir -ErrorAction SilentlyContinue | Out-Null
Remove-Item -Force "$OutDir\*" -Recurse -ErrorAction SilentlyContinue # remove build
Write-Host "Building Clangbuilder Utils ..."
$ec = ProcessExec -FilePath $cmakeexe -Argv "-G`"NMake Makefiles`" -DCMAKE_BUILD_TYPE=Release .." -WD $OutDir
if ($ec -ne 0) {
    exit $ec
}

$ec = ProcessExec -FilePath $cmakeexe -Argv "--build .  --config Release" -WD $OutDir
if ($ec -ne 0) {
    exit $ec
}

$Utils = "ClangbuilderUI.exe", "blast.exe", "cli.exe", "cmdex.exe"

foreach ($e in $Utils) {
    if (!(Test-Path "$OutDir\bin\$e")) {
        Write-Host -ForegroundColor Red "File: $OutDir\bin\$e not exists"
        exit 1
    }
    Copy-Item -Path "$OutDir\bin\$e" -Destination "$ClangbuilderRoot\bin\utils"
}

if (Test-Path "$ClangbuilderRoot\bin\utils\ClangbuilderUI.exe") {
    $cswshell = New-Object -ComObject WScript.Shell
    $clangbuilderlnk = $cswshell.CreateShortcut("$ClangbuilderRoot\ClangbuilderUI.lnk")
    $clangbuilderlnk.TargetPath = "$ClangbuilderRoot\bin\utils\ClangbuilderUI.exe"
    $clangbuilderlnk.Description = "Start ClangbuilderUI"
    $clangbuilderlnk.WindowStyle = 1
    $clangbuilderlnk.WorkingDirectory = "$ClangbuilderRoot\bin\utils"
    $clangbuilderlnk.IconLocation = "$ClangbuilderRoot\bin\utils\ClangbuilderUI.exe,0"
    # support overwrite
    $clangbuilderlnk.Save()
}

$LauncherUtils = "$ClangbuilderRoot\bin\utils\cli.exe"
$Blastexe = "$ClangbuilderRoot\bin\utils\blast.exe"
&$Blastexe --link $Blastexe "$ClangbuilderRoot\bin\blast.exe" -F # install self
&$Blastexe --link $LauncherUtils "$ClangbuilderRoot\bin\ClangbuilderTarget.exe" -F
&$Blastexe --link $LauncherUtils "$ClangbuilderRoot\bin\mklauncher.exe" -F
&$Blastexe --link $LauncherUtils "$ClangbuilderRoot\bin\devi.exe" -F

Remove-Item $OutDir -Force -Recurse -ErrorAction SilentlyContinue


text: Inventory_Detail_Js("Invoice_Detail_Js",{},{});


text:
package toothpick.data;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@javax.inject.Scope
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface CustomScope {}


text:
import _ from 'lodash';
import request from 'superagent';
import jsonapify from 'superagent-jsonapify';

import config from '../../config';
import {CredentialStore} from '../stores';

jsonapify(request);

class ClientService {
	createClient(data) {
		return new Promise((resolve, reject) => {
			request.post(`${config.serverUrl}/clients`)
				.set('Authorization', `Bearer ${CredentialStore.accessToken}`)
				.type('application/vnd.api+json').send({ data })
				.end((err, res) => {
					err ? reject(err) : resolve(res.body);
				});
		});
	}

	readClient(clientId) {
		return new Promise((resolve, reject) => {
			request.get(`${config.serverUrl}/clients/${clientId}`)
				.set('Authorization', `Bearer ${CredentialStore.accessToken}`)
				.type('application/vnd.api+json').end((err, res) => {
					err ? reject(err) : resolve(res.body);
				});
		});
	}

	updateClient(clientId, data) {
		return new Promise((resolve, reject) => {
			request.put(`${config.serverUrl}/clients/${clientId}`)
				.set('Authorization', `Bearer ${CredentialStore.accessToken}`)
				.type('application/vnd.api+json').send({ data })
				.end((err, res) => {
					err ? reject(err) : resolve(res.body);
				});
		});
	}

	removeClient(clientId) {
		return new Promise((resolve, reject) => {
			request.del(`${config.serverUrl}/clients/${clientId}`)
				.set('Authorization', `Bearer ${CredentialStore.accessToken}`)
				.end((err, res) => {
					err ? reject(err) : resolve(res.body);
				});
		});
	}

	searchClients(query, limit, offset) {
		offset = offset || 0;
		return new Promise((resolve, reject) => {
			let filter = _.assign({
				'page[offset]': offset, 'page[limit]': limit
			}, _.mapKeys(query, (value, field) => `filter[${field}]`));
			request.get(`${config.serverUrl}/clients`).query(filter)
				.set('Authorization', `Bearer ${CredentialStore.accessToken}`)
				.end((err, res) => {
					err ? reject(err) : resolve(res.body.data);
				});
		});
	}
};

export default new ClientService;


text:
cask "whatsize" do
  version "7.6.5,7650"
  sha256 "f84d15428b149534ff8a11a83c9a4a7b6fb345d5e84fd83bade0a3d78abd28c0"

  url "https://www.whatsizemac.com/software/whatsize#{version.major}/whatsize_#{version.before_comma}.tgz"
  name "WhatSize"
  desc "File system utility used to view and reclaim disk space"
  homepage "https://www.whatsizemac.com/"

  livecheck do
    url "https://www.whatsizemac.com/software/whatsize#{version.major}/release/notes.xml"
    strategy :sparkle
  end

  depends_on macos: ">= :sierra"

  pkg "WhatSize.pkg"

  uninstall pkgutil:   "com.id-design.whatsize#{version.major}.pkg",
            launchctl: "com.id-design.v#{version.major}.whatsizehelper"
end


text:
<?xml version="1.0" encoding="utf-8"?>
<root>
	<default-servlet name="deny" uri-pattern="*.xml|*.yaml">
		<headers>
			<property name="Content-Type" value="text/html;${env:prop:wikiup.charset}"/>
		</headers>
		<processor class="deny" reason="SC_NOT_FOUND"/>
	</default-servlet>
</root>


text:
<!DOCTYPE html>

	<link rel="stylesheet" type="text/css" href="css/compiled/main.css">
	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.1/css/materialize.min.css">

	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">

Employee List

Employee Search

JavaScript


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.coletivoJava;

/**
 *
 * @author SalvioF
 */
public class SBComandos {

}


text: Designed by Freepik


text:
include make.inc

VERILOG=../verilog
SCRIPT?=test_example
TIMEOUT?=3000

SIM_ARGS=+python+$(SCRIPT).py +timeout+$(TIMEOUT)
LIBEXM=../c/libexm_vpi

.PHONY : all build verilog iverilog verilate cver clean

all : iverilog icarus verilator verilate

iverilog icarus : iverilog-build $(LIBEXM).vpl
	PYTHONPATH=$$PYTHONPATH:. $(IRUN) -m $(LIBEXM) example.iverilog $(SIM_ARGS)

iverilog-build : build
	$(IBUILD) -g2005-sv -D IVERILOG -I$(VERILOG) $(VERILOG)/example.v -o example.iverilog

verilator verilate : verilog
	PYTHONPATH=$$PYTHONPATH:. $(VERILOG)/example/examplex $(SIM_ARGS)

../c/% :
	$(MAKE) -C ../c $(notdir $@)

regress : all
	./regress

build :
	$(MAKE) -C ../c
	$(MAKE) -C ../db
	$(MAKE) -C ../python

verilog : build
	$(MAKE) -C ../verilog

clean :
	$(MAKE) -C ../c       clean
	$(MAKE) -C ../python  clean
	$(MAKE) -C ../verilog clean
	-@rm example.iverilog


text:
from app import socketio
from .. import resource_blueprint as message
from app.core.db.sql.models import Message, User
from flask_login import login_required, current_user
from app.core.auth.handle import authenticated_only
from flask import render_template, render_template, session, request, url_for, jsonify
from flask_socketio import Namespace, emit, join_room, leave_room, \
    close_room, rooms, disconnect
from sqlalchemy import and_

thread = None

def background_thread():
    """Example of how to send server generated events to clients."""
    count = 0
    while True:
        socketio.sleep(10)
        count += 1
        socketio.emit('my_response',
                      {'data': 'Server generated event', 'count': count},
                      namespace='/test')

class MyNamespace(Namespace):
    @authenticated_only
    def on_my_event(self, message):
        session['receive_count'] = session.get('receive_count', 0) + 1
        emit('my_response',
             {'data': message['data'], 'count': session['receive_count']})
    @authenticated_only
    def on_my_broadcast_event(self, message):
        session['receive_count'] = session.get('receive_count', 0) + 1
        emit('my_response',
             {'data': message['data'], 'count': session['receive_count']},
             broadcast=True)
    @authenticated_only
    def on_join(self, message):
        join_room(message['room'])
        session['receive_count'] = session.get('receive_count', 0) + 1
        emit('my_response',
             {'data': 'In rooms: ' + ', '.join(rooms()),
              'count': session['receive_count']})
    @authenticated_only
    def on_leave(self, message):
        leave_room(message['room'])
        session['receive_count'] = session.get('receive_count', 0) + 1
        emit('my_response',
             {'data': 'In rooms: ' + ', '.join(rooms()),
              'count': session['receive_count']})
    @authenticated_only
    def on_close_room(self, message):
        session['receive_count'] = session.get('receive_count', 0) + 1
        emit('my_response', {'data': 'Room ' + message['room'] + ' is closing.',
                             'count': session['receive_count']},
             room=message['room'])
        close_room(message['room'])
    @authenticated_only
    def on_my_room_event(self, message):
        session['receive_count'] = session.get('receive_count', 0) + 1
        emit('my_response',
             {'data': message['data'], 'count': session['receive_count']},
             room=message['room'])
    @authenticated_only
    def on_disconnect_request(self):
        session['receive_count'] = session.get('receive_count', 0) + 1
        emit('my_response',
             {'data': 'Disconnected!', 'count': session['receive_count']})
        disconnect()
    @authenticated_only
    def on_my_ping(self):
        emit('my_pong')
    @authenticated_only
    def on_connect(self):
        global thread
        if thread is None:
            thread = socketio.start_background_task(target=background_thread)
        emit('my_response', {'data': 'Connected', 'count': 0})
    @authenticated_only
    def on_disconnect(self):
        print('Client disconnected', request.sid)

# socketio.on_namespace(MyNamespace('/test'))

@message.route('/<string:user_id>/message-received')
@login_required
def message_received(user_id):
    page = int(request.args.get('page', 1))
    page_size = request.args.get('page_size', 10)
    order_name = request.args.get('order_name', 'id')
    order_direction = request.args.get('order_direction', 'asc')
    if page_size == 'all':
        offset_size = page_size = None
    else:
        page_size = int(page_size)
        offset_size = (page - 1) * page_size
    message_id = request.args.get('message_id')
    status = request.args.get('status')
    if status and status == '1':
        pass
        "需要设置消息状态为已读True"
    message_list = current_user.get_message_received(message_id=message_id)

    print "views message_list: ",message_list

    return render_template('resources/message/be_received.html', message_list=message_list,  async_mode= None,
                           page_size=request.args.get('page_size', 10), page=request.args.get('page', 1),
                           current_url=url_for('resource.message_received', user_id=current_user.id), query_size=10)

@message.route('/<string:user_id>/message-sent')
@login_required
def message_sent(user_id):
    page = int(request.args.get('page', 1))
    page_size = request.args.get('page_size', 10)
    order_name = request.args.get('order_name', 'id')
    order_direction = request.args.get('order_direction', 'asc')
    if page_size == 'all':
        offset_size = page_size = None
    else:
        page_size = int(page_size)
        offset_size = (page - 1) * page_size

    message_list = current_user.get_message_sent()
    print message_list
    if message_list is None:
        messages = []
    # else:
    #     print message.receivers
    return render_template('resources/message/be_sent.html', message_list=message_list,  async_mode= None,
                           page_size=request.args.get('page_size', 10), page=request.args.get('page', 1),
                           current_url=url_for('resource.message_received', user_id=current_user.id), query_size=10)

@message.route('/<string:user_id>/send-message', methods=['GET', 'POST'])
@login_required
def send_message(user_id):
    if request.method == 'POST':
        print request.form
        subject = request.form.get('subject')
        content = request.form.get('content')
        send_to_user_id = request.form.get('send_to')
        current_user.send_message(send_to_user_id, subject, content)
        return jsonify({'msg':"success"})
    page = int(request.args.get('page', 1))
    page_size = request.args.get('page_size', 10)
    order_name = request.args.get('order_name', 'id')
    order_direction = request.args.get('order_direction', 'asc')
    if page_size == 'all':
        offset_size = page_size = None
    else:
        page_size = int(page_size)
        offset_size = (page - 1) * page_size

    friend_list = User.query.limit(10).all()
    return render_template('resources/message/write_message.html', friend_list=friend_list,  async_mode= None,
                           page_size=request.args.get('page_size', 10), page=request.args.get('page', 1),
                           query_size=10)


text:
package com.hurence.logisland.util.kafka;

import com.hurence.logisland.record.Record;
import com.hurence.logisland.record.StandardRecord;
import com.hurence.logisland.serializer.KryoSerializer;
import kafka.producer.KeyedMessage;
import kafka.producer.Producer;
import kafka.producer.ProducerConfig;
import kafka.utils.TestUtils;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;

/**
 * Created by lhubert on 15/04/16.
 *
 * Used for plugin tests
 */
public class DocumentPublisher {

    /**
     * Published all files found in path into topic (content is setField in content field)
     * @param context
     * @param path
     * @param topic
     * @throws IOException
     */
    public void publish(EmbeddedKafkaEnvironment context, String path, String topic) throws IOException {

        List<KeyedMessage> messages = new ArrayList<>();

        // read a json file at path and publish to topic
        // TODO
        // setup producer
        Properties properties = TestUtils.getProducerConfig("localhost:" + context.getBrokerPort());
        ProducerConfig producerConfig = new ProducerConfig(properties);
        Producer producer = new Producer(producerConfig);

        final KryoSerializer kryoSerializer = new KryoSerializer(true);

        File folder = new File(path);
        File[] listOfFiles = folder.listFiles();

        for (File file : listOfFiles) {
            if (file.isFile()) {
                String content = SmallFileUtil.getContent(file);
                Record record = new StandardRecord(file.getName());
                record.setStringField("name", file.getName());
                record.setStringField("content", content);
                ByteArrayOutputStream baos = new ByteArrayOutputStream();
                kryoSerializer.serialize(baos, record);
                KeyedMessage<String, byte[]> data = new KeyedMessage(topic, baos.toByteArray());
                baos.close();
                messages.add(data);
            }
        }

        producer.send(scala.collection.JavaConversions.asScalaBuffer(messages));
        producer.close();
    }
}


text:
import {Feature, HtmlAstNode, Resolvable, SourceRange, Warning} from '../model/model';

import {Document} from './document';
import {ImmutableArray, ImmutableMap, ImmutableSet} from './immutable';

export interface Attribute {
  readonly name: string;
  readonly sourceRange: SourceRange;
  readonly nameSourceRange: SourceRange;
  readonly valueSourceRange: SourceRange|undefined;
  readonly value?: string;
}

declare module '../model/queryable' {
  interface FeatureKindMap {
    'element-reference': ElementReference;
  }
}

export class ElementReference implements Feature {
  readonly tagName: string;
  readonly attributes: ImmutableMap<string, Attribute>;
  readonly sourceRange: SourceRange;
  readonly astNode: HtmlAstNode;
  readonly warnings: ImmutableArray<Warning>;
  readonly kinds: ImmutableSet<string> = new Set(['element-reference']);

  constructor(scannedRef: ScannedElementReference, _document: Document) {
    this.tagName = scannedRef.tagName;
    this.attributes = scannedRef.attributes;
    this.sourceRange = scannedRef.sourceRange;
    this.astNode = scannedRef.astNode;
    this.warnings = scannedRef.warnings;
  }

  get identifiers(): ImmutableSet<string> {
    return new Set([this.tagName]);
  }
}

export class ScannedElementReference implements Resolvable {
  readonly tagName: string;
  readonly attributes = new Map<string, Attribute>();
  readonly sourceRange: SourceRange;
  readonly astNode: HtmlAstNode;
  readonly warnings: ImmutableArray<Warning> = [];

  constructor(tagName: string, sourceRange: SourceRange, ast: HtmlAstNode) {
    this.tagName = tagName;
    this.sourceRange = sourceRange;
    this.astNode = ast;
  }

  resolve(document: Document): ElementReference {
    return new ElementReference(this, document);
  }
}


text:
#pragma once

#include "paddle/utils/TypeDefs.h"
#include "ModelConfig.pb.h"
#include "hl_gpu.h"

namespace paddle {

class GruCompute {
public:
  void init(LayerConfig &config);

  template <bool useGpu>
  void forward(hl_gru_value value, int frameSize, int batchSize = 1);

  template <bool useGpu>
  void backward(hl_gru_value value, hl_gru_grad grad, int frameSize,
                int batchSize = 1);

public:
  hl_activation_mode_t activeNode_;
  hl_activation_mode_t activeGate_;
};

}  // namespace paddle