text:
package net.imagej.ops.threshold.maxEntropy;

import net.imagej.ops.Ops;
import net.imagej.ops.threshold.AbstractComputeThresholdHistogram;
import net.imglib2.histogram.Histogram1d;
import net.imglib2.type.numeric.RealType;

import org.scijava.Priority;
import org.scijava.plugin.Plugin;

// NB - this plugin adapted from Gabriel Landini's code of his AutoThreshold
// plugin found in Fiji (version 1.14).

/**
 * Implements Kapur-Sahoo-Wong (Maximum Entropy) thresholding method.
 *
 * @author Barry DeZonia
 * @author Gabriel Landini
 */
@Plugin(type = Ops.Threshold.MaxEntropy.class, priority = Priority.HIGH_PRIORITY)
public class ComputeMaxEntropyThreshold<T extends RealType<T>> extends
		AbstractComputeThresholdHistogram<T> implements Ops.Threshold.MaxEntropy {

	@Override
	public long computeBin(final Histogram1d<T> hist) {
		long[] histogram = hist.toLongArray();
		// Implements Kapur-Sahoo-Wong (Maximum Entropy) thresholding method
		// Kapur J.N., Sahoo P.K., and Wong A.K.C. (1985) "A New Method for
		// Gray-Level Picture Thresholding Using the Entropy of the Histogram"
		// Graphical Models and Image Processing, 29(3): 273-285
		// M. Emre Celebi
		// 06.15.2007
		// Ported to ImageJ plugin by G.Landini from E Celebi's fourier_0.8
		// routines
		int threshold = -1;
		int ih, it;
		int first_bin;
		int last_bin;
		double tot_ent; /* total entropy */
		double max_ent; /* max entropy */
		double ent_back; /* entropy of the background pixels at a given threshold */
		double ent_obj; /* entropy of the object pixels at a given threshold */
		double[] norm_histo = new double[histogram.length]; /*
															 * normalized
															 * histogram
															 */
		double[] P1 = new double[histogram.length]; /*
													 * cumulative normalized
													 * histogram
													 */
		double[] P2 = new double[histogram.length];

		int total = 0;
		for (ih = 0; ih < histogram.length; ih++)
			total += histogram[ih];

		for (ih = 0; ih < histogram.length; ih++)
			norm_histo[ih] = (double) histogram[ih] / total;

		P1[0] = norm_histo[0];
		P2[0] = 1.0 - P1[0];
		for (ih = 1; ih < histogram.length; ih++) {
			P1[ih] = P1[ih - 1] + norm_histo[ih];
			P2[ih] = 1.0 - P1[ih];
		}

		/* Determine the first non-zero bin */
		first_bin = 0;
		for (ih = 0; ih < histogram.length; ih++) {
			if (!(Math.abs(P1[ih]) < 2.220446049250313E-16)) {
				first_bin = ih;
				break;
			}
		}

		/* Determine the last non-zero bin */
		last_bin = histogram.length - 1;
		for (ih = histogram.length - 1; ih >= first_bin; ih--) {
			if (!(Math.abs(P2[ih]) < 2.220446049250313E-16)) {
				last_bin = ih;
				break;
			}
		}

		// Calculate the total entropy each gray-level
		// and find the threshold that maximizes it
		max_ent = Double.NEGATIVE_INFINITY;

		for (it = first_bin; it <= last_bin; it++) {
			/* Entropy of the background pixels */
			ent_back = 0.0;
			for (ih = 0; ih <= it; ih++) {
				if (histogram[ih] != 0) {
					ent_back -= (norm_histo[ih] / P1[it])
							* Math.log(norm_histo[ih] / P1[it]);
				}
			}

			/* Entropy of the object pixels */
			ent_obj = 0.0;
			for (ih = it + 1; ih < histogram.length; ih++) {
				if (histogram[ih] != 0) {
					ent_obj -= (norm_histo[ih] / P2[it])
							* Math.log(norm_histo[ih] / P2[it]);
				}
			}

			/* Total entropy */
			tot_ent = ent_back + ent_obj;

			// IJ.log(""+max_ent+"  "+tot_ent);
			if (max_ent < tot_ent) {
				max_ent = tot_ent;
				threshold = it;
			}
		}
		return threshold;
	}

}


text:
var animationDelay = 3200;
var flickerInterval = 500;
var tickerAnimationTimer = null;
var wobbleAnimationTimer = null;
var flickerAnimationTimer = null;

// Clears the given timer
function clearTimer(timer) {
  if (timer) {
    clearTimeout(timer);
    timer = null;
  }
}

// Returns given element or null
function getElement(elementId) {
  return document.getElementById(elementId);
}

// Add or remove the given class to an element
function addClassToElement(className, elementId, add) {
  var element = getElement(elementId);
  if (element !== null) {
    if (add) {
      element.classList.add(className);
    } else {
      element.classList.remove(className);
    }
  }
}

// Called after page load
function onLoad() {
  startAnimations(animationDelay);
}

// Start ticker, noise & wobble animations
function startAnimations(animationDelay) {
  tickerAnimationTimer = setTimeout(function () { enableTickerAnimation(true); }, animationDelay);
  wobbleAnimationTimer = setTimeout(function () { enableWobbleAnimation(true); }, animationDelay);
  flickerAnimationTimer = setTimeout(function () { startFlickerAnimation(); }, animationDelay);
}

// Toggle the animation of the tickerText
function enableTickerAnimation(start) {
  addClassToElement("tickerMove", "tickerText", start);
  showNewsTicker(start);
}

// Show/hide tickerText (toggle color)
function showNewsTicker(visible) {
  var element = getElement("tickerText");
  if (element !== null) {
    if (visible) {
      element.style.color = "white";
    } else {
      element.style.color = "black";
    }
  }
}

// Add the wobble class to content
function enableWobbleAnimation(start) {
  addClassToElement("wobble", "content", start);
}

// Start the flickering animation (random start/stop noise animation)
function startFlickerAnimation() {
  enableNoiseAnimation(true);
  flickerAnimationTimer = setTimeout(function () { restartFlickerAnimation(); }, Math.random() * flickerInterval);
}

// Stops and restarts flickering noise animation after random timeout
function restartFlickerAnimation() {
  stopFlickerAnimation();
  flickerAnimationTimer = setTimeout(function () { startFlickerAnimation(); }, Math.random() * flickerInterval);
}

// Stop the flickering noise animation
function stopFlickerAnimation() {
  clearTimer(flickerAnimationTimer);
  enableNoiseAnimation(false);
}

// Stop the ticker animation
function stopTickerAnimation() {
  clearTimer(tickerAnimationTimer);
  enableTickerAnimation(false);
}

// Stop the wobble animation
function stopWobbleAnimation() {
  clearTimer(wobbleAnimationTimer);
  enableWobbleAnimation(false);
}

// Stop noise, wobble & ticker animations
function stopAnimations() {
  stopFlickerAnimation();
  stopWobbleAnimation();
  stopTickerAnimation();
}

// Callback onClick for turnaround-container
function onTurnaroundContainerClicked() {
  toggleAudioStreamPlayback();
}

// Toggle audio stream playback & toggle UI
function toggleAudioStreamPlayback() {
  var myAudio = getElement("mp3");
  if (myAudio !== null) {
    if (myAudio.paused) {
      myAudio.play();
      myAudio.addEventListener('ended', function () {
        toggleAudioUiState(true);
        myAudio.pause();
      });
    } else {
      myAudio.pause();
    }
    toggleAudioUiState(myAudio.paused);
  }
}

// Toggle the audio buttons, ticker visibility & animations
function toggleAudioUiState(audioPaused) {
  toggleAudioPlayButtons(audioPaused);
  if (audioPaused) {
    startAnimations(animationDelay);
  } else {
    stopAnimations();
  }
  stopLogoZoomLoop(audioPaused);
  stopLogoRotation(audioPaused);
}

// Toggle audio play / pause button image
function toggleAudioPlayButtons(audioPaused) {
  var element = getElement("audioButton");
  if (element !== null) {
    if (audioPaused) {
      element.style.backgroundImage = "url(img/play.svg)";
    } else {
      element.style.backgroundImage = "url(img/pause.svg)";
    }
  }
}

// Remove the zoomLoop class from logo
function stopLogoZoomLoop(stop) {
  addClassToElement("zoomLoop", "logo", !stop);
}

// Remove the rotateY360 class from turnaroundLogo
function stopLogoRotation(stop) {
  addClassToElement("rotateY360", "turnaroundLogo", !stop);
}

redpajama_set_name: RedPajamaGithub


text:
const pathPlugin = require('path');
const webpack = require('webpack');
var Extract = require("extract-text-webpack-plugin");

//第三方Js库
const jsModules = [
    'reflect-metadata',
    'zone.js',
    'moment',
    '@angular/animations',
    '@angular/common',
    '@angular/common/http',
    '@angular/compiler',
    '@angular/core',
    '@angular/forms',
    '@angular/elements',
    '@angular/platform-browser',
    '@angular/platform-browser/animations',
    '@angular/platform-browser-dynamic',
    '@angular/router',
    '@angular/cdk/esm5/collections.es5',
    '@angular/flex-layout',
    '@angular/material',
    'primeng/primeng',
    'lodash',
    "echarts-ng2"
];

//第三方Css库
const cssModules = [
    '@angular/material/prebuilt-themes/indigo-pink.css',
    'material-design-icons/iconfont/material-icons.css',
    'font-awesome/css/font-awesome.css',
    'primeicons/primeicons.css',
    'primeng/resources/themes/omega/theme.css',
    'primeng/resources/primeng.min.css'
];

module.exports = (env) => {
    //是否开发环境
    const isDev = !(env && env.prod);
    const mode = isDev ? "development" : "production";

    //将css提取到单独文件中
    const extractCss = new Extract("vendor.css");

    //获取路径
    function getPath(path) {
        return pathPlugin.join(__dirname, path);
    }

    //打包第三方Js库
    let vendorJs = {
        mode: mode,
        entry: { vendor: jsModules },
        output: {
            publicPath: 'dist/',
            path: getPath("wwwroot/dist"),
            filename: "[name].js",
            library: '[name]'
        },
        resolve: {
            extensions: ['.js']
        },
        devtool: "source-map",
        plugins: [
            new webpack.DllPlugin({
                path: getPath("wwwroot/dist/[name]-manifest.json"),
                name: "[name]"
            }),
            new webpack.ContextReplacementPlugin(/\@angular\b.*\b(bundles|linker)/, getPath('./Typings')),
            new webpack.ContextReplacementPlugin(/angular(\\|\/)core(\\|\/)@angular/, getPath('./Typings')),
            new webpack.IgnorePlugin(/^vertx$/)
        ]
    }

    //打包css
    let vendorCss = {
        mode: mode,
        entry: { vendor: cssModules },
        output: {
            publicPath: './',
            path: getPath("wwwroot/dist"),
            filename: "[name].css"
        },
        devtool: "source-map",
        module: {
            rules: [
                { test: /\.css$/, use: extractCss.extract({ use: isDev ? 'css-loader' : 'css-loader?minimize' }) },
                {
                    test: /\.(png|jpg|gif|woff|woff2|eot|ttf|svg)(\?|$)/, use: {
                        loader: 'url-loader',
                        options: {
                            limit: 20000,
                            name: "[name].[ext]",
                            outputPath: "images/"
                        }
                    }
                }
            ]
        },
        plugins: [
            extractCss
        ]
    }
    return isDev ? [ vendorJs, vendorCss] : [vendorCss];
}


text:
<!doctype html>
<!-- <meta name="timeout" content="long"> -->
<title>Accept-CH Persistence test</title>
<body>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script src="resources/accept-ch-test.js"></script>

