text:
package com.opengamma.strata.pricer.bond;

import static java.time.temporal.ChronoUnit.DAYS;

import java.time.LocalDate;

import com.opengamma.strata.basics.currency.Currency;
import com.opengamma.strata.basics.currency.CurrencyAmount;
import com.opengamma.strata.collect.ArgChecker;
import com.opengamma.strata.market.explain.ExplainKey;
import com.opengamma.strata.market.explain.ExplainMapBuilder;
import com.opengamma.strata.market.sensitivity.PointSensitivityBuilder;
import com.opengamma.strata.pricer.CompoundedRateType;
import com.opengamma.strata.pricer.ZeroRateSensitivity;
import com.opengamma.strata.pricer.rate.RateComputationFn;
import com.opengamma.strata.pricer.rate.RatesProvider;
import com.opengamma.strata.product.bond.CapitalIndexedBondPaymentPeriod;
import com.opengamma.strata.product.rate.RateComputation;

/**
 * Pricer implementation for bond payment periods based on a capital indexed coupon.
 *

 * This pricer performs discounting of {@link CapitalIndexedBondPaymentPeriod}.
 */
public class DiscountingCapitalIndexedBondPaymentPeriodPricer {

  /**
   * Default implementation.
   */
  public static final DiscountingCapitalIndexedBondPaymentPeriodPricer DEFAULT =
      new DiscountingCapitalIndexedBondPaymentPeriodPricer(RateComputationFn.standard());
  /**
   * Rate observation.
   */
  private final RateComputationFn<RateComputation> rateComputationFn;

  /**
   * Creates an instance.
   *
   * @param rateComputationFn  the rate computation function
   */
  public DiscountingCapitalIndexedBondPaymentPeriodPricer(RateComputationFn<RateComputation> rateComputationFn) {
    this.rateComputationFn = ArgChecker.notNull(rateComputationFn, "rateComputationFn");
  }

  /**
   * Obtains the rate computation function.
   *
   * @return the rate computation function
   */
  public RateComputationFn<RateComputation> getRateComputationFn() {
    return rateComputationFn;
  }

  //-------------------------------------------------------------------------
  /**
   * Calculates the present value of a single payment period.
   *

   * This returns the value of the period with discounting.
   * If the payment date of the period is in the past, zero is returned.
   *
   * @param period  the period to price
   * @param ratesProvider  the rates provider, used to determine price index values
   * @param issuerDiscountFactors  the discount factor provider
   * @return the present value of the period
   */
  public double presentValue(
      CapitalIndexedBondPaymentPeriod period,
      RatesProvider ratesProvider,
      IssuerCurveDiscountFactors issuerDiscountFactors) {

    double df = issuerDiscountFactors.discountFactor(period.getPaymentDate());
    return df * forecastValue(period, ratesProvider);
  }

  /**
   * Calculates the present value of a single payment period with z-spread.
   *

   * This returns the value of the period with discounting.
   * If the payment date of the period is in the past, zero is returned.
   *
   * @param period  the period to price
   * @param ratesProvider  the rates provider, used to determine price index values
   * @param issuerDiscountFactors  the discount factor provider
   * @param zSpread  the z-spread
   * @param compoundedRateType  the compounded rate type
   * @param periodsPerYear  the number of periods per year
   * @return the present value of the period
   */
  public double presentValueWithZSpread(
      CapitalIndexedBondPaymentPeriod period,
      RatesProvider ratesProvider,
      IssuerCurveDiscountFactors issuerDiscountFactors,
      double zSpread,
      CompoundedRateType compoundedRateType,
      int periodsPerYear) {

    double df = issuerDiscountFactors.getDiscountFactors()
        .discountFactorWithSpread(period.getPaymentDate(), zSpread, compoundedRateType, periodsPerYear);
    return df * forecastValue(period, ratesProvider);
  }

  /**
   * Calculates the forecast value of a single payment period.
   *
   * @param period  the period to price
   * @param ratesProvider  the rates provider, used to determine price index values
   * @return the forecast value of the period
   */
  public double forecastValue(CapitalIndexedBondPaymentPeriod period, RatesProvider ratesProvider) {
    if (period.getPaymentDate().isBefore(ratesProvider.getValuationDate())) {
      return 0d;
    }
    double rate = rateComputationFn.rate(
        period.getRateComputation(), period.getStartDate(), period.getEndDate(), ratesProvider);
    return period.getNotional() * period.getRealCoupon() * (rate + 1d);
  }

  //-------------------------------------------------------------------------
  /**
   * Calculates the present value sensitivity of a single payment period.
   *

   * The present value sensitivity of the period is the sensitivity of the present value to
   * the underlying curves.
   *
   * @param period  the period to price
   * @param ratesProvider  the rates provider, used to determine price index values
   * @param issuerDiscountFactors  the discount factor provider
   * @return the present value curve sensitivity of the period
   */
  public PointSensitivityBuilder presentValueSensitivity(
      CapitalIndexedBondPaymentPeriod period,
      RatesProvider ratesProvider,
      IssuerCurveDiscountFactors issuerDiscountFactors) {

    if (period.getPaymentDate().isBefore(ratesProvider.getValuationDate())) {
      return PointSensitivityBuilder.none();
    }
    double rate = rateComputationFn.rate(
        period.getRateComputation(), period.getStartDate(), period.getEndDate(), ratesProvider);
    PointSensitivityBuilder rateSensi = rateComputationFn.rateSensitivity(
        period.getRateComputation(), period.getStartDate(), period.getEndDate(), ratesProvider);
    double df = issuerDiscountFactors.discountFactor(period.getPaymentDate());
    PointSensitivityBuilder dfSensi = issuerDiscountFactors.zeroRatePointSensitivity(period.getPaymentDate());
    double factor = period.getNotional() * period.getRealCoupon();
    return rateSensi.multipliedBy(df * factor).combinedWith(dfSensi.multipliedBy((rate + 1d) * factor));
  }

  /**
   * Calculates the present value sensitivity of a single payment period with z-spread.
   *

   * The present value sensitivity of the period is the sensitivity of the present value to
   * the underlying curves.
   *
   * @param period  the period to price
   * @param ratesProvider  the rates provider, used to determine price index values
   * @param issuerDiscountFactors  the discount factor provider
   * @param zSpread  the z-spread
   * @param compoundedRateType  the compounded rate type
   * @param periodsPerYear  the number of periods per year
   * @return the present value curve sensitivity of the period
   */
  public PointSensitivityBuilder presentValueSensitivityWithZSpread(
      CapitalIndexedBondPaymentPeriod period,
      RatesProvider ratesProvider,
      IssuerCurveDiscountFactors issuerDiscountFactors,
      double zSpread,
      CompoundedRateType compoundedRateType,
      int periodsPerYear) {

    if (period.getPaymentDate().isBefore(ratesProvider.getValuationDate())) {
      return PointSensitivityBuilder.none();
    }
    double rate = rateComputationFn.rate(
        period.getRateComputation(), period.getStartDate(), period.getEndDate(), ratesProvider);
    PointSensitivityBuilder rateSensi = rateComputationFn.rateSensitivity(
        period.getRateComputation(), period.getStartDate(), period.getEndDate(), ratesProvider);
    double df = issuerDiscountFactors.getDiscountFactors()
        .discountFactorWithSpread(period.getPaymentDate(), zSpread, compoundedRateType, periodsPerYear);
    ZeroRateSensitivity zeroSensi = issuerDiscountFactors.getDiscountFactors()
        .zeroRatePointSensitivityWithSpread(period.getPaymentDate(), zSpread, compoundedRateType, periodsPerYear);
    IssuerCurveZeroRateSensitivity dfSensi =
        IssuerCurveZeroRateSensitivity.of(zeroSensi, issuerDiscountFactors.getLegalEntityGroup());
    double factor = period.getNotional() * period.getRealCoupon();
    return rateSensi.multipliedBy(df * factor).combinedWith(dfSensi.multipliedBy((rate + 1d) * factor));
  }

  /**
   * Calculates the forecast value sensitivity of a single payment period.
   *

   * The forecast value sensitivity of the period is the sensitivity of the present value to
   * the underlying curves.
   *
   * @param period  the period to price
   * @param ratesProvider  the rates provider, used to determine price index values
   * @return the forecast value sensitivity of the period
   */
  public PointSensitivityBuilder forecastValueSensitivity(
      CapitalIndexedBondPaymentPeriod period,
      RatesProvider ratesProvider) {

    if (period.getPaymentDate().isBefore(ratesProvider.getValuationDate())) {
      return PointSensitivityBuilder.none();
    }
    PointSensitivityBuilder rateSensi = rateComputationFn.rateSensitivity(
        period.getRateComputation(), period.getStartDate(), period.getEndDate(), ratesProvider);
    return rateSensi.multipliedBy(period.getNotional() * period.getRealCoupon());
  }

  //-------------------------------------------------------------------------
  /**
   * Explains the present value of a single payment period.
   *

   * This adds information to the {@link ExplainMapBuilder} to aid understanding of the calculation.
   *
   * @param period  the period to price
   * @param ratesProvider  the rates provider, used to determine price index values
   * @param issuerDiscountFactors  the discount factor provider
   * @param builder  the builder to populate
   */
  public void explainPresentValue(
      CapitalIndexedBondPaymentPeriod period,
      RatesProvider ratesProvider,
      IssuerCurveDiscountFactors issuerDiscountFactors,
      ExplainMapBuilder builder) {

    Currency currency = period.getCurrency();
    LocalDate paymentDate = period.getPaymentDate();
    builder.put(ExplainKey.ENTRY_TYPE, "CapitalIndexedBondPaymentPeriod");
    builder.put(ExplainKey.PAYMENT_DATE, paymentDate);
    builder.put(ExplainKey.PAYMENT_CURRENCY, currency);
    builder.put(ExplainKey.START_DATE, period.getStartDate());
    builder.put(ExplainKey.UNADJUSTED_START_DATE, period.getUnadjustedStartDate());
    builder.put(ExplainKey.END_DATE, period.getEndDate());
    builder.put(ExplainKey.UNADJUSTED_END_DATE, period.getUnadjustedEndDate());
    builder.put(ExplainKey.DAYS, (int) DAYS.between(period.getUnadjustedStartDate(), period.getUnadjustedEndDate()));
    if (paymentDate.isBefore(ratesProvider.getValuationDate())) {
      builder.put(ExplainKey.COMPLETED, Boolean.TRUE);
      builder.put(ExplainKey.FORECAST_VALUE, CurrencyAmount.zero(currency));
      builder.put(ExplainKey.PRESENT_VALUE, CurrencyAmount.zero(currency));
    } else {
      builder.put(ExplainKey.DISCOUNT_FACTOR, issuerDiscountFactors.discountFactor(paymentDate));
      builder.put(ExplainKey.FORECAST_VALUE, CurrencyAmount.of(currency, forecastValue(period, ratesProvider)));
      builder.put(ExplainKey.PRESENT_VALUE,
          CurrencyAmount.of(currency, presentValue(period, ratesProvider, issuerDiscountFactors)));
    }
  }

