text:
package org.bdgenomics.adam.rdd.read.recalibration

import htsjdk.samtools.{
  CigarElement,
  CigarOperator,
  TextCigarCodec,
  ValidationStringency
}
import org.apache.spark.broadcast.Broadcast
import org.apache.spark.rdd.RDD
import org.apache.spark.storage.StorageLevel
import org.bdgenomics.adam.models.{
  MdTag,
  RecordGroupDictionary,
  ReferenceRegion,
  SnpTable
}
import org.bdgenomics.adam.instrumentation.Timers._
import org.bdgenomics.formats.avro.AlignmentRecord
import org.bdgenomics.utils.misc.Logging
import scala.annotation.tailrec

/**
 * The algorithm proceeds in two phases. First, we make a pass over the reads
 * to collect statistics and build the recalibration tables. Then, we perform
 * a second pass over the reads to apply the recalibration and assign adjusted
 * quality scores.
 *
 * @param input The reads to recalibrate.
 * @param knownSnps A broadcast variable containing the locations of any known
 *   SNPs to ignore during recalibration table generation.
 * @param recordGroups The record groups that the reads in this dataset are from.
 * @param minAcceptableAsciiPhred The minimum acceptable Phred score to attempt
 *   recalibrating, expressed as an ASCII character with Illumina (33) encodings.
 *   Defaults to '&' (Phred 5).
 * @param optStorageLevel An optional storage level to apply if caching the
 *   output of the first stage of BQSR.
 */
private class BaseQualityRecalibration(
  val input: RDD[AlignmentRecord],
  val knownSnps: Broadcast[SnpTable],
  val recordGroups: RecordGroupDictionary,
  val minAcceptableAsciiPhred: Char = (5 + 33).toChar,
  val optStorageLevel: Option[StorageLevel] = None)
    extends Serializable with Logging {

  /**
   * An RDD representing the input reads along with any error covariates that
   * the bases in the read map to.
   */
  val dataset: RDD[(AlignmentRecord, Array[CovariateKey])] = {
    val covRdd = input.map(read => {
      val covariates = if (BaseQualityRecalibration.shouldIncludeRead(read)) {
        BaseQualityRecalibration.observe(read, knownSnps, recordGroups)
      } else {
        Array.empty[CovariateKey]
      }
      (read, covariates)
    })

    optStorageLevel.fold(covRdd)(sl => {
      log.info("User requested %s persistance for covariate RDD.".format(sl))
      covRdd.persist(sl)
    })
  }

  /**
   * A table containing the error frequency observations for the given reads.
   */
  val observed: ObservationTable = {
    val observations = dataset.flatMap(p => p._2).flatMap(cov => {
      if (cov.shouldInclude) {
        Some((cov.toDefault, Observation(cov.isMismatch)))
      } else {
        None
      }
    }).reduceByKeyLocally(_ + _)
    new ObservationTable(observations)
  }

  /**
   * The input reads but with the quality scores of the reads replaced with
   * the quality scores given by the observation table.
   */
  val result: RDD[AlignmentRecord] = {
    val recalibrator = Recalibrator(observed, minAcceptableAsciiPhred)
    dataset.map(p => recalibrator(p._1, p._2))
  }
}

private[read] object BaseQualityRecalibration {

  /**
   * @param read The read to check to see if it is a proper quality read.
   * @return We consider a read valid for use in generating the recalibration
   *   table if it is a "proper" read. That is to say, it is the canonical read
   *   (mapped as a primary alignment with non-zero mapQ and not marked as a
   *   duplicate), it did not fail vendor checks, and the quality and CIGAR
   *   are defined.
   */
  private def shouldIncludeRead(read: AlignmentRecord) = {
    (read.getReadMapped && read.getPrimaryAlignment && !read.getDuplicateRead) &&
      read.getQual != null &&
      (read.getMapq != null && read.getMapq > 0) &&
      (read.getCigar != null && read.getCigar != "*") &&
      !read.getFailedVendorQualityChecks
  }

  /**
   * @param read The read to generate residue inclusion/mismatch flags for.
   * @param maskedSites The set of positions overlapped by this read that
   *   contain known SNPs. This is the product of a join-like operation.
   * @return Returns two arrays that have the length of the read. The first
   *   array contains true at an index if the base at this index should be
   *   included in recalibration (non-zero quality, not in INDEL, not an N,
   *   not masked) and the second array contains true if the base is not a
   *   mismatch.
   */
  private def computeResiduesToInclude(read: AlignmentRecord,
                                       maskedSites: Set[Long]): (Array[Boolean], Array[Boolean]) = {
    val readSequence = read.getSequence.toArray
    val readQualities = read.getQual.toArray
    val shouldInclude = new Array[Boolean](readSequence.length)
    val isMismatch = new Array[Boolean](readSequence.length)
    val readCigar = TextCigarCodec.decode(read.getCigar)
    val readCigarIterator = readCigar.iterator
    val firstCigarElement = readCigarIterator.next

    @tailrec def shouldIncludeResidue(shouldInclude: Array[Boolean],
                                      isMismatch: Array[Boolean],
                                      currentPos: Long,
                                      readSequence: Array[Char],
                                      readQualities: Array[Char],
                                      readCigar: java.util.Iterator[CigarElement],
                                      currentCigarElem: CigarElement,
                                      optMd: Option[MdTag],
                                      maskedSites: Set[Long],
                                      cigarIdx: Int,
                                      baseIdx: Int) {
      if (baseIdx < readSequence.length) {
        val currentCigarOp = currentCigarElem.getOperator
        val (newPos,
          newCigarElem,
          newCigarIdx,
          newBaseIdx) = if (currentCigarOp == CigarOperator.H) {
          // we must either be at the start or the end of the read
          // if we are at the end, we will have exited the loop already
          // so just check to make sure we're at base 0
          assert(baseIdx == 0)
          (currentPos, readCigar.next, 0, 0)
        } else if (currentCigarOp == CigarOperator.N ||
          currentCigarOp == CigarOperator.D) {
          (currentPos + currentCigarElem.getLength,
            readCigar.next,
            0,
            baseIdx)
        } else if (currentCigarOp == CigarOperator.I ||
          currentCigarOp == CigarOperator.S) {

          // soft clip at start needs "unclipped start pos"
          val pos = if (currentCigarOp == CigarOperator.S &&
            baseIdx == 0) {
            currentPos - currentCigarElem.getLength
          } else {
            currentPos
          }

          // set all the overlaping bases to be ignored
          val opLength = currentCigarElem.getLength
          var localIdx = baseIdx
          val baseIdxEnd = baseIdx + opLength - 1
          while (localIdx < baseIdxEnd) {
            shouldInclude(localIdx) = false
            isMismatch(localIdx) = false
            localIdx += 1
          }

          // if we have an insertion, we have already advanced
          // the start position in the match preceding the insertion
          // if we have a soft clip, we have no need to advance the
          // start position, since a soft clip implies that this base
          // is not part of the local alignment
          if (readCigar.hasNext) {
            (currentPos, readCigar.next, 0, baseIdxEnd + 1)
          } else {
            // we cannot pop off the next cigar element when we are at the
            // end of the read, so fake it
            assert(baseIdxEnd >= readSequence.length - 1, baseIdxEnd)
            (currentPos, currentCigarElem, 0, baseIdxEnd + 1)
          }
        } else {
          shouldInclude(baseIdx) = ((readSequence(baseIdx) != 'N') &&
            !maskedSites(currentPos) &&
            readQualities(baseIdx) > '!')
          isMismatch(baseIdx) = currentCigarOp match {
            case CigarOperator.X => true
            case CigarOperator.M => {
              // TODO: allow user to broadcast a ReferenceFile
              require(optMd.isDefined,
                "Cigar M was seen for read with undefined MD tag.")
              !optMd.get.isMatch(currentPos)
            }
            case _ => {
              // we fall through to this case IFF we see a Cigar =
              // however, the compiler can't check this since we
              // if/else out of the non-X/M cases above (DHSIN, disregard P)
              // so, we treat it as a case _
              false
            }
          }

          // are we at the end of this cigar block? if so, grab a new operator
          val (nextCigarElem,
            nextCigarIdx) = if (cigarIdx == currentCigarElem.getLength - 1) {
            if (readCigar.hasNext) {
              (readCigar.next, 0)
            } else {
              // we cannot pop off the next cigar element when we are at the
              // end of the read, so fake it
              assert(baseIdx >= readSequence.length - 1, baseIdx.toString)
              (currentCigarElem, cigarIdx + 1)
            }
          } else {
            (currentCigarElem, cigarIdx + 1)
          }

          (currentPos + 1L,
            nextCigarElem,
            nextCigarIdx,
            baseIdx + 1)
        }

        // call recursively
        shouldIncludeResidue(shouldInclude,
          isMismatch,
          newPos,
          readSequence,
          readQualities,
          readCigar,
          newCigarElem,
          optMd,
          maskedSites,
          newCigarIdx,
          newBaseIdx)
      }
    }

    shouldIncludeResidue(shouldInclude, isMismatch,
      read.getStart,
      readSequence,
      readQualities,
      readCigarIterator,
      firstCigarElement,
      Option(read.getMismatchingPositions)
        .map(MdTag(_, read.getStart, readCigar)),
      maskedSites,
      0, 0)
    (shouldInclude, isMismatch)
  }

  /**
   * Observes the error covariates contained in a read.
   *
   * @param read The read to observe.
   * @param recordGroups A record group dictionary containing the read group
   *   this read is from.
   * @param maskedSites The known SNP loci that this read covers.
   * @return Returns an array of CovariateKeys that describe the per-base
   *   error covariates seen in this read.
   *
   * @note This method was split out from the other observe method to make it
   *   simpler to write unit tests for this package. Similarly, that is why
   *   this method is package private, while the other is private.
   */
  private[recalibration] def observe(
    read: AlignmentRecord,
    recordGroups: RecordGroupDictionary,
    maskedSites: Set[Long] = Set.empty): Array[CovariateKey] = ObservingRead.time {
    val (toInclude, isMismatch) = ReadResidues.time {
      computeResiduesToInclude(read, maskedSites)
    }
    ReadCovariates.time {
      CovariateSpace(read,
        toInclude,
        isMismatch,
        recordGroups)
    }
  }

  /**
   * Observes the error covariates contained in a read.
   *
   * @param read The read to observe.
   * @param knownSnps A broadcast variable containing all known SNP loci to mask.
   * @param recordGroups A record group dictionary containing the read group
   *   this read is from.
   * @return Returns an array of CovariateKeys that describe the per-base
   *   error covariates seen in this read.
   */
  private def observe(
    read: AlignmentRecord,
    knownSnps: Broadcast[SnpTable],
    recordGroups: RecordGroupDictionary): Array[CovariateKey] = ObservingRead.time {
    val maskedSites = knownSnps.value
      .maskedSites(ReferenceRegion.unstranded(read))
    observe(read, recordGroups, maskedSites)
  }

  /**
   * Runs base quality score recalibration.
   *
   * @param rdd The reads to recalibrate.
   * @param knownSnps A broadcast table of known variation to mask during the
   *   recalibration process.
   * @param recordGroups The read groups that generated these reads.
   * @param minAcceptableQuality The minimum quality score to attempt to
   *   recalibrate.
   * @param optStorageLevel An optional storage level to apply if caching the
   *   output of the first stage of BQSR.
   */
  def apply(
    rdd: RDD[AlignmentRecord],
    knownSnps: Broadcast[SnpTable],
    recordGroups: RecordGroupDictionary,
    minAcceptableQuality: Int,
    optStorageLevel: Option[StorageLevel]): RDD[AlignmentRecord] = {
    require(minAcceptableQuality >= 0 && minAcceptableQuality < 93,
      "MinAcceptableQuality (%d) must be positive and less than 93.")
    new BaseQualityRecalibration(rdd,
      knownSnps,
      recordGroups,
      (minAcceptableQuality + 33).toChar,
      optStorageLevel).result
  }
}


text:
const paths = require('./paths');
const getClientEnvironment = require('./env');

const publicPath = paths.publicUrlOrPath + 'assets/';
// We will provide `paths.publicUrlOrPath` to our app
// as %PUBLIC_URL% in `index.html` and `process.env.PUBLIC_URL` in JavaScript.
// Omit trailing slash as %PUBLIC_URL%/xyz looks better than %PUBLIC_URL%xyz.
// Get environment variables to inject into our app.
const env = getClientEnvironment(publicPath.slice(0, -1));

