text:
package sudoku;

import java.util.List;

/**
 * Base class for different sudoku solving strategies.
 *
 * @author Taras Mychaskiw
 */
public interface SudokuSolver {

    /**
     * Tries to solve the sudoku board.
     *
     * @param board the board to solve
     * @return a solved version of the board, or null if unsolvable
     */
    public SudokuBoard solve(SudokuBoard board);

    /**
     * Returns a list of all solutions to the board given.
     *
     * @param board the board to solve
     * @return the list of all solutions to the board
     */
    public List<SudokuBoard> enumerate(SudokuBoard board);

    /**
     * Returns true if the board is well formed, that is if the
     * board only has one solution.
     *
     * @param board the board to test
     * @return true if it only has one possible solution
     */
    public boolean isWellFormed(SudokuBoard board);

    /**
     * Returns the formity of the board sent.
     *
     * @param board the board to test
     * @return 0 if no solutions, 1 if unique solution, -1 if multiple solutions
     */
    public int getFormity(SudokuBoard board);
    public static final int NO_SOLUTIONS = 0;
    public static final int MULTIPLE_SOLUTIONS = -1;
    public static final int UNIQUE_SOLUTION = 1;
}


text:
require 'test_helper'

class LevelsControllerTest < ActionController::TestCase
  include Devise::TestHelpers

  setup do
    @level = create(:level)
    @user = create(:admin)
    sign_in(@user)
  end

  test "should get index" do
    get :index, game_id: @level.game
    assert_response :success
    assert_not_nil assigns(:levels)
  end

  test "should get new" do
    get :new, game_id: @level.game
    assert_response :success
  end

  test "should create level" do
    assert_difference('Level.count') do
      post :create, game_id: @level.game, level: {  }
    end

    level = assigns(:level)
    assert_redirected_to game_level_path(level.game, level)
  end

  test "should show level" do
    get :show, id: @level, game_id: @level.game
    assert_response :success
  end

  test "should get edit" do
    get :edit, id: @level, game_id: @level.game
    assert_response :success
  end

  test "should update level" do
    patch :update, id: @level, game_id: @level.game, level: {  }
    level = assigns(:level)
    assert_redirected_to game_level_path(level.game, level)
  end

  test "should destroy level" do
    assert_difference('Level.count', -1) do
      delete :destroy, id: @level, game_id: @level.game
    end

    assert_redirected_to game_levels_path
  end
end

redpajama_set_name: RedPajamaGithub


text:
#include "halApiTestSupport.h"
#include "halAlignment.h"
#include "halBottomSegmentIterator.h"
#include "halColumnIterator.h"
#include "halDnaIterator.h"
#include "halGenome.h"
#include "halMetaData.h"
#include "halTopSegmentIterator.h"
#include "halValidate.h"
#include <iostream>
#include <stdio.h>
#include <string>
extern "C" {
#include "commonC.h"
}

using namespace std;
using namespace hal;

struct GenomeMetaTest : public AlignmentTest {
    void createCallBack(Alignment *alignment) {
        hal_size_t alignmentSize = alignment->getNumGenomes();
        CuAssertTrue(_testCase, alignmentSize == 0);

        Genome *ancGenome = alignment->addRootGenome("AncGenome", 0);

        MetaData *ancMeta = ancGenome->getMetaData();
        ancMeta->set("Young", "Jeezy");
    }

    void checkCallBack(const Alignment *alignment) {
        const Genome *ancGenome = alignment->openGenome("AncGenome");
        const MetaData *ancMeta = ancGenome->getMetaData();
        CuAssertTrue(_testCase, ancMeta->get("Young") == "Jeezy");
        CuAssertTrue(_testCase, ancGenome->getSequenceLength() == 0);
        CuAssertTrue(_testCase, ancGenome->getNumTopSegments() == 0);
        CuAssertTrue(_testCase, ancGenome->getNumBottomSegments() == 0);
        CuAssertTrue(_testCase, ancGenome->getName() == "AncGenome");
    }
};

struct GenomeCreateTest : public AlignmentTest {
    std::string _string;
    void createCallBack(Alignment *alignment) {
        hal_size_t alignmentSize = alignment->getNumGenomes();
        CuAssertTrue(_testCase, alignmentSize == 0);

        Genome *ancGenome = alignment->addRootGenome("AncGenome", 0);
        Genome *leaf1Genome = alignment->addLeafGenome("Leaf1", "AncGenome", 0.1);
        Genome *leaf2Genome = alignment->addLeafGenome("Leaf2", "AncGenome", 0.2);
        Genome *leaf3Genome = alignment->addLeafGenome("Leaf3", "AncGenome", 0.3);

        MetaData *ancMeta = ancGenome->getMetaData();
        ancMeta->set("Young", "Jeezy");

        vector<Sequence::Info> seqVec(1);
        seqVec[0] = Sequence::Info("Sequence", 1000000, 5000, 700000);
        ancGenome->setDimensions(seqVec);
        seqVec[0] = Sequence::Info("Sequence", 1000000, 700000, 0);
        leaf1Genome->setDimensions(seqVec);
        seqVec[0] = Sequence::Info("Sequence", 2000000, 700000, 0);
        leaf2Genome->setDimensions(seqVec);
        seqVec[0] = Sequence::Info("Sequence", 3000000, 700000, 0);
        leaf3Genome->setDimensions(seqVec);
    }

    void checkCallBack(const Alignment *alignment) {
        const Genome *dudGenome = alignment->openGenome("Zebra");
        CuAssertTrue(_testCase, dudGenome == NULL);
        const Genome *ancGenome = alignment->openGenome("AncGenome");
        const MetaData *ancMeta = ancGenome->getMetaData();
        CuAssertTrue(_testCase, ancMeta->get("Young") == "Jeezy");
        const Genome *leaf1Genome = alignment->openGenome("Leaf1");
        const Genome *leaf2Genome = alignment->openGenome("Leaf2");
        const Genome *leaf3Genome = alignment->openGenome("Leaf3");
        CuAssertTrue(_testCase, ancGenome->getName() == "AncGenome");
        CuAssertTrue(_testCase, leaf1Genome->getName() == "Leaf1");
        CuAssertTrue(_testCase, leaf2Genome->getName() == "Leaf2");
        CuAssertTrue(_testCase, leaf3Genome->getName() == "Leaf3");
        CuAssertTrue(_testCase, ancGenome->getSequenceLength() == 1000000);
        CuAssertTrue(_testCase, ancGenome->getNumTopSegments() == 5000);
        CuAssertTrue(_testCase, ancGenome->getNumBottomSegments() == 700000);
        CuAssertTrue(_testCase, leaf1Genome->getSequenceLength() == 1000000);
        CuAssertTrue(_testCase, leaf1Genome->getNumTopSegments() == 700000);
        CuAssertTrue(_testCase, leaf1Genome->getNumBottomSegments() == 0);
        CuAssertTrue(_testCase, leaf2Genome->getSequenceLength() == 2000000);
        CuAssertTrue(_testCase, leaf2Genome->getNumTopSegments() == 700000);
        CuAssertTrue(_testCase, leaf2Genome->getNumBottomSegments() == 0);
        CuAssertTrue(_testCase, leaf3Genome->getSequenceLength() == 3000000);
        CuAssertTrue(_testCase, leaf3Genome->getNumTopSegments() == 700000);
        CuAssertTrue(_testCase, leaf3Genome->getNumBottomSegments() == 0);
    }
};

struct GenomeUpdateTest : public AlignmentTest {
    void createCallBack(Alignment *alignment) {
        hal_size_t alignmentSize = alignment->getNumGenomes();
        CuAssertTrue(_testCase, alignmentSize == 0);

        Genome *ancGenome = alignment->addRootGenome("AncGenome", 0);
        vector<Sequence::Info> seqVec(1);
        seqVec[0] = Sequence::Info("Sequence", 1000000, 5000, 700000);
        ancGenome->setDimensions(seqVec);
        seqVec[0] = Sequence::Info("Sequence", 10000005, 14000, 2000001);
        ancGenome->setDimensions(seqVec);
    }

    void checkCallBack(const Alignment *alignment) {
        const Genome *ancGenome = alignment->openGenome("AncGenome");
        CuAssertTrue(_testCase, ancGenome->getName() == "AncGenome");
        CuAssertTrue(_testCase, ancGenome->getSequenceLength() == 10000005);
        CuAssertTrue(_testCase, ancGenome->getNumTopSegments() == 14000);
        CuAssertTrue(_testCase, ancGenome->getNumBottomSegments() == 2000001);
    }
};

struct GenomeStringTest : public AlignmentTest {
    std::string _string;
    void createCallBack(Alignment *alignment) {
        hal_size_t alignmentSize = alignment->getNumGenomes();
        CuAssertTrue(_testCase, alignmentSize == 0);
        hal_size_t seqLength = 28889943;
        Genome *ancGenome = alignment->addRootGenome("AncGenome", 0);
        vector<Sequence::Info> seqVec(1);
        seqVec[0] = Sequence::Info("Sequence", seqLength, 5000, 700000);
        ancGenome->setDimensions(seqVec);

        _string = randomString(seqLength);
        ancGenome->setString(_string);
    }

    void checkCallBack(const Alignment *alignment) {
        const Genome *ancGenome = alignment->openGenome("AncGenome");
        CuAssertTrue(_testCase, ancGenome->getName() == "AncGenome");
        string genomeString;
        ancGenome->getString(genomeString);
        CuAssertTrue(_testCase, genomeString == _string);
    }
};

struct GenomeCopyTest : public AlignmentTest {
    std::string _path;
    AlignmentPtr _secondAlignment;

    void createCallBack(Alignment *alignment) {
        hal_size_t alignmentSize = alignment->getNumGenomes();
        CuAssertTrue(_testCase, alignmentSize == 0);

        // Hacky: Need a different alignment to test copying the bottom
        // segments correctly.  (the names of a node's children are used
        // when copying bottom segments, and two genomes can't have the same
        // name in the same alignment)
        _path = getTempFile();
        _secondAlignment =
            AlignmentPtr(getTestAlignmentInstances(alignment->getStorageFormat(), _path, WRITE_ACCESS | CREATE_ACCESS));

        Genome *ancGenome = alignment->addRootGenome("AncGenome", 0);
        Genome *leafGenome = alignment->addLeafGenome("LeafGenome1", "AncGenome", 0);
        // This genome will test copyDimensions, copyTopSegments,
        // copyBottomSegments, copySequence, copyMetadata
        Genome *copyRootGenome = _secondAlignment->addRootGenome("copyRootGenome", 0);
        Genome *copyLeafGenome = _secondAlignment->addLeafGenome("LeafGenome1", "copyRootGenome", 0);

        MetaData *ancMeta = ancGenome->getMetaData();
        ancMeta->set("Young", "Jeezy");

        vector<Sequence::Info> seqVec(1);
        seqVec[0] = Sequence::Info("Sequence", 1000000, 0, 700000);
        ancGenome->setDimensions(seqVec);
        seqVec[0] = Sequence::Info("Sequence", 1000000, 5000, 0);
        leafGenome->setDimensions(seqVec);
        string ancSeq = "CAT";
        hal_index_t n = ancGenome->getSequenceLength();
        DnaIteratorPtr dnaIt = ancGenome->getDnaIterator();
        for (; dnaIt->getArrayIndex() < n; dnaIt->toRight()) {
            size_t i = dnaIt->getArrayIndex() % ancSeq.size();
            dnaIt->setBase(ancSeq[i]);
        }
        dnaIt->flush();

        n = leafGenome->getSequenceLength();
        dnaIt = leafGenome->getDnaIterator();
        for (; dnaIt->getArrayIndex() < n; dnaIt->toRight()) {
            size_t i = dnaIt->getArrayIndex() % ancSeq.size();
            dnaIt->setBase(ancSeq[i]);
        }
        dnaIt->flush();

        TopSegmentIteratorPtr topIt = leafGenome->getTopSegmentIterator();
        n = leafGenome->getNumTopSegments();
        for (; topIt->getArrayIndex() < n; topIt->toRight()) {
            topIt->setCoordinates(topIt->getArrayIndex(), 1);
            topIt->tseg()->setParentIndex(3);
            topIt->tseg()->setParentReversed(true);
            topIt->tseg()->setBottomParseIndex(5);
            if (topIt->getArrayIndex() != 6) {
                topIt->tseg()->setNextParalogyIndex(6);
            } else {
                topIt->tseg()->setNextParalogyIndex(7);
            }
        }
        BottomSegmentIteratorPtr botIt = ancGenome->getBottomSegmentIterator();
        n = ancGenome->getNumBottomSegments();
        for (; botIt->getArrayIndex() < n; botIt->toRight()) {
            botIt->setCoordinates(botIt->getArrayIndex(), 1);
            botIt->bseg()->setChildIndex(0, 3);
            botIt->bseg()->setChildReversed(0, true);
            botIt->bseg()->setTopParseIndex(5);
        }

        seqVec[0] = Sequence::Info("Sequence", 3300, 0, 1100);
        copyRootGenome->setDimensions(seqVec);
        seqVec[0] = Sequence::Info("Sequence", 3300, 2200, 0);
        copyLeafGenome->setDimensions(seqVec);
        string copySeq = "TAG";
        dnaIt = copyRootGenome->getDnaIterator();
        n = copyRootGenome->getSequenceLength();
        for (; dnaIt->getArrayIndex() < n; dnaIt->toRight()) {
            size_t i = dnaIt->getArrayIndex() % copySeq.size();
            dnaIt->setBase(copySeq[i]);
        }
        dnaIt->flush();

        dnaIt = copyLeafGenome->getDnaIterator();
        n = copyLeafGenome->getSequenceLength();
        for (; dnaIt->getArrayIndex() < n; dnaIt->toRight()) {
            size_t i = dnaIt->getArrayIndex() % copySeq.size();
            dnaIt->setBase(copySeq[i]);
        }
        dnaIt->flush();

        topIt = copyLeafGenome->getTopSegmentIterator();
        n = copyLeafGenome->getNumTopSegments();
        for (; topIt->getArrayIndex() < n; topIt->toRight()) {
            topIt->setCoordinates(7, 8);
            topIt->tseg()->setParentIndex(9);
            topIt->tseg()->setParentReversed(false);
            topIt->tseg()->setBottomParseIndex(11);
            if (topIt->getArrayIndex() != 12) {
                topIt->tseg()->setNextParalogyIndex(12);
            } else {
                topIt->tseg()->setNextParalogyIndex(7);
            }
        }
        botIt = copyRootGenome->getBottomSegmentIterator();
        n = copyRootGenome->getNumBottomSegments();
        for (; botIt->getArrayIndex() < n; botIt->toRight()) {
            botIt->setCoordinates(6, 7);
            botIt->bseg()->setChildIndex(0, 8);
            botIt->bseg()->setChildReversed(0, false);
            botIt->bseg()->setTopParseIndex(10);
        }

        ancGenome->copy(copyRootGenome);
        leafGenome->copy(copyLeafGenome);
        _secondAlignment->close();
    }