  /**
   * Explains the present value of a single payment period with z-spread.
   *

   * This adds information to the {@link ExplainMapBuilder} to aid understanding of the calculation.
   *
   * @param period  the period to price
   * @param ratesProvider  the rates provider, used to determine price index values
   * @param issuerDiscountFactors  the discount factor provider
   * @param zSpread  the z-spread
   * @param compoundedRateType  the compounded rate type
   * @param periodsPerYear  the number of periods per year
   * @param builder  the builder to populate
   */
  public void explainPresentValueWithZSpread(
      CapitalIndexedBondPaymentPeriod period,
      RatesProvider ratesProvider,
      IssuerCurveDiscountFactors issuerDiscountFactors,
      ExplainMapBuilder builder,
      double zSpread,
      CompoundedRateType compoundedRateType,
      int periodsPerYear) {

    Currency currency = period.getCurrency();
    LocalDate paymentDate = period.getPaymentDate();
    builder.put(ExplainKey.ENTRY_TYPE, "CapitalIndexedBondPaymentPeriod");
    builder.put(ExplainKey.PAYMENT_DATE, paymentDate);
    builder.put(ExplainKey.PAYMENT_CURRENCY, currency);
    builder.put(ExplainKey.START_DATE, period.getStartDate());
    builder.put(ExplainKey.UNADJUSTED_START_DATE, period.getUnadjustedStartDate());
    builder.put(ExplainKey.END_DATE, period.getEndDate());
    builder.put(ExplainKey.UNADJUSTED_END_DATE, period.getUnadjustedEndDate());
    builder.put(ExplainKey.DAYS, (int) DAYS.between(period.getUnadjustedStartDate(), period.getUnadjustedEndDate()));
    if (paymentDate.isBefore(ratesProvider.getValuationDate())) {
      builder.put(ExplainKey.COMPLETED, Boolean.TRUE);
      builder.put(ExplainKey.FORECAST_VALUE, CurrencyAmount.zero(currency));
      builder.put(ExplainKey.PRESENT_VALUE, CurrencyAmount.zero(currency));
    } else {
      builder.put(ExplainKey.DISCOUNT_FACTOR, issuerDiscountFactors.discountFactor(paymentDate));
      builder.put(ExplainKey.FORECAST_VALUE, CurrencyAmount.of(currency, forecastValue(period, ratesProvider)));
      builder.put(ExplainKey.PRESENT_VALUE, CurrencyAmount.of(currency, presentValueWithZSpread(
          period, ratesProvider, issuerDiscountFactors, zSpread, compoundedRateType, periodsPerYear)));
    }
  }

}


text:
namespace content {

class WebBundleHandle;
class WebBundleReader;

// This class is used to track navigations within the Web Bundle file.
class WebBundleHandleTracker {
 public:
  WebBundleHandleTracker(scoped_refptr<WebBundleReader> reader,
                         const GURL& target_inner_url);

  WebBundleHandleTracker(const WebBundleHandleTracker&) = delete;
  WebBundleHandleTracker& operator=(const WebBundleHandleTracker&) = delete;

  ~WebBundleHandleTracker();

  // Returns a WebBundleHandle to handle the navigation request to |url|
  // if the Web Bundle file contains the matching response. Otherwise returns
  // null.
  std::unique_ptr<WebBundleHandle> MaybeCreateWebBundleHandle(
      const GURL& url,
      int frame_tree_node_id);

 private:
  scoped_refptr<WebBundleReader> reader_;
  const GURL target_inner_url_;
};

}  // namespace content

#endif  // CONTENT_BROWSER_WEB_PACKAGE_WEB_BUNDLE_HANDLE_TRACKER_H_

redpajama_set_name: RedPajamaGithub


text:
var people = (function () {
	var people = {
		init: function(name, age) {
			this.name = name;
			this.age = age;
			return this;
		},

		toString: function() {
			return this.name + ' ' + this.age;
		}
	};

	return people;
}());

var student = (function(parent) {
	var student = Object.create(parent);

	Object.defineProperties(student, {
		init: {
			value: function(name, age, study) {
				parent.init.call(this, name, age);
				this.study = study;
				return this;
			}
		},

		toString: {
			value: function() {
				var baseResult = parent.toString.call(this);
				return baseResult + ' ' + this.study;
			}
		},

		move: {
			value: function() {
				return 'I\'m moving!';
			}
		}
	});

	return student;
}(people));

var employee = (function(parent) {
	var employee = Object.create(parent);

	Object.defineProperties(employee, {
		init: {
			value: function(name, age, study, salary) {
				parent.init.call(this, name, age, study);
				this.salary = salary;
				return this;
			}
		},
		toString: {
			value: function() {
				var baseResult = parent.toString.call(this);
				return baseResult + ' ' + this.salary;
			}
		}
	});
	return employee;
}(student));

var person = Object.create(people).init('Gosho', 23);
var currStudent = Object.create(student).init('Pesho', 25, true);
var currEmployee = Object.create(employee).init('Tosho', 25, true, 2000);
console.log(person.toString());
console.log(currStudent.toString());
console.log(currEmployee.toString());
console.log(currEmployee.move());


text:
author: robmyers
comments: true
date: 2008-10-28 07:43:41+00:00
layout: post
slug: puredyne-discussion-on-netbehaviour
title: Pure:dyne Discussion on Netbehaviour
wordpress_id: 1684
categories:
- Aesthetics
- Art Computing
- Free Culture
---