<script>
run_test({ name: "http-equiv same origin iframe",
    initial_url: echo,
    accept_url: httpequiv_accept,
    expect_url: do_not_expect,
    type: "iframe" });
</script>
</body>
</html>


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.valarhao.valarnews" >

    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.READ_PHONE_STATE" />

    <application
        android:name=".common.app.App"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme" >
        <activity android:name=".common.app.RootActivity"
                  android:screenOrientation="portrait"
                  android:theme="@style/TranslucentTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name=".module.main.MainActivity"
                  android:screenOrientation="portrait"/>

        <activity android:name=".module.zhihu.common.detail.DetailActivity"
                  android:screenOrientation="portrait"
                  android:launchMode="singleTop"
                  android:theme="@style/TranslucentTheme"/>
        <activity android:name=".module.zhihu.common.detail.comment.ShortCommentActivity"
                  android:screenOrientation="portrait"
                  android:launchMode="singleTop"
                  android:theme="@style/TranslucentTheme"/>
        <activity android:name=".module.zhihu.module.theme.child.ThemeChildActivity"
                  android:screenOrientation="portrait"
                  android:launchMode="singleTop"
                  android:theme="@style/TranslucentTheme"/>
        <activity android:name=".module.zhihu.module.section.child.SectionChildActivity"
                  android:screenOrientation="portrait"
                  android:launchMode="singleTop"
                  android:theme="@style/TranslucentTheme"/>
    </application>

</manifest>


text:
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE document SYSTEM 'file:///C:/Xilinx/14.7/ISE_DS/ISE/chipviewer/data/xsl/buildXML.dtd'>

<document>
<design name='Main'/>
<rptdir name='Main'/>
<xilinx path='C:/Xilinx/14.7/ISE_DS/ISE;'/>
<projDir path='C:\Users\Yoshio\git\ecorun\ecorun_fi_hardware\fi_timer\FiTimer'/>
<xslDir path='chipviewer/data/xsl'/>
<fileDir path='/chipviewer/data/html'/>
<dataFile file='index.htm'/>
<dataFile file='report.htm'/>
<dataFile file='genmsg.htm'/>
<dataFile file='eqns.js'/>
<dataFile file='maplogic.js'/>
<dataFile file='fbs.js'/>
<dataFile file='pins.js'/>
<dataFile file='tooltips.js'/>
<dataFile file='errors.js'/>
<dataFile file='leftnav.js'/>
<dataFile file='paths.js'/>
<dataFile file='summary.js'/>
<dataFile file='topnav.js'/>
<dataFile file='applet.js'/>
<dataFile file='plugin.js'/>
<dataFile file='ns4plugin.js'/>
<dataFile file='equations.htm'/>
<dataFile file='result.htm'/>
<dataFile file='style.css'/>
<dataFile file='blank.gif'/>
<dataFile file='fbview.jpg'/>
<dataFile file='pinview.jpg'/>
<dataFile file='xc9500xl_logo.jpg'/>
<dataFile file='asciidoc.htm'/>
<dataFile file='equationsdoc.htm'/>
<dataFile file='errorsdoc.htm'/>
<dataFile file='failtabledoc.htm'/>
<dataFile file='fbs_FBdoc.htm'/>
<dataFile file='fbsdoc.htm'/>
<dataFile file='inputleftdoc.htm'/>
<dataFile file='logicleftdoc.htm'/>
<dataFile file='mapinputdoc.htm'/>
<dataFile file='maplogicdoc.htm'/>
<dataFile file='optionsdoc.htm'/>
<dataFile file='pinsdoc.htm'/>
<dataFile file='summarydoc.htm'/>
<dataFile file='check.htm'/>
<dataFile file='checkNS4.htm'/>
<dataFile file='appletref.htm'/>
<dataFile file='newappletref.htm'/>
<dataFile file='errors1.gif'/>
<dataFile file='errors2.gif'/>
<dataFile file='equations.gif'/>
<dataFile file='functionblock.gif'/>
<dataFile file='fb1.gif'/>
<dataFile file='legend.gif'/>
<dataFile file='macrocell.gif'/>
<dataFile file='fb.gif'/>
<dataFile file='pin.gif'/>
<dataFile file='pindiagram.gif'/>
<dataFile file='view.gif'/>
<dataFile file='xml8.jpg'/>
<dataFile file='xml7.jpg'/>
<dataFile file='xml6.jpg'/>
<dataFile file='xml5.jpg'/>
<xmlFileGroup id='1'>
<xmlFile file='Main.xml'>
  <xslFile file='topnav.xsl'>
    <output file='topnav.htm'/>
  </xslFile>
  <xslFile file='leftnav.xsl'>
    <param name='result' value='1'/>
    <output file='leftnav.htm'/>
  </xslFile>
  <xslFile file='print.xsl'>
    <output file='ascii.tmp'/>
  </xslFile>
  <xslFile file='eqns.xsl'>
    <output file='eqns.htm'/>
  </xslFile>
  <xslFile file='summary.xsl'>
    <param name='sumOn' value='1'/>
    <param name='optOn' value='0'/>
    <param name='legendOn' value='0'/>
    <output file='summary.htm'/>
  </xslFile>
</xmlFile>
</xmlFileGroup>
<xmlFileGroup id='2'>
<xmlFile file='Main.xml'>
  <xslFile file='summary.xsl'>
    <param name='sumOn' value='0'/>
    <param name='optOn' value='1'/>
    <param name='legendOn' value='0'/>
    <output file='options.htm'/>
  </xslFile>
  <xslFile file='printErrors.xsl'>
    <output file='errs.htm'/>
  </xslFile>
  <xslFile file='failtable.xsl'>
    <output file='failtable.htm'/>
  </xslFile>
  <xslFile file='logicleft.xsl'>
    <output file='logicleft.htm'/>
  </xslFile>
  <xslFile file='inputleft.xsl'>
    <output file='inputleft.htm'/>
  </xslFile>
  <xslFile file='printPins.xsl'>
    <param name='appletOn' value='0'/>
    <output file='pins.htm'/>
  </xslFile>
  <xslFile file='wait.xsl'>
    <output file='wait.htm'/>
  </xslFile>
  <xslDebug file='printErrors.xsl'>
    <output file='errors.htm'/>
  </xslDebug>
  <xslDebug file='printPins.xsl'>
    <output file='pinout.htm'/>
  </xslDebug>
  <xslDebug file='printEqns.xsl'>
    <output file='eqnout.htm'/>
  </xslDebug>
  <xslFile file='maplogic.xsl'>
    <param name='sortType' value='0'/>
    <param name='mapLog' value='1'/>
    <param name='mapIn' value='0'/>
    <param name='unmapLog' value='0'/>
    <param name='unmapIn' value='0'/>
    <param name='legendOn' value='1'/>
    <param name='appletOn' value='0'/>
    <output file='maplogic_00.htm'/>
    <param name='sortType' value='1'/>
    <param name='mapLog' value='1'/>
    <param name='mapIn' value='0'/>
    <param name='unmapLog' value='0'/>
    <param name='unmapIn' value='0'/>
    <param name='legendOn' value='1'/>
    <param name='appletOn' value='0'/>
    <output file='maplogic_01.htm'/>
    <param name='sortType' value='2'/>
    <param name='mapLog' value='1'/>
    <param name='mapIn' value='0'/>
    <param name='unmapLog' value='0'/>
    <param name='unmapIn' value='0'/>
    <param name='legendOn' value='1'/>
    <param name='appletOn' value='0'/>
    <output file='maplogic_02.htm'/>
    <param name='sortType' value='0'/>
    <param name='mapLog' value='0'/>
    <param name='mapIn' value='1'/>
    <param name='unmapLog' value='0'/>
    <param name='unmapIn' value='0'/>
    <param name='legendOn' value='1'/>
    <param name='appletOn' value='0'/>
    <output file='mapinput_00.htm'/>
    <param name='sortType' value='1'/>
    <param name='mapLog' value='0'/>
    <param name='mapIn' value='1'/>
    <param name='unmapLog' value='0'/>
    <param name='unmapIn' value='0'/>
    <param name='legendOn' value='1'/>
    <param name='appletOn' value='0'/>
    <output file='mapinput_01.htm'/>
    <param name='sortType' value='2'/>
    <param name='mapLog' value='0'/>
    <param name='mapIn' value='1'/>
    <param name='unmapLog' value='0'/>
    <param name='unmapIn' value='0'/>
    <param name='legendOn' value='1'/>
    <param name='appletOn' value='0'/>
    <output file='mapinput_02.htm'/>
  </xslFile>
  <xslFile file='fbsum.xsl'>
    <param name='legendOn' value='0'/>
    <output file='fbs.htm'/>
  </xslFile>
  <xslFile file='fbs.xsl'>
    <param name='fb' value='FB1'/>
    <param name='type' value='1'/>
    <param name='legendOn' value='1'/>
    <param name='appletOn' value='0'/>
    <output file='fbs_FB1.htm'/>
    <param name='fb' value='FB2'/>
    <param name='type' value='3'/>
    <param name='legendOn' value='1'/>
    <param name='appletOn' value='0'/>
    <output file='fbs_FB2.htm'/>
    <param name='fb' value='FB3'/>
    <param name='type' value='3'/>
    <param name='legendOn' value='1'/>
    <param name='appletOn' value='0'/>
    <output file='fbs_FB3.htm'/>
    <param name='fb' value='FB4'/>
    <param name='type' value='2'/>
    <param name='legendOn' value='1'/>
    <param name='appletOn' value='0'/>
    <output file='fbs_FB4.htm'/>
  </xslFile>
</xmlFile>
<xmlFile file='C:/Xilinx/14.7/ISE_DS/ISE/chipviewer/data/xsl/pinlegend.xml'>
  <xslFile file='legend.xsl'>
    <param name='device' value='XC9572XL-10-VQ44'/>
    <param name='verOn' value='0'/>
    <param name='linkName' value='pinlegendV.htm'/>
    <output file='pinlegend.htm'/>
    <param name='device' value='XC9572XL-10-VQ44'/>
    <param name='verOn' value='1'/>
    <param name='linkName' value='pinlegend.htm'/>
    <output file='pinlegendV.htm'/>
  </xslFile>
</xmlFile>
<xmlFile file='C:/Xilinx/14.7/ISE_DS/ISE/chipviewer/data/xsl/logiclegend.xml'>
  <xslFile file='legend.xsl'>
    <param name='device' value='XC9572XL-10-VQ44'/>
    <param name='verOn' value='0'/>
    <param name='linkName' value='logiclegendV.htm'/>
    <output file='logiclegend.htm'/>
    <param name='device' value='XC9572XL-10-VQ44'/>
    <param name='verOn' value='1'/>
    <param name='linkName' value='logiclegend.htm'/>
    <output file='logiclegendV.htm'/>
  </xslFile>
</xmlFile>
</xmlFileGroup>
<rptFile file='Main.rpt'/>
<timFile file='Main.tim'/>
</document>


text:
package overlay

import (
	"context"
	"fmt"
	"io/ioutil"
	"os"
	"path/filepath"
	"strings"

	"github.com/containerd/containerd/fs"
	"github.com/containerd/containerd/log"
	"github.com/containerd/containerd/mount"
	"github.com/containerd/containerd/plugin"
	"github.com/containerd/containerd/snapshot"
	"github.com/containerd/containerd/snapshot/storage"
	"github.com/pkg/errors"
)

func init() {
	plugin.Register(&plugin.Registration{
		Type: plugin.SnapshotPlugin,
		ID:   "overlayfs",
		Init: func(ic *plugin.InitContext) (interface{}, error) {
			return NewSnapshotter(ic.Root)
		},
	})
}

type snapshotter struct {
	root string
	ms   *storage.MetaStore
}

type activeSnapshot struct {
	id       string
	name     string
	parentID interface{}
	readonly bool
}