    void checkCallBack(const Alignment *alignment) {
        // FIXME: halAlignment->open() fails miserably but
        // openHalAlignmentReadOnly works? Probably some state isn't cleared
        // on close.
        AlignmentPtr tmp(getTestAlignmentInstances(alignment->getStorageFormat(), _path, WRITE_ACCESS));
        _secondAlignment = tmp;
        const Genome *ancGenome = alignment->openGenome("AncGenome");
        CuAssertTrue(_testCase, ancGenome->getName() == "AncGenome");
        CuAssertTrue(_testCase, ancGenome->getSequenceLength() == 1000000);
        CuAssertTrue(_testCase, ancGenome->getNumTopSegments() == 0);
        CuAssertTrue(_testCase, ancGenome->getNumBottomSegments() == 700000);
        const MetaData *ancMeta = ancGenome->getMetaData();
        CuAssertTrue(_testCase, ancMeta->get("Young") == "Jeezy");
        const Genome *leafGenome = alignment->openGenome("LeafGenome1");
        string ancSeq = "CAT";
        hal_index_t n = ancGenome->getSequenceLength();
        DnaIteratorPtr dnaIt = ancGenome->getDnaIterator();
        for (; dnaIt->getArrayIndex() < n; dnaIt->toRight()) {
            size_t i = dnaIt->getArrayIndex() % ancSeq.size();
            CuAssertTrue(_testCase, dnaIt->getBase() == ancSeq[i]);
        }
        TopSegmentIteratorPtr topIt = leafGenome->getTopSegmentIterator();
        n = leafGenome->getNumTopSegments();
        for (; topIt->getArrayIndex() < n; topIt->toRight()) {
            CuAssertTrue(_testCase, topIt->getStartPosition() == topIt->getArrayIndex());
            CuAssertTrue(_testCase, topIt->getLength() == 1);
            CuAssertTrue(_testCase, topIt->tseg()->getParentIndex() == 3);
            CuAssertTrue(_testCase, topIt->tseg()->getParentReversed() == true);
            CuAssertTrue(_testCase, topIt->tseg()->getBottomParseIndex() == 5);
            if (topIt->getArrayIndex() != 6) {
                CuAssertTrue(_testCase, topIt->tseg()->getNextParalogyIndex() == 6);
            } else {
                CuAssertTrue(_testCase, topIt->tseg()->getNextParalogyIndex() == 7);
            }
        }
        BottomSegmentIteratorPtr botIt = ancGenome->getBottomSegmentIterator();
        n = ancGenome->getNumBottomSegments();
        for (; botIt->getArrayIndex() < n; botIt->toRight()) {
            CuAssertTrue(_testCase, botIt->getStartPosition() == botIt->getArrayIndex());
            CuAssertTrue(_testCase, botIt->getLength() == 1);
            CuAssertTrue(_testCase, botIt->bseg()->getChildIndex(0) == 3);
            CuAssertTrue(_testCase, botIt->bseg()->getChildReversed(0) == true);
            CuAssertTrue(_testCase, botIt->bseg()->getTopParseIndex() == 5);
        }

        const Genome *copyRootGenome = _secondAlignment->openGenome("copyRootGenome");
        const Genome *copyLeafGenome = _secondAlignment->openGenome("LeafGenome1");
        CuAssertTrue(_testCase, copyRootGenome->getName() == "copyRootGenome");
        CuAssertTrue(_testCase, copyRootGenome->getSequenceLength() == 1000000);
        CuAssertTrue(_testCase, copyRootGenome->getNumTopSegments() == 0);
        CuAssertTrue(_testCase, copyRootGenome->getNumBottomSegments() == 700000);
        CuAssertTrue(_testCase, copyLeafGenome->getName() == "LeafGenome1");
        CuAssertTrue(_testCase, copyLeafGenome->getSequenceLength() == 1000000);
        CuAssertTrue(_testCase, copyLeafGenome->getNumTopSegments() == 5000);
        CuAssertTrue(_testCase, copyLeafGenome->getNumBottomSegments() == 0);
        const MetaData *copyMeta = copyRootGenome->getMetaData();
        CuAssertTrue(_testCase, copyMeta->get("Young") == "Jeezy");
        n = copyRootGenome->getSequenceLength();
        dnaIt = copyRootGenome->getDnaIterator();
        for (; dnaIt->getArrayIndex() < n; dnaIt->toRight()) {
            size_t i = dnaIt->getArrayIndex() % ancSeq.size();
            CuAssertTrue(_testCase, dnaIt->getBase() == ancSeq[i]);
        }
        topIt = copyLeafGenome->getTopSegmentIterator();
        n = copyLeafGenome->getNumTopSegments();
        for (; topIt->getArrayIndex() < n; topIt->toRight()) {
            CuAssertTrue(_testCase, topIt->getStartPosition() == topIt->getArrayIndex());
            CuAssertTrue(_testCase, topIt->getLength() == 1);
            CuAssertTrue(_testCase, topIt->tseg()->getParentIndex() == 3);
            CuAssertTrue(_testCase, topIt->tseg()->getParentReversed() == true);
            CuAssertTrue(_testCase, topIt->tseg()->getBottomParseIndex() == 5);
            if (topIt->getArrayIndex() != 6) {
                CuAssertTrue(_testCase, topIt->tseg()->getNextParalogyIndex() == 6);
            } else {
                CuAssertTrue(_testCase, topIt->tseg()->getNextParalogyIndex() == 7);
            }
        }
        botIt = copyRootGenome->getBottomSegmentIterator();
        n = copyRootGenome->getNumBottomSegments();
        for (; botIt->getArrayIndex() < n; botIt->toRight()) {
            CuAssertTrue(_testCase, botIt->getStartPosition() == botIt->getArrayIndex());
            CuAssertTrue(_testCase, botIt->getLength() == 1);
            CuAssertTrue(_testCase, botIt->bseg()->getChildIndex(0) == 3);
            CuAssertTrue(_testCase, botIt->bseg()->getChildReversed(0) == true);
            CuAssertTrue(_testCase, botIt->bseg()->getTopParseIndex() == 5);
        }

        _secondAlignment->close();
        remove(_path.c_str());
    }
};

struct GenomeCopySegmentsWhenSequencesOutOfOrderTest : public AlignmentTest {
    std::string _path;
    AlignmentPtr _secondAlignment;

    // Set top segments to be equal width and so that segment 1, 2, 3,
    // etc. corresponds to parent segment 1, 2, 3, etc.
    void setTopSegments(Genome *genome, hal_size_t width) {
        TopSegmentIteratorPtr topIt = genome->getTopSegmentIterator();
        hal_size_t n = genome->getNumTopSegments();
        hal_index_t startPos = 0;
        for (; topIt->getArrayIndex() < n; topIt->toRight(), startPos += width) {
            topIt->setCoordinates(startPos, width);
            topIt->tseg()->setParentIndex(topIt->getArrayIndex());
            topIt->tseg()->setParentReversed(false);
            topIt->tseg()->setBottomParseIndex(NULL_INDEX);
            topIt->tseg()->setNextParalogyIndex(NULL_INDEX);
        }
    }

    // Set bottom segments to be equal width and so that segment 1, 2, 3,
    // etc. corresponds to child segment 1, 2, 3, etc.
    void setBottomSegments(Genome *genome, hal_size_t width) {
        hal_size_t numChildren = genome->getNumChildren();
        BottomSegmentIteratorPtr bottomIt = genome->getBottomSegmentIterator();
        hal_size_t n = genome->getNumBottomSegments();
        hal_index_t startPos = 0;
        for (; bottomIt->getArrayIndex() < n; bottomIt->toRight(), startPos += width) {
            for (hal_size_t i = 0; i < numChildren; i++) {
                bottomIt->setCoordinates(startPos, width);
                bottomIt->bseg()->setChildIndex(i, bottomIt->getArrayIndex());
                bottomIt->bseg()->setChildReversed(i, false);
                bottomIt->bseg()->setTopParseIndex(NULL_INDEX);
            }
        }
    }