[http://www.furtherfield.org/displayreview.php?review_id=322](http://www.furtherfield.org/displayreview.php?review_id=322)_**

**_

<blockquote>_
Marc invited two team members of the **GOTO10** collective, **Heather Corcoran** and **Aymeric Mansoux** to discuss about **pure:dyne** on the [Netbehaviour.org list](http://www.netbehaviour.org/)._

_
The discussion took place between October 16th - 23rd Oct 08. An
interview and an open discussion was joined by other list members of
Netbehaviour._
</blockquote>

This is an excellent insight into an art computing project.

I've now switched to pure:dyne based on this discussion.


text:
pegasos
=======
pegasos is a pure-python package for fitting SVM and logistic models using the Primal Estimated sub-GrAdient SOlver. This implementation is based on the google tool `sofia-ml`. The package has an sklearn-like interface so can easily be used with existing sklearn functionality. At each training step, the pegasos solver randomly samples a batch from the training data. The runtime of the training algorithm scales linearly with the regularization parameter `lambda` and the number of training steps; as such the model is well suited to large datasets. For details on the training algorithm see:

http://eprints.pascal-network.org/archive/00004062/01/ShalevSiSr07.pdf

API support
-----------
* sparse or dense matrix support
* binary classification (multiclass via sklearn.multiclass)
* balanced class weightings via training loops
* probabilistic predictions for logistic model
* model serialisation via cPickle

See `example.py` for how to use the library.

speed
-----
There are benchmarks against sklearn's SGDClassifier in the benchmarks folder.

```
samples   pegasos  liblinear  libsvm
------------------------------------
10^4      4.08     0.55       10.42
10^5      4.09     17.35      2638.62
10^6      4.63     230.71     *
10^7      6.87     3318.32    *
```

\* `libsvm` times are missing because the models converge sometime around the heat-death of the universe

The near-constant training time of pegasos is due to the constant number of training steps. For larger datasets the number of iterations should be increased. A grid-search on the lambda regularization parameter may also be benifical. The accuracy of the classifiers is generally ordered as `libsvm` > `liblinear` > `pegasos` but the differences are only 0.5-1%

Note that training time will increase by a constant amount for sparse matrices

build
------
Requirements are:

* scikit-learn >= 0.13.1
* numpy >= 1.7.1
* scipy >= 0.10.1

and nose for tests:

```
python setup.py nosetests
```

todo
----
* more tests
* training batches (with online learning)


text:
package org.lantern.event;

import java.net.URI;
import java.security.cert.Certificate;

public class PeerCertEvent {

    private final URI jid;
    private final Certificate cert;

    public PeerCertEvent(URI jid, Certificate cert) {
        super();
        this.jid = jid;
        this.cert = cert;
    }

    public URI getJid() {
        return jid;
    }

    public Certificate getCert() {
        return cert;
    }

}


text:
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;

namespace Avi_Movie_Player
{
    public class RIFFParser
    {
        private long totalOffset = 0;
        public AviMainHeader AviMainHeader
        {
            get;
            private set;
        }
        public AviStreamHeader VideoStreamHeader
        {
            get;
            private set;
        }
        public BitmapInfo BitmapInfo
        {
            get;
            private set;
        }
        public AviStreamHeader AudioStreamHeader
        {
            get;
            private set;
        }
        public WaveFormatEX WaveFormatEX
        {
            get;
            private set;
        }
        public AviOldIndex AviOldIndex
        {
            get;
            private set;
        }
        public long MoviIndex
        {
            get;
            private set;
        }

        public RIFFParser ()
        {
        }

        private bool findStr(ref byte[] bytes, long index, String str) {
            long index2 = index;
            bool retVal = true;
            foreach (char c in str) {
                if (bytes[index2] != c) {
                    retVal = false;
                    break;
                }
                index2++;
            }
            return retVal;
        }

        private bool shiftIndex(ref byte[] bs, int bsize, ref long index, int targetLength, ref BinaryReader reader) {
            int readSize = 0;
            int size = bs.Length;
            if (size - index < targetLength) { // bsのindex + 残りがtargetよりも小さい場合、読み込み直す
                /*
                for (int i = 0; i < size - index; i++) {
                    bs[i] = bs[index + i];
                }
                 */
                reader.BaseStream.Seek(index + totalOffset, SeekOrigin.Begin);
                reader.BaseStream.Seek(0, SeekOrigin.Current);
                bs = reader.ReadBytes(size);

                readSize = bs.Length;
                totalOffset += (readSize - (size - index));
                if (readSize == 0) { // 終了判定
                    return false;
                } else {
                    Console.WriteLine("readSize = " + readSize);
                }
                index = 0;
            }
            return true;
        }

        private void searchIndex(ref byte[] bs, int bsize, ref long index, String target, ref BinaryReader reader) {
            int size = bs.Length;
            for(;;) {
                shiftIndex(ref bs, bsize, ref index, target.Length, ref reader);

                bool result = findStr(ref bs, index , target);
                if (result == true) {
                    break;
                }
                index++;
            }
        }

        private bool shiftIndexToForward(ref byte[] bs, int bsize, ref long index, int targetLength, ref BinaryReader reader) {
            int readSize = 0;
            int size = bs.Length;
            if (size - index < targetLength) { // bsのindex + 残りがtargetよりも小さい場合、読み込み直す
                reader.BaseStream.Seek(totalOffset - size + (size - index), SeekOrigin.Begin);
                bs = reader.ReadBytes(size);

                readSize = bs.Length;
                totalOffset -= readSize - (size - index);
                if (readSize == 0) { // 終了判定
                    return false;
                } else {
                    Console.WriteLine("readSize = " + readSize);
                }
                index = 0;
            }
            return true;
        }

        private void searchIndexFromBack(ref byte[] bs, int bsize, ref long index, String target, ref BinaryReader reader) {
            int size = bs.Length;
            for(;;) {
                shiftIndexToForward(ref bs, bsize, ref index, target.Length, ref reader);

                bool result = findStr(ref bs, index , target);
                if (result == true) {
                    break;
                }
                index++;
            }
        }

        public void parse(String filePath) {
            BinaryReader reader = null;
            int offset = 0;
            try {
                reader = new BinaryReader(File.OpenRead(filePath));
                int size = 0x1000;
                long index = 0;

                reader.BaseStream.Seek(index + totalOffset, SeekOrigin.Begin);
                byte[] bs = reader.ReadBytes(size);
                int readSize = bs.Length;
                if (readSize == 0) { // 終了判定
                    return;
                }

                offset = size;
                searchIndex(ref bs, size, ref index, "avih", ref reader);
                int avihSize = 56;
                shiftIndex(ref bs, size, ref index, avihSize, ref reader);
                AviMainHeader = new AviMainHeader(ref bs, index);
                searchIndex(ref bs, size, ref index, "strh", ref reader);
                                Console.WriteLine(index + totalOffset);
                int strhSize = 56;
                shiftIndex(ref bs, size, ref index, strhSize, ref reader);
                VideoStreamHeader = new AviStreamHeader(ref bs, index);
                searchIndex(ref bs, size, ref index, "strf", ref reader);
                                Console.WriteLine(index + totalOffset);
                int bitmapInfoSize = 44 + 8;
                shiftIndex(ref bs, size, ref index, bitmapInfoSize, ref reader);
                BitmapInfo = new BitmapInfo(ref bs, index + 8);
                searchIndex(ref bs, size, ref index, "strh", ref reader);
                                Console.WriteLine(index + totalOffset);
                shiftIndex(ref bs, size, ref index, strhSize, ref reader);
                AudioStreamHeader = new AviStreamHeader(ref bs, index);
                searchIndex(ref bs, size, ref index, "strf", ref reader);
                                Console.WriteLine(index + totalOffset);
                int waveFormatSize = 24 + 8;
                shiftIndex(ref bs, size, ref index, waveFormatSize, ref reader);
                WaveFormatEX = new WaveFormatEX(ref bs, index + 8);

                Console.WriteLine("videoheader start");
                VideoStreamHeader.Print();
                Console.WriteLine("videoheader end");
                Console.WriteLine("bitmap start");
                BitmapInfo.Print();
                Console.WriteLine("bitmap end");
                Console.WriteLine("audioheader start");
                AudioStreamHeader.Print();
                Console.WriteLine("audioheader end");
                Console.WriteLine("wave start");
                WaveFormatEX.Print();
                Console.WriteLine("wave end");

                searchIndex(ref bs, size, ref index, "movi", ref reader);
                this.MoviIndex = index + totalOffset;

                FileInfo info = new FileInfo(filePath);
                long num = info.Length;
                reader.BaseStream.Seek(num - size, SeekOrigin.Begin);
                bs = reader.ReadBytes(size);
                totalOffset = num - size;
                index = 0;

                searchIndexFromBack(ref bs, size, ref index, "idx1", ref reader);
                int idxSize = 8;
                shiftIndex(ref bs, size, ref index, idxSize, ref reader);
                AviOldIndex = new AviOldIndex(ref bs, index);
                index += idxSize;
                for (;;) {
                    bool end = shiftIndex(ref bs, size, ref index, 16, ref reader);
                    if (!end) {
                         break;
                    }
                    AviOldIndex.AddEntrys(ref bs, index);
                    index += 16;
                }

             //   aviOldIndex.print();
            } finally {
                if (reader != null) {
                    reader.Close();
                    reader.Dispose();
                }
            }

        }
    }

    public class AviMainHeader {
        public String Fcc
        {
            get;
            private set;
        }
        public int Cb
        {
            get;
            private set;
        }
        public int MicroSecPerFrame
        {
            get;
            private set;
        }
        public int MaxBytesPerSec
        {
            get;
            private set;
        }
        public int PaddingGranularity
        {
            get;
            private set;
        }
        public int Flags
        {
            get;
            private set;
        }
        public int TotalFrames
        {
            get;
            private set;
        }
        public int InitialFrames
        {
            get;
            private set;
        }
        public int Streams
        {
            get;
            private set;
        }
        public int SuggestedBufferSize
        {
            get;
            private set;
        }
        public int Width
        {
            get;
            private set;
        }
        public int Height
        {
            get;
            private set;
        }

        public AviMainHeader(ref byte[] contents, long offset) {
            byte[] dwfcc = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwcb = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwMicroSecPerFrame = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwMaxBytesPerSec = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwPaddingGranularity = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwFlags = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwTotalFrames = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwInitialFrames = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwStreams = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwSuggestedBufferSize = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwWidth = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwHeight = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};

            Fcc = Encoding.ASCII.GetString(dwfcc);
            Cb = BitConverter.ToInt32(dwcb, 0);
            MicroSecPerFrame = BitConverter.ToInt32(dwMicroSecPerFrame, 0);
            MaxBytesPerSec = BitConverter.ToInt32(dwMaxBytesPerSec, 0);
            PaddingGranularity = BitConverter.ToInt32(dwPaddingGranularity, 0);
            Flags = BitConverter.ToInt32(dwFlags, 0);
            TotalFrames = BitConverter.ToInt32(dwTotalFrames, 0);
            InitialFrames = BitConverter.ToInt32(dwInitialFrames, 0);
            Streams = BitConverter.ToInt32(dwStreams, 0);
            SuggestedBufferSize = BitConverter.ToInt32(dwSuggestedBufferSize, 0);
            Width = BitConverter.ToInt32(dwWidth, 0);
            Height = BitConverter.ToInt32(dwHeight, 0);
        }

        public void Print() {
            Console.WriteLine("fcc = " + Fcc);
            Console.WriteLine("cb = " + Cb);
            Console.WriteLine("microSecPerFrame = " + MicroSecPerFrame);
            Console.WriteLine("maxBytesPerSec = " + MaxBytesPerSec);
            Console.WriteLine("paddingGranularity = " + PaddingGranularity);
            Console.WriteLine("flags = " + Flags);
            Console.WriteLine("totalFrames = " + TotalFrames);
            Console.WriteLine("itnitalFrames = " + InitialFrames);
            Console.WriteLine("streams = " + Streams);
            Console.WriteLine("suggestedBufferSize = " + SuggestedBufferSize);
            Console.WriteLine("width = " + Width);
            Console.WriteLine("height = " + Height);
        }
    }

    public class AviStreamHeader {
        public String Fcc
        {
            get;
            private set;
        }
        public int Cb
        {
            get;
            private set;
        }
        public String FccType
        {
            get;
            private set;
        }
        public int FccHandler
        {
            get;
            private set;
        }
        public int Flags
        {
            get;
            private set;
        }
        public short Priority
        {
            get;
            private set;
        }
        public short Language
        {
            get;
            private set;
        }
        public int InitialFrames
        {
            get;
            private set;
        }
        public int Scale
        {
            get;
            private set;
        }
        public int Rate
        {
            get;
            private set;
        }
        public int Start
        {
            get;
            private set;
        }
        public int Length
        {
            get;
            private set;
        }
        public int SuggetedBufferSize
        {
            get;
            private set;
        }
        public int Quality
        {
            get;
            private set;
        }
        public int SampleSize
        {
            get;
            private set;
        }
        public RcFrame RCFrame
        {
            get;
            private set;
        }

        public class RcFrame {
            public short Left
            {
                get;
                private set;
            }
            public short Top
            {
                get;
                private set;
            }
            public short Right
            {
                get;
                private set;
            }
            public short Buttom
            {
                get;
                private set;
            }

            public RcFrame(ref byte[] contents, long offset) {
                byte[] wleft = {contents[offset++], contents[offset++]};
                byte[] wtop = {contents[offset++], contents[offset++]};
                byte[] wright = {contents[offset++], contents[offset++]};
                byte[] wbottom = {contents[offset++], contents[offset++]};
                Left = BitConverter.ToInt16(wleft, 0);
                Top = BitConverter.ToInt16(wtop, 0);
                Right = BitConverter.ToInt16(wright, 0);
                Buttom = BitConverter.ToInt16(wbottom, 0);
            }
            public void Print() {
                Console.WriteLine("left = " + Left);
                Console.WriteLine("top = " + Top);
                Console.WriteLine("right = " + Right);
                Console.WriteLine("buttom = " + Buttom);
            }
        }

        public AviStreamHeader(ref byte[] contents, long offset) {
            byte[] dwfcc = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwcb = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwfccType = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwfccHandler = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwFlags = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] wPriority = {contents[offset++], contents[offset++]};
            byte[] wLanguage = {contents[offset++], contents[offset++]};
            byte[] dwInitialFrames = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwScale = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwRate = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwStart = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwLength = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwSuggestedBufferSize = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwQuality = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwSampleSize = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            this.RCFrame = new RcFrame(ref contents, offset);

            Fcc = Encoding.ASCII.GetString(dwfcc);
            Cb = BitConverter.ToInt32(dwcb, 0);
            FccType = Encoding.ASCII.GetString(dwfccType);
            FccHandler = BitConverter.ToInt32(dwfccHandler, 0);
            Flags = BitConverter.ToInt32(dwFlags, 0);
            Priority = BitConverter.ToInt16(wPriority, 0);
            Language = BitConverter.ToInt16(wLanguage, 0);
            InitialFrames = BitConverter.ToInt32(dwInitialFrames, 0);
            Scale = BitConverter.ToInt32(dwScale, 0);
            Rate = BitConverter.ToInt32(dwRate, 0);
            Start = BitConverter.ToInt32(dwStart, 0);
            Length = BitConverter.ToInt32(dwLength, 0);
            SuggetedBufferSize = BitConverter.ToInt32(dwSuggestedBufferSize, 0);
            Quality = BitConverter.ToInt32(dwQuality, 0);
            SampleSize = BitConverter.ToInt32(dwSampleSize, 0);
        }

        public void Print() {
            Console.WriteLine("fcc = " + Fcc);
            Console.WriteLine("cb = " + Cb);
            Console.WriteLine("fccType = " + FccType);
            Console.WriteLine("fccHandler = " + FccHandler);
            Console.WriteLine("flags = " + Flags);
            Console.WriteLine("priority = " + Priority);
            Console.WriteLine("language = " + Language);
            Console.WriteLine("initialFrames = " + InitialFrames);
            Console.WriteLine("scale = " + Scale);
            Console.WriteLine("rate = " + Rate);
            Console.WriteLine("start = " + Start);
            Console.WriteLine("length = " + Length);
            Console.WriteLine("suggetedBufferSize = " + SuggetedBufferSize);
            Console.WriteLine("quality = " + Quality);
            Console.WriteLine("sampleSize = " + SampleSize);
            this.RCFrame.Print();
        }
    }

    public class BitmapInfo {
        public BitmapInfoHeader BitmapHeader
        {
            get;
            private set;
        }
        public RGBQuad Rgb
        {
            get;
            private set;
        }

        public class BitmapInfoHeader {
            public int Size
            {
                get;
                private set;
            }
            public int Width
            {
                get;
                private set;
            }
            public int Height
            {
                get;
                private set;
            }
            public short Planes
            {
                get;
                private set;
            }
            public short BitCount
            {
                get;
                private set;
            }
            public int Compression
            {
                get;
                private set;
            }
            public int SizeImage
            {
                get;
                private set;
            }
            public int XPelsPerMeter
            {
                get;
                private set;
            }
            public int YPelsPerMeter
            {
                get;
                private set;
            }
            public int ClrUserd
            {
                get;
                private set;
            }
            public int ClrImportant
            {
                get;
                private set;
            }

            public BitmapInfoHeader(ref byte[] contents, long offset) {
                byte[] biSize = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
                byte[] biWidth = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
                byte[] biHeight = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
                byte[] biPlanes = {contents[offset++], contents[offset++]};
                byte[] biBitCount = {contents[offset++], contents[offset++]};
                byte[] biCompression = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
                byte[] biSizeImage = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
                byte[] biXPelsPerMeter = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
                byte[] biYPelsPerMeter = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
                byte[] biClrUsed = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
                byte[] biClrImportant = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
                Size = BitConverter.ToInt32(biSize, 0);
                Width = BitConverter.ToInt32(biWidth, 0);
                Height = BitConverter.ToInt32(biHeight, 0);
                Planes = BitConverter.ToInt16(biPlanes, 0);
                BitCount = BitConverter.ToInt16(biBitCount, 0);
                Compression = BitConverter.ToInt32(biCompression, 0);
                SizeImage = BitConverter.ToInt32(biSizeImage, 0);
                XPelsPerMeter = BitConverter.ToInt32(biXPelsPerMeter, 0);
                YPelsPerMeter = BitConverter.ToInt32(biYPelsPerMeter, 0);
                ClrUserd = BitConverter.ToInt32(biClrUsed, 0);
                ClrImportant = BitConverter.ToInt32(biClrImportant, 0);
            }

            public void Print() {
                Console.WriteLine("size = " + Size);
                Console.WriteLine("width = " + Width);
                Console.WriteLine("height = " + Height);
                Console.WriteLine("planes = " + Planes);
                Console.WriteLine("bitCount = " + BitCount);
                Console.WriteLine("compression = " + Compression);
                Console.WriteLine("sizeImage = " + SizeImage);
                Console.WriteLine("xPelsPerMeter = " + XPelsPerMeter);
                Console.WriteLine("yPelsPerMeter = " + YPelsPerMeter);
                Console.WriteLine("clrUserd = " + ClrUserd);
                Console.WriteLine("clrImportant = " + ClrImportant);
            }
        }

        public class RGBQuad {
            public byte RgbBlue
            {
                get;
                private set;
            }
            public byte RgbGreen
            {
                get;
                private set;
            }
            public byte RgbRed
            {
                get;
                private set;
            }
            public byte RgbReserved
            {
                get;
                private set;
            }

            public RGBQuad(ref byte[] contents, long offset) {
                RgbBlue = contents[offset++];
                RgbGreen = contents[offset++];
                RgbRed = contents[offset++];
                RgbReserved = contents[offset++];
            }

            public void Print() {
                Console.WriteLine("rgbBlue = " + RgbBlue);
                Console.WriteLine("rgbGreen = " + RgbGreen);
                Console.WriteLine("rgbRed = " + RgbRed);
                Console.WriteLine("rgbReserved = " + RgbReserved);

            }
        }

        public BitmapInfo(ref byte[] contents, long offset) {
            BitmapHeader = new BitmapInfoHeader(ref contents, offset);
            Rgb = new RGBQuad(ref contents, offset);
        }

        public void Print() {
            BitmapHeader.Print();
            Rgb.Print();
        }
    }

    public class WaveFormatEX {
        public short FormatTag
        {
            get;
            private set;
        }
        public short Channels
        {
            get;
            private set;
        }
        public int SamplesPerSec
        {
            get;
            private set;
        }
        public int AvgBytesPerSec
        {
            get;
            private set;
        }
        public short BlockAlign
        {
            get;
            private set;
        }
        public short BitsPerSample
        {
            get;
            private set;
        }
        public short CbSize
        {
            get;
            private set;
        }

        public WaveFormatEX(ref byte[] contents, long offset) {
            byte[] wFormatTag = {contents[offset++], contents[offset++]};
            byte[] nChannels = {contents[offset++], contents[offset++]};
            byte[] nSamplesPerSec = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] nAvgBytesPerSec = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] nBlockAlign = {contents[offset++], contents[offset++]};
            byte[] wBitsPerSample = {contents[offset++], contents[offset++]};
            byte[] wcbSize = {contents[offset++], contents[offset++]};

            FormatTag = BitConverter.ToInt16(wFormatTag, 0);
            Channels = BitConverter.ToInt16(nChannels, 0);
            SamplesPerSec = BitConverter.ToInt32(nSamplesPerSec, 0);
            AvgBytesPerSec = BitConverter.ToInt32(nAvgBytesPerSec, 0);
            BlockAlign = BitConverter.ToInt16(nBlockAlign, 0);
            BitsPerSample = BitConverter.ToInt16(wBitsPerSample, 0);
            CbSize = BitConverter.ToInt16(wcbSize, 0);
        }
        public void Print() {
            Console.WriteLine("formatTag = " + FormatTag);
            Console.WriteLine("channels = " + Channels);
            Console.WriteLine("samplesPerSec = " + SamplesPerSec);
            Console.WriteLine("avgBytesPerSec = " + AvgBytesPerSec);
            Console.WriteLine("blockAlign = " + BlockAlign);
            Console.WriteLine("bitsPerSample = " + BitsPerSample);
            Console.WriteLine("cbSize = " + CbSize);
        }
    }

    public class AviOldIndex {
        public string Fcc
        {
            get;
            private set;
        }
        public int Cb
        {
            get;
            private set;
        }
        public List<AviOldIndexEntry> VideoEntry
        {
            get;
            private set;
        }
        public List<AviOldIndexEntry> AudioEntry
        {
            get;
            private set;
        }

        public AviOldIndex(ref byte[] contents, long offset) {
            this.VideoEntry = new List<AviOldIndexEntry>();
            this.AudioEntry = new List<AviOldIndexEntry>();
            byte[] dwfcc = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwcb = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            this.Fcc = Encoding.ASCII.GetString(dwfcc);
            this.Cb = BitConverter.ToInt32(dwcb, 0);
        }

        public void AddEntrys(ref byte[] contents, long offset) {
            AviOldIndexEntry aviOldIndexEntry = new AviOldIndexEntry(ref contents, offset);
            if (aviOldIndexEntry.ChunkId.Equals("00dc")) {
                VideoEntry.Add(aviOldIndexEntry);
            } else if (aviOldIndexEntry.ChunkId.Equals("01wb")) {
                AudioEntry.Add(aviOldIndexEntry);
            }
        }

        public void Print() {
            Console.WriteLine("fcc = " + Fcc);
            Console.WriteLine("cb = " + Cb);
            foreach(AviOldIndexEntry entry in VideoEntry) {
                entry.Print();
            }
            foreach(AviOldIndexEntry entry in AudioEntry) {
                entry.Print();
            }
        }
    }

    public class AviOldIndexEntry {
        public String ChunkId
        {
            get;
            private set;
        }
        public int Flags
        {
            get;
            private set;
        }
        public int Offset
        {
            get;
            private set;
        }
        public int Size
        {
            get;
            private set;
        }

        public AviOldIndexEntry(ref byte[] contents, long offset) {
            byte[] dwChunkId = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwFlags = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwOffset = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};
            byte[] dwSize = {contents[offset++], contents[offset++], contents[offset++], contents[offset++]};

            this.ChunkId = Encoding.ASCII.GetString(dwChunkId);
            this.Flags = BitConverter.ToInt32(dwFlags, 0);
            this.Offset = BitConverter.ToInt32(dwOffset, 0);
            this.Size = BitConverter.ToInt32(dwSize, 0);
        }

        public void Print() {
            Console.WriteLine("chunkId = " + ChunkId);
            Console.WriteLine("flags = " + Flags);
            Console.WriteLine("offset = " + Offset);
            Console.WriteLine("size = " + Size);
        }
    }
}