// NewSnapshotter returns a Snapshotter which uses overlayfs. The overlayfs
// diffs are stored under the provided root. A metadata file is stored under
// the root.
func NewSnapshotter(root string) (snapshot.Snapshotter, error) {
	if err := os.MkdirAll(root, 0700); err != nil {
		return nil, err
	}
	supportsDType, err := fs.SupportsDType(root)
	if err != nil {
		return nil, err
	}
	if !supportsDType {
		return nil, fmt.Errorf("%s does not support d_type. If the backing filesystem is xfs, please reformat with ftype=1 to enable d_type support.", root)
	}
	ms, err := storage.NewMetaStore(filepath.Join(root, "metadata.db"))
	if err != nil {
		return nil, err
	}

	if err := os.Mkdir(filepath.Join(root, "snapshots"), 0700); err != nil && !os.IsExist(err) {
		return nil, err
	}

	return &snapshotter{
		root: root,
		ms:   ms,
	}, nil
}

// Stat returns the info for an active or committed snapshot by name or
// key.
//
// Should be used for parent resolution, existence checks and to discern
// the kind of snapshot.
func (o *snapshotter) Stat(ctx context.Context, key string) (snapshot.Info, error) {
	ctx, t, err := o.ms.TransactionContext(ctx, false)
	if err != nil {
		return snapshot.Info{}, err
	}
	defer t.Rollback()
	_, info, _, err := storage.GetInfo(ctx, key)
	if err != nil {
		return snapshot.Info{}, err
	}

	return info, nil
}

// Usage returns the resources taken by the snapshot identified by key.
//
// For active snapshots, this will scan the usage of the overlay "diff" (aka
// "upper") directory and may take some time.
//
// For committed snapshots, the value is returned from the metadata database.
func (o *snapshotter) Usage(ctx context.Context, key string) (snapshot.Usage, error) {
	ctx, t, err := o.ms.TransactionContext(ctx, false)
	if err != nil {
		return snapshot.Usage{}, err
	}
	id, info, usage, err := storage.GetInfo(ctx, key)
	if err != nil {
		return snapshot.Usage{}, err
	}

	upperPath := o.upperPath(id)
	t.Rollback() // transaction no longer needed at this point.

	if info.Kind == snapshot.KindActive {
		du, err := fs.DiskUsage(upperPath)
		if err != nil {
			// TODO(stevvooe): Consider not reporting an error in this case.
			return snapshot.Usage{}, err
		}

		usage = snapshot.Usage(du)
	}

	return usage, nil
}

func (o *snapshotter) Prepare(ctx context.Context, key, parent string) ([]mount.Mount, error) {
	return o.createSnapshot(ctx, snapshot.KindActive, key, parent)
}

func (o *snapshotter) View(ctx context.Context, key, parent string) ([]mount.Mount, error) {
	return o.createSnapshot(ctx, snapshot.KindView, key, parent)
}

// Mounts returns the mounts for the transaction identified by key. Can be
// called on an read-write or readonly transaction.
//
// This can be used to recover mounts after calling View or Prepare.
func (o *snapshotter) Mounts(ctx context.Context, key string) ([]mount.Mount, error) {
	ctx, t, err := o.ms.TransactionContext(ctx, false)
	if err != nil {
		return nil, err
	}
	s, err := storage.GetSnapshot(ctx, key)
	t.Rollback()
	if err != nil {
		return nil, errors.Wrap(err, "failed to get active mount")
	}
	return o.mounts(s), nil
}

func (o *snapshotter) Commit(ctx context.Context, name, key string) error {
	ctx, t, err := o.ms.TransactionContext(ctx, true)
	if err != nil {
		return err
	}

	defer func() {
		if err != nil {
			if rerr := t.Rollback(); rerr != nil {
				log.G(ctx).WithError(rerr).Warn("Failure rolling back transaction")
			}
		}
	}()

	// grab the existing id
	id, _, _, err := storage.GetInfo(ctx, key)
	if err != nil {
		return err
	}

	usage, err := fs.DiskUsage(o.upperPath(id))
	if err != nil {
		return err
	}

	if _, err = storage.CommitActive(ctx, key, name, snapshot.Usage(usage)); err != nil {
		return errors.Wrap(err, "failed to commit snapshot")
	}
	return t.Commit()
}

// Remove abandons the transaction identified by key. All resources
// associated with the key will be removed.
func (o *snapshotter) Remove(ctx context.Context, key string) (err error) {
	ctx, t, err := o.ms.TransactionContext(ctx, true)
	if err != nil {
		return err
	}
	defer func() {
		if err != nil && t != nil {
			if rerr := t.Rollback(); rerr != nil {
				log.G(ctx).WithError(rerr).Warn("Failure rolling back transaction")
			}
		}
	}()

	id, _, err := storage.Remove(ctx, key)
	if err != nil {
		return errors.Wrap(err, "failed to remove")
	}

	path := filepath.Join(o.root, "snapshots", id)
	renamed := filepath.Join(o.root, "snapshots", "rm-"+id)
	if err := os.Rename(path, renamed); err != nil {
		return errors.Wrap(err, "failed to rename")
	}

	err = t.Commit()
	t = nil
	if err != nil {
		if err1 := os.Rename(renamed, path); err1 != nil {
			// May cause inconsistent data on disk
			log.G(ctx).WithError(err1).WithField("path", renamed).Errorf("Failed to rename after failed commit")
		}
		return errors.Wrap(err, "failed to commit")
	}
	if err := os.RemoveAll(renamed); err != nil {
		// Must be cleaned up, any "rm-*" could be removed if no active transactions
		log.G(ctx).WithError(err).WithField("path", renamed).Warnf("Failed to remove root filesystem")
	}

	return nil
}

// Walk the committed snapshots.
func (o *snapshotter) Walk(ctx context.Context, fn func(context.Context, snapshot.Info) error) error {
	ctx, t, err := o.ms.TransactionContext(ctx, false)
	if err != nil {
		return err
	}
	defer t.Rollback()
	return storage.WalkInfo(ctx, fn)
}

func (o *snapshotter) createSnapshot(ctx context.Context, kind snapshot.Kind, key, parent string) ([]mount.Mount, error) {
	var (
		path        string
		snapshotDir = filepath.Join(o.root, "snapshots")
	)

	td, err := ioutil.TempDir(snapshotDir, "new-")
	if err != nil {
		return nil, errors.Wrap(err, "failed to create temp dir")
	}
	defer func() {
		if err != nil {
			if td != "" {
				if err1 := os.RemoveAll(td); err1 != nil {
					err = errors.Wrapf(err, "remove failed: %v", err1)
				}
			}
			if path != "" {
				if err1 := os.RemoveAll(path); err1 != nil {
					err = errors.Wrapf(err, "failed to remove path: %v", err1)
				}
			}
		}
	}()

	if err = os.MkdirAll(filepath.Join(td, "fs"), 0755); err != nil {
		return nil, err
	}

	if kind == snapshot.KindActive {
		if err = os.MkdirAll(filepath.Join(td, "work"), 0711); err != nil {
			return nil, err
		}
	}

	ctx, t, err := o.ms.TransactionContext(ctx, true)
	if err != nil {
		return nil, err
	}

	s, err := storage.CreateSnapshot(ctx, kind, key, parent)
	if err != nil {
		if rerr := t.Rollback(); rerr != nil {
			log.G(ctx).WithError(rerr).Warn("Failure rolling back transaction")
		}
		return nil, errors.Wrap(err, "failed to create active")
	}

	path = filepath.Join(snapshotDir, s.ID)
	if err = os.Rename(td, path); err != nil {
		if rerr := t.Rollback(); rerr != nil {
			log.G(ctx).WithError(rerr).Warn("Failure rolling back transaction")
		}
		return nil, errors.Wrap(err, "failed to rename")
	}
	td = ""

	if err = t.Commit(); err != nil {
		return nil, errors.Wrap(err, "commit failed")
	}

	return o.mounts(s), nil
}

func (o *snapshotter) mounts(s storage.Snapshot) []mount.Mount {
	if len(s.ParentIDs) == 0 {
		// if we only have one layer/no parents then just return a bind mount as overlay
		// will not work
		roFlag := "rw"
		if s.Kind == snapshot.KindView {
			roFlag = "ro"
		}

		return []mount.Mount{
			{
				Source: o.upperPath(s.ID),
				Type:   "bind",
				Options: []string{
					roFlag,
					"rbind",
				},
			},
		}
	}
	var options []string

	if s.Kind == snapshot.KindActive {
		options = append(options,
			fmt.Sprintf("workdir=%s", o.workPath(s.ID)),
			fmt.Sprintf("upperdir=%s", o.upperPath(s.ID)),
		)
	} else if len(s.ParentIDs) == 1 {
		return []mount.Mount{
			{
				Source: o.upperPath(s.ParentIDs[0]),
				Type:   "bind",
				Options: []string{
					"ro",
					"rbind",
				},
			},
		}
	}

	parentPaths := make([]string, len(s.ParentIDs))
	for i := range s.ParentIDs {
		parentPaths[i] = o.upperPath(s.ParentIDs[i])
	}

	options = append(options, fmt.Sprintf("lowerdir=%s", strings.Join(parentPaths, ":")))
	return []mount.Mount{
		{
			Type:    "overlay",
			Source:  "overlay",
			Options: options,
		},
	}

}

func (o *snapshotter) upperPath(id string) string {
	return filepath.Join(o.root, "snapshots", id, "fs")
}

func (o *snapshotter) workPath(id string) string {
	return filepath.Join(o.root, "snapshots", id, "work")
}


text:
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Arbitrader.GW2API.Results;

namespace Arbitrader.GW2API.Entities
{
    /// <summary>
    /// A row of data in the GuildIngredients table. Associated with the result type <see cref="GuildIngredientResult"/>.
    /// </summary>
    [Table("GuildIngredients")]
    public class GuildIngredientEntity : Entity
    {
        /// <summary>
        /// Gets or sets the unique identifier in the GW2 API for the guild hall upgrade that requires the ingredient.
        /// </summary>
        public int UpgradeID { get; set; }

        /// <summary>
        /// Gets or sets the number of the ingredient required for the guild hall upgrade.
        /// </summary>
        public int Count { get; set; }
    }
}


text:
using namespace std;

class Solution
{
    public:
        std::vector<int> partitionLabels(std::string S)
        {
            vector<int> result;

            int n=S.size();

            //Map each character in S to a pair of indices - the first index at which the letter appears in S and the last index at which the letter appears in S
            unordered_map<char, pair<int, int>> hashtable;

            //Create the mappings
            for(int i=0;i<n;i++)
            {
                char c=S[i];

                if(!hashtable.count(c))
                {
                    hashtable[c]=make_pair(i, i);
                }
                else
                {
                    hashtable[c].second=max(hashtable[c].second, i);
                }
            }

            //We use this unordered_set to prevent us from considering duplicate characters as we iterate through S
            unordered_set<char> cache;

            //Start of the partition
            int start=hashtable[S[0]].first;

            //End of the partition
            int end=hashtable[S[0]].second;

            //Insert the first letter of S into the cache
            cache.insert(S[0]);

            //Iterate through S
            for(int i=0;i<n;i++)
            {
                char c=S[i];

                //If we haven't seen the character before
                if(!cache.count(c))
                {
                    //The first index at which the character appears
                    int cStart=hashtable[c].first;

                    //The last index at which the character appears
                    int cEnd=hashtable[c].second;

                    //If the start and end indices for the current character fall within the current parition range
                    if(start < cStart && cEnd < end)
                    {
                        //Insert the character into the cache
                        cache.insert(c);
                    }
                    //Else if, the start index for the current character falls within the partition range but the end index does not, then extend the end of the partition
                    else if(start < cStart && cStart < end && cEnd > end)
                    {
                        cache.insert(c);

                        end=cEnd;
                    }
                    //Else if, the start and end indices for the current character fall outside of the partitions range, then the current partition ends at this index
                    else if(cStart > end && cEnd > end)
                    {
                        //Calculate the length of the partition
                        int length=(end - start) + 1;

                        result.emplace_back(length);

                        cache.clear();

                        cache.insert(c);

                        //Update start and end values to match the start and end of the new partition
                        start=cStart;

                        end=cEnd;
                    }
                }
            }

            //If the end of the last partition extends to the last index of S, then calculate the length and add it to the result
            int length=(end - start) + 1;

            result.emplace_back(length);

            return result;
        }
};


