text:
package org.apache.fluo.command;

import java.util.Collections;
import java.util.List;

import org.apache.accumulo.core.client.AccumuloException;
import org.apache.accumulo.core.client.AccumuloSecurityException;
import org.apache.accumulo.core.client.Scanner;
import org.apache.accumulo.core.client.TableNotFoundException;
import org.apache.fluo.api.config.FluoConfiguration;
import org.apache.fluo.core.client.FluoAdminImpl;
import org.apache.fluo.core.impl.Environment;
import org.apache.fluo.core.impl.Notification;
import org.apache.fluo.core.util.UtilWaitThread;
import org.apache.fluo.core.worker.finder.hash.TableRange;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static java.util.concurrent.TimeUnit.MINUTES;

public class FluoWait {

  private static final Logger log = LoggerFactory.getLogger(FluoWait.class);
  private static final long MIN_SLEEP_MS = 250;
  private static final long MAX_SLEEP_MS = MINUTES.toMillis(5);

  private static List<TableRange> getRanges(Environment env)
      throws TableNotFoundException, AccumuloSecurityException, AccumuloException {
    List<TableRange> ranges =
        TableRange.fromTexts(env.getAccumuloClient().tableOperations().listSplits(env.getTable()));
    Collections.shuffle(ranges);
    return ranges;
  }

  private static boolean hasNotifications(Environment env, TableRange range)
      throws TableNotFoundException {
    try (Scanner scanner =
        env.getAccumuloClient().createScanner(env.getTable(), env.getAuthorizations())) {
      scanner.setRange(range.getRange());
      Notification.configureScanner(scanner);

      return scanner.iterator().hasNext();
    }
  }

  /**
   * Wait until a range has no notifications.
   *
   * @return true if notifications were ever seen while waiting
   */
  private static boolean waitTillNoNotifications(Environment env, TableRange range)
      throws TableNotFoundException {
    boolean sawNotifications = false;
    long retryTime = MIN_SLEEP_MS;

    log.debug("Scanning tablet {} for notifications", range);

    long start = System.currentTimeMillis();
    while (hasNotifications(env, range)) {
      sawNotifications = true;
      long sleepTime = Math.max(System.currentTimeMillis() - start, retryTime);
      log.debug("Tablet {} had notfications, will rescan in {}ms", range, sleepTime);
      UtilWaitThread.sleep(sleepTime);
      retryTime = Math.min(MAX_SLEEP_MS, (long) (retryTime * 1.5));
      start = System.currentTimeMillis();
    }

    return sawNotifications;
  }

  /**
   * Wait until a scan of the table completes without seeing notifications AND without the Oracle
   * issuing any timestamps during the scan.
   */
  private static void waitUntilFinished(FluoConfiguration config) {
    try (Environment env = new Environment(config)) {
      List<TableRange> ranges = getRanges(env);

      outer: while (true) {
        long ts1 = env.getSharedResources().getOracleClient().getStamp().getTxTimestamp();
        for (TableRange range : ranges) {
          boolean sawNotifications = waitTillNoNotifications(env, range);
          if (sawNotifications) {
            ranges = getRanges(env);
            // This range had notifications. Processing those notifications may have created
            // notifications in previously scanned ranges, so start over.
            continue outer;
          }
        }
        long ts2 = env.getSharedResources().getOracleClient().getStamp().getTxTimestamp();

        // Check to ensure the Oracle issued no timestamps during the scan for notifications.
        if (ts2 - ts1 == 1) {
          break;
        }
      }
    } catch (Exception e) {
      log.error("An exception was thrown -", e);
      System.exit(-1);
    }
  }

  public static void main(String[] args) throws Exception {
    CommonOpts opts = CommonOpts.parse("fluo wait", args);
    FluoConfiguration config = CommandUtil.resolveFluoConfig();
    config.setApplicationName(opts.getApplicationName());
    opts.overrideFluoConfig(config);
    CommandUtil.verifyAppRunning(config);
    config = FluoAdminImpl.mergeZookeeperConfig(config);
    waitUntilFinished(config);
  }
}


text:
/**
 * Текстуры используются для отрисовки изображений в WebGL
 */

class Texture {
    /**
     * @param {HTMLImageElement | HTMLCanvasElement | ImageBitmap | ImageData | TypedArray} [src=null] В качестве
     * изображения может быть либо элемент img, либо canvas
     * @param {?TextureOptions} options
     */
    constructor(src, options = {}) {
        this._src = src || null;

        /**
         * Параметры для связывания текстуры
         * @type {TextureOptions}
         * @readonly
         */
        this.options = Object.assign({}, Texture.defaultOptions, options);

        /**
         * Контекст WebGL, в котором была инициализирована текстура.
         * Используется только для удаления, подумать хорошо, прежде чем использовать для чего-то ещё.
         * @type {?WebGLRenderingContext}
         * @ignore
         */
        this._glContext = null;
    }

    /**
     * Связывает WebGL и данные текстуры.
     * При первом вызов происходит инициализация.
     *
     * @param {WebGLRenderingContext} gl
     * @param {?Number} index Номер текстуры в контексте WebGL.
     * Если его нет, используется уже активированный юнит текстуры.
     */
    enable(gl, index) {
        const unit = index !== undefined ? index : this.options.unit;

        if (unit !== undefined) {
            gl.activeTexture(gl.TEXTURE0 + unit);
        }

        if (!this._texture) {
            this.prepare(gl);
        }

        gl.bindTexture(gl.TEXTURE_2D, this._texture);

        return this;
    }

    /**
     * Удаляет текстуру из видеокарты
     */
    remove() {
        if (this._texture) {
            this._glContext.deleteTexture(this._texture);
            this._glContext = null;
            this._texture = null;
        }

        return this;
    }

    /**
     * Возвращает WebGL текстуру
     * @return {WebGLTexture}
     */
    getTexture() {
        return this._texture;
    }

    /**
     * Обновляет часть текстуры
     *
     * @param {WebGLRenderingContext} gl
     * @param {HTMLImageElement | HTMLCanvasElement | ImageBitmap | ImageData | TypedArray} src
     * @param {number} x Горизонтальное смещение, с которого записываем в текстуру
     * @param {number} y Вертикальное смещение, с которого записываем в текстуру
     */
    subImage(gl, src, x, y) {
        gl.bindTexture(gl.TEXTURE_2D, this._texture);
        gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, this.options.flipY);
        gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.options.premultiplyAlpha);

        gl.texSubImage2D(
            gl.TEXTURE_2D,
            0,
            x, y,
            this._toGlParam(gl, this.options.format),
            this._toGlParam(gl, this.options.type),
            src
        );

        return this;
    }

    /**
     * Кладёт текстуру в видеокарту
     * @param {WebGLRenderingContext} gl
     */
    prepare(gl) {
        this._glContext = gl;
        this._texture = gl.createTexture();

        gl.bindTexture(gl.TEXTURE_2D, this._texture);
        gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, this.options.flipY);
        gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, this.options.premultiplyAlpha);

        if (this.options.size) {
            gl.texImage2D(
                gl.TEXTURE_2D,
                0,
                this._toGlParam(gl, this.options.format),
                this.options.size[0],
                this.options.size[1],
                0,
                this._toGlParam(gl, this.options.format),
                this._toGlParam(gl, this.options.type),
                this._src
            );
        } else {
            gl.texImage2D(
                gl.TEXTURE_2D,
                0,
                this._toGlParam(gl, this.options.format),
                this._toGlParam(gl, this.options.format),
                this._toGlParam(gl, this.options.type),
                this._src
            );
        }

        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, this._toGlParam(gl, this.options.wrapS));
        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, this._toGlParam(gl, this.options.wrapT));

        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, this._toGlParam(gl, this.options.magFilter));
        gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, this._toGlParam(gl, this.options.minFilter));

        if (this.options.generateMipmaps &&
            this.options.minFilter !== Texture.NearestFilter &&
            this.options.minFilter !== Texture.LinearFilter
        ) {
            gl.generateMipmap(gl.TEXTURE_2D);
        }

        gl.bindTexture(gl.TEXTURE_2D, null);

        return this;
    }

    _toGlParam(gl, param) {
        if (param === Texture.ClampToEdgeWrapping) { return gl.CLAMP_TO_EDGE; }
        if (param === Texture.Repeat) { return gl.REPEAT; }
        if (param === Texture.MirroredRepeat) { return gl.MIRRORED_REPEAT; }

        if (param === Texture.NearestFilter) { return gl.NEAREST; }
        if (param === Texture.NearestMipMapNearestFilter) { return gl.NEAREST_MIPMAP_NEAREST; }
        if (param === Texture.NearestMipMapLinearFilter) { return gl.NEAREST_MIPMAP_LINEAR; }

        if (param === Texture.LinearFilter) { return gl.LINEAR; }
        if (param === Texture.LinearMipMapNearestFilter) { return gl.LINEAR_MIPMAP_NEAREST; }
        if (param === Texture.LinearMipMapLinearFilter) { return gl.LINEAR_MIPMAP_LINEAR; }
        if (param === Texture.RgbaFormat) { return gl.RGBA; }
        if (param === Texture.AlphaFormat) { return gl.ALPHA; }
        if (param === Texture.RgbFormat) { return gl.RGB; }

        if (param === Texture.UnsignedByte) { return gl.UNSIGNED_BYTE; }
        if (param === Texture.Float) { return gl.FLOAT; }

        return null;
    }
}

Texture.ClampToEdgeWrapping = 8;
Texture.Repeat = 9;
Texture.MirroredRepeat = 10;

Texture.NearestFilter = 1;
Texture.NearestMipMapNearestFilter = 2;
Texture.NearestMipMapLinearFilter = 3;
Texture.LinearFilter = 4;
Texture.LinearMipMapNearestFilter = 5;
Texture.LinearMipMapLinearFilter = 6;

Texture.RgbaFormat = 11;
Texture.AlphaFormat = 12;
Texture.RgbFormat = 13;

Texture.UnsignedByte = 14;
Texture.Float = 15;

Texture.defaultOptions = {
    magFilter: Texture.LinearFilter,
    minFilter: Texture.LinearMipMapLinearFilter,
    wrapS: Texture.ClampToEdgeWrapping,
    wrapT: Texture.ClampToEdgeWrapping,
    format: Texture.RgbaFormat,
    generateMipmaps: true,
    flipY: true,
    premultiplyAlpha: true,
    type: Texture.UnsignedByte,
};

export default Texture;

/**
 * @typedef {Texture.NearestFilter | Texture.NearestMipMapNearestFilter |
 * Texture.NearestMipMapLinearFilter | Texture.LinearFilter |
 * Texture.LinearMipMapNearestFilter | Texture.LinearMipMapLinearFilter} TextureFilter
 */

/**
 * @typedef {Texture.ClampToEdgeWrapping} TextureClamp
 */

/**
 * @typedef {Texture.RgbaFormat | Texture.AlphaFormat} TextureFormat
 */

/**
 * @typedef {Texture.UnsignedByte | Texture.Float} TextureType
 */

/**
 * Параметры связывания текстуры
 *
 * @typedef {Object} TextureOptions
 * @property {TextureFilter} magFilter
 * @property {TextureFilter} minFilter
 * @property {TextureClamp} wrapS
 * @property {TextureClamp} wrapT
 * @property {TextureFormat} format
 * @property {Boolean} generateMipmaps
 * @property {Boolean} flipY
 * @property {Boolean} premultiplyAlpha
 * @property {?Number[]} size
 * @property {?Number} unit
 * @property {?TextureType} type
 */

redpajama_set_name: RedPajamaGithub


text:
package org.quil.interpreter.strata;

import static com.opengamma.strata.collect.Guavate.toImmutableList;

import java.io.File;
import java.net.URISyntaxException;
import java.net.URL;
import java.nio.file.Path;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.SortedMap;
import java.util.TreeMap;