    // Test copying when the sequences aren't in the same order.
    //
    // Create an alignment with "Sequence1" positions aligned to
    // "Sequence1" positions, and "Sequence2" to "Sequence2", but try
    // copying the segments to an alignment with "Sequence2" before
    // "Sequence1" in the ordering.
    void createCallBack(Alignment *alignment) {
        hal_size_t alignmentSize = alignment->getNumGenomes();
        CuAssertTrue(_testCase, alignmentSize == 0);

        // Hacky: Need a different alignment to test copying the bottom
        // segments correctly.  (the names of a node's children are used
        // when copying bottom segments, and two genomes can't have the same
        // name in the same alignment)
        _path = getTempFile();
        _secondAlignment = AlignmentPtr(getTestAlignmentInstances(alignment->getStorageFormat(), _path, CREATE_ACCESS));

        Genome *rootGenome = alignment->addRootGenome("root", 0);
        Genome *internalGenome = alignment->addLeafGenome("internal", "root", 0);
        Genome *leaf1Genome = alignment->addLeafGenome("leaf1", "root", 0);
        Genome *leaf2Genome = alignment->addLeafGenome("leaf2", "internal", 0);
        Genome *copyRootGenome = _secondAlignment->addRootGenome("root", 0);
        Genome *copyInternalGenome = _secondAlignment->addLeafGenome("internal", "root", 0);
        Genome *copyLeaf1Genome = _secondAlignment->addLeafGenome("leaf1", "root", 0);
        Genome *copyLeaf2Genome = _secondAlignment->addLeafGenome("leaf2", "internal", 0);

        vector<Sequence::Info> seqVec(2);
        seqVec[0] = Sequence::Info("Sequence1", 130, 0, 13);
        seqVec[1] = Sequence::Info("Sequence2", 170, 0, 17);
        rootGenome->setDimensions(seqVec);
        rootGenome->setString(randomString(rootGenome->getSequenceLength()));
        seqVec[0] = Sequence::Info("Sequence1", 130, 13, 13);
        seqVec[1] = Sequence::Info("Sequence2", 170, 17, 17);
        internalGenome->setDimensions(seqVec);
        internalGenome->setString(randomString(internalGenome->getSequenceLength()));
        seqVec[0] = Sequence::Info("Sequence1", 130, 13, 0);
        seqVec[1] = Sequence::Info("Sequence2", 170, 17, 0);
        leaf1Genome->setDimensions(seqVec);
        leaf1Genome->setString(randomString(leaf1Genome->getSequenceLength()));
        leaf2Genome->setDimensions(seqVec);
        leaf2Genome->setString(randomString(leaf2Genome->getSequenceLength()));

        setTopSegments(internalGenome, 10);
        setTopSegments(leaf1Genome, 10);
        setTopSegments(leaf2Genome, 10);

        setBottomSegments(rootGenome, 10);
        setBottomSegments(internalGenome, 10);

        rootGenome->fixParseInfo();
        internalGenome->fixParseInfo();
        leaf1Genome->fixParseInfo();
        leaf2Genome->fixParseInfo();

        seqVec[0] = Sequence::Info("Sequence1", 130, 0, 13);
        seqVec[1] = Sequence::Info("Sequence2", 170, 0, 17);
        copyRootGenome->setDimensions(seqVec);
        copyRootGenome->setString(randomString(copyRootGenome->getSequenceLength()));
        seqVec[0] = Sequence::Info("Sequence1", 130, 13, 0);
        seqVec[1] = Sequence::Info("Sequence2", 170, 17, 0);
        copyLeaf1Genome->setDimensions(seqVec);
        copyLeaf2Genome->setDimensions(seqVec);
        copyLeaf1Genome->setString(randomString(copyLeaf1Genome->getSequenceLength()));
        copyLeaf2Genome->setString(randomString(copyLeaf2Genome->getSequenceLength()));
        seqVec[0] = Sequence::Info("Sequence2", 170, 17, 17);
        seqVec[1] = Sequence::Info("Sequence1", 130, 13, 13);
        copyInternalGenome->setDimensions(seqVec);
        copyInternalGenome->setString(randomString(copyInternalGenome->getSequenceLength()));

        rootGenome->copyBottomDimensions(copyRootGenome);
        rootGenome->copyBottomSegments(copyRootGenome);
        copyRootGenome->fixParseInfo();

        internalGenome->copyBottomDimensions(copyInternalGenome);
        internalGenome->copyBottomSegments(copyInternalGenome);
        internalGenome->copyTopDimensions(copyInternalGenome);
        internalGenome->copyTopSegments(copyInternalGenome);
        copyInternalGenome->fixParseInfo();

        leaf1Genome->copyTopDimensions(copyLeaf1Genome);
        leaf1Genome->copyTopSegments(copyLeaf1Genome);
        copyLeaf1Genome->fixParseInfo();

        leaf2Genome->copyTopDimensions(copyLeaf2Genome);
        leaf2Genome->copyTopSegments(copyLeaf2Genome);
        copyLeaf2Genome->fixParseInfo();

        _secondAlignment->close();
    }

    void checkBottomSegments(Genome *genome, hal_size_t width, CuTest *testCase) {
        hal_size_t numChildren = genome->getNumChildren();
        BottomSegmentIteratorPtr bottomIt = genome->getBottomSegmentIterator();
        hal_size_t n = genome->getNumBottomSegments();
        hal_index_t startPos = 0;
        for (; bottomIt->getArrayIndex() < n; bottomIt->toRight(), startPos += width) {
            CuAssertTrue(testCase, bottomIt->getStartPosition() == startPos);

            for (hal_size_t i = 0; i < numChildren; i++) {
                if (startPos < 170) {
                    CuAssertStrEquals(testCase, "Sequence2", genome->getSequenceBySite(startPos)->getName().c_str());
                    CuAssertTrue(testCase, bottomIt->bseg()->getChildIndex(i) == 13 + bottomIt->getArrayIndex());
                } else {
                    CuAssertStrEquals(testCase, "Sequence1", genome->getSequenceBySite(startPos)->getName().c_str());
                    CuAssertTrue(testCase, bottomIt->bseg()->getChildIndex(i) == bottomIt->getArrayIndex() - 17);
                }
            }
        }
    }

    void checkTopSegments(Genome *genome, hal_size_t width, CuTest *testCase) {
    }

    void checkCallBack(const Alignment *alignment) {
        // FIXME: halAlignment->open() fails miserably but
        // openHalAlignmentReadOnly works? Probably some state isn't cleared
        // on close.
        AlignmentPtr tmp(getTestAlignmentInstances(alignment->getStorageFormat(), _path, WRITE_ACCESS));
        _secondAlignment = tmp;

        Genome *copyRootGenome = _secondAlignment->openGenome("root");
        Sequence *sequence2 = copyRootGenome->getSequenceBySite(0);
        CuAssertStrEquals(_testCase, sequence2->getName().c_str(), "Sequence1");
        Sequence *sequence1 = copyRootGenome->getSequenceBySite(170);
        CuAssertStrEquals(_testCase, sequence1->getName().c_str(), "Sequence2");

        Genome *copyInternalGenome = _secondAlignment->openGenome("internal");
        sequence2 = copyInternalGenome->getSequenceBySite(0);
        CuAssertStrEquals(_testCase, sequence2->getName().c_str(), "Sequence2");
        sequence1 = copyInternalGenome->getSequenceBySite(170);
        CuAssertStrEquals(_testCase, sequence1->getName().c_str(), "Sequence1");

        checkBottomSegments(copyInternalGenome, 10, _testCase);

        validateAlignment(_secondAlignment.get());

        _secondAlignment->close();
        remove(_path.c_str());
    }
};

static void halGenomeCopySegmentsWhenSequencesOutOfOrderTest(CuTest *testCase) {
    GenomeCopySegmentsWhenSequencesOutOfOrderTest tester;
    tester.check(testCase);
}

static void halGenomeMetaTest(CuTest *testCase) {
    GenomeMetaTest tester;
    tester.check(testCase);
}

static void halGenomeCreateTest(CuTest *testCase) {
    GenomeCreateTest tester;
    tester.check(testCase);
}

static void halGenomeUpdateTest(CuTest *testCase) {
    GenomeUpdateTest tester;
    tester.check(testCase);
}

static void halGenomeStringTest(CuTest *testCase) {
    GenomeStringTest tester;
    tester.check(testCase);
}

static void halGenomeCopyTest(CuTest *testCase) {
    GenomeCopyTest tester;
    tester.check(testCase);
}

static void halGenomeDNAPackUnpackTest(CuTest *testCase) {
    const char *DNA = "CCTTTTGAGAATTGATGGTGTGGATAAAGCCTTTCATTCATAAACACTCAAGGTACCACACTGTAAAAGGGTCAGTAAGT";
    char packed[strlen(DNA)];
    for (uint64_t i = 0; i < strlen(DNA); i++) {
        packed[i / 2] = dnaPack(DNA[i], i, packed[i / 2]);
    }
    for (uint64_t i = 0; i < strlen(DNA); i++) {
        CuAssertIntEquals(testCase, dnaUnpack(i, packed[i / 2]), DNA[i]);
    }
}

static CuSuite *halGenomeTestSuite(void) {
    CuSuite *suite = CuSuiteNew();
    SUITE_ADD_TEST(suite, halGenomeMetaTest);
    SUITE_ADD_TEST(suite, halGenomeCreateTest);
    SUITE_ADD_TEST(suite, halGenomeUpdateTest);
    SUITE_ADD_TEST(suite, halGenomeStringTest);
    SUITE_ADD_TEST(suite, halGenomeCopyTest);
    SUITE_ADD_TEST(suite, halGenomeCopySegmentsWhenSequencesOutOfOrderTest);
    SUITE_ADD_TEST(suite, halGenomeDNAPackUnpackTest);
    return suite;
}

int main(int argc, char *argv[]) {
    return runHalTestSuite(argc, argv, halGenomeTestSuite());
}


text:
package com.conversantmedia.mapreduce.tool;

import java.util.ListIterator;

import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;

/**
 * Parser override to ignore unknown options. This
 * enables us to parse config file option
 *
 */
public class IgnoreUnknownParser extends PosixParser {

	@Override
	@SuppressWarnings("rawtypes")
	protected void processOption(String arg, ListIterator iter)
			throws ParseException {
		boolean hasOption = getOptions().hasOption(arg);
		if (hasOption) {
			super.processOption(arg, iter);
		}
	}
}


text:
<?php

namespace SymfonyContrib\Bundle\EmailTemplateBundle\Twig\Loader;

use SymfonyContrib\Bundle\EmailTemplateBundle\Entity\Repository\EmailTemplateRepository;
use SymfonyContrib\Bundle\EmailTemplateBundle\Entity\EmailTemplate;

/**
 *
 */
class EmailDoctrineLoader implements \Twig_LoaderInterface, \Twig_ExistsLoaderInterface
{
    const PREFIX = 'et:';

    /** @var  EmailTemplateRepository */
    protected $doctrineRepo;

    public function __construct(EmailTemplateRepository $doctrineRepo)
    {
        $this->doctrineRepo = $doctrineRepo;
    }

    /**
     * {@inheritdoc}
     */
    public function exists($name)
    {
        try {
            $this->getTemplate($name);

            return  true;
        } catch (\Twig_Error_Loader $exception) {
            return false;
        }
    }

    /**
     * Gets the source code of a template, given its name.
     *
     * @param string $name The name of the template to load
     *
     * @return string The template source code
     *
     * @throws \Twig_Error_Loader When $name is not found
     */
    public function getSource($name)
    {
        // Build twig source from entity parts.
        $template = $this->getTemplate($name);

        $source  = '{%- block from -%}';
        $source .= $template->getFrom();
        $source .= '{%- endblock -%}';

        $source .= '{%- block cc -%}';
        $source .= $template->getCc() ? implode(',', $template->getCc()) : '';
        $source .= '{%- endblock -%}';

        $source .= '{%- block bcc -%}';
        $source .= $template->getBcc() ? implode(',', $template->getBcc()) : '';
        $source .= '{%- endblock -%}';

        $source .= '{%- block subject -%}';
        $source .= $template->getSubject();
        $source .= '{%- endblock -%}';

        $source .= '{%- block html_body -%}';
        $source .= $template->getHtmlBody();
        $source .= '{%- endblock -%}';

        $source .= '{%- block txt_body -%}';
        $source .= $template->getTxtBody();
        $source .= '{%- endblock -%}';

        return $source;
    }

    /**
     * Gets the cache key to use for the cache for a given template name.
     *
     * @param string $name The name of the template to load
     *
     * @return string The cache key
     *
     * @throws \Twig_Error_Loader When $name is not found
     */
    public function getCacheKey($name)
    {
        return '__email_template__' . $this->parseName($name);
    }

    /**
     * Returns true if the template is still fresh.
     *
     * @param string  $name The template name.
     * @param integer $time The last modification time of the cached template.
     *
     * @return bool True if the template is fresh, false otherwise.
     *
     * @throws \Twig_Error_Loader When $name is not found
     */
    public function isFresh($name, $time)
    {
        $lastModified = $this->getTemplate($name)->getUpdatedAt()->getTimestamp();

        return $lastModified <= $time;
    }

    /**
     * @param string $name
     *
     * @return EmailTemplate
     *
     * @throws \Twig_Error_Loader
     */
    protected function getTemplate($name)
    {
        $this->validateName($name);

        $name     = $this->parseName($name);
        $template = $this->doctrineRepo->find($name);

        if ($template === null) {
            throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $name));
        }

        return $template;
    }

    protected function validateName($name)
    {
        if (strpos($name, "\0") !== false) {
            throw new \Twig_Error_Loader('A template name cannot contain NUL bytes.');
        }

        if (strpos($name, self::PREFIX) !== 0) {
            throw new \Twig_Error_Loader('Invalid Doctrine email template name.');
        }
    }

    protected function parseName($name)
    {
        return preg_replace('~^' . self::PREFIX . '~', '', $name, 1);
    }
}