text:
/**
 * \file        lzma/base.h
 * \brief       Data types and functions used in many places in liblzma API
 */

/*
 * Author: Lasse Collin
 *
 * This file has been put into the public domain.
 * You can do whatever you want with this file.
 *
 * See ../lzma.h for information about liblzma as a whole.
 */

#ifndef LZMA_H_INTERNAL
#	error Never include this file directly. Use <lzma.h> instead.
#endif

/**
 * \brief       Boolean
 *
 * This is here because C89 doesn't have stdbool.h. To set a value for
 * variables having type lzma_bool, you can use
 *   - C99's `true' and `false' from stdbool.h;
 *   - C++'s internal `true' and `false'; or
 *   - integers one (true) and zero (false).
 */
typedef unsigned char lzma_bool;

/**
 * \brief       Type of reserved enumeration variable in structures
 *
 * To avoid breaking library ABI when new features are added, several
 * structures contain extra variables that may be used in future. Since
 * sizeof(enum) can be different than sizeof(int), and sizeof(enum) may
 * even vary depending on the range of enumeration constants, we specify
 * a separate type to be used for reserved enumeration variables. All
 * enumeration constants in liblzma API will be non-negative and less
 * than 128, which should guarantee that the ABI won't break even when
 * new constants are added to existing enumerations.
 */
typedef enum {
	LZMA_RESERVED_ENUM      = 0
} lzma_reserved_enum;

/**
 * \brief       Return values used by several functions in liblzma
 *
 * Check the descriptions of specific functions to find out which return
 * values they can return. With some functions the return values may have
 * more specific meanings than described here; those differences are
 * described per-function basis.
 */
typedef enum {
	LZMA_OK                 = 0,
		/**<
		 * \brief       Operation completed successfully
		 */

	LZMA_STREAM_END         = 1,
		/**<
		 * \brief       End of stream was reached
		 *
		 * In encoder, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or
		 * LZMA_FINISH was finished. In decoder, this indicates
		 * that all the data was successfully decoded.
		 *
		 * In all cases, when LZMA_STREAM_END is returned, the last
		 * output bytes should be picked from strm->next_out.
		 */

	LZMA_NO_CHECK           = 2,
		/**<
		 * \brief       Input stream has no integrity check
		 *
		 * This return value can be returned only if the
		 * LZMA_TELL_NO_CHECK flag was used when initializing
		 * the decoder. LZMA_NO_CHECK is just a warning, and
		 * the decoding can be continued normally.
		 *
		 * It is possible to call lzma_get_check() immediately after
		 * lzma_code has returned LZMA_NO_CHECK. The result will
		 * naturally be LZMA_CHECK_NONE, but the possibility to call
		 * lzma_get_check() may be convenient in some applications.
		 */

	LZMA_UNSUPPORTED_CHECK  = 3,
		/**<
		 * \brief       Cannot calculate the integrity check
		 *
		 * The usage of this return value is different in encoders
		 * and decoders.
		 *
		 * Encoders can return this value only from the initialization
		 * function. If initialization fails with this value, the
		 * encoding cannot be done, because there's no way to produce
		 * output with the correct integrity check.
		 *
		 * Decoders can return this value only from lzma_code() and
		 * only if the LZMA_TELL_UNSUPPORTED_CHECK flag was used when
		 * initializing the decoder. The decoding can still be
		 * continued normally even if the check type is unsupported,
		 * but naturally the check will not be validated, and possible
		 * errors may go undetected.
		 *
		 * With decoder, it is possible to call lzma_get_check()
		 * immediately after lzma_code() has returned
		 * LZMA_UNSUPPORTED_CHECK. This way it is possible to find
		 * out what the unsupported Check ID was.
		 */

	LZMA_GET_CHECK          = 4,
		/**<
		 * \brief       Integrity check type is now available
		 *
		 * This value can be returned only by the lzma_code() function
		 * and only if the decoder was initialized with the
		 * LZMA_TELL_ANY_CHECK flag. LZMA_GET_CHECK tells the
		 * application that it may now call lzma_get_check() to find
		 * out the Check ID. This can be used, for example, to
		 * implement a decoder that accepts only files that have
		 * strong enough integrity check.
		 */

	LZMA_MEM_ERROR          = 5,
		/**<
		 * \brief       Cannot allocate memory
		 *
		 * Memory allocation failed, or the size of the allocation
		 * would be greater than SIZE_MAX.
		 *
		 * Due to internal implementation reasons, the coding cannot
		 * be continued even if more memory were made available after
		 * LZMA_MEM_ERROR.
		 */

	LZMA_MEMLIMIT_ERROR     = 6,
		/**
		 * \brief       Memory usage limit was reached
		 *
		 * Decoder would need more memory than allowed by the
		 * specified memory usage limit. To continue decoding,
		 * the memory usage limit has to be increased with
		 * lzma_memlimit_set().
		 */

	LZMA_FORMAT_ERROR       = 7,
		/**<
		 * \brief       File format not recognized
		 *
		 * The decoder did not recognize the input as supported file
		 * format. This error can occur, for example, when trying to
		 * decode .lzma format file with lzma_stream_decoder,
		 * because lzma_stream_decoder accepts only the .xz format.
		 */

	LZMA_OPTIONS_ERROR      = 8,
		/**<
		 * \brief       Invalid or unsupported options
		 *
		 * Invalid or unsupported options, for example
		 *  - unsupported filter(s) or filter options; or
		 *  - reserved bits set in headers (decoder only).
		 *
		 * Rebuilding liblzma with more features enabled, or
		 * upgrading to a newer version of liblzma may help.
		 */

	LZMA_DATA_ERROR         = 9,
		/**<
		 * \brief       Data is corrupt
		 *
		 * The usage of this return value is different in encoders
		 * and decoders. In both encoder and decoder, the coding
		 * cannot continue after this error.
		 *
		 * Encoders return this if size limits of the target file
		 * format would be exceeded. These limits are huge, thus
		 * getting this error from an encoder is mostly theoretical.
		 * For example, the maximum compressed and uncompressed
		 * size of a .xz Stream is roughly 8 EiB (2^63 bytes).
		 *
		 * Decoders return this error if the input data is corrupt.
		 * This can mean, for example, invalid CRC32 in headers
		 * or invalid check of uncompressed data.
		 */

	LZMA_BUF_ERROR          = 10,
		/**<
		 * \brief       No progress is possible
		 *
		 * This error code is returned when the coder cannot consume
		 * any new input and produce any new output. The most common
		 * reason for this error is that the input stream being
		 * decoded is truncated or corrupt.
		 *
		 * This error is not fatal. Coding can be continued normally
		 * by providing more input and/or more output space, if
		 * possible.
		 *
		 * Typically the first call to lzma_code() that can do no
		 * progress returns LZMA_OK instead of LZMA_BUF_ERROR. Only
		 * the second consecutive call doing no progress will return
		 * LZMA_BUF_ERROR. This is intentional.
		 *
		 * With zlib, Z_BUF_ERROR may be returned even if the
		 * application is doing nothing wrong, so apps will need
		 * to handle Z_BUF_ERROR specially. The above hack
		 * guarantees that liblzma never returns LZMA_BUF_ERROR
		 * to properly written applications unless the input file
		 * is truncated or corrupt. This should simplify the
		 * applications a little.
		 */

	LZMA_PROG_ERROR         = 11,
		/**<
		 * \brief       Programming error
		 *
		 * This indicates that the arguments given to the function are
		 * invalid or the internal state of the decoder is corrupt.
		 *   - Function arguments are invalid or the structures
		 *     pointed by the argument pointers are invalid
		 *     e.g. if strm->next_out has been set to NULL and
		 *     strm->avail_out > 0 when calling lzma_code().
		 *   - lzma_* functions have been called in wrong order
		 *     e.g. lzma_code() was called right after lzma_end().
		 *   - If errors occur randomly, the reason might be flaky
		 *     hardware.
		 *
		 * If you think that your code is correct, this error code
		 * can be a sign of a bug in liblzma. See the documentation
		 * how to report bugs.
		 */
} lzma_ret;

/**
 * \brief       The `action' argument for lzma_code()
 *
 * After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, LZMA_FULL_BARRIER,
 * or LZMA_FINISH, the same `action' must is used until lzma_code() returns
 * LZMA_STREAM_END. Also, the amount of input (that is, strm->avail_in) must
 * not be modified by the application until lzma_code() returns
 * LZMA_STREAM_END. Changing the `action' or modifying the amount of input
 * will make lzma_code() return LZMA_PROG_ERROR.
 */
typedef enum {
	LZMA_RUN = 0,
		/**<
		 * \brief       Continue coding
		 *
		 * Encoder: Encode as much input as possible. Some internal
		 * buffering will probably be done (depends on the filter
		 * chain in use), which causes latency: the input used won't
		 * usually be decodeable from the output of the same
		 * lzma_code() call.
		 *
		 * Decoder: Decode as much input as possible and produce as
		 * much output as possible.
		 */

	LZMA_SYNC_FLUSH = 1,
		/**<
		 * \brief       Make all the input available at output
		 *
		 * Normally the encoder introduces some latency.
		 * LZMA_SYNC_FLUSH forces all the buffered data to be
		 * available at output without resetting the internal
		 * state of the encoder. This way it is possible to use
		 * compressed stream for example for communication over
		 * network.
		 *
		 * Only some filters support LZMA_SYNC_FLUSH. Trying to use
		 * LZMA_SYNC_FLUSH with filters that don't support it will
		 * make lzma_code() return LZMA_OPTIONS_ERROR. For example,
		 * LZMA1 doesn't support LZMA_SYNC_FLUSH but LZMA2 does.
		 *
		 * Using LZMA_SYNC_FLUSH very often can dramatically reduce
		 * the compression ratio. With some filters (for example,
		 * LZMA2), fine-tuning the compression options may help
		 * mitigate this problem significantly (for example,
		 * match finder with LZMA2).
		 *
		 * Decoders don't support LZMA_SYNC_FLUSH.
		 */

	LZMA_FULL_FLUSH = 2,
		/**<
		 * \brief       Finish encoding of the current Block
		 *
		 * All the input data going to the current Block must have
		 * been given to the encoder (the last bytes can still be
		 * pending in *next_in). Call lzma_code() with LZMA_FULL_FLUSH
		 * until it returns LZMA_STREAM_END. Then continue normally
		 * with LZMA_RUN or finish the Stream with LZMA_FINISH.
		 *
		 * This action is currently supported only by Stream encoder
		 * and easy encoder (which uses Stream encoder). If there is
		 * no unfinished Block, no empty Block is created.
		 */

	LZMA_FULL_BARRIER = 4,
		/**<
		 * \brief       Finish encoding of the current Block
		 *
		 * This is like LZMA_FULL_FLUSH except that this doesn't
		 * necessarily wait until all the input has been made
		 * available via the output buffer. That is, lzma_code()
		 * might return LZMA_STREAM_END as soon as all the input
		 * has been consumed (avail_in == 0).
		 *
		 * LZMA_FULL_BARRIER is useful with a threaded encoder if
		 * one wants to split the .xz Stream into Blocks at specific
		 * offsets but doesn't care if the output isn't flushed
		 * immediately. Using LZMA_FULL_BARRIER allows keeping
		 * the threads busy while LZMA_FULL_FLUSH would make
		 * lzma_code() wait until all the threads have finished
		 * until more data could be passed to the encoder.
		 *
		 * With a lzma_stream initialized with the single-threaded
		 * lzma_stream_encoder() or lzma_easy_encoder(),
		 * LZMA_FULL_BARRIER is an alias for LZMA_FULL_FLUSH.
		 */

	LZMA_FINISH = 3
		/**<
		 * \brief       Finish the coding operation
		 *
		 * All the input data must have been given to the encoder
		 * (the last bytes can still be pending in next_in).
		 * Call lzma_code() with LZMA_FINISH until it returns
		 * LZMA_STREAM_END. Once LZMA_FINISH has been used,
		 * the amount of input must no longer be changed by
		 * the application.
		 *
		 * When decoding, using LZMA_FINISH is optional unless the
		 * LZMA_CONCATENATED flag was used when the decoder was
		 * initialized. When LZMA_CONCATENATED was not used, the only
		 * effect of LZMA_FINISH is that the amount of input must not
		 * be changed just like in the encoder.
		 */
} lzma_action;