import org.apache.ignite.igfs.IgfsPath;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.google.common.collect.ListMultimap;
import com.google.common.collect.Maps;
import com.google.common.io.CharSource;
import com.opengamma.strata.basics.currency.Currency;
import com.opengamma.strata.basics.currency.FxRate;
import com.opengamma.strata.collect.Messages;
import com.opengamma.strata.collect.io.ResourceLocator;
import com.opengamma.strata.collect.timeseries.LocalDateDoubleTimeSeries;
import com.opengamma.strata.data.FxRateId;
import com.opengamma.strata.data.ImmutableMarketData;
import com.opengamma.strata.data.ImmutableMarketDataBuilder;
import com.opengamma.strata.data.ObservableId;
import com.opengamma.strata.loader.csv.FixingSeriesCsvLoader;
import com.opengamma.strata.loader.csv.QuotesCsvLoader;
import com.opengamma.strata.loader.csv.RatesCurvesCsvLoader;
import com.opengamma.strata.market.curve.CurveGroup;
import com.opengamma.strata.market.curve.CurveGroupId;
import com.opengamma.strata.market.curve.CurveId;
import com.opengamma.strata.market.observable.QuoteId;
import com.opengamma.strata.measure.rate.RatesMarketDataLookup;
import com.opengamma.strata.pricer.credit.IsdaYieldCurveInputs;
import com.opengamma.strata.pricer.credit.IsdaYieldCurveInputsId;

public abstract class QuilMarketDataBuilder {

    private static final Logger log = LoggerFactory.getLogger(QuilMarketDataBuilder.class);

    /** The name of the subdirectory containing historical fixings. */
    private static final String HISTORICAL_FIXINGS_DIR = "historical-fixings";

    /** The name of the subdirectory containing calibrated rates curves. */
    private static final String CURVES_DIR = "curves";
    /** The name of the curve groups file. */
    private static final String CURVES_GROUPS_FILE = "groups.csv";
    /** The name of the curve settings file. */
    private static final String CURVES_SETTINGS_FILE = "settings.csv";

    /** The name of the directory containing CDS ISDA yield curve, credit curve and static data. */
    private static final String CREDIT_DIR = "credit";
    private static final String CDS_YIELD_CURVES_FILE = "cds.yieldCurves.csv";
    private static final String SINGLE_NAME_CREDIT_CURVES_FILE = "singleName.creditCurves.csv";
    private static final String SINGLE_NAME_STATIC_DATA_FILE = "singleName.staticData.csv";
    private static final String INDEX_CREDIT_CURVES_FILE = "index.creditCurves.csv";
    private static final String INDEX_STATIC_DATA_FILE = "index.staticData.csv";

    /** The name of the subdirectory containing simple market quotes. */
    private static final String QUOTES_DIR = "quotes";
    /** The name of the quotes file. */
    private static final String QUOTES_FILE = "quotes.csv";

    //-------------------------------------------------------------------------
    /**
     * Creates an instance from a given classpath resource root location using the class loader
     * which created this class.
     *

     * This is designed to handle resource roots which may physically correspond to a directory on
     * disk, or be located within a jar file.
     *
     * @param resourceRoot  the resource root path
     * @return the market data builder
     */
    public static QuilMarketDataBuilder ofResource(String resourceRoot) {
        return ofResource(resourceRoot, QuilMarketDataBuilder.class.getClassLoader());
    }

    /**
     * Creates an instance from a given classpath resource root location, using the given class loader
     * to find the resource.
     *

     * This is designed to handle resource roots which may physically correspond to a directory on
     * disk, or be located within a jar file.
     *
     * @param resourceRoot  the resource root path
     * @param classLoader  the class loader with which to find the resource
     * @return the market data builder
     */
    public static QuilMarketDataBuilder ofResource(String resourceRoot, ClassLoader classLoader) {
        // classpath resources are forward-slash separated
        String qualifiedRoot = resourceRoot;
        qualifiedRoot = qualifiedRoot.startsWith("/") ? qualifiedRoot.substring(1) : qualifiedRoot;
        qualifiedRoot = qualifiedRoot.startsWith("\\") ? qualifiedRoot.substring(1) : qualifiedRoot;
        qualifiedRoot = qualifiedRoot.endsWith("/") ? qualifiedRoot : qualifiedRoot + "/";
        URL url = classLoader.getResource(qualifiedRoot);
        if (url == null) {
            throw new IllegalArgumentException(Messages.format("Classpath resource not found: {}", qualifiedRoot));
        }
        if (url.getProtocol() != null && "jar".equals(url.getProtocol().toLowerCase(Locale.ENGLISH))) {
            // Inside a JAR
            int classSeparatorIdx = url.getFile().indexOf("!");
            if (classSeparatorIdx == -1) {
                throw new IllegalArgumentException(Messages.format("Unexpected JAR file URL: {}", url));
            }
            String jarPath = url.getFile().substring("file:".length(), classSeparatorIdx);
            File jarFile;
            try {
                jarFile = new File(jarPath);
            } catch (Exception e) {
                throw new IllegalArgumentException(Messages.format("Unable to create file for JAR: {}", jarPath), e);
            }
            return new JarMarketDataBuilder(jarFile, resourceRoot);
        } else if (url.getProtocol() != null && "igfs".equals(url.getProtocol().toLowerCase(Locale.ENGLISH))) {

            log.info("Loading MarketData from " + url.toString());

            String rootPath = url.toString().replace("igfs:","");

            return new IgfsMarketDataBuilder(new IgfsPath(rootPath));

        } else {
            // Resource is on disk
            File file;
            try {
                file = new File(url.toURI());
            } catch (URISyntaxException e) {
                throw new IllegalArgumentException(Messages.format("Unexpected file location: {}", url), e);
            }
            return new DirectoryMarketDataBuilder(file.toPath());
        }
    }

    /**
     * Creates an instance from a given directory root.
     *
     * @param rootPath  the root directory
     * @return the market data builder
     */
    public static QuilMarketDataBuilder ofPath(Path rootPath) {
        return new DirectoryMarketDataBuilder(rootPath);
    }

    public static QuilMarketDataBuilder ofIgfsPath(IgfsPath rootPath) {

        log.info("Loading MarketData from " + rootPath.toString());

        return new IgfsMarketDataBuilder(rootPath);
    }

    //-------------------------------------------------------------------------
    /**
     * Builds a market data snapshot from this environment.
     *
     * @param marketDataDate  the date of the market data
     * @return the snapshot
     */
    public ImmutableMarketData buildSnapshot(LocalDate marketDataDate) {
        ImmutableMarketDataBuilder builder = ImmutableMarketData.builder(marketDataDate);
        loadFixingSeries(builder);
        loadRatesCurves(builder, marketDataDate);
        loadQuotes(builder, marketDataDate);
        loadFxRates(builder);
        return builder.build();
    }

    /**
     * Gets the rates market lookup to use with this environment.
     *
     * @param marketDataDate  the date of the market data
     * @return the rates lookup
     */
    public RatesMarketDataLookup ratesLookup(LocalDate marketDataDate) {
        SortedMap<LocalDate, CurveGroup> curves = loadAllRatesCurves();
        return RatesMarketDataLookup.of(curves.get(marketDataDate));
    }

    /**
     * Gets all rates curves.
     *
     * @return the map of all rates curves
     */
    public SortedMap<LocalDate, CurveGroup> loadAllRatesCurves() {
        if (!subdirectoryExists(CURVES_DIR)) {
            throw new IllegalArgumentException("No rates curves directory found");
        }
        ResourceLocator curveGroupsResource = getResource(CURVES_DIR, CURVES_GROUPS_FILE);
        if (curveGroupsResource == null) {
            throw new IllegalArgumentException(Messages.format(
                    "Unable to load rates curves: curve groups file not found at {}/{}", CURVES_DIR, CURVES_GROUPS_FILE));
        }
        ResourceLocator curveSettingsResource = getResource(CURVES_DIR, CURVES_SETTINGS_FILE);
        if (curveSettingsResource == null) {
            throw new IllegalArgumentException(Messages.format(
                    "Unable to load rates curves: curve settings file not found at {}/{}", CURVES_DIR, CURVES_SETTINGS_FILE));
        }
        ListMultimap<LocalDate, CurveGroup> curveGroups =
                RatesCurvesCsvLoader.loadAllDates(curveGroupsResource, curveSettingsResource, getRatesCurvesResources());

        // There is only one curve group in the market data file so this will always succeed
        Map<LocalDate, CurveGroup> curveGroupMap = Maps.transformValues(curveGroups.asMap(), groups -> groups.iterator().next());
        return new TreeMap<>(curveGroupMap);
    }

    //-------------------------------------------------------------------------
    private void loadFixingSeries(ImmutableMarketDataBuilder builder) {
        if (!subdirectoryExists(HISTORICAL_FIXINGS_DIR)) {
            log.debug("No historical fixings directory found");
            return;
        }
        try {

            Collection<ResourceLocator> fixingSeriesResources = getAllResources(HISTORICAL_FIXINGS_DIR);
            Map<ObservableId, LocalDateDoubleTimeSeries> fixingSeries = FixingSeriesCsvLoader.load(fixingSeriesResources);
            builder.addTimeSeriesMap(fixingSeries);
        } catch (Exception e) {
            log.error("Error loading fixing series", e);
        }
    }

    private void loadRatesCurves(ImmutableMarketDataBuilder builder, LocalDate marketDataDate) {
        if (!subdirectoryExists(CURVES_DIR)) {
            log.debug("No rates curves directory found");
            return;
        }

        ResourceLocator curveGroupsResource = getResource(CURVES_DIR, CURVES_GROUPS_FILE);
        if (curveGroupsResource == null) {
            log.error("Unable to load rates curves: curve groups file not found at {}/{}", CURVES_DIR, CURVES_GROUPS_FILE);
            return;
        }

        ResourceLocator curveSettingsResource = getResource(CURVES_DIR, CURVES_SETTINGS_FILE);
        if (curveSettingsResource == null) {
            log.error("Unable to load rates curves: curve settings file not found at {}/{}", CURVES_DIR, CURVES_SETTINGS_FILE);
            return;
        }
        try {
            Collection<ResourceLocator> curvesResources = getRatesCurvesResources();
            List<CurveGroup> ratesCurves =
                    RatesCurvesCsvLoader.load(marketDataDate, curveGroupsResource, curveSettingsResource, curvesResources);

            for (CurveGroup group : ratesCurves) {
                // add entry for each group
                builder.addValue(CurveGroupId.of(group.getName()), group);
                // add entry for higher level discount curve name
                group.getDiscountCurves().forEach(
                        (ccy, curve) -> builder.addValue(CurveId.of(group.getName(), curve.getName()), curve));
                // add entry for higher level forward curve name
                group.getForwardCurves().forEach(
                        (idx, curve) -> builder.addValue(CurveId.of(group.getName(), curve.getName()), curve));
            }

        } catch (Exception e) {
            log.error("Error loading rates curves", e);
        }
    }

    // load quotes
    private void loadQuotes(ImmutableMarketDataBuilder builder, LocalDate marketDataDate) {
        if (!subdirectoryExists(QUOTES_DIR)) {
            log.debug("No quotes directory found");
            return;
        }

        ResourceLocator quotesResource = getResource(QUOTES_DIR, QUOTES_FILE);
        if (quotesResource == null) {
            log.error("Unable to load quotes: quotes file not found at {}/{}", QUOTES_DIR, QUOTES_FILE);
            return;
        }

        try {
            Map<QuoteId, Double> quotes = QuotesCsvLoader.load(marketDataDate, quotesResource);
            builder.addValueMap(quotes);

        } catch (Exception ex) {
            log.error("Error loading quotes", ex);
        }
    }

    private void loadFxRates(ImmutableMarketDataBuilder builder) {
        // TODO - load from CSV file - format to be defined
        builder.addValue(FxRateId.of(com.opengamma.strata.basics.currency.Currency.GBP, com.opengamma.strata.basics.currency.Currency.USD), FxRate.of(com.opengamma.strata.basics.currency.Currency.GBP, com.opengamma.strata.basics.currency.Currency.USD, 1.61));
    }

    //-------------------------------------------------------------------------
    private Collection<ResourceLocator> getRatesCurvesResources() {
        return getAllResources(CURVES_DIR).stream()
                .filter(res -> !res.getLocator().endsWith(CURVES_GROUPS_FILE))
                .filter(res -> !res.getLocator().endsWith(CURVES_SETTINGS_FILE))
                .collect(toImmutableList());
    }