const isEnvDevelopment = env.raw.NODE_ENV === 'development';
const isEnvProduction = env.raw.NODE_ENV === 'production';
const isEnvTest = env.raw.NODE_ENV === 'test';

// Variable used for enabling profiling in Production
// passed into alias object. Uses a flag if passed into the build command
const isEnvProductionProfile = isEnvProduction && process.argv.includes('--profile');

const imageInlineSizeLimit = parseInt(process.env.IMAGE_INLINE_SIZE_LIMIT || '10000');

// Source maps are resource heavy and can cause out of memory issue for large source files.
const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false';

const isServerWebpackConfig = process.env.WEBPACK_SERVER_CONFIG;

const isSSR = env.raw.REACT_APP_SSR !== 'false';

// Express port and host
const port = process.env.PORT || 8080;
const host = process.env.HOST || 'localhost';
const ssl = process.env.SSL === 'true' || false;
const logLevel = process.env.LOG_LEVEL;

module.exports = {
  env,
  host,
  imageInlineSizeLimit,
  isEnvDevelopment,
  isEnvProduction,
  isEnvProductionProfile,
  isEnvTest,
  isSSR,
  isServerWebpackConfig,
  logLevel,
  port,
  publicPath,
  shouldUseSourceMap,
  ssl,
};

redpajama_set_name: RedPajamaGithub


text:
<?php namespace Morrislaptop\ErrorTracker\Adapter;

use Exception;
use Exceptiontrap as Exceptiontrap_Client;

class Exceptiontrap extends AbstractAdapter
{
    /**
     * @var Exceptiontrap_Client
     */
    protected $exceptiontrap;

    /**
     * @param Exceptiontrap_Client $exceptiontrap
     */
    public function __construct(Exceptiontrap_Client $exceptiontrap)
    {
        $this->exceptiontrap = $exceptiontrap;
    }

    /**
     * @param Exception $e
     * @param array $extra
     */
    public function report(Exception $e, array $extra = [])
    {
        if ($extra) {
            throw new \InvalidArgumentException('Exceptiontrap doesn\'t support context for exceptions');
        }

        $this->exceptiontrap->handleException($e);
    }
}


text:
<?php

namespace spec\Sylius\Bundle\CoreBundle\EventListener;

use PHPSpec2\ObjectBehavior;

/**
 * Order taxation listener spec.
 *
 * @author Paweł Jędrzejewski <pjedrzejewski@diweb.pl>
 */
class OrderTaxationListener extends ObjectBehavior
{
    /**
     * @param Sylius\Bundle\CoreBundle\OrderProcessing\TaxationProcessorInterface $taxationProcessor
     */
    function let($taxationProcessor)
    {
        $this->beConstructedWith($taxationProcessor);
    }

    function it_is_initializable()
    {
        $this->shouldHaveType('Sylius\Bundle\CoreBundle\EventListener\OrderTaxationListener');
    }

    /**
     * @param Symfony\Component\EventDispatcher\GenericEvent $event
     * @param \stdClass                                      $invalidSubject
     */
    function it_throws_exception_if_event_has_non_order_subject($event, $invalidSubject)
    {
        $event->getSubject()->willReturn($invalidSubject);

        $this
            ->shouldThrow('InvalidArgumentException')
            ->duringProcessOrderTaxation($event)
        ;
    }