/**
 * \brief       Custom functions for memory handling
 *
 * A pointer to lzma_allocator may be passed via lzma_stream structure
 * to liblzma, and some advanced functions take a pointer to lzma_allocator
 * as a separate function argument. The library will use the functions
 * specified in lzma_allocator for memory handling instead of the default
 * malloc() and free(). C++ users should note that the custom memory
 * handling functions must not throw exceptions.
 *
 * Single-threaded mode only: liblzma doesn't make an internal copy of
 * lzma_allocator. Thus, it is OK to change these function pointers in
 * the middle of the coding process, but obviously it must be done
 * carefully to make sure that the replacement `free' can deallocate
 * memory allocated by the earlier `alloc' function(s).
 *
 * Multithreaded mode: liblzma might internally store pointers to the
 * lzma_allocator given via the lzma_stream structure. The application
 * must not change the allocator pointer in lzma_stream or the contents
 * of the pointed lzma_allocator structure until lzma_end() has been used
 * to free the memory associated with that lzma_stream. The allocation
 * functions might be called simultaneously from multiple threads, and
 * thus they must be thread safe.
 */
typedef struct {
	/**
	 * \brief       Pointer to a custom memory allocation function
	 *
	 * If you don't want a custom allocator, but still want
	 * custom free(), set this to NULL and liblzma will use
	 * the standard malloc().
	 *
	 * \param       opaque  lzma_allocator.opaque (see below)
	 * \param       nmemb   Number of elements like in calloc(). liblzma
	 *                      will always set nmemb to 1, so it is safe to
	 *                      ignore nmemb in a custom allocator if you like.
	 *                      The nmemb argument exists only for
	 *                      compatibility with zlib and libbzip2.
	 * \param       size    Size of an element in bytes.
	 *                      liblzma never sets this to zero.
	 *
	 * \return      Pointer to the beginning of a memory block of
	 *              `size' bytes, or NULL if allocation fails
	 *              for some reason. When allocation fails, functions
	 *              of liblzma return LZMA_MEM_ERROR.
	 *
	 * The allocator should not waste time zeroing the allocated buffers.
	 * This is not only about speed, but also memory usage, since the
	 * operating system kernel doesn't necessarily allocate the requested
	 * memory in physical memory until it is actually used. With small
	 * input files, liblzma may actually need only a fraction of the
	 * memory that it requested for allocation.
	 *
	 * \note        LZMA_MEM_ERROR is also used when the size of the
	 *              allocation would be greater than SIZE_MAX. Thus,
	 *              don't assume that the custom allocator must have
	 *              returned NULL if some function from liblzma
	 *              returns LZMA_MEM_ERROR.
	 */
	void *(LZMA_API_CALL *alloc)(void *opaque, size_t nmemb, size_t size);

	/**
	 * \brief       Pointer to a custom memory freeing function
	 *
	 * If you don't want a custom freeing function, but still
	 * want a custom allocator, set this to NULL and liblzma
	 * will use the standard free().
	 *
	 * \param       opaque  lzma_allocator.opaque (see below)
	 * \param       ptr     Pointer returned by lzma_allocator.alloc(),
	 *                      or when it is set to NULL, a pointer returned
	 *                      by the standard malloc().
	 */
	void (LZMA_API_CALL *free)(void *opaque, void *ptr);

	/**
	 * \brief       Pointer passed to .alloc() and .free()
	 *
	 * opaque is passed as the first argument to lzma_allocator.alloc()
	 * and lzma_allocator.free(). This intended to ease implementing
	 * custom memory allocation functions for use with liblzma.
	 *
	 * If you don't need this, you should set this to NULL.
	 */
	void *opaque;

} lzma_allocator;

/**
 * \brief       Internal data structure
 *
 * The contents of this structure is not visible outside the library.
 */
typedef struct lzma_internal_s lzma_internal;

/**
 * \brief       Passing data to and from liblzma
 *
 * The lzma_stream structure is used for
 *  - passing pointers to input and output buffers to liblzma;
 *  - defining custom memory hander functions; and
 *  - holding a pointer to coder-specific internal data structures.
 *
 * Typical usage:
 *
 *  - After allocating lzma_stream (on stack or with malloc()), it must be
 *    initialized to LZMA_STREAM_INIT (see LZMA_STREAM_INIT for details).
 *
 *  - Initialize a coder to the lzma_stream, for example by using
 *    lzma_easy_encoder() or lzma_auto_decoder(). Some notes:
 *      - In contrast to zlib, strm->next_in and strm->next_out are
 *        ignored by all initialization functions, thus it is safe
 *        to not initialize them yet.
 *      - The initialization functions always set strm->total_in and
 *        strm->total_out to zero.
 *      - If the initialization function fails, no memory is left allocated
 *        that would require freeing with lzma_end() even if some memory was
 *        associated with the lzma_stream structure when the initialization
 *        function was called.
 *
 *  - Use lzma_code() to do the actual work.
 *
 *  - Once the coding has been finished, the existing lzma_stream can be
 *    reused. It is OK to reuse lzma_stream with different initialization
 *    function without calling lzma_end() first. Old allocations are
 *    automatically freed.
 *
 *  - Finally, use lzma_end() to free the allocated memory. lzma_end() never
 *    frees the lzma_stream structure itself.
 *
 * Application may modify the values of total_in and total_out as it wants.
 * They are updated by liblzma to match the amount of data read and
 * written but aren't used for anything else except as a possible return
 * values from lzma_get_progress().
 */
typedef struct {
	const uint8_t *next_in; /**< Pointer to the next input byte. */
	size_t avail_in;    /**< Number of available input bytes in next_in. */
	uint64_t total_in;  /**< Total number of bytes read by liblzma. */

	uint8_t *next_out;  /**< Pointer to the next output position. */
	size_t avail_out;   /**< Amount of free space in next_out. */
	uint64_t total_out; /**< Total number of bytes written by liblzma. */

	/**
	 * \brief       Custom memory allocation functions
	 *
	 * In most cases this is NULL which makes liblzma use
	 * the standard malloc() and free().
	 *
	 * \note        In 5.0.x this is not a const pointer.
	 */
	const lzma_allocator *allocator;

	/** Internal state is not visible to applications. */
	lzma_internal *internal;

	/*
	 * Reserved space to allow possible future extensions without
	 * breaking the ABI. Excluding the initialization of this structure,
	 * you should not touch these, because the names of these variables
	 * may change.
	 */
	void *reserved_ptr1;
	void *reserved_ptr2;
	void *reserved_ptr3;
	void *reserved_ptr4;
	uint64_t reserved_int1;
	uint64_t reserved_int2;
	size_t reserved_int3;
	size_t reserved_int4;
	lzma_reserved_enum reserved_enum1;
	lzma_reserved_enum reserved_enum2;

} lzma_stream;

/**
 * \brief       Initialization for lzma_stream
 *
 * When you declare an instance of lzma_stream, you can immediately
 * initialize it so that initialization functions know that no memory
 * has been allocated yet:
 *
 *     lzma_stream strm = LZMA_STREAM_INIT;
 *
 * If you need to initialize a dynamically allocated lzma_stream, you can use
 * memset(strm_pointer, 0, sizeof(lzma_stream)). Strictly speaking, this
 * violates the C standard since NULL may have different internal
 * representation than zero, but it should be portable enough in practice.
 * Anyway, for maximum portability, you can use something like this:
 *
 *     lzma_stream tmp = LZMA_STREAM_INIT;
 *     *strm = tmp;
 */
#define LZMA_STREAM_INIT \
	{ NULL, 0, 0, NULL, 0, 0, NULL, NULL, \
	NULL, NULL, NULL, NULL, 0, 0, 0, 0, \
	LZMA_RESERVED_ENUM, LZMA_RESERVED_ENUM }

/**
 * \brief       Encode or decode data
 *
 * Once the lzma_stream has been successfully initialized (e.g. with
 * lzma_stream_encoder()), the actual encoding or decoding is done
 * using this function. The application has to update strm->next_in,
 * strm->avail_in, strm->next_out, and strm->avail_out to pass input
 * to and get output from liblzma.
 *
 * See the description of the coder-specific initialization function to find
 * out what `action' values are supported by the coder.
 */
extern LZMA_API(lzma_ret) lzma_code(lzma_stream *strm, lzma_action action)
		lzma_nothrow lzma_attr_warn_unused_result;

/**
 * \brief       Free memory allocated for the coder data structures
 *
 * \param       strm    Pointer to lzma_stream that is at least initialized
 *                      with LZMA_STREAM_INIT.
 *
 * After lzma_end(strm), strm->internal is guaranteed to be NULL. No other
 * members of the lzma_stream structure are touched.
 *
 * \note        zlib indicates an error if application end()s unfinished
 *              stream structure. liblzma doesn't do this, and assumes that
 *              application knows what it is doing.
 */
extern LZMA_API(void) lzma_end(lzma_stream *strm) lzma_nothrow;

/**
 * \brief       Get progress information
 *
 * In single-threaded mode, applications can get progress information from
 * strm->total_in and strm->total_out. In multi-threaded mode this is less
 * useful because a significant amount of both input and output data gets
 * buffered internally by liblzma. This makes total_in and total_out give
 * misleading information and also makes the progress indicator updates
 * non-smooth.
 *
 * This function gives realistic progress information also in multi-threaded
 * mode by taking into account the progress made by each thread. In
 * single-threaded mode *progress_in and *progress_out are set to
 * strm->total_in and strm->total_out, respectively.
 */
extern LZMA_API(void) lzma_get_progress(lzma_stream *strm,
		uint64_t *progress_in, uint64_t *progress_out) lzma_nothrow;

/**
 * \brief       Get the memory usage of decoder filter chain
 *
 * This function is currently supported only when *strm has been initialized
 * with a function that takes a memlimit argument. With other functions, you
 * should use e.g. lzma_raw_encoder_memusage() or lzma_raw_decoder_memusage()
 * to estimate the memory requirements.
 *
 * This function is useful e.g. after LZMA_MEMLIMIT_ERROR to find out how big
 * the memory usage limit should have been to decode the input. Note that
 * this may give misleading information if decoding .xz Streams that have
 * multiple Blocks, because each Block can have different memory requirements.
 *
 * \return      How much memory is currently allocated for the filter
 *              decoders. If no filter chain is currently allocated,
 *              some non-zero value is still returned, which is less than
 *              or equal to what any filter chain would indicate as its
 *              memory requirement.
 *
 *              If this function isn't supported by *strm or some other error
 *              occurs, zero is returned.
 */