    //-------------------------------------------------------------------------
    /**
     * Gets all available resources from a given subdirectory.
     *
     * @param subdirectoryName  the name of the subdirectory
     * @return a collection of locators for the resources in the subdirectory
     */
    protected abstract Collection<ResourceLocator> getAllResources(String subdirectoryName);

    /**
     * Gets a specific resource from a given subdirectory.
     *
     * @param subdirectoryName  the name of the subdirectory
     * @param resourceName  the name of the resource
     * @return a locator for the requested resource
     */
    protected abstract ResourceLocator getResource(String subdirectoryName, String resourceName);

    /**
     * Checks whether a specific subdirectory exists.
     *
     * @param subdirectoryName  the name of the subdirectory
     * @return whether the subdirectory exists
     */
    protected abstract boolean subdirectoryExists(String subdirectoryName);

}


text:
$( document ).ready(function() {

$('#design').addClass('animated fadeInLeft');

});


text:
<?php
$TRANSLATIONS = array(
"WebDAV Authentication" => "WebDAV overenie",
"Address: " => "Adresa: ",
"The user credentials will be sent to this address. This plugin checks the response and will interpret the HTTP statuscodes 401 and 403 as invalid credentials, and all other responses as valid credentials." => "Používateľské prihlasovacie údaje budú odoslané na túto adresu. Tento plugin skontroluje odpoveď servera a interpretuje návratový kód HTTP 401 a 403 ako neplatné prihlasovacie údaje a akýkoľvek iný ako platné prihlasovacie údaje."
);
$PLURAL_FORMS = "nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;";


text:
package org.mybatis.spring.annotation.mapper.ds2;

import org.springframework.context.annotation.Scope;

@Scope
public interface Ds2Mapper {
  default String test() {
    return "ds2";
  }
}


text:
#include "modules/audio_coding/codecs/isac/fix/include/isacfix.h"
#include "modules/audio_coding/neteq/tools/neteq_quality_test.h"
#include "rtc_base/flags.h"

using testing::InitGoogleTest;

namespace webrtc {
namespace test {
namespace {
static const int kIsacBlockDurationMs = 30;
static const int kIsacInputSamplingKhz = 16;
static const int kIsacOutputSamplingKhz = 16;

DEFINE_int(bit_rate_kbps, 32, "Target bit rate (kbps).");

}  // namespace

class NetEqIsacQualityTest : public NetEqQualityTest {
 protected:
  NetEqIsacQualityTest();
  void SetUp() override;
  void TearDown() override;
  int EncodeBlock(int16_t* in_data, size_t block_size_samples,
                  rtc::Buffer* payload, size_t max_bytes) override;
 private:
  ISACFIX_MainStruct* isac_encoder_;
  int bit_rate_kbps_;
};

NetEqIsacQualityTest::NetEqIsacQualityTest()
    : NetEqQualityTest(kIsacBlockDurationMs,
                       kIsacInputSamplingKhz,
                       kIsacOutputSamplingKhz,
                       NetEqDecoder::kDecoderISAC),
      isac_encoder_(NULL),
      bit_rate_kbps_(FLAG_bit_rate_kbps) {
    // Flag validation
    RTC_CHECK(FLAG_bit_rate_kbps >= 10 && FLAG_bit_rate_kbps <= 32)
        << "Invalid bit rate, should be between 10 and 32 kbps.";
  }

void NetEqIsacQualityTest::SetUp() {
  ASSERT_EQ(1u, channels_) << "iSAC supports only mono audio.";
  // Create encoder memory.
  WebRtcIsacfix_Create(&isac_encoder_);
  ASSERT_TRUE(isac_encoder_ != NULL);
  EXPECT_EQ(0, WebRtcIsacfix_EncoderInit(isac_encoder_, 1));
  // Set bitrate and block length.
  EXPECT_EQ(0, WebRtcIsacfix_Control(isac_encoder_, bit_rate_kbps_ * 1000,
                                     kIsacBlockDurationMs));
  NetEqQualityTest::SetUp();
}

void NetEqIsacQualityTest::TearDown() {
  // Free memory.
  EXPECT_EQ(0, WebRtcIsacfix_Free(isac_encoder_));
  NetEqQualityTest::TearDown();
}

int NetEqIsacQualityTest::EncodeBlock(int16_t* in_data,
                                      size_t block_size_samples,
                                      rtc::Buffer* payload, size_t max_bytes) {
  // ISAC takes 10 ms for every call.
  const int subblocks = kIsacBlockDurationMs / 10;
  const int subblock_length = 10 * kIsacInputSamplingKhz;
  int value = 0;

  int pointer = 0;
  for (int idx = 0; idx < subblocks; idx++, pointer += subblock_length) {
    // The Isac encoder does not perform encoding (and returns 0) until it
    // receives a sequence of sub-blocks that amount to the frame duration.
    EXPECT_EQ(0, value);
    payload->AppendData(max_bytes, [&] (rtc::ArrayView<uint8_t> payload) {
        value = WebRtcIsacfix_Encode(isac_encoder_, &in_data[pointer],
                                     payload.data());
        return (value >= 0) ? static_cast<size_t>(value) : 0;
      });
  }
  EXPECT_GT(value, 0);
  return value;
}

TEST_F(NetEqIsacQualityTest, Test) {
  Simulate();
}

}  // namespace test
}  // namespace webrtc


text:
<!-- Common imports -->
<link rel="import" href="../../polymer/polymer.html" />
<link rel="import" href="../../px-polymer-font-awesome/px-polymer-font-awesome.html" />

<!-- Common demo imports -->
<link rel="import" href="../../px-demo/px-demo-header.html" />
<link rel="import" href="../../px-demo/px-demo-api-viewer.html" />
<link rel="import" href="../../px-demo/px-demo-footer.html" />
<link rel="import" href="../../px-demo/px-demo-props.html" />
<link rel="import" href="../../px-demo/px-demo-configs.html" />
<link rel="import" href="../../px-demo/px-demo-interactive.html" />
<link rel="import" href="../../px-demo/px-demo-component-snippet.html" />
<link rel="import" href="../../px-demo/px-demo-code-editor.html" />
<link rel="import" href="../../px-demo/css/px-demo-styles.html" />

<!-- Imports for this componnent -->
<link rel="import" href="px-vis-toolbar-demo-component.html">

<!-- Demo DOM module -->
<dom-module id="px-vis-toolbar-demo">
  <template>
  <style include="px-demo-styles" is="custom-style"></style>

  <!-- Light theme -->
  <style include="px-theme-styles" is="custom-style"></style>

  <!-- Dark theme -->
  <style include="px-dark-demo-theme-styles" is="custom-style"></style>
  <style include="px-dark-theme-styles" is="custom-style"></style>

    <!-- Header -->
    <px-demo-header
        module-name="px-vis-toolbar"
        description="[[description]]"
        parent-name="px-vis">
    </px-demo-header>

    <!-- Interactive -->
    <px-demo-interactive force-hide-props>
      <px-demo-configs configs="[[configs]]" props="{{props}}" chosen-config="{{chosenConfig}}"></px-demo-configs>
      <!-- Props -->
    <px-demo-props props="{{props}}" config="[[chosenConfig]]"></px-demo-props>

      <!-- Component ---------------------------------------------------------->
      <px-demo-component>
        <px-vis-toolbar-demo-component></px-vis-toolbar-demo-component>
      </px-demo-component>
      <!-- END Component ------------------------------------------------------>

      <px-demo-component-snippet
          element-properties="{{props}}"
          element-name="px-vis-toolbar">
      </px-demo-component-snippet>
    </px-demo-interactive>

    <!-- API Viewer -->
    <px-demo-api-viewer source="px-vis-toolbar"></px-demo-api-viewer>

  </template>

</dom-module>
<script>
  Polymer({
    is: 'px-vis-toolbar-demo',
    properties: {
      description: {
        type: String,
        value: "Element providing a configurable toolbar which can be configured to add chart interaction through developer configured features."
      },
      /**
       * @property demoProps
       * @type {Object}
       */
      props: {
        type: Object,
        value: function(){ return this.demoProps; }
      },

      /**
       * @property demoProps
       * @type {Array}
       */
      configs: {
        type: Array,
        value: function(){
          return [
              {
                configName: "Default",
                configShowProps: []
              }
          ];
        },
      },
    },
    demoProps: {
      additionalDetail:{
			  value:"[[item]]"
		  },
      dynamicMenuConfig:{
			  value:"[[dynamicMenuConfig]]"
		  }
    }
  });
</script>


text:
package com.google.errorprone.bugpatterns;

import com.google.errorprone.CompilationTestHelper;
import org.junit.Before;
import org.junit.Test;

import java.io.File;

/**
 * @author alexeagle@google.com (Alex Eagle)
 */
public class CollectionIncompatibleTypeTest {

  private CompilationTestHelper compilationHelper;

  @Before
  public void setUp() {
    compilationHelper = new CompilationTestHelper(CollectionIncompatibleType.class);
  }

  @Test
  public void testPositiveCase() throws Exception {
    compilationHelper.assertCompileFailsWithMessages(
        new File(this.getClass().getResource(
            "CollectionIncompatibleTypePositiveCases.java").toURI()));
  }

  @Test
  public void testNegativeCase() throws Exception {
    compilationHelper.assertCompileSucceeds(
        new File(this.getClass().getResource(
            "CollectionIncompatibleTypeNegativeCases.java").toURI()));
  }

}


text:
#ifndef _UAPI_ASM_X86_SIGNAL_H
#define _UAPI_ASM_X86_SIGNAL_H
#ifndef __ASSEMBLY__
#include <linux/types.h>
#include <linux/time.h>
#include <linux/compiler.h>
struct siginfo;
#define _KERNEL_NSIG 32
typedef unsigned long sigset_t;
#endif
#define SIGHUP 1
#define SIGINT 2
#define SIGQUIT 3
#define SIGILL 4
#define SIGTRAP 5
#define SIGABRT 6
#define SIGIOT 6
#define SIGBUS 7
#define SIGFPE 8
#define SIGKILL 9
#define SIGUSR1 10
#define SIGSEGV 11
#define SIGUSR2 12
#define SIGPIPE 13
#define SIGALRM 14
#define SIGTERM 15
#define SIGSTKFLT 16
#define SIGCHLD 17
#define SIGCONT 18
#define SIGSTOP 19
#define SIGTSTP 20
#define SIGTTIN 21
#define SIGTTOU 22
#define SIGURG 23
#define SIGXCPU 24
#define SIGXFSZ 25
#define SIGVTALRM 26
#define SIGPROF 27
#define SIGWINCH 28
#define SIGIO 29
#define SIGPOLL SIGIO
#define SIGPWR 30
#define SIGSYS 31
#define SIGUNUSED 31
#define __SIGRTMIN 32
#define __SIGRTMAX _KERNEL__NSIG
#define SA_RESTORER 0x04000000
#define MINSIGSTKSZ 2048
#define SIGSTKSZ 8192
#include <asm-generic/signal-defs.h>
#ifndef __ASSEMBLY__
#ifdef __i386__
struct sigaction {
  union {
    __sighandler_t _sa_handler;
    void(* _sa_sigaction) (int, struct siginfo *, void *);
  } _u;
  sigset_t sa_mask;
  unsigned long sa_flags;
  void(* sa_restorer) (void);
};
#define sa_handler _u._sa_handler
#define sa_sigaction _u._sa_sigaction
#else
struct sigaction {
  __sighandler_t sa_handler;
  unsigned long sa_flags;
  __sigrestore_t sa_restorer;
  sigset_t sa_mask;
};
#endif
typedef struct sigaltstack {
  void __user * ss_sp;
  int ss_flags;
  size_t ss_size;
} stack_t;
#endif
#endif


text:
const User = {
  addPoints: (req, res) => {},
};

module.exports = User;


text:
// Copyright (c) 2018 Intel Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#include "precomp.h"

#include <stdlib.h>

#include "owndefs.h"

/* ////////////////////////////////////////////////////////////////////////// */
#define ALIGNED_MASK  (~(IPP_MALLOC_ALIGNED_BYTES-1))

