text:
<?php
namespace Inventory\Infrastructure\Persistence\Domain\Doctrine\Mapper;

use Application\Entity\NmtInventoryItemSerial;
use Doctrine\ORM\EntityManager;
use Inventory\Domain\Item\Serial\SerialSnapshot;

/**
 * Mapper
 *
 * @author Nguyen Mau Tri - ngmautri@gmail.com
 *
 */
class ItemSerialMapper
{

    /*
     * |=============================
     * |Mapping Serial
     * |
     * |=============================
     */
    public static function mapSerialEntity(EntityManager $doctrineEM, SerialSnapshot $snapshot, NmtInventoryItemSerial $entity)
    {
        if ($snapshot == null || $entity == null || $doctrineEM == null) {
            return null;
        }

        /*
         * |=============================
         * | Mapping None-Object Field
         * | not mapping setID
         * |=============================
         */
        // $entity->setId($snapshot->id);

        $entity->setToken($snapshot->token);
        $entity->setSerialNumber($snapshot->serialNumber);
        $entity->setIsActive($snapshot->isActive);
        $entity->setRemarks($snapshot->remarks);
        $entity->setMfgSerialNumber($snapshot->mfgSerialNumber);
        $entity->setLotNumber($snapshot->lotNumber);
        $entity->setItemName($snapshot->itemName);
        $entity->setLocation($snapshot->location);
        $entity->setCategory($snapshot->category);
        $entity->setMfgName($snapshot->mfgName);
        $entity->setRevisionNo($snapshot->revisionNo);
        $entity->setSysNumber($snapshot->sysNumber);
        $entity->setSerialNumber1($snapshot->serialNumber1);
        $entity->setSerialNumber2($snapshot->serialNumber2);
        $entity->setSerialNumber3($snapshot->serialNumber3);
        $entity->setMfgModel($snapshot->mfgModel);
        $entity->setMfgModel1($snapshot->mfgModel1);
        $entity->setMfgModel2($snapshot->mfgModel2);
        $entity->setMfgDescription($snapshot->mfgDescription);
        $entity->setCapacity($snapshot->capacity);
        $entity->setErpAssetNumber($snapshot->erpAssetNumber);
        $entity->setErpAssetNumber1($snapshot->erpAssetNumber1);
        $entity->setIsReversed($snapshot->isReversed);
        $entity->setReversalDoc($snapshot->reversalDoc);
        $entity->setReversalReason($snapshot->reversalReason);
        $entity->setIsReversable($snapshot->isReversable);
        $entity->setUuid($snapshot->uuid);

        /*
         * |=============================
         * | DATE MAPPING
         * |
         * |=============================
         */
        /*
         * $entity->setCreatedOn($snapshot->createdOn);
         * $entity->setLastchangeOn($snapshot->lastchangeOn);
         *
         * $entity->setConsumedOn($snapshot->consumedOn);
         * $entity->setMfgDate($snapshot->mfgDate);
         *
         * $entity->setMfgWarrantyStart($snapshot->mfgWarrantyStart);
         * $entity->setMfgWarrantyEnd($snapshot->mfgWarrantyEnd);
         * $entity->setReversalDate($snapshot->reversalDate);
         */

        if ($snapshot->createdOn !== null) {
            $entity->setCreatedOn(new \DateTime($snapshot->createdOn));
        }

        if ($snapshot->lastchangeOn !== null) {
            $entity->setLastchangeOn(new \DateTime($snapshot->lastchangeOn));
        }

        if ($snapshot->consumedOn !== null) {
            $entity->setLastChangeOn(new \DateTime($snapshot->consumedOn));
        }

        if ($snapshot->mfgDate !== null) {
            $entity->setMfgDate(new \DateTime($snapshot->mfgDate));
        }

        if ($snapshot->mfgWarrantyStart !== null) {
            $entity->setMfgDate(new \DateTime($snapshot->mfgWarrantyStart));
        }

        if ($snapshot->mfgWarrantyEnd !== null) {
            $entity->setMfgWarrantyStart(new \DateTime($snapshot->mfgWarrantyEnd));
        }

        if ($snapshot->setReversalDate !== null) {
            $entity->setReversalDate(new \DateTime($snapshot->setReversalDate));
        }

        /*
         * |=============================
         * | REFERRENCE MAPPING
         * |
         * |=============================
         */
        /*
         * $entity->setCreatedBy($snapshot->createdBy);
         * $entity->setLastchangeBy($snapshot->lastchangeBy);
         *
         * $entity->setItem($snapshot->item);
         * $entity->setSerial($snapshot->serial);
         * $entity->setInventoryTrx($snapshot->inventoryTrx);
         * $entity->setApRow($snapshot->apRow);
         * $entity->setGrRow($snapshot->grRow);
         * $entity->setOriginCountry($snapshot->originCountry);
         */

        if ($snapshot->createdBy > 0) {
            /**
             *
             * @var \Application\Entity\MlaUsers $obj ;
             */
            $obj = $doctrineEM->getRepository('Application\Entity\MlaUsers')->find($snapshot->createdBy);
            $entity->setCreatedBy($obj);
        }

        if ($snapshot->lastChangeBy > 0) {
            /**
             *
             * @var \Application\Entity\MlaUsers $obj ;
             */
            $obj = $doctrineEM->getRepository('Application\Entity\MlaUsers')->find($snapshot->lastChangeBy);
            $entity->setLastChangeBy($obj);
        }

        if ($snapshot->item > 0) {
            /**
             *
             * @var \Application\Entity\NmtInventoryItem $obj ;
             */
            $obj = $doctrineEM->getRepository('Application\Entity\NmtInventoryItem')->find($snapshot->item);
            $entity->setItem($obj);
        }

        if ($snapshot->inventoryTrx > 0) {
            /**
             *
             * @var \Application\Entity\NmtInventoryTrx $obj ;
             */
            $obj = $doctrineEM->getRepository('Application\Entity\NmtInventoryTrx')->find($snapshot->inventoryTrx);
            $entity->setInventoryTrx($obj);
        }

        if ($snapshot->apRow > 0) {
            /**
             *
             * @var \Application\Entity\FinVendorInvoiceRow $obj ;
             */
            $obj = $doctrineEM->getRepository('Application\Entity\FinVendorInvoiceRow')->find($snapshot->apRow);
            $entity->setApRow($obj);
        }

        if ($snapshot->grRow > 0) {
            /**
             *
             * @var \Application\Entity\NmtProcureGrRow $obj ;
             */
            $obj = $doctrineEM->getRepository('Application\Entity\NmtProcureGrRow')->find($snapshot->grRow);
            $entity->setGrRow($obj);
        }

        if ($snapshot->originCountry > 0) {
            /**
             *
             * @var \Application\Entity\NmtApplicationCountry $obj ;
             */
            $obj = $doctrineEM->getRepository('Application\Entity\NmtApplicationCountry')->find($snapshot->originCountry);
            $entity->setOriginCountry($obj);
        }

        return $entity;
    }

    public static function createSerialSnapshot(NmtInventoryItemSerial $entity, SerialSnapshot $snapshot = null, $needDetails = false)
    {
        if ($entity == null) {
            return null;
        }

        if ($snapshot == null) {
            $snapshot = new SerialSnapshot();
        }

        /*
         * |=============================
         * | None-Object Field
         * |
         * |=============================
         */

        $snapshot->id = $entity->getId();
        $snapshot->token = $entity->getToken();
        $snapshot->serialNumber = $entity->getSerialNumber();
        $snapshot->isActive = $entity->getIsActive();
        $snapshot->remarks = $entity->getRemarks();
        $snapshot->mfgSerialNumber = $entity->getMfgSerialNumber();
        $snapshot->lotNumber = $entity->getLotNumber();
        $snapshot->itemName = $entity->getItemName();
        $snapshot->location = $entity->getLocation();
        $snapshot->category = $entity->getCategory();
        $snapshot->mfgName = $entity->getMfgName();
        $snapshot->revisionNo = $entity->getRevisionNo();
        $snapshot->sysNumber = $entity->getSysNumber();
        $snapshot->serialNumber1 = $entity->getSerialNumber1();
        $snapshot->serialNumber2 = $entity->getSerialNumber2();
        $snapshot->serialNumber3 = $entity->getSerialNumber3();
        $snapshot->mfgModel = $entity->getMfgModel();
        $snapshot->mfgModel1 = $entity->getMfgModel1();
        $snapshot->mfgModel2 = $entity->getMfgModel2();
        $snapshot->mfgDescription = $entity->getMfgDescription();
        $snapshot->capacity = $entity->getCapacity();
        $snapshot->erpAssetNumber = $entity->getErpAssetNumber();
        $snapshot->erpAssetNumber1 = $entity->getErpAssetNumber1();
        $snapshot->isReversed = $entity->getIsReversed();
        $snapshot->reversalDoc = $entity->getReversalDoc();
        $snapshot->reversalReason = $entity->getReversalReason();
        $snapshot->isReversable = $entity->getIsReversable();
        $snapshot->uuid = $entity->getUuid();

        /*
         * |=============================
         * | Mapping Date
         * |
         * |=============================
         */

        /*
         * $snapshot->createdOn = $entity->getCreatedOn();
         * $snapshot->lastChangeOn = $entity->getLastChangeOn();
         * $snapshot->consumedOn = $entity->getConsumedOn();
         * $snapshot->mfgDate = $entity->getMfgDate();
         * $snapshot->mfgWarrantyStart = $entity->getMfgWarrantyStart();
         * $snapshot->mfgWarrantyEnd = $entity->getMfgWarrantyEnd();
         * $snapshot->reversalDate = $entity->getReversalDate();
         */
        if (! $entity->getCreatedOn() == null) {
            $snapshot->createdOn = $entity->getCreatedOn()->format("Y-m-d H:i:s");
        }

        if (! $entity->getLastChangeOn() == null) {
            $snapshot->lastChangeOn = $entity->getLastChangeOn()->format("Y-m-d H:i:s");
        }

        if (! $entity->getConsumedOn() == null) {
            $snapshot->consumedOn = $entity->getConsumedOn()->format("Y-m-d");
        }

        if (! $entity->getMfgDate() == null) {
            $snapshot->mfgDate = $entity->getMfgDate()->format("Y-m-d");
        }

        if (! $entity->getMfgWarrantyStart() == null) {
            $snapshot->mfgWarrantyStart = $entity->getMfgWarrantyStart()->format("Y-m-d");
        }

        if (! $entity->getMfgWarrantyEnd() == null) {
            $snapshot->mfgWarrantyEnd = $entity->getMfgWarrantyEnd()->format("Y-m-d");
        }

        if (! $entity->getReversalDate() == null) {
            $snapshot->reversalDate = $entity->getReversalDate()->format("Y-m-d");
        }

        /*
         * |=============================
         * |REFERRENCE MAPPING
         * |
         * |=============================
         */
        // $snapshot->createdBy = $entity->getCreatedBy();
        // $snapshot->lastchangeBy = $entity->getLastchangeBy();
        // $snapshot->item = $entity->getItem();
        // $snapshot->serial = $entity->getSerial();
        // $snapshot->inventoryTrx = $entity->getInventoryTrx();
        // $snapshot->apRow = $entity->getApRow();
        // $snapshot->grRow = $entity->getGrRow();
        // $snapshot->originCountry = $entity->getOriginCountry();

        if ($entity->getCreatedBy() !== null) {
            $snapshot->createdBy = $entity->getCreatedBy()->getId();
        }

        if ($entity->getLastChangeBy() !== null) {
            $snapshot->lastChangeBy = $entity->getLastChangeBy()->getId();
        }

        if ($entity->getItem() != null) {
            $snapshot->item = $entity->getItem()->getId();
            $snapshot->itemName = $entity->getItem()->getItemName();
        }

        if ($entity->getInventoryTrx() != null) {
            $snapshot->inventoryTrx = $entity->getInventoryTrx()->getId();
        }

        if ($entity->getApRow() != null) {
            $snapshot->apRow = $entity->getApRow()->getId();

            $invoice = $entity->getApRow()->getInvoice();

            if ($invoice != null) {
                $snapshot->invoiceId = $invoice->getId();
                $snapshot->invoiceToken = $invoice->getToken();
                $snapshot->invoiceSysNumber = $invoice->getSysNumber();
                $snapshot->vendorName = $invoice->getVendorName();
            }
        }

        if ($entity->getGrRow() != null) {
            $snapshot->grRow = $entity->getGrRow()->getId();

            $gr = $entity->getGrRow()->getGr();

            if ($gr != null) {
                $snapshot->grId = $gr->getId();
                $snapshot->grToken = $gr->getToken();
                $snapshot->grSysNumber = $gr->getSysNumber();
            }
        }

        if ($entity->getOriginCountry() != null) {
            $snapshot->originCountry = $entity->getOriginCountry()->getId();
        }

        return $snapshot;
    }
}