    /**
     * @param Symfony\Component\EventDispatcher\GenericEvent $event
     * @param Sylius\Bundle\CoreBundle\Model\OrderInterface  $order
     */
    function it_calls_taxation_processor_on_order($taxationProcessor, $event, $order)
    {
        $event->getSubject()->willReturn($order);
        $taxationProcessor->applyTaxes($order)->shouldBeCalled();

        $this->processOrderTaxation($event);
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="@dimen/wb_city_search_ablum_height"
    android:background="@color/white"
    android:gravity="center">

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="32.0dip"
        android:layout_gravity="center_vertical"
        android:layout_marginBottom="6.0dip"
        android:layout_marginLeft="@dimen/city_search_margin_landr_dimen"
        android:layout_marginRight="@dimen/city_search_margin_landr_dimen"
        android:layout_marginTop="6.0dip"
        android:background="@drawable/city_search_bg">

        <ImageView
            android:id="@+id/search_check"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_centerVertical="true"
            android:layout_marginLeft="9.0dip"
            android:src="@drawable/wb_letter_search_normal" />

        <TextView
            android:id="@+id/city_search_edittext"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:layout_centerVertical="true"
            android:layout_marginLeft="5.0dip"
            android:layout_toRightOf="@id/search_check"
            android:gravity="center_vertical"
            android:text="@string/city_hotcity_searchedittext_hint"
            android:textColor="#ff94989d"
            android:textSize="12.0sp" />
    </RelativeLayout>
</RelativeLayout>


text:
var runTests = true;
var displayResults = true;

var t = [];         // An array of test functions
var m = [];         // An array of mandatory test functions (usually later tests depend on these)
var options = [];    // A list of orders for an account

exports.registerTests = function(th)
{
    th.tests = th.tests.concat(runTests ? t : m);
};

previewOptionChainParams = {
  chainType : "CALL",
  expirationDay : 29,
  expirationMonth : 01,
  expirationYear : 2016,
  underlier : "PCLN",
  skipAdjusted : true
};

previewExpiryDates = {
  underlier : "GOOG"
};

lookupProductParams = {
  company : "VSAT",
  type : "EQ"
};

getQuoteEquityParams = {
  symbol : "MSFT",
  detailFlag : "OPTIONS"
};

getQuoteOptionParams = {
  symbol :  "AAPL:2015:8:21:CALL:130",
  detailFlag : "OPTIONS"
};

// Test getOptionChains function
t.push(function() { this.et.getOptionChains(previewOptionChainParams,this.next(),this.getErrorCallbackFor("OptionChain")); });
if (displayResults) t.push(function(optionChains) { console.log("Option Chains: " + JSON.stringify(optionChains,null,2)); this.next()(optionChains); });
t.push(function(optionChains) { this.shared.options = options = optionChains.optionDetails; this.next()(); });

// Test getOptionExpireDates function
t.push(function() { this.et.getOptionExpireDates(previewExpiryDates["underlier"],this.next(),this.getErrorCallbackFor("OptionExpiry")); });
if (displayResults) t.push(function(optionExpiry) { console.log("Option Expiry Dates: " + JSON.stringify(optionExpiry,null,2)); this.next()(optionExpiry); });
t.push(function(optionExpiry) { this.shared.options = options = optionExpiry.optionDetails; this.next()(); });

// Test LookupProduct function
t.push(function() { this.et.lookupProduct(lookupProductParams,this.next(),this.getErrorCallbackFor("LookupProduct")); });
if (displayResults) t.push(function(lookupProd) { console.log("Product Lookup: " + JSON.stringify(lookupProd,null,2)); this.next()(lookupProd); });
t.push(function(lookupProd) { this.shared.options = options = lookupProd.optionDetails; this.next()(); });

// Test getQuote function for single stock
t.push(function() { this.et.getQuote(getQuoteEquityParams,this.next(),this.getErrorCallbackFor("GetQuote")); });
if (displayResults) t.push(function(quote) { console.log("Get Quote for Stock: " + JSON.stringify(quote,null,2)); this.next()(quote); });
t.push(function(quote) { this.shared.options = options = quote.optionDetails; this.next()(); });

// Test getQuote function for option
t.push(function() { this.et.getQuote(getQuoteOptionParams,this.next(),this.getErrorCallbackFor("GetQuote")); });
if (displayResults) t.push(function(quote) { console.log("Get Quote for Option: " + JSON.stringify(quote,null,2)); this.next()(quote); });
t.push(function(quote) { this.shared.options = options = quote.optionDetails; this.next()(); });

// All done


text:
{-# LANGUAGE CPP #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE MagicHash #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE RoleAnnotations #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ParallelListComp #-}
{-# LANGUAGE DefaultSignatures #-}
{-# LANGUAGE DeriveDataTypeable #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# OPTIONS_GHC -fno-cse -fno-full-laziness #-}

module Data.Discrimination.Grouping
  ( Group(..)
  , Grouping(..)
  , Grouping1(..)
  -- * Combinators
  , nub, nubWith
  , group, groupWith
  , groupingEq
  , runGroup
  -- * Internals
  , hashing
  ) where

import Control.Monad hiding (mapM_)
import Control.Monad.Primitive
import Control.Monad.ST
import Data.Complex
import Data.Discrimination.Internal.WordMap as WordMap
import Data.Foldable hiding (concat)
import Data.Functor.Compose
import Data.Functor.Contravariant
import Data.Functor.Contravariant.Divisible
import Data.Functor.Contravariant.Generic
import Data.Hashable
import Data.Int
import Data.Semigroup hiding (Any)
import Data.Primitive.MutVar
import Data.Promise
import Data.Proxy
import Data.Ratio
import Data.Typeable
import Data.Void
import Data.Word
import Prelude hiding (read, concat, mapM_)

-- | Productive Stable Unordered Discriminator

newtype Group a = Group
  { getGroup :: forall m b. PrimMonad m
             => (b -> m (b -> m ())) -> m (a -> b -> m ())
  } deriving Typeable

instance Contravariant Group where
  contramap f m = Group $ \k -> do
    g <- getGroup m k
    return (g . f)

instance Divisible Group where
  conquer = Group $ \ (k :: b -> m (b -> m ())) -> do
    v <- newMutVar undefined
    writeMutVar v $ \b -> k b >>= writeMutVar v
    return $ \ _ b -> readMutVar v >>= ($ b)

  divide f m n = Group $ \k -> do
    kbcd <- getGroup m $ \ (c, d) -> do
      kcd <- getGroup n k
      kcd c d
      return $ uncurry kcd
    return $ \ a d -> case f a of
      (b, c) -> kbcd b (c, d)

instance Decidable Group where
  choose f m n = Group $ \k -> do
    kb <- getGroup m k
    kc <- getGroup n k
    return (either kb kc . f)

  lose k = Group $ \_ -> return (absurd . k)

instance Semigroup (Group a) where
  (<>) = divide (\a -> (a,a))

instance Monoid (Group a) where
  mempty = conquer
  mappend = (<>)

--------------------------------------------------------------------------------
-- Primitives
--------------------------------------------------------------------------------

groupingWord64 :: Group Word64
groupingWord64 = Group $ \k -> do
  mt <- newMutVar WordMap.empty
  return $ \a b -> readMutVar mt >>= \m -> case WordMap.lookup a m of
    Nothing -> k b >>= \p -> writeMutVar mt (insert a p m)
    Just n -> n b

-- | This may be useful for pragmatically accelerating a grouping structure by
-- preclassifying by a hash function
--
-- Semantically,
--
-- @
-- grouping = hashing <> grouping
-- @
hashing :: Hashable a => Group a
hashing = contramap hash grouping

--------------------------------------------------------------------------------
-- * Unordered Discrimination (for partitioning)
--------------------------------------------------------------------------------

-- | 'Eq' equipped with a compatible stable unordered discriminator.
class Grouping a where
  -- | For every surjection @f@,
  --
  -- @
  -- 'contramap' f 'grouping' ≡ 'grouping'
  -- @

  grouping :: Group a
#ifndef HLINT
  default grouping :: Deciding Grouping a => Group a
  grouping = deciding (Proxy :: Proxy Grouping) grouping
#endif

instance Grouping Void where
  grouping = lose id

instance Grouping Word8 where grouping = contramap fromIntegral groupingWord64
instance Grouping Word16 where grouping = contramap fromIntegral groupingWord64
instance Grouping Word32 where grouping = contramap fromIntegral groupingWord64
instance Grouping Word64 where grouping = groupingWord64
instance Grouping Word where grouping = contramap fromIntegral groupingWord64
instance Grouping Int8 where grouping = contramap fromIntegral groupingWord64
instance Grouping Int16 where grouping = contramap fromIntegral groupingWord64
instance Grouping Int32 where grouping = contramap fromIntegral groupingWord64
instance Grouping Int64 where grouping = contramap fromIntegral groupingWord64
instance Grouping Int where grouping = contramap fromIntegral groupingWord64
instance Grouping Char where grouping = contramap (fromIntegral . fromEnum) groupingWord64

instance Grouping Bool
instance (Grouping a, Grouping b) => Grouping (a, b)
instance (Grouping a, Grouping b, Grouping c) => Grouping (a, b, c)
instance (Grouping a, Grouping b, Grouping c, Grouping d) => Grouping (a, b, c, d)
instance Grouping a => Grouping [a]
instance Grouping a => Grouping (Maybe a)
instance (Grouping a, Grouping b) => Grouping (Either a b)
instance Grouping a => Grouping (Complex a) where
  grouping = divide (\(a :+ b) -> (a, b)) grouping grouping
instance (Grouping a, Integral a) => Grouping (Ratio a) where
  grouping = divide (\r -> (numerator r, denominator r)) grouping grouping
instance (Grouping1 f, Grouping1 g, Grouping a) => Grouping (Compose f g a) where
  grouping = getCompose `contramap` grouping1 (grouping1 grouping)

class Grouping1 f where
  grouping1 :: Group a -> Group (f a)
#ifndef HLINT
  default grouping1 :: Deciding1 Grouping f => Group a -> Group (f a)
  grouping1 = deciding1 (Proxy :: Proxy Grouping) grouping
#endif

instance Grouping1 []
instance Grouping1 Maybe
instance Grouping a => Grouping1 (Either a)
instance Grouping a => Grouping1 ((,) a)
instance (Grouping a, Grouping b) => Grouping1 ((,,) a b)
instance (Grouping a, Grouping b, Grouping c) => Grouping1 ((,,,) a b c)
instance (Grouping1 f, Grouping1 g) => Grouping1 (Compose f g) where
  grouping1 f = getCompose `contramap` grouping1 (grouping1 f)
instance Grouping1 Complex where
  grouping1 f = divide (\(a :+ b) -> (a, b)) f f

-- | Valid definition for @('==')@ in terms of 'Grouping'.
groupingEq :: Grouping a => a -> a -> Bool
groupingEq a b = runST $ do
  rn <- newMutVar (0 :: Word8)
  k <- getGroup grouping $ \_ -> do
    modifyMutVar' rn (+1)
    return return
  k a ()
  k b ()
  n <- readMutVar rn
  return $ n == 1
{-# INLINE groupingEq #-}

runGroup :: Group a -> [(a,b)] -> [[b]]
runGroup (Group m) xs = runLazy (\p0 -> do
    rp <- newMutVar p0
    f <- m $ \ b -> do
      p <- readMutVar rp
      q <- promise []
      p' <- promise []
      p != (b : demand q) : demand p'
      writeMutVar rp p'
      rq <- newMutVar q
      return $ \b' -> do
        q' <- readMutVar rq
        q'' <- promise []
        q' != b' : demand q''
        writeMutVar rq q''
    mapM_ (uncurry f) xs
  ) []

--------------------------------------------------------------------------------
-- * Combinators
--------------------------------------------------------------------------------

-- | /O(n)/. Similar to 'Data.List.group', except we do not require groups to be clustered.
--
-- This combinator still operates in linear time, at the expense of storing history.
--
-- The result equivalence classes are _not_ sorted, but the grouping is stable.
--
-- @
-- 'group' = 'groupWith' 'id'
-- @
group :: Grouping a => [a] -> [[a]]
group as = runGroup grouping [(a, a) | a <- as]

-- | /O(n)/. This is a replacement for 'GHC.Exts.groupWith' using discrimination.
--
-- The result equivalence classes are _not_ sorted, but the grouping is stable.
groupWith :: Grouping b => (a -> b) -> [a] -> [[a]]
groupWith f as = runGroup grouping [(f a, a) | a <- as]

-- | /O(n)/. This upgrades 'Data.List.nub' from @Data.List@ from /O(n^2)/ to /O(n)/ by using
-- productive unordered discrimination.
--
-- @
-- 'nub' = 'nubWith' 'id'
-- 'nub' as = 'head' 'Control.Applicative.<$>' 'group' as
-- @
nub :: Grouping a => [a] -> [a]
nub = nubWith id

-- | /O(n)/. Online 'nub' with a Schwartzian transform.
--
-- @
-- 'nubWith' f as = 'head' 'Control.Applicative.<$>' 'groupWith' f as
-- @
nubWith :: Grouping b => (a -> b) -> [a] -> [a]
nubWith f xs = runLazy (\p0 -> do
    rp <- newMutVar p0
    k <- getGroup grouping $ \a -> do
      p' <- promise []
      p <- readMutVar rp
      p != a : demand p'
      writeMutVar rp p'
      return $ \ _ -> return ()
    mapM_ (\x -> k (f x) x) xs
  ) []


text:
<?php

namespace App\Controllers;

use App\Models\Product;
use App\Models\DetailsGames;
use App\Models\DetailsMovies;
use App\Controllers\Controller;
use Respect\Validation\Validator as v;
use Slim\Views\Twig as View;

class AdminController extends Controller
{

   private function fileUpload($folder)
   {
      $_FILES['image_file']['name'];
      $name = preg_replace('/\s+/', '', $_FILES['image_file']['name']);
      if ($name != "") {
         $target_dir = "/../../public/resources/img/".$folder."/";
         $target_file = __DIR__. $target_dir . $name;
         if(file_exists($target_file)) {
            chmod($target_file,0755); //Change the file permissions if allowed
            unlink($target_file); //remove the file
         }
         move_uploaded_file($_FILES["image_file"]["tmp_name"], $target_file);
         return $name;
      } else {
         return '';
      }
   }

   public function index($request, $response)
   {
      return $this->view->render($response, 'admin.html');
   }

   public function productsAll($request, $response)
   {
      $products = Product::select('id', 'title', 'category', 'price', 'availability')->get();
      return $this->view->render($response, 'adminProducts.html', [
         'products' => $products
      ]);
   }

   public function getProductNew($request, $response)
   {
      return $this->view->render($response, 'adminProductNew.html');
   }

   public function getProductNewMovie($request, $response)
   {
      return $this->view->render($response, 'adminProductNewMovie.html');
   }

   public function postProductNewMovie($request, $response)
   {
      $validation = $this->ValidationController->validate($request, [
         'title' => v::notEmpty()->stringType()->length(1, 1000),
         'description' => v::notEmpty()->stringType()->length(1, 1000),
         'price' => v::notEmpty()->floatVal(),
         'availability' => v::notEmpty()->intVal(),
         'director' => v::notEmpty()->stringType()->length(1, 1000),
         'actors' => v::notEmpty()->stringType()->length(1, 1000),
         'release_date' => v::notEmpty()->intVal()->between(1900, 2090)
      ]);

      if ($validation->failed()) {
         $this->flash->addMessage('error', 'Could not add product');
         return $response->withRedirect($this->router->pathFor('admin.product.new.movie'));
      }

      $image = $this->fileUpload('movies');

      $movie = Product::create([
         'title' => $request->getParam('title'),
         'description' => $request->getParam('description'),
         'category' => 'movies',
         'price' => $request->getParam('price'),
         'image' => $image,
         'availability' => $request->getParam('availability')
      ]);

      $movieDetails = DetailsMovies::create([
         'product_id' => $movie->id,
         'director' => $request->getParam('director'),
         'actors' => $request->getParam('actors'),
         'release_date' => $request->getParam('release_date')
      ]);

      $this->flash->addMessage('info', 'New product added');

      return $response->withRedirect($this->router->pathFor('admin.product.new.movie'));
   }

   public function getProductNewGame($request, $response)
   {
      return $this->view->render($response, 'adminProductNewGame.html');
   }

   public function postProductNewGame($request, $response)
   {
      $validation = $this->ValidationController->validate($request, [
         'title' => v::notEmpty()->stringType()->length(1, 1000),
         'description' => v::notEmpty()->stringType()->length(1, 1000),
         'price' => v::notEmpty()->floatVal(),
         'availability' => v::notEmpty()->intVal(),
         'platform' => v::notEmpty()->stringType()->length(1, 1000),
         'release_date' => v::notEmpty()->intVal()->between(1900, 2090)
      ]);

      if ($validation->failed()) {
         $this->flash->addMessage('error', 'Could not add product');
         return $response->withRedirect($this->router->pathFor('admin.product.new.game'));
      }

      $image = $this->fileUpload('games');

      $game = Product::create([
         'title' => $request->getParam('title'),
         'description' => $request->getParam('description'),
         'category' => 'games',
         'price' => $request->getParam('price'),
         'image' => $image,
         'availability' => $request->getParam('availability')
      ]);

      $gameDetails = DetailsGames::create([
         'product_id' => $game->id,
         'platform' => $request->getParam('platform'),
         'release_date' => $request->getParam('release_date')
      ]);

      $this->flash->addMessage('info', 'New product added');

      return $response->withRedirect($this->router->pathFor('admin.product.new.game'));
   }

   public function postProductEditMovie($request, $response)
   {
      $validation = $this->ValidationController->validate($request, [
         'title' => v::notEmpty()->stringType()->length(1, 1000),
         'description' => v::notEmpty()->stringType()->length(1, 1000),
         'price' => v::notEmpty()->floatVal(),
         'availability' => v::notEmpty()->intVal(),
         'director' => v::notEmpty()->stringType()->length(1, 1000),
         'actors' => v::notEmpty()->stringType()->length(1, 1000),
         'release_date' => v::notEmpty()->intVal()->between(1900, 2090)
      ]);

      if ($validation->failed()) {
         $this->flash->addMessage('error', 'Could not Edit product');
         return $response->withRedirect($this->router->pathFor('admin.products.all'));
      }

      $image = $this->fileUpload('movies');

      $movie = Product::where('id', $request->getParam('id'))->update([
         'title' => $request->getParam('title'),
         'description' => $request->getParam('description'),
         'category' => 'movies',
         'price' => $request->getParam('price'),
         'image' => $image,
         'availability' => $request->getParam('availability')
      ]);

      $movieDetails = DetailsMovies::where('product_id', $request->getParam('id'))->update([
         'director' => $request->getParam('director'),
         'actors' => $request->getParam('actors'),
         'release_date' => $request->getParam('release_date')
      ]);

      $this->flash->addMessage('info', 'Product updated');

      return $response->withRedirect($this->router->pathFor('admin.products.all'));
   }

   public function postProductEditGame($request, $response)
   {
      $validation = $this->ValidationController->validate($request, [
         'title' => v::notEmpty()->stringType()->length(1, 1000),
         'description' => v::notEmpty()->stringType()->length(1, 1000),
         'price' => v::notEmpty()->floatVal(),
         'availability' => v::notEmpty()->intVal(),
         'platform' => v::notEmpty()->stringType()->length(1, 1000),
         'release_date' => v::notEmpty()->intVal()->between(1900, 2090)
      ]);

      if ($validation->failed()) {
         $this->flash->addMessage('error', 'Could Edit product');
         return $response->withRedirect($this->router->pathFor('admin.products.all'));
      }

      $image = $this->fileUpload('games');

      $game = Product::where('id', $request->getParam('id'))->update([
         'title' => $request->getParam('title'),
         'description' => $request->getParam('description'),
         'category' => 'games',
         'price' => $request->getParam('price'),
         'image' => $image,
         'availability' => $request->getParam('availability')
      ]);

      $gameDetails = DetailsGames::where('product_id', $request->getParam('id'))->update([
         'platform' => $request->getParam('platform'),
         'release_date' => $request->getParam('release_date')
      ]);

      $this->flash->addMessage('info', 'Product updated');

      return $response->withRedirect($this->router->pathFor('admin.products.all'));
   }

   public function getProductEdit($request, $response, $args = [])
   {
      $products = Product::where('id', $args['id'])->first();

      if ($products->category == 'movies') {
         $details = DetailsMovies::where('product_id', $args['id'])->first();
         return $this->view->render($response, 'adminProductEditMovie.html', [
            'products' => $products,
            'details' => $details
         ]);
      } else {
         $details = DetailsGames::where('product_id', $args['id'])->first();
         return $this->view->render($response, 'adminProductEditGame.html', [
            'products' => $products,
            'details' => $details
         ]);
      }

      return $this->view->render($response, 'adminProductEdit.html', [
         'products' => $products,
         'details' => $details
      ]);

   }

   public function postProductDelete($request, $response)
   {

      $deletedRowsProduct = Product::where('id', $request->getParam('id'))->delete();

      if ($request->getParam('category') == 'movies') {
         $deletedRowsDetails = DetailsMovies::where('product_id', $request->getParam('id'))->delete();
      } else {
         $deletedRowsDetails = DetailsGames::where('product_id', $request->getParam('id'))->delete();
      }

      $this->flash->addMessage('info', 'Product removed');
      return $response->withRedirect($this->router->pathFor('admin.products.all'));
   }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
	<item android:drawable="@drawable/common_alert_btn_left_pressed" android:state_pressed="true"></item>
</selector>


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:staggered="http://schemas.android.com/apk/res-auto"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <com.origamilabs.library.views.StaggeredGridView
        android:id="@+id/staggered_grid"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:layout_marginLeft="5.0dip"
        android:layout_marginRight="5.0dip"
        android:layout_marginTop="10.0dip"
        android:clipToPadding="true"
        android:columnWidth="100.0dip"
        android:gravity="center"
        android:horizontalSpacing="10.0dip"
        android:smoothScrollbar="true"
        android:stretchMode="columnWidth"
        android:verticalSpacing="25.0dip"
        staggered:drawSelectorOnTop="true"
        staggered:itemMargin="10.0dip"
        staggered:numColumns="2" />

</LinearLayout>


text:
package com.wordpress.mteixeira.warrantychecker;

import android.app.AlertDialog;
import android.app.Dialog;
import android.app.FragmentManager;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;

/**
 * Created by mteixeir on 7/17/13.
 */
public class AlertMessageDialog extends DialogFragment {
    private static String message;

    public AlertMessageDialog(String incomingMessage) {
        message = incomingMessage;
    }

    @Override
    public Dialog onCreateDialog(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
        builder.setMessage(message)
                .setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialogInterface, int i) {
                        // bleh
                    }
                });
        return builder.create();
    }
}


text:
using namespace cerb;

void Server::on_events(int events)
{
    if (this->closed()) {
        return;
    }
    if (poll::event_is_hup(events)) {
        return this->close_conn();
    }
    if (poll::event_is_read(events)) {
        try {
            this->_recv_from();
        } catch (BadRedisMessage& e) {
            LOG(FATAL) << "Receive bad message from server " << this->str()
                       << " because: " << e.what()
                       << " dump buffer (before close): "
                       << this->_buffer.to_string();
            exit(1);
        }
    }
    if (poll::event_is_write(events)) {
        this->_send_to();
    }
}

void Server::_send_buffer_set()
{
    if (this->_output_buffer_set.writev(this->fd)) {
        this->_proxy->set_conn_poll_ro(this);
    } else {
        this->_proxy->set_conn_poll_rw(this);
    }
}

void Server::_send_to()
{
    if (!this->_output_buffer_set.empty()) {
        return this->_send_buffer_set();
    }
    if (this->_commands.empty()) {
        this->_proxy->set_conn_poll_ro(this);
    }
    if (!this->_ready_commands.empty()) {
        LOG(DEBUG) << "+busy";
        return;
    }

    this->_ready_commands = std::move(this->_commands);
    for (util::sref<DataCommand> c: this->_ready_commands) {
        this->_output_buffer_set.append(util::mkref(c->buffer));
    }
    this->_send_buffer_set();
    auto now = Clock::now();
    for (util::sref<DataCommand> c: this->_ready_commands) {
        c->sent_time = now;
    }
}

void Server::_recv_from()
{
    int n = this->_buffer.read(this->fd);
    if (n == 0) {
        throw ConnectionHungUp();
    }
    LOG(DEBUG) << "Read " << this->str() << " buffer size " << this->_buffer.size();
    auto responses(split_server_response(this->_buffer));
    if (responses.size() > this->_ready_commands.size()) {
        LOG(ERROR) << "+Error on split, expected size: " << this->_ready_commands.size()
                   << " actual: " << responses.size() << " dump buffer:";
        for (util::sptr<Response> const& rsp: responses) {
            LOG(ERROR) << "::: " << rsp->get_buffer().to_string();
        }
        LOG(ERROR) << "Rest buffer: " << this->_buffer.to_string();
        LOG(FATAL) << "Exit";
        exit(1);
    }
    LOG(DEBUG) << "+responses size: " << responses.size();
    LOG(DEBUG) << "+rest buffer: " << this->_buffer.size();
    auto cmd_it = this->_ready_commands.begin();
    auto now = Clock::now();
    for (util::sptr<Response>& rsp: responses) {
        util::sref<DataCommand> c = *cmd_it++;
        if (c.not_nul()) {
            rsp->rsp_to(c, util::mkref(*this->_proxy));
            c->resp_time = now;
        }
    }
    this->_ready_commands.erase(this->_ready_commands.begin(), cmd_it);
    this->_proxy->set_conn_poll_ro(this);
}

void Server::push_client_command(util::sref<DataCommand> cmd)
{
    _commands.push_back(cmd);
    cmd->group->client->add_peer(this);
}

void Server::pop_client(Client* cli)
{
    util::erase_if(
        this->_commands,
        [&](util::sref<DataCommand> cmd)
        {
            return cmd->group->client.is(cli);
        });
    for (util::sref<DataCommand>& cmd: this->_ready_commands) {
        if (cmd.not_nul() && cmd->group->client.is(cli)) {
            cmd.reset();
        }
    }
}

std::vector<util::sref<DataCommand>> Server::deliver_commands()
{
    util::erase_if(
        this->_ready_commands,
        [](util::sref<DataCommand> cmd)
        {
            return cmd.nul();
        });
    _commands.insert(_commands.end(), _ready_commands.begin(),
                     _ready_commands.end());
    return std::move(_commands);
}

static thread_local std::map<util::Address, Server*> servers_map;
static thread_local std::vector<Server*> servers_pool;

static void remove_entry(Server* server)
{
    ::servers_map.erase(server->addr);
    ::servers_pool.push_back(server);
}

void Server::after_events(std::set<Connection*>&)
{
    if (this->closed()) {
        this->_proxy->update_slot_map();
    }
}

std::string Server::str() const
{
    return fmt::format("Server({}@{})[{}]", this->fd,
                       static_cast<void const*>(this), this->addr.str());
}

void Server::close_conn()
{
    if (!this->closed()) {
        LOG(INFO) << "Close " << this->str();
        this->close();
        this->_buffer.clear();

        for (util::sref<DataCommand> c: this->_commands) {
            this->_proxy->retry_move_ask_command_later(c);
        }
        this->_commands.clear();

        for (util::sref<DataCommand> c: this->_ready_commands) {
            if (c.nul()) {
                continue;
            }
            this->_proxy->retry_move_ask_command_later(c);
        }
        this->_ready_commands.clear();

        for (ProxyConnection* conn: this->attached_long_connections) {
            this->_proxy->inactivate_long_conn(conn);
        }
        this->attached_long_connections.clear();

        ::remove_entry(this);
    }
}

std::map<util::Address, Server*>::iterator Server::addr_begin()
{
    return ::servers_map.begin();
}

std::map<util::Address, Server*>::iterator Server::addr_end()
{
    return ::servers_map.end();
}

static std::function<void(int, std::vector<util::sref<DataCommand>>&)> on_server_connected(
    [](int, std::vector<util::sref<DataCommand>>&) {});

void Server::_reconnect(util::Address const& addr, Proxy* p)
{
    this->fd = fctl::new_stream_socket();
    this->_proxy = p;
    this->addr = addr;

    fctl::set_nonblocking(this->fd);
    fctl::connect_fd(addr.host, addr.port, this->fd);
    LOG(INFO) << "Open " << this->str();
    p->poll_add_rw(this);
    ::on_server_connected(this->fd, this->_ready_commands);
}

Server* Server::_alloc_server(util::Address const& addr, Proxy* p)
{
    if (servers_pool.empty()) {
        for (int i = 0; i < 8; ++i) {
            servers_pool.push_back(new Server);
            LOG(DEBUG) << "Allocate Server: " << servers_pool.back();
        }
    }
    Server* s = servers_pool.back();
    try {
        s->_reconnect(addr, p);
    } catch (IOErrorBase& e) {
        LOG(ERROR) << "Fail to open server " << s->str() << " because " << e.what();
        s->close_conn();
    }
    servers_pool.pop_back();
    return s;
}

Server* Server::get_server(util::Address addr, Proxy* p)
{
    auto i = servers_map.find(addr);
    if (i == servers_map.end() || i->second->closed()) {
        Server* s = Server::_alloc_server(addr, p);
        servers_map.insert(std::make_pair(std::move(addr), s));
        return s;
    }
    return i->second;
}

static Buffer const READ_ONLY_CMD(Buffer::from_string("READONLY\r\n"));

void Server::send_readonly_for_each_conn()
{
    ::on_server_connected =
        [](int fd, std::vector<util::sref<DataCommand>>& cmds)
        {
            READ_ONLY_CMD.write(fd);
            cmds.push_back(util::sref<DataCommand>(nullptr));
        };
}


text:
package v1

import (
	"github.com/GoogleCloudPlatform/kubernetes/pkg/api"
)

func init() {
	api.Scheme.AddKnownTypes("v1",
		&ClusterNetwork{},
		&ClusterNetworkList{},
		&HostSubnet{},
		&HostSubnetList{},
	)
}

func (*ClusterNetwork) IsAnAPIObject()     {}
func (*ClusterNetworkList) IsAnAPIObject() {}
func (*HostSubnet) IsAnAPIObject()         {}
func (*HostSubnetList) IsAnAPIObject()     {}


text:
"""Create a CL to update the SKP version."""

import argparse
import os
import subprocess
import sys
import urllib2

import git_utils

COMMIT_MSG = '''Update SKP version

Automatic commit by the RecreateSKPs bot.

TBR=rmistry@google.com
NO_MERGE_BUILDS
'''
SKIA_REPO = 'https://skia.googlesource.com/skia.git'

def main(target_dir):
  # We're going to sync a new, clean Skia checkout to upload the CL to update
  # the SKPs. However, we want to use the scripts from the current checkout,
  # in order to facilitate running this as a try job.
  infrabots_dir = os.path.dirname(os.path.realpath(__file__))
  skp_dir = os.path.join(infrabots_dir, 'assets', 'skp')
  upload_py = os.path.join(skp_dir, 'upload.py')

  with git_utils.NewGitCheckout(repository=SKIA_REPO):
    # First verify that there are no gen_tasks diffs.
    tmp_infrabots_dir = os.path.join(os.getcwd(), 'infra', 'bots')
    tmp_gen_tasks = os.path.join(tmp_infrabots_dir, 'gen_tasks.go')
    try:
      subprocess.check_call(['go', 'run', tmp_gen_tasks, '--test'])
    except subprocess.CalledProcessError as e:
      print >> sys.stderr, (
         'gen_tasks.go failed, not uploading SKP update:\n\n%s' % e.output)
      sys.exit(1)

    # Upload the new version, land the update CL as the recreate-skps user.
    with git_utils.GitBranch(branch_name='update_skp_version',
                             commit_msg=COMMIT_MSG,
                             commit_queue=True):
      upload_cmd = ['python', upload_py, '-t', target_dir]
      if args.chromium_path:
        chromium_revision = subprocess.check_output(
            ['git', 'rev-parse', 'HEAD'], cwd=args.chromium_path).rstrip()
        upload_cmd.extend([
            '--extra_tags', 'chromium_revision:%s' % chromium_revision])
      subprocess.check_call(upload_cmd)
      # We used upload.py from the repo that this script lives in, NOT the temp
      # repo we've created. Therefore, the VERSION file was written in that repo
      # so we need to copy it to the temp repo in order to commit it.
      src = os.path.join(skp_dir, 'VERSION')
      dst = os.path.join(
          os.getcwd(), 'infra', 'bots', 'assets', 'skp', 'VERSION')
      subprocess.check_call(['cp', src, dst])
      subprocess.check_call(['go', 'run', tmp_gen_tasks])
      subprocess.check_call([
          'git', 'add', os.path.join('infra', 'bots', 'tasks.json')])

if '__main__' == __name__:
  parser = argparse.ArgumentParser()
  parser.add_argument("--target_dir")
  parser.add_argument("--chromium_path")
  args = parser.parse_args()
  main(args.target_dir)


text:
name             "mongo_test"
maintainer       "YOUR_NAME"
maintainer_email "YOUR_EMAIL"
license          "All rights reserved"
description      "Installs/Configures mongo_test"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version          "0.1.0"


text:
parser_params::parser_params() :
    m_dump_goal_as_smt(false),
    m_display_error_for_vs(false) {
}

void parser_params::register_params(ini_params & p) {
    p.register_bool_param("DUMP_GOAL_AS_SMT", m_dump_goal_as_smt, "write goal back to output in SMT format");
    p.register_bool_param("DISPLAY_ERROR_FOR_VISUAL_STUDIO", m_display_error_for_vs, "display error messages in Visual Studio format");
}


text:
<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
  <title>client-uuid Test Runner</title>

  <script src="../../webcomponentsjs/webcomponents-lite.js"></script>
  <script src="../../web-component-tester/browser.js"></script>
</head>
<body>
  <script>
    WCT.loadSuites(['client-uuid-basic.html']);
  </script>
</body>
</html>


text:
package cn.edu.siso.rlxapf.bean;

import cn.edu.siso.rlxapf.config.TCPConfig;
import cn.edu.siso.rlxapf.util.CRCUtil;

/**
 * Created by jason on 2017-7-26.
 * 实时数据解析,使用parse函数传入数据,getXXXX方法获取解析值
 */

public class RealTimeDatasBean {
    private double systemAVoltage; //系统A相电压
    private double systemBVoltage; //系统B相电压
    private double systemCVoltage; //系统C相电压
    private int systemACurrent; //系统A相电流
    private int systemBCurrent; //系统B相电流
    private int systemCCurrent; //系统C相电流
    private int loadACurrent; //负载A相电流
    private int loadBCurrent; //负载B相电流
    private int loadCCurrent; //负载C相电流
    private double compensationACurrent; //补偿A相电流
    private double compensationBCurrent; //补偿B相电流
    private double compensationCCurrent; //补偿C相电流
    private double voltageATotalDistortionRate; //A相电压总畸变率
    private double voltageBTotalDistortionRate; //B相电压总畸变率
    private double voltageCTotalDistortionRate; //C相电压总畸变率
    private double systemCurrentATotalDistortionRate; //A相系统电流总畸变率
    private double systemCurrentBTotalDistortionRate; //B相系统电流总畸变率
    private double systemCurrentCTotalDistortionRate; //C相系统电流总畸变率
    private double loadCurrentATotalDistortionRate; //A相负载电流总畸变率
    private double loadCurrentBTotalDistortionRate; //B相负载电流总畸变率
    private double loadCurrentCTotalDistortionRate; //C相负载电流总畸变率
    private double systemPowerFactor; //系统功率因数
    private double loadPowerFactor; //负载功率因数
    private double systemCurrentUnbalanceDegree; //系统电流不平衡度
    private double loadCurrentUnbalanceDegree; //负载电流不平衡度
    private int tempratureIGBT; //IGBT 温度
    private int stateAPF; //APF 运行状态
    private int voltageDC1; //直流电压 1
    private int voltageDC2; //直流电压 2
    private String version; //软件版本号

    /**
     * 低位高字节,高位低字节
     * @param b1
     * @param b2
     * @return
     */
    private int bytes2int(byte b1 , byte b2){
        return (int)((b1&0xff)<<8)|(b2 & 0xff);
    }

    /**
     *
     * @param bytes 网络数据
     * @return -1 CRC校验错误;  -2长度解析出错; 0解析成功
     */
    public int parse(byte[] bytes){

        if(bytes == null || bytes.length != 65 || bytes[2] != 60)//指定参数一次读出的长度
            return -2;

        if(!CRCUtil.decode(bytes))
            return -1;

        int startLoc = 3;

        systemAVoltage = (double)bytes2int(bytes[startLoc],bytes[startLoc+1]) * TCPConfig.ZPO;
        systemBVoltage = (double)bytes2int(bytes[startLoc+2],bytes[startLoc+3]) * TCPConfig.ZPO;
        systemCVoltage = (double)bytes2int(bytes[startLoc+4],bytes[startLoc+5]) * TCPConfig.ZPO;
        systemACurrent = bytes2int(bytes[startLoc+6],bytes[startLoc+7]);
        systemBCurrent = bytes2int(bytes[startLoc+8],bytes[startLoc+9]);
        systemCCurrent = bytes2int(bytes[startLoc+10],bytes[startLoc+11]);
        loadACurrent = bytes2int(bytes[startLoc+12],bytes[startLoc+13]);
        loadBCurrent = bytes2int(bytes[startLoc+14],bytes[startLoc+15]);
        loadCCurrent = bytes2int(bytes[startLoc+16],bytes[startLoc+17]);
        compensationACurrent = (double)bytes2int(bytes[startLoc+18],bytes[startLoc+19]) * TCPConfig.ZPO;
        compensationBCurrent = (double)bytes2int(bytes[startLoc+20],bytes[startLoc+21]) * TCPConfig.ZPO;
        compensationCCurrent = (double)bytes2int(bytes[startLoc+22],bytes[startLoc+23]) * TCPConfig.ZPO;
        voltageATotalDistortionRate = (double)bytes2int(bytes[startLoc+24],bytes[startLoc+25]) * TCPConfig.ZPZZO;
        voltageBTotalDistortionRate = (double)bytes2int(bytes[startLoc+26],bytes[startLoc+27]) * TCPConfig.ZPZZO;
        voltageCTotalDistortionRate = (double)bytes2int(bytes[startLoc+28],bytes[startLoc+29]) * TCPConfig.ZPZZO;
        systemCurrentATotalDistortionRate = (double)bytes2int(bytes[startLoc+30],bytes[startLoc+31]) * TCPConfig.ZPZZO;
        systemCurrentBTotalDistortionRate = (double)bytes2int(bytes[startLoc+32],bytes[startLoc+33]) * TCPConfig.ZPZZO;
        systemCurrentCTotalDistortionRate = (double)bytes2int(bytes[startLoc+34],bytes[startLoc+35]) * TCPConfig.ZPZZO;
        loadCurrentATotalDistortionRate = (double)bytes2int(bytes[startLoc+36],bytes[startLoc+37]) * TCPConfig.ZPZZO;
        loadCurrentBTotalDistortionRate = (double)bytes2int(bytes[startLoc+38],bytes[startLoc+39]) * TCPConfig.ZPZZO;
        loadCurrentCTotalDistortionRate = (double)bytes2int(bytes[startLoc+40],bytes[startLoc+41]) * TCPConfig.ZPZZO;
        systemPowerFactor = (double)bytes2int(bytes[startLoc+42],bytes[startLoc+43]) * TCPConfig.ZPZZO;
        loadPowerFactor = (double)bytes2int(bytes[startLoc+44],bytes[startLoc+45]) * TCPConfig.ZPZZO;
        systemCurrentUnbalanceDegree = (double)bytes2int(bytes[startLoc+46],bytes[startLoc+47]) * TCPConfig.ZPO;
        loadCurrentUnbalanceDegree = (double)bytes2int(bytes[startLoc+48],bytes[startLoc+49]) * TCPConfig.ZPO;
        tempratureIGBT = bytes2int(bytes[startLoc+50],bytes[startLoc+51]);
        stateAPF = bytes2int(bytes[startLoc+52],bytes[startLoc+53]);
        voltageDC1 = bytes2int(bytes[startLoc+54],bytes[startLoc+55]);
        voltageDC2 = bytes2int(bytes[startLoc+56],bytes[startLoc+57]);
        int versionH = bytes[startLoc+59];
        int versionL = bytes[startLoc+58];
        version = ""+ versionH + "." + versionL;
        return 0;
    }

    public void setSystemAVoltage(double systemAVoltage) {
        this.systemAVoltage = systemAVoltage;
    }

    public void setSystemBVoltage(double systemBVoltage) {
        this.systemBVoltage = systemBVoltage;
    }

    public void setSystemCVoltage(double systemCVoltage) {
        this.systemCVoltage = systemCVoltage;
    }

    public void setSystemACurrent(int systemACurrent) {
        this.systemACurrent = systemACurrent;
    }

    public void setSystemBCurrent(int systemBCurrent) {
        this.systemBCurrent = systemBCurrent;
    }

    public void setSystemCCurrent(int systemCCurrent) {
        this.systemCCurrent = systemCCurrent;
    }

    public void setLoadACurrent(int loadACurrent) {
        this.loadACurrent = loadACurrent;
    }

    public void setLoadBCurrent(int loadBCurrent) {
        this.loadBCurrent = loadBCurrent;
    }

    public void setLoadCCurrent(int loadCCurrent) {
        this.loadCCurrent = loadCCurrent;
    }

    public void setCompensationACurrent(double compensationACurrent) {
        this.compensationACurrent = compensationACurrent;
    }

    public void setCompensationBCurrent(double compensationBCurrent) {
        this.compensationBCurrent = compensationBCurrent;
    }

    public void setCompensationCCurrent(double compensationCCurrent) {
        this.compensationCCurrent = compensationCCurrent;
    }

    public void setVoltageATotalDistortionRate(double voltageATotalDistortionRate) {
        this.voltageATotalDistortionRate = voltageATotalDistortionRate;
    }

    public void setVoltageBTotalDistortionRate(double voltageBTotalDistortionRate) {
        this.voltageBTotalDistortionRate = voltageBTotalDistortionRate;
    }

    public void setVoltageCTotalDistortionRate(double voltageCTotalDistortionRate) {
        this.voltageCTotalDistortionRate = voltageCTotalDistortionRate;
    }

    public void setSystemCurrentATotalDistortionRate(double systemCurrentATotalDistortionRate) {
        this.systemCurrentATotalDistortionRate = systemCurrentATotalDistortionRate;
    }

    public void setSystemCurrentBTotalDistortionRate(double systemCurrentBTotalDistortionRate) {
        this.systemCurrentBTotalDistortionRate = systemCurrentBTotalDistortionRate;
    }

    public void setSystemCurrentCTotalDistortionRate(double systemCurrentCTotalDistortionRate) {
        this.systemCurrentCTotalDistortionRate = systemCurrentCTotalDistortionRate;
    }

    public void setLoadCurrentATotalDistortionRate(double loadCurrentATotalDistortionRate) {
        this.loadCurrentATotalDistortionRate = loadCurrentATotalDistortionRate;
    }

    public void setLoadCurrentBTotalDistortionRate(double loadCurrentBTotalDistortionRate) {
        this.loadCurrentBTotalDistortionRate = loadCurrentBTotalDistortionRate;
    }

    public void setLoadCurrentCTotalDistortionRate(double loadCurrentCTotalDistortionRate) {
        this.loadCurrentCTotalDistortionRate = loadCurrentCTotalDistortionRate;
    }

    public void setSystemPowerFactor(double systemPowerFactor) {
        this.systemPowerFactor = systemPowerFactor;
    }

    public void setLoadPowerFactor(double loadPowerFactor) {
        this.loadPowerFactor = loadPowerFactor;
    }

    public void setSystemCurrentUnbalanceDegree(double systemCurrentUnbalanceDegree) {
        this.systemCurrentUnbalanceDegree = systemCurrentUnbalanceDegree;
    }

    public void setLoadCurrentUnbalanceDegree(double loadCurrentUnbalanceDegree) {
        this.loadCurrentUnbalanceDegree = loadCurrentUnbalanceDegree;
    }

    public void setTempratureIGBT(int tempratureIGBT) {
        this.tempratureIGBT = tempratureIGBT;
    }

    public void setStateAPF(int stateAPF) {
        this.stateAPF = stateAPF;
    }

    public void setVoltageDC1(int voltageDC1) {
        this.voltageDC1 = voltageDC1;
    }

    public void setVoltageDC2(int voltageDC2) {
        this.voltageDC2 = voltageDC2;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public double getSystemAVoltage() {
        return systemAVoltage;
    }

    public double getSystemBVoltage() {
        return systemBVoltage;
    }

    public double getSystemCVoltage() {
        return systemCVoltage;
    }

    public int getSystemACurrent() {
        return systemACurrent;
    }

    public int getSystemBCurrent() {
        return systemBCurrent;
    }

    public int getSystemCCurrent() {
        return systemCCurrent;
    }

    public int getLoadACurrent() {
        return loadACurrent;
    }

    public int getLoadBCurrent() {
        return loadBCurrent;
    }

    public int getLoadCCurrent() {
        return loadCCurrent;
    }

    public double getCompensationACurrent() {
        return compensationACurrent;
    }

    public double getCompensationBCurrent() {
        return compensationBCurrent;
    }

    public double getCompensationCCurrent() {
        return compensationCCurrent;
    }

    public double getVoltageATotalDistortionRate() {
        return voltageATotalDistortionRate;
    }

    public double getVoltageBTotalDistortionRate() {
        return voltageBTotalDistortionRate;
    }

    public double getVoltageCTotalDistortionRate() {
        return voltageCTotalDistortionRate;
    }

    public double getSystemCurrentATotalDistortionRate() {
        return systemCurrentATotalDistortionRate;
    }

    public double getSystemCurrentBTotalDistortionRate() {
        return systemCurrentBTotalDistortionRate;
    }

    public double getSystemCurrentCTotalDistortionRate() {
        return systemCurrentCTotalDistortionRate;
    }

    public double getLoadCurrentATotalDistortionRate() {
        return loadCurrentATotalDistortionRate;
    }

    public double getLoadCurrentBTotalDistortionRate() {
        return loadCurrentBTotalDistortionRate;
    }

    public double getLoadCurrentCTotalDistortionRate() {
        return loadCurrentCTotalDistortionRate;
    }

    public double getSystemPowerFactor() {
        return systemPowerFactor;
    }

    public double getLoadPowerFactor() {
        return loadPowerFactor;
    }

    public double getSystemCurrentUnbalanceDegree() {
        return systemCurrentUnbalanceDegree;
    }

    public double getLoadCurrentUnbalanceDegree() {
        return loadCurrentUnbalanceDegree;
    }

    public int getTempratureIGBT() {
        return tempratureIGBT;
    }

    public int getStateAPF() {
        return stateAPF;
    }

    public int getVoltageDC1() {
        return voltageDC1;
    }

    public int getVoltageDC2() {
        return voltageDC2;
    }

    public String getVersion() {
        return version;
    }
}


text:
package org.asynchttpclient.request.body;

import static org.asynchttpclient.test.TestUtils.LARGE_IMAGE_BYTES;
import static org.asynchttpclient.test.TestUtils.LARGE_IMAGE_PUBLISHER;
import static org.testng.Assert.assertEquals;

import java.nio.ByteBuffer;
import java.util.concurrent.ExecutionException;

import org.asynchttpclient.AbstractBasicTest;
import org.asynchttpclient.AsyncHttpClient;
import org.asynchttpclient.AsyncHttpClientConfig;
import org.asynchttpclient.BoundRequestBuilder;
import org.asynchttpclient.DefaultAsyncHttpClient;
import org.asynchttpclient.Response;
import org.reactivestreams.Publisher;
import org.testng.annotations.Test;

import rx.Observable;
import rx.RxReactiveStreams;

public class ReactiveStreamsTest extends AbstractBasicTest {

    @Test(groups = { "standalone", "default_provider" }, enabled = true)
    public void testStreamingPutImage() throws Exception {
        try (AsyncHttpClient client = new DefaultAsyncHttpClient(new AsyncHttpClientConfig.Builder().setRequestTimeout(100 * 6000).build())) {
            Response response = client.preparePut(getTargetUrl()).setBody(LARGE_IMAGE_PUBLISHER).execute().get();
            assertEquals(response.getStatusCode(), 200);
            assertEquals(response.getResponseBodyAsBytes(), LARGE_IMAGE_BYTES);
        }
    }

    @Test(groups = { "standalone", "default_provider" }, enabled = true)
    public void testConnectionDoesNotGetClosed() throws Exception { // test that we can stream the same request multiple times
        try (AsyncHttpClient client = new DefaultAsyncHttpClient(new AsyncHttpClientConfig.Builder().setRequestTimeout(100 * 6000).build())) {
            BoundRequestBuilder requestBuilder = client.preparePut(getTargetUrl()).setBody(LARGE_IMAGE_PUBLISHER);
            Response response = requestBuilder.execute().get();
            assertEquals(response.getStatusCode(), 200);
            assertEquals(response.getResponseBodyAsBytes(), LARGE_IMAGE_BYTES);

            response = requestBuilder.execute().get();
            assertEquals(response.getStatusCode(), 200);
            assertEquals(response.getResponseBodyAsBytes(), LARGE_IMAGE_BYTES);
        }
    }

    @Test(groups = { "standalone", "default_provider" }, enabled = true, expectedExceptions = ExecutionException.class)
    public void testFailingStream() throws Exception {
        try (AsyncHttpClient client = new DefaultAsyncHttpClient(new AsyncHttpClientConfig.Builder().setRequestTimeout(100 * 6000).build())) {
            Observable<ByteBuffer> failingObservable = Observable.error(new FailedStream());
            Publisher<ByteBuffer> failingPublisher = RxReactiveStreams.toPublisher(failingObservable);

            client.preparePut(getTargetUrl()).setBody(failingPublisher).execute().get();
        }
    }

    @SuppressWarnings("serial")
    private class FailedStream extends RuntimeException {}
}


text:
//MooCanvas, My Object Oriented Canvas Element. Copyright (c) 2007 Olmo Maldonado, <http://ibolmo.no-ip.info/sandbox/moocanvas/>, MIT Style License.
/*
Script: Canvas.js
	Contains the <Canvas> class.

Dependencies:
	MooTools, <http://mootools.net/>
		Element, and its dependencies

Author:
	Olmo Maldonado, <http://olmo-maldonado.com/>

Credits:
	Lightly based from Ralph Sommerer's work: <http://blogs.msdn.com/sompost/archive/2006/02/22/536967.aspx>
	Moderately based from excanvas: <http://excanvas.sourceforge.net/>
	Great thanks to Inviz, <http://inviz.ru/>, for his optimizing help.

License:
	MIT License, <http://en.wikipedia.org/wiki/MIT_License>
*/

/*
Class: Canvas
	Creates the element <canvas> and extends the element with getContext if not defined.

Arguments:
	id - The ID of the canvas element
	props - Optional properties for the canvas element, which also gets passed to the new Element

Example:
	> var cv = new Canvas('cv');
	> var ctx = cv.getContext('2d');
	>
	> $(document.body).adopt(cv);
*/
var MooCanvas = new Class({

	initialize: function(id, props) {
		var el;
		if($type(id) == 'string') {
			props = $merge({width: 300, height: 150}, props, {'id': id});
			el = new Element('canvas', props);
			if(!el.getContext) {
				if(!CanvasRenderingContext2D.cssFixed) {
					document.createStyleSheet().cssText =
						'canvas{display:inline-block;overflow:hidden;text-align:left;cursor:default;}' +
						'v\\:*{behavior:url(#default#VML)}' +
						'o\\:*{behavior:url(#default#VML)}';
					CanvasRenderingContext2D.cssFixed = true;
				}

				el.set({
					styles: {
						width: props.width,
						height: props.height,
						display: 'inline-block',
						overflow: 'hidden'
					},

					getContext: function() {
						this.context = this.context || new CanvasRenderingContext2D(el);
						return this.context;
					}
				});

			}
		}

		return el;
	}

});

/*
Class: CanvasRenderingContext2D
	Context2D class with all the Context methods specified by the WHATWG, <http://www.whatwg.org/specs/web-apps/current-work/#the-canvas>

Arguments:
	el - Element requesting the context2D
*/
var CanvasRenderingContext2D = new Class({

	initialize: function(el) {
		this.parent = el;
		this.fragment = document.createDocumentFragment();
		this.element = new Element('div', {
			styles: {
				width: el.clientWidth || el.width,
				height: el.clientHeight || el.height,
				overflow: 'hidden',
				position: 'absolute'
			}
		});
		this.fragment.appendChild(this.element);

		this.m = [
			[1, 0, 0],
			[0, 1, 0],
			[0, 0, 1]
		];
		this.rot = 0;
		this.state = [];
		this.path = [];
		this.delay = 30;
		this.max = 10;
		this.i = 0;

		// from excanvas, subpixel rendering.
		this.Z = 10;
		this.Z2 = this.Z / 2;
		this.arcScaleX = 1;
		this.arcScaleY = 1;
		this.currentX = 0;
		this.currentY = 0;

		this.miterLimit = this.Z * 1;
	},

	lineWidth: 1,
	strokeStyle: '#000',
	fillStyle: '#fff',
	globalAlpha: 1,
	globalCompositeOperation: 'source-over',
	lineCap: 'butt',
	lineJoin: 'miter',
	shadowBlur: 0,
	shadowColor: '#000',
	shadowOffsetX: 0,
	shadowOffsetY: 0

});

/*
Script: Path.js

Dependencies:
	Canvas.js

Author:
	Olmo Maldonado, <http://olmo-maldonado.com/>

Credits:
	Lightly based from Ralph Sommerer's work: <http://blogs.msdn.com/sompost/archive/2006/02/22/536967.aspx>
	Moderately based from excanvas: <http://excanvas.sourceforge.net/>
	Great thanks to Inviz, <http://inviz.ru/>, for his optimizing help.

License:
	MIT License, <http://en.wikipedia.org/wiki/MIT_License>
*/

CanvasRenderingContext2D.implement({

	/*
		A path has a list of zero or more subpaths.
		Each subpath consists of a list of one or more points,
		connected by straight or curved lines, and a flag indicating whether
		the subpath is closed or not. A closed subpath is one where the
		last point of the subpath is connected to the first point of
		the subpath by a straight line. Subpaths with fewer than two
		points are ignored when painting the path.
	*/

	/*
	Property:
		Empties the list of subpaths so that the context once again has zero
		subpaths.
	*/
	beginPath: function() {
		this.path = [];
		this.moved = false;
	},

	/*
	Property:
		Creates a new subpath with the specified point as its first
		(and only) point.
	*/
	moveTo: function(x, y) {
		this.path.push('m', this.coord(x, y));
		this.currentX = x;
		this.currentY = y;
		this.moved = true;
	},

	/*
	Property:
		Does nothing if the context has no subpaths.
		Otherwise, marks the last subpath as closed, create a new
		subpath whose first point is the same as the previous
		subpath's first point, and finally add this new subpath to the
		path.
	*/
	closePath: function() {
		this.path.push('x');
	},

	/*
	Property:
		Method must do nothing if the context has no subpaths. Otherwise,
		it must connect the last point in the subpath to the given point
		(x, y) using a straight line, and must then add the given point
		(x, y) to the subpath.
	*/
	lineTo: function(x, y) {
		this.path.push((this.moved ? 'l' : ','), this.coord(x, y));
		this.currentX = x;
		this.currentY = y;
		this.moved = false;
	},

	/*
	Property:
		Method must do nothing if the context has no subpaths. Otherwise,
		it must connect the last point in the subpath to the given point
		(x, y) using a straight line, and must then add the given point
		(x, y) to the subpath.
	*/
	quadraticCurveTo: function(cpx, cpy, x, y) {
		var cx = 2 * cpx,
			cy = 2 * cpy;

		this.bezierCurveTo(
			(cx + this.currentX) / 3,
			(cy + this.currentY) / 3,
			(cx + x) / 3,
			(cy + y) / 3,
			x,
			y
		);
	},

	/*
	Property:
		Method must do nothing if the context has no subpaths. Otherwise,
		it must connect the last point in the subpath to the given point
		(x, y) using a bezier curve with control points (cp1x, cp1y) and
		(cp2x, cp2y). Then, it must add the point (x, y) to the subpath.
	*/
	bezierCurveTo: function(cp0x, cp0y, cp1x, cp1y, x, y) {
		this.path.push(' c ',
			this.coord(cp0x, cp0y), ",",
			this.coord(cp1x, cp1y), ",",
			this.coord(x, y)
		);

		this.currentX = x;
		this.currentY = y;
	},

	/*
	Property:
		Method must do nothing if the context has no subpaths. If the context
		does have a subpath, then the behaviour depends on the arguments and
		the last point in the subpath.

		Let the point (x0, y0) be the last point in the subpath. Let The Arc
		be the shortest arc given by circumference of the circle that has one
		point tangent to the line defined by the points (x0, y0) and (x1, y1),
		another point tangent to the line defined by the points (x1, y1) and
		(x2, y2), and that has radius radius. The points at which this circle
		touches these two lines are called the start and end tangent points
		respectively.

		If the point (x2, y2) is on the line defined by the points (x0, y0)
		and (x1, y1) then the method must do nothing, as no arc would satisfy
		the above constraints.

		Otherwise, the method must connect the point (x0, y0) to the start
		tangent point by a straight line, then connect the start tangent point
		to the end tangent point by The Arc, and finally add the start and end
		tangent points to the subpath.

		Negative or zero values for radius must cause the implementation to
		raise an INDEX_SIZE_ERR exception.
	*/
	arcTo: function(x, y, w, h) {

	},

	/*
	Property:
		Method draws an arc. If the context has any subpaths, then the method
		must add a straight line from the last point in the subpath to the
		start point of the arc. In any case, it must draw the arc between the
		start point of the arc and the end point of the arc, and add the start
		and end points of the arc to the subpath. The arc and its start and
		end points are defined as follows:

		Consider a circle that has its origin at (x, y) and that has radius
		radius. The points at startAngle and endAngle along the circle's
		circumference, measured in radians clockwise from the positive x-axis,
		are the start and end points respectively. The arc is the path along
		the circumference of this circle from the start point to the end point,
		going anti-clockwise if the anticlockwise argument is true, and
		clockwise otherwise.

		Negative or zero values for radius must cause the implementation to
		raise an INDEX_SIZE_ERR exception.
	*/
	arc: function(x, y, rad, a0, a1, cw) {
		if(this.rot === 0) rad *= this.Z;

		var x0 = Math.cos(a0) * rad,
			y0 = Math.sin(a0) * rad,
			x1 = Math.cos(a1) * rad,
			y1 = Math.sin(a1) * rad;

		if (this.rot !== 0) {
			var da = Math.PI / 24;
			this.lineTo(x0 + x, y0 + y);
			if(cw) {
				if (a0 < a1) a0 += 2 * Math.PI;
				while(a0 - da > a1) this.lineTo(x + Math.cos(a0 -= da) * rad, y + Math.sin(a0) * rad);
			} else {
				if (a1 < a0) a1 += 2 * Math.PI;
				while(a0 + da < a1) this.lineTo(x + Math.cos(a0 += da) * rad, y + Math.sin(a0) * rad);
			}
			this.lineTo(x1 + x, y1 + y);
			return;
		}

		if (x0 == x1 && !cw) x0 += 0.125;

		var c = this.getCoords(x, y);
		this.path.push(cw ? 'at ' : 'wa ',
			Math.round(c.x - this.arcScaleX * rad) + ',' + Math.round(c.y - this.arcScaleY * rad),  ' ',
			Math.round(c.x + this.arcScaleX * rad) + ',' + Math.round(c.y + this.arcScaleY * rad),  ' ',
			this.coord(x0 + x - this.Z2, y0 + y - this.Z2), ' ',
			this.coord(x1 + x - this.Z2, y1 + y - this.Z2)
		);
	},

	/*
	Property:
		method must create a new subpath containing just the four points
		(x, y), (x+w, y), (x+w, y+h), (x, y+h), with those four points
		connected by straight lines, and must then mark the subpath as
		closed. It must then create a new subpath with the point (x, y)
		as the only point in the subpath.

		Negative values for w and h must cause the implementation to raise
		an INDEX_SIZE_ERR exception.
	*/
	rect: function(x, y, w, h) {
		this.moveTo(x, y);
		this.lineTo(x + w, y);
		this.lineTo(x + w, y + h);
		this.lineTo(x, y + h);
		this.closePath();
	},

	/*
	Property:
		Method must fill each subpath of the current path in turn, using
		fillStyle, and using the non-zero winding number rule. Open subpaths
		must be implicitly closed when being filled (without affecting the
		actual subpaths).
	*/
	fill: function() {
		this.stroke(true);
	},

	/*
	Property:
		Method must stroke each subpath of the current path in turn, using
		the strokeStyle, lineWidth, lineJoin, and (if appropriate) miterLimit
		attributes.

		Paths, when filled or stroked, must be painted without affecting the
		current path, and must be subject to transformations, shadow effects,
		global alpha, clipping paths, and global composition operators.

		The transformation is applied to the path when it is drawn, not when
		the path is constructed. Thus, a single path can be constructed and
		then drawn according to different transformations without recreating
		the path.
	*/

	stroke: function(fill) {
		if(!this.path.length) return;
		var a, color;
		if (fill) {
			a = [1000, '<v:fill ' + this.processColorObject(this.fillStyle) + '></v:fill>'];
		} else {
			color = this.processColor(this.strokeStyle);
			a = [10,
			'<v:stroke ' +
				'endcap="' + ((this.lineCap == 'butt') ? 'flat' : this.lineCap) + '" ' +
				'joinstyle="' + this.lineJoin + '" ' +
				'color="' + color.color + '" ' +
				'opacity="' + color.opacity + '"' +
			'/>'];
		}
		this.element.insertAdjacentHTML('beforeEnd',
			'<v:shape ' +
				'path="' + this.path.join('') + 'e" ' +
				'stroked="' + !fill + '" ' +
				(!fill ? ('strokeweight="' + 0.8 * this.lineWidth * this.m[0][0] + '" ') : '') +
				'filled="' + !!fill + '" ' +
				'coordsize="' + this.Z * a[0] + ',' +  this.Z * a[0] + '" ' +
				'style="width:' + a[0] + 'px; height:' + a[0] + 'px; position: absolute;">' +
				a[1] +
			'</v:shape>'
		);

		this.parent.appendChild(this.fragment);

		if(fill && this.fillStyle.img) this.element.getLast().fill.alignshape = false; // not sure why this has to be called explicitly

		this.path = [];
	},

	/*
	Property:
		Method must create a new clipping path by calculating the intersection
		of the current clipping path and the area described by the current path
		(after applying the current transformation), using the non-zero winding
		number rule. Open subpaths must be implicitly closed when computing the
		clipping path, without affecting the actual subpaths.

		When the context is created, the initial clipping path is the rectangle
		with the top left corner at (0,0) and the width and height of the
		coordinate space.
	*/
	clip: function() {

	},

	/*
	Property:
		Method must return true if the point given by the x and y coordinates
		passed to the method, when treated as coordinates in the canvas'
		coordinate space unaffected by the current transformation, is within
		the area of the canvas that is inside the current path; and must
		return false otherwise.
	*/
	isPointInPath: function(x, y) {

	},

	processColor: function(col) { //path
		var a = this.globalAlpha;
		if (col.substr(0, 3) == 'rgb') {
			if (col.charAt(3) == "a") {
				a*= col.match(/([\d.]*)\)$/)[1];
			}

			col = col.rgbToHex();
		}
		return {
			color: col,
			opacity: a
		};
	},

	/*
		If a gradient has no stops defined, then the gradient must be treated as a
		solid transparent black. Gradients are, naturally, only painted where the
		stroking or filling effect requires that they be drawn.
	*/
	processColorObject: function(obj) {
		var ret = '', col;
		if(obj.addColorStop) {
			ret += ((obj.r0) ? (
				'type="gradientradial" ' +
				'focusposition="0.2, 0.2" ' +
				'focussize="0.2, 0.2" '
			) : (
				'type="gradient" ' +
				'focus="0" ' +
				'angle="' + (180 + (180 * obj.angle(obj.x0, obj.y0, obj.x1, obj.y1) / Math.PI)) + '" '
			)) +
				'color="' + obj.col0.color + '" ' +
				'opacity="' + obj.col0.opacity * 100 + '%" ' +
				'color2="' + obj.col1.color + '" ' +
				'o:opacity2="' + obj.col1.opacity * 100 + '%" ' +
				'colors="';
			if(obj.stops) {
				for (var i = 0, l = obj.stops.length; i < l; i++) {
					ret += Math.round(100 * obj.stops[i][0]) + '% ' + obj.stops[i][1];
				}
			}
			ret +=
				'" ';
		} else if(obj.img) { //pattern
			ret +=
				'type="tile" ' +
				'src="' + obj.img.src + '" ';
		} else {
			col = this.processColor(obj);
			ret +=
				'color="' + col.color + '" ' +
				'opacity="' + col.opacity + '" ';
		}

		return ret;
	},

	getCoords: function(x, y) {
		var m = this.m;
		return {
			x: this.Z * (x * m[0][0] + y * m[1][0] + m[2][0]) - this.Z2,
			y: this.Z * (x * m[0][1] + y * m[1][1] + m[2][1]) - this.Z2
		};
	},

	coord: function(x, y) {
		var m = this.m;
		return  [
			 Math.round(this.Z * (x * m[0][0] + y * m[1][0] + m[2][0]) - this.Z2), ',',
			 Math.round(this.Z * (x * m[0][1] + y * m[1][1] + m[2][1]) - this.Z2)
		].join('');
	}
});
/*
Script: Rects.js

Dependencies:
	Canvas.js, Path.js

Author:
	Olmo Maldonado, <http://olmo-maldonado.com/>

Credits:
	Lightly based from Ralph Sommerer's work: <http://blogs.msdn.com/sompost/archive/2006/02/22/536967.aspx>
	Moderately based from excanvas: <http://excanvas.sourceforge.net/>
	Great thanks to Inviz, <http://inviz.ru/>, for his optimizing help.

License:
	MIT License, <http://en.wikipedia.org/wiki/MIT_License>
*/

CanvasRenderingContext2D.implement({

	/*
	Property: clearRect
		Clears the pixels in the specified rectangle.
		If height or width are zero has no effect.

		If no arguments, clears all of the canvas

		Currently, clearRect clears all of the canvas.
	 */
	clearRect: function(x, y, w, h) {
		//if((x <= 0) && (y <= 0) && ( x + w >= this.element.width) && (y + h >= this.element.height)){
			this.element.innerHTML = '';
		//} else {
		//	var f0 = this.fillStyle;
		//	this.fillStyle = '#fff';
		//	this.fillRect(x, y, w, h);
		//	this.fillStyle = f0;
		//}
	},

	/*
	Property: fillRect
		Paints the specified rectangle using fillStyle.
		If height or width are zero, this method has no effect.
	 */
	fillRect: function(x, y, w, h) {
		this.rect(x, y, w, h);
		this.fill();
	},

	/*
		Draws a rectangular outline of the specified size.
		If width or height are zero: ??
	 */
	strokeRect: function(x, y, w, h) {
		this.rect(x, y, w, h);
		this.stroke();
	}

});
/*
Script: Transform.js

Dependencies:
	Canvas.js

Author:
	Olmo Maldonado, <http://olmo-maldonado.com/>

Credits:
	Lightly based from Ralph Sommerer's work: <http://blogs.msdn.com/sompost/archive/2006/02/22/536967.aspx>
	Moderately based from excanvas: <http://excanvas.sourceforge.net/>
	Great thanks to Inviz, <http://inviz.ru/>, for his optimizing help.

License:
	MIT License, <http://en.wikipedia.org/wiki/MIT_License>
*/

CanvasRenderingContext2D.implement({
	/*
		The transformation matrix is applied to all drawing operations prior
		to their being rendered. It is also applied when creating the clip region.
		*  The transformations must be performed in reverse order. For instance,
		if a scale transformation that doubles the width is applied, followed
		by a rotation transformation that rotates drawing operations by a
		quarter turn, and a rectangle twice as wide as it is tall is then
		drawn on the canvas, the actual result will be a square.
	*/

  	/*
  	Property: scale
		Method must add the scaling transformation described by the arguments
		to the transformation matrix. The x argument represents the scale factor
		in the horizontal direction and the y argument represents the scale
		factor in the vertical direction. The factors are multiples.
	*/
	scale: function(x, y) {
		this.arcScaleX *= x;
		this.arcScaleY *= y;

		this.matMult([
			[x, 0, 0],
			[0, y, 0],
			[0, 0, 1]
		]);
	},

  	/*
  	Property: rotate
		Method must add the rotation transformation described by the argument
		to the transformation matrix. The angle argument represents a clockwise
		rotation angle expressed in radians.
	*/
	rotate: function(ang) {
		this.rot += ang;
		var c = Math.cos(ang),
			s = Math.sin(ang);

		this.matMult([
			[ c, s, 0],
			[-s, c, 0],
			[ 0, 0, 1]
		]);
	},

  	/*
  	Property: translate
		Method must add the translation transformation described by the arguments
		to the transformation matrix. The x argument represents the translation
		distance in the horizontal direction and the y argument represents the
		translation distance in the vertical direction. The arguments are in
		coordinate space units.
	*/
	translate: function(x, y) {
		this.matMult([
			[1, 0, 0],
			[0, 1, 0],
			[x, y, 1]
		]);
	},

  	/*
  	Property: transform
		Method must multiply the current transformation matrix with the matrix described
		by the inputs.
	*/
 	transform: function(m11, m12, m21, m22, dx, dy) {
		this.matMult([
			[m11, m21, dx],
			[m12, m22, dy],
			[  0,   0,  1]
		]);
	},

  	/*
  	Property: setTransform
  		Method must reset the current transform to the identity matrix, and then invoke
  		the transform method with the same arguments.
  	*/
	setTransform: function(m11, m12, m21, m22, dx, dy) {
		this.m = [
			[1, 0, 0],
			[0, 1, 0],
			[0, 0, 1]
		];

		this.transform(m11, m12, m21, m22, dx, dy);
	},

	/*
		Property: matMult
			Method to multiply 3x3 matrice. Currently takes input and multiplies against
			the transform matrix and saves the result to the transform matrix.

			This is an optimized multiplication method. Will only multiply if the input
			value is not zero. Thus, minimizing multiplications and additions.
	*/
	matMult: function(b) {
		var m = this.m,
			o = [
				[0, 0, 0],
				[0, 0, 0],
				[0, 0, 0]
			];

		for(var i = 0; i < 3; i++) {
			if(b[0][i] !== 0) this.sum(o[0], this.mult(b[0][i], m[i]));
			if(b[1][i] !== 0) this.sum(o[1], this.mult(b[1][i], m[i]));
			if(b[2][i] !== 0) this.sum(o[2], this.mult(b[2][i], m[i]));
		}

		this.m = [o[0], o[1], o[2]];
	},

	mult: function(x, y) {
		return [x * y[0], x * y[1], x * y[2]];
	},

	sum: function(o, v) {
		o[0] += v[0];
		o[1] += v[1];
		o[2] += v[2];
	}
});
/*
Script: Image.js

Dependencies:
	Canvas.js

Author:
	Olmo Maldonado, <http://olmo-maldonado.com/>

Credits:
	Lightly based from Ralph Sommerer's work: <http://blogs.msdn.com/sompost/archive/2006/02/22/536967.aspx>
	Moderately based from excanvas: <http://excanvas.sourceforge.net/>
	Great thanks to Inviz, <http://inviz.ru/>, for his optimizing help.

License:
	MIT License, <http://en.wikipedia.org/wiki/MIT_License>
*/

CanvasRenderingContext2D.implement({
	/*
	Property: drawImage
		This method is overloaded with three variants: drawImage(image, dx, dy),
		drawImage(image, dx, dy, dw, dh), and drawImage(image, sx, sy, sw, sh,
		dx, dy, dw, dh). (Actually it is overloaded with six; each of those three
		can take either an HTMLImageElement or an HTMLCanvasElement for the image
		argument.) If not specified, the dw and dh arguments default to the values
		of sw and sh, interpreted such that one CSS pixel in the image is treated
		as one unit in the canvas coordinate space. If the sx, sy, sw, and sh
		arguments are omitted, they default to 0, 0, the image's intrinsic width
		in image pixels, and the image's intrinsic height in image pixels,
		respectively.

		If the image is of the wrong type, the implementation must raise a
		TYPE_MISMATCH_ERR exception. If one of the sy, sw, sw, and sh arguments
		is outside the size of the image, or if one of the dw and dh arguments
		is negative, the implementation must raise an INDEX_SIZE_ERR  exception.

		The specified region of the image specified by the source rectangle
		(sx, sy, sw, sh) must be painted on the region of the canvas specified
		by the destination rectangle (dx, dy, dw, dh).

		Images are painted without affecting the current path, and are subject to
		transformations, shadow effects, global alpha, clipping paths, and global
		composition operators.
	*/
	drawImage: function (image, var_args) {
		var args = arguments,
			length = args.length,
			off = (length == 9) ? 4 : 0;

		if(!((length + '').test(/3|5|9/))) throw 'Wrong number of arguments';

		var w0 = image.runtimeStyle.width,
			h0 = image.runtimeStyle.height;
		image.runtimeStyle.width = 'auto';
		image.runtimeStyle.height = 'auto';

		var w = image.width,
			h = image.height;
		image.runtimeStyle.width = w0;
		image.runtimeStyle.height = h0;

		var sx = 0,
			sy = 0,
			sw = w,
			sh = h,
			dx = args[1 + off],
			dy = args[2 + off],
			dw = args[3 + off] || w,
			dh = args[4 + off] || h;

		if (length == 9) {
			sx = args[1];
			sy = args[2];
			sw = args[3];
			sh = args[4];
		}

		var d = this.getCoords(dx, dy),
			vmlStr =
			'<v:group coordsize="' + this.Z * 10 + ',' + this.Z * 10 + '" ' +
				'coordorigin="0,0" ' +
				'style="width:10;height:10;position:absolute;';

		if (this.m[0][0] != 1 || this.m[0][1]) {
			var max = Math.max(
				this.getCoords(dx + dw, dy),
				this.getCoords(dx, dy + dh),
				this.getCoords(dx + dw, dy + dh)
			);

			vmlStr +=
				'padding:0;' +
				'padding-right:' + Math.round(Math.max(d.x, max) / this.Z) + 'px;' +
				'padding-bottom:' + Math.round(Math.max(d.y, max) / this.Z) + 'px;' +
				'filter:progid:DXImageTransform.Microsoft.Matrix(' +
					"M11='" + this.m[0][0] + "', M12='" + this.m[1][0] + "', " +
					"M21='" + this.m[0][1] + "', M22='" + this.m[1][1] + "', " +
					"Dx='" + Math.round(d.x / this.Z) + "', Dy='" + Math.round(d.y / this.Z) + "', " +
					"sizingmethod='clip'" +
				');';
		} else {
			vmlStr +=
				'top:' + Math.round(d.y / this.Z) + 'px;' +
				'left:' + Math.round(d.x / this.Z) + 'px;';
		}

		this.element.insertAdjacentHTML('BeforeEnd', vmlStr +
			'"><v:image src="' + image.src + '" ' +
				'style="width:' + this.Z * dw + ';height:' + this.Z * dh + ';" ' +
				'cropleft="' + sx / w + '" ' +
				'croptop="' + sy / h + '" ' +
				'cropright="' + (w - sx - sw) / w + '" ' +
				'cropbottom="' + (h - sy - sh) / h + '" ' +
			'/></v:group>'
		);

		this.parent.appendChild(this.fragment);
	},

	drawImageFromRect: Function.empty,

	/*
	Property: getImageData
		Method must return an ImageData object representing the underlying
		pixel data for the area of the canvas denoted by the rectangle which
		has one corner at the (sx, sy) coordinate, and that has width sw and
		height sh. Pixels outside the canvas must be returned as transparent
		black.
	*/
	getImageData: function(sx, sy, sw, sh) {

	},

	/*
	Property: putImageData
		Method must take the given ImageData structure, and draw it at the
		specified location dx,dy in the canvas coordinate space, mapping each
		pixel represented by the ImageData structure into one device pixel.
	*/
	putImageData: function(image, dx, dy) {

	},

	getCoords: function(x, y) {
		var m = this.m;
		return {
			x: this.Z * (x * m[0][0] + y * m[1][0] + m[2][0]) - this.Z2,
			y: this.Z * (x * m[0][1] + y * m[1][1] + m[2][1]) - this.Z2
		};
	}

});


text:
![image](https://github.com/xhzengAIB/LearnEnglish/raw/master/Screenshots/XHImageViewer.gif)
XHImageViewer
=============
XHImageViewer is images viewer, zoom image

## How to use
Easy to drop into your project. You can add this feature to your own project, `XHImageViewer` is easy-to-use.
```objc
#import "XHImageViewer.h"

XHImageViewer *imageViewer = [[XHImageViewer alloc] init];
imageViewer.delegate = self;
[imageViewer showWithImageViews:_imageViews selectedView:imageView];

_imageViews is mutiple imageViews(subClass UIImageView or UIImageView)
imageView is user touch imageView to selectedImageView
```

Easy to use download web image form the open source.
```objc
#import "UIImageView+XHURLDownload.h"

UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 160, 200)]
[imageView setDefaultLoadingView];
[imageView loadWithURL:[NSURL URLWithString:@"http://www.pailixiu.com/IMG_1388.JPG"]];

multiple api to use:
- (void)loadWithURL:(NSURL *)url placeholer:(UIImage *)placeholerImage;
- (void)loadWithURL:(NSURL *)url placeholer:(UIImage *)placeholerImage showActivityIndicatorView:(BOOL)show;
- (void)loadWithURL:(NSURL *)url placeholer:(UIImage *)placeholerImage showActivityIndicatorView:(BOOL)show completionBlock:(void(^)(UIImage *image, NSURL *url, NSError *error))handler;
```

## Profile

[CocosPods](http://cocosPods.org) is the recommended methods of installation XHImageViewer, just add the following line to `Profile`:

```
pod 'XHImageViewer'
```

## Lincense ##

`XHImageViewer` is available under the MIT license. See the LICENSE file for more info.


text:
<!DOCTYPE html>
<title>Test of sandbox features - confirm</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/utils.js"></script>
<script src="resources/utils.js"></script>
<script src="resources/sandboxed-features.js"></script>

<body>
<script>
run_sanboxed_feature_test('test_confirm',
  'The fenced frame must fail to open a confirm dialog.');
</script>

</body>


text:
layout: post
title: Various Job posts in Neyveli Lignite Corporation last date 12th Jan-2016
date: 2015-12-16 04:24
comments: true
tags:  Engineer Manager Medical Online Public-Sector Superintendent
archive: false
---
Neyveli Lignite Corporation Limited (NLC), a premier 'Navratna' Public Sector Enterprise,  is looking for energetic & result oriented talents for following posts and disciplines :

- Superintendent (Medical) : 01 post, Pay Scale : Rs. 51300 - 73000
- Dy. Superintendent (Medical) : 01 post, Pay Scale : Rs. 43200 - 66000
- General Manager : 03 posts (Mechanical-2, Civil-1), Pay Scale : Rs. 51300 - 73000
- Dy. General Manager : 08 posts (Mechanical-3, Electrical-2, Civil-3), Pay Scale : Rs. 43200 - 66000
- Executive Engineer : 59 posts (Mechanical-18, Electrical-10, Civil-21, C&I-10), Pay Scale : Rs. 29100 - 54000

Apply Online : Candidates will be required to apply Online through Neyveli Lignite Website from 23/12/2015 to 12/01/2016 only.  Application should be received by posts on or before 19/01/2016.

For more details, please visit Neyveli Lignite website at <http://www.nlcindia.com/index.php?file_name=careers>


text:
namespace Atlas
{
    /// <summary>
    /// Interface for creating object-based method callbacks
    /// </summary>
    /// <seealso cref="Signal"/>
    public interface ICommand
    {
        /// <summary>
        /// Executes the object. When registered with a <see cref="Signal"/>, this will get called upon <see cref="Signal.Dispatch"/>
        /// </summary>
        void Execute();
    }

    /// <summary>
    /// Interface for creating object-based method callbacks with a single argument
    /// </summary>
    /// <seealso cref="Signal{T}"/>
    public interface ICommand<T>
    {
        /// <summary>
        /// Executes the object. When registered with a <see cref="Signal{T}"/>, this will get called upon <see cref="Signal{T}.Dispatch"/>
        /// </summary>
        void Execute( T arg );
    }

    /// <summary>
    /// Interface for creating object-based method callbacks with two argument
    /// </summary>
    /// <seealso cref="Signal{T1, T2}"/>
    public interface ICommand<T1, T2>
    {
        /// <summary>
        /// Executes the object. When registered with a <see cref="Signal{T1, T2}"/>, this will get called upon <see cref="Signal{T1, T2}.Dispatch"/>
        /// </summary>
        void Execute( T1 arg1, T2 arg2 );
    }

    /// <summary>
    /// Interface for creating object-based method callbacks with three argument
    /// </summary>
    /// <seealso cref="Signal{T1, T2, T3}"/>
    public interface ICommand<T1, T2, T3>
    {
        /// <summary>
        /// Executes the object. When registered with a <see cref="Signal{T1, T2, T3}"/>, this will get called upon <see cref="Signal{T1, T2, T3}.Dispatch"/>
        /// </summary>
        void Execute( T1 arg1, T2 arg2, T3 arg3 );
    }

    /// <summary>
    /// Interface for creating object-based method callbacks with four argument
    /// </summary>
    /// <seealso cref="Signal{T1, T2, T3, T4}"/>
    public interface ICommand<T1, T2, T3, T4>
    {
        /// <summary>
        /// Executes the object. When registered with a <see cref="Signal{T1, T2, T3, T4}"/>, this will get called upon <see cref="Signal{T1, T2, T3, T4}.Dispatch"/>
        /// </summary>
        void Execute( T1 arg1, T2 arg2, T3 arg3, T4 arg4 );
    }
}