#define ALLOC_ALIGNED_AND_RET( retType,lengthType,length )                             \
{                                                                                \
    void *ptr = (void*)0;                                                              \
/*    IPP_BADARG_RET( (length<=0), NULL )*/                                            \
    if( length <= 0 ) return NULL;                                                     \
    ptr = malloc(sizeof(lengthType)*length + IPP_MALLOC_ALIGNED_BYTES + sizeof(void*));\
    if (ptr) {                                                                         \
        void **ap = (void**)( (IPP_UINT_PTR(ptr) + IPP_MALLOC_ALIGNED_BYTES +          \
                                      sizeof(void*) - 1 ) & ALIGNED_MASK );            \
        ap[-1] = (void*)ptr;                                                           \
        return (retType)ap;                                                            \
    }                                                                                \
    return (retType)0;                                                                 \
}
/* ////////////////////////////////////////////////////////////////////////// */

/* /////////////////////////////////////////////////////////////////////////////
//  Name:       mfxMalloc
//  Purpose:    allocates aligned (32 bytes) arrays
//  Returns:    actual pointer, if no errors
//              NULL, if out of memory or if incorrect length
//  Parameter:
//    length  - sizeof in bytes
//
//  Notes:      You should release memory only by function mfxFree()
*/

IPPFUN( void*, mfxMalloc, (int length) )
{
    ALLOC_ALIGNED_AND_RET( void*, Ipp8u, length )
}

/* /////////////////////////////////////////////////////////////////////////////
//  Name:       mfxFree
//  Purpose:    frees memory allocated by mfx*_Malloc
//  Parameter:
//    ptr     - the pointer on memory, which allocated by mfx*_Malloc*
//
//  Notes: function correctly free memory, which allocated mfx*_Malloc*() only
*/
IPPFUN( void, mfxFree, (void* ptr) )
{
   if( ptr )free( ((void**)ptr)[-1] );
}

/* //////////////////////// End of file "ippmalloc.c" ///////////////////////// */


text:
#include "MemcacheLocal.h"

#include <time.h>

#include <vector>

#include <folly/FileUtil.h>
#include <folly/Memory.h>
#include <folly/Range.h>

#include "mcrouter/config.h"
#include "mcrouter/lib/network/test/ClientSocket.h"

using namespace std;

namespace facebook { namespace memcache { namespace test {

// constants
constexpr int kPortSearchOut = 100;
constexpr int kPortRangeBegin = 30000;
constexpr int kPortRangeEnd = 50000;
constexpr int kTimeout = 10;
constexpr folly::StringPiece kMemcachedPath
  = MCROUTER_INSTALL_PATH "mcrouter/lib/network/mock_mc_server";
constexpr folly::StringPiece kMemcachedBin = "mock_mc_server";
constexpr folly::StringPiece kConfig =
  "mcrouter/test/cpp_unit_tests/files/memcache_local_config.json";

MemcacheLocal::MemcacheLocal()
  : random_(time(nullptr)) {

  // find an open port and start memcache for our test.
  // blocks until server ready
  port_ = startMemcachedServer(kPortRangeBegin, kPortRangeEnd);
}

MemcacheLocal::~MemcacheLocal() {
  // stop the server. blocks until server exited
  stopMemcachedServer(port_);
}

bool MemcacheLocal::startMemcachedOnPort(folly::StringPiece path,
                                         folly::StringPiece bin,
                                         const int port) {
  //open the output file
  int fd1 = open("/dev/null", O_RDWR);

  /**
   * options: redirect stdout and stderr of the subprocess to fd1 (/dev/null)
   * also send the subprocess a SIGTERM (terminate) signal when parent dies
   */
  folly::Subprocess::Options options;
  options.stdout(fd1).stderr(fd1).parentDeathSignal(SIGTERM);

  process_ = folly::make_unique<folly::Subprocess>(
      vector<string>{bin.str(), "-P", to_string(port)},
      options,
      path.str().c_str(),
      nullptr);

  // premature exit?
  sleep(1);
  auto prc = process_->poll();
  if (prc.exited() || prc.killed()) {
    return false;
  }

  // busy wait and test if we can connect to the server
  for (int i = 0; i < kTimeout; i++) {
    try {
      ClientSocket socket(port);
      return true; // could start memcached server, and connect to it
    } catch (const std::runtime_error& e) { }
    sleep(1);
  }

  process_->kill(); // kill suprocess
  process_->wait(); // reap subprocess
  return false;
}

void MemcacheLocal::stopMemcachedServer(const int port) const {
  try {
    ClientSocket socket(port);
    socket.write("shutdown\r\n");
    process_->wait();
  } catch (const std::runtime_error& e) {
    process_->kill();
    process_->wait();
  }
}

int MemcacheLocal::generateRandomPort(const int startPort,
                                      const int stopPort) {
  int halfRange = (stopPort - startPort) >> 1;  // half the range
  std::uniform_int_distribution<int> dist(0, halfRange - 1);
  int halfPort = dist(random_);     // generate URN [0, half_range)
  return (halfPort << 1) + startPort; // ensures the generated port is even
}

int MemcacheLocal::startMemcachedServer(const int startPort,
                                        const int stopPort) {
  if (startPort > stopPort) {
    throw std::runtime_error("Port limit misconfiguration. Begin > End !");
  }

  /* find an open port */
  for (int i = 0; i < kPortSearchOut; i++) {
    int port = generateRandomPort(startPort, stopPort);

    // if memcached started successfully, return. Otherwise, keep begging.
    if (startMemcachedOnPort(kMemcachedPath, kMemcachedBin, port)) {
      return port;
    }
  }
  throw std::runtime_error("Can not find an open port to bind memcached");
}

std::string MemcacheLocal::generateMcrouterConfigString() {
  std::string config;
  if (!folly::readFile(kConfig.data(), config)) {
    throw std::runtime_error("Can not read " + kConfig.str());
  }
  config.replace(config.find("PORT"), 4, std::to_string(port_));
  return config;
}

}}} // namespace facebook::memcache::test


text:
package org.camunda.bpm.engine.test.cmmn.listener;

import org.camunda.bpm.engine.delegate.CaseExecutionListener;
import org.camunda.bpm.engine.delegate.DelegateCaseExecution;

/**
 * @author Roman Smirnov
 *
 */
public class MySpecialCaseExecutionListener extends MyCaseExecutionListener implements CaseExecutionListener {

  private static final long serialVersionUID = 1L;

  public void notify(DelegateCaseExecution caseExecution) throws Exception {
    notify(caseExecution, caseExecution.getEventName());
  }

}


text:
import Post from '../models/post';
import cuid from 'cuid';
import slug from 'limax';
import sanitizeHtml from 'sanitize-html';

/**
 * Get all posts
 * @param req
 * @param res
 */
export function getPosts(req, res) {
  Post.find().sort('-dateAdded').exec((err, posts) => {
    if (err) {
      return res.status(500).send(err);
    }
    return res.json({ posts });
  });
}

/**
 * Save a post
 * @param req
 * @param res
 * @returns {*}
 */
export function addPost(req, res) { // eslint-disable-line consistent-return
  if (!req.body.post.name || !req.body.post.title || !req.body.post.content) {
    return res.status(403).end();
  }

  const newPost = new Post(req.body.post);

  // Let's sanitize inputs
  newPost.title = sanitizeHtml(newPost.title);
  newPost.name = sanitizeHtml(newPost.name);
  newPost.content = sanitizeHtml(newPost.content);

  newPost.slug = slug(newPost.title.toLowerCase(), { lowercase: true });
  newPost.cuid = cuid();
  newPost.save((err, saved) => {
    if (err) {
      return res.status(500).send(err);
    }
    return res.json({ post: saved });
  });
}

/**
 * Get a single post
 * @param req
 * @param res
 */
export function getPost(req, res) {
  const newSlug = req.params.slug.split('-');
  const newCuid = newSlug[newSlug.length - 1];
  Post.findOne({ cuid: newCuid }).exec((err, post) => {
    if (err) {
      return res.status(500).send(err);
    }
    return res.json({ post });
  });
}

/**
 * Delete a post
 * @param req
 * @param res
 */
export function deletePost(req, res) {
  const postId = req.body.id;
  Post.findById(postId).exec((err, post) => { // eslint-disable-line consistent-return
    if (err) {
      return res.status(500).send(err);
    }

    post.remove(() => {
      return res.status(200).end();
    });
  });
}


text:
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true">

    <fragment
        android:id="@+id/map"
        android:name="com.google.android.gms.maps.SupportMapFragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/search_fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@drawable/ic_fab_search"
        app:backgroundTint="@color/colorPrimary"/>

</android.support.design.widget.CoordinatorLayout>


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using System.ServiceProcess;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace AsimovDeploy.WinAgent.Framework.Tasks.ServiceControl
{
    //http://stackoverflow.com/a/1597244
    class ProcessAwareServiceController
    {

        [DllImport("advapi32")]
        static extern bool QueryServiceStatusEx(IntPtr hService, int InfoLevel, ref SERVICE_STATUS_PROCESS lpBuffer, int cbBufSize, out int pcbBytesNeeded);

        const int SC_STATUS_PROCESS_INFO = 0;

        [StructLayout(LayoutKind.Sequential)]
        struct SERVICE_STATUS_PROCESS
        {
            public int dwServiceType;
            public int dwCurrentState;
            public int dwControlsAccepted;
            public int dwWin32ExitCode;
            public int dwServiceSpecificExitCode;
            public int dwCheckPoint;
            public int dwWaitHint;
            public int dwProcessId;
            public int dwServiceFlags;
        }

        const int SERVICE_WIN32_OWN_PROCESS = 0x00000010;

        const int SERVICE_RUNS_IN_SYSTEM_PROCESS = 0x00000001;

        public static void StopServiceAndWaitForExit(string serviceName)
        {
            using (ServiceController controller = new ServiceController(serviceName))
            {
                SERVICE_STATUS_PROCESS ssp = new SERVICE_STATUS_PROCESS();
                int ignored;

                // Obtain information about the service, and specifically its hosting process,
                // from the Service Control Manager.
                if (!QueryServiceStatusEx(controller.ServiceHandle.DangerousGetHandle(), SC_STATUS_PROCESS_INFO, ref ssp, Marshal.SizeOf(ssp), out ignored))
                    throw new Exception("Couldn't obtain service process information.");

                // A few quick sanity checks that what the caller wants is *possible*.
                if (ssp.dwServiceType != SERVICE_WIN32_OWN_PROCESS)
                    throw new Exception("Can't wait for the service's hosting process to exit because there may be multiple services in the process (dwServiceType is not SERVICE_WIN32_OWN_PROCESS");

                if ((ssp.dwServiceFlags & SERVICE_RUNS_IN_SYSTEM_PROCESS) != 0)
                    throw new Exception("Can't wait for the service's hosting process to exit because the hosting process is a critical system process that will not exit (SERVICE_RUNS_IN_SYSTEM_PROCESS flag set)");

                if (ssp.dwProcessId == 0)
                    throw new Exception("Can't wait for the service's hosting process to exit because the process ID is not known.");

                // Note: It is possible for the next line to throw an ArgumentException if the
                // Service Control Manager's information is out-of-date (e.g. due to the process
                // having *just* been terminated in Task Manager) and the process does not really
                // exist. This is a race condition. The exception is the desirable result in this
                // case.
                using (Process process = Process.GetProcessById(ssp.dwProcessId))
                {
                    // EDIT: There is no need for waiting in a separate thread, because MSDN says "The handles are valid until closed, even after the process or thread they represent has been terminated." ( http://msdn.microsoft.com/en-us/library/windows/desktop/ms684868%28v=vs.85%29.aspx ), so to keep things in the same thread, the process HANDLE should be opened from the process id before the service is stopped, and the Wait should be done after that.

                    // Response to EDIT: What you report is true, but the problem is that the handle isn't actually opened by Process.GetProcessById. It's only opened within the .WaitForExit method, which won't return until the wait is complete. Thus, if we try the wait on the current therad, we can't actually do anything until it's done, and if we defer the check until after the process has completed, it won't be possible to obtain a handle to it any more.

                    // The actual wait, using process.WaitForExit, opens a handle with the SYNCHRONIZE
                    // permission only and closes the handle before returning. As long as that handle
                    // is open, the process can be monitored for termination, but if the process exits
                    // before the handle is opened, it is no longer possible to open a handle to the
                    // original process and, worse, though it exists only as a technicality, there is
                    // a race condition in that another process could pop up with the same process ID.
                    // As such, we definitely want the handle to be opened before we ask the service
                    // to close, but since the handle's lifetime is only that of the call to WaitForExit
                    // and while WaitForExit is blocking the thread we can't make calls into the SCM,
                    // it would appear to be necessary to perform the wait on a separate thread.
                    ProcessWaitForExitData threadData = new ProcessWaitForExitData();

                    threadData.Process = process;

                    Thread processWaitForExitThread = new Thread(ProcessWaitForExitThreadProc);

                    processWaitForExitThread.IsBackground = Thread.CurrentThread.IsBackground;
                    processWaitForExitThread.Start(threadData);

                    // Now we ask the service to exit.
                    controller.Stop();

                    // Instead of waiting until the *service* is in the "stopped" state, here we
                    // wait for its hosting process to go away. Of course, it's really that other
                    // thread waiting for the process to go away, and then we wait for the thread
                    // to go away.
                    lock (threadData.Sync)
                      while (!threadData.HasExited)
                            Monitor.Wait(threadData.Sync);
                }
            }
        }

        class ProcessWaitForExitData
        {
            public Process Process;
            public volatile bool HasExited;
            public object Sync = new object();
        }

        static void ProcessWaitForExitThreadProc(object state)
        {
            ProcessWaitForExitData threadData = (ProcessWaitForExitData)state;

            try
            {
                threadData.Process.WaitForExit();
            }
            catch { }
            finally
            {
                lock (threadData.Sync)
                {
                    threadData.HasExited = true;
                    Monitor.PulseAll(threadData.Sync);
                }
            }
        }
    }
}