text:
package com.indignado.logicbricks.components.sensors;

import com.indignado.logicbricks.core.sensors.MessageSensor;

/**
 * @author Rubentxu
 */
public class MessageSensorComponent extends SensorComponent<MessageSensor> {

}

redpajama_set_name: RedPajamaGithub


text: <ng-content></ng-content>


text:
<?php namespace Frostbite;

use Illuminate\Database\Eloquent\Model;

class Category extends Model {

    /**
     * @var string
     */
    protected $table = 'categories';

    /**
     * @var boolean
     */
    public $timestamps = false;

    /**
     * @var array
     */
    protected $fillable = ['name', 'parent_id'];

    /**
     * @return object
     */
    public function posts()
    {
        return $this->hasMany('Frostbite\Post');
    }

    /**
     * @return Illuminate\Support\Collection
     */
    public function childCategories()
    {
        return $this->whereParentId($this->id)->get();
    }
}


text:
// Copyright (c) 2012, 2013 Pierre MOULON.

// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include "openMVG/robust_estimation/robust_estimator_lineKernel_test.hpp"
#include "openMVG/robust_estimation/robust_estimator_LMeds.hpp"
#include "openMVG/robust_estimation/score_evaluator.hpp"

#include "openMVG/numeric/numeric.h"

#include "testing/testing.h"

using namespace openMVG;
using namespace openMVG::robust;

static const double dExpectedPrecision = 1e-9;

template<typename Kernel>
void EvalInlier(const Kernel & kernel, const typename Kernel::Model & model,
   double dThreshold, std::vector<size_t> * vec_inliers)
{
  ScorerEvaluator<Kernel> scorer(dThreshold);
  std::vector<size_t> vec_index(kernel.NumSamples());
  for (size_t i = 0; i < kernel.NumSamples(); ++i)
    vec_index[i] = i;

  scorer.Score(kernel, model, vec_index, &(*vec_inliers));
}

// Test without outlier
TEST(LMedsLineFitter, OutlierFree) {

  Mat2X xy(2, 5);
  // y = 2x + 1
  xy << 1, 2, 3, 4,  5,
        3, 5, 7, 9, 11;

  // The base estimator
  LineKernel kernel(xy);

  // Check the best model that fit the most of the data
  //  in a robust framework (LMeds).
  Vec2 model;
  double dThreshold = std::numeric_limits<double>::infinity();
  double dBestMedian = LeastMedianOfSquares(kernel, &model, &dThreshold);
  EXPECT_NEAR(2.0, model[1], dExpectedPrecision);
  EXPECT_NEAR(1.0, model[0], dExpectedPrecision);
  EXPECT_NEAR(0.0, dBestMedian, dExpectedPrecision);
  EXPECT_NEAR(0.0, dThreshold, dExpectedPrecision);
  //Compute which point are inliers (error below dThreshold)
  std::vector<size_t> vec_inliers;
  EvalInlier(kernel, model, dExpectedPrecision, &vec_inliers);
  CHECK_EQUAL(5, vec_inliers.size());
}

// Test efficiency of LMeds to find (inlier/outlier) in contamined data
TEST(LMedsLineFitter, OneOutlier) {

  Mat2X xy(2, 6);
  // y = 2x + 1 with an outlier
  xy << 1, 2, 3, 4,  5, 100, // outlier!
        3, 5, 7, 9, 11, -123; // outlier!

  LineKernel kernel(xy);

  Vec2 model;
  double dThreshold = std::numeric_limits<double>::infinity();
  double dBestMedian = LeastMedianOfSquares(kernel, &model, &dThreshold);
  EXPECT_NEAR(2.0, model[1], dExpectedPrecision);
  EXPECT_NEAR(1.0, model[0], dExpectedPrecision);
  EXPECT_NEAR(0.0, dBestMedian, dExpectedPrecision);
  EXPECT_NEAR(0.0, dThreshold, dExpectedPrecision);
  //Compute which point are inliers (error below dThreshold)
  std::vector<size_t> vec_inliers;
  EvalInlier(kernel, model, dExpectedPrecision, &vec_inliers);
  CHECK_EQUAL(5, vec_inliers.size());
}

// Critical test:
// Test if the robust estimator do not return inlier if too few point
// was given for an estimation.
TEST(LMedsLineFitter, TooFewPoints) {

  Mat2X xy(2, 1);
  xy << 1,
        3;   // y = 2x + 1 with x = 1
  LineKernel kernel(xy);

  Vec2 model;
  double dThreshold = std::numeric_limits<double>::infinity();
  double dBestMedian = LeastMedianOfSquares(kernel, &model, &dThreshold);
  //No inliers
  CHECK_EQUAL( dBestMedian, std::numeric_limits<double>::max());
}

// From a GT model :
//  Compute a list of point that fit the model.
//  Add white noise to given amount of points in this list.
//  Check that the number of inliers and the model are correct.
TEST(LMedsLineFitter, RealisticCase) {

  const int NbPoints = 30;
  const int inlierPourcentAmount = 30; //works with 40
  Mat2X xy(2, NbPoints);

  Vec2 GTModel; // y = 2x + 1
  GTModel <<  -2.0, 6.3;

  //-- Build the point list according the given model
  for(int i = 0; i < NbPoints; ++i)  {
    xy.col(i) << i, (double)i*GTModel[1] + GTModel[0];
  }

  //-- Add some noise (for the asked percentage amount)
  int nbPtToNoise = (int) NbPoints*inlierPourcentAmount/100.0;
  vector<size_t> vec_samples; // Fit with unique random index
  UniformSample(nbPtToNoise, NbPoints, &vec_samples);
  for(size_t i = 0; i <vec_samples.size(); ++i)
  {
    const size_t randomIndex = vec_samples[i];
    //Additive random noise
    xy.col(randomIndex) << xy.col(randomIndex)(0)+rand()%2-3,
                           xy.col(randomIndex)(1)+rand()%8-6;
  }

  LineKernel kernel(xy);

  Vec2 model;
  double dThreshold = std::numeric_limits<double>::infinity();
  double dBestMedian = LeastMedianOfSquares(kernel, &model, &dThreshold);
  EXPECT_NEAR(-2.0, model[0], dExpectedPrecision);
  EXPECT_NEAR(6.3, model[1], dExpectedPrecision);
  //Compute which point are inliers (error below dThreshold)
  std::vector<size_t> vec_inliers;
  EvalInlier(kernel, model, dThreshold, &vec_inliers);
  EXPECT_TRUE(vec_inliers.size()>0);
  CHECK_EQUAL(NbPoints-nbPtToNoise, vec_inliers.size());
}

/* ************************************************************************* */
int main() { TestResult tr; return TestRegistry::runAllTests(tr);}
/* ************************************************************************* */