text:
export Login from './login'
export Register from './register'
export Logout from './logout'
export Connect from './connect'
export AuthPanel from './panel'


text:
title: Lake Tekapo Scenic Resort

listing-type: accommodation
island: south
region: canterbury
destination: Lake Tekapo

order: a
image-path: lake-tekapo-resort.jpg
image-alt: Lake Tekapo Scenic Resort
refer-url: http://www.laketekapo.com/
---
Offers  self-contained motel accommodation in a central location featuring wireless Internet access and views over Lake Tekapo and the surrounding mountains.


text:
namespace signin {
namespace android {
// A bridge between the Java and C++ AccountTrackerService.
bool RegisterAccountTrackerService(JNIEnv* env);

}  // namespace android
}  // namespace signin

#endif  // CHROME_BROWSER_ANDROID_SIGNIN_ACCOUNT_TRACKER_SERVICE_ANDROID_H_


text:
using FlatRedBall.Glue.MVVM;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TopDownPlugin.ViewModels
{
    public class AllAnimationValuesViewModel : ViewModel
    {
        public ObservableCollection<AnimationRowViewModel> AnimationRows { get; private set; } =
            new ObservableCollection<AnimationRowViewModel>();
    }
}


text:
import stem
import stem.connection

import time
import urllib2

from stem import Signal
from stem.control import Controller

# initialize some HTTP headers
# for later usage in URL requests
user_agent = 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.7) Gecko/2009021910 Firefox/3.0.7'
headers={'User-Agent':user_agent}

# initialize some
# holding variables
oldIP = "0.0.0.0"
newIP = "0.0.0.0"

# how many IP addresses
# through which to iterate?
nbrOfIpAddresses = 3

# seconds between
# IP address checks
secondsBetweenChecks = 2

# request a URL
def request(url):
    # communicate with TOR via a local proxy (privoxy)
    def _set_urlproxy():
        proxy_support = urllib2.ProxyHandler({"http" : "127.0.0.1:8118"})
        opener = urllib2.build_opener(proxy_support)
        urllib2.install_opener(opener)

    # request a URL
    # via the proxy
    _set_urlproxy()
    request=urllib2.Request(url, None, headers)
    return urllib2.urlopen(request).read()

# signal TOR for a new connection
def renew_connection():
    with Controller.from_port(port = 9051) as controller:
        controller.authenticate(password = 'my_password')
        controller.signal(Signal.NEWNYM)
        controller.close()

# cycle through
# the specified number
# of IP addresses via TOR
for i in range(0, nbrOfIpAddresses):

    # if it's the first pass
    if newIP == "0.0.0.0":
        # renew the TOR connection
        renew_connection()
        # obtain the "new" IP address
        newIP = request("http://icanhazip.com/")
    # otherwise
    else:
        # remember the
        # "new" IP address
        # as the "old" IP address
        oldIP = newIP
        # refresh the TOR connection
        renew_connection()
        # obtain the "new" IP address
        newIP = request("http://icanhazip.com/")

    # zero the
    # elapsed seconds
    seconds = 0

    # loop until the "new" IP address
    # is different than the "old" IP address,
    # as it may take the TOR network some
    # time to effect a different IP address
    while oldIP == newIP:
        # sleep this thread
        # for the specified duration
        time.sleep(secondsBetweenChecks)
        # track the elapsed seconds
        seconds += secondsBetweenChecks
        # obtain the current IP address
        newIP = request("http://icanhazip.com/")
        # signal that the program is still awaiting a different IP address
        print ("%d seconds elapsed awaiting a different IP address." % seconds)
    # output the
    # new IP address
    print ("")
    print ("newIP: %s" % newIP)


text:
<?php

namespace Shoplift\RouteFilter;

use Zend\Http\PhpEnvironment\Request;
use Zend\Mvc\MvcEvent;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorAwareTrait;
use Zend\InputFilter\Factory as FilterFactory;
use Zend\Stdlib\Parameters;
use ZF\ApiProblem\ApiProblem;
use ZF\ApiProblem\ApiProblemResponse;

class RouteListener implements ServiceLocatorAwareInterface
{
    use ServiceLocatorAwareTrait;

    /**
     * @var array|null
     */
    protected $config = null;

    /**
     * @var FilterFactory
     */
    protected $filterFactory;

    public function __invoke(MvcEvent $event)
    {
        $route = $event->getRouteMatch();
        $paramTypeFilters = $this->getFiltersForRoute($route->getMatchedRouteName());

        foreach ($paramTypeFilters as $type => $filters) {
            $type = strtolower($type);
            switch ($type) {
                case 'query':
                    $request = $event->getRequest();
                    if ($request instanceof Request) {
                        $filtered = $this->filterParameters($filters, $request->getQuery());
                        if ($filtered instanceof ApiProblemResponse) {
                            return $filtered;
                        }
                        $request->setQuery($filtered);
                    }
                    break;

                case 'route':
                    $filtered = $this->filterParameters($filters, $route->getParams());
                    if ($filtered instanceof ApiProblemResponse) {
                        return $filtered;
                    }
                    foreach ($filtered as $key => $value) {
                        $route->setParam($key, $value);
                    }
                    break;
            }
        }

        return true;
    }

    /**
     * @param FilterFactory $filterFactory
     * @return $this
     */
    public function setFilterFactory(FilterFactory $filterFactory)
    {
        $this->filterFactory = $filterFactory;
        return $this;
    }

    /**
     * @return FilterFactory
     */
    public function getFilterFactory()
    {
        if (! $this->filterFactory) {
            $this->filterFactory = new FilterFactory();
            $this->filterFactory->setInputFilterManager($this->getServiceLocator()->get('InputFilterManager'));
        }
        return $this->filterFactory;
    }

    /**
     *
     * @param array            $filterSpec
     * @param array|Parameters $parameters
     * @return array|Parameters|ApiProblemResponse
     */
    protected function filterParameters(array $filterSpec, $parameters)
    {
        $filter = $this->getFilterFactory()->createInputFilter($filterSpec);
        $filter->setData($parameters);
        if ($filter->isValid()) {
            $data = $filter->getValues();
            foreach ($parameters as $param => $value) {
                if (isset($data[$param])) {
                    $parameters[$param] = $data[$param];
                }
            }
        } else {
            // Data is not valid
            return new ApiProblemResponse(
                new ApiProblem(422, 'Failed Validation', null, null, array(
                    'validation_messages' => $filter->getMessages(),
                ))
            );
        }

        return $parameters;
    }

    /**
     * Get filter configuration for a matched route
     *
     * @param string $route
     * @return array
     */
    protected function getFiltersForRoute($route)
    {
        if ($this->config === null) {
            $config = $this->getServiceLocator()->get('config');
            if (is_array($config) && isset($config['shoplift-route-filters'])) {
                $this->config = $config['shoplift-route-filters'];
            } else {
                $this->config = array();
            }
        }

        if (isset($this->config[$route])) {
            return $this->config[$route];
        }

        return array();
    }
}