text:
namespace RWEST.Nexus.MDM.Test
{
    using System.Configuration;
    using System.Linq;
    using System.Net;
    using System.Runtime.Serialization;

    using Microsoft.Http;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    using RWEST.Nexus.MDM.Contracts;

    using Curve = RWEST.Nexus.MDM.Curve;

    [TestClass]
    public class when_a_request_is_made_for_an_individual_mapping_for_a_curve : IntegrationTestBase
    {
        private static HttpResponseMessage response;
        private static MappingResponse mappingResponse;
        private static HttpClient client;
        private static Curve entity;
        private static CurveMapping mapping;

        [ClassInitialize]
        public static void ClassInit(TestContext context)
        {
            Because_of();
        }

        protected static void Because_of()
        {
            entity = CurveData.CreateBasicEntityWithOneMapping();
            mapping = entity.Mappings[0];
            client = new HttpClient(ServiceUrl["Curve"] + string.Format("{0}/mapping/{1}", entity.Id, mapping.Id));

            response = client.Get();
            mappingResponse = response.Content.ReadAsDataContract<Contracts.MappingResponse>();
        }

        [TestMethod]
        public void should_return_the_correct_vesrion_of_the_mapping()
        {
            Assert.AreEqual(mapping.Validity.Start, mappingResponse.Mappings[0].StartDate);
            Assert.AreEqual(mapping.Validity.Finish, mappingResponse.Mappings[0].EndDate);
            Assert.AreEqual(mapping.System.Name, mappingResponse.Mappings[0].SystemName);
            Assert.IsFalse(mappingResponse.Mappings[0].IsNexusId);
            Assert.AreEqual(mapping.Id, mappingResponse.Mappings[0].MappingId);
        }