text:
(function() {
	module("tinymce.html.SaxParser");

	var writer = new tinymce.html.Writer(), schema = new tinymce.html.Schema();

	function createCounter(writer) {
		var counts = {};

		return {
			counts : counts,

			comment: function(text) {
				if ("comment" in counts) {
					counts.comment++;
				} else {
					counts.comment = 1;
				}

				writer.comment(text);
			},

			cdata: function(text) {
				if ("cdata" in counts) {
					counts.cdata++;
				} else {
					counts.cdata = 1;
				}

				writer.cdata(text);
			},

			text: function(text, raw) {
				if ("text" in counts) {
					counts.text++;
				} else {
					counts.text = 1;
				}

				writer.text(text, raw);
			},

			start: function(name, attrs, empty) {
				if ("start" in counts) {
					counts.start++;
				} else {
					counts.start = 1;
				}

				writer.start(name, attrs, empty);
			},

			end: function(name) {
				if ("end" in counts) {
					counts.end++;
				} else {
					counts.end = 1;
				}

				writer.end(name);
			},

			pi: function(name, text) {
				if ("pi" in counts) {
					counts.pi++;
				} else {
					counts.pi = 1;
				}

				writer.pi(name, text);
			},

			doctype: function(text) {
				if ("doctype:" in counts) {
					counts.doctype++;
				} else {
					counts.doctype = 1;
				}

				writer.doctype(text);
			}
		};
	}

	test('Parse elements', function() {
		var counter, parser;

		expect(48);

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('');
		equal(writer.getContent(), '', 'Parse attribute formats.');
		deepEqual(counter.counts, {start:1, end:1}, 'Parse attribute formats counts.');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('<b href=\'"&<>\'>');
		equal(writer.getContent(), '', 'Parse attributes with <> in them.');
		deepEqual(counter.counts, {start:1, end:1}, 'Parse attributes with <> in them (count).');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('');
		equal(writer.getContent(), '', 'Parse compressed attributes.');
		deepEqual(counter.counts, {start:1, end:1}, 'Parse compressed attributes (count).');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('');
		equal(writer.getContent(), '', 'Single empty attribute.');
		deepEqual(counter.counts, {start:1, end:1}, 'Single empty attributes (count).');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('');
		equal(writer.getContent(), '', 'Empty attribute at end.');
		deepEqual(counter.counts, {start:1, end:1}, 'Empty attribute at end (count).');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('');
		equal(writer.getContent(), '', 'Empty attribute at start.');
		deepEqual(counter.counts, {start:1, end:1}, 'Empty attribute at start (count).');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('');
		equal(writer.getContent(), '', 'Parse empty element.');
		deepEqual(counter.counts, {start:1}, 'Parse empty element counts.');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('');
		equal(writer.getContent(), '', 'Parse attributes with linebreak.');
		deepEqual(counter.counts, {start: 1}, 'Parse attributes with linebreak counts.');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('');
		equal(writer.getContent(), '', 'Parse attributes with whitespace.');
		deepEqual(counter.counts, {start: 1}, 'Parse attributes with whitespace counts.');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('<myns:mytag>text</myns:mytag>');
		equal(writer.getContent(), '<myns:mytag>text</myns:mytag>', 'Parse element with namespace.');
		deepEqual(counter.counts, {start:1, text:1, end: 1}, 'Parse element with namespace counts.');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('<myns-mytag>text</myns-mytag>');
		equal(writer.getContent(), '<myns-mytag>text</myns-mytag>', 'Parse element with dash name.');
		deepEqual(counter.counts, {start:1, text:1, end:1}, 'Parse element with dash name counts.');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('<myns_mytag>text</myns_mytag>');
		equal(writer.getContent(), '<myns_mytag>text</myns_mytag>', 'Parse element with underscore name.');
		deepEqual(counter.counts, {start:1, text:1, end:1}, 'Parse element with underscore name counts.');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('text1
text2text3
text4text5');
		equal(writer.getContent(), 'text1
text2text3
text4text5', 'Parse tag soup 1.');
		deepEqual(counter.counts, {text:5, start: 2, end: 2}, 'Parse tag soup 1 counts.');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('text1
text2text3
text4text5');
		equal(writer.getContent(), 'text1
text2text3
text4text5', 'Parse tag soup 2.');
		deepEqual(counter.counts, {text: 5, start: 2, end: 2}, 'Parse tag soup 2 counts.');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('text1
text2tex<t3
te>xt4text5');
		equal(writer.getContent(), 'text1
text2tex<t3
te>xt4text5', 'Parse tag soup 3.');
		deepEqual(counter.counts, {text: 5, start: 2, end: 2}, 'Parse tag soup 3 counts.');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('text1
text2text3');
		equal(writer.getContent(), 'text1
text2text3
', 'Parse tag soup 4.');
		deepEqual(counter.counts, {text: 3, start: 2, end: 2}, 'Parse tag soup 4 counts.');

		counter = createCounter(writer);
		parser = new tinymce.html.SaxParser(counter, schema);
		writer.reset();
		parser.parse('text1


text:
package com.zhan_dui.adapters;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.squareup.picasso.Picasso;
import com.zhan_dui.animetaste.R;
import com.zhan_dui.download.alfred.defaults.MissionListenerForAdapter;
import com.zhan_dui.download.alfred.missions.M3U8Mission;
import com.zhan_dui.download.alfred.missions.Mission;
import com.zhan_dui.modal.Animation;
import com.zhan_dui.modal.DownloadRecord;

/**
 * Created by daimajia on 14-3-25.
 */
public class DownloadAdapter extends MissionListenerForAdapter{

    private Context mContext;
    private LayoutInflater mLayoutInflater;

    public DownloadAdapter(Context context) {
        super();
        mContext = context;
        mLayoutInflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ImageView thumb;
        TextView title,content,progress;
        ViewHolder holder;
        if(convertView == null){
            convertView = mLayoutInflater.inflate(R.layout.download_item,null);
            thumb = (ImageView)convertView.findViewById(R.id.thumbImage);
            title = (TextView)convertView.findViewById(R.id.title);
            content = (TextView)convertView.findViewById(R.id.content);
            progress = (TextView)convertView.findViewById(R.id.progress);
            holder = new ViewHolder(title,progress,content,thumb);
            convertView.setTag(holder);
        }else{
            holder = (ViewHolder)convertView.getTag();
            title = holder.title;
            content = holder.content;
            progress = holder.progress;
            thumb = holder.thumb;
        }
        if(position > getCount() - 1){
            return null;
        }
        Object mission = getItem(position);
        Animation animation = null;
        if(mission instanceof DownloadRecord){
            animation = DownloadRecord.getAnimation((DownloadRecord)mission);
            progress.setVisibility(View.INVISIBLE);
        }else if(mission instanceof M3U8Mission){
            Mission m = (M3U8Mission)mission;
            Object extra =m.getExtraInformation(m.getUri());
            animation = (Animation)extra;
            if(m.isDone()){
                progress.setVisibility(View.INVISIBLE);
            }else{
                progress.setVisibility(View.VISIBLE);
                progress.setText(m.getReadablePercentage());
            }
        }
        holder.animation = animation;
        Picasso.with(mContext).load(animation.HomePic)
                .placeholder(R.drawable.placeholder_thumb)
                .error(R.drawable.placeholder_fail).into(thumb);
        title.setText(animation.Name);
        content.setText(animation.Brief);
        return convertView;
    }

    public static class ViewHolder{
        public Animation animation;
        public TextView title,progress,content;
        public ImageView thumb;

        private ViewHolder(TextView title, TextView progress, TextView content, ImageView thumb) {
            this.title = title;
            this.progress = progress;
            this.content = content;
            this.thumb = thumb;
        }
    }

}


text:
/*++

Module Name:

  SimpleTextOutBBTestMain_uefi.c

Abstract:

  Test Driver of Simple Text Output Protocol

--*/

#include "SimpleTextOutBBTestMain_uefi.h"

EFI_EVENT              TimerEvent;

CHAR16                 *mAttribStr[] = { L"BLACK", L"BLUE", L"GREEN", L"CYAN", L"RED", L"MAGENTA", L"BROWN", L"LIGHT GRAY", L"DARK GRAY",
                                         L"LIGHT BLUE", L"LIGHT GREEN", L"LIGHT GYAN", L"LIGHT RED", L"LIGHT MAGENTA", L"YELLOW", L"WHITE"};

//
// Build Data structure here
//

EFI_BB_TEST_PROTOCOL_FIELD gBBTestProtocolField = {
  SIMPLE_TEXT_OUTPUT_PROTOCOL_TEST_REVISION,
  EFI_SIMPLE_TEXT_OUT_PROTOCOL_GUID,
  L"Simple Text Output Protocol Test",
  L"UEFI2.0 Simple Text Output Protocol Test"
};

EFI_GUID gSupportProtocolGuid[] = {
  EFI_STANDARD_TEST_LIBRARY_GUID,
  EFI_NULL_GUID
};

EFI_BB_TEST_ENTRY_FIELD gBBTestEntryField[] = {
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_RESET_FUNCTION_AUTO_GUID,
    L"Reset_Func",
    L"Automatically Test the functionality of Reset",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestResetFunctionAutoTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_OUTPUTSTRING_FUNCTION_AUTO_GUID,
    L"OutputString_Func",
    L"Auto Test the functionality of OutputString",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestOutputStringFunctionAutoTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_TESTSTRING_FUNCTION_AUTO_GUID,
    L"TestString_Func",
    L"Automatically Test the functionality of TestString",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestTestStringFunctionAutoTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_QUERYMODE_FUNCTION_AUTO_GUID,
    L"QueryMode_Func",
    L"Automatically Test the functionality of QueryMode",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestQueryModeFunctionAutoTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_SETMODE_FUNCTION_AUTO_GUID,
    L"SetMode_Func",
    L"Auto Test the functionality of SetMode",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestSetModeFunctionAutoTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_SETATTRIBUTE_FUNCTION_AUTO_GUID,
    L"SetAttribute_Func",
    L"Auto Test the functionality of SetAttribute",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestSetAttributeFunctionAutoTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_CLEARSCREEN_FUNCTION_AUTO_GUID,
    L"ClearScreen_Func",
    L"Auto Test the functionality of ClearScreen",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestClearScreenFunctionAutoTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_ENABLECURSOR_FUNCTION_AUTO_GUID,
    L"EnableCursor_Func",
    L"Auto Test the functionality of EnableCursor",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestEnableCursorFunctionAutoTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_SETCURSORPOSITION_FUNCTION_AUTO_GUID,
    L"SetCursorPosition_Func",
    L"Auto Test the functionality of SetCursorPosition",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestSetCursorPositionFunctionAutoTest
  },

  //
  // Conformance test function data structure
  //
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_QUERYMODE_CONFORMANCE_AUTO_GUID,
    L"QueryMode_Conf",
    L"Auto Conformance Test of QueryMode",
    EFI_TEST_LEVEL_MINIMAL,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestQueryModeConformanceAutoTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_SETMODE_CONFORMANCE_AUTO_GUID,
    L"SetMode_Conf",
    L"Auto Conformance Test of SetMode",
    EFI_TEST_LEVEL_MINIMAL,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestSetModeConformanceAutoTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_SETCURSORPOSITION_CONFORMANCE_AUTO_GUID,
    L"SetCursorPosition_Conf",
    L"Auto Conformance Test of SetCursorPosition",
    EFI_TEST_LEVEL_MINIMAL,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestSetCursorPositionConformanceAutoTest
  },
/*
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_SETATTRIBUTE_CONFORMANCE_AUTO_GUID,
    L"SetAttribute_Conf",
    L"Auto Conformance Test of SetAttribute",
    EFI_TEST_LEVEL_MINIMAL,
    gSupportProtocolGuid,
    EFI_TEST_CASE_AUTO,
    BBTestSetAttributeConformanceAutoTest
  },
*/
#ifdef EFI_TEST_EXHAUSTIVE
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_RESET_FUNCTION_MANUAL_GUID,
    L"Reset_Func_Manual",
    L"Manually Test the functionality of Reset",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_MANUAL,
    BBTestResetFunctionManualTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_OUTPUTSTRING_FUNCTION_MANUAL_GUID,
    L"OutputString_Func_Manual",
    L"Manually Test the functionality of OutputString",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_MANUAL,
    BBTestOutputStringFunctionManualTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_SETMODE_FUNCTION_MANUAL_GUID,
    L"SetMode_Func_Manual",
    L"Manually Test the functionality of SetMode",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_MANUAL,
    BBTestSetModeFunctionManualTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_SETATTRIBUTE_FUNCTION_MANUAL_GUID,
    L"SetAttribute_Func_Manual",
    L"Manually Test the functionality of SetAttribute",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_MANUAL,
    BBTestSetAttributeFunctionManualTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_CLEARSCREEN_FUNCTION_MANUAL_GUID,
    L"ClearScreen_Func_Manual",
    L"Manually Test the functionality of ClearScreen",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_MANUAL,
    BBTestClearScreenFunctionManualTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_SETCURSORPOSITION_FUNCTION_MANUAL_GUID,
    L"SetCursorPosition_Func_Manual",
    L"Manually Test the functionality of SetCursorPosition",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_MANUAL,
    BBTestSetCursorPositionFunctionManualTest
  },
  {
    SIMPLE_TEXT_OUTPUT_PROTOCOL_ENABLECURSOR_FUNCTION_MANUAL_GUID,
    L"EnableCursor_Func_Manual",
    L"Manually Test the functionality of EnableCursor",
    EFI_TEST_LEVEL_DEFAULT,
    gSupportProtocolGuid,
    EFI_TEST_CASE_MANUAL,
    BBTestEnableCursorFunctionManualTest
  },
#endif

  0
};

EFI_BB_TEST_PROTOCOL *gBBTestProtocolInterface;

EFI_STATUS
BBTestSimpleTextOutputProtocolUnload (
  IN EFI_HANDLE       ImageHandle
  );

/**
 *  Simple Text Output Protocol Test Driver Entry point.
 *  @param ImageHandle the driver image handle.
 *  @param SystemTable the system table.
 *  @return EFI_SUCCESS the driver is loaded successfully.
 */
EFI_STATUS
InitializeBBTestSimpleTextOutput (
  IN EFI_HANDLE           ImageHandle,
  IN EFI_SYSTEM_TABLE     *SystemTable
  )
{
  EfiInitializeTestLib (ImageHandle, SystemTable);
  SctInitializeLib (ImageHandle, SystemTable);

  gtBS->CreateEvent (EVT_TIMER, 0, (EFI_EVENT_NOTIFY) NULL, NULL, &TimerEvent);

  return EfiInitAndInstallBBTestInterface (
           &ImageHandle,
           &gBBTestProtocolField,
           gBBTestEntryField,
           BBTestSimpleTextOutputProtocolUnload,
           &gBBTestProtocolInterface
           );
}

/**
 *  The driver's Unload function.
 *  @param ImageHandle the test driver image handle.
 *  @return EFI_SUCCESS unload successfully.
 */
EFI_STATUS
BBTestSimpleTextOutputProtocolUnload (
  IN EFI_HANDLE       ImageHandle
  )
{
  EFI_STATUS Status;

  gtBS->CloseEvent (TimerEvent);

  Status = EfiUninstallAndFreeBBTestInterface (
             ImageHandle,
             gBBTestProtocolInterface
             );

  return Status;
}

/**
 *  Assistant function to copy a Unicode string to destination
 *  @param  Destination buffer of destine Unicode string
 *  @param  Source buffer of original Unicode string
 */
VOID
CopyUnicodeString (
  IN CHAR16                     *Destination,
  IN CHAR16                     *Source
  )
{
  UINTN                Index = 0;
  while (Source!=NULL && (*Source)!=0 && Index<256) {
    *Destination=*Source;
    Destination++;
    Source++;
  }
  *Destination=0;
}

#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
UINTN
_IPrint (
  IN EFI_GRAPHICS_OUTPUT_PROTOCOL            *GraphicsOutput,
  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL  *Sto,
  IN UINTN                            X,
  IN UINTN                            Y,
  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL                    *Foreground,
  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL                    *Background,
  IN CHAR16                           *fmt
  )
{
  VOID                                *Buffer;
  EFI_STATUS                          Status;
  UINT16                              GlyphWidth;
  UINT32                              GlyphStatus;
  UINT16                              StringIndex;
  UINTN                               Index;
  CHAR16                              *UnicodeWeight;
  EFI_NARROW_GLYPH                    *Glyph;
  UINTN                               Size;
  EFI_HII_PROTOCOL                    *Hii;
  EFI_HANDLE                          Handle;
  EFI_GRAPHICS_OUTPUT_BLT_PIXEL                        *LineBuffer;
  UINTN                             HorizontalResolution;
  UINTN                              VerticalResolution;

  GlyphStatus = 0;

  //
  // For now, allocate an arbitrarily long buffer
  //
  Status = gtBS->AllocatePool (EfiBootServicesData,
                              0x10000,
                              (VOID **) &Buffer);

  CopyUnicodeString ((CHAR16*) Buffer, fmt);

  HorizontalResolution  = GraphicsOutput->Mode->Info->HorizontalResolution;
  VerticalResolution    = GraphicsOutput->Mode->Info->VerticalResolution;

  Status = gtBS->AllocatePool (
                   EfiBootServicesData,
                   sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL) * HorizontalResolution * GLYPH_HEIGHT,
                   (VOID **)&LineBuffer
                   );

  if (EFI_ERROR (Status)) {
    gtBS->FreePool (Buffer);
    return Status;
  }

  Size = sizeof (EFI_HANDLE);

  Status = gtBS->LocateHandle (
                   ByProtocol,
                   &gBlackBoxEfiHiiProtocolGuid,
                   NULL,
                   &Size,
                   &Handle
                   );

  if (EFI_ERROR (Status)) {
    goto Error;
  }

  Status = gtBS->HandleProtocol (
                   Handle,
                   &gBlackBoxEfiHiiProtocolGuid,
                   (VOID **) &Hii
                   );

  if (EFI_ERROR (Status)) {
    goto Error;
  }

  UnicodeWeight = (CHAR16 *)Buffer;

  for (Index = 0; UnicodeWeight[Index] != 0; Index++) {
    if (UnicodeWeight[Index] == CHAR_BACKSPACE ||
        UnicodeWeight[Index] == CHAR_LINEFEED ||
        UnicodeWeight[Index] == CHAR_CARRIAGE_RETURN) {
      UnicodeWeight[Index] = 0;
    }
  }

  for (Index = 0; Index < SctStrLen (Buffer); Index++) {
    StringIndex = (UINT16)Index;
    Status = Hii->GetGlyph (Hii, UnicodeWeight, &StringIndex, (UINT8 **)&Glyph, &GlyphWidth, &GlyphStatus);
    if (EFI_ERROR (Status)) {
      goto Error;
    }

    if (Foreground == NULL || Background == NULL) {
      Status = Hii->GlyphToBlt (Hii, (UINT8 *)Glyph, mEfiColors[Sto->Mode->Attribute & 0x0f], mEfiColors[Sto->Mode->Attribute >> 4], SctStrLen (Buffer), GlyphWidth, GLYPH_HEIGHT, &LineBuffer[Index * GLYPH_WIDTH]);
    } else {
      Status = Hii->GlyphToBlt (Hii, (UINT8 *)Glyph, *Foreground, *Background, SctStrLen (Buffer), GlyphWidth, GLYPH_HEIGHT, &LineBuffer[Index * GLYPH_WIDTH]);
    }
  }

  //
  // Blt a character to the screen
  //
 Status = GraphicsOutput->Blt (
                                  GraphicsOutput,
                                  LineBuffer,
                                  EfiBltBufferToVideo,
                                  0,
                                  0,
                                  X,
                                  Y,
                                  GLYPH_WIDTH * SctStrLen (Buffer),
                                  GLYPH_HEIGHT,
                                  GLYPH_WIDTH * SctStrLen (Buffer) * sizeof (EFI_GRAPHICS_OUTPUT_BLT_PIXEL)
                                  );

Error:
  gtBS->FreePool (LineBuffer);
  gtBS->FreePool (Buffer);
  return Status;
}

UINTN
PrintXY (
  IN UINTN                            X,
  IN UINTN                            Y,
  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL                    *ForeGround,  OPTIONAL
  IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL                    *BackGround,  OPTIONAL
  IN CHAR16                           *Fmt
  )
{
  EFI_HANDLE                          Handle;
  EFI_GRAPHICS_OUTPUT_PROTOCOL        *GraphicsOutput;
  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL     *Sto;
  EFI_STATUS                          Status;

  Handle = gtST->ConsoleOutHandle;

  Status = gtBS->HandleProtocol (
                   Handle,
                   &gBlackBoxEfiGraphicsOutputProtocolGuid,
                   (VOID **) &GraphicsOutput
                   );

  if (EFI_ERROR (Status)) {
    return Status;
  }

  Status = gtBS->HandleProtocol (
                   Handle,
                   &gBlackBoxEfiSimpleTextOutProtocolGuid,
                   (VOID **) &Sto
                   );

  if (EFI_ERROR (Status)) {
    return Status;
  }

  return _IPrint (GraphicsOutput, Sto, X, Y, ForeGround, BackGround, Fmt);
}
#endif

/**
 *  assistant function to auto judge the user's choice, correct or uncorrect?
 *  @param  Seconds time inteval
 *  @return TRUE/FALSE standing for correct/uncorrect choice respectively
*/
BOOLEAN
AutoJudge (
  IN  UINTN         Seconds,
  IN  BOOLEAN       Default,
  IN  CHAR16        *Message
  )
{
  EFI_STATUS              Status;
  EFI_EVENT               WaitList[2];
  UINTN                   NoWait, WaitIndex;
  EFI_INPUT_KEY           Key;
  BOOLEAN                 PressYes;

  //
  // Set 1 second periodic timer
  //
  Status = gtBS->SetTimer (TimerEvent, TimerPeriodic, 10000000);

  //
  // Set up a wait list for a key and the timer
  //
  NoWait = 0;
  WaitList[NoWait++] = TimerEvent;
  WaitList[NoWait++] = gtST->ConIn->WaitForKey;

  PressYes = Default;
  //
  // Wait for either
  //
  SctPrint (Message);
  while (NoWait) {
    if (Default==TRUE) {
      SctPrint (L"\rYes/No?(Auto judge as Yes in %d seconds)", Seconds);
    } else {
      SctPrint (L"\rYes/No?(Auto judge as No in %d seconds)", Seconds);
    }

    Status = gtBS->WaitForEvent (NoWait, WaitList, &WaitIndex);

    switch (WaitIndex) {
      case 0:
        Seconds -= 1;
        if (Seconds <= 0) {
          //
          // To stop loop
          //
          NoWait = 0;
        }
        break;

      case 1:
        //
        // Read the key
        //
        Status = gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key);
        SctAPrint ((char*)(&Key.UnicodeChar));
        switch (Key.UnicodeChar) {
          case 'Y':
          case 'y':
            NoWait = 0;
            PressYes = TRUE;
            break;
          case 'N':
          case 'n':
            NoWait = 0;
            PressYes = FALSE;
            break;
          default :
            SctPrint (L"\n");
            break;
        }
        break;
      default:
        break;
        //
        // bad WaitIndex response
        //
    }
  }
  SctPrint (L"\r\n");

  //
  // Done, cancle periodic timer
  //
  Status = gtBS->SetTimer (TimerEvent, TimerCancel, 0);

  return PressYes;
}

#if (EFI_SPECIFICATION_VERSION < 0x0002000A)
/**
 *  assistant function to auto judge the user's choice, correct or uncorrect?
 *  @param  Seconds time inteval
 *  @return TRUE/FALSE standing for correct/uncorrect choice respectively
*/
BOOLEAN
AutoJudgeUga (
  IN  UINTN         X,
  IN  UINTN         Y,
  IN  UINTN         Seconds,
  IN  BOOLEAN       Default,
  IN  CHAR16        *Message
  )
{
  EFI_STATUS              Status;
  EFI_EVENT               WaitList[2];
  UINTN                   NoWait, WaitIndex;
  EFI_INPUT_KEY           Key;
  BOOLEAN                 PressYes;
  CHAR16                  *Msg;

  //
  // Set 1 second periodic timer
  //
  Status = gtBS->SetTimer (TimerEvent, TimerPeriodic, 10000000);

  //
  // Set up a wait list for a key and the timer
  //
  NoWait = 0;
  WaitList[NoWait++] = TimerEvent;
  WaitList[NoWait++] = gtST->ConIn->WaitForKey;

  PressYes = Default;
  //
  // Wait for either
  //
  PrintXY (X, Y, NULL, NULL, Message);
  while (NoWait) {
    if (Default==TRUE) {
      Msg = SctPoolPrint (L"Yes/No?(Auto judge as Yes in %d seconds  ", Seconds);
    } else {
      Msg = SctPoolPrint (L"Yes/No?(Auto judge as No in %d seconds   ", Seconds);
    }

    if (Msg == NULL) {
      return FALSE;
    } else {
      PrintXY(X, Y+20, NULL, NULL, Msg);
      SctFreePool (Msg);
    }

    Status = gtBS->WaitForEvent (NoWait, WaitList, &WaitIndex);

    switch (WaitIndex) {
      case 0:
        Seconds -= 1;
        if (Seconds <= 0) {
          //
          // To stop loop
          //
          NoWait = 0;
        }
        break;

      case 1:
        //
        // Read the key
        //
        Status = gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key);
        SctAPrint ((char*)(&Key.UnicodeChar));
        switch (Key.UnicodeChar) {
          case 'Y':
          case 'y':
            NoWait = 0;
            PressYes = TRUE;
            break;
          case 'N':
          case 'n':
            NoWait = 0;
            PressYes = FALSE;
            break;
          default :
            //PrintXY(X,YL"\n");
            break;
        }
        break;
      default:
        break;
        //
        // bad WaitIndex response
        //
    }
  }
  //SctPrint (L"\r\n");

  //
  // Done, cancle periodic timer
  //
  Status = gtBS->SetTimer (TimerEvent, TimerCancel, 0);

  return PressYes;
}
#endif

/**
 *  assistant function to restore the mode of SimpleTextOutput Protocol
 *  @param  SimpleOut destine SimpleTextOutput Protocol
 *  @param  SavedMode EFI_SIMPLE_TEXT_OUTPUT_MODE type
 *  @param  StandardLib EFI Standard Test Library Protocol Interface
 *  @return  EFI Status of the procedure
 */
EFI_STATUS
RestoreMode (
  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL      *SimpleOut,
  IN EFI_SIMPLE_TEXT_OUTPUT_MODE          *SavedMode,
  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL   *StandardLib
  )
{
  EFI_STATUS  Status;

  //
  //restore old mode of SimpleOut
  //
  if (SavedMode->Mode != SimpleOut->Mode->Mode) {
    Status = SimpleOut->SetMode (SimpleOut, SavedMode->Mode);
    if (EFI_ERROR(Status)) {
      StandardLib->RecordAssertion (
                  StandardLib,
                  EFI_TEST_ASSERTION_FAILED,
                  gTestGenericFailureGuid,
                  L"EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetMode - SetMode to restore.",
                  L"%a:%d, Status = %r,Mode = %d",
                  __FILE__,
                  (UINTN)__LINE__,
                  Status,
                  SavedMode->Mode);
      return Status;
    }
  }

  //
  //restore old attriubte of SimpleOut
  //
  if (SavedMode->Attribute != SimpleOut->Mode->Attribute) {
    Status = SimpleOut->SetAttribute (SimpleOut, SavedMode->Attribute);
    if (EFI_ERROR(Status)) {
      StandardLib->RecordAssertion (
                  StandardLib,
                  EFI_TEST_ASSERTION_FAILED,
                  gTestGenericFailureGuid,
                  L"EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute - SetAttribute to restore.",
                  L"%a:%d, Status = %r,Attribute = %d",
                  __FILE__,
                  (UINTN)__LINE__,
                  Status,
                  SavedMode->Attribute);
      return Status;
    }
  }

  //
  //restore old cursor attriubte of SimpleOut
  //
  if (SavedMode->CursorVisible != SimpleOut->Mode->CursorVisible) {
    Status = SimpleOut->EnableCursor (SimpleOut, SavedMode->CursorVisible);
    if (EFI_ERROR(Status)) {
      StandardLib->RecordAssertion (
                  StandardLib,
                  EFI_TEST_ASSERTION_FAILED,
                  gTestGenericFailureGuid,
                  L"EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.EnableCursor - EnableCursor to restore cursor.",
                  L"%a:%d, Status = %r,CursorVisible = %d",
                  __FILE__,
                  (UINTN)__LINE__,
                  Status,
                  SavedMode->CursorVisible);
      return Status;
    }
  }

  //
  //restore mode successfully
  //
  return EFI_SUCCESS;
}

/**
 *  assistant function to backup the mode of SimpleTextOutput Protocol
 *  @param  SimpleOut destine SimpleTextOutput Protocol
 *  @param  SavedMode EFI_SIMPLE_TEXT_OUTPUT_MODE type
 *  @param  StandardLib EFI Standard Test Library Protocol Interface
 *  @return  EFI Status of the procedure
 */
VOID
BackupMode (
  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL      *SimpleOut,
  IN EFI_SIMPLE_TEXT_OUTPUT_MODE          *SavedMode
  )
{
  //
  //backup old mode of SimpleOut
  //
  SavedMode->MaxMode            = SimpleOut->Mode->MaxMode;
  SavedMode->Mode               = SimpleOut->Mode->Mode;
  SavedMode->Attribute          = SimpleOut->Mode->Attribute;
  SavedMode->CursorColumn       = SimpleOut->Mode->CursorColumn;
  SavedMode->CursorRow          = SimpleOut->Mode->CursorRow;
  SavedMode->CursorVisible      = SimpleOut->Mode->CursorVisible;
}

/**
 *  assistant function to locate DevicePath Protocol from SimpleTextOut Protocol
 *  @param  SimpleTextOut protocol interface
 *  @param  DevicePath protocol interface
 *  @param  StandardLib protocol interface for record assertion point
 *  @return Status
*/
EFI_STATUS
LocateDevicePathFromSimpleTextOut (
  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL      *SimpleOut,
  IN EFI_DEVICE_PATH_PROTOCOL             **DevicePath,
  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL   *StandardLib
  )
{
  EFI_STATUS                              Status;

  UINTN                                   NoHandles, Index;
  EFI_HANDLE                              *HandleBuffer;
  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL         *OtherSimpleOut;

  //
  // Locate the Handle that the SimpleTextOutput interface is bound to
  //
  Status = gtBS->LocateHandleBuffer (
                   ByProtocol,
                   &gBlackBoxEfiSimpleTextOutProtocolGuid,
                   NULL,
                   &NoHandles,
                   &HandleBuffer
                   );
  if (EFI_ERROR (Status)) {
    StandardLib->RecordAssertion (
                   StandardLib,
                   EFI_TEST_ASSERTION_FAILED,
                   gTestGenericFailureGuid,
                   L"BS.LocateHandle - LocateHandle",
                   L"%a:%d:Status - %r",
                   __FILE__,
                   (UINTN)__LINE__,
                   Status
                   );
    return Status;
  }

  if (NoHandles <= 0 || HandleBuffer == NULL) {
    StandardLib->RecordAssertion (
                   StandardLib,
                   EFI_TEST_ASSERTION_FAILED,
                   gTestGenericFailureGuid,
                   L"BS.LocateHandle - LocateHandle",
                   L"%a:%d:Device Error",
                   __FILE__,
                   (UINTN)__LINE__
                   );
    return EFI_DEVICE_ERROR;
  }

  //
  // Find the exact handle that SimpleTextOutput bound to
  //
  for (Index=0; Index<NoHandles; Index++) {
    Status = gtBS->HandleProtocol (
                     HandleBuffer[Index],
                     &gBlackBoxEfiSimpleTextOutProtocolGuid,
                     (VOID **) &OtherSimpleOut
                     );
    if (EFI_ERROR (Status)) {
      StandardLib->RecordAssertion (
                     StandardLib,
                     EFI_TEST_ASSERTION_FAILED,
                     gTestGenericFailureGuid,
                     L"BS.HandleProtocol - HandleProtocol",
                     L"%a:%d:Status - %r",
                     __FILE__,
                     (UINTN)__LINE__,
                     Status
                     );

      gtBS->FreePool (HandleBuffer);
      return Status;
    }

    if (OtherSimpleOut == SimpleOut) {
      break;
    }
  }

  //
  // Locate the DevicePath Protocol bound to SimpleOut Protocol
  //
  if (Index>=NoHandles) {
    //
    // No Handle Found!!
    //
    gtBS->FreePool (HandleBuffer);
    return EFI_DEVICE_ERROR;
  }

  Status = gtBS->HandleProtocol (
                   HandleBuffer[Index],
                   &gBlackBoxEfiDevicePathProtocolGuid,
                   (VOID **) DevicePath
                   );

  gtBS->FreePool (HandleBuffer);

  return Status;
}

/**
 *  assistant function to locate GraphicsOutput Protocol from SimpleTextOut Protocol
 *  @param  SimpleTextOut protocol interface
 *  @param  Graphics Output protocol interface
 *  @param  StandardLib protocol interface for record assertion point
 *  @return Status
*/
EFI_STATUS
LocateGopFromSimpleTextOut (
  IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL      *SimpleOut,
  IN EFI_GRAPHICS_OUTPUT_PROTOCOL           **GraphicsOutput,
  IN EFI_STANDARD_TEST_LIBRARY_PROTOCOL   *StandardLib
  )
{
  EFI_STATUS                              Status;

  UINTN                                   NoHandles, Index;
  EFI_HANDLE                              *HandleBuffer;
  EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL         *OtherSimpleOut;

  //
  // Locate the Handle that the SimpleTextOutput interface is bound to
  //
  Status = gtBS->LocateHandleBuffer (
                   ByProtocol,
                   &gBlackBoxEfiSimpleTextOutProtocolGuid,
                   NULL,
                   &NoHandles,
                   &HandleBuffer
                   );
  if (EFI_ERROR (Status)) {
    StandardLib->RecordAssertion (
                   StandardLib,
                   EFI_TEST_ASSERTION_FAILED,
                   gTestGenericFailureGuid,
                   L"BS.LocateHandle - LocateHandle",
                   L"%a:%d:Status - %r",
                   __FILE__,
                   (UINTN)__LINE__,
                   Status
                   );
    return Status;
  }

  if (NoHandles <= 0 || HandleBuffer == NULL) {
    StandardLib->RecordAssertion (
                   StandardLib,
                   EFI_TEST_ASSERTION_FAILED,
                   gTestGenericFailureGuid,
                   L"BS.LocateHandle - LocateHandle",
                   L"%a:%d:Device Error",
                   __FILE__,
                   (UINTN)__LINE__
                   );
    return EFI_DEVICE_ERROR;
  }

  //
  // Find the exact handle that SimpleTextOutput bound to
  //
  for (Index=0; Index<NoHandles; Index++) {
    Status = gtBS->HandleProtocol (
                     HandleBuffer[Index],
                     &gBlackBoxEfiSimpleTextOutProtocolGuid,
                     (VOID **) &OtherSimpleOut
                     );
    if (EFI_ERROR (Status)) {
      StandardLib->RecordAssertion (
                     StandardLib,
                     EFI_TEST_ASSERTION_FAILED,
                     gTestGenericFailureGuid,
                     L"BS.HandleProtocol - HandleProtocol",
                     L"%a:%d:Status - %r",
                     __FILE__,
                     (UINTN)__LINE__,
                     Status
                     );

      gtBS->FreePool (HandleBuffer);
      return Status;
    }
    if (OtherSimpleOut == SimpleOut) {
      break;
    }
  }

  //
  // Locate the Graphics Output Protocol bound to SimpleOut Protocol
  //
  if (Index >= NoHandles) {
    //
    // No Handle Found!!
    //
    gtBS->FreePool (HandleBuffer);
    return EFI_DEVICE_ERROR;
  }

  Status = gtBS->HandleProtocol (
                   HandleBuffer[Index],
                   &gBlackBoxEfiGraphicsOutputProtocolGuid,
                   (VOID **) GraphicsOutput
                   );

  gtBS->FreePool (HandleBuffer);
  return Status;
}

BOOLEAN
CheckModeIntegrity (
  IN EFI_SIMPLE_TEXT_OUTPUT_MODE          *ModeExpected,
  IN EFI_SIMPLE_TEXT_OUTPUT_MODE          *Mode
  )
{
  if (Mode->Mode!=ModeExpected->Mode) {
    return FALSE;
  }

  if (Mode->MaxMode!=ModeExpected->MaxMode) {
    return FALSE;
  }

  if (Mode->Attribute!=ModeExpected->Attribute) {
    return FALSE;
  }

  if (Mode->CursorColumn!=ModeExpected->CursorColumn) {
    return FALSE;
  }

  if (Mode->CursorRow!=ModeExpected->CursorRow) {
    return FALSE;
  }

  if (Mode->CursorVisible!=ModeExpected->CursorVisible) {
    return FALSE;
  }

  return TRUE;
}

/**
 *  assistant function to wait a key press or timeout?
 *  @param  Seconds time inteval
*/
void
WaitTimeOrKey (
  IN  UINTN       Seconds
  )
{
  EFI_STATUS              Status;
  EFI_EVENT               WaitList[2];
  UINTN                   NoWait, WaitIndex;
  EFI_INPUT_KEY           Key;

  //
  // Set 1 second periodic timer
  //
  Status = gtBS->SetTimer (TimerEvent, TimerPeriodic, 10000000);

  //
  // Set up a wait list for a key and the timer
  //

  NoWait = 0;
  WaitList[NoWait++] = TimerEvent;
  WaitList[NoWait++] = gtST->ConIn->WaitForKey;

  //
  // Wait for either
  //

  while (NoWait)   {
    SctPrint (L"\rAuto begin in %d seconds or Press Enter to start ", Seconds);
    Status = gtBS->WaitForEvent (NoWait, WaitList, &WaitIndex);

    switch (WaitIndex) {
      case 0:
        Seconds -= 1;
        if (Seconds <= 0) {
          NoWait = 0;     // stop loop
        }
        break;
      case 1:             // Read the key
        Status = gtST->ConIn->ReadKeyStroke (gtST->ConIn, &Key);
        if (Key.UnicodeChar == 0xD) {
          NoWait = 0;     // stop loop
        }
        break;
      default:            // bad WaitIndex response
        break;
   }
  }

  //
  // Done, cancle periodic timer
  //

  Status = gtBS->SetTimer (TimerEvent, TimerCancel, 0);
}


text:
<bill session="110" type="hr" number="852" updated="2009-01-09T09:38:15-05:00">
	<status><vote date="1201113180" datetime="2008-01-23T14:33:00-05:00" where="h" result="pass" how="by voice vote" roll=""/></status>

	<introduced date="1196917200" datetime="2007-12-06"/>
	<titles>
		<title type="official" as="introduced">Raising awareness and encouraging prevention of stalking by establishing January 2008 as "National Stalking Awareness Month".</title>
	</titles>
	<sponsor id="400652"/>
	<cosponsors>
		<cosponsor id="400160" joined="2007-12-06"/>
		<cosponsor id="400618" joined="2007-12-06"/>
		<cosponsor id="400660" joined="2007-12-13"/>
		<cosponsor id="400282" joined="2007-12-06"/>
		<cosponsor id="400443" joined="2008-01-15"/>
		<cosponsor id="412215" joined="2007-12-12"/>
		<cosponsor id="400071" joined="2007-12-06"/>
		<cosponsor id="400663" joined="2007-12-06"/>
		<cosponsor id="400347" joined="2007-12-06"/>
		<cosponsor id="400251" joined="2007-12-06"/>
		<cosponsor id="412236" joined="2007-12-06"/>
		<cosponsor id="400283" joined="2007-12-13"/>
		<cosponsor id="400654" joined="2007-12-12"/>
		<cosponsor id="400639" joined="2007-12-06"/>
	</cosponsors>
	<actions>
		<action date="1196917200" datetime="2007-12-06"><text>Referred to the House Committee on the Judiciary.</text></action>
		<action date="1200286800" datetime="2008-01-14"><text>Referred to the Subcommittee on Crime, Terrorism, and Homeland Security.</text></action>
		<action date="1201112160" datetime="2008-01-23T14:16:00-05:00"><text>Mr. Scott (VA) moved to suspend the rules and agree to the resolution, as amended.</text></action>
		<action date="1201112220" datetime="2008-01-23T14:17:00-05:00"><text>Considered under suspension of the rules.</text><reference label="consideration" ref="CR H422-424"/></action>
		<action date="1201112220" datetime="2008-01-23T14:17:00-05:00"><text>DEBATE - The House proceeded with forty minutes of debate on H. Res. 852.</text></action>
		<vote date="1201113180" how="by voice vote" datetime="2008-01-23T14:33:00-05:00" where="h" type="vote" result="pass" ><text>On motion to suspend the rules and agree to the resolution, as amended Agreed to by voice vote.</text><reference label="text" ref="CR H422"/></vote>
	</actions>
	<committees>

	</committees>
	<relatedbills>

	</relatedbills>
	<subjects>

	</subjects>
	<amendments>

	</amendments>
	<summary>
	1/23/2008--Passed House amended. Expresses the sense of the House of Representatives that: (1) National Stalking Awareness Month provides an opportunity to educate Americans about stalking; (2) all Americans should applaud efforts to promote awareness about stalking; and (3) policymakers and other interested groups should recognize the need to increase awareness of stalking and the availability of services for stalking victims. Urges national and community organizations, private businesses, and the media to promote, through National Stalking Awareness Month, awareness of the crime of stalking.<br/>
	</summary>
</bill>


text:
package com.ilearnrw.api.selectnextword;

import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class GameSentence {
	private String theSentence;
	private ArrayList<String> fillerWords;

	private int languageArea = -1;
	private int difficulty = -1;

	public void setDifficulty(int languageArea,int difficulty){
		this.languageArea = languageArea;
		this.difficulty = difficulty;

	}

	public GameSentence(String theSentence, ArrayList<String> fillerWords,int languageArea, int difficulty) {
		this.theSentence = theSentence;
		this.fillerWords = fillerWords;
		this.difficulty = difficulty;
		this.languageArea = languageArea;
	}

	public GameSentence(String theSentence, ArrayList<String> fillerWords) {
		this.theSentence = theSentence;
		this.fillerWords = fillerWords;
	}

	public GameSentence() {
		this.theSentence = null;
		this.fillerWords = null;
	}
	public String getTheSentence() {
		return theSentence;
	}
	public void setTheSentence(String theSentence) {
		this.theSentence = theSentence;
	}
	public int getLanguageArea(){
		return this.languageArea;
	}
	public int getDifficulty(){
		return this.difficulty;
	}
	public ArrayList<String> getFillerWords() {
		return fillerWords;
	}
	public ArrayList<String> getTargetedWords() {
		ArrayList<String> allMatches = new ArrayList<String>();
		 Matcher m = Pattern.compile("\\{(.*?)\\}",Pattern.DOTALL).matcher(theSentence);
		 while (m.find()) {
		   allMatches.add(m.group().substring(1, m.group().length()-1));
		 }
		return allMatches;
	}
	public void setFillerWords(ArrayList<String> fillerWords) {
		this.fillerWords = fillerWords;
	}

}


text:
package com.trackandtalk.pafos17;

import android.app.Application;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.preference.PreferenceManager;
import android.util.DisplayMetrics;

import com.facebook.stetho.Stetho;
import com.squareup.leakcanary.LeakCanary;
import com.trackandtalk.pafos17.dagger.AppComponent;
import com.trackandtalk.pafos17.dagger.AppModule;
import com.trackandtalk.pafos17.dagger.DaggerAppComponent;
import com.trackandtalk.pafos17.data.AccountManager;
import com.trackandtalk.pafos17.data.db.DbHelper;
import com.trackandtalk.pafos17.data.model.Account;
import com.trackandtalk.pafos17.helper.SharedPrefsHelper;

import java.util.Locale;

import javax.inject.Inject;

/**
  * Created by Konstantinos Papageorgiou and Charalambos Xinaris
  */
public class CulturalCapitalApp extends Application implements SharedPreferences.OnSharedPreferenceChangeListener {

    AppComponent component;

    @Inject DbHelper dbHelper;
    @Inject SharedPrefsHelper prefsHelper;
    @Inject SharedPreferences appSettings;

    private boolean firstRun;
    private int launchCount;
    private static final String PREFERENCE_LAUNCH_COUNTER = "launch_counter";
    private static final String PREFERENCE_IS_RATED = "is_rated";

    String langCode;  //  language code from settings

    @Override
    public void onCreate() {
        super.onCreate();

        //  leakcanary
        if (LeakCanary.isInAnalyzerProcess(this)) {
            return;
        }
        LeakCanary.install(this);

        //  dagger 2
        component = DaggerAppComponent.builder()
                .appModule(new AppModule(this))
                .build();
        component.inject(this);

        //  stetho only for debug build
        if (BuildConfig.DEBUG) {
            Stetho.initializeWithDefaults(this);
        }

        //  override device locale according to user settings
        langCode = appSettings.getString("language", "en");
        setLocale(langCode, false);
        appSettings.registerOnSharedPreferenceChangeListener(this);  //  listen for settings changes

        //  launch counter
        new Thread(new Runnable() {
            @Override
            public void run() {
                launchCount = appSettings.getInt(PREFERENCE_LAUNCH_COUNTER, 0);
                launchCount++;  //  increment it
                appSettings.edit().putInt(PREFERENCE_LAUNCH_COUNTER, launchCount).apply();
            }
        });

        firstRun = appSettings.getBoolean("first_run", true);
        if (firstRun) {
            appSettings.edit().putBoolean("first_run", false).apply();
        }
    }

    public AppComponent getComponent() {
        return component;
    }

    public DbHelper getDbHelper() {

        return dbHelper;
    }

    /**
     * Set the locale for the application.
     *
     * @param langCode ISO-639 language code
     * @param flushDatabase  if the setting is changed, we flush the db and set lastChecked=0 in order to redownload stuff in the new language
     */
    public void setLocale(String langCode, boolean flushDatabase) {
        Locale locale = new Locale(langCode);
        Resources res = getResources();
        DisplayMetrics dm = res.getDisplayMetrics();
        Configuration conf = res.getConfiguration();
        conf.setLocale(locale);
        res.updateConfiguration(conf, dm);

        this.langCode = langCode;
        PreferenceManager.getDefaultSharedPreferences(this).edit().putString("language", langCode).apply();

        if (flushDatabase) {
            getSharedPrefsHelper().setLastCheckedDate(0);
            getDbHelper().deleteAll();
        }
    }

    public Locale getLocale() {
        return new Locale(langCode);
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);
    }

    @Override
    public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
        if (key.equals("language") && !appSettings.getString(key, "en").equals(langCode)) {  //  if language changed...
            setLocale(sharedPreferences.getString(key, "en"), true);  //  change app language and delete all events (to redownload in new language)
        }
    }

    public SharedPrefsHelper getSharedPrefsHelper() {

        return prefsHelper;
    }

    public boolean shouldshowRateDialog() {
        boolean isRated = appSettings.getBoolean(PREFERENCE_IS_RATED, false);

        return launchCount != 0 && launchCount % 5 == 0 && !isRated;
    }

    public void setRated(boolean rated) {
        appSettings.edit().putBoolean(PREFERENCE_IS_RATED, rated).apply();
    }

    public boolean isFirstRun() {

        /* We return in a roundabout way, to avoid firstRun sometimes returning
        * true because it's cached but the method gets called again due to
        * activity lifecycle*/
        if (firstRun) {
            firstRun = false;
            return true;
        }

        return false;
    }
}


text:
/* Don't use the main frame div when the error is in a subframe. */
html[subframe] #main-frame-error {
  display: none;
}

/* Don't use the subframe error div when the error is in a main frame. */
html:not([subframe]) #sub-frame-error {
  display: none;
}

#diagnose-button {
  -webkit-margin-start: 0;
  float: none;
  margin-bottom: 10px;
  margin-top: 20px;
}

h1 {
  margin-top: 0;
}

h2 {
  color: #666;
  font-size: 1.2em;
  font-weight: normal;
  margin: 10px 0;
}

a {
  color: rgb(17, 85, 204);
  text-decoration: none;
}

.icon {
  -webkit-user-select: none;
  content: '';
}

.icon-generic {
  /**
   * Can't access chrome://theme/IDR_ERROR_NETWORK_GENERIC from an untrusted
   * renderer process, so embed the resource manually.
   */
  content: -webkit-image-set(
      url(default_100_percent/common/error_network_generic.png) 1x,
      url(default_200_percent/common/error_network_generic.png) 2x);
  padding-top: 20px;
}

.icon-offline {
  content: -webkit-image-set(
      url(default_100_percent/offline/100-error-offline.png) 1x,
      url(default_200_percent/offline/200-error-offline.png) 2x);
  position: relative;
}

.error-code {
  display: block;
}

#content-top {
  margin: 20px;
}

#help-box-inner {
  background-color: #f9f9f9;
  border-top: 1px solid #EEE;
  color: #444;
  padding: 20px;
  text-align: start;
}