extern LZMA_API(uint64_t) lzma_memusage(const lzma_stream *strm)
		lzma_nothrow lzma_attr_pure;

/**
 * \brief       Get the current memory usage limit
 *
 * This function is supported only when *strm has been initialized with
 * a function that takes a memlimit argument.
 *
 * \return      On success, the current memory usage limit is returned
 *              (always non-zero). On error, zero is returned.
 */
extern LZMA_API(uint64_t) lzma_memlimit_get(const lzma_stream *strm)
		lzma_nothrow lzma_attr_pure;

/**
 * \brief       Set the memory usage limit
 *
 * This function is supported only when *strm has been initialized with
 * a function that takes a memlimit argument.
 *
 * liblzma 5.2.3 and earlier has a bug where memlimit value of 0 causes
 * this function to do nothing (leaving the limit unchanged) and still
 * return LZMA_OK. Later versions treat 0 as if 1 had been specified (so
 * lzma_memlimit_get() will return 1 even if you specify 0 here).
 *
 * \return      - LZMA_OK: New memory usage limit successfully set.
 *              - LZMA_MEMLIMIT_ERROR: The new limit is too small.
 *                The limit was not changed.
 *              - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't
 *                support memory usage limit.
 */
extern LZMA_API(lzma_ret) lzma_memlimit_set(
		lzma_stream *strm, uint64_t memlimit) lzma_nothrow;


text:
package info.opencards.core;

import java.io.File;
import java.util.HashMap;
import java.util.Map;

/**
 * A cache for instantiated CardFiles.
 *
 * @author Holger Brandl
 *

 */
public class CardFileCache {

    private static final Map<File, CardFile> cache = new HashMap<File, CardFile>();

    public static CardFile getCardFile(File file) {
        if (file == null)
            return null;

        if (!cache.containsKey(file))
            cache.put(file, new CardFile(file));

        return cache.get(file);
    }

    /**
     * Adds an already instantiated CardFile to this cache.
     */
    public static void register(CardFile cardFile) {
        cache.put(cardFile.getFileLocation(), cardFile);
    }
}


text:
<?php

spl_autoload_register(function($classname){
    if(strpos($classname,'TrustedForms\\')===0)
    {
        if(file_exists(__DIR__.'/../library/'.str_replace('\\', DIRECTORY_SEPARATOR, substr($classname, 13)).'.php'))
        {
            require_once __DIR__.'/../library/'.str_replace('\\', DIRECTORY_SEPARATOR, substr($classname, 13)).'.php';
            return true;
        }
    }
    if($classname=='phpQuery')
    {
        if(file_exists(__DIR__.'/../3dparty/phpQuery/phpQuery/phpQuery.php'))
        {
            require_once __DIR__.'/../3dparty/phpQuery/phpQuery/phpQuery.php';
        }
    }
    return false;
});


text:
export const foldr1Impl = function (f) {
  return function (xs) {
    var acc = xs[xs.length - 1];
    for (var i = xs.length - 2; i >= 0; i--) {
      acc = f(xs[i])(acc);
    }
    return acc;
  };
};

export const foldl1Impl = function (f) {
  return function (xs) {
    var acc = xs[0];
    var len = xs.length;
    for (var i = 1; i < len; i++) {
      acc = f(acc)(xs[i]);
    }
    return acc;
  };
};

export const traverse1Impl = function () {
  function Cont(fn) {
    this.fn = fn;
  }

  var emptyList = {};

  var ConsCell = function (head, tail) {
    this.head = head;
    this.tail = tail;
  };

  function finalCell(head) {
    return new ConsCell(head, emptyList);
  }

  function consList(x) {
    return function (xs) {
      return new ConsCell(x, xs);
    };
  }

  function listToArray(list) {
    var arr = [];
    var xs = list;
    while (xs !== emptyList) {
      arr.push(xs.head);
      xs = xs.tail;
    }
    return arr;
  }

  return function (apply) {
    return function (map) {
      return function (f) {
        var buildFrom = function (x, ys) {
          return apply(map(consList)(f(x)))(ys);
        };

        var go = function (acc, currentLen, xs) {
          if (currentLen === 0) {
            return acc;
          } else {
            var last = xs[currentLen - 1];
            return new Cont(function () {
              var built = go(buildFrom(last, acc), currentLen - 1, xs);
              return built;
            });
          }
        };

        return function (array) {
          var acc = map(finalCell)(f(array[array.length - 1]));
          var result = go(acc, array.length - 1, array);
          while (result instanceof Cont) {
            result = result.fn();
          }

          return map(listToArray)(result);
        };
      };
    };
  };
}();


text:
<!--

    Copyright (C) 2012-2019 the original author or authors.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->

<ehcache xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../config/ehcache.xsd" updateCheck="false">

    <defaultCache
            maxElementsInMemory="10000"
            eternal="false"
            timeToIdleSeconds="120"
            timeToLiveSeconds="120"
            overflowToDisk="false"
            maxElementsOnDisk="10000000"
            diskPersistent="false"
            diskExpiryThreadIntervalSeconds="120"
            memoryStoreEvictionPolicy="LRU"
    />

</ehcache>


text:
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:fitsSystemWindows="true">

<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/backgroundColor"
    tools:context="com.example.laptop.mutliapka.RegisterActivity"
    android:fitsSystemWindows="true">

    <include
        android:id="@+id/app_bar"
        layout="@layout/app_bar" />

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceMedium"
        android:text="Zakładanie konta MultiApki"
        android:id="@+id/textView4"
        android:layout_below="@+id/app_bar"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="36dp" />

    <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="textPersonName"
        android:ems="10"
        android:id="@+id/reg_username"
        android:layout_below="@+id/textView4"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="43dp" />

    <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="textEmailAddress"
        android:ems="10"
        android:id="@+id/reg_mail"
        android:layout_centerHorizontal="true"
        android:paddingTop="15dp"
        android:layout_below="@+id/reg_username" />

    <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="textPassword"
        android:ems="10"
        android:id="@+id/reg_pass"
        android:paddingTop="15dp"
        android:layout_alignLeft="@+id/textView4"
        android:layout_alignStart="@+id/textView4"
        android:layout_below="@+id/reg_mail" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Make it !"
        android:id="@+id/button2"
        android:layout_below="@+id/reg_pass"
        android:layout_marginTop="98dp"
        android:onClick="make"
        android:layout_alignRight="@+id/textView4"
        android:layout_alignEnd="@+id/textView4" />

    <EditText
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:inputType="textPassword"
        android:ems="10"
        android:id="@+id/reg_con_pass"
        android:paddingTop="15dp"
        android:layout_below="@+id/reg_pass"
        android:layout_alignLeft="@+id/reg_pass"
        android:layout_alignStart="@+id/reg_pass" />

</RelativeLayout>

    <fragment
        android:id="@+id/frag_nav_draw"
        android:layout_width="280dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:layout="@layout/fragment_navigation_drawer"
        android:name="com.example.laptop.mutliapka.NavigationDrawerFragment"
        tools:layout="@layout/fragment_navigation_drawer" />

</android.support.v4.widget.DrawerLayout>


text:
/*
 * theme.js: Methods for loading the site's theme.
 *
 * (C) 2011, Nodejitsu Inc.
 *
 */

var docs = require('../docs'),
    findit  = require('findit'),
    path    = require('path'),
    mkdirp  = require('mkdirp'),
    fs      = require('fs'),
    fs2     = require('../fs2'),
    helpers = require('../helpers');

var theme = exports;

theme.weld = function (dom, data) {

  // There is no real "weld" step for templates.
  return data;

};

theme.generate = function (output, files) {

  // Write theme files that *aren't* used as templates to disk.
  Object.keys(files).forEach(function (filePath) {

    // This list of template files gets filtered from the write step.
    // TODO: Find a way to generate this list programmatically.
    var templates = ['index.html', 'error.html', 'article.html'];

    if (templates.indexOf(path.basename(filePath)) !== -1) {
      return;
    }

    var newPath = docs.src + "/../public/" + filePath;

    fs2.writeFile(newPath, files[filePath], function (){ });
  });
};

theme.load = function () {

  // Read in all the files in the themes directory, and filter directories.
  var _theme = fs2.readDirSync(docs.src + '/../theme', true, function (p) {
    return !fs.statSync(p).isDirectory();
  });

  var theme = {};

  // The keys that come back from fs2.readDirSync are absolute. This makes it
  // difficult to refer to the right templates later, so here we use the
  // file paths relative to ./theme instead as keys instead.
  Object.keys(_theme).forEach(function (k) {
    var newK = helpers.unresolve(docs.src + '/../theme', k);
    theme[newK] = _theme[k];
  });

  return theme;

};


text:
import { ShopItemModel } from "../../app/app.model";

export class ListShopModel {
    items: Array<ShopItemModel>;
}


text:
from api import API
# from fserver.models import *

class Update(API):
    def __init__(self, request):
        super(API, self).__init__(request)


text:
<!DOCTYPE html>
<html>
    <head>
        <script src="../../media/media-file.js"></script>
        <!-- TODO(philipj): Convert test to testharness.js. crbug.com/588956
             (Please avoid writing new tests using video-test.js) -->
        <script src="../../media/video-test.js"></script>
        <script type="text/javascript">
            if (window.testRunner) {
                window.testRunner.dumpAsTextWithPixelResults();
                window.testRunner.waitUntilDone();
            }
            function runTest() {
                video = document.getElementById('video');
                video.addEventListener('canplaythrough', canplaythrough, true);
                video.src = findMediaFile('video', '../../media/content/test');
            }
            function canplaythrough(e) {
                var video = e.target;
                video.addEventListener('seeked', seeked, true);
                video.currentTime = 1;
            }
            function seeked(e) {
                testExpected('video.currentTime', 1);

                if (window.testRunner)
                    setTimeout(function() { testRunner.notifyDone(); }, 150);
            }
        </script>
        <style>
            video {
                -webkit-box-reflect: below 0px;
                border: 3px solid red;
            }
        </style>
    </head>
    <body onload="runTest()">
        <video id="video"></video>
    </body>
</html>


text:
import sys
biopython_lib = request.folder + "modules/"
sys.path.append(biopython_lib)

from Bio import Phylo
from Bio.Phylo import BaseTree
from StringIO import StringIO

def index():
   # Dump a Bio.Phylo tree object as string
   tree = Phylo.read(StringIO("(A, (B, C), (D, E))"), "newick")
   #tree_str = Phylo.draw_ascii(tree)
   count = BaseTree.TreeMixin.count_terminals(tree)
   #return "<pre>" + str(tree) + "</pre>"
   return count


text:
package net.glowstone.entity;

import com.flowpowered.math.vector.Vector3d;
import com.flowpowered.networking.Message;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableMap;
import net.glowstone.GlowServer;
import net.glowstone.data.GlowDataHolder;
import net.glowstone.entity.meta.MetadataIndex;
import net.glowstone.entity.meta.MetadataMap;
import net.glowstone.entity.physics.BoundingBox;
import net.glowstone.entity.physics.EntityBoundingBox;
import net.glowstone.net.message.play.entity.*;
import net.glowstone.util.Locations;
import net.glowstone.util.MutableVector;
import net.glowstone.util.Position;
import net.glowstone.world.GlowChunk;
import net.glowstone.world.GlowWorld;
import org.apache.commons.lang3.Validate;
import org.spongepowered.api.block.BlockType;
import org.spongepowered.api.data.DataContainer;
import org.spongepowered.api.data.DataQuery;
import org.spongepowered.api.data.DataView;
import org.spongepowered.api.data.Property;
import org.spongepowered.api.entity.Entity;
import org.spongepowered.api.util.Direction;
import org.spongepowered.api.util.RelativePositions;
import org.spongepowered.api.world.DimensionTypes;
import org.spongepowered.api.world.Location;
import org.spongepowered.api.world.World;