        [TestMethod]
        public void should_return_correct_content_type()
        {
            Assert.AreEqual(ConfigurationManager.AppSettings["restReturnType"], response.Content.ContentType);
        }

        [TestMethod]
        public void should_return_status_ok()
        {
            response.StatusCode = HttpStatusCode.OK;
        }

        [TestMethod]
        public void should_return_only_one_mapping()
        {
            Assert.AreEqual(1, mappingResponse.Mappings.Count);
        }
    }
}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.labservices.models;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

/** The user lab registration state. */
public enum RegistrationState {
    /** Enum value Registered. */
    REGISTERED("Registered"),

    /** Enum value NotRegistered. */
    NOT_REGISTERED("NotRegistered");

    /** The actual serialized value for a RegistrationState instance. */
    private final String value;

    RegistrationState(String value) {
        this.value = value;
    }

    /**
     * Parses a serialized value to a RegistrationState instance.
     *
     * @param value the serialized value to parse.
     * @return the parsed RegistrationState object, or null if unable to parse.
     */
    @JsonCreator
    public static RegistrationState fromString(String value) {
        if (value == null) {
            return null;
        }
        RegistrationState[] items = RegistrationState.values();
        for (RegistrationState item : items) {
            if (item.toString().equalsIgnoreCase(value)) {
                return item;
            }
        }
        return null;
    }

    /** {@inheritDoc} */
    @JsonValue
    @Override
    public String toString() {
        return this.value;
    }
}


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

<routes xmlns="http://symfony.com/schema/routing"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">

    <route id="admin_layout" pattern="/">
        <default key="_controller">PiAppAdminBundle:Layout:index</default>
    </route>

    <route id="admin_layout_show" pattern="/{id}/show">
        <default key="_controller">PiAppAdminBundle:Layout:show</default>
    </route>

    <route id="admin_layout_new" pattern="/new">
        <default key="_controller">PiAppAdminBundle:Layout:new</default>
    </route>

    <route id="admin_layout_create" pattern="/create">
        <default key="_controller">PiAppAdminBundle:Layout:create</default>
        <requirement key="_method">post</requirement>
    </route>

    <route id="admin_layout_edit" pattern="/{id}/edit">
        <default key="_controller">PiAppAdminBundle:Layout:edit</default>
    </route>

    <route id="admin_layout_update" pattern="/{id}/update">
        <default key="_controller">PiAppAdminBundle:Layout:update</default>
        <requirement key="_method">post</requirement>
    </route>

    <route id="admin_layout_delete" pattern="/{id}/delete">
        <default key="_controller">PiAppAdminBundle:Layout:delete</default>
        <requirement key="_method">post</requirement>
    </route>

</routes>


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Hedwigia 20: (1897)

#### Original name
Capnodium crassum Pat., 1895

### Remarks
null


text:
require_relative 'orange'
require_relative 'orange_tree'

tree = OrangeTree.new

# Let seasons pass until the tree is ready to bear fruit.
tree.pass_growing_season until tree.mature?

# Report yearly harvest information for the lifetime of the tree.
until tree.dead?
  tree.pass_growing_season

  harvested_oranges = []

  while tree.has_oranges?
    harvested_oranges << tree.pick_an_orange
  end

  average_orange_diameter = # Need to calculate the average diameter for this harvest.

  # This is a heredoc, a way to create a formatted multiline string.
  # http://makandracards.com/makandra/1675-using-heredoc-for-prettier-ruby-code
  puts <<-HARVEST_REPORT.gsub(/^ {4}/, '')
    YEAR #{tree.age} REPORT
    -----------------------
    Height: #{tree.height} feet.
    Harvest: #{harvested_oranges.size} oranges with an average diameter of #{average_orange_diameter} inches.

  HARVEST_REPORT
end

puts "Alas, the tree, she is dead!"


text:
using Starcounter;
using Simplified.Ring1;

namespace Simplified.Ring6
{
    [Database]
    public class OrderShippingAddress : Something
    {
        public Order Order { get; set; }
        public string Street { get; set; }
        public string PostalCode { get; set; }
        public string City { get; set; }
        public string State { get; set; }
        public string Country { get; set; }
    }
}


text:
using DavisVantage.WeatherReader.Extensions;

namespace DavisVantage.WeatherReader.Models
{
    public class ConsoleInfo
    {
        public decimal IssBatteryStatus { get; set; }
        public decimal ConsoleBatteryVoltage { get; set; }

        public override string ToString()
        {
            return this.PrintAllProperties();
        }
    }
}


text:
/* -*- Mode: C; tab-width:4 -*- */
/* ex: set ts=4 shiftwidth=4 softtabstop=4 cindent: */

/**
 * ADS7828 Driver Module
 *
 * Gets readings from the ADS7828
 *
 *
 * \author Roy Shea (roy@cs.ucla.edu)
 * \author Mike Buchanan
 * \author Ben Jencks
 */

#include <sys_module.h>
#include <sensor.h>
// High level names of the functionality provided by the ADS7828
#include "ads7828_internal.h"
#include <led_dbg.h>

#include <ads7828.h>
#include <i2c_system.h>

////
// Module specific state and header
////

typedef struct ads7828_state ads7828_state_t;

/**
 * Sensor state.
 */
typedef struct ads7828_sensor_state {
	ads7828_state_t *mod_state;
	// Yes, it's redundant to have both sensor_id and command.
	uint8_t sensor_id;
	uint8_t command;
} ads7828_sensor_state_t;

/**
 * Module state.  Yippie skippie.
 */
struct ads7828_state {
	ads7828_sensor_state_t sensors[ADS7828_NUM_SENSORS];
	uint8_t cur_sensor;
};

/**
 * Special module message handler
 */
static int8_t ads7828_msg_handler(void *state, Message *msg);
static int8_t ads7828_control(func_cb_ptr cb, uint8_t cmd, void* sensor_state);

static uint16_t inline byteswaps(uint16_t word);

/**
 * Module header.  Um, yay.
 */
static const mod_header_t mod_header SOS_MODULE_HEADER = {
  mod_id : ADS7828_SENSOR_PID,
  state_size : sizeof(ads7828_state_t),
  num_timers : 0,
  num_sub_func : 0,
  num_prov_func : 1,
  platform_type : HW_TYPE,
  processor_type : MCU_TYPE,
  code_id : ehtons(ADS7828_SENSOR_PID),
  module_handler : ads7828_msg_handler,
  funct : {
    {ads7828_control, "cCw2", ADS7828_SENSOR_PID, SENSOR_CONTROL_FID},
  },
};

////
// Local function prototypes
////

////
// Code.  Finally, code.
////

/** Sensor control function.
 */
static int8_t ads7828_control(func_cb_ptr cb, uint8_t cmd, void* sensor_state) {
	int power_mask = THERMISTOR;
	ads7828_sensor_state_t *s = (ads7828_sensor_state_t*)sensor_state;
	HAS_CRITICAL_SECTION;
	switch (cmd) {
		case SENSOR_GET_DATA_CMD:
		// Try to reserve the I2C bus
			if (sys_i2c_reserve_bus(ADS7828_SENSOR_PID, I2C_ADDRESS,
							I2C_SYS_MASTER_FLAG | I2C_SYS_TX_FLAG) != SOS_OK) {
				return -EBUSY;
			}

			if (sys_i2c_send_data(ADS7828_I2C_ADDR,
								 &(s->command),
								 1,
								 ADS7828_SENSOR_PID) != SOS_OK) {
				sys_i2c_release_bus(ADS7828_SENSOR_PID);
				return -EBUSY;
			}
			s->mod_state->cur_sensor = s->sensor_id;
			break;

		case SENSOR_ENABLE_CMD:
			// Temporary code.
		    ENTER_CRITICAL_SECTION();
		    ADS7828_DIRECTION = ADS7828_DIRECTION | power_mask;
		    ADS7828_PORT = ADS7828_PORT | power_mask;
		    LEAVE_CRITICAL_SECTION();
			break;

		case SENSOR_DISABLE_CMD:
			// Can we turn them off?
			break;

		case SENSOR_CONFIG_CMD:
			// For now, do nothing. Perhaps we can switch to differential
			// measurements?
			// Apparently we have to free it, according to the drivers I'm
			// copying from.
			if (sensor_state != NULL) {
				sys_free(sensor_state);
			}
			break;

		default:
			return -EINVAL;
	}
	return SOS_OK;
}

/** Main message handler for ADS7828
 */