#suggestion {
  margin-top: 15px;
}

#short-suggestion {
  margin-top: 5px;
}

#sub-frame-error-details {
  color: #8F8F8F;
<if expr="not is_android and not is_ios">
  /* Not done on mobile for performance reasons. */
  text-shadow: 0 1px 0 rgba(255,255,255,0.3);
</if>
}

[jscontent=failedUrl] {
  overflow-wrap: break-word;
}

#search-container {
  /* Prevents a space between controls. */
  display: flex;
  margin-top: 20px;
}

#search-box {
  border: 1px solid #cdcdcd;
  flex-grow: 1;
  font-size: 16px;
  height: 26px;
  margin-right: 0;
  padding: 1px 9px;
}

#search-box:focus {
  border: 1px solid rgb(93, 154, 255);
  outline: none;
}

#search-button {
  border: none;
  border-bottom-left-radius: 0;
  border-top-left-radius: 0;
  box-shadow: none;
  display: flex;
  height: 30px;
  margin: 0;
  padding: 0;
  width: 60px;
}

#search-image {
  content:
      -webkit-image-set(
          url(../../app/theme/default_100_percent/common/omnibox_search_button_loupe.png) 1x,
          url(../../app/theme/default_200_percent/common/omnibox_search_button_loupe.png) 2x);
  margin: auto;
}