import java.util.EnumSet;
import java.util.LinkedList;
import java.util.List;
import java.util.UUID;

/**
 * Represents some entity in the world such as an item on the floor or a player.
 * @author Graham Edgecombe
 */
public abstract class GlowEntity extends GlowDataHolder implements Entity {
    /**
     * The server this entity belongs to.
     */
    protected final GlowServer server;

    /**
     * The entity's metadata.
     */
    protected final MetadataMap metadata = new MetadataMap(getClass());

    /**
     * The world this entity belongs to.
     */
    protected GlowWorld world;

    /**
     * Whether this entity was spawned.
     */
    protected boolean spawned = false;

    /**
     * A flag indicating if this entity is currently active.
     */
    protected boolean active = true;

    /**
     * This entity's unique id.
     */
    private UUID uuid;

    /**
     * This entity's current identifier for its world.
     */
    protected int id;

    /**
     * The current position.
     */
    protected final MutableVector location;

    /**
     * The position in the last cycle.
     */
    protected final MutableVector previousLocation;

    /**
     * The entity's rotation.
     */
    protected double yaw, pitch;

    /**
     * The entity's velocity, applied each tick.
     */
    protected Vector3d velocity = new Vector3d();

    /**
     * The entity's bounding box, or null if it has no physical presence.
     */
    private EntityBoundingBox boundingBox;

    /**
     * Whether the entity should have its position resent as if teleported.
     */
    protected boolean teleported = false;

    /**
     * Whether the entity should have its velocity resent.
     */
    protected boolean velocityChanged = false;

    /**
     * A flag indicting if the entity is on the ground
     */
    private boolean onGround = true;

    /**
     * The distance the entity is currently falling without touching the ground.
     */
    private float fallDistance;

    /**
     * A counter of how long this entity has existed
     */
    private int ticksLived = 0;

    /**
     * How long the entity has been on fire, or 0 if it is not.
     */
    private int fireTicks = 0;

    /**
     * The entity's properties.
     */
    private final ImmutableMap<Class<?>, Property<?, ?>> properties;

    /**
     * Creates a new instance of this entity without spawning it.
     */
    public GlowEntity(Location location) {
        this.world = Locations.world(location);
        this.server = this.world.getServer();
        this.location = new MutableVector(Locations.worldLoc(location));
        this.yaw = this.pitch = 0;
        previousLocation = this.location.clone();
        properties = ImmutableMap.of();
    }

    @Override
    public String toString() {
        return getClass().getSimpleName();
    }

    ////////////////////////////////////////////////////////////////////////////
    // Core properties

    public void spawn() {
        this.spawned = true;
        server.getEntityIdManager().allocate(this);
        world.getEntityManager().register(this);
    }

    @Override
    public final GlowWorld getWorld() {
        return world;
    }

    public final int getEntityId() {
        return id;
    }

    @Override
    public UUID getUniqueId() {
        if (uuid == null) {
            uuid = UUID.randomUUID();
        }
        return uuid;
    }

    public boolean isDead() {
        return !active;
    }