text:
module Gifts::Grit

  class Ref

    class << self

      # Count all Refs
      #   +repo+ is the Repo
      #   +options+ is a Hash of options
      #
      # Returns int
      def count_all(repo, options = {})
        refs = repo.git.refs(options, prefix)
        refs.split("\n").size
      end

      # Find all Refs
      #   +repo+ is the Repo
      #   +options+ is a Hash of options
      #
      # Returns Gifts::Grit::Ref[] (baked)
      def find_all(repo, options = {})
        refs = repo.git.refs(options, prefix)
        refs.split("\n").map do |ref|
          name, id = *ref.split(' ')
          self.new(name, repo, id)
        end
      end

      protected

        def prefix
          "refs/#{name.to_s.gsub(/^.*::/, '').downcase}s"
        end

    end

    attr_reader :name

    # Instantiate a new Head
    #   +name+ is the name of the head
    #   +commit+ is the Commit that the head points to
    #
    # Returns Gifts::Grit::Head (baked)
    def initialize(name, repo, commit_id)
      @name = name
      @commit_id = commit_id
      @repo_ref = repo
      @commit = nil
    end

    def commit
      @commit ||= get_commit
    end

    # Pretty object inspection
    def inspect
      %Q{#<#{self.class.name} "#{@name}">}
    end

    protected

    def get_commit
      Commit.create(@repo_ref, :id => @commit_id)
    end

  end # Ref

  # A Head is a named reference to a Commit. Every Head instance contains a name
  # and a Commit object.
  #
  #   r = Gifts::Grit::Repo.new("/path/to/repo")
  #   h = r.heads.first
  #   h.name       # => "master"
  #   h.commit     # => #<Gifts::Grit::Commit "1c09f116cbc2cb4100fb6935bb162daa4723f455">
  #   h.commit.id  # => "1c09f116cbc2cb4100fb6935bb162daa4723f455"
  class Head < Ref

    # Get the HEAD revision of the repo.
    #   +repo+ is the Repo
    #   +options+ is a Hash of options
    #
    # Returns Gifts::Grit::Head (baked)
    def self.current(repo, options = {})
      head = repo.git.fs_read('HEAD').chomp
      if /ref: refs\/heads\/(.*)/.match(head)
        id = repo.git.rev_parse(options, 'HEAD')
        self.new($1, repo, id)
      end
    end

  end # Head

  class Remote < Ref; end

  class Note < Ref; end

end # Gifts::Grit


text:
package edu.stolaf.cs.wmrserver.streaming;

import java.io.*;
import java.net.*;
import java.util.Arrays;

import org.apache.hadoop.mapred.JobConf;

/** Utilities not available elsewhere in Hadoop.
 *
 */
public class StreamUtil {

	public static URL getClassResource(Class<?> clazz) {
		String simpleName = clazz.getSimpleName();
		return clazz.getResource(simpleName + ".class");
	}

	public static String classNameToPath(String className) {
    String relPath = className;
    relPath = relPath.replace('.', '/');
    relPath += ".class";
		return relPath;
	}

	public static URL getClassResource(String className, ClassLoader loader) {
    return loader.getResource(classNameToPath(className));
	}

	public static String getClassBasePath(URL classUrl, Class<?> clazz) {
    return getClassBasePath(classUrl, clazz.getName());
	}

	public static String getClassBasePath(URL classUrl, String className) {
		String codePath;
    if (classUrl != null) {
      boolean inJar = classUrl.getProtocol().equals("jar");
      codePath = classUrl.toString();
      if (codePath.startsWith("jar:")) {
        codePath = codePath.substring("jar:".length());
      }
      if (codePath.startsWith("file:")) { // can have both
        codePath = codePath.substring("file:".length());
      }
      if (inJar) {
        // A jar spec: remove class suffix in /path/my.jar!/package/Class
        int bang = codePath.lastIndexOf('!');
        codePath = codePath.substring(0, bang);
      } else {
        // A class spec: remove the /my/package/Class.class portion
        int pos = codePath.lastIndexOf(classNameToPath(className));
        if (pos == -1) {
          throw new IllegalArgumentException("invalid codePath: className=" + className
                                             + " codePath=" + codePath);
        }
        codePath = codePath.substring(0, pos);
      }
    } else {
      codePath = null;
    }
    return codePath;
	}

  public static String findInClasspath(String className) {
    return findInClasspath(className, StreamUtil.class.getClassLoader());
  }

  /** @return a jar file path or a base directory or null if not found.
   */
  public static String findInClasspath(String className, ClassLoader loader){
    URL classUrl = getClassResource(className, loader);
    return getClassBasePath(classUrl, className);
  }

	public static String findInClasspath(Class<?> clazz) {
		URL classUrl = getClassResource(clazz);
		return getClassBasePath(classUrl, clazz);
	}

  static class StreamConsumer extends Thread {

    StreamConsumer(InputStream in, OutputStream out) {
      this.bin = new LineNumberReader(new BufferedReader(new InputStreamReader(in)));
      if (out != null) {
        this.bout = new DataOutputStream(out);
      }
    }

    public void run() {
      try {
        String line;
        while ((line = bin.readLine()) != null) {
          if (bout != null) {
            bout.writeUTF(line); //writeChars
            bout.writeChar('\n');
          }
        }
        bout.flush();
      } catch (IOException io) {
      }
    }

    LineNumberReader bin;
    DataOutputStream bout;
  }

  static void exec(String arg, PrintStream log) {
    exec(new String[] { arg }, log);
  }

  static void exec(String[] args, PrintStream log) {
    try {
      log.println("Exec: start: " + Arrays.asList(args));
      Process proc = Runtime.getRuntime().exec(args);
      new StreamConsumer(proc.getErrorStream(), log).start();
      new StreamConsumer(proc.getInputStream(), log).start();
      int status = proc.waitFor();
      //if status != 0
      log.println("Exec: status=" + status + ": " + Arrays.asList(args));
    } catch (InterruptedException in) {
      in.printStackTrace();
    } catch (IOException io) {
      io.printStackTrace();
    }
  }

  // JobConf helpers

  static class TaskId {

    boolean mapTask;
    String jobid;
    int taskid;
    int execid;
  }

  public static boolean isLocalJobTracker(JobConf job) {
    return job.get("mapred.job.tracker", "local").equals("local");
  }

  public static TaskId getTaskInfo(JobConf job) {
    TaskId res = new TaskId();

    String id = job.get("mapred.task.id");
    if (isLocalJobTracker(job)) {
      // it uses difft naming
      res.mapTask = job.getBoolean("mapred.task.is.map", true);
      res.jobid = "0";
      res.taskid = 0;
      res.execid = 0;
    } else {
      String[] e = id.split("_");
      res.mapTask = e[3].equals("m");
      res.jobid = e[1] + "_" + e[2];
      res.taskid = Integer.parseInt(e[4]);
      res.execid = Integer.parseInt(e[5]);
    }
    return res;
  }
}


text:
<!DOCTYPE HTML>

	<meta charset="utf-8">
	<title>Blog Archives - Read My Things</title>
	<meta name="author" content="Jeremy Cerise">

	<meta name="description" content="2013 Play Framework Setup Gotchas Aug 8 Gotchas, Java, Play, Scala, Web Framework, unit tests Comments Generating realistic (two dimensional) …">

	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

	<link href="/atom.xml" rel="alternate" title="Read My Things" type="application/atom+xml">
	<link rel="canonical" href="">
	<link href="/favicon.png" rel="shortcut icon">
	<link href="/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">

Read My Things

Blog

About

Projects

Archives

		Menu

Blog

About

Projects

Archives

			<form action="http://google.com/search" method="get">
				<input type="text" name="q" results="0">
				<input type="hidden" name="q" value="site:www.readmythings.com">
			</form>

		Twitter

		GitHub

		RSS

	<form class="search" action="http://google.com/search" method="get">
		<input class="alignright" type="text" name="q" results="0">
		<input type="hidden" name="q" value="site:www.readmythings.com">
	</form>

2013

Play Framework Setup Gotchas

		Aug  8

	Gotchas, Java, Play, Scala, Web Framework, unit tests

	    Comments

Generating realistic (two dimensional) caverns with cellular automata

		Feb 20

	gamedev, procedural generation, python, roguelikes

	    Comments

2012

Polybius Square Encoding in Python

		Dec  4

	crytopraphy, math, python

	    Comments

ROOT_URL when deploying Meteor to Heroku

		Oct 26

	heroku, js, meteor, meteorjs

	    Comments

Deploying Meteor to Heroku

		Oct 18

	git, heroku, javascript, js, meteor, meteorjs

	    Comments

Node.js project setup gotcha (for a beginner)

		Sep 26

	gotchas, node, node.js, npm

	    Comments

Moving away from Wordpress

		Sep 17

	general, rant

	    Comments

	Copyright © 2013

    Jeremy Cerise


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

<resources>
  <string name="shows">Seriály</string>
  <string name="lists">Zoznamy</string>
  <string name="movies">Filmy</string>
  <string name="statistics">Štatistiky</string>
  <string name="search">Hľadať</string>
  <string name="preferences">Nastavenia</string>
  <string name="help">Pomoc</string>
  <string name="drawer_open">Otvoriť navigačný panel</string>
  <string name="drawer_close">Zavrieť navigačný panel</string>
  <string name="show">Seriál</string>
  <string name="episode">Epizóda</string>
  <string name="episode_number">Epizóda %s</string>
  <string name="episodes">Epizódy</string>
  <string name="season">Séria</string>
  <string name="season_number">Séria %s</string>
  <string name="seasons">Série</string>
  <string name="specialseason">Skryť bonusové epizódy</string>
  <string name="description_overview">Prehľad</string>
  <string name="description_poster">Zobraziť plagát</string>
  <string name="description_image">Obrázok z epizódy</string>
  <string name="clear">Zmazať</string>
  <string name="clear_search_history">Vymazať históriu vyhľadávania</string>
  <string name="discard">Zrušiť</string>
  <string name="save_selection">Uložiť výber</string>
  <string name="search_hint">Hľadať epizódy</string>
  <string name="action_display_all">Zobraziť všetko</string>
  <string name="updated">Aktualizované na najnovšiu verziu.</string>
  <string name="norating">Nedostupné</string>
  <string name="unknown">neznámy</string>
  <string name="offline">Pripojte sa k sieti a skúste to znovu.</string>
  <string name="offline_no_wifi">Pripojte sa k Wi-Fi alebo povoľte všetky pripojenia a skúste to znova.</string>
  <string name="app_not_available">Žiadna použiteľná aplikácia k dispozícii.</string>
  <string name="add_empty">Niesú tu žiadne seriály.</string>
  <string name="people_empty">Nikde nikto?! Skúste to znova.</string>
  <string name="database_error">nemožno upraviť dáta.</string>
  <string name="share">Zdieľať</string>
  <string name="share_show">Zdieľať reláciu</string>
  <string name="share_episode">Zdieľať epizódu</string>
  <string name="share_movie">Zdieľať film</string>
  <string name="share_checkout">Odhlásiť %s</string>
  <string name="comments">Komentáre</string>
  <string name="shout_hint">Napíšte komentár (5 a viac slov)</string>
  <string name="shout_invalid">Váš komentár nezodpovedá pravidlám!</string>
  <string name="shout">Zakrič!</string>
  <string name="isspoiler">Prezradenie deja!</string>
  <string name="no_shouts">Buď prvý kto zakričí!</string>
  <string name="refresh">Obnoviť</string>
  <string name="movies_collection">Kolekcia</string>
  <string name="movies_watchlist">Watchlist</string>
  <string name="watchlist_add">Pridať do zoznamu videných</string>
  <string name="watchlist_remove">Vymazať zo zoznamu videných</string>
  <string name="watchlist_added">Pridané do zoznamu videných</string>
  <string name="watchlist_removed">Odstránené zo zoznamu videných</string>
  <string name="movies_search_hint">Zadajte názov filmu</string>
  <string name="movies_empty">Hľadať zadaný film.</string>
  <string name="movies_collection_empty">Do zbierky ste nepridali žiadne filmy.</string>
  <string name="movies_watchlist_empty">Do watchlistu ste nepridali žiadne filmy.</string>
  <string name="trailer">Trailer</string>
  <string name="movie_cast">Obsadenie</string>
  <string name="movie_crew">Kolektív</string>
  <string name="action_movies_sort">Zoradiť filmy</string>
  <string name="action_movies_sort_title">Názov</string>
  <string name="action_movies_sort_release">Prvýkrát odvysielané</string>
  <string name="statistics_shows">Seriály</string>
  <string name="statistics_episodes">Epizódy</string>
  <string name="statistics_movies">Filmy</string>
  <string name="shows_with_next">%s s ďalšími epizódami</string>
  <string name="shows_continuing">%s pokračujúcich</string>
  <string name="episodes_watched">%s videných</string>
  <string name="runtime_all_episodes">Celkový čas všetkých videných epizód</string>
  <string name="movies_on_watchlist">%s na watchliste</string>
  <string name="runtime_movies_watchlist">Celková dĺžka filmov na watchliste</string>
  <plurals name="days_plural">
    <item quantity="one">%d deň</item>
    <item quantity="zero">%d dní</item>
    <item quantity="two">%d dni</item>
    <item quantity="few">%d dni</item>
    <item quantity="many">%d dní</item>
    <item quantity="other">%d dní</item>
  </plurals>
  <plurals name="hours_plural">
    <item quantity="zero">%d hodín</item>
    <item quantity="one">%d hodina</item>
    <item quantity="two">%d hodiny</item>
    <item quantity="few">%d hodiny</item>
    <item quantity="many">%d hodín</item>
    <item quantity="other">%d hodín</item>
  </plurals>
  <plurals name="minutes_plural">
    <item quantity="zero">%d minút</item>
    <item quantity="one">%d minúta</item>
    <item quantity="two">%d minúty</item>
    <item quantity="few">%d minúty</item>
    <item quantity="many">%d minút</item>
    <item quantity="other">%d minút</item>
  </plurals>
  <string name="episode_number_absolute">CELKOVO</string>
  <string name="episode_number_disk">DVD</string>
  <string name="episode_firstaired">Prvýkrát odvysielané</string>
  <string name="episode_firstaired_unknown">Neznáme dátum odvysielaní</string>
  <string name="episode_dvdnumber">DVD epizóda</string>
  <string name="show_actors">Herci</string>
  <string name="original_release">Pôvodná verzia</string>
  <string name="show_on_network">na %s</string>
  <string name="show_genres">Žánre</string>
  <string name="show_runtime">Dĺžka</string>
  <string name="show_contentrating">Hodnotenie obsahu</string>
  <string name="show_release_times">Bude vydané v</string>
  <string name="episode_directors">Režiséri</string>
  <string name="episode_gueststars">Hosťujúci herci</string>
  <string name="episode_writers">Scenár</string>
  <string name="show_isalive">Vysiela sa</string>
  <string name="show_isnotalive">Skončil</string>
  <string name="lastEdit">Posledné úpravy / / TVDb</string>
  <string name="services_watch">Zhliadnuť</string>
  <string name="services_more">Viac</string>
  <string name="today">dnes</string>
  <string name="now">teraz</string>
  <string name="daily">Deňne</string>
  <string name="release_date_and_day">%1$s (%2$s)</string>
  <string name="runtime_minutes">%s min</string>
  <string name="mark_all">Pozreté všetky</string>
  <string name="unmark_all">Nepozreté žiadne</string>
  <string name="mark_untilhere">Prezreté všetky predchádzajúce</string>
  <string name="collect_all">Pridať sériu do zbierky</string>
  <string name="uncollect_all">Odobrané zo zbierky</string>
  <string name="action_skip">Preskočiť</string>
  <string name="action_dont_skip">Nepreskakovať</string>
  <string name="action_collection_add">Pridať do zbierky</string>
  <string name="action_collection_remove">Odstrániť zo zbierky</string>
  <string name="action_collection_added">Pridané do zbierky</string>
  <string name="action_collection_removed">Odstránené zo zbierky</string>
  <string name="action_watched">Zhliadnute</string>
  <string name="action_unwatched">Nezhliadnute</string>
  <string name="confirm_delete">Naozaj chcete odstrániť %s?</string>
  <string name="delete_error">Seriál nemožno odstrániť. Skúste to znova neskôr.</string>
  <string name="delete_show">Odstrániť</string>
  <string name="no_nextepisode">žiadne ďalšie epizódy sa nenašli</string>
  <string name="context_favorite">Obľúbené</string>
  <string name="context_unfavorite">Odstrániť z obľúbených položiek</string>
  <string name="favorited">Pridané k obľúbeným</string>
  <string name="unfavorited">Odstránené z obľúbených</string>
  <string name="context_hide">Skryť</string>
  <string name="context_unhide">Obnoviť</string>
  <string name="hidden">Skrytý seriál</string>
  <string name="unhidden">Obnovený seriál</string>
  <string name="action_shows_add">Pridať seriál</string>
  <string name="action_shows_filter">Triediť seriály</string>
  <string name="empty_filter">Odstrániť všetky triedenia</string>
  <string name="action_shows_filter_favorites">Obľúbené</string>
  <string name="action_shows_filter_unwatched">Nevidené</string>
  <string name="action_shows_filter_upcoming">Nadchádzajúce</string>
  <string name="action_shows_filter_hidden">Skryté</string>
  <string name="action_shows_sort">Zoradiť seriály</string>
  <string name="action_shows_sort_title">Názov</string>
  <string name="action_shows_sort_episode">Ďalšia epizóda</string>
  <string name="action_shows_sort_favorites">Uprednostniť obľúbené</string>
  <string name="updateall_yes">Aktualizovať (všetky)</string>
  <string name="menu_update_delta">Aktualizácia (iba zastaralé)</string>
  <string name="context_updateshow">Aktualizovať</string>
  <string name="context_marknext">Ďalšia pozretá epizóda</string>
  <string name="now_tab">Teraz</string>
  <string name="recently_watched">Nedávno videné</string>
  <string name="released_today">Vydané Dnes</string>
  <string name="friends_recently">Vaši trakt priatelia</string>
  <string name="now_empty">Nič nebeží. Pozri nejaké seriály!</string>
  <string name="upcoming">Nadchádzajúce</string>
  <string name="recent">Nedávne</string>
  <string name="friends">Priatelia</string>
  <string name="friends_empty">Žiadna činnosť priateľov na trakte.</string>
  <string name="user_stream">História</string>
  <string name="user_stream_empty">Žiadna história na trakt. Pozri sa na nejaké seriály!</string>
  <string name="user_movie_stream_empty">Žiadna nedávna aktivita na trakt. Pozri sa na nejaké filmy</string>
  <string name="noupcoming">Žiadne nadchádzajúce epizódy.</string>
  <string name="norecent">Žiadne nedávne epizódy.</string>
  <string name="only_favorites">Iba obľúbené seriály</string>
  <string name="pref_infinite_scrolling">Neobmedzená činnosť</string>
  <string name="action_activity_filter">Filter činností</string>
  <string name="update_scheduled">Aktualizuje sa...</string>
  <string name="update_no_connection">Pre aktualizáciu sa pripojte k internetu</string>
  <string name="update_inprogress">Prebieha aktualizácia, skúste to neskôr.</string>
  <string name="season_watchcount">nepozreté epizódy</string>
  <string name="season_allwatched">Všetky epizódy pozreté</string>
  <string name="season_onenotwatched">epizóda nepozretá</string>
  <string name="season_unaired">neodvysielané</string>
  <string name="oneotherepisode">iná epizóda</string>
  <string name="otherepisodes">iné epizódy</string>
  <string name="remaining">%s do konca</string>
  <string name="no_results">Žiadne výsledky, skúste celé slová.</string>
  <string name="search_error">Hľadanie zlyhalo, skúste to neskôr.</string>
  <string name="add_all">Pridaj všetky</string>
  <string name="add_multiple">Všetky seriály sa zakrátko zobrazia vo vašom zozname.</string>
  <string name="add_started">%s sa čoskoro zobrazí v zozname seriálov.</string>
  <string name="add_error">Nemožno pridať %s.</string>
  <string name="add_already_exists">%s je už vo vašom zozname.</string>
  <string name="recommended">Odporúčané</string>
  <string name="library">Knižnica</string>
  <string name="watchlist">Watchlist</string>
  <string name="first_list">Prvý zoznam</string>
  <string name="list_add">Pridať zoznam</string>
  <string name="list_title_hint">Názov zoznamu</string>
  <string name="list_remove">Odstrániť zoznam</string>
  <string name="list_manage">Spravovať zoznam</string>
  <string name="list_item_manage">Spravovať zoznamy</string>
  <string name="list_item_remove">Odstrániť zo zoznamu</string>
  <string name="list_empty">Do tohto zoznamu môžete pridať seriály, sezóny alebo epizódy.</string>
  <string name="action_lists_sort">Zoriadiť zoznamy</string>
  <string name="action_lists_reorder">zoradiť zoznamy</string>
  <string name="hexagon_warning">Experimentovanie!</string>
  <string name="hexagon_setup">Nastaviť SeriesGuide Cloud</string>
  <string name="hexagon_description">Pripojte sa ku cloudu pre zálohovanie a synchronizovanie seriálov a filmov.</string>
  <string name="hexagon_warning_lists">Zoznamy nie su zahrnuté</string>
  <string name="hexagon_warning_trakt">When using SeriesGuide Cloud, changes on trakt will not sync down to SeriesGuide.</string>
  <string name="hexagon_signin">Prihlásiť sa</string>
  <string name="hexagon_signed_in">You are connected to SeriesGuide Cloud.</string>
  <string name="hexagon_signout">Odhlásiť sa</string>
  <string name="hexagon_setup_incomplete">Setting up SeriesGuide Cloud was not completed.</string>
  <string name="hexagon_setup_fail_auth">Your Google account did not check out.</string>
  <string name="hexagon_remove_account">Remove account</string>
  <string name="hexagon_remove_account_success">Account obliterated.</string>
  <string name="hexagon_remove_account_failure">Could not remove account.</string>
  <string name="hexagon_remove_account_confirmation">Removing your account will delete all shows and movies from SeriesGuide Cloud. Make sure to remove it on other connected devices as well.</string>
  <string name="hexagon_api_error">Could not talk to SeriesGuide Cloud. Try again later.</string>
  <string name="hexagon_api_queued">Sending to SeriesGuide Cloud.</string>
  <string name="trakt_submitqueued">Odosiela sa na trakt.</string>
  <string name="trakt_seen">%s pozrené.</string>
  <string name="trakt_notseen">%s nových.</string>
  <string name="trakt_collected">%s zozbieraných.</string>
  <string name="trakt_notcollected">%s nezozbieraných.</string>
  <string name="checkin_success_trakt">Checked into %s on trakt.</string>
  <string name="checkin_canceled_success_trakt">Cancelled check-in on trakt.</string>
  <string name="checkin_error_not_exists">Item not (yet) found on trakt. Try again later.</string>
  <string name="traktcheckin_cancel">Prepísať</string>
  <string name="traktcheckin_inprogress">You are already checked into another episode or movie. Either override the previous check-in or wait %s and try again.</string>
  <string name="traktcheckin_wait">Budem čakať</string>
  <string name="trakt_success">Sent to trakt.</string>
  <string name="trakt_error_credentials">Something went wrong. Check your credentials and try again.</string>
  <string name="trakt_error_general">Could not talk to trakt. Try again later.</string>
  <string name="trakt_account">trakt account</string>
  <string name="trakt_connect_instructions">On the next screen sign into trakt or create a new account. Then allow SeriesGuide access to your trakt account.</string>
  <string name="connect_trakt">Pripojenie na trakt.tv</string>
  <string name="trakt_reconnect">Connect SeriesGuide to trakt</string>
  <string name="trakt_reconnect_details">Check your trakt credentials</string>
  <string name="username">Užívateľské meno</string>
  <string name="waitplease">Prosím, chvíľku počkajte…</string>
  <string name="connect">Pripojiť</string>
  <string name="disconnect">Odpojiť</string>
  <string name="connect_trakt_done">Pripojený do trakt.tv!</string>
  <string name="connect_trakt_done_explanation">SeriesGuide will now sync the shows and movies on this device with trakt. This may take some time.</string>
  <string name="add_trakt_shows">Pridať seriály z knižnice:</string>
  <string name="show_library">Zobraziť knižnicu</string>
  <string name="about_trakt">trakt helps keep a record of what TV shows and movies you are watching. Learn more</string>
  <string name="action_rate">Ohodnotiť</string>
  <string name="your_rating">Vaše hodnotenie</string>
  <string name="love">Totálna pecka!</string>
  <string name="hate">Odpad :(</string>
  <string name="rating2">Hrozné</string>
  <string name="rating3">Zlé</string>
  <string name="rating4">Slabé</string>
  <string name="rating5">Dal sa</string>
  <string name="rating6">Priemerné</string>
  <string name="rating7">Dobré</string>
  <string name="rating8">Skvelé</string>
  <string name="rating9">Vynikajúce</string>
  <plurals name="votes">
    <item quantity="zero">%d hlasov</item>
    <item quantity="one">%d hlas</item>
    <item quantity="two">%d hlasy</item>
    <item quantity="few">%d hlasy</item>
    <item quantity="many">%d hlasov</item>
    <item quantity="other">%d hlasov</item>
  </plurals>
  <string name="feedback">Poslať reakciu</string>
  <string name="action_open_in_browser">Open in browser</string>
  <string name="prefs_category_basic">Základné</string>
  <string name="prefs_category_sharing">Služby</string>
  <string name="prefs_category_advanced">Pokročilé</string>
  <string name="prefs_category_about">O aplikácii</string>
  <string name="pref_onlyfuture">Nezobrazovať odvysielané epizódy</string>
  <string name="pref_onlyfuturesummary">Nikdy nebude zobrazovať odvysielané epizódy</string>
  <string name="pref_onlyseasoneps">Skryť bonusové epizódy</string>
  <string name="pref_onlyseasonepssummary">Bonusové epizódy sa budú zobrazovať jedine v zozname sérií</string>
  <string name="pref_seasonsorting">Zoradiť série podľa…</string>
  <string name="pref_episodesorting">Zoradiť epizódy podľa…</string>
  <string name="pref_language">Jazyk obsahu</string>
  <string name="pref_updatewifionly">Zobrazovať obrázky výlučne cez Wi-Fi</string>
  <string name="pref_updatewifionlysummary">Pre zníženie platieb za prenos dát. Obrázky sa nebudú sťahovať cez mobilnú sieť</string>
  <string name="about">O SeriesGuide</string>
  <string name="pref_credits">Credits</string>
  <string name="pref_traktsummary">Pridať/Upraviť prihlasovacie údaje</string>
  <string name="pref_autoaddshows">Pridávať nové seriály z trakt.tv</string>
  <string name="pref_autoaddshowssummary">Automaticky pridávať seriály z vašej aktivity na trakt.tv</string>
  <string name="sort">Zoradiť podľa</string>
  <string name="action_sort_ignore_articles">Ignore articles</string>
  <string name="sort_order_latest_first">Od najnovších</string>
  <string name="sort_order_oldest_first">Od najstarších</string>
  <string name="sort_order_unwatched_first">Od nezhliadnutých</string>
  <string name="sort_order_alphabetical">A - Z</string>
  <string name="sort_order_top_rated_first">Najlepšie hodnotené</string>
  <string name="sort_order_latest_first_dvd">Od najnovších (DVD)</string>
  <string name="sort_order_oldest_first_dvd">Od najstarších (DVD)</string>
  <string name="upcoming_upto_now">teraz</string>
  <string name="upcoming_upto_one_day">denne</string>
  <string name="upcoming_upto_three_days">3 dní</string>
  <string name="upcoming_upto_one_week">týždenne</string>
  <string name="upcoming_upto_two_weeks">dva týždne</string>
  <string name="upcoming_upto_one_month">mesiaca</string>
  <string name="upcoming_upto_one_hour">1 hour</string>
  <string name="upcoming_upto_six_hours">6 hours</string>
  <string name="upcoming_upto_half_day">12 hours</string>
  <string name="pref_appearance">Vzhľad</string>
  <string name="pref_theme">Téma</string>
  <string name="pref_other">Ostatné</string>
  <string name="pref_autoupdate">Aktualizovať automaticky</string>
  <string name="pref_autoupdatesummary">Pravidelná aktualizácia vašich seriálov</string>
  <string name="pref_autobackup">Turn on Auto Backup</string>
  <string name="pref_autobackupsummary">Weekly backup of your show database into the Download folder</string>
  <string name="backup">Zálohovanie / obnovenie</string>
  <string name="backup_summary">Zálohovanie alebo obnovenie vašich seriálov</string>
  <string name="pref_upcominglimit">Nadchádzajúce seriály počas…</string>
  <string name="pref_number">Formát číslovania</string>
  <string name="pref_offset">Manuálny časový posun</string>
  <string name="pref_offsetsummary">Kompenzácia času [offset] %s hodín</string>
  <string name="clear_cache">Vymazať vyrovnávaciu pamäť obrázkov</string>
  <string name="clear_cache_summary">Odstrániť všetky obrázky stiahnuté do zariadenia</string>
  <string name="pref_ganalyticssummary">Sledovať používanie aplikácie pre zlepšenie SeriesGuide</string>
  <string name="backup_description">Záloha bude obsahovať vaše seriály, série, epizódy a zoznamy ktorú budú uložené do súboru JSON v uvedenom priečinku nižšie.\n Obnova je možná jedine vtedy ak sa súbor JSON nachádza v priečinku uvedenom nižšie. Preto sa pred obnovou uistite že sa tam súbor nachádza!</string>
  <string name="backup_full_dump">Zahrnúť metadata ako popisy, herci alebo hodnotenie.</string>
  <string name="backup_path">Priečinok zálohy</string>
  <string name="backup_version">Verzia databázy</string>
  <string name="backup_failed_nosd">Nemožno zálohovať. Adresár so zálohov nie je dostupný.</string>
  <string name="backup_inprogress">Zálohovanie databázy…</string>
  <string name="backup_success">Zálohovanie úspešné.</string>
  <string name="backup_failed">Zálohovanie zlyhalo.</string>
  <string name="import_inprogress">Obnovovanie databázy…</string>
  <string name="import_failed_nosd">Nemožno obnoviť. Adresár so zálohov nie je dostupný.</string>
  <string name="import_failed_nofile">Nie je čitateľný záložný súbor.</string>
  <string name="import_failed_noread">Záloha sa nedá načítať.</string>
  <string name="dbupgradefailed">Vaša záloha je príliš stará alebo prázdna. Poznámka: Zálohy nižšej verzie ako 2.0 obnovujte najskôr vo verzii 1.9.x .</string>
  <string name="import_success">Záloha úspešne vytvorená.</string>
  <string name="import_failed">Obnovenie zálohy zlyhalo.</string>
  <string name="backup_button">Zálohovať</string>
  <string name="import_button">Obnoviť</string>
  <string name="backup_question">Prepíše aktuálnu zálohu v adresáry novou!</string>
  <string name="import_question">Aktuálny zoznam seriálov sa stratí! Presvedčte sa, či máte spravenú zálohu.</string>
  <string name="import_warning">Som si vedomí že moje všetky súčasné a zoznamy budú zmazané!</string>
  <string name="last_auto_backup">Posledná automatická záloha: %s</string>
  <string name="restore_auto_backup">Obnoviť automatickú zálohu</string>
  <string name="checkin">Check in</string>
  <string name="checkin_searchhint">Napíšte názov seriálu</string>
  <string name="checkin_hint">Napíšte správu (nepovinné)</string>
  <string name="paste_title">Paste title</string>
  <string name="addtocalendar">Pridať do kalendára</string>
  <string name="addtocalendar_failed">V kalendári nie je možné vytvoriť udalosť.</string>
  <string name="get_started">Get started</string>
  <string name="welcome_setuplanguage">Vyberte jazyk</string>
  <string name="dismiss">Zamietnuť</string>
  <string name="upcoming_show">%s práve vychádzajú</string>
  <string name="upcoming_episodes">Práve vychádzajú nové epizódy</string>
  <string name="upcoming_episodes_number">%s new episodes</string>
  <string name="upcoming_show_detailed">%1$s na %2$s</string>
  <string name="more">%s viac</string>
  <string name="upcoming_display">Vyberte pre zobrazenie nadchádzajúcich seriálov</string>
  <string name="pref_notifications">Upozornenia</string>
  <string name="pref_notificationssummary">Upozorňovať na nové epizódy</string>
  <string name="pref_notifyfavonly">Iba obľúbené položky</string>
  <string name="pref_notifyfavonlysummary">Upozorňovať jedine na obľúbené seriály</string>
  <string name="pref_ringtone">Tón upozornenia</string>
  <string name="pref_vibrate">Vibrovať</string>
  <string name="pref_vibratesummary">Pri upozornení vibrovať</string>
  <string name="pref_notifications_treshold">Čas upozornenia</string>
  <string name="notification_release_exact">vysiela sa</string>
  <string name="notification_release_earlier_five">5 minut vopred</string>
  <string name="notification_release_earlier_ten">10 minut vopred</string>
  <string name="notification_release_earlier_hour">hodinu vopred</string>
  <string name="smallwidget">SeriesGuide (malý)</string>
  <string name="bigwidget">SeriesGuide (stredný)</string>
  <string name="largewidget">SeriesGuide (veľký)</string>
  <string name="hide_watched">Skryť zhliadnuté epizódy</string>
  <string name="pref_widget_opacity">Pozadie widgetu</string>
  <string name="pref_widget_type">Typ widgetu</string>
  <string name="widget_background_transparent">Transparent</string>
  <string name="widget_background_25">25%</string>
  <string name="widget_background_50">50%</string>
  <string name="widget_background_75">75%</string>
  <string name="widget_background_opaque">Opaque</string>
  <string name="dashclock_extension_label">Ďalší diel</string>
  <string name="dashclock_extension_description">Zobrazuje ďalší diel zo seriálov v SeriesGuide.</string>
  <string name="dashclock_pref_upcoming_threshold">Display episode within…</string>
  <string name="onlyx">Only for supporters</string>
  <string name="action_upgrade">Unlock all features</string>
  <string name="billing_action_subscribe">Subscribe</string>
  <string name="billing_action_pass">Get X Pass</string>
  <string name="billing_price_subscribe">%s/year, 30 day trial</string>
  <string name="billing_price_pass">one-time purchase</string>
  <string name="upgrade_description">Unlock all features including notifications, themes and more list widget options. Help me make future updates.</string>
  <string name="upgrade_success">Thanks for supporting SeriesGuide! You have access to all features.</string>
  <string name="billing_learn_more">Why pay? Learn more.</string>
  <string name="subscription_expired">Subscription expired</string>
  <string name="subscription_expired_details">Your SeriesGuide subscription has expired.</string>
  <string name="subscription_not_signed_in">Sign into your Amazon account!</string>
  <string name="subscription_unavailable">The subscription is currently not available.</string>
  <string name="subscription_failed">Purchase not completed.</string>
  <string name="add_to_homescreen">Shortcut</string>
  <string name="search_within_show">Search within %s</string>
  <string name="web_search">Web search</string>
  <string name="extensions">Extensions</string>
  <string name="action_extensions_configure">Customize extensions</string>
  <string name="action_extensions_add">Add extension</string>
  <string name="action_extensions_limit">Get X to add more extensions</string>
  <string name="action_extensions_search">Get more extensions</string>
  <string name="action_extension_remove">Odstrániť</string>
  <string name="extension_amazon">Amazon search</string>
  <string name="description_extension_amazon">Search your local Amazon site</string>
  <string name="pref_amazon_domain">Amazon site</string>
  <string name="extension_google_play">Google Play search</string>
  <string name="description_extension_google_play">Search the Google Play Store</string>
  <string name="extension_youtube">YouTube search</string>
  <string name="description_extension_youtube">Search YouTube for videos</string>
  <string name="description_extension_web_search">Search for websites and images</string>
  <string name="person_biography">Biography</string>
</resources>


text:
package org.runningdinner.wizard.upload;

import javax.validation.constraints.NotNull;

import org.hibernate.validator.constraints.NotEmpty;

public class ParticipantUploadSettingsTO {

	@NotEmpty
	private String fileId;

	@NotNull
	private ParsingConfigurationTO parsingConfiguration;

	public String getFileId() {
		return fileId;
	}

	public void setFileId(String fileId) {
		this.fileId = fileId;
	}

	public ParsingConfigurationTO getParsingConfiguration() {
		return parsingConfiguration;
	}

	public void setParsingConfiguration(ParsingConfigurationTO parsingConfiguration) {
		this.parsingConfiguration = parsingConfiguration;
	}

	@Override
	public String toString() {
		return "fileId=" + fileId + ", parsingConfiguration=" + parsingConfiguration;
	}

}


text:
struct WebPoint {
  WebPoint();
  WebPoint(int x, int y);
  ~WebPoint();

  void Offset(int x_, int y_);

  int x;
  int y;
};

struct WebSize {
  WebSize();
  WebSize(int width, int height);
  ~WebSize();

  int width;
  int height;
};

struct WebRect {
  WebRect();
  WebRect(int x, int y, int width, int height);
  WebRect(const WebPoint& origin, const WebSize& size);
  ~WebRect();

  int X() const;
  int Y() const;
  int Width() const;
  int Height() const;

  WebPoint origin;
  WebSize size;
};

#endif  // CHROME_TEST_CHROMEDRIVER_BASIC_TYPES_H_


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Debugging with GDB: GDB/MI Stream Records</title>

<meta name="description" content="Debugging with GDB: GDB/MI Stream Records">
<meta name="keywords" content="Debugging with GDB: GDB/MI Stream Records">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="index.html#Top" rel="start" title="Top">
<link href="Concept-Index.html#Concept-Index" rel="index" title="Concept Index">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="GDB_002fMI-Output-Records.html#GDB_002fMI-Output-Records" rel="up" title="GDB/MI Output Records">
<link href="GDB_002fMI-Async-Records.html#GDB_002fMI-Async-Records" rel="next" title="GDB/MI Async Records">
<link href="GDB_002fMI-Result-Records.html#GDB_002fMI-Result-Records" rel="prev" title="GDB/MI Result Records">

Next: GDB/MI Async Records, Previous: GDB/MI Result Records, Up: GDB/MI Output Records   [Contents][Index]

27.5.2 GDB/MI Stream Records

GDB internally maintains a number of output streams: the console, the
target, and the log.  The output intended for each of these streams is
funneled through the GDB/MI interface using stream records.

Each stream record begins with a unique prefix character which
identifies its stream (see GDB/MI Output
Syntax).  In addition to the prefix, each stream record contains a
<var>string-output</var>.  This is either raw text (with an implicit new
line) or a quoted C string (which does not contain an implicit newline).

"~" <var>string-output</var>

The console output stream contains text that should be displayed in the
CLI console window.  It contains the textual responses to CLI commands.

"@" <var>string-output</var>

The target output stream contains any textual output from the running
target.  This is only present when GDB’s event loop is truly
asynchronous, which is currently only the case for remote targets.

"&" <var>string-output</var>

The log stream contains debugging messages being produced by GDB’s
internals.


text:
#ifndef AMGCL_VALUE_TYPE_EIGEN_HPP
#define AMGCL_VALUE_TYPE_EIGEN_HPP

/**
 * \file   amgcl/value_type/eigen.hpp
 * \author Denis Demidov <dennis.demidov@gmail.com>
 * \brief  Enable statically sized eigen matrices as value types.
 */

#include <Eigen/Dense>

#include <amgcl/backend/builtin.hpp>
#include <amgcl/value_type/interface.hpp>

namespace amgcl {
namespace backend {

/// Enable Eigen matrix as a value-type.
template <typename T, int N, int M>
struct is_builtin_vector< std::vector<Eigen::Matrix<T, N, M> > > : std::true_type {};

} // namespace backend

namespace math {

/// Scalar type of a non-scalar type.
template <class T, int N, int M>
struct scalar_of< Eigen::Matrix<T, N, M> > {
    typedef typename math::scalar_of<T>::type type;
};

/// Replace scalar type in the static matrix
template <class T, int N, int M, class S>
struct replace_scalar< Eigen::Matrix<T, N, M>, S> {
    typedef Eigen::Matrix<S, N, M> type;
};

/// RHS type corresponding to a non-scalar type.
template <class T, int N>
struct rhs_of< Eigen::Matrix<T, N, N> > {
    typedef Eigen::Matrix<T, N, 1> type;
};

/// Element type of a non-scalar type
template <class T, int N, int M>
struct element_of< Eigen::Matrix<T, N, M> > {
    typedef T type;
};

/// Whether the value type is a statically sized matrix.
template <class T, int N, int M>
struct is_static_matrix< Eigen::Matrix<T, N, M> > : std::true_type {};

/// Number of rows for statically sized matrix types.
template <class T, int N, int M>
struct static_rows< Eigen::Matrix<T, N, M> > : std::integral_constant<int, N> {};

/// Number of columns for statically sized matrix types.
template <class T, int N, int M>
struct static_cols< Eigen::Matrix<T, N, M> > : std::integral_constant<int, M> {};

/// Specialization of conjugate transpose for eigen matrices.
template <typename T, int N, int M>
struct adjoint_impl< Eigen::Matrix<T, N, M> >
{
    typedef typename Eigen::Matrix<T, N, M>::AdjointReturnType return_type;

    static return_type get(const Eigen::Matrix<T, N, M> &x) {
        return x.adjoint();
    }
};

/// Inner-product result of two Eigen vectors.
template <class T, int N>
struct inner_product_impl< Eigen::Matrix<T, N, 1> >
{
    typedef T return_type;
    static T get(const Eigen::Matrix<T, N, 1> &x, const Eigen::Matrix<T, N, 1> &y) {
        return x.adjoint() * y;
    }
};

/// Inner-product result of two Eigen matrices.
template <class T, int N, int M>
struct inner_product_impl< Eigen::Matrix<T, N, M> >
{
    typedef Eigen::Matrix<T, M, M> return_type;

    static return_type get(const Eigen::Matrix<T, N, M> &x, const Eigen::Matrix<T, N, M> &y) {
        return x.adjoint() * y;
    }
};

/// Specialization of element norm for eigen matrices.
template <typename T, int N, int M>
struct norm_impl< Eigen::Matrix<T, N, M> >
{
    static typename math::scalar_of<T>::type get(const Eigen::Matrix<T, N, M> &x) {
        return x.norm();
    }
};

/// Specialization of zero element for eigen matrices.
template <typename T, int N, int M>
struct zero_impl< Eigen::Matrix<T, N, M> >
{
    static Eigen::Matrix<T, N, M> get() {
        return Eigen::Matrix<T, N, M>::Zero();
    }
};

/// Specialization of zero element for eigen matrices.
template <typename T, int N, int M>
struct is_zero_impl< Eigen::Matrix<T, N, M> >
{
    static bool get(const Eigen::Matrix<T, N, M> &x) {
        return x.isZero();
    }
};

/// Specialization of identity for eigen matrices.
template <typename T, int N>
struct identity_impl< Eigen::Matrix<T, N, N> >
{
    static Eigen::Matrix<T, N, N> get() {
        return Eigen::Matrix<T, N, N>::Identity();
    }
};

/// Specialization of constant for eigen matrices.
template <typename T, int N, int M>
struct constant_impl< Eigen::Matrix<T, N, M> >
{
    static Eigen::Matrix<T, N, M> get(T c) {
        return Eigen::Matrix<T, N, M>::Constant(c);
    }
};

/// Specialization of inversion for eigen matrices.
template <typename T, int N>
struct inverse_impl< Eigen::Matrix<T, N, N> >
{
    static Eigen::Matrix<T, N, N> get(const Eigen::Matrix<T, N, N> &x) {
        return x.inverse();
    }
};

} // namespace math
} // namespace amgcl

namespace Eigen {

template <class A, class B>
bool operator<(const MatrixBase<A> &a, const MatrixBase<B> &b) {
    return a.trace() < b.trace();
}

} // namespace Eigen

#endif


text:
#pragma once
#include <aws/iotwireless/IoTWireless_EXPORTS.h>
#include <aws/iotwireless/model/DeviceRegistrationStateResourceTypeEventConfiguration.h>
#include <aws/iotwireless/model/ProximityResourceTypeEventConfiguration.h>
#include <aws/iotwireless/model/JoinResourceTypeEventConfiguration.h>
#include <aws/iotwireless/model/ConnectionStatusResourceTypeEventConfiguration.h>
#include <aws/iotwireless/model/MessageDeliveryStatusResourceTypeEventConfiguration.h>
#include <utility>

namespace Aws
{
template<typename RESULT_TYPE>
class AmazonWebServiceResult;

namespace Utils
{
namespace Json
{
  class JsonValue;
} // namespace Json
} // namespace Utils
namespace IoTWireless
{
namespace Model
{
  class AWS_IOTWIRELESS_API GetEventConfigurationByResourceTypesResult
  {
  public:
    GetEventConfigurationByResourceTypesResult();
    GetEventConfigurationByResourceTypesResult(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);
    GetEventConfigurationByResourceTypesResult& operator=(const Aws::AmazonWebServiceResult<Aws::Utils::Json::JsonValue>& result);

    /**
     *
Resource type event configuration for the device registration state
     * event.

     */
    inline const DeviceRegistrationStateResourceTypeEventConfiguration& GetDeviceRegistrationState() const{ return m_deviceRegistrationState; }

    /**
     *
Resource type event configuration for the device registration state
     * event.

     */
    inline void SetDeviceRegistrationState(const DeviceRegistrationStateResourceTypeEventConfiguration& value) { m_deviceRegistrationState = value; }

    /**
     *
Resource type event configuration for the device registration state
     * event.

     */
    inline void SetDeviceRegistrationState(DeviceRegistrationStateResourceTypeEventConfiguration&& value) { m_deviceRegistrationState = std::move(value); }

    /**
     *
Resource type event configuration for the device registration state
     * event.

     */
    inline GetEventConfigurationByResourceTypesResult& WithDeviceRegistrationState(const DeviceRegistrationStateResourceTypeEventConfiguration& value) { SetDeviceRegistrationState(value); return *this;}

    /**
     *
Resource type event configuration for the device registration state
     * event.

     */
    inline GetEventConfigurationByResourceTypesResult& WithDeviceRegistrationState(DeviceRegistrationStateResourceTypeEventConfiguration&& value) { SetDeviceRegistrationState(std::move(value)); return *this;}

    /**
     *
Resource type event configuration for the proximity event.

     */
    inline const ProximityResourceTypeEventConfiguration& GetProximity() const{ return m_proximity; }

    /**
     *
Resource type event configuration for the proximity event.

     */
    inline void SetProximity(const ProximityResourceTypeEventConfiguration& value) { m_proximity = value; }

    /**
     *
Resource type event configuration for the proximity event.

     */
    inline void SetProximity(ProximityResourceTypeEventConfiguration&& value) { m_proximity = std::move(value); }

    /**
     *
Resource type event configuration for the proximity event.

     */
    inline GetEventConfigurationByResourceTypesResult& WithProximity(const ProximityResourceTypeEventConfiguration& value) { SetProximity(value); return *this;}

    /**
     *
Resource type event configuration for the proximity event.

     */
    inline GetEventConfigurationByResourceTypesResult& WithProximity(ProximityResourceTypeEventConfiguration&& value) { SetProximity(std::move(value)); return *this;}

    /**
     *
Resource type event configuration for the join event.

     */
    inline const JoinResourceTypeEventConfiguration& GetJoin() const{ return m_join; }

    /**
     *
Resource type event configuration for the join event.

     */
    inline void SetJoin(const JoinResourceTypeEventConfiguration& value) { m_join = value; }

    /**
     *
Resource type event configuration for the join event.

     */
    inline void SetJoin(JoinResourceTypeEventConfiguration&& value) { m_join = std::move(value); }

    /**
     *
Resource type event configuration for the join event.

     */
    inline GetEventConfigurationByResourceTypesResult& WithJoin(const JoinResourceTypeEventConfiguration& value) { SetJoin(value); return *this;}

    /**
     *
Resource type event configuration for the join event.

     */
    inline GetEventConfigurationByResourceTypesResult& WithJoin(JoinResourceTypeEventConfiguration&& value) { SetJoin(std::move(value)); return *this;}

    /**
     *
Resource type event configuration for the connection status event.

     */
    inline const ConnectionStatusResourceTypeEventConfiguration& GetConnectionStatus() const{ return m_connectionStatus; }

    /**
     *
Resource type event configuration for the connection status event.

     */
    inline void SetConnectionStatus(const ConnectionStatusResourceTypeEventConfiguration& value) { m_connectionStatus = value; }

    /**
     *
Resource type event configuration for the connection status event.

     */
    inline void SetConnectionStatus(ConnectionStatusResourceTypeEventConfiguration&& value) { m_connectionStatus = std::move(value); }

    /**
     *
Resource type event configuration for the connection status event.

     */
    inline GetEventConfigurationByResourceTypesResult& WithConnectionStatus(const ConnectionStatusResourceTypeEventConfiguration& value) { SetConnectionStatus(value); return *this;}

    /**
     *
Resource type event configuration for the connection status event.

     */
    inline GetEventConfigurationByResourceTypesResult& WithConnectionStatus(ConnectionStatusResourceTypeEventConfiguration&& value) { SetConnectionStatus(std::move(value)); return *this;}

    /**
     *
Resource type event configuration object for the message delivery status
     * event.

     */
    inline const MessageDeliveryStatusResourceTypeEventConfiguration& GetMessageDeliveryStatus() const{ return m_messageDeliveryStatus; }

    /**
     *
Resource type event configuration object for the message delivery status
     * event.

     */
    inline void SetMessageDeliveryStatus(const MessageDeliveryStatusResourceTypeEventConfiguration& value) { m_messageDeliveryStatus = value; }

    /**
     *
Resource type event configuration object for the message delivery status
     * event.

     */
    inline void SetMessageDeliveryStatus(MessageDeliveryStatusResourceTypeEventConfiguration&& value) { m_messageDeliveryStatus = std::move(value); }

    /**
     *
Resource type event configuration object for the message delivery status
     * event.

     */
    inline GetEventConfigurationByResourceTypesResult& WithMessageDeliveryStatus(const MessageDeliveryStatusResourceTypeEventConfiguration& value) { SetMessageDeliveryStatus(value); return *this;}

    /**
     *
Resource type event configuration object for the message delivery status
     * event.

     */
    inline GetEventConfigurationByResourceTypesResult& WithMessageDeliveryStatus(MessageDeliveryStatusResourceTypeEventConfiguration&& value) { SetMessageDeliveryStatus(std::move(value)); return *this;}

  private:

    DeviceRegistrationStateResourceTypeEventConfiguration m_deviceRegistrationState;

    ProximityResourceTypeEventConfiguration m_proximity;

    JoinResourceTypeEventConfiguration m_join;

    ConnectionStatusResourceTypeEventConfiguration m_connectionStatus;

    MessageDeliveryStatusResourceTypeEventConfiguration m_messageDeliveryStatus;
  };

} // namespace Model
} // namespace IoTWireless
} // namespace Aws


text:
package edu.neu.ccs.pyramid.calibration;

import org.apache.mahout.math.Vector;

import java.io.Serializable;

public interface VectorCalibrator extends Serializable {
    double calibrate(Vector vector);
}


text:
@implementation UINavigationController (RDViewRotationSupport)

-(BOOL)shouldAutorotate
{
    return YES;
}

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown;
}

@end


text:
from swproject.settings import *

DEBUG = True
TEMPLATE_DEBUG = DEBUG

DATABASES['default']['NAME'] = 'swdev'
DATABASES['default']['USER'] = 'user'
DATABASES['default']['PASSWORD'] = 'password'
DATABASES['default']['HOST'] = '/var/run/postgresql'

SKIP_SOUTH_TESTS = True
SOUTH_TESTS_MIGRATE = False

CELERY_ALWAYS_EAGER = True

if django.VERSION >= (1, 3):
    STATICFILES_ROOT = 'static'
else:
    STATIC_ROOT = 'static'

from fnmatch import fnmatch
class glob_list(list):
    def __contains__(self, key):
        for elt in self:
            if fnmatch(key, elt): return True
        return False

INTERNAL_IPS = glob_list([
    '*.*.*.*',
])

SENTRY_TESTING = False

MEDIA_PATH = 'uploaded_media/'

CMS_PAGE_MEDIA_PATH = 'cms_page_media/'

STATICFILES_DIRS = (
    ('uploaded_media', 'uploaded_media'),
)

STATICFILES_RESOLVERS += (
    'staticfiles.resolvers.FileSystemResolver',
)

POSTMARK_DEBUG = True

HAYSTACK_SEARCH_ENGINE = 'solr'
HAYSTACK_SOLR_URL = 'http://127.0.0.1:8080/solr'

SHORTEN_FULL_BASE_URL = 'http://localhost:8000/'

### Suggested additions to your localsettings.py ###

# ----
# concurrent server
#
# $ pip install -e git+git://github.com/ashchristopher/django-concurrent-server.git#egg=django-concurrent-server
#
# INSTALLED_APPS += (
#     'concurrent_server',
# )
#
# ----
# Devserver
#
# $ pip install git+git://github.com/dcramer/django-devserver#egg=django-devserver
# $ pip install sqlparse
# $ pip install werkzeug
# $ pip install guppy
#

# INSTALLED_APPS += (
#     'devserver',
# )
#
# DEVSERVER_MODULES = (
#     'devserver.modules.sql.SQLRealTimeModule',
#     'devserver.modules.sql.SQLSummaryModule',
#     'devserver.modules.profile.ProfileSummaryModule',
#     # Modules not enabled by default
#     ## 'devserver.modules.ajax.AjaxDumpModule',
#     ## 'devserver.modules.profile.MemoryUseModule',
#     ## 'devserver.modules.cache.CacheSummaryModule',
# )

# ----
# Debug toolbar
#
# $ pip install django-debug-toolbar
#

# MIDDLEWARE_CLASSES += (
#     'debug_toolbar.middleware.DebugToolbarMiddleware',
# )
#
# INSTALLED_APPS += (
#     'debug_toolbar',
# )
#
# DEBUG_TOOLBAR_CONFIG = {
#     'INTERCEPT_REDIRECTS': False,
# }