.secondary-button {
  -webkit-margin-end: 16px;
  background: #d9d9d9;
  color: #696969;
}

.hidden {
  display: none;
}

.suggestions {
  margin-top: 18px;
}

.suggestion-header {
  font-weight: bold;
  margin-bottom: 4px;
}

.suggestion-body {
  color: #777;
}

/* Increase line height at higher resolutions. */
@media (min-width: 641px) and (min-height: 641px) {
  #help-box-inner {
    line-height: 18px;
  }
}

/* Decrease padding at low sizes. */
@media (max-width: 640px), (max-height: 640px) {
  h1 {
    margin: 0 0 15px;
  }
  #content-top {
    margin: 15px;
  }
  #help-box-inner {
    padding: 20px;
  }
  .suggestions {
    margin-top: 10px;
  }
  .suggestion-header {
    margin-bottom: 0;
  }
  .error-code {
    margin-top: 10px;
  }
}

/* Don't allow overflow when in a subframe. */
html[subframe] body {
  overflow: hidden;
}

#sub-frame-error {
  -webkit-align-items: center;
  background-color: #DDD;
  display: -webkit-flex;
  -webkit-flex-flow: column;
  height: 100%;
  -webkit-justify-content: center;
  left: 0;
  position: absolute;
  top: 0;
  transition: background-color .2s ease-in-out;
  width: 100%;
}