    public boolean isValid() {
        return world.getEntityManager().getEntity(id) == this;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Location stuff

    @Override
    public Location getLocation() {
        return new Location(world, location.getX(), location.getY(), location.getZ());
    }

    @Override
    public void setLocation(Location newLocation) {
        Validate.notNull(newLocation, "location cannot be null");

        Location location = Locations.worldLoc(newLocation);
        if (location.getExtent() != world) {
            world.getEntityManager().unregister(this);
            world = (GlowWorld) location.getExtent();
            world.getEntityManager().register(this);
        }
        setRawLocation(location);
        teleported = true;
    }

    @Override
    public void setLocationAndRotation(Location location, Vector3d rotation) {
        setLocation(location);
        this.yaw = rotation.getX();
        this.pitch = rotation.getY();
    }

    @Override
    public void setLocationAndRotation(Location location, Vector3d rotation, EnumSet<RelativePositions> relativePositions) {

    }

    @Override
    public boolean setLocationSafely(Location location) {
        Optional<Location> newLocation = server.getGame().getTeleportHelper().getSafeLocation(location);
        if (newLocation.isPresent()) {
            setLocation(location);
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean setLocationAndRotationSafely(Location location, Vector3d rotation) {
        Optional<Location> newLocation = server.getGame().getTeleportHelper().getSafeLocation(location);
        if (newLocation.isPresent()) {
            setLocationAndRotation(location, rotation);
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean setLocationAndRotationSafely(Location location, Vector3d rotation, EnumSet<RelativePositions> relativePositions) {
        Optional<Location> newLocation = server.getGame().getTeleportHelper().getSafeLocation(location);
        if (newLocation.isPresent()) {
            setLocationAndRotation(location, rotation, relativePositions);
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean transferToWorld(String worldName, Vector3d position) {
        Optional<World> world = server.loadWorld(worldName);
        if (world.isPresent()) {
            setLocation(new Location(world.get(), position.getX(), position.getY(), position.getZ()));
            return true;
        } else {
            return false;
        }
    }

    @Override
    public boolean transferToWorld(UUID uuid, Vector3d position) {
        Optional<World> world = server.loadWorld(uuid);
        if (world.isPresent()) {
            setLocation(new Location(world.get(), position.getX(), position.getY(), position.getZ()));
            return true;
        } else {
            return false;
        }
    }

    @Override
    public Vector3d getRotation() {
        return new Vector3d(yaw, pitch, 0);
    }

    @Override
    public void setRotation(Vector3d rotation) {
        this.yaw = rotation.getX();
        this.pitch = rotation.getY();
        teleported = true;
    }

    /**
     * Get the direction (SOUTH, WEST, NORTH, or EAST) this entity is facing.
     * @return The cardinal BlockFace of this entity.
     */
    public Direction getDirection() {
        double rot = yaw % 360;
        if (rot < 0) {
            rot += 360.0;
        }
        if (0 <= rot && rot < 45) {
            return Direction.SOUTH;
        } else if (45 <= rot && rot < 135) {
            return Direction.WEST;
        } else if (135 <= rot && rot < 225) {
            return Direction.NORTH;
        } else if (225 <= rot && rot < 315) {
            return Direction.EAST;
        } else if (315 <= rot && rot < 360.0) {
            return Direction.SOUTH;
        } else {
            return Direction.EAST;
        }
    }

    /**
     * Gets the full direction (including SOUTH_SOUTH_EAST etc) this entity is facing.
     * @return The intercardinal BlockFace of this entity
     */
    public Direction getFacing() {
        long facing = Math.round(yaw / 22.5) + 8;
        return Position.getDirection((byte) (facing % 16));
    }

    public void setVelocity(Vector3d velocity) {
        this.velocity = velocity;
        velocityChanged = true;
    }

    public void setVelocity(MutableVector velocity) {
        this.velocity = velocity.toVector3d();
        velocityChanged = true;
    }

    public Vector3d getVelocity() {
        return velocity.clone();
    }

    ////////////////////////////////////////////////////////////////////////////
    // Internals

    /**
     * Checks if this entity is within the visible radius of another.
     * @param other The other entity.
     * @return {@code true} if the entities can see each other, {@code false} if
     * not.
     */
    public boolean isWithinDistance(GlowEntity other) {
        return !other.isDead() && (isWithinDistance(other.world, other.location) || other instanceof GlowLightningStrike);
    }

    /**
     * Checks if this entity is within the visible radius of a location.
     * @param loc The location.
     * @return {@code true} if the entities can see each other, {@code false} if
     * not.
     */
    public boolean isWithinDistance(GlowWorld world, MutableVector loc) {
        double dx = Math.abs(location.getX() - loc.getX());
        double dz = Math.abs(location.getZ() - loc.getZ());
        return this.world == world && dx <= (server.getViewDistance() * GlowChunk.WIDTH) && dz <= (server.getViewDistance() * GlowChunk.HEIGHT);
    }

    /**
     * Checks whether this entity should be saved as part of the world.
     * @return True if the entity should be saved.
     */
    public boolean shouldSave() {
        return true;
    }

    /**
     * Called every game cycle. Subclasses should implement this to implement
     * periodic functionality e.g. mob AI.
     */
    public void pulse() {
        ticksLived++;

        if (fireTicks > 0) {
            --fireTicks;
        }
        metadata.setBit(MetadataIndex.STATUS, MetadataIndex.StatusFlags.ON_FIRE, fireTicks > 0);

        // resend position if it's been a while
        if (ticksLived % (30 * 20) == 0) {
            teleported = true;
        }

        pulsePhysics();

        if (hasMoved()) {
            checkEndTeleporting();
        }
    }

    private void checkEndTeleporting() {
       /* Block currentBlock = location.getBlock();
        if (currentBlock.getType() == Material.ENDER_PORTAL) {
            EventFactory.callEvent(new EntityPortalEnterEvent(this, currentBlock.getLocation()));
            if (server.getAllowEnd()) {
                Location previousLocation = location.clone();
                boolean success;
                if (getWorld().getEnvironment() == World.Environment.THE_END) {
                    success = teleportToSpawn();
                } else {
                    success = teleportToEnd();
                }
                if (success) {
                    EntityPortalExitEvent e = EventFactory.callEvent(new EntityPortalExitEvent(this, previousLocation, location.clone(), velocity.clone(), new Vector()));
                    if (!e.getAfter().equals(velocity)) {
                        setVelocity(e.getAfter());
                    }
                }
            }
        }*/
    }

    /**
     * Resets the previous location and other properties to their current value.
     */
    public void reset() {
        previousLocation.updateFrom(location);
        metadata.resetChanges();
        teleported = false;
        velocityChanged = false;
    }

    /**
     * Sets this entity's location.
     * @param location The new location.
     */
    public void setRawLocation(Location location) {
        setRawLocation(new MutableVector(location));
    }

    public void setRawLocation(MutableVector location) {
        world.getEntityManager().move(this, location);
        this.location.updateFrom(location);
    }

    public MutableVector getRawLocation() {
        return location;
    }

    /**
     * Sets this entity's unique identifier if possible.
     * @param uuid The new UUID. Must not be null.
     * @throws IllegalArgumentException if the passed UUID is null.
     * @throws IllegalStateException if a UUID has already been set.
     */
    public void setUniqueId(UUID uuid) {
        Validate.notNull(uuid, "uuid must not be null");
        if (this.uuid == null) {
            this.uuid = uuid;
        } else if (!this.uuid.equals(uuid)) {
            // silently allow setting the same UUID, since
            // it can't be checked with getUniqueId()
            throw new IllegalStateException("UUID of " + this + " is already " + this.uuid);
        }
    }

    /**
     * Creates a {@link Message} which can be sent to a client to spawn this
     * entity.
     * @return A message which can spawn this entity.
     */
    public abstract List<Message> createSpawnMessage();

    /**
     * Creates a {@link Message} which can be sent to a client to update this
     * entity.
     * @return A message which can update this entity.
     */
    public List<Message> createUpdateMessage() {
        boolean moved = hasMoved();
        boolean rotated = hasRotated();

        int x = Position.getIntX(location);
        int y = Position.getIntY(location);
        int z = Position.getIntZ(location);

        int dx = x - Position.getIntX(previousLocation);
        int dy = y - Position.getIntY(previousLocation);
        int dz = z - Position.getIntZ(previousLocation);

        boolean teleport = dx > Byte.MAX_VALUE || dy > Byte.MAX_VALUE || dz > Byte.MAX_VALUE || dx < Byte.MIN_VALUE || dy < Byte.MIN_VALUE || dz < Byte.MIN_VALUE;

        int yaw = Position.getIntYaw(this.yaw);
        int pitch = Position.getIntPitch(this.pitch);

        List<Message> result = new LinkedList<>();
        if (teleported || (moved && teleport)) {
            result.add(new EntityTeleportMessage(id, x, y, z, yaw, pitch));
        } else if (moved && rotated) {
            result.add(new RelativeEntityPositionRotationMessage(id, dx, dy, dz, yaw, pitch));
        } else if (moved) {
            result.add(new RelativeEntityPositionMessage(id, dx, dy, dz));
        } else if (rotated) {
            result.add(new EntityRotationMessage(id, yaw, pitch));
        }

        // todo: handle head rotation as a separate value
        if (rotated) {
            result.add(new EntityHeadRotationMessage(id, yaw));
        }

        // send changed metadata
        List<MetadataMap.Entry> changes = metadata.getChanges();
        if (changes.size() > 0) {
            result.add(new EntityMetadataMessage(id, changes));
        }

        // send velocity if needed
        if (velocityChanged) {
            result.add(new EntityVelocityMessage(id, velocity));
        }

        return result;
    }

    /**
     * Checks if this entity has moved this cycle.
     * @return {@code true} if so, {@code false} if not.
     */
    public boolean hasMoved() {
        return Position.hasMoved(location, previousLocation);
    }

    /**
     * Checks if this entity has rotated this cycle.
     * @return {@code true} if so, {@code false} if not.
     */
    public boolean hasRotated() {
        return Position.hasRotated(location, previousLocation);
    }

    /**
     * Teleport this entity to the spawn point of the main world.
     * This is used to teleport out of the End.
     * @return {@code true} if the teleport was successful.
     */
    protected boolean teleportToSpawn() {
        Location target = server.getWorlds().get(0).getSpawnLocation();

       /*
        TODO: event?
        EntityPortalEvent event = EventFactory.callEvent(new EntityPortalEvent(this, location.clone(), target, null));
        if (event.isCancelled()) {
            return false;
        }
        target = event.getTo();*/

        setLocation(target);
        return true;
    }

    /**
     * Teleport this entity to the End.
     * If no End world is loaded this does nothing.
     * @return {@code true} if the teleport was successful.
     */
    protected boolean teleportToEnd() {
        /*
        TODO: allowEnd
        if (!allowEnd) {
            return false;
        }*/
        Location target = null;
        for (World world : server.getWorlds()) {
            if (world.getDimension().getType() == DimensionTypes.END) {
                target = world.getSpawnLocation();
                break;
            }
        }
        if (target == null) {
            return false;
        }

       /*
       TODO: event?
       EntityPortalEvent event = EventFactory.callEvent(new EntityPortalEvent(this, location.clone(), target, null));
        if (event.isCancelled()) {
            return false;
        }
        target = event.getTo();*/

        setLocation(target);
        return true;
    }

    /**
     * Determine if this entity is intersecting a block of the specified type.
     * If the entity has a defined bounding box, that is used to check for
     * intersection. Otherwise,
     * @param material The material to check for.
     * @return True if the entity is intersecting
     */
    public boolean isTouchingMaterial(BlockType material) {
        if (boundingBox == null) {
            // less accurate calculation if no bounding box is present
            for (Direction face : new Direction[]{Direction.EAST, Direction.WEST, Direction.SOUTH, Direction.NORTH, Direction.DOWN, Direction.NONE,
                    Direction.NORTHEAST, Direction.NORTHWEST, Direction.SOUTHEAST, Direction.SOUTHWEST}) {
                Vector3d adding = face.toVector3d();
                //TODO: correct rounding
                if (world.getBlockType((int) (location.getX() + adding.getX()), (int) (location.getY() + adding.getY()), (int) (location.getZ() + adding.getZ())).equals(material)) {
                    return true;
                }
            }
        } else {
            // bounding box-based calculation
            MutableVector min = boundingBox.minCorner, max = boundingBox.maxCorner;
            for (int x = min.getBlockX(); x <= max.getBlockX(); ++x) {
                for (int y = min.getBlockY(); y <= max.getBlockY(); ++y) {
                    for (int z = min.getBlockZ(); z <= max.getBlockZ(); ++z) {
                        if (world.getBlockType(x, y, z).equals(material)) {
                            return true;
                        }
                    }
                }
            }
        }
        return false;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Physics stuff

    protected final void setBoundingBox(double xz, double y) {
        boundingBox = new EntityBoundingBox(xz, y);
    }

    public boolean intersects(BoundingBox box) {
        return boundingBox != null && boundingBox.intersects(box);
    }

    protected void pulsePhysics() {
        // todo: update location based on velocity,
        // do gravity, all that other good stuff

        // make sure bounding box is up to date
        if (boundingBox != null) {
            boundingBox.setCenter(location.getX(), location.getY(), location.getZ());
        }
    }

    ////////////////////////////////////////////////////////////////////////////
    // Various properties
    public int getFireTicks() {
        return fireTicks;
    }

    public void setFireTicks(int ticks) {
        fireTicks = ticks;
    }

    public float getFallDistance() {
        return fallDistance;
    }

    public void setFallDistance(float distance) {
        fallDistance = Math.max(distance, 0);
    }

    public int getTicksLived() {
        return ticksLived;
    }

    public void setTicksLived(int value) {
        this.ticksLived = value;
    }

    @Override
    public boolean isOnGround() {
        return onGround;
    }

    @Override
    public boolean isRemoved() {
        return active;
    }

    @Override
    public boolean isLoaded() {
        return !isRemoved();
    }

    public void setOnGround(boolean onGround) {
        this.onGround = onGround;
    }

    ////////////////////////////////////////////////////////////////////////////
    // Miscellaneous actions

    @Override
    public void remove() {
        active = false;
        world.getEntityManager().unregister(this);
        server.getEntityIdManager().deallocate(this);
    }

    public List<Entity> getNearbyEntities(double x, double y, double z) {
        // This behavior is similar to CraftBukkit, where a call with args
        // (0, 0, 0) finds any entities whose bounding boxes intersect that of
        // this entity.

        BoundingBox searchBox;
        if (boundingBox == null) {
            searchBox = BoundingBox.fromPositionAndSize(location, new MutableVector(0, 0, 0));
        } else {
            searchBox = BoundingBox.copyOf(boundingBox);
        }
        Vector3d vec = new Vector3d(x, y, z);
        searchBox.minCorner.sub(vec);
        searchBox.maxCorner.add(vec);

        return world.getEntityManager().getEntitiesInside(searchBox, this);
    }

   /* @Override
    public void playEffect(Effect type) {
        EntityStatusMessage message = new EntityStatusMessage(id, type);
        for (GlowPlayer player : world.getRawPlayers()) {
            if (player.canSeeEntity(this)) {
                player.getSession().send(message);
            }
        }
    }*/

    @Override
    public final DataContainer toContainer() {
        DataContainer container = super.toContainer();
        serialize(container);
        return container;
    }

    protected void serialize(DataView data) {
        data.set(DataQuery.of("world"), world.getUniqueId().toString());
        data.set(DataQuery.of("x"), location.getX());
        data.set(DataQuery.of("y"), location.getY());
        data.set(DataQuery.of("z"), location.getZ());
    }
}


text:
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-comp-4588',
  templateUrl: './comp-4588.component.html',
  styleUrls: ['./comp-4588.component.css']
})
export class Comp4588Component implements OnInit {

  constructor() { }

  ngOnInit() {
  }

}


text:
Solução do developer task proposto. Feito em Python 2.7.10.

Utilização:

Usar o script logparser.py na pasta onde se encontra o log a ser analisado. Utilizar o seguinte comando no prompt de comando:

>> python logparser.py log

"log" pode ser substituido por qualquer nome de arquivo no qual o log pode estar contido (ex: log1.txt, log04092015, etc.)

Adicionei no repositório uma imagem com um exemplo de utilização com o log fornecido.


text:
package org.onosproject.iptopology.api.device;

import org.onosproject.iptopology.api.DeviceTed;
import org.onosproject.iptopology.api.IpDeviceIdentifier;
import org.onosproject.net.AbstractDescription;
import org.onosproject.net.SparseAnnotations;

import java.net.URI;

import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkNotNull;
import static org.onosproject.iptopology.api.IpDevice.Type;

/**
 * Default implementation of immutable device description entity.
 */
public class DefaultIpDeviceDescription extends AbstractDescription
        implements IpDeviceDescription {
    private final URI uri;
    private final Type type;
    private final IpDeviceIdentifier deviceIdentifier;
    private final DeviceTed deviceTed;

    /**
     * Creates an ip device description using the supplied information.
     *
     * @param uri               device URI
     * @param type              device type
     * @param deviceIdentifier  device manufacturer
     * @param deviceTed         device Traffic Engineering parameters
     * @param annotations  optional key/value annotations map
     */
    public DefaultIpDeviceDescription(URI uri, Type type, IpDeviceIdentifier deviceIdentifier,
                                    DeviceTed deviceTed, SparseAnnotations... annotations) {
        super(annotations);
        this.uri = checkNotNull(uri, "Device URI cannot be null");
        this.type = checkNotNull(type, "Device type cannot be null");
        this.deviceIdentifier = deviceIdentifier;
        this.deviceTed = deviceTed;
    }

    /**
     * Creates an ip device description using the supplied information.
     * @param base IpDeviceDescription to basic information
     * @param annotations Annotations to use.
     */
    public DefaultIpDeviceDescription(IpDeviceDescription base, SparseAnnotations... annotations) {
        this(base.deviceUri(), base.type(), base.deviceIdentifier(),
             base.deviceTed(), annotations);
    }

    /**
     * Creates an ip device description using the supplied information.
     * @param base IpDeviceDescription to basic information (except for type)
     * @param type device type
     * @param annotations Annotations to use.
     */
    public DefaultIpDeviceDescription(IpDeviceDescription base, Type type, SparseAnnotations... annotations) {
        this(base.deviceUri(), type, base.deviceIdentifier(),
                base.deviceTed(), annotations);
    }

    @Override
    public URI deviceUri() {
        return uri;
    }

    @Override
    public Type type() {
        return type;
    }

    @Override
    public IpDeviceIdentifier deviceIdentifier() {
        return deviceIdentifier;
    }

    @Override
    public DeviceTed deviceTed() {
        return deviceTed;
    }

    @Override
    public String toString() {
        return toStringHelper(this)
                .add("uri", uri)
                .add("type", type)
                .add("devid", deviceIdentifier)
                .add("devTed", deviceTed)
                .toString();
    }

    /**
     * Default constructor for serialization.
     */
    private DefaultIpDeviceDescription() {
        this.uri = null;
        this.type = null;
        this.deviceIdentifier = null;
        this.deviceTed = null;
    }
}


text: require 'action_mailer/demuxer'


text:
using System;
using System.Collections.Generic;
using System.Linq;

// https://www.sololearn.com/Discuss/697164/?ref=app

namespace SoloLearn
{
    class Program
    {
        static void Main(string[] zephyr_koo)
        {
            var numberList = new List<ulong> { 1, 2 }; // starting case (ulong == UInt64)

            while (true)
            {
                var number = numberList[numberList.Count - 2] * numberList[numberList.Count - 1];

                if (number == ulong.MinValue) break; // overflow

                numberList.Add(number);
            }

            Console.WriteLine(string.Join(", ", numberList));
        }
    }
}


text:
#ifndef __CHANNEL_IDLE_STATE_HANDLER_H__
#define __CHANNEL_IDLE_STATE_HANDLER_H__

#include <channel/ChannelHandler.h>

TINY_BEGIN_DECLS

#define ChannelIdleStateHandler_Name    "ChannelIdleStateHandler"

TINY_API
TINY_LOR
ChannelHandler * ChannelIdleStateHandler(uint32_t readerIdle, uint32_t writerIdle, uint32_t allIdle);

TINY_END_DECLS

#endif /* __CHANNEL_IDLE_STATE_HANDLER_H__ */