static int8_t ads7828_msg_handler(void *state, Message *msg) {

    ads7828_state_t *s = (ads7828_state_t *)state;
	int i;

    /**
     *
Types of messages handled by the ADS7828 module

     */
    switch(msg->type) {

        /**
         * \par MSG_INIT:
		 * Register all our sensors, and make states for them. Each state
		 * tells the sensor code which sensor to poll, and the command to send
		 * over I2C.
         */
		case MSG_INIT:
			// Set up a state for each sensor, giving it the appropriate
			// command, then register the sensor.
			// Yes, it's a bit hackish to iterate over an enumeration, but
			// it's better than having eight copies of the same code.
			for (i = 0; i < ADS7828_NUM_SENSORS; i++) {
				s->sensors[i].mod_state = s;
				s->sensors[i].sensor_id = i+1;

				// Rather than index into an array (which is apparently broken)
				// just use a switch.
				// s->sensors[i].command = ADS7828_SENSOR_CHANNELS[i];
				switch (i) {
					case 0:
						s->sensors[i].command = ADS7828_CH0;
						break;
					case 1:
						s->sensors[i].command = ADS7828_CH1;
						break;
					case 2:
						s->sensors[i].command = ADS7828_CH2;
						break;
					case 3:
						s->sensors[i].command = ADS7828_CH3;
						break;
					case 4:
						s->sensors[i].command = ADS7828_CH4;
						break;
					case 5:
						s->sensors[i].command = ADS7828_CH5;
						break;
					case 6:
						s->sensors[i].command = ADS7828_CH6;
						break;
					case 7:
						s->sensors[i].command = ADS7828_CH7;
						break;
				}
				// 1 1 -- Leave everything on.
				s->sensors[i].command |= (ADS7828_PD0 | ADS7828_PD1);

				sys_sensor_register(ADS7828_SENSOR_PID, i+1, SENSOR_CONTROL_FID,
						(void*)(&s->sensors[i]));
			}
			break;
		case MSG_FINAL:
			// Unregister everything. All the states are in our global state,
			// which the kernel manages for us.
			for (i = 1; i <= ADS7828_NUM_SENSORS; i++) {
				sys_sensor_deregister(ADS7828_SENSOR_PID, i);
			}
			break;
		/**
		 * Turns things on
		 */
		/*case ADS_POWER_ON:
			uint8_t* power_mask = sys_msg_take_data(msg);

		    break;*/

		/**
		 * Request has been sent.  Now read the data from the device.  The
		 * device is still reserved, so we are good to go.
		 */
		case MSG_I2C_SEND_DONE:
            // Re-reserve the I2C bus in read mode
            if(sys_i2c_reserve_bus(ADS7828_SENSOR_PID, I2C_ADDRESS,
									I2C_SYS_MASTER_FLAG) != SOS_OK) {
				return -EBUSY;
            }

			if (sys_i2c_read_data(ADS7828_I2C_ADDR, 2,
								  ADS7828_SENSOR_PID) !=SOS_OK) {
				sys_i2c_release_bus(ADS7828_SENSOR_PID);
				return -EBUSY;
			}
			break;

		/**
		 * Read the data!
		 */
		case MSG_I2C_READ_DONE:
			// Swapping byte order here because everything else seems to
			// expect it in the opposite order.
			sys_sensor_data_ready(s->cur_sensor, byteswaps(*(uint16_t*)(msg->data)), SOS_OK);
			sys_i2c_release_bus(ADS7828_SENSOR_PID);
			break;

		default:
			return -EINVAL;
	}

    return SOS_OK;
}

/*
 * Forcibly byteswap, because entohs doesn't do anything on the motes.
 */
static uint16_t inline byteswaps(uint16_t word)
{
	word = (word << 8) ^ word;
	word = (word >> 8) ^ word;
	word = (word << 8) ^ word;
	return word;
}

#ifndef _MODULE_
mod_header_ptr ads7828_get_header()
{
  return sos_get_header_address(mod_header);
}
#endif


text:
package org.joyrest.extractor.param;

public class LongVariable extends AbstractVariable<Long> {

    public static final LongVariable INSTANCE = new LongVariable();
    public static final String NAME = "long";

    private LongVariable() {
        super(NAME, Long::parseLong);
    }

}


text:
package org.apache.polygene.sample.forum.context.view;

import org.apache.polygene.api.injection.scope.Structure;
import org.apache.polygene.api.injection.scope.Uses;
import org.apache.polygene.api.unitofwork.UnitOfWorkFactory;
import org.apache.polygene.library.rest.server.api.ResourceIndex;
import org.apache.polygene.library.rest.server.api.dci.Role;
import org.apache.polygene.sample.forum.data.Moderators;
import org.apache.polygene.sample.forum.data.entity.Board;
import org.apache.polygene.sample.forum.data.entity.Forum;
import org.apache.polygene.sample.forum.data.entity.Post;
import org.apache.polygene.sample.forum.data.entity.Topic;
import org.apache.polygene.sample.forum.data.entity.User;

import static org.apache.polygene.api.property.Numbers.add;

/**
 * TODO
 */
public class ViewBoard
    implements ResourceIndex<Board>
{
    private Posting posting;
    private BoardViewer viewer;
    private BoardModeration boardModeration;
    private ForumModeration forumModeration;

    public ViewBoard bind( @Uses Forum forum, @Uses Board board, @Uses User user )
    {
        posting.bind( board );
        viewer.bind( user );
        boardModeration.bind( board );
        forumModeration.bind( forum );
        return this;
    }

    @Override
    public Board index()
    {
        return posting.self();
    }

    public Topic createTopic( String subject, String message )
    {
        return posting.createTopic( subject, message, viewer );
    }

    protected class BoardViewer
        extends Role<User>
    {
        boolean isModerator( Moderators moderators )
        {
            return moderators.moderators().contains( self );
        }
    }

    protected class BoardModeration
        extends Role<Moderators>
    {
        boolean isModerator( BoardViewer user )
        {
            return user.isModerator( self ) || forumModeration.isModerator( user );
        }
    }

    protected class ForumModeration
        extends Role<Moderators>
    {
        boolean isModerator( BoardViewer user )
        {
            return user.isModerator( self );
        }
    }

    protected class Posting
        extends Role<Board>
    {
        @Structure
        UnitOfWorkFactory uowf;

        Topic createTopic( String subject, String message, BoardViewer poster )
        {
            Topic topic = uowf.currentUnitOfWork().newEntity( Topic.class );

            topic.subject().set( subject );

            Post post = uowf.currentUnitOfWork().newEntity( Post.class );
            post.message().set( message );

            // Moderation checks
            if( boardModeration.isModerator( poster ) )
            {
                post.status().set( Post.Status.POSTED );

                self.lastPost().set( post );
                add( self.topicCount(), 1 );
                add( self.postCount(), 1 );

                return topic;
            }
            else
            {
                post.status().set( Post.Status.MODERATION );
            }

            return topic;
        }
    }
}


text:
extern ConVar mod_player_performance_value;

class C_MOD_build_map_proxy : public C_BaseEntity
{
public:
	DECLARE_CLASS( C_MOD_build_map_proxy, C_BaseEntity ); // generic entity class macro
	DECLARE_CLIENTCLASS(); // this is a client representation of a server class

public:
	// networked variables as defined in server class
	int	m_iPlayerPerformance;

	void OnDataChanged(DataUpdateType_t updateType)
	{
		Msg("C_MOD_build_map_proxy received player performance: [%d]\n", m_iPlayerPerformance);
		mod_player_performance_value.SetValue(m_iPlayerPerformance);
	}

};

//Link a global entity name to this class (name used in Hammer etc.)
LINK_ENTITY_TO_CLASS( mod_build_map_proxy, C_MOD_build_map_proxy );

// Link data table DT_MyEntity to client class and map variables (RecvProps)
// DO NOT create this in the header! Put it in the main CPP file.
IMPLEMENT_CLIENTCLASS_DT( C_MOD_build_map_proxy, DT_MOD_build_map_proxy, CMOD_build_map_proxy )
	RecvPropInt( RECVINFO( m_iPlayerPerformance ) ),
END_RECV_TABLE()


text:
package ma.wafa.cream.web.rest;

import com.codahale.metrics.annotation.Timed;
import ma.wafa.cream.domain.RefStatutProspection;
import ma.wafa.cream.repository.RefStatutProspectionRepository;
import ma.wafa.cream.repository.search.RefStatutProspectionSearchRepository;
import ma.wafa.cream.web.rest.util.HeaderUtil;
import ma.wafa.cream.web.rest.dto.RefStatutProspectionDTO;
import ma.wafa.cream.web.rest.mapper.RefStatutProspectionMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;

import javax.inject.Inject;
import javax.validation.Valid;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import java.util.stream.StreamSupport;

import static org.elasticsearch.index.query.QueryBuilders.*;

/**
 * REST controller for managing RefStatutProspection.
 */
@RestController
@RequestMapping("/api")
public class RefStatutProspectionResource {

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

    @Inject
    private RefStatutProspectionRepository refStatutProspectionRepository;

    @Inject
    private RefStatutProspectionMapper refStatutProspectionMapper;

    @Inject
    private RefStatutProspectionSearchRepository refStatutProspectionSearchRepository;