#sub-frame-error:hover {
  background-color: #EEE;
}

#sub-frame-error .icon-generic {
  margin: 0 0 16px;
}

#sub-frame-error-details {
  margin: 0 10px;
  text-align: center;
  visibility: hidden;
}

/* Show details only when hovering. */
#sub-frame-error:hover #sub-frame-error-details {
  visibility: visible;
}

/* If the iframe is too small, always hide the error code. */
/* TODO(mmenke): See if overflow: no-display works better, once supported. */
@media (max-width: 200px), (max-height: 95px) {
  #sub-frame-error-details {
    display: none;
  }
}

/* Adjust icon for small embedded frames in apps. */
@media (max-height: 100px) {
  #sub-frame-error .icon-generic {
    height: auto;
    margin: 0;
    padding-top: 0;
    width: 25px;
  }
}

/* details-button is special; it's a <button> element that looks like a link. */
#details-button {
  box-shadow: none;
  min-width: 0;
}

/* Styles for platform dependent separation of controls and details button. */
.suggested-left > #control-buttons,
.suggested-left #stale-load-button,
.suggested-right > #details-button {
  float: left;
}

.suggested-right > #control-buttons,
.suggested-right #stale-load-button,
.suggested-left > #details-button {
  float: right;
}

.suggested-left .secondary-button {
  -webkit-margin-end: 0px;
  -webkit-margin-start: 16px;
}