text:
import sbt._
import Keys._
import play.Project._

object ApplicationBuild extends Build {

  val appName = "playstrap"
  val appVersion = "0.0.1"

  val persistentDependencies = Seq(
    "mysql" % "mysql-connector-java" % "5.1.25",
    "org.joda" % "joda-money" % "0.9",
    "com.typesafe.play" %% "play-slick" % "0.5.0.8"
  )

  val appDependencies = Seq(
    "commons-collections" % "commons-collections" % "3.2.1",
    "org.apache.commons" % "commons-lang3" % "3.1",
    "org.apache.commons" % "commons-math3" % "3.0",
    "commons-digester" % "commons-digester" % "2.1" exclude("commons-beanutils", "commons-beanutils"),
    "commons-validator" % "commons-validator" % "1.4.0" exclude("commons-beanutils", "commons-beanutils"),
    "commons-io" % "commons-io" % "2.4",
    "jp.t2v" %% "stackable-controller" % "0.3.0",
    "jp.t2v" %% "play2-auth" % "0.11.0",
    "jp.t2v" %% "play2-auth-test" % "0.11.0" % "test",
    "org.apache.commons" % "commons-email" % "1.3.1",
    "org.ocpsoft.prettytime" % "prettytime" % "3.1.0.Final",
    "com.mohiva" %% "play-html-compressor" % "0.2-SNAPSHOT",
    "com.restfb" % "restfb" % "1.6.11",
    "com.google.http-client" % "google-http-client-jackson2" % "1.11.0-beta",
    "com.google.apis" % "google-api-services-oauth2" % "v2-rev48-1.16.0-rc"
  ) ++ persistentDependencies

  val appResolvers = Seq(
    "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
    "Sonatype Releases" at "https://oss.sonatype.org/content/repositories/releases/",
    "t2v.jp repo" at "http://www.t2v.jp/maven-repo/"
  )

  val core = play.Project(appName + "-core", appVersion, appDependencies, path = file("core")).settings(
    resolvers ++= appResolvers
  )

  val admin = play.Project(appName + "-admin", appVersion, appDependencies, path = file("admin")).settings(
    templatesImport ++= Seq(
      "model._",
      "dto._"
    ),
    resolvers ++= appResolvers
  ).dependsOn(core)

  val main = play.Project(appName, appVersion, appDependencies).settings(
    templatesImport ++= Seq(
      "model._",
      "dto._"
    ),
    resolvers ++= appResolvers
  ).dependsOn(admin).aggregate(core, admin)

}


text:
#ifndef CTKPLUGINFRAMEWORKUTIL_P_H
#define CTKPLUGINFRAMEWORKUTIL_P_H

#include <QMap>
#include <QStringList>
#include <QDir>

class ctkPluginFrameworkContext;

/**
 * \ingroup PluginFramework
 */
class ctkPluginFrameworkUtil
{
public:

  /**
   * Parse strings of format:
   *
   *   ENTRY (, ENTRY)*
   *   ENTRY = key (; key)* (; PARAM)*
   *   PARAM = attribute '=' value
   *   PARAM = directive ':=' value
   *
   * @param a Attribute being parsed
   * @param s String to parse
   * @param single If true, only allow one key per ENTRY
   * @param unique Only allow unique parameters for each ENTRY.
   * @param single_entry If true, only allow one ENTRY is allowed.
   * @return QMap<QString, QString> mapping attributes to values.
   * @exception ctkInvalidArgumentException If syntax error in input string.
   */
  static QList<QMap<QString, QStringList> > parseEntries(const QString& a, const QString& s,
                                                         bool single, bool unique, bool single_entry);

  static QString getFrameworkDir(ctkPluginFrameworkContext* ctx);

  /**
   * Check for local file storage directory.
   *
   * @param name local directory name.
   * @return A QDir object pointing to the directory. The directory is
   *         guaranteed to exist.
   * @throws ctkRuntimeException if there is no global framework storage
   *         directory or if the directory could not be created.
   */
  static QDir getFileStorage(ctkPluginFrameworkContext* ctx, const QString& name);

  /**
   * Check wildcard filter matches the string
   */
  static bool filterMatch(const QString& filter, const QString& s);

private:

  /**
   *
   */
  static bool patSubstr(const QString& s, int si, const QString& pat, int pi);

};

#include <QSharedPointer>
class ctkPlugin;

bool pluginIdLessThan(const QSharedPointer<ctkPlugin>& p1, const QSharedPointer<ctkPlugin>& p2);

#endif // CTKPLUGINFRAMEWORKUTIL_P_H


text:
#ifndef DATAFLOW_NETWORK_MODULEPORTDESCRIPTIONTAGS_H
#define DATAFLOW_NETWORK_MODULEPORTDESCRIPTIONTAGS_H

#include <boost/noncopyable.hpp>
#include <boost/static_assert.hpp>
#include <vector>
#include <Core/Datatypes/DatatypeFwd.h>
// ReSharper disable once CppUnusedIncludeDirective
#include <Core/Datatypes/Mesh/FieldFwd.h>
#include <Core/Algorithms/Base/AlgorithmFwd.h>
#include <Dataflow/Network/NetworkFwd.h>
#include <Dataflow/Network/ModuleInterface.h>
#include <Dataflow/Network/ModuleStateInterface.h>
#include <Dataflow/Network/ModuleDescription.h>
#include <Dataflow/Network/PortManager.h>
#include <Dataflow/Network/share.h>

namespace SCIRun {
namespace Modules
{
  struct SCISHARE MatrixPortTag {};
  struct SCISHARE ComplexMatrixPortTag {};
  struct SCISHARE ScalarPortTag {};
  struct SCISHARE StringPortTag {};
  struct SCISHARE FieldPortTag {};
  struct SCISHARE OsprayGeometryPortTag {};
  struct SCISHARE GeometryPortTag {};
  struct SCISHARE ColorMapPortTag {};
  struct SCISHARE BundlePortTag {};
  struct SCISHARE NrrdPortTag {};
  struct SCISHARE DatatypePortTag {};

  template <typename Base>
  struct DynamicPortTag : Base
  {
    typedef Base type;
  };

  template <typename Base>
  struct AsyncDynamicPortTag : DynamicPortTag<Base>
  {
    typedef Base type;
  };

  template <size_t N>
  struct NumInputPorts
  {
    enum { NumIPorts = N };
  };

  template <size_t N>
  struct NumOutputPorts
  {
    enum { NumOPorts = N };
  };

  struct HasNoInputPorts : NumInputPorts<0> {};
  struct HasNoOutputPorts : NumOutputPorts<0> {};

  //MEGA TODO: these will become variadic templates in VS2013
  template <class PortTypeTag>
  class Has1InputPort : public NumInputPorts<1>
  {
  public:
    static std::vector<Dataflow::Networks::InputPortDescription> inputPortDescription(const std::string& port0Name);
  };