    /**
     * POST  /refStatutProspections -> Create a new refStatutProspection.
     */
    @RequestMapping(value = "/refStatutProspections",
        method = RequestMethod.POST,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    public ResponseEntity<RefStatutProspectionDTO> createRefStatutProspection(@Valid @RequestBody RefStatutProspectionDTO refStatutProspectionDTO) throws URISyntaxException {
        log.debug("REST request to save RefStatutProspection : {}", refStatutProspectionDTO);
        if (refStatutProspectionDTO.getId() != null) {
            return ResponseEntity.badRequest().headers(HeaderUtil.createFailureAlert("refStatutProspection", "idexists", "A new refStatutProspection cannot already have an ID")).body(null);
        }
        RefStatutProspection refStatutProspection = refStatutProspectionMapper.refStatutProspectionDTOToRefStatutProspection(refStatutProspectionDTO);
        refStatutProspection = refStatutProspectionRepository.save(refStatutProspection);
        RefStatutProspectionDTO result = refStatutProspectionMapper.refStatutProspectionToRefStatutProspectionDTO(refStatutProspection);
        refStatutProspectionSearchRepository.save(refStatutProspection);
        return ResponseEntity.created(new URI("/api/refStatutProspections/" + result.getId()))
            .headers(HeaderUtil.createEntityCreationAlert("refStatutProspection", result.getId().toString()))
            .body(result);
    }

    /**
     * PUT  /refStatutProspections -> Updates an existing refStatutProspection.
     */
    @RequestMapping(value = "/refStatutProspections",
        method = RequestMethod.PUT,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    public ResponseEntity<RefStatutProspectionDTO> updateRefStatutProspection(@Valid @RequestBody RefStatutProspectionDTO refStatutProspectionDTO) throws URISyntaxException {
        log.debug("REST request to update RefStatutProspection : {}", refStatutProspectionDTO);
        if (refStatutProspectionDTO.getId() == null) {
            return createRefStatutProspection(refStatutProspectionDTO);
        }
        RefStatutProspection refStatutProspection = refStatutProspectionMapper.refStatutProspectionDTOToRefStatutProspection(refStatutProspectionDTO);
        refStatutProspection = refStatutProspectionRepository.save(refStatutProspection);
        RefStatutProspectionDTO result = refStatutProspectionMapper.refStatutProspectionToRefStatutProspectionDTO(refStatutProspection);
        refStatutProspectionSearchRepository.save(refStatutProspection);
        return ResponseEntity.ok()
            .headers(HeaderUtil.createEntityUpdateAlert("refStatutProspection", refStatutProspectionDTO.getId().toString()))
            .body(result);
    }

    /**
     * GET  /refStatutProspections -> get all the refStatutProspections.
     */
    @RequestMapping(value = "/refStatutProspections",
        method = RequestMethod.GET,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    @Transactional(readOnly = true)
    public List<RefStatutProspectionDTO> getAllRefStatutProspections() {
        log.debug("REST request to get all RefStatutProspections");
        return refStatutProspectionRepository.findAll().stream()
            .map(refStatutProspectionMapper::refStatutProspectionToRefStatutProspectionDTO)
            .collect(Collectors.toCollection(LinkedList::new));
            }

    /**
     * GET  /refStatutProspections/:id -> get the "id" refStatutProspection.
     */
    @RequestMapping(value = "/refStatutProspections/{id}",
        method = RequestMethod.GET,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    public ResponseEntity<RefStatutProspectionDTO> getRefStatutProspection(@PathVariable Long id) {
        log.debug("REST request to get RefStatutProspection : {}", id);
        RefStatutProspection refStatutProspection = refStatutProspectionRepository.findOne(id);
        RefStatutProspectionDTO refStatutProspectionDTO = refStatutProspectionMapper.refStatutProspectionToRefStatutProspectionDTO(refStatutProspection);
        return Optional.ofNullable(refStatutProspectionDTO)
            .map(result -> new ResponseEntity<>(
                result,
                HttpStatus.OK))
            .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
    }

    /**
     * DELETE  /refStatutProspections/:id -> delete the "id" refStatutProspection.
     */
    @RequestMapping(value = "/refStatutProspections/{id}",
        method = RequestMethod.DELETE,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    public ResponseEntity<Void> deleteRefStatutProspection(@PathVariable Long id) {
        log.debug("REST request to delete RefStatutProspection : {}", id);
        refStatutProspectionRepository.delete(id);
        refStatutProspectionSearchRepository.delete(id);
        return ResponseEntity.ok().headers(HeaderUtil.createEntityDeletionAlert("refStatutProspection", id.toString())).build();
    }

    /**
     * SEARCH  /_search/refStatutProspections/:query -> search for the refStatutProspection corresponding
     * to the query.
     */
    @RequestMapping(value = "/_search/refStatutProspections/{query}",
        method = RequestMethod.GET,
        produces = MediaType.APPLICATION_JSON_VALUE)
    @Timed
    public List<RefStatutProspectionDTO> searchRefStatutProspections(@PathVariable String query) {
        log.debug("REST request to search RefStatutProspections for query {}", query);
        return StreamSupport
            .stream(refStatutProspectionSearchRepository.search(queryStringQuery(query)).spliterator(), false)
            .map(refStatutProspectionMapper::refStatutProspectionToRefStatutProspectionDTO)
            .collect(Collectors.toList());
    }
}


text:
import { GameInfo, GameInfoFactory, Player } from "../main";
export declare enum TimvTeam {
    INNOCENT = 0,
    TRAITOR = 1,
}
export declare function timvTeamFromText(text: string): TimvTeam;
export declare class TimvGameInfo extends GameInfo {
    readonly winningTeam: TimvTeam;
    readonly innocent: Player[];
    readonly detective: Player[];
    readonly traitor: Player[];
    constructor(gameEvents: any, server: any, endTime: any, startTime: any, map: any, winningTeam: TimvTeam, innocent: Player[], detective: Player[], traitor: Player[]);
}
export declare class TimvGameInfoFactory extends GameInfoFactory<TimvGameInfo> {
    protected _winningTeam: TimvTeam;
    protected _innocent: Player[];
    protected _detective: Player[];
    protected _traitor: Player[];
    create(): TimvGameInfo;
    fromResponse(res: any): TimvGameInfoFactory;
    winningTeam(winningTeam: TimvTeam): this;
    innocent(innocent: Player[]): this;
    detective(detective: Player[]): this;
    traitor(traitor: Player[]): this;
}


text:
<!DOCTYPE html>

		<title>Custom Target Drag Marker</title>
		<link rel="stylesheet" href="../../../codebase/webix.css" type="text/css" charset="utf-8">

		<link rel="stylesheet" type="text/css" href="../common/samples.css">

Custom target drag marker

Drag items from the 1st to 2nd tree.


text:
"""
Hash utilities for cuckoo filters to generate fingerprints.

Generate FNV64 hash based on http://isthe.com/chongo/tech/comp/fnv/
"""

FNV64_OFFSET_BASIS = 0xcbf29ce484222325
FNV64_PRIME = 0x100000001b3
MAX_64_INT = 2 ** 64
MAX_32_INT = 2 ** 32

def _fnv64(data):
    """
    Generate FNV64 hash for data in bytes

    :param data: Data to generate FNV hash for
    """
    assert isinstance(data, str)

    h = FNV64_OFFSET_BASIS
    for byte in data.encode():
        h = (h * FNV64_PRIME) % MAX_64_INT
        h ^= byte
    return abs(h)

def _int_to_bytes(x):
    return x.to_bytes((x.bit_length() + 7) // 8, byteorder='big')

def _bytes_to_int(x):
    return int.from_bytes(x, byteorder='big')

def fingerprint(data, size):
    """
    Get fingerprint of a string using FNV 64-bit hash and truncate it to
    'size' bytes.

    :param data: Data to get fingerprint for
    :param size: Size in bytes to truncate the fingerprint
    :return: fingerprint of 'size' bytes
    """
    fp = _int_to_bytes(_fnv64(data))
    return _bytes_to_int(fp[:size])

def hash_code(data):
    """Generate hash code using builtin hash() function.

    :param data: Data to generate hash code for
    """
    # h = 0
    # for c in data:
    #     h = (ord(c) + (31 * h)) % MAX_32_INT
    # return h
    return abs(hash(data))


text:
namespace Algorithms.Core.Context
{
    /// <summary>
    /// internal nodes: only use key and next
    /// external nodes: only use key and value
    /// </summary>
    /// <typeparam name="TKey"></typeparam>
    /// <typeparam name="TValue"></typeparam>
    public class Entry<TKey, TValue> where TKey : class where TValue : class
    {
        public TKey Key { get; set; }
        public TValue Value { get; }
        public Node<TKey, TValue> Next { get; set; }  // helper field to iterate over array entries

        public Entry(TKey key, TValue value, Node<TKey, TValue> next)
        {
            Key = key;
            Value = value;
            Next = next;
        }

    }
}


text:
package com.netflix.nicobar.core.archive;

import java.io.IOException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.Set;

import javax.annotation.Nullable;

/**
 * Data object which represents a bundle of scripts and associated resources.
 * Also contains a {@link ScriptModuleSpec} to describe how this archive
 * is to be converted into a module, and optionally, a set of deploy specs that
 * describes deploy data useful in operating the module.
 *
 * @author James Kojo
 * @author Vasanth Asokan
 */
public interface ScriptArchive {

    /**
     * @return the module spec for this archive
     */
    public ScriptModuleSpec getModuleSpec();

    /**
     * Set the module spec for this archive.
     * This will override an already set module spec.
     * @param spec the module spec to set to.
     */
    public void setModuleSpec(ScriptModuleSpec spec);

    /**
     * @return {@link URL}s representing the contents of this archive. should be
     * suitable for passing to a {@link URLClassLoader}
     */
    @Nullable
    public URL getRootUrl();

    /**
     * @return relative path names of all the entries in the script archive.
     */
    public Set<String> getArchiveEntryNames();

    /**
     * @return a URL to the resource.
     * @throws IOException
     */
    @Nullable
    public URL getEntry(String entryName) throws IOException;

    /**
     * Timestamp used to resolve multiple revisions of the archive. If multiple archives
     * are submitted with the same moduleId, only the one with the highest timestamp will be used.
     */
    public long getCreateTime();
}


text:
package org.qi4j.library.eventsourcing.domain.source.helper;

import org.qi4j.api.configuration.Configuration;
import org.qi4j.io.Output;
import org.qi4j.io.Transforms;
import org.qi4j.library.eventsourcing.domain.api.UnitOfWorkDomainEventsValue;
import org.qi4j.library.eventsourcing.domain.source.EventSource;
import org.qi4j.library.eventsourcing.domain.source.EventStream;
import org.qi4j.library.eventsourcing.domain.source.UnitOfWorkEventsListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Helper that enables a service to easily track transactions.
 *

 * Upon startup
 * the tracker will get all the transactions from the store since the last
 * check, and delegate them to the given Output. It will also register itself
 * with the store so that it can get continuous updates.
 *

 *

 * Then, as transactions come in from the store, they will be processed in real-time.
 * If a transaction is successfully handled the configuration of the service, which must
 * extend DomainEventTrackerConfiguration, will update the marker for the last successfully handled transaction.
 *

 */
public class DomainEventTracker
        implements Runnable, UnitOfWorkEventsListener
{
    private Configuration<? extends DomainEventTrackerConfiguration> configuration;
    private final Output<UnitOfWorkDomainEventsValue, ? extends Throwable> output;
    private EventStream stream;
    private EventSource source;
    private boolean started = false;
    private Logger logger;

    public DomainEventTracker( EventStream stream, EventSource source,
                               Configuration<? extends DomainEventTrackerConfiguration> configuration,
                               Output<UnitOfWorkDomainEventsValue, ? extends Throwable> output )
    {
        this.stream = stream;
        this.configuration = configuration;
        this.output = output;
        this.source = source;

        logger = LoggerFactory.getLogger( configuration.get().identity().get() );
    }

    public synchronized void start()
    {
        if (!started)
        {
            started = true;

            run();

            stream.registerListener( this );
        }
    }

    public synchronized void stop()
    {
        if (started)
        {
            started = false;
            stream.unregisterListener( this );
        }
    }

    @Override
    public synchronized void run()
    {
        // TODO This should optionally use a CircuitBreaker
        if (started && configuration.get().enabled().get())
        {
            Transforms.Counter counter = new Transforms.Counter();
            try
            {
                long currentOffset = configuration.get().lastOffset().get();
                source.events( currentOffset, Long.MAX_VALUE ).transferTo( Transforms.map( counter, output ) );

                // Save new offset, to be used in next round
                configuration.get().lastOffset().set( currentOffset+counter.count() );
                configuration.save();
            } catch (Throwable throwable)
            {
                logger.warn( "Event handling failed", throwable );
            }
        }
    }

    @Override
    public void notifyTransactions( Iterable<UnitOfWorkDomainEventsValue> transactions )
    {
        run();
    }
}


text:
function processPlots(config){
    var toAppend = [];
    var navConfig = {};
    var plotData = {};
    var sectionMap = {};
    $.each(config.sections, function(idx, section){
        section.id = uniqID.get(section.label.toLowerCase());
        section.id = section.id.replace(/ /g, '_');

        //add to nav panel
        navConfig[section.label] = navConfig[section.label] || {label: section.label, id: section.id, children: []};

        //create div for section
        if (!sectionMap[section.label]){
            sectionMap[section.label] = section;
        }

        $.each(section.reports, function(idx, r){
            r.id = uniqID.get(r.label.toLowerCase());
            r.id = r.id.replace(/ /g, '_');
            r.plotDivId = r.id + '_plot';
            r.sectionLabel = section.label;

            //add to NavPanel
            navConfig[section.label].children.push({
                id: r.id,
                label: r.label
            });

            //merge for nav panel
            r.data.config = r.data.config || {};
            r.data.config.id = r.plotDivId;
            plotData[r.plotDivId] = r.data;
        });
    });

    $('div.mainpage').append(toAppend);
    updateNavPanel(navConfig, sectionMap);

    window.mqc_compressed_plotdata = mqc_compressed_plotdata = plotData;
}

function updateNavPanel(navConfig, sectionMap){
    var toAppend = [];
    $.each(navConfig, function(key, val){
        var newEl = $('

', {
            html: '' + val.label + '

'
        });

        newEl.click(function(){
            var sectionDiv = buildSectionDiv(sectionMap[val.label]);
            $.each(sectionMap[val.label].reports, function (idx, r) {
                //make plot div
                buildReportDiv(sectionDiv.get(1), r);
            });
            $('div #section_wrapper').empty();
            $('div #section_wrapper').append(sectionDiv);

            render_plots();
            render_tables();
            configure_toolbox();
        });

        if (val.children.length > 1) {
            $.each(val.children, function (idx, child) {
                var el = $('
', {
                    html: '' + child.label + ''
                });
                newEl.find('ul').append(el);
            });
        }

        toAppend.push(newEl);
    });

    $('ul.mqc-nav').append(toAppend);
}

function buildSectionDiv(section){
    var sectionId = section.id || '';
    var sectionLabel = section.label || '';
    var descriptionHTML = section.descriptionHTML || '';

    var html = '
' +
        '
' +
        '
' + sectionLabel + '
' +
        '
' + descriptionHTML + '
' +
        '
';

    return $(html);
}

function buildReportDiv(parentDiv, config) {
    var buttonCfg = '';
    switch (config.data.plot_type) {
        case 'xy_line':
            buttonCfg = '<button class="btn btn-default btn-sm active" data-action="set_data" data-ylab="Count"  data-newdata="0" data-target="' + config.plotDivId + '">Counts</button>' +
                '<button class="btn btn-default btn-sm " data-action="set_data" data-ylab="Observed / Expected"  data-newdata="1" data-target="' + config.plotDivId + '">Obs/Exp</button>';
            return buildPlotDiv(parentDiv, config, 'hc-line-plot', buttonCfg);
        case 'bar_graph':
            buttonCfg = '<button class="btn btn-default btn-sm active" data-action="set_numbers" data-target="' + config.plotDivId + '" data-ylab="Number of Reads">Number of Reads</button>' +
                '<button class="btn btn-default btn-sm " data-action="set_percent" data-target="' + config.plotDivId + '" data-ylab="Percentages">Percentages</button>';
            return buildPlotDiv(parentDiv, config, 'hc-bar-plot', buttonCfg);
        case 'data_table':
            return buildTableDiv(parentDiv, config);

        //default:
        //    throw 'Unknown type: ' + config.data.plot_type;
    }
}

function buildPlotDiv(parentDiv, config, plotType, buttonCfg){
    var html = '

' + config.label + '
' +
        '
Section: ' + config.sectionLabel + '
'+
        '
' +
        '
' + buttonCfg + '
' +
        '
' +
        '
loading..
' +
        '
' +
        '
';

    $(parentDiv).append($(html));
}

function buildTableDiv(parentDiv, config){
    var html = generateTableHtml(config);
    $(parentDiv).append($(html));
}

var uniqID = {
    counter:0,
    get:function(prefix) {
        if(!prefix) {
            prefix = "uniqid";
        }
        var id =  prefix+""+uniqID.counter++;
        id = id.replace(/ /g, '_');
        id = id.replace(/\//g, '_');

        if($("#"+id).length == 0)
            return id;
        else
            return uniqID.get()
    }
};


text:
package nu.validator.htmlparser.annotation;

/**
 * Marks a method as virtualy in C++.
 *
 * @version $Id$
 * @author hsivonen
 */
public @interface Virtual {

}


text:
package org.jetbrains.plugins.scala
package lang
package psi
package impl
package expr
package xml

import org.jetbrains.plugins.scala.lang.psi.ScalaPsiElementImpl
import com.intellij.lang.ASTNode
import api.ScalaElementVisitor
import com.intellij.psi._
import org.jetbrains.plugins.scala.lang.psi.api.expr.xml._
import collection.mutable.ArrayBuffer
import api.base.patterns.{ScPatterns, ScPattern}
import types.{ScDesignatorType, ScType}
import types.result.{Success, Failure, TypeResult, TypingContext}

/**
* @author Alexander Podkhalyuzin
* Date: 21.04.2008
*/

class ScXmlPatternImpl(node: ASTNode) extends ScalaPsiElementImpl (node) with ScXmlPattern {
  override def accept(visitor: PsiElementVisitor) {
    visitor match {
      case visitor: ScalaElementVisitor => super.accept(visitor)
      case _ => super.accept(visitor)
    }
  }

  override def subpatterns: Seq[ScPattern] = {
    val pattBuff: ArrayBuffer[ScPattern] = new ArrayBuffer[ScPattern]
    pattBuff ++= super.subpatterns
    val args = findChildrenByClassScala(classOf[ScPatterns])
    for (arg <- args) {
      pattBuff ++= arg.patterns
    }
    pattBuff.toSeq
  }

  override def toString: String = "XmlPattern"

  override def getType(ctx: TypingContext): TypeResult[ScType] = {
    val clazz = ScalaPsiManager.instance(getProject).getCachedClass(getResolveScope, "scala.xml.Node")
    if (clazz == null) return Failure("not found scala.xml.Node", Some(this))
    Success(ScDesignatorType(clazz), Some(this))
  }
}


text:
package br.com.modoagil.asr.repository.support;

import java.io.Serializable;

import javax.persistence.EntityManager;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.NoRepositoryBean;

import br.com.modoagil.asr.model.support.AbstractEntity;

/**
 * Repositório genérico para extender recursos do Spring Data, para queries ou métodos mais elaborados
 *
 * @created 17/12/2014
 * @author Bruno César Ribeiro e Silva - bruno@brunocesar.com
 * @see JpaRepository
 */
@NoRepositoryBean
public interface GenericRepository<E extends AbstractEntity, PK extends Serializable> extends JpaRepository<E, PK>,
        JpaSpecificationExecutor<E> {

    /**
     * Recupera o {@link EntityManager}
     *
     * @return {@link EntityManager}
     */
    EntityManager getEntityManager();

}


text:
package io.bxbxbai.zhuanlan.activity;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v7.widget.SearchView;
import android.view.MenuItem;

public class SearchActivity extends FragmentActivity {
    private SearchView searchView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            case android.R.id.home:
                onBackPressed();
                return true;
            default:
                return super.onOptionsItemSelected(item);
        }
    }
}


text:
'use strict';

describe('movieInfo.view1 module', function() {

  beforeEach(module('movieInfo.view1'));

  describe('view1 controller', function(){

    it('should ....', inject(function($controller) {
      //spec body
      var view1Ctrl = $controller('View1Ctrl');
      expect(view1Ctrl).toBeDefined();
    }));

  });
});


text:
// Wait till the browser is ready to render the game (avoids glitches)
window.requestAnimationFrame(function () {
  /* For debugging */ window.game = /* remove later */ new GameManager(4, KeyboardInputManager, HTMLActuator, LocalStorageManager);
});


text:
/*eslint-env node */
/*eslint strict: ["error", "global"], no-console: 0 */

'use strict';

function main() {
    const {v4: uuidv4}  = require('uuid');

    const uuid = uuidv4();
    console.log(uuid);
}

main();


text:
title: Project Name
subtitle: Lorem ipsum dolor sit amet consectetur.
image: https://raw.githubusercontent.com/BlackrockDigital/startbootstrap-agency/master/src/assets/img/portfolio/05-full.jpg
alt:

caption:
  title: Southwest
  subtitle: Website Design
  thumbnail: assets/img/portfolio/05-thumbnail.jpg
---
Use this area to describe your project. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Est blanditiis dolorem culpa incidunt minus dignissimos deserunt repellat aperiam quasi sunt officia expedita beatae cupiditate, maiores repudiandae, nostrum, reiciendis facere nemo!

{:.list-inline}
- Date: October 2019
- Client: Southwest
- Category: Website Design


text:
interface Animal { animal: {} };
interface Dog extends Animal { dog: {} }
interface Cat extends Animal { cat: {} }
interface Moose extends Animal { moose: {} }

function doThing(x: "dog"): Dog;
function doThing(x: "cat"): Cat;
function doThing(x: string): Animal;
function doThing(x: string, y?: string): Moose {
    return undefined;
}

//// [stringLiteralTypesOverloads05.js]
;
function doThing(x, y) {
    return undefined;
}

//// [stringLiteralTypesOverloads05.d.ts]
interface Animal {
    animal: {};
}
interface Dog extends Animal {
    dog: {};
}
interface Cat extends Animal {
    cat: {};
}
interface Moose extends Animal {
    moose: {};
}
declare function doThing(x: "dog"): Dog;
declare function doThing(x: "cat"): Cat;
declare function doThing(x: string): Animal;