#details-button.singular {
  float: none;
}

#buttons::after {
  clear: both;
  content: '';
  display: block;
  width: 100%;
}

/* Offline page */
.offline .interstitial-wrapper {
  color: #2b2b2b;
  font-size: 1em;
  line-height: 1.55;
  margin: 0 auto;
  max-width: 600px;
  padding-top: 100px;
  width: 100%;
}

.offline .runner-container {
  height: 150px;
  max-width: 600px;
  overflow: hidden;
  position: absolute;
  top: 35px;
  width: 44px;
}

.offline .runner-canvas {
  height: 150px;
  max-width: 600px;
  opacity: 1;
  overflow: hidden;
  position: absolute;
  top: 0;
  z-index: 2;
}

.offline .controller {
  background: rgba(247,247,247, .1);
  height: 100vh;
  left: 0;
  position: absolute;
  top: 0;
  width: 100vw;
  z-index: 1;
}

#offline-resources {
  display: none;
}

@media (max-width: 420px) {
  .suggested-left > #control-buttons,
  .suggested-right > #control-buttons {
    float: none;
  }
}

@media (max-height: 350px) {
  h1 {
    margin: 0 0 15px;
  }

  .icon-offline {
    margin: 0 0 10px;
  }

  .interstitial-wrapper {
    margin-top: 5%;
  }

  .nav-wrapper {
    margin-top: 30px;
  }
}

@media (min-width: 600px) and (max-width: 736px) and (orientation: landscape) {
  .offline .interstitial-wrapper {
    margin-left: 0;
    margin-right: 0;
  }
}

@media (min-height: 240px) and (orientation: landscape) {
  .offline .interstitial-wrapper {
    margin-bottom: 90px;
  }

  .icon-offline {
    margin-bottom: 20px;
  }
}

@media (max-height: 320px) and (orientation: landscape) {
  .icon-offline {
    margin-bottom: 0;
  }

  .offline .runner-container {
    top: 10px;
  }
}

@media (max-width: 240px) {
  button {
    padding-left: 12px;
    padding-right: 12px;
  }

  .interstitial-wrapper {
    overflow: inherit;
    padding: 0 8px;
  }
}

@media (max-width: 120px) {
  button {
    width: auto;
  }
}


text:
package org.javarosa.user.view;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

import de.enough.polish.ui.CustomItem;
import de.enough.polish.ui.Style;

class ImageButton extends CustomItem {

    private Image _image = null;
    private boolean _down = false;
    private int _clicks = 0;

    public ImageButton(Image image) {
        this(image, null);
    }

    public ImageButton(Image image, Style s) {
        super("", s);
        _image = image;
    }

    public Image getImage() {
        return _image;
    }

    // Is the button currently down?
    public boolean isDown() {
        return _down;
    }

    // Minimal button size = image size
    protected int getMinContentHeight() {
        return getImage().getHeight();
    }
    protected int getMinContentWidth() {
        return getImage().getWidth();
    }
    // Preferred button size = image size + borders
    protected int getPrefContentHeight(int width) {
        return getImage().getHeight()+2;
    }
    protected int getPrefContentWidth(int height) {
        return getImage().getWidth()+2;
    }

    // Button painting procedure
    protected void paint(Graphics g, int w, int h) {
        // Fill the button with grey color - background
        g.setColor(0, 0, 0);
        g.fillRect(0, 0, w, h);
        // Draw the image in the center of the button
        g.drawImage(getImage(), w/2, h/2, Graphics.HCENTER|Graphics.VCENTER);
        // Draw the borders
        g.setColor(0x000000);
        g.drawLine(0, 0, w, 0);
        g.drawLine(0, 0, 0, h);
        g.drawLine(0, h-1, w, h-1);
        g.drawLine(w-1, 0, w-1, h);
    }
}


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

<rootTag>
  <Award>
    <AwardTitle>Aircraft Infrastructure Enhancements</AwardTitle>
    <AwardEffectiveDate>07/15/2009</AwardEffectiveDate>
    <AwardExpirationDate>09/30/2013</AwardExpirationDate>
    <AwardAmount>10700000</AwardAmount>
    <AwardInstrument>
      <Value>Cooperative Agreement</Value>
    </AwardInstrument>
    <Organization>
      06020300
      <Directorate>
        <LongName>Directorate For Geosciences</LongName>
      </Directorate>
      <Division>
        <LongName>Div Atmospheric & Geospace Sciences</LongName>
      </Division>
    </Organization>
    <ProgramOfficer>
      <SignBlockName>Linnea M. Avallone</SignBlockName>
    </ProgramOfficer>
    <AbstractNarration/>
    <MinAmdLetterDate>07/20/2009</MinAmdLetterDate>
    <MaxAmdLetterDate>02/21/2013</MaxAmdLetterDate>
    <ARRAAmount>10700000</ARRAAmount>
    <AwardID>0904552</AwardID>
    <Investigator>
      <FirstName>Roger</FirstName>
      <LastName>Wakimoto</LastName>
      <EmailAddress>ncarreports@ucar.edu</EmailAddress>
      <StartDate>03/06/2010</StartDate>
      <EndDate>11/30/2012</EndDate>
      <RoleCode>Former Principal Investigator</RoleCode>
    </Investigator>
    <Investigator>
      <FirstName>Eric</FirstName>
      <LastName>Barron</LastName>
      <EmailAddress>barron@ucar.edu</EmailAddress>
      <StartDate>07/20/2009</StartDate>
      <EndDate>03/05/2010</EndDate>
      <RoleCode>Former Principal Investigator</RoleCode>
    </Investigator>
    <Investigator>
      <FirstName>Maura</FirstName>
      <LastName>Hagan</LastName>
      <EmailAddress>hagan@ucar.edu</EmailAddress>
      <StartDate>12/01/2012</StartDate>
      <EndDate/>
      <RoleCode>Principal Investigator</RoleCode>
    </Investigator>
    <Institution>
      <Name>University Corporation For Atmospheric Res</Name>
      <CityName>Boulder</CityName>
      <ZipCode>803012252</ZipCode>
      <PhoneNumber>3034971000</PhoneNumber>
      <StreetAddress>3090 Center Green Drive</StreetAddress>
      <CountryName>United States</CountryName>
      <StateName>Colorado</StateName>
      <StateCode>CO</StateCode>
    </Institution>
    <FoaInformation>
      0000099
      <Name>Other Applications NEC</Name>
    </FoaInformation>
    <ProgramElement>
      4200
      <Text>NAT CENTER FOR ATMOSPHERIC RES</Text>
    </ProgramElement>
    <ProgramReference>
      0000
      <Text>UNASSIGNED</Text>
    </ProgramReference>
    <ProgramReference>
      4200
      <Text>NAT CENTER FOR ATMOSPHERIC RES</Text>
    </ProgramReference>
    <ProgramReference>
      6890
      <Text>RECOVERY ACT ACTION</Text>
    </ProgramReference>
    <ProgramReference>
      OTHR
      <Text>OTHER RESEARCH OR EDUCATION</Text>
    </ProgramReference>
  </Award>
</rootTag>


text:
package org.dataloader.stats;

import org.dataloader.stats.context.IncrementBatchLoadCountByStatisticsContext;
import org.dataloader.stats.context.IncrementBatchLoadExceptionCountStatisticsContext;
import org.dataloader.stats.context.IncrementCacheHitCountStatisticsContext;
import org.dataloader.stats.context.IncrementLoadCountStatisticsContext;
import org.dataloader.stats.context.IncrementLoadErrorCountStatisticsContext;

/**
 * This can collect statistics per thread as well as in an overall sense.  This allows you to snapshot stats for a web request say
 * as well as all requests.
 *

 * You will want to call {@link #resetThread()} to clean up the thread local aspects of this object per request thread.
 *

 * ThreadLocals have their place in the Java world but be careful on how you use them.  If you don't clean them up on "request boundaries"
 * then you WILL have misleading statistics.
 *
 * @see org.dataloader.stats.StatisticsCollector
 */
public class ThreadLocalStatisticsCollector implements StatisticsCollector {

    private static final ThreadLocal<SimpleStatisticsCollector> collector = ThreadLocal.withInitial(SimpleStatisticsCollector::new);

    private final SimpleStatisticsCollector overallCollector = new SimpleStatisticsCollector();

    /**
     * Removes the underlying thread local value for this current thread.  This is a way to reset the thread local
     * values for the current thread and start afresh
     *
     * @return this collector for fluent coding
     */
    public ThreadLocalStatisticsCollector resetThread() {
        collector.remove();
        return this;
    }

    @Override
    public <K> long incrementLoadCount(IncrementLoadCountStatisticsContext<K> context) {
        overallCollector.incrementLoadCount(context);
        return collector.get().incrementLoadCount(context);
    }

    @Deprecated
    @Override
    public long incrementLoadCount() {
        return incrementLoadCount(null);
    }

    @Override
    public <K> long incrementLoadErrorCount(IncrementLoadErrorCountStatisticsContext<K> context) {
        overallCollector.incrementLoadErrorCount(context);
        return collector.get().incrementLoadErrorCount(context);
    }

    @Deprecated
    @Override
    public long incrementLoadErrorCount() {
        return incrementLoadErrorCount(null);
    }

    @Override
    public <K> long incrementBatchLoadCountBy(long delta, IncrementBatchLoadCountByStatisticsContext<K> context) {
        overallCollector.incrementBatchLoadCountBy(delta, context);
        return collector.get().incrementBatchLoadCountBy(delta, context);
    }

    @Deprecated
    @Override
    public long incrementBatchLoadCountBy(long delta) {
        return incrementBatchLoadCountBy(delta, null);
    }

    @Override
    public <K> long incrementBatchLoadExceptionCount(IncrementBatchLoadExceptionCountStatisticsContext<K> context) {
        overallCollector.incrementBatchLoadExceptionCount(context);
        return collector.get().incrementBatchLoadExceptionCount(context);
    }