  template <class PortTypeTag0, class PortTypeTag1>
  class Has2InputPorts : public NumInputPorts<2>
  {
  public:
    static std::vector<Dataflow::Networks::InputPortDescription> inputPortDescription(const std::string& port0Name, const std::string& port1Name)
    {
      /// @todo: use move semantics
      auto ports = Has1InputPort<PortTypeTag0>::inputPortDescription(port0Name);
      ports.push_back(Has1InputPort<PortTypeTag1>::inputPortDescription(port1Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag0, class PortTypeTag1, class PortTypeTag2>
  class Has3InputPorts : public NumInputPorts<3>
  {
  public:
    static std::vector<Dataflow::Networks::InputPortDescription> inputPortDescription(const std::string& port0Name, const std::string& port1Name, const std::string& port2Name)
    {
      auto ports = Has2InputPorts<PortTypeTag0, PortTypeTag1>::inputPortDescription(port0Name, port1Name);
      ports.push_back(Has1InputPort<PortTypeTag2>::inputPortDescription(port2Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag0, class PortTypeTag1, class PortTypeTag2, class PortTypeTag3>
  class Has4InputPorts : public NumInputPorts<4>
  {
  public:
    static std::vector<Dataflow::Networks::InputPortDescription> inputPortDescription(const std::string& port0Name, const std::string& port1Name, const std::string& port2Name, const std::string& port3Name)
    {
      auto ports = Has3InputPorts<PortTypeTag0, PortTypeTag1, PortTypeTag2>::inputPortDescription(port0Name, port1Name, port2Name);
      ports.push_back(Has1InputPort<PortTypeTag3>::inputPortDescription(port3Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag0, class PortTypeTag1, class PortTypeTag2, class PortTypeTag3, class PortTypeTag4>
  class Has5InputPorts : public NumInputPorts<5>
  {
  public:
    static std::vector<Dataflow::Networks::InputPortDescription> inputPortDescription(const std::string& port0Name, const std::string& port1Name, const std::string& port2Name, const std::string& port3Name, const std::string& port4Name)
    {
      auto ports = Has4InputPorts<PortTypeTag0, PortTypeTag1, PortTypeTag2, PortTypeTag3>::inputPortDescription(port0Name, port1Name, port2Name, port3Name);
      ports.push_back(Has1InputPort<PortTypeTag4>::inputPortDescription(port4Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag0, class PortTypeTag1, class PortTypeTag2, class PortTypeTag3, class PortTypeTag4, class PortTypeTag5>
  class Has6InputPorts : public NumInputPorts<6>
  {
  public:
    static std::vector<Dataflow::Networks::InputPortDescription> inputPortDescription(const std::string& port0Name, const std::string& port1Name, const std::string& port2Name, const std::string& port3Name, const std::string& port4Name, const std::string& port5Name)
    {
      auto ports = Has5InputPorts<PortTypeTag0, PortTypeTag1, PortTypeTag2, PortTypeTag3, PortTypeTag4>::inputPortDescription(port0Name, port1Name, port2Name, port3Name, port4Name);
      ports.push_back(Has1InputPort<PortTypeTag5>::inputPortDescription(port5Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag0, class PortTypeTag1, class PortTypeTag2, class PortTypeTag3, class PortTypeTag4, class PortTypeTag5, class PortTypeTag6>
  class Has7InputPorts : public NumInputPorts<7>
  {
  public:
    static std::vector<Dataflow::Networks::InputPortDescription> inputPortDescription(const std::string& port0Name, const std::string& port1Name, const std::string& port2Name, const std::string& port3Name, const std::string& port4Name, const std::string& port5Name, const std::string& port6Name)
    {
      auto ports = Has6InputPorts<PortTypeTag0, PortTypeTag1, PortTypeTag2, PortTypeTag3, PortTypeTag4, PortTypeTag5>::inputPortDescription(port0Name, port1Name, port2Name, port3Name, port4Name, port5Name);
      ports.push_back(Has1InputPort<PortTypeTag6>::inputPortDescription(port6Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag>
  class Has1OutputPort : public NumOutputPorts<1>
  {
  public:
    static std::vector<Dataflow::Networks::OutputPortDescription> outputPortDescription(const std::string& port0Name);
  };

  template <class PortTypeTag0, class PortTypeTag1>
  class Has2OutputPorts : public NumOutputPorts<2>
  {
  public:
    static std::vector<Dataflow::Networks::OutputPortDescription> outputPortDescription(const std::string& port0Name, const std::string& port1Name)
    {
      /// @todo: use move semantics
      auto ports = Has1OutputPort<PortTypeTag0>::outputPortDescription(port0Name);
      ports.push_back(Has1OutputPort<PortTypeTag1>::outputPortDescription(port1Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag0, class PortTypeTag1, class PortTypeTag2>
  class Has3OutputPorts : public NumOutputPorts<3>
  {
  public:
    static std::vector<Dataflow::Networks::OutputPortDescription> outputPortDescription(const std::string& port0Name, const std::string& port1Name, const std::string& port2Name)
    {
      auto ports = Has2OutputPorts<PortTypeTag0, PortTypeTag1>::outputPortDescription(port0Name, port1Name);
      ports.push_back(Has1OutputPort<PortTypeTag2>::outputPortDescription(port2Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag0, class PortTypeTag1, class PortTypeTag2, class PortTypeTag3>
  class Has4OutputPorts : public NumOutputPorts<4>
  {
  public:
    static std::vector<Dataflow::Networks::OutputPortDescription> outputPortDescription(const std::string& port0Name, const std::string& port1Name, const std::string& port2Name, const std::string& port3Name)
    {
      auto ports = Has3OutputPorts<PortTypeTag0, PortTypeTag1, PortTypeTag2>::outputPortDescription(port0Name, port1Name, port2Name);
      ports.push_back(Has1OutputPort<PortTypeTag3>::outputPortDescription(port3Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag0, class PortTypeTag1, class PortTypeTag2, class PortTypeTag3, class PortTypeTag4>
  class Has5OutputPorts : public NumOutputPorts<5>
  {
  public:
    static std::vector<Dataflow::Networks::OutputPortDescription> outputPortDescription(const std::string& port0Name, const std::string& port1Name, const std::string& port2Name, const std::string& port3Name, const std::string& port4Name)
    {
      auto ports = Has4OutputPorts<PortTypeTag0, PortTypeTag1, PortTypeTag2, PortTypeTag3>::outputPortDescription(port0Name, port1Name, port2Name, port3Name);
      ports.push_back(Has1OutputPort<PortTypeTag4>::outputPortDescription(port4Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag0, class PortTypeTag1, class PortTypeTag2, class PortTypeTag3, class PortTypeTag4, class PortTypeTag5>
  class Has6OutputPorts : public NumOutputPorts<6>
  {
  public:
    static std::vector<Dataflow::Networks::OutputPortDescription> outputPortDescription(const std::string& port0Name, const std::string& port1Name, const std::string& port2Name, const std::string& port3Name, const std::string& port4Name, const std::string& port5Name)
    {
      auto ports = Has5OutputPorts<PortTypeTag0, PortTypeTag1, PortTypeTag2, PortTypeTag3, PortTypeTag4>::outputPortDescription(port0Name, port1Name, port2Name, port3Name, port4Name);
      ports.push_back(Has1OutputPort<PortTypeTag5>::outputPortDescription(port5Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag0, class PortTypeTag1, class PortTypeTag2, class PortTypeTag3, class PortTypeTag4, class PortTypeTag5, class PortTypeTag6>
  class Has7OutputPorts : public NumOutputPorts<7>
  {
  public:
    static std::vector<Dataflow::Networks::OutputPortDescription> outputPortDescription(const std::string& port0Name, const std::string& port1Name, const std::string& port2Name, const std::string& port3Name, const std::string& port4Name, const std::string& port5Name, const std::string& port6Name)
    {
      auto ports = Has6OutputPorts<PortTypeTag0, PortTypeTag1, PortTypeTag2, PortTypeTag3, PortTypeTag4, PortTypeTag5>::outputPortDescription(port0Name, port1Name, port2Name, port3Name, port4Name, port5Name);
      ports.push_back(Has1OutputPort<PortTypeTag6>::outputPortDescription(port6Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag0, class PortTypeTag1, class PortTypeTag2, class PortTypeTag3, class PortTypeTag4, class PortTypeTag5, class PortTypeTag6, class PortTypeTag7>
  class Has8OutputPorts : public NumOutputPorts<8>
  {
  public:
    static std::vector<Dataflow::Networks::OutputPortDescription> outputPortDescription(const std::string& port0Name, const std::string& port1Name, const std::string& port2Name, const std::string& port3Name, const std::string& port4Name, const std::string& port5Name, const std::string& port6Name, const std::string& port7Name)
    {
      auto ports = Has7OutputPorts<PortTypeTag0, PortTypeTag1, PortTypeTag2, PortTypeTag3, PortTypeTag4, PortTypeTag5, PortTypeTag6>::outputPortDescription(port0Name, port1Name, port2Name, port3Name, port4Name, port5Name, port6Name);
      ports.push_back(Has1OutputPort<PortTypeTag7>::outputPortDescription(port7Name)[0]);
      return ports;
    }
  };

  template <class PortTypeTag0, class PortTypeTag1, class PortTypeTag2, class PortTypeTag3, class PortTypeTag4, class PortTypeTag5, class PortTypeTag6, class PortTypeTag7, class PortTypeTag8>
  class Has9OutputPorts : public NumOutputPorts<9>
  {
  public:
    static std::vector<Dataflow::Networks::OutputPortDescription> outputPortDescription(const std::string& port0Name, const std::string& port1Name, const std::string& port2Name, const std::string& port3Name, const std::string& port4Name, const std::string& port5Name, const std::string& port6Name, const std::string& port7Name, const std::string& port8Name)
    {
      auto ports = Has8OutputPorts<PortTypeTag0, PortTypeTag1, PortTypeTag2, PortTypeTag3, PortTypeTag4, PortTypeTag5, PortTypeTag6, PortTypeTag7>::outputPortDescription(port0Name, port1Name, port2Name, port3Name, port4Name, port5Name, port6Name, port7Name);
      ports.push_back(Has1OutputPort<PortTypeTag8>::outputPortDescription(port8Name)[0]);
      return ports;
    }
  };

#define PORT_SPEC(type)   template <>\
  class Has1InputPort<type ##PortTag> : public NumInputPorts<1>\
  {\
  public:\
    static std::vector<SCIRun::Dataflow::Networks::InputPortDescription> inputPortDescription(const std::string& port0Name)\
    {\
      std::vector<SCIRun::Dataflow::Networks::InputPortDescription> ports;\
      ports.push_back(SCIRun::Dataflow::Networks::PortDescription(SCIRun::Dataflow::Networks::PortId(0, port0Name), #type, false)); \
      return ports;\
    }\
  };\
  template <>\
  class Has1OutputPort<type ##PortTag> : public NumOutputPorts<1>\
  {\
  public:\
    static std::vector<SCIRun::Dataflow::Networks::OutputPortDescription> outputPortDescription(const std::string& port0Name)\
    {\
      std::vector<SCIRun::Dataflow::Networks::OutputPortDescription> ports;\
      ports.push_back(SCIRun::Dataflow::Networks::PortDescription(SCIRun::Dataflow::Networks::PortId(0, port0Name), #type, false)); \
      return ports;\
    }\
  };\
  template <>\
  class Has1InputPort<DynamicPortTag<type ## PortTag>> : public NumInputPorts<1>\
  {\
  public:\
    static std::vector<SCIRun::Dataflow::Networks::InputPortDescription> inputPortDescription(const std::string& port0Name)\
    {\
      std::vector<SCIRun::Dataflow::Networks::InputPortDescription> ports;\
      ports.push_back(SCIRun::Dataflow::Networks::PortDescription(SCIRun::Dataflow::Networks::PortId(0, port0Name), #type, true)); \
      return ports;\
    }\
  };\
  template <>\
  class Has1InputPort<AsyncDynamicPortTag<type ## PortTag>> : public NumInputPorts<1>\
  {\
  public:\
  static std::vector<SCIRun::Dataflow::Networks::InputPortDescription> inputPortDescription(const std::string& port0Name)\
  {\
  std::vector<SCIRun::Dataflow::Networks::InputPortDescription> ports;\
  ports.push_back(SCIRun::Dataflow::Networks::PortDescription(SCIRun::Dataflow::Networks::PortId(0, port0Name), #type, true)); \
  return ports;\
  }\
  }\

  PORT_SPEC(Matrix);
  PORT_SPEC(Scalar);
  PORT_SPEC(String);
  PORT_SPEC(Field);
  PORT_SPEC(Geometry);
  PORT_SPEC(OsprayGeometry);
  PORT_SPEC(ColorMap);
  PORT_SPEC(Bundle);
  PORT_SPEC(Nrrd);
  PORT_SPEC(ComplexMatrix);
  PORT_SPEC(Datatype);

#define ATTACH_NAMESPACE(type) Core::Datatypes::type
#define ATTACH_NAMESPACE2(type) SCIRun::Core::Datatypes::type

#define INPUT_PORT(index, name, type) static std::string inputPort ## index ## Name() { return #name; } \
  Dataflow::Networks::StaticPortName< ATTACH_NAMESPACE(type), index > name;

#define INPUT_PORT_DYNAMIC(index, name, type) static std::string inputPort ## index ## Name() { return #name; } \
  Dataflow::Networks::DynamicPortName< ATTACH_NAMESPACE(type), index > name;

#define OUTPUT_PORT(index, name, type) static std::string outputPort ## index ## Name() { return #name; } \
  Dataflow::Networks::StaticPortName< ATTACH_NAMESPACE(type), index> name;

#define INITIALIZE_PORT(nameObj) do{ nameObj.id_.name = #nameObj; }while(0);

  /// @todo: make metafunc for Input/Output

  template <size_t numPorts, class ModuleType>
  struct IPortDescriber
  {
    static std::vector<Dataflow::Networks::InputPortDescription> inputs()
    {
      return {};
    }
  };

  template <class ModuleType>
  struct IPortDescriber<1, ModuleType>
  {
    static std::vector<Dataflow::Networks::InputPortDescription> inputs()
    {
      return ModuleType::inputPortDescription(ModuleType::inputPort0Name());
    }
  };

  template <class ModuleType>
  struct IPortDescriber<2, ModuleType>
  {
    static std::vector<Dataflow::Networks::InputPortDescription> inputs()
    {
      return ModuleType::inputPortDescription(ModuleType::inputPort0Name(), ModuleType::inputPort1Name());
    }
  };

  template <class ModuleType>
  struct IPortDescriber<3, ModuleType>
  {
    static std::vector<Dataflow::Networks::InputPortDescription> inputs()
    {
      return ModuleType::inputPortDescription(ModuleType::inputPort0Name(), ModuleType::inputPort1Name(), ModuleType::inputPort2Name());
    }
  };

  template <class ModuleType>
  struct IPortDescriber<4, ModuleType>
  {
    static std::vector<Dataflow::Networks::InputPortDescription> inputs()
    {
      return ModuleType::inputPortDescription(ModuleType::inputPort0Name(), ModuleType::inputPort1Name(), ModuleType::inputPort2Name(), ModuleType::inputPort3Name());
    }
  };

  template <class ModuleType>
  struct IPortDescriber<5, ModuleType>
  {
    static std::vector<Dataflow::Networks::InputPortDescription> inputs()
    {
      return ModuleType::inputPortDescription(ModuleType::inputPort0Name(), ModuleType::inputPort1Name(), ModuleType::inputPort2Name(), ModuleType::inputPort3Name(), ModuleType::inputPort4Name());
    }
  };

  template <class ModuleType>
  struct IPortDescriber<6, ModuleType>
  {
    static std::vector<Dataflow::Networks::InputPortDescription> inputs()
    {
      return ModuleType::inputPortDescription(ModuleType::inputPort0Name(), ModuleType::inputPort1Name(), ModuleType::inputPort2Name(), ModuleType::inputPort3Name(), ModuleType::inputPort4Name(), ModuleType::inputPort5Name());
    }
  };

  template <class ModuleType>
  struct IPortDescriber<7, ModuleType>
  {
    static std::vector<Dataflow::Networks::InputPortDescription> inputs()
    {
      return ModuleType::inputPortDescription(ModuleType::inputPort0Name(), ModuleType::inputPort1Name(), ModuleType::inputPort2Name(), ModuleType::inputPort3Name(), ModuleType::inputPort4Name(), ModuleType::inputPort5Name(), ModuleType::inputPort6Name());
    }
  };

  template <class ModuleType>
  struct IPortDescriber<8, ModuleType>
  {
    static std::vector<Dataflow::Networks::InputPortDescription> inputs()
    {
      return ModuleType::inputPortDescription(ModuleType::inputPort0Name(), ModuleType::inputPort1Name(), ModuleType::inputPort2Name(), ModuleType::inputPort3Name(), ModuleType::inputPort4Name(), ModuleType::inputPort5Name(), ModuleType::inputPort6Name(), ModuleType::inputPort7Name());
    }
  };

  template <class ModuleType>
  struct IPortDescriber<9, ModuleType>
  {
    static std::vector<Dataflow::Networks::InputPortDescription> inputs()
    {
      return ModuleType::inputPortDescription(ModuleType::inputPort0Name(), ModuleType::inputPort1Name(), ModuleType::inputPort2Name(), ModuleType::inputPort3Name(), ModuleType::inputPort4Name(), ModuleType::inputPort5Name(), ModuleType::inputPort6Name(), ModuleType::inputPort7Name(), ModuleType::inputPort8Name());
    }
  };

  template <size_t numPorts, class ModuleType>
  struct OPortDescriber
  {
    static std::vector<Dataflow::Networks::OutputPortDescription> outputs()
    {
      return {};
    }
  };

  template <class ModuleType>
  struct OPortDescriber<1, ModuleType>
  {
    static std::vector<Dataflow::Networks::OutputPortDescription> outputs()
    {
      return ModuleType::outputPortDescription(ModuleType::outputPort0Name());
    }
  };

  template <class ModuleType>
  struct OPortDescriber<2, ModuleType>
  {
    static std::vector<Dataflow::Networks::OutputPortDescription> outputs()
    {
      return ModuleType::outputPortDescription(ModuleType::outputPort0Name(), ModuleType::outputPort1Name());
    }
  };

  template <class ModuleType>
  struct OPortDescriber<3, ModuleType>
  {
    static std::vector<Dataflow::Networks::OutputPortDescription> outputs()
    {
      return ModuleType::outputPortDescription(ModuleType::outputPort0Name(), ModuleType::outputPort1Name(), ModuleType::outputPort2Name());
    }
  };

  template <class ModuleType>
  struct OPortDescriber<4, ModuleType>
  {
    static std::vector<Dataflow::Networks::OutputPortDescription> outputs()
    {
      return ModuleType::outputPortDescription(ModuleType::outputPort0Name(), ModuleType::outputPort1Name(), ModuleType::outputPort2Name(), ModuleType::outputPort3Name());
    }
  };

  template <class ModuleType>
  struct OPortDescriber<5, ModuleType>
  {
    static std::vector<Dataflow::Networks::OutputPortDescription> outputs()
    {
      return ModuleType::outputPortDescription(ModuleType::outputPort0Name(), ModuleType::outputPort1Name(), ModuleType::outputPort2Name(), ModuleType::outputPort3Name(), ModuleType::outputPort4Name());
    }
  };

  template <class ModuleType>
  struct OPortDescriber<6, ModuleType>
  {
    static std::vector<Dataflow::Networks::OutputPortDescription> outputs()
    {
      return ModuleType::outputPortDescription(ModuleType::outputPort0Name(), ModuleType::outputPort1Name(), ModuleType::outputPort2Name(), ModuleType::outputPort3Name(), ModuleType::outputPort4Name(), ModuleType::outputPort5Name());
    }
  };

  template <class ModuleType>
  struct OPortDescriber<7, ModuleType>
  {
    static std::vector<Dataflow::Networks::OutputPortDescription> outputs()
    {
      return ModuleType::outputPortDescription(ModuleType::outputPort0Name(), ModuleType::outputPort1Name(), ModuleType::outputPort2Name(), ModuleType::outputPort3Name(), ModuleType::outputPort4Name(), ModuleType::outputPort5Name(), ModuleType::outputPort6Name());
    }
  };

  template <class ModuleType>
  struct OPortDescriber<8, ModuleType>
  {
    static std::vector<Dataflow::Networks::OutputPortDescription> outputs()
    {
      return ModuleType::outputPortDescription(ModuleType::outputPort0Name(), ModuleType::outputPort1Name(), ModuleType::outputPort2Name(), ModuleType::outputPort3Name(), ModuleType::outputPort4Name(), ModuleType::outputPort5Name(), ModuleType::outputPort6Name(), ModuleType::outputPort7Name());
    }
  };

  template <class ModuleType>
  struct OPortDescriber<9, ModuleType>
  {
    static std::vector<Dataflow::Networks::OutputPortDescription> outputs()
    {
      return ModuleType::outputPortDescription(ModuleType::outputPort0Name(), ModuleType::outputPort1Name(), ModuleType::outputPort2Name(), ModuleType::outputPort3Name(), ModuleType::outputPort4Name(), ModuleType::outputPort5Name(), ModuleType::outputPort6Name(), ModuleType::outputPort7Name(), ModuleType::outputPort8Name());
    }
  };

}
}

#endif


text:
import Router from 'koa-router';
import { getList, add, edit, param, del, getById } from '../controllers/interface';

const router = new Router({
  prefix: '/interface'
});

router
  .param('id', param)
  .get('/', getList)
  .get('/:id', getById)
  .post('/', add)
  .patch('/:id', edit)
  .del('/:id', del);

export default router;


text:
<?php
require_once('./config/accesscontrol.php');
require_once('./utilities.php');

// Set up/check session and get database password etc.
require_once('./config/MySQL.php');
session_start();
sessionAuthenticate();

$mysql = mysql_connect($mysql_host, $mysql_user, $mysql_password);
if (!mysql_select_db($mysql_database))
  showerror();

check_location(34, $mysql);

?>

<title>52 Weeks of Primeval</title>

<link rel="stylesheet" href="./styles/default.css" type="text/css">

<?php
print_header($mysql);

$phase = get_user_phase($mysql);
$sid_collected = check_for_character('sid', $mysql);
?>

<?php
print_standard_start($mysql);
?>

A Hot Desert

You are standing in a hot desert surrounded by diictodon burrows.

<?php

if (!$sid_collected) {
     update_users("new_character", "sid", $mysql);
     print "";
     print "
Sid is here.  He leaps out of his burrow and runs eagerly towards you.
";
}
?>


text:
@import Foundation;

@interface KiteValidationPair : NSObject <NSCopying>
@property (nonatomic, readonly) NSObject<NSCopying>* left;
@property (nonatomic, readonly) NSObject<NSCopying>* right;
+ (instancetype) pairWithLeft:(NSObject<NSCopying> *)l right:(NSObject<NSCopying> *)r;
- (instancetype) initWithLeft:(NSObject<NSCopying> *)l right:(NSObject<NSCopying> *)r;

@end


text:
package poly.collection.mut

import poly.collection._
import poly.collection.factory._
import poly.collection.typeclass._

import scala.reflect._

/**
 * Constructs a mutable set given an implicit equivalence relation on the keys.
 * The type of the resulting set is determined from the following fallback relation:
 * <ul>
 *   <li> If the key is endowed with a hashing instance ([[poly.collection.typeclass.Hash]]),
 *     the result type is [[poly.collection.mut.HashSet]]. Under this condition, the lookup complexity is amortized O(1). </li>
 *   <li> Else, if the key is endowed with a weak order ([[cats.Order]]),
 *     the result type is [[poly.collection.mut.RedBlackTreeSet]]. Under this condition, the lookup complexity is O(log ''n''). </li>
 *   <li> Else, the result type is [[poly.collection.mut.ListSet]]. Under this condition, the lookup complexity is O(''n''). </li>
 * </ul>
 *
 * @author Tongfei Chen
 * @since 0.1.0
 */
object AutoSet extends SetFactory[KeyMutableSet, Eq] {
  implicit def newSetBuilder[K](implicit K: Eq[K]): Builder[K, KeyMutableSet[K]] = K match {
    case kh: Hash[K] => HashSet.newBuilder(kh)
    case ko: Order[K]   => RedBlackTreeSet.newBuilder(ko)
    case ke             => ListSet.newBuilder(ke)
  }

  object Dense extends SetFactory[KeyMutableSet, (Eq & ClassTag)#λ] {
    implicit def newSetBuilder[K](implicit ev: Ev2[Eq, ClassTag, K]): Builder[K, KeyMutableSet[K]] = ev match {
      case Product2(intEq, ClassTag.Int)
        if intEq.isInstanceOf[cats.kernel.instances.IntOrder] // standard Int equivalence
      =>
        BitSet.newSetBuilder(evInt[K]).asInstanceOf[Builder[K, KeyMutableSet[K]]] // the cast is safe: K =:= Int
      case _
      => AutoSet.newSetBuilder(ev._1)
    }
  }
}


text:
package com.softwareverde.http.server.servlet;

import com.softwareverde.constable.bytearray.ByteArray;
import com.softwareverde.constable.bytearray.MutableByteArray;
import com.softwareverde.http.HttpRequest;
import com.softwareverde.http.HttpResponse;
import com.softwareverde.http.querystring.GetParameters;
import com.softwareverde.http.server.servlet.request.Headers;
import com.softwareverde.http.server.servlet.request.WebSocketRequest;
import com.softwareverde.http.server.servlet.response.WebSocketResponse;
import com.softwareverde.http.websocket.WebSocket;
import com.softwareverde.util.Util;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class ProxyServlet implements WebSocketServlet {
    public static class Url {
        public final String protocol;
        public final String hostname;
        public final Integer port;

        public Url(final String protocol, final String hostname, final Integer port) {
            this.protocol = protocol;
            this.hostname = hostname;
            this.port = port;
        }
    }

    protected final ConcurrentHashMap<Long, WebSocket> _proxiedWebSockets = new ConcurrentHashMap<Long, WebSocket>();
    protected final HashMap<String, Url> _proxyConfiguration = new HashMap<String, Url>();

    public ProxyServlet(final Map<String, Url> proxyConfiguration) {
        if (proxyConfiguration != null) {
            for (final String regex : proxyConfiguration.keySet()) {
                final Url proxiedUrl = proxyConfiguration.get(regex);
                _proxyConfiguration.put(regex, proxiedUrl);
            }
        }
    }

    @Override
    public WebSocketResponse onRequest(final WebSocketRequest request) {
        final HttpRequest httpRequest = new HttpRequest();

        final String serverHostname;
        {
            final Headers headers = request.getHeaders();
            if (headers.containsHeader("host")) {
                serverHostname = Util.coalesce(headers.getHeader("host").get(0));
            }
            else {
                serverHostname = request.getLocalHostInformation().resolveHostName();
            }
        }

        String url = null;
        for (final String hostnameRegex : _proxyConfiguration.keySet()) {
            final Pattern pattern = Pattern.compile(hostnameRegex);
            final Matcher matcher = pattern.matcher(serverHostname);
            if (matcher.matches()) {
                final Url proxiedUrl = _proxyConfiguration.get(hostnameRegex);
                url = (proxiedUrl.protocol + "://" + proxiedUrl.hostname + ":" + proxiedUrl.port);
                break;
            }
        }
        httpRequest.setUrl(url + request.getFilePath());

        httpRequest.setMethod(request.getMethod());
        httpRequest.setFollowsRedirects(true);
        httpRequest.setValidateSslCertificates(false);

        final Headers headers = request.getHeaders();
        for (final String headerKey : headers.getHeaderNames()) {
            String separator = "";
            final StringBuilder headerBuilder = new StringBuilder();
            for (final String headerValue : headers.getHeader(headerKey)) {
                headerBuilder.append(separator);
                headerBuilder.append(headerValue);
                separator = "; ";
            }

            httpRequest.setHeader(headerKey, headerBuilder.toString());
        }

        final GetParameters getParameters = request.getGetParameters();
        final ByteArray postData = MutableByteArray.wrap(request.getRawPostData());
        httpRequest.setQueryString(getParameters.toString());
        httpRequest.setRequestData(postData);

        final Boolean isWebSocketRequest = request.isWebSocketRequest();
        if (isWebSocketRequest) {
            httpRequest.setAllowWebSocketUpgrade(true);
        }

        final HttpResponse httpResponse = httpRequest.execute();

        final WebSocketResponse response = new WebSocketResponse();
        response.setCode(httpResponse.getResponseCode());

        final Map<String, List<String>> proxiedHeaders = httpResponse.getHeaders();
        if (proxiedHeaders != null) {
            for (final String headerKey : proxiedHeaders.keySet()) {
                for (final String headerValue : proxiedHeaders.get(headerKey)) {
                    if (headerKey != null) {
                        if (! Util.areEqual("sec-websocket-accept", headerKey.toLowerCase())) { // NOTE: Accept Headers for proxied socket should be omitted since they're handled by the upgrade...
                            response.addHeader(headerKey, headerValue);
                        }
                    }
                }
            }
        }

        if (httpResponse.didUpgradeToWebSocket()) {
            final WebSocket webSocket = httpResponse.getWebSocket();
            final Long webSocketId = webSocket.getId();

            _proxiedWebSockets.put(webSocketId, webSocket);

            response.setWebSocketId(webSocketId);
            response.upgradeToWebSocket();
        }
        else {
            final ByteArray rawResult = httpResponse.getRawResult();
            response.setContent((rawResult != null ? rawResult.getBytes() : new byte[0]));
        }

        return response;
    }

    @Override
    public void onNewWebSocket(final WebSocket externalWebSocket) {
        final WebSocket proxiedWebSocket = _proxiedWebSockets.get(externalWebSocket.getId());
        if (proxiedWebSocket == null) {
            externalWebSocket.close();
            return;
        }

        proxiedWebSocket.setMessageReceivedCallback(new WebSocket.MessageReceivedCallback() {
            @Override
            public void onMessage(final String message) {
                externalWebSocket.sendMessage(message);
            }
        });

        proxiedWebSocket.setBinaryMessageReceivedCallback(new WebSocket.BinaryMessageReceivedCallback() {
            @Override
            public void onMessage(final byte[] bytes) {
                externalWebSocket.sendMessage(bytes);
            }
        });

        proxiedWebSocket.setConnectionClosedCallback(new WebSocket.ConnectionClosedCallback() {
            @Override
            public void onClose(final int code, final String message) {
                _proxiedWebSockets.remove(externalWebSocket.getId());
                externalWebSocket.close();
            }
        });

        externalWebSocket.setMessageReceivedCallback(new WebSocket.MessageReceivedCallback() {
            @Override
            public void onMessage(final String message) {
                proxiedWebSocket.sendMessage(message);
            }
        });

        externalWebSocket.setBinaryMessageReceivedCallback(new WebSocket.BinaryMessageReceivedCallback() {
            @Override
            public void onMessage(final byte[] bytes) {
                proxiedWebSocket.sendMessage(bytes);
            }
        });

        externalWebSocket.setConnectionClosedCallback(new WebSocket.ConnectionClosedCallback() {
            @Override
            public void onClose(final int code, final String message) {
                proxiedWebSocket.close();
            }
        });

        proxiedWebSocket.startListening();
        externalWebSocket.startListening();
    }
}


text:
#ifndef TTOY_TEXT_TOY_DICTIONARY_H_
#define TTOY_TEXT_TOY_DICTIONARY_H_

#include <ttoy/textToy.h>

#include "./common/dictionary.h"

TTOY_DECLARE_DICTIONARY(ttoy_TextToy)

#endif


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Fusarium metachroum var. metachroum Appel & Wollenw.

### Remarks
null


text:
import r from 'restructure';

let GaspRange = new r.Struct({
  rangeMaxPPEM:       r.uint16,                  // Upper limit of range, in ppem
  rangeGaspBehavior:  new r.Bitfield(r.uint16, [ // Flags describing desired rasterizer behavior
    'grayscale', 'gridfit',
    'symmetricSmoothing', 'symmetricGridfit'     // only in version 1, for ClearType
  ])
});

export default new r.Struct({
  version:    r.uint16,  // set to 0
  numRanges:  r.uint16,
  gaspRanges: new r.Array(GaspRange, 'numRanges') // Sorted by ppem
});


text:
import os
import sys

from bosk.management import run_commands

if __name__ == '__main__':
    os.environ.setdefault('BOSK_SETTING_MODULE', 'project.setting')
    run_commands()


text:
/* This file is part of Lwt, released under the MIT license. See LICENSE.md for
   details, or visit https://github.com/ocsigen/lwt/blob/master/LICENSE.md. */

/* Informations:

   - this is the expected prototype of the C function [lseek]:

       off_t lseek(int fd, off_t offset, int whence)

   - these are the expected ocaml externals for this job:

       external lseek_job : Unix.file_descr -> int -> Unix.seek_command -> int Lwt_unix.job = "lwt_unix_lseek_job"
       external lseek_sync : Unix.file_descr -> int -> Unix.seek_command -> int = "lwt_unix_lseek_sync"
*/

/* Caml headers. */
#include <lwt_unix.h>
#include <caml/memory.h>
#include <caml/alloc.h>
#include <caml/fail.h>
#include <caml/signals.h>

#if !defined(LWT_ON_WINDOWS)

/* Specific headers. */
#include <errno.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>

/* +-----------------------------------------------------------------+
   | Converters                                                      |
   +-----------------------------------------------------------------+ */

/* Table mapping constructors of ocaml type Unix.seek_command to C values. */
static int seek_command_table[] = {
  /* Constructor SEEK_SET. */
  SEEK_SET,
  /* Constructor SEEK_CUR. */
  SEEK_CUR,
  /* Constructor SEEK_END. */
  SEEK_END
};

/* +-----------------------------------------------------------------+
   | Asynchronous job                                                |
   +-----------------------------------------------------------------+ */

/* Structure holding informations for calling [lseek]. */
struct job_lseek {
  /* Informations used by lwt. It must be the first field of the structure. */
  struct lwt_unix_job job;
  /* This field store the result of the call. */
  off_t result;
  /* This field store the value of [errno] after the call. */
  int errno_copy;
  /* in parameter. */
  int fd;
  /* in parameter. */
  off_t offset;
  /* in parameter. */
  int whence;
};

/* The function calling [lseek]. */
static void worker_lseek(struct job_lseek* job)
{
  /* Perform the blocking call. */
  job->result = lseek(job->fd, job->offset, job->whence);
  /* Save the value of errno. */
  job->errno_copy = errno;
}

/* The function building the caml result. */
static value result_lseek(struct job_lseek* job)
{
  value result;
  /* Check for errors. */
  if (job->result == (off_t)-1) {
    /* Save the value of errno so we can use it once the job has been freed. */
    int error = job->errno_copy;
    /* Free the job structure. */
    lwt_unix_free_job(&job->job);
    /* Raise the error. */
    unix_error(error, "lseek", Nothing);
  }
  /* Build the caml result. */
  result = Val_long(job->result);
  /* Free the job structure. */
  lwt_unix_free_job(&job->job);
  /* Return the result. */
  return result;
}

/* The function building the caml result. */
static value result_lseek_64(struct job_lseek* job)
{
  value result;
  /* Check for errors. */
  if (job->result == (off_t)-1) {
    /* Save the value of errno so we can use it once the job has been freed. */
    int error = job->errno_copy;
    /* Free the job structure. */
    lwt_unix_free_job(&job->job);
    /* Raise the error. */
    unix_error(error, "lseek", Nothing);
  }
  /* Build the caml result. */
  result = caml_copy_int64(job->result);
  /* Free the job structure. */
  lwt_unix_free_job(&job->job);
  /* Return the result. */
  return result;
}

/* The stub creating the job structure. */
CAMLprim value lwt_unix_lseek_job(value fd, value offset, value whence)
{
  /* Allocate a new job. */
  struct job_lseek* job = lwt_unix_new(struct job_lseek);
  /* Initializes function fields. */
  job->job.worker = (lwt_unix_job_worker)worker_lseek;
  job->job.result = (lwt_unix_job_result)result_lseek;
  /* Copy the fd parameter. */
  job->fd = Int_val(fd);
  /* Copy the offset parameter. */
  job->offset = Long_val(offset);
  /* Copy the whence parameter. */
  job->whence = seek_command_table[Int_val(whence)];
  /* Wrap the structure into a caml value. */
  return lwt_unix_alloc_job(&job->job);
}

/* The stub creating the job structure. */
CAMLprim value lwt_unix_lseek_64_job(value fd, value offset, value whence)
{
  /* Allocate a new job. */
  struct job_lseek* job = lwt_unix_new(struct job_lseek);
  /* Initializes function fields. */
  job->job.worker = (lwt_unix_job_worker)worker_lseek;
  job->job.result = (lwt_unix_job_result)result_lseek_64;
  /* Copy the fd parameter. */
  job->fd = Int_val(fd);
  /* Copy the offset parameter. */
  job->offset = Int64_val(offset);
  /* Copy the whence parameter. */
  job->whence = seek_command_table[Int_val(whence)];
  /* Wrap the structure into a caml value. */
  return lwt_unix_alloc_job(&job->job);
}

#else /* !defined(LWT_ON_WINDOWS) */

CAMLprim value lwt_unix_lseek_job(value Unit)
{
  lwt_unix_not_available("lseek");
  return Val_unit;
}

CAMLprim value lwt_unix_lseek_64_job(value Unit)
{
  lwt_unix_not_available("lseek");
  return Val_unit;
}

#endif /* !defined(LWT_ON_WINDOWS) */


text:
'use strict';

var app = angular.module('myApp.stats', ['ngRoute','highcharts-ng'])

app.config(['$routeProvider', function($routeProvider) {
	$routeProvider.when('/stats', {
		templateUrl: 'stats/stats.html'
	});
}])

app.controller('statsCtrl', function($scope, $http, myFactory) {
	var baseURL = 'http://localhost:4968';

	$scope.stats = {};

	$scope.options = [
	                  { label: 'All', value: 'all' },
	                  { label: 'Run Info', value: 'runInfo' }
	                  ];

	$scope.filteredStats = $scope.options[0];

	$scope.initStats = fetchStats('all');

	$scope.getStats = function(option){
		fetchStats(option.value);
	}

	$scope.chartConfig = {
			loading: true
	}

	$http.get(baseURL+'/getStats?filter=all&table='+myFactory.get()).success(function(data, status, headers, config) {
		$scope.chartConfig = {
				options: {
					chart: {
						type: 'pie'
					}
				},
				series: [{
					name: 'Number of tests',
					data: [{
						name: 'Successes',
						y : data[0].success,
						color : '#dff0d8'
					},
					{
						name: 'Failures',
						y : data[0].failure,
						color : '#f2dede'
					},
					{
						name: 'Other',
						y : data[0].other,
						color : '#fcf8e3'
					}
					]
				}],
				title: {
					text: 'Test Statuses'
				},
				loading: false
		}
	}).error(function(data, status, headers, config) {

	});

	function fetchStats(value){
		$http.get(baseURL+'/getStats?filter='+value+'&table='+myFactory.get()).success(function(data, status, headers, config) {
			$scope.stats = data;
		}).error(function(data, status, headers, config) {
			$scope.stats.filter = "Error getting the statistics";
		});
	}

});


text: from simple_mutators import KAlleleLifetimeTrackingMutator