    @Deprecated
    @Override
    public long incrementBatchLoadExceptionCount() {
        return incrementBatchLoadExceptionCount(null);
    }

    @Override
    public <K> long incrementCacheHitCount(IncrementCacheHitCountStatisticsContext<K> context) {
        overallCollector.incrementCacheHitCount(context);
        return collector.get().incrementCacheHitCount(context);
    }

    @Deprecated
    @Override
    public long incrementCacheHitCount() {
        return incrementCacheHitCount(null);
    }

    /**
     * This returns the statistics for this thread.
     *
     * @return this thread's statistics
     */
    @Override
    public Statistics getStatistics() {
        return collector.get().getStatistics();
    }

    /**
     * This returns the overall statistics, that is not per thread but for the life of this object
     *
     * @return overall statistics
     */
    public Statistics getOverallStatistics() {
        return overallCollector.getStatistics();
    }

    @Override
    public String toString() {
        return "ThreadLocalStatisticsCollector{" +
                "thread=" + getStatistics().toString() +
                "overallCollector=" + overallCollector.getStatistics().toString() +
                '}';
    }
}


text:
'use strict';

northwindApp.controller('dummyviewController',
    function ($scope) {
    });


text:
FROM python:3.6.5-alpine3.7

RUN apk add -U --no-cache curl git make gcc python-dev libffi-dev musl-dev libxml2-dev libxslt-dev openssl-dev zlib-dev jpeg-dev
RUN git clone https://github.com/fhamborg/news-please.git /news-please
RUN cd /news-please && pip3 install -r requirements.txt

COPY docker.sh /
RUN chmod +x /docker.sh

CMD ["/docker.sh"]


text:
'use strict';

var expect = require('expect');
var runner = require('gulp-test-tools').gulpRunner;

describe('flag: --silent', function() {

  it('prints nothing when silent flag is set', function(done) {
    runner({ verbose: false })
      .gulp('--silent', '--cwd ./test/fixtures/gulpfiles')
      .run(cb);

    function cb(err, stdout, stderr) {
      expect(err).toEqual(null);
      expect(stderr).toEqual('');
      expect(stdout).toEqual('');
      done(err);
    }
  });

});


text:
package it.reply.orchestrator.service.commands;

import static org.assertj.core.api.Assertions.assertThatCode;
import static org.mockito.Mockito.when;

import it.reply.orchestrator.service.CallbackService;
import it.reply.orchestrator.utils.WorkflowConstants;

import java.util.UUID;

import junitparams.JUnitParamsRunner;
import junitparams.Parameters;

import org.flowable.engine.delegate.DelegateExecution;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;

@RunWith(JUnitParamsRunner.class)
public class NotifyTest extends BaseJavaDelegateTest<Notify> {

  @Mock
  private CallbackService callbackService;

  public NotifyTest() {
    super(new Notify());
  }

  @Test
  @Parameters({ "true", "false" })
  public void doExecuteSuccesfully(boolean serviceResult) throws Exception {
    String deploymentId = UUID.randomUUID().toString();

    DelegateExecution delegateExecution = new ExecutionEntityBuilder()
        .withMockedVariable(WorkflowConstants.Param.DEPLOYMENT_ID, deploymentId)
        .build();

    when(callbackService.doCallback(deploymentId))
        .thenReturn(serviceResult);

    assertThatCode(() -> command.execute(delegateExecution))
        .doesNotThrowAnyException();

  }

  @Test
  public void doExecuteWithRuntimeException() throws Exception {
    String deploymentId = UUID.randomUUID().toString();

    DelegateExecution delegateExecution = new ExecutionEntityBuilder()
        .withMockedVariable(WorkflowConstants.Param.DEPLOYMENT_ID, deploymentId)
        .build();

    when(callbackService.doCallback(deploymentId))
        .thenThrow(new RuntimeException("some error"));

    assertThatCode(() -> command.execute(delegateExecution))
        .doesNotThrowAnyException();

  }

  @Test
  public void doExecuteWithMissingParam() throws Exception {

    DelegateExecution delegateExecution = new ExecutionEntityBuilder().build();

    assertThatCode(() -> command.execute(delegateExecution))
        .doesNotThrowAnyException();

  }
}


text:
/* -*-c++-*- */
/* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
 * Copyright 2008-2013 Pelican Mapping
 * http://osgearth.org
 *
 * osgEarth is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>
 */

#include <osgEarth/Geoid>
#include <osgEarth/HeightFieldUtils>

#define LC "[Geoid] "

using namespace osgEarth;

Geoid::Geoid() :
_units( Units::METERS ),
_valid( false )
{
    //nop
}

void
Geoid::setName( const std::string& name )
{
    _name = name;
    validate();
}

void
Geoid::setHeightField( osg::HeightField* hf )
{
    _hf = hf;
    _bounds = Bounds(
        _hf->getOrigin().x(),
        _hf->getOrigin().y(),
        _hf->getOrigin().x() + _hf->getXInterval() * double(_hf->getNumColumns()),
        _hf->getOrigin().y() + _hf->getYInterval() * double(_hf->getNumRows()) );
    validate();
}

void
Geoid::setUnits( const Units& units )
{
    _units = units;
    validate();
}

void
Geoid::validate()
{
    _valid = false;
    if ( !_hf.valid() )
    {
        //OE_WARN << LC << "ILLEGAL GEOID: no heightfield" << std::endl;
    }
    else if ( !_bounds.valid() )
    {
        OE_WARN << LC << "ILLEGAL GEOID: heightfield must be geodetic" << std::endl;
    }
    else
    {
        _valid = true;
    }
}

float
Geoid::getHeight(double lat_deg, double lon_deg, const ElevationInterpolation& interp ) const
{
    float result = 0.0f;

    if ( _valid && _bounds.contains(lon_deg, lat_deg) )
    {
        double nlon = (lon_deg-_bounds.xMin())/_bounds.width();
        double nlat = (lat_deg-_bounds.yMin())/_bounds.height();
        result = HeightFieldUtils::getHeightAtNormalizedLocation( _hf.get(), nlon, nlat, interp );
    }

    return result;
}

bool
Geoid::isEquivalentTo( const Geoid& rhs ) const
{
    // weak..
    return
        _valid                      &&
        _name == rhs._name          &&
        _hf.get() == rhs._hf.get()  &&
        _units == rhs._units;
}


text:
function addPoints(map, color, category) {
	var layerName = category+"-points";
	map.addLayer({
		"id": layerName,
		"type": "circle",
		"source": category,
		"paint": {
			"circle-color": color,
			"circle-stroke-color": "black",
			"circle-stroke-width": 1
		}
	});

	map.on('click', layerName, function(e) {
		var results = tooltip(e, category);
		new mapboxgl.Popup().setLngLat(results['coordinates']).
		setHTML(results['description']).addTo(map);
	});
}

function tooltip(elem, category) {
	// Position the popup nicely
	var coordinates = elem.features[0].geometry.coordinates.slice();
	while (Math.abs(elem.lngLat.lng - coordinates[0]) > 180)
		coordinates[0] += elem.lngLat.lng > coordinates[0] ? 360 : -360;

	// Add useful information to the popup
	var pointProperties = elem.features[0].properties;
	var description = 'City: ' + pointProperties.city;
	if (pointProperties.reason) {
		if (category == "Conference")
			description += '
' + pointProperties.reason;
		else if (category == "Internship")
			description += '
' + pointProperties.reason;
		else
			description += '
' + pointProperties.reason;
	}
	return {'coordinates': coordinates,
	'description': description};
}

function addMapPoint(layers, city, lat, lng, reason, year, category) {
	var lat = parseFloat(lat);
	var lng = parseFloat(lng);
	var data = {
		"type": "Feature",
		"geometry": {"type": "Point",
		"coordinates": [lng, lat]},
		"properties": {
		  "city": city,
		  "reason": reason,
		  "year": year
		}
	};
	layers[category].push(data);
	return layers;
}


text: Post questions about things that make you go "WAT". Get answers. Read comments. Vote.


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <TextView
        android:id="@+id/actionListTitle"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="10dp"
        android:text="@string/everyplay_default_title"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <LinearLayout
        android:id="@+id/actionlistButtonContainer"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@+id/actionListTitle"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"
        android:orientation="vertical" >

        <Button
            android:id="@+id/Button02"
            style="@style/ActionListButtonText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="2dp"
            android:background="@drawable/everyplay_action_list_option"
            android:text="@string/everyplay_default_button_label"/>

        <Button
            android:id="@+id/Button01"
            style="@style/ActionListButtonText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="2dp"
            android:background="@drawable/everyplay_action_list_destructive"
            android:text="@string/everyplay_default_button_label" />

        <Button
            android:id="@+id/installButton"
            style="@style/ActionListButtonText"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="2dp"
            android:background="@drawable/everyplay_action_list_cancel"
            android:text="@string/everyplay_default_button_label" />

    </LinearLayout>

</RelativeLayout>


text:
/*
 * Instrument.cpp
 *
 *  Created on: 2016Äê4ÔÂ28ÈÕ
 *      Author: LeoBrilliant
 */

#include "Instrument.h"

Instrument::Instrument(): Name(InvalidString),
	Code(InvalidString),
	Underlying(InvalidString),
	Multiplier(Constants::INVALIDVOLUME),
	QuotationUnit(Constants::INVALIDVOLUME),
	Tick(Constants::INVALIDPRICE),
	Month(InvalidString)
{
}

Instrument::Instrument(StringType name, StringType code, StringType underlying,
		VolumeType multiplier, VolumeType quotationUnit, PriceType tick,
		StringType month): Name(name),
				Code(code),
				Underlying(underlying),
				Multiplier(multiplier),
				QuotationUnit(quotationUnit),
				Tick(tick),
				Month(month)
{
}

Instrument::~Instrument() {
}

const StringType& Instrument::GetCode() const {
	return Code;
}

const StringType& Instrument::GetMonth() const {
	return Month;
}

VolumeType Instrument::GetMultiplier() const {
	return Multiplier;
}

const StringType& Instrument::GetName() const {
	return Name;
}

VolumeType Instrument::GetQuotationUnit() const {
	return QuotationUnit;
}

PriceType Instrument::GetTick() const {
	return Tick;
}

const StringType& Instrument::GetUnderlying() const {
	return Underlying;
}


text:
/* -*- C++ -*- */

/*

  Heap Layers: An Extensible Memory Allocation Infrastructure

  Copyright (C) 2000-2012 by Emery Berger
  http://www.cs.umass.edu/~emery
  emery@cs.umass.edu

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/

#ifndef HL_FREELISTHEAP_H
#define HL_FREELISTHEAP_H

/**
 * @class FreelistHeap
 * @brief Manage freed memory on a linked list.
 * @warning This is for one "size class" only.
 *
 * Note that the linked list is threaded through the freed objects,
 * meaning that such objects must be at least the size of a pointer.
 */

#include <assert.h>
#include "utility/freesllist.h"

#ifndef NULL
#define NULL 0
#endif

namespace HL {

  template <class SuperHeap>
  class FreelistHeap : public SuperHeap {
  public:

    inline void * malloc (size_t sz) {
      // Check the free list first.
      void * ptr = _freelist.get();
      // If it's empty, get more memory;
      // otherwise, advance the free list pointer.
      if (ptr == 0) {
        ptr = SuperHeap::malloc (sz);
      }
      return ptr;
    }

    inline void free (void * ptr) {
      if (ptr == 0) {
        return;
      }
      _freelist.insert (ptr);
    }

    inline void clear (void) {
      void * ptr;
      while ((ptr = _freelist.get())) {
        SuperHeap::free (ptr);
      }
    }

  private:

    FreeSLList _freelist;

  };

}

#endif


text:
CMAKE_<LANG>_COMPILE_OBJECT
---------------------------

Rule variable to compile a single object file.

This is a rule variable that tells CMake how to compile a single
object file for the language <LANG>.