text:
using System;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

using FubarDev.FtpServer.Features;

namespace FubarDev.FtpServer.CommandExtensions
{
    /// <summary>
    /// The implementation of the <c>OPTS UTF8</c> command.
    /// </summary>
    [FtpCommandHandlerExtension("UTF8", "OPTS", false)]
    [FtpCommandHandlerExtension("UTF-8", "OPTS", false)]
    [FtpFeatureText("UTF8")]
    public class OptsUtf8CommandExtension : FtpCommandHandlerExtension
    {
        private static readonly UTF8Encoding _encodingUtf8 = new UTF8Encoding(false);

        /// <inheritdoc />
        [Obsolete("Use the FtpCommandHandlerExtension attribute instead.")]
        public override bool? IsLoginRequired { get; } = false;

        /// <inheritdoc />
        public override void InitializeConnectionData()
        {
        }

        /// <inheritdoc />
        public override Task<IFtpResponse?> Process(FtpCommand command, CancellationToken cancellationToken)
        {
            var encodingFeature = Connection.Features.Get<IEncodingFeature>();
            switch (command.Argument.ToUpperInvariant())
            {
                case "ON": // Compatibility feature...
                case "NLST": // NLST and other paths are transmitted as UTF-8
                    encodingFeature.Reset();
                    encodingFeature.Encoding = encodingFeature.NlstEncoding = _encodingUtf8;
                    break;
                case "":
                    // Only for non-NLST paths are transmitted as UTF-8
                    encodingFeature.Reset();
                    encodingFeature.Encoding = _encodingUtf8;
                    break;
                default:
                    return Task.FromResult<IFtpResponse?>(new FtpResponse(501, T("Syntax error in parameters or arguments.")));
            }

            return Task.FromResult<IFtpResponse?>(new FtpResponse(200, T("Command okay.")));
        }
    }
}


text:
SET(CMAKE_DEPENDS_LANGUAGES
  "C"
  )
# The set of files for implicit dependencies of each language:
SET(CMAKE_DEPENDS_CHECK_C
  "/data/home/robin/test/cmake/6/libhello/hello.c" "/data/home/robin/test/cmake/6/build/lib/CMakeFiles/libhello.dir/hello.c.o"
  )
SET(CMAKE_C_COMPILER_ID "GNU")

# Targets to which this target links.
SET(CMAKE_TARGET_LINKED_INFO_FILES
  )

# The include file search paths:
SET(CMAKE_C_TARGET_INCLUDE_PATH
  )
SET(CMAKE_CXX_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH})
SET(CMAKE_Fortran_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH})
SET(CMAKE_ASM_TARGET_INCLUDE_PATH ${CMAKE_C_TARGET_INCLUDE_PATH})

redpajama_set_name: RedPajamaGithub


text:
package com.frogtown.engine;

/**
 * Created by matthew on 11/20/14.
 */
public class Town {
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CreateFiveRandomCardsThenSortThem
{
    class Card
    {
        public Suits Suit { get; set; }
        public Values Value { get; set; }

        public Card(Suits suit, Values value)
        {
            this.Suit = suit;
            this.Value = value;
        }
        public string Name
        {
            get { return Value.ToString() + " of " + Suit.ToString(); }
        }

        public override string ToString()
        {
            return Name;
        }
    }

}


text:
/**
 * @author 戎晓伟
 * @description  Sink信息设置
 */

import React, { PropTypes, Component } from 'react'
import { Form, Select, Input, Button, Row, Col } from 'antd'
import { FormattedMessage } from 'react-intl'
import { fromJS } from 'immutable'
// 导入样式
import styles from './res/styles/index.less'

const FormItem = Form.Item
const Option = Select.Option

@Form.create()
export default class ProjectTopologySearch extends Component {
  /**
   * 校验并查询
   */
  handleSearch = e => {
    const { validateFields } = this.props.form
    const { onSearch, topologyParams } = this.props
    // 校验并查询
    validateFields((err, value) => {
      if (!err) {
        onSearch({ ...topologyParams, ...value }, true)
      }
    })
  };
  render () {
    const { onCreateTopology, onProjectIdChange, projectList, topologyList, projectId, isCreate } = this.props
    const { getFieldDecorator } = this.props.form
    const isCanCreateTopology =
      topologyList.result.isCanCreateTopology === undefined
        ? 1
        : topologyList.result.isCanCreateTopology
    const { result } = projectList
    const project = [
      { id: null, project_display_name: '请选择Project' },
      ...Object.values(result)
    ] || [{ id: null, project_display_name: '请选择Project' }]
    return (
      <div className="form-search">
        <Form autoComplete="off" layout="inline" className={styles.searchForm} onKeyUp={e => e.keyCode === 13 && this.handleSearch()}>
          <Row>
            <Col span={12} className={styles.formLeft}>
              {
                <Button
                  size="large"
                  type="primary"
                  icon="plus"
                  onClick={() => onCreateTopology(true)}
                  disabled={!isCanCreateTopology}
                  className={styles.button}
              >
                  <FormattedMessage id="app.common.added" defaultMessage="新增" />
                </Button>
              }
              {
                !isCreate && <FormItem
                  label={
                    <FormattedMessage
                      id="app.common.table.project"
                      defaultMessage="项目"
                  />
                }
              >
                  {getFieldDecorator('projectId', {
                    initialValue: null
                  })(
                    <Select
                      showSearch
                      optionFilterProp='children'
                      className={styles.select}
                      placeholder="Select Project"
                      onChange={onProjectIdChange}
                  >
                      {project.map(item => (
                        <Option
                          value={item.id ? `${item.id}` : null}
                          key={item.id ? `${item.id}` : '0000'}
                      >
                          {item.project_display_name}
                        </Option>
                    ))}
                    </Select>
                )}
                </FormItem>
              }
            </Col>
            <Col span={12} className={styles.formRight}>
              <FormItem>
                {getFieldDecorator('topoName', {
                  initialValue: ''
                })(<Input className={styles.input} placeholder="topoName" />)}
              </FormItem>
              <FormItem>
                <Button
                  type="primary"
                  icon="search"
                  onClick={this.handleSearch}
                >
                  <FormattedMessage
                    id="app.common.search"
                    defaultMessage="查询"
                  />
                </Button>
              </FormItem>
            </Col>
          </Row>
        </Form>
      </div>
    )
  }
}

ProjectTopologySearch.propTypes = {
  form: PropTypes.object,
  local: PropTypes.any,
  projectList: PropTypes.object,
  topologyList: PropTypes.object,
  topologyParams: PropTypes.object,
  onSearch: PropTypes.func,
  onCreateTopology: PropTypes.func
}


text:
Dummy::Application.configure do
  # Settings specified here will take precedence over those in config/application.rb

  # In the development environment your application's code is reloaded on
  # every request.  This slows down response time but is perfect for development
  # since you don't have to restart the web server when you make code changes.
  config.cache_classes = false

  # Log error messages when you accidentally call methods on nil.
  config.whiny_nils = true

  # Show full error reports and disable caching
  config.consider_all_requests_local       = true
  config.action_controller.perform_caching = false

  # Don't care if the mailer can't send
  config.action_mailer.raise_delivery_errors = false

  # Print deprecation notices to the Rails logger
  config.active_support.deprecation = :log

  # Only use best-standards-support built into browsers
  config.action_dispatch.best_standards_support = :builtin

  # Do not compress assets
  config.assets.compress = false

  # Expands the lines which load the assets
  config.assets.debug = true

  # These 2 lines auto-reload conversations
  # This first line adds our gem's lib directory to the list of directories that will be searched
  # when we encounter a missing constant
  config.autoload_paths += %W(#{config.root}/../conversations/lib)
  # This line tells rails to unload the root constant (module/class) for our gem on every request
  ActiveSupport::Dependencies.explicitly_unloadable_constants << 'Conversations'
end


text:
/*
 * 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.
 */
package com.facebook.presto.orc;

import com.facebook.presto.common.Page;
import io.airlift.units.DataSize;

import java.util.Optional;

import static com.facebook.presto.orc.FlushReason.DICTIONARY_FULL;
import static com.facebook.presto.orc.FlushReason.MAX_BYTES;
import static com.facebook.presto.orc.FlushReason.MAX_ROWS;
import static com.google.common.base.MoreObjects.toStringHelper;
import static com.google.common.base.Preconditions.checkArgument;
import static io.airlift.units.DataSize.Unit.MEGABYTE;
import static java.lang.Math.max;
import static java.lang.Math.toIntExact;
import static java.util.Objects.requireNonNull;

public class DefaultOrcWriterFlushPolicy
        implements OrcWriterFlushPolicy
{
    public static final DataSize DEFAULT_STRIPE_MIN_SIZE = new DataSize(32, MEGABYTE);
    public static final DataSize DEFAULT_STRIPE_MAX_SIZE = new DataSize(64, MEGABYTE);
    public static final int DEFAULT_STRIPE_MAX_ROW_COUNT = 10_000_000;

    private final int stripeMaxRowCount;
    private final int stripeMinBytes;
    private final int stripeMaxBytes;

    private DefaultOrcWriterFlushPolicy(int stripeMaxRowCount, int stripeMinBytes, int stripeMaxBytes)
    {
        this.stripeMaxRowCount = stripeMaxRowCount;
        this.stripeMinBytes = stripeMinBytes;
        this.stripeMaxBytes = stripeMaxBytes;
    }

    @Override
    public Optional<FlushReason> shouldFlushStripe(int stripeRowCount, int bufferedBytes, boolean dictionaryIsFull)
    {
        if (stripeRowCount == stripeMaxRowCount) {
            return Optional.of(MAX_ROWS);
        }
        else if (bufferedBytes > stripeMaxBytes) {
            return Optional.of(MAX_BYTES);
        }
        else if (dictionaryIsFull) {
            return Optional.of(DICTIONARY_FULL);
        }
        return Optional.empty();
    }

    @Override
    public int getMaxChunkRowCount(Page page)
    {
        // avoid chunks with huge logical size
        int chunkMaxLogicalBytes = max(1, stripeMaxBytes / 2);
        double averageLogicalSizePerRow = (double) page.getApproximateLogicalSizeInBytes() / page.getPositionCount();
        return max(1, (int) (chunkMaxLogicalBytes / max(1, averageLogicalSizePerRow)));
    }

    @Override
    public int getStripeMinBytes()
    {
        return stripeMinBytes;
    }

    @Override
    public int getStripeMaxBytes()
    {
        return stripeMaxBytes;
    }

    @Override
    public int getStripeMaxRowCount()
    {
        return stripeMaxRowCount;
    }

    @Override
    public String toString()
    {
        return toStringHelper(this)
                .add("stripeMaxRowCount", stripeMaxRowCount)
                .add("stripeMinBytes", stripeMinBytes)
                .add("stripeMaxBytes", stripeMaxBytes)
                .toString();
    }

    public static Builder builder()
    {
        return new Builder();
    }

    public static class Builder
    {
        private int stripeMaxRowCount = DEFAULT_STRIPE_MAX_ROW_COUNT;
        private DataSize stripeMinSize = DEFAULT_STRIPE_MIN_SIZE;
        private DataSize stripeMaxSize = DEFAULT_STRIPE_MAX_SIZE;

        private Builder() {}

        public Builder withStripeMaxRowCount(int stripeMaxRowCount)
        {
            checkArgument(stripeMaxRowCount >= 1, "stripeMaxRowCount must be at least 1");
            this.stripeMaxRowCount = stripeMaxRowCount;
            return this;
        }

        public Builder withStripeMinSize(DataSize stripeMinSize)
        {
            this.stripeMinSize = requireNonNull(stripeMinSize, "stripeMinSize is null");
            return this;
        }

        public Builder withStripeMaxSize(DataSize stripeMaxSize)
        {
            this.stripeMaxSize = requireNonNull(stripeMaxSize, "stripeMaxSize is null");
            return this;
        }

        public DefaultOrcWriterFlushPolicy build()
        {
            checkArgument(stripeMaxSize.compareTo(stripeMinSize) >= 0, "stripeMaxSize must be greater than stripeMinSize");
            return new DefaultOrcWriterFlushPolicy(
                    stripeMaxRowCount,
                    toIntExact(stripeMinSize.toBytes()),
                    toIntExact(stripeMaxSize.toBytes()));
        }
    }
}


text:
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Security-Policy" content="script-src 'nonce-noncynonce' 'nonce-noncy+/=nonce'">
        <script nonce="noncynonce">
        if (window.testRunner)
            testRunner.dumpAsText();
        </script>
        <script nonce="noncynonce">
            alert('PASS (1/2)');
        </script>
        <script nonce="noncy+/=nonce">
            alert('PASS (2/2)');
        </script>
    </head>
    <body>
        <p>
            This tests the effect of a valid script-nonce value. It passes if
            no console warning is visible and the alerts are executed.
        </p>
    </body>
</html>


text:
<!DOCTYPE html>

    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />

    <title th:text="#{cas.mfa.registerdevice.pagetitle}">CAS MFA Register Device View</title>
    <link href="../../static/css/cas.css" rel="stylesheet" th:remove="tag" />

Register Device

Please name the current device.

            <form method="post" id="registerform" th:object="${mfaTrustRecord}" th:action="@{/login}">

                        <input class="mdc-text-field__input pwd"
                               type="password"
                               name="deviceName"
                               id="deviceName"
                               th:field="*{deviceName}"
                               size="25"
                               autocomplete="off" />

                              Name

How long should we remember this device?

                            <input class="mdc-text-field__input"
                                   type="number"
                                   name="expiration"
                                   id="expiration"
                                   th:field="*{expiration}"
                                   autocomplete="off" required />

                                      Expiration

                    <select name="timeUnit" id="timeUnit" class="custom-select" th:field="*{timeUnit}"
                            onchange="let hide = this.value!=='FOREVER'; $('#expiration').toggle(hide)">
                        <option value="SECONDS">Seconds</option>
                        <option value="MINUTES">Minutes</option>
                        <option value="HOURS">Hours</option>
                        <option value="DAYS">Days</option>
                        <option value="WEEKS">Weeks</option>
                        <option value="MONTHS">Months</option>
                        <option value="YEARS">Years</option>
                        <option value="FOREVER">Forever</option>
                    </select>

                    <button class="mdc-button mdc-button--raised" accesskey="s"
                        th:value="#{cas.mfa.registerdevice.button.register}">
                        Register
                    </button>
                    <button class="mdc-button mdc-button--raised" name="resend" accesskey="k"
                        th:value="#{cas.mfa.registerdevice.button.skip}">
                        Skip
                    </button>

                <input type="hidden" name="_eventId_submit" value="Register" />
                <input type="hidden" name="geolocation" />
                <input type="hidden" name="execution" th:value="${flowExecutionKey}" />
            </form>


text:
Demonstrates how to create and use a raster layer made from a local raster file.

![](raster-layer-file.png)

## How it works

To add a `RasterLayer` as an operational layer from a local raster file:

- Create a `Raster` from a raster file.
- Create a RasterLayer from the `Raster`.
- Add it as an operational layer with `map.getOperationalLayers().add(rasterLayer)`.

## Features
- Raster
- RasterLayer

## Provision your device
1. Download the **raster-file.zip** data from [ArcGIS Online](https://arcgisruntime.maps.arcgis.com/home/item.html?id=7c4c679ab06a4df19dc497f577f111bd).
2. Extract the contents of the downloaded zip file to disk.
3. Create an ArcGIS/samples/raster folder on your device. You can use the [Android Debug Bridge (adb)](https://developer.android.com/guide/developing/tools/adb.html) tool found in **<sdk-dir>/platform-tools**.
4. Open up a command prompt and execute the `adb shell` command to start a remote shell on your target device.
5. Navigate to your sdcard directory, e.g. `cd /sdcard/`.
6. Create the ArcGIS/samples directory, `mkdir ArcGIS/samples/raster`.
7. You should now have the following directory on your target device, `/sdcard/ArcGIS/samples/raster`. We will copy the contents of the downloaded data into this directory. Note:  Directory may be slightly different on your device.
8. Exit the shell with the, `exit` command.
9. While still in your command prompt, navigate to the root folder where you extracted the contents of the data from step 1 and execute the following command:
	* `adb push raster-file/. /sdcard/ArcGIS/samples/raster`

Link | Local Location
---------|-------|
|[raster-file.zip](https://arcgisruntime.maps.arcgis.com/home/item.html?id=7c4c679ab06a4df19dc497f577f111bd)| `<sdcard>`/ArcGIS/samples/raster/Shasta.tif |


text:
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using System.Text;

using Morpe.Distributions.D1;

namespace Morpe
{
	/// <summary>
	/// Trains an instance of the MoRPE classifier using the training data provided.
	/// </summary>
	public class Trainer
	{
		/// <summary>
		/// The relative importance of each category on the solution.  This is important when calculating accuracy and entropy.
		/// </summary>
		public double[] CatWeights;
		/// <summary>
		/// The trained classifier.
		/// </summary>
		public Fitted<Classifier> Classifier;
		/// <summary>
		/// Returns true if the trainer is currently training a classifier.
		/// </summary>
		public bool IsTraining { get { return this.trainerIsRunning; } }
		private bool trainerIsRunning = false;
		/// <summary>
		/// The number of quantiles used.
		/// </summary>
		public int Nquantiles = 15;
		/// <summary>
		/// Solver options used during training.  Prior to training, this member contains the default options.
		/// </summary>
		public SolverOptions Options { get { return this.options; } }
		protected SolverOptions options = null;
		/// <summary>
		/// Construct a trainer for a given classifier.
		/// </summary>
		/// <param name="classifier">The classifier to be trained.</param>
		public Trainer(Classifier classifier)
		{
			this.Classifier = new Fitted<Classifier>(classifier, double.NaN);
			this.CatWeights = new double[classifier.Ncats];
		}
		/// <summary>
		/// The total amount of weight across all training data.
		/// </summary>
		protected double totalWeight;
		/// <summary>
		/// A container for the output of analyses performed prior to optimization.
		/// </summary>
		public PreOptimizationAnalysis Analysis;
		/// <summary>
		/// Trains the classifier by optimizing parameters based on the training data using specified solver options.
		/// This can only be called once.
		/// </summary>
		/// <param name="data">The training data.
		/// WARNING:  In order to save memory, this data is altered in palce (instead of copying a new object).</param>
		/// <param name="ops">Sets the member variable <see cref="Classifier.Options"/>.  If a value is not provided, default options are used.</param>
		/// <param name="ops">The pre-optimization analysis <see cref="Classifier.Analysis"/>.  If a value is not provided, default options are used.</param>
		public async Task<Trainer> Train(CategorizedData data, SolverOptions ops=null, PreOptimizationAnalysis analysis=null)
		{
			lock (this)
			{
				if (this.trainerIsRunning)
					throw new ApplicationException("The Train method can only be called once at a time.  You might consider creating multiple Trainer objects.");
				this.trainerIsRunning = true;
			}
			try
			{
				if (data.Ncats != this.Classifier.Instance.Ncats)
					throw new ArgumentException("The number of categories in the classifier must be equal to the number of categories in the training set.");

				//-----------------------
				//	Set the solver otions.
				//-----------------------
				if (ops == null)
					ops = new SolverOptions();
				this.options = ops;

				//-----------------------
				//	Compute CatWeights.
				//-----------------------
				double cwTotal = 0.0;
				this.totalWeight = 0.0;  // Total weight across all training data.
				if (this.options.WeightingRule == WeightingRule.EqualPriors)
				{
					for (int iCat = 0; iCat < data.Ncats; iCat++)
					{
						double w = (double)data.Ntotal / (double)data.Neach[iCat] / (double)data.Ncats;
						this.CatWeights[iCat] = w;
						cwTotal += w;
						this.totalWeight += w * (double)data.Neach[iCat];
					}
				}
				else if (this.options.WeightingRule == WeightingRule.ObservedPriors)
				{
					for (int iCat = 0; iCat < data.Ncats; iCat++)
					{
						this.totalWeight += (float)data.Neach[iCat];
						this.CatWeights[iCat] = 1.0f;
						cwTotal += 1.0f;
					}
				}
				else
					throw new ApplicationException("Unhandled weighting rule.");

				//	[iDatum] Used for identifying the category label for each datum.
				byte[] catVec = new byte[data.Ntotal];
				//	[iDatum] Used for storing the polynomial calculation for each datum.
				float[][] yVec = Static.NewArrays<float>(this.Classifier.Instance.Npoly, data.Ntotal);
				//	[iPoly][iDatum]  Used for sorting data rows.  Sort order is preserved for each polynomial.
				int[][] idxVec = Static.NewArrays<int>(this.Classifier.Instance.Npoly,data.Ntotal);

				//-----------------------
				//	Prepare category labels for each datum.
				//-----------------------
				int iDatum = 0;
				for (int iCat = 0; iCat < data.Ncats; iCat++)
				{
					int nRows = data.X[iCat].Length;
					for (int iRow = 0; iRow < nRows; iRow++)
						catVec[iDatum++] = (byte)iCat;
				}

				if (analysis != null)
					this.Analysis = analysis;
				else
				{
					//-----------------------
					//	Condition the data and perform a polynomial expansion.
					//-----------------------
					this.Analysis = new PreOptimizationAnalysis();
					this.Analysis.ConditionMeasurer = SpatialConditionMeasurer.Measure(data);
					this.Analysis.Conditioner = this.Analysis.ConditionMeasurer.Conditioner();
					this.Analysis.Conditioner.Condition(data);
					data.Expand(this.Classifier.Instance.Coeffs);

					this.Analysis.ParamScale = new float[this.Classifier.Instance.Coeffs.Ncoeffs];
					this.Analysis.ParamInit = Static.NewArrays<float>(this.Classifier.Instance.Ncats, this.Classifier.Instance.Coeffs.Ncoeffs);

					//if (ops.InitializeParams)
					this.Analysis.Crits = Static.NewArrays<UniCrit>(this.Classifier.Instance.Ncats, this.Classifier.Instance.Coeffs.Ncoeffs);

					//-----------------------
					//	Get the parameter scale.
					//-----------------------
					float scale;
					int i15 = (int)(0.5 + 0.15 * (double)(data.Ntotal - 1));
					int i50 = (int)(0.5 + 0.50 * (double)(data.Ntotal - 1));
					int i85 = (int)(0.5 + 0.85 * (double)(data.Ntotal - 1));
					float[] xVec = yVec[0];
					for (int iCoeff = 0; iCoeff < this.Classifier.Instance.Coeffs.Ncoeffs; iCoeff++)
					{
						//	Quantiles determine the parameter scale.
						Static.FillSeries(idxVec[0]);
						iDatum = 0;
						for (int iCat = 0; iCat < data.Ncats; iCat++)
						{
							int nSamp = data.Neach[iCat];
							for (int iSamp = 0; iSamp < nSamp; iSamp++)
								xVec[iDatum++] = data.X[iCat][iSamp][iCoeff];
						}
						Static.QuickSortIndex(idxVec[0], xVec, 0, xVec.Length - 1);
						scale = xVec[idxVec[0][i85]] - xVec[idxVec[0][i15]];
						this.Analysis.ParamScale[iCoeff] = (float)(1.0 / scale);

						//if (ops.InitializeParams)
						//{
						//	Get univariate classification criteria to get a first-order clue about the saliency of each feature.
						for (int iCat = 0; iCat < data.Ncats; iCat++)
							this.Analysis.Crits[iCat][iCoeff] = UniCrit.MaximumAccuracy(iCat, catVec, xVec, idxVec[0], this.CatWeights);
						//}
					}

					//-----------------------
					//	Compute initial params.
					//-----------------------
					//	Compute the expected minimum value for the univariate 2-category classification accuracy.
					double[] accMin = new double[data.Ncats];
					for (int iCat = 0; iCat < data.Ncats; iCat++)
					{
						accMin[iCat] = (this.totalWeight - this.CatWeights[iCat] * (double)data.Neach[iCat]) / this.totalWeight;
						if (accMin[iCat] < 0.5)
							accMin[iCat] = 1.0 - accMin[iCat];
					}

					//	The magnitude of each parameter is a function of univariate classification accuracy for the corresponding spatial dimension.
					double invNtotal = 1.0 / data.Ntotal;
					for (int iCoeff = 0; iCoeff < this.Classifier.Instance.Coeffs.Ncoeffs; iCoeff++)
					{
						if (this.Classifier.Instance.Npoly == 1)
						{
							double tAcc = 0.5 *
								(
									Math.Max(0.0, this.Analysis.Crits[0][iCoeff].Accuracy - accMin[0])
									+
									Math.Max(0.0, this.Analysis.Crits[1][iCoeff].Accuracy - accMin[1])
								);
							tAcc /= (1.0 - 0.5 * (accMin[0] + accMin[1]) + invNtotal);
							if (this.Analysis.Crits[0][iCoeff].TargetUpper)
								this.Analysis.ParamInit[0][iCoeff] = (float)tAcc * this.Analysis.ParamScale[iCoeff];
							else
								this.Analysis.ParamInit[0][iCoeff] = -(float)tAcc * this.Analysis.ParamScale[iCoeff];

						}
						else
						{
							for (int iPoly = 0; iPoly < this.Classifier.Instance.Npoly; iPoly++)
							{
								double tAcc = Math.Max(0.0, this.Analysis.Crits[iPoly][iCoeff].Accuracy - accMin[iPoly]);
								tAcc /= (1.0 - accMin[iPoly] + invNtotal);
								if (this.Analysis.Crits[iPoly][iCoeff].TargetUpper)
									this.Analysis.ParamInit[iPoly][iCoeff] = (float)tAcc * this.Analysis.ParamScale[iCoeff];
								else
									this.Analysis.ParamInit[iPoly][iCoeff] = -(float)tAcc * this.Analysis.ParamScale[iCoeff];
							}
						}
					}
				}

				//-----------------------
				//	Set classifier parameters.
				//-----------------------
				if (ops.InitializeParams)
				{
					Static.Copy<float>(this.Analysis.ParamInit, this.Classifier.Instance.Params);
				}
				else
				{
					//	Inherit parameters passed in by the classifier.  We assume the classifier was already initialized with parameters.
					Static.Copy<float>(this.Classifier.Instance.Params, this.Analysis.ParamInit);
				}

				//-----------------------
				//	Perform dual optimizations.
				//-----------------------
				if (this.Classifier.Instance.Npoly > 2 && this.options.InitializeParams)
				{
					SolverOptions dualOps = this.options.Copy();
					dualOps.WeightingRule = WeightingRule.EqualPriors;
					Task<Trainer>[] dualTasks = new Task<Trainer>[this.Classifier.Instance.Npoly];
					for(int iPoly=0; iPoly<this.Classifier.Instance.Npoly; iPoly++)
					{
						Trainer t = new Trainer(this.Classifier.Instance.GetDual(iPoly));
						dualTasks[iPoly] = t.Train(data.GetDual(iPoly), dualOps);
					}
					for (int iPoly = 0; iPoly < this.Classifier.Instance.Npoly; iPoly++)
					{
						Trainer t = await dualTasks[iPoly];
						Array.Copy(t.Classifier.Instance.Params, this.Analysis.ParamInit[iPoly], this.Classifier.Instance.Coeffs.Ncoeffs);
					}
					Static.Copy<float>(this.Analysis.ParamInit, this.Classifier.Instance.Params);
				}

				//-----------------------
				//	Finish constructing the classifier for the first time.
				//-----------------------
				MonotonicRegressor regressor = new MonotonicRegressor();
				for (int iPoly = 0; iPoly < this.Classifier.Instance.Npoly; iPoly++)
					Static.FillSeries(idxVec[iPoly]);

				for (int iPoly = 0; iPoly < this.Classifier.Instance.Npoly; iPoly++)
				{
					//	Set the quantized probability limits.
					double nPerQuantile = (double)Math.Min(data.Neach[iPoly], data.Ntotal - data.Neach[iPoly]) / (double)this.Classifier.Instance.Quant[iPoly].Nquantiles;
					this.Classifier.Instance.Quant[iPoly].Pmin = 1.0 / nPerQuantile;
					this.Classifier.Instance.Quant[iPoly].Pmax = 1.0-this.Classifier.Instance.Quant[iPoly].Pmin;

					//	Evaluate the polynomial expression for each datum.
					iDatum = 0;
					for (int iCat = 0; iCat < data.Ncats; iCat++)
					{
						int nSamp = data.Neach[iCat];
						for (int iSamp = 0; iSamp < nSamp; iSamp++)
						{
							//	Evaluate the polynomial expression.
							yVec[iPoly][iDatum++] = (float)this.Classifier.Instance.EvalPolyFromExpanded(iPoly, data.X[iCat][iSamp]);
						}
					}

					//	Sort the output.  Indexes are preserved to speed up subsequent sorts.
					Static.QuickSortIndex(idxVec[iPoly], yVec[iPoly], 0, data.Ntotal-1);

					//	Quantize the output.
					this.Classifier.Instance.Quant[iPoly].Measure(idxVec[iPoly], yVec[iPoly], catVec, (byte)iPoly, this.CatWeights, totalWeight, regressor);
				}

				//-----------------------
				//	Measure the conditional entropy.
				//-----------------------
				float[] y = new float[this.Classifier.Instance.Npoly];
				double[] p;
				double fit = 0.0;
				byte c;
				for(iDatum=0; iDatum < data.Ntotal; iDatum++)
				{
					for (int iPoly = 0; iPoly < this.Classifier.Instance.Npoly; iPoly++)
						y[iPoly] = yVec[iPoly][iDatum];
					p = this.Classifier.Instance.ClassifyPolynomialOutputs(y);
					c = catVec[iDatum];
					fit += Math.Log(p[c]) * this.CatWeights[c];
				}
				//	Change logarithm base and normalize by total weight.
				this.Classifier.Fit = -fit / totalWeight / Math.Log((double)data.Ncats);	//	<-- The conditional entropy... we want to minimize it.

				//-----------------------
				//	Prepare optimization memory.
				//-----------------------

				//	Initialize an orthonormal if the parameter space is small enough.
				float[][][] ortho = null;
				int nParams = this.Classifier.Instance.Npoly * this.Classifier.Instance.Coeffs.Ncoeffs;
				if (nParams <= 100)
					ortho = this.randomDeviates();
				int iOrtho = 0;
				int ctOrtho = 0;
				int ctSteps = 0;

				//	Every `modOrtho` steps through the orthonormal basis, we try a gradient search.
				int modOrtho = Math.Min(10, nParams);

				//	For a trip through `modOrtho` bases, changes in entropy are partialled across the parameter space.
				float[][] dhOrtho = Static.NewArrays<float>(this.Classifier.Instance.Npoly, this.Classifier.Instance.Coeffs.Ncoeffs);

				//-----------------------
				//	Optimize.
				//-----------------------
				//	The attempted classifier.
				Classifier cTry = this.Classifier.Instance.Copy();
				//	The initial step size.
				float stepSize = this.Options.ParamDiffMax;
				//	The optimization mode.  We start by iterating through the orthogonal bases.
				OptimizationMode mode = OptimizationMode.Ortho;

				throw new NotImplementedException("TO DO");

				bool keepOptimizing = true;
				while (keepOptimizing)
				{
					if(mode==OptimizationMode.Ortho)
					{
						if(iOrtho >= modOrtho)
						{
							iOrtho = 0;
						}
					}
					else if(mode==OptimizationMode.Gradient)
					{
					}
					else
						throw new ApplicationException("Unhandled optimization mode.");
				}
			}
			finally
			{
				this.trainerIsRunning = false;
			}
		}

		/// <summary>
		/// This performs the quantization procedure for the data provided.
		/// </summary>
		/// <param name="yVals">The y-value of each datum in the sample.  These values are the output
		/// of the polynomial function for the target category.</param>
		/// <param name="yIdx">On output, provides the zero-based index into yVals that rank-orders the yVals.  On output,
		/// this order is calculated by calling <see cref="Static.QuickSortIndex"/> to sort yVals[yIdx[:]].
		/// On input, the order from the previous optimization step is passed in.  This means that the list is
		/// mostly sorted (for small parameter changes), and a mostly sorted list will make the optimization go
		/// faster than anothr random ordering such as 0...(yVals.Length-1).</param>
		/// <param name="cats">The category label of each datum.</param>
		/// <param name="catWeight">The weight assigned to each category.</param>
		/// <param name="targetCat">The target category for the y-values provided.</param>
		protected Quantization quantize(float[] yVals, int[] yIdx, byte[] catVec, double[] catWeight, byte targetCat)
		{
			//	Prepare output
			Quantization output = new Quantization(this.Nquantiles);
			double wPerBin = this.totalWeight / (double)this.Nquantiles;
			output.Pmin = 0.5 / wPerBin;
			output.Pmax = 1.0 - output.Pmin;

			//	IMPORTANT PERFORMANCE NOTE:
			//	Each time we enter this function, the sort index is preserved from the prior function call.
			//	This typically leads to faster sort times during optimization because typically the list is sorted
			//	already (or partially sorted).
			Static.QuickSortIndex(yIdx, yVals, 0, yVals.Length);

			int iBin = 0;  // The current bin.
			double ySum = 0.0; // Weighted sum of y-values for the current bin.
			double correctWeight = 0.0; // Correct weight for the current bin.
			double errorWeight = 0.0;  // Incorrect weight for the current bin.
			double binWeight;

			double wNextBin = wPerBin; // The amount of cucmulative weight that separates the current bin from the next.
			double wThis = 0.0; // The current accumulated weight.
			double dwThis; // The amount of weight added by the current sample.
			double wLast;	//	The accumulated weight prior to the current sample.

			//	Quantize the  samples.
			for (int iSamp = 0; iSamp < yVals.Length; iSamp++)
			{
				int iSort = yIdx[iSamp];
				byte idCat = catVec[iSort];
				wLast = wThis;
				dwThis = catWeight[idCat];
				wThis += dwThis;
				if (wThis > wNextBin || iSamp == yVals.Length-1)
				{
					//---------------------------
					//	It is time for a new bin.
					//---------------------------
					if ( iBin < this.Nquantiles-1 && wNextBin - wLast > wThis - wNextBin)
					{
						//	Rewind to last sample.
						iSort = yIdx[--iSamp];
						wThis = wLast;
					}
					else
					{
						//	Process this sample  as normal.
						ySum += dwThis * yVals[iSort];
						if (idCat == targetCat)
							correctWeight += dwThis;
						else
							errorWeight += dwThis;
					}

					//---------------------------
					//	Special processing for the last bin.
					//---------------------------
					if (iBin == this.Nquantiles - 1)
					{
						//	There should not be any more samples, but we are doing this just to be sure.
						while (++iSamp < yVals.Length)
						{
							iSort = yIdx[iSamp];
							idCat = catVec[iSort];
							dwThis = catWeight[idCat];
							wThis += dwThis;
							ySum += dwThis * yVals[iSort];
							if (idCat == targetCat)
								correctWeight += dwThis;
							else
								errorWeight += dwThis;
						}
					}

					//---------------------------
					//	Close out the current bin.
					//---------------------------
					binWeight = Math.Min(0.00001,correctWeight + errorWeight);
					output.P[iBin] = correctWeight / binWeight;
					output.Ymid[iBin] = ySum / binWeight;
					if (iBin < this.Nquantiles-1)
						output.Ysep[iBin] = (yVals[iSort] + yVals[yIdx[iSamp + 1]]) / 2.0;

					//---------------------------
					//	Start a next bin.
					//---------------------------
					iBin++;
					correctWeight = errorWeight = 0.0;
					wNextBin += wPerBin;
				}
				else
				{
					//	Process each sample.
					ySum += dwThis * yVals[iSort];
					if (idCat == targetCat)
						correctWeight += dwThis;
					else
						errorWeight += dwThis;
				}
			}
			return output;
		}
		/// <summary>
		/// Generates an orthonormal basis of scaled random deviates based on a proper orthonormal matrix and the scale of each parameter.
		/// </summary>
		/// <returns>The orthonormal basis of random deviates, with entries multiplied by appropriate scale factors.</returns>
		protected float[][][] randomDeviates()
		{
			int nParams = this.Classifier.Instance.Npoly * this.Classifier.Instance.Coeffs.Ncoeffs;
			double[,] ortho = Static.RandomRotationMatrix(nParams);
			float[][][] output = Static.NewArrays<float>(nParams, this.Classifier.Instance.Npoly, this.Classifier.Instance.Coeffs.Ncoeffs);
			for (int iBasis = 0; iBasis < nParams; iBasis++)
			{
				for (int iPoly = 0; iPoly < this.Classifier.Instance.Npoly; iPoly++)
				{
					for (int iCoeff = 0; iCoeff < this.Classifier.Instance.Coeffs.Ncoeffs; iCoeff++)
					{
						int j = iPoly * this.Classifier.Instance.Coeffs.Ncoeffs + iCoeff;
						output[iBasis][iPoly][iCoeff] = (float)(ortho[iBasis, j] * this.Analysis.ParamScale[iCoeff]);
					}
				}
			}
			return output;
		}
		/// <summary>
		/// Generates a random deviate in the parameter space.
		/// </summary>
		/// <returns>The random deviate.</returns>
		protected float[][] randomDeviate()
		{
			int nParams = this.Classifier.Instance.Npoly * this.Classifier.Instance.Coeffs.Ncoeffs;
			float[][] output = Static.NewArrays<float>(this.Classifier.Instance.Npoly, this.Classifier.Instance.Coeffs.Ncoeffs);
			double sumsq = 0.0;
			double r;
			for (int iPoly = 0; iPoly < this.Classifier.Instance.Npoly; iPoly++)
			{
				for (int iCoeff = 0; iCoeff < this.Classifier.Instance.Coeffs.Ncoeffs; iCoeff++)
				{
					r = Gaussian.InvCdf(Static.Rand.NextDouble());
					sumsq += r * r;
					output[iPoly][iCoeff] = (float)r;
				}
			}
			float norm = (float)(1.0/sumsq);
			for (int iPoly = 0; iPoly < this.Classifier.Instance.Npoly; iPoly++)
			{
				for (int iCoeff = 0; iCoeff < this.Classifier.Instance.Coeffs.Ncoeffs; iCoeff++)
				{
					output[iPoly][iCoeff] *= this.Analysis.ParamScale[iCoeff] * norm;
				}
			}
			return output;
		}
	}
}


text:
// Assume firebase has been loaded. We can't `import` it here as it does not
// support strict mode.
export const btoa = window.btoa;


text:
namespace blastify {

class Buffer {
 public:
  // Construct empty.
  Buffer();

  // Construct from string.
  explicit Buffer(const std::string& str);

  // Construct from existing raw buffer.
  Buffer(const char* data, size_t size);

  // Copy constructor.
  Buffer(const Buffer& copy_from);

  // Copy assignment.
  Buffer& operator=(const Buffer& assign_from);

  // Destructor.
  ~Buffer();

  // Return the size in bytes.
  size_t Size() const;

  // Return pointer to raw data (const.)
  const char* Data() const;

  // Return pointer to raw data (non-const.)
  char* Data();

  // Append data at the end of the buffer.
  // Returns reference to self so that calls may be chained.
  Buffer& Append(const char* data, size_t size);

  // Canonical swap support
  void swap(Buffer& other);

 private:
  std::vector<char> data_;
};

// Canonical swap support
void swap(Buffer& lhs, Buffer& rhs);

}  // namespace blastify

bool operator==(const blastify::Buffer& lhs, const blastify::Buffer& rhs);

#endif  // INCLUDE_BLASTIFY_BUFFER_H_


text:
@echo off
:##############################################################################
:#                                                                            #
:#  Filename        2note2.bat                                                #
:#                                                                            #
:#  Description     Pipe data into Notepad2.exe                               #
:#                                                                            #
:#  Notes 	                                                              #
:#                                                                            #
:#  Author          Jean-François Larvoire, jf.larvoire@hpe.com               #
:#                                                                            #
:#  History                                                                   #
:#   2019-10-24 JFL Create this script.                                       #
:#   2022-06-27 JFL Fix the issue with the extra CRLF appended to the text.   #
:#   2022-06-28 JFL Fix hangs with clipboard contents > 4KB.                  #
:#   2022-07-04 JFL Added option -p to revert to using a pipe if desired.     #
:#		    Added option -d to enable debugging on the command line.  #
:#		                                                              #
:##############################################################################

:# Rerun self in a sub-shell, to avoid breaking the original shell file handles
echo %0 | findstr :: >nul || (cmd /d /c ^""%~dp0\::\..\%~nx0" %*^" & exit /b)

setlocal EnableExtensions EnableDelayedExpansion
set "VERSION=2022-07-04"
set "SCRIPT=%~nx0"		&:# Script name
set "SNAME=%~n0"		&:# Script name, without its extension
set "SPATH=%~dp0"		&:# Script path
set "SPATH=%SPATH:~0,-1%"	&:# Script path, without the trailing \
set "SFULL=%~f0"		&:# Script full pathname
set ^"ARG0=%0^"			&:# Script invokation name
set ^"ARGS=%*^"			&:# Argument line

call :debug.init
goto :Main

:debug.init
set "IFDEBUG=if "%DEBUG%"=="1""
set "ECHO=echo"
set "ECHO.D=%IFDEBUG% echo"
set "ECHOVARS=call :echovars"
set "ECHOVARS.D=%IFDEBUG% call :echovars"
set "RETURN=exit /b"
exit /b

:echovars %*=variables names
setlocal EnableExtensions EnableDelayedExpansion
for %%s in (%*) do echo set "%%s=!%%s!"
endlocal & exit /b

:#----------------------------------------------------------------------------#
:# Sleep N seconds. %1 = Number of seconds to wait.
:Sleep
%FUNCTION%
set /A N=%1+1
ping -n %N% 127.0.0.1 >NUL 2>&1
%RETURN%

:#----------------------------------------------------------------------------#

:# Note: In the routines below, we call "lists" batch variables with elements separated by a space.
:# The advantage of such lists is that they can be parsed, or looped on, using just the "for" command.
:# We build lists in a way that inserts an extra space ahead of the first element.
:# For performance reasons, we do not bother removing that space all along.
:# We remove it only in the final list returned in the end.
:# Also, we rely on the fact that elements in a list of handles here are all 1-digit numbers.

:#----------------------------------------------------------------------------#
:# Handle enumeration routine - Return lists of used and free file I/O handles
:EnumHandles %1=freeListVar %2=usedListVar %3=quantumLevelVar %4=knownList (Not including 0 1 2)
:#	     Returns %freeHandles%, %usedHandles%, %nUnknownHandles%
setlocal EnableExtensions EnableDelayedExpansion
%ECHO.D% call %0 %*

:# Search the top free handles
:# Our :TryRedir routine uses 2>NUL, so itself always uses the first free handle.
:# => Handle 3 will always be found in use: Either it was already, or 2>NUL will use it.
:# Using handle 3 for redirection tests forces cmd.exe to use the second free handle to save it.
:# => Handle 4 will always be found in use: Either it was already, or 3>&%%h will use it.
:# Try duplicating handles 5 to 9, to see if they exist.
set "freeHandles="	&:# List of free file handles
set "usedHandles= 3 4"	&:# List of used file handles. 3 and 4 will be in use.
for /L %%h in (5,1,9) do call :TryRedir 3 %%h freeHandles usedHandles
%ECHOVARS.D% freeHandles usedHandles

:# Search the second missed free handle, used for saving handle 3 above
if defined freeHandles ( :# This can only work by using another free handle
  set "firstFreeHandle=!freeHandles:~1,1!" &:# The first free one we've found so far
  set /a "tryLast=firstFreeHandle-1" &:# The last used handle before the first free one
  set "freeHandle="	&:# 1-element list with the free handle we missed in the above loop
  :# Again, no need to test handle 3, it's bound to be found in use.
  for /L %%h in (4,1,!tryLast!) do if not defined freeHandle call :TryRedir !firstFreeHandle! %%h freeHandle usedHandles2
  :# Move that free handle from the used list to the free list
  for %%h in ("!freeHandle!") do set "usedHandles=!usedHandles:%%~h=!"
  set "freeHandles=!freeHandle!!freeHandles!"
)
%ECHOVARS.D% freeHandles usedHandles

:# Search the first missed free handle, used for saving handle 2 above
:# If the first used handle is followed by the first free handle, then we know
:# it's the one that was used by the 2>NUL redirection. So it's actually free.
:# More generally, if all used handles before the first free one are known used
:# handles passed in %4, except for one, then that unknown one is actually free.
if defined freeHandles ( :# [Else there may actually be two unknown handles]
  set "firstFreeHandle=!freeHandles:~1,1!" &:# The first free one we've found so far
  set "knownUsedHandles=%~4" &:# This list may be empty, or partial
  set /a "nUnknownHandles=firstFreeHandle-3"
  %ECHOVARS.D% firstFreeHandle nUnknownHandles knownUsedHandles
  set "unknownHandles="
  set /a "tryLast=firstFreeHandle-1"
  for /l %%h in (3,1,!tryLast!) do set "unknownHandles=!unknownHandles! %%h"
  if defined knownUsedHandles for %%h in (!knownUsedHandles!) do (
    if %%h lss !firstFreeHandle! ( :# Then remove it from the unknown handle list
      set /a "nUnknownHandles-=1"
      set "unknownHandles=!unknownHandles: %%h=!"
    )
  )
  %ECHOVARS.D% nUnknownHandles unknownHandles
  if !nUnknownHandles!==1 (  :# OK, this single used handle is actually free.
    :# Move it from the used list to the free list
    for %%h in ("!unknownHandles!") do set "usedHandles=!usedHandles:%%~h=!"
    set "freeHandles=!unknownHandles!%freeHandles%"
    set "quantumLevel=0"
  ) else ( :# One unidentified handle in the used list is actually free.
    set "quantumLevel=1"
  )
) else ( :# No free handle found. Up to 2 used handles may actually be free.
  set "quantumLevel=2"
)
:# Cleanup and return
for %%v in (freeHandles usedHandles) do if defined %%v set "%%v=!%%v:~1!" &:# Remove the head space
endlocal & (
  set "%1=%freeHandles%"
  set "%2=%usedHandles%"
  set "%3=%quantumLevel%"
  %ECHOVARS.D% freeHandles usedHandles quantumLevel
) & (%ECHO.D% return %ERRORLEVEL%) & exit /b

:TryRedir %1=Handle to redirect; %2=Handle to duplicate; %3=Free var; %4=Used var
2>NUL ( :# Prevent error messages written to stderr from being visible.
  break %1>&%2 && (	:# The redirection succeeded.
    set "%4=!%4! %2"	&rem The handle %2 existed. Add it to the used list.
    (call,)		&rem Clear ERRORLEVEL, which might be non-0 despite success here.
  ) || (		:# The redirection failed, and an error message was written to stderr.
    set "%3=!%3! %2"	&rem The handle %2 did not exit. Add it to the free list.
  )
)
exit /b	  &:# Returns 0=Used, 1=Free

:#----------------------------------------------------------------------------#
:# Pipe creation routine - Returns the two handles selected, and updates the known handles list
:CreatePipe %1=PipeIn name; %2=PipeOut name; %3=Known handles list name (optional, list may be partial)
setlocal EnableExtensions EnableDelayedExpansion
%ECHO.D% call %0 %*
if not "%3"=="" (set "knownHandles=!%3!") else (set "knownHandles=")
call :EnumHandles freeHandles usedHandles quantumLevel "%knownHandles%"
:# Make sure there are at least 4 free handles. The list looks like: "0 2 4 6"
if %quantumLevel% gtr 1 endlocal & exit /b 1	 &:# No free handles
if "%freeHandles:~6,1%"=="" endlocal & exit /b 1 &:# Not enough free handles
:# Define an optional redirection, that plugs the hole in the usedHandles list, if any
set "FILL_HOLE="
if %quantumLevel% equ 1 set "FILL_HOLE=2>NUL"
:# Select the handles to use, in the first four free handles left
for /f "tokens=1,2,4" %%a in ("%freeHandles%") do (
  set "hIn=%%a"			&:# PipeIn handle
  set "hOut=%%b"		&:# PipeOut handle
  set "hTmp=%%c"		&rem Temporary handle, released after use
)
%ECHOVARS.D% hIn hOut hTmp
endlocal & (
  set "%1=%hIn%"		&:# PipeIn handle
  set "%2=%hOut%"		&:# PipeOut handle
  if not "%3"=="" (
    set "%3=!%3! %hIn% %hOut%"
    %ECHOVARS.D% %3
  )
) & %FILL_HOLE% (rundll32 1>&%hOut% %hOut%>&%hTmp% | rundll32 0>&%hIn% %hIn%>&%hTmp%)
%ECHO.D% return %ERRORLEVEL%
exit /b

:#----------------------------------------------------------------------------#
:#                                                                            #
:#  Function        Main                                                      #
:#                                                                            #
:#  Description     Process command line arguments                            #
:#                                                                            #
:#  Arguments       %*	    Command line arguments                            #
:#                                                                            #
:#  Notes 	                                                              #
:#                                                                            #
:#  History                                                                   #
:#                                                                            #
:#----------------------------------------------------------------------------#

:Help
echo.
echo %SCRIPT% version %VERSION% - Pipe data into Notepad2.exe
echo.
echo Usage: ^<command^> ^| %SCRIPT% [OPTIONS]
echo.
echo Options:
echo   -?       Display this help
echo   -d       Debug mode
echo   -p       Use a pipe instead of a file for saving the clipboard content
echo   -V       Display the script version and exit
goto :eof

:#----------------------------------------------------------------------------#
:# Main routine

:Main
set "USE_PIPE=0"
goto :get_arg
:next_arg
shift
:get_arg
if [%1]==[] goto :Start
set "ARG=%~1"
if "!ARG!"=="-?" goto :Help
if "!ARG!"=="/?" goto :Help
if "!ARG!"=="-d" set "DEBUG=1" & call :debug.init & goto :next_arg
if "!ARG!"=="-p" set "USE_PIPE=1" & goto :next_arg
if "!ARG!"=="-V" (echo.%VERSION%) & goto :eof
if "!ARG:~0,1!"=="-" (
  >&2 %ECHO% Warning: Unexpected option ignored: !ARG!
  goto :next_arg
)
>&2 %ECHO% Warning: Unexpected argument ignored: %1
goto :next_arg

:#----------------------------------------------------------------------------#

:Start
:# Create a SUB variable containing a SUB <==> EOF <==> Ctrl-Z character
:# Not necessary anymore, now that 1clip.exe has a -Z option for generating a Ctrl-Z.
:# >NUL copy /y NUL + NUL /a "%TEMP%\1A.chr" /a
:# for /f %%c in (%TEMP%\1A.chr) do set "SUB=%%c"

:# Prepare saving the initial clipboard contents
if "%USE_PIPE%"=="1" (
  call :CreatePipe P1IN P1OUT
  if errorlevel 1 echo Error: Failed to find 4 free handles for pipe 1 & exit /b 1
) else (
  set "TEMPFILE=%TEMP%\2note2_%PID%_%RANDOM%_%TIME::=%.tmp"
)
:# Save the initial clipboard contents
:# Use a second if test for doing the actual save, because >&!P1OUT! in a (block) generates a syntax error.
if "%USE_PIPE%"=="1" (
  :# Saving the data in a pipe hangs if there is 4KB of data or more.
  >&%P1OUT% 1clip -U -Z
  rem :# >&%P1OUT% echo.!SUB!
) else (
  :# So instead of saving it in a pipe, save it by default in a temporary file.
  >"%TEMPFILE%" 1clip -U
)

:# Pipe the standard input data into Notepad2
2clip -N	  &:# First pipe it into the clipboard, removing the final CRLF
start notepad2 -c &:# -c option tells Notepad2 to copy data from the clipboard
		   :# Known issue: -c appends an extra \n after the clipboard data!
		   :# 2clip.exe's -N option now compensates for that.

:# wait 1s, to give time to Notepad2 to start and paste the clipboard content
call :Sleep 1

:# Restore the initial clipboard contents
if "%USE_PIPE%"=="1" (
  <&%P1IN% 2clip -U -z
) else (
  <"%TEMPFILE%" 2clip -U
  del "%TEMPFILE%"
)


text:
"use strict"

const _ = require("lodash")

const keywordSets = {}

keywordSets.nonLengthUnits = new Set([
  // Relative length units
  "%",
  // Time length units
  "s",
  "ms",
  // Angle
  "deg",
  "grad",
  "turn",
  "rad",
  // Frequency
  "Hz",
  "kHz",
  // Resolution
  "dpi",
  "dpcm",
  "dppx",
])

keywordSets.lengthUnits = new Set([
  // Relative length units
  "em",
  "ex",
  "ch",
  "rem",
  // Viewport-percentage lengths
  "vh",
  "vw",
  "vmin",
  "vmax",
  "vm",
  // Absolute length units
  "px",
  "mm",
  "cm",
  "in",
  "pt",
  "pc",
  "q",
])

keywordSets.units = uniteSets(keywordSets.nonLengthUnits, keywordSets.lengthUnits)

keywordSets.colorFunctionNames = new Set([
  "rgb",
  "rgba",
  "hsl",
  "hsla",
  "hwb",
  "gray",
])

keywordSets.camelCaseFunctionNames = new Set([
  "translateX",
  "translateY",
  "translateZ",
  "scaleX",
  "scaleY",
  "scaleZ",
  "rotateX",
  "rotateY",
  "rotateZ",
  "skewX",
  "skewY",
])

keywordSets.basicKeywords = new Set([
  "initial",
  "inherit",
  "unset",
])

keywordSets.fontFamilyKeywords = uniteSets(keywordSets.basicKeywords, [
  "serif",
  "sans-serif",
  "cursive",
  "fantasy",
  "monospace",
])

keywordSets.fontWeightRelativeKeywords = new Set([
  "bolder",
  "lighter",
])

keywordSets.fontWeightAbsoluteKeywords = new Set(["bold"])

keywordSets.fontWeightNumericKeywords = new Set([
  "100",
  "200",
  "300",
  "400",
  "500",
  "600",
  "700",
  "800",
  "900",
])

keywordSets.fontWeightKeywords = uniteSets(
  keywordSets.basicKeywords,
  keywordSets.fontWeightRelativeKeywords,
  keywordSets.fontWeightAbsoluteKeywords,
  keywordSets.fontWeightNumericKeywords
)

keywordSets.animationNameKeywords = uniteSets(keywordSets.basicKeywords,
  ["none"]
)

keywordSets.animationTimingFunctionKeywords = uniteSets(keywordSets.basicKeywords, [
  "linear",
  "ease",
  "ease-in",
  "ease-in-out",
  "ease-out",
  "step-start",
  "step-end",
  "steps",
  "cubic-bezier",
])

keywordSets.animationIterationCountKeywords = new Set(["infinite"])

keywordSets.animationDirectionKeywords = uniteSets(keywordSets.basicKeywords, [
  "normal",
  "reverse",
  "alternate",
  "alternate-reverse",
])

keywordSets.animationFillModeKeywords = new Set([
  "none",
  "forwards",
  "backwards",
  "both",
])

keywordSets.animationPlayStateKeywords = uniteSets(keywordSets.basicKeywords, [
  "running",
  "paused",
])

// cf. https://developer.mozilla.org/en-US/docs/Web/CSS/animation
keywordSets.animationShorthandKeywords = uniteSets(
  keywordSets.basicKeywords,
  keywordSets.animationNameKeywords,
  keywordSets.animationTimingFunctionKeywords,
  keywordSets.animationIterationCountKeywords,
  keywordSets.animationDirectionKeywords,
  keywordSets.animationFillModeKeywords,
  keywordSets.animationPlayStateKeywords
)

// These are the ones that can have single-colon notation
keywordSets.levelOneAndTwoPseudoElements = new Set([
  "before",
  "after",
  "first-line",
  "first-letter",
])

// These are the ones that require double-colon notation
keywordSets.levelThreePseudoElements = new Set([
  "before",
  "after",
  "first-line",
  "first-letter",
  "selection",
  "spelling-error",
  "grammar-error",
  "backdrop",
  "marker",
  "placeholder",
  "shadow",
  "slotted",
  "content",
])

keywordSets.pseudoElements = uniteSets(
  keywordSets.levelOneAndTwoPseudoElements,
  keywordSets.levelThreePseudoElements
)

keywordSets.aNPlusBNotationPseudoClasses = new Set([
  "nth-child",
  "nth-column",
  "nth-last-child",
  "nth-last-column",
  "nth-last-of-type",
  "nth-of-type",
])

keywordSets.linguisticPseudoClasses = new Set([
  "dir",
  "lang",
])

keywordSets.otherPseudoClasses = new Set([
  "active",
  "any-link",
  "blank",
  "checked",
  "contains",
  "current",
  "default",
  "disabled",
  "drop",
  "empty",
  "enabled",
  "first-child",
  "first-of-type",
  "focus",
  "focus-within",
  "fullscreen",
  "future",
  "has",
  "host",
  "host-context",
  "hover",
  "indeterminate",
  "in-range",
  "invalid",
  "last-child",
  "last-of-type",
  "link",
  "matches",
  "not",
  "only-child",
  "only-of-type",
  "optional",
  "out-of-range",
  "past",
  "placeholder-shown",
  "read-only",
  "read-write",
  "required",
  "root",
  "scope",
  "target",
  "user-error",
  "user-invalid",
  "val",
  "valid",
  "visited",
])

keywordSets.pseudoClasses = uniteSets(
  keywordSets.aNPlusBNotationPseudoClasses,
  keywordSets.linguisticPseudoClasses,
  keywordSets.otherPseudoClasses
)

keywordSets.shorthandTimeProperties = new Set([
  "transition",
  "animation",
])

keywordSets.longhandTimeProperties = new Set([
  "transition-duration",
  "transition-delay",
  "animation-duration",
  "animation-delay",
])

keywordSets.timeProperties = uniteSets(
  keywordSets.shorthandTimeProperties,
  keywordSets.longhandTimeProperties
)

keywordSets.camelCaseKeywords = new Set([
  "optimizeSpeed",
  "optimizeQuality",
  "optimizeLegibility",
  "geometricPrecision",
  "currentColor",
  "crispEdges",
  "visiblePainted",
  "visibleFill",
  "visibleStroke",
  "sRGB",
  "linearRGB",
])

// https://developer.mozilla.org/docs/Web/CSS/counter-increment
keywordSets.counterIncrementKeywords = uniteSets(keywordSets.basicKeywords, ["none"])

keywordSets.gridRowKeywords = uniteSets(keywordSets.basicKeywords, [
  "auto",
  "span",
])

keywordSets.gridColumnKeywords = uniteSets(keywordSets.basicKeywords, [
  "auto",
  "span",
])

keywordSets.gridAreaKeywords = uniteSets(keywordSets.basicKeywords, [
  "auto",
  "span",
])

// https://developer.mozilla.org/ru/docs/Web/CSS/list-style-type
keywordSets.listStyleTypeKeywords = uniteSets(keywordSets.basicKeywords, [
  "none",
  "disc",
  "circle",
  "square",
  "decimal",
  "cjk-decimal",
  "decimal-leading-zero",
  "lower-roman",
  "upper-roman",
  "lower-greek",
  "lower-alpha",
  "lower-latin",
  "upper-alpha",
  "upper-latin",
  "arabic-indic",
  "armenian",
  "bengali",
  "cambodian",
  "cjk-earthly-branch",
  "cjk-ideographic",
  "devanagari",
  "ethiopic-numeric",
  "georgian",
  "gujarati",
  "gurmukhi",
  "hebrew",
  "hiragana",
  "hiragana-iroha",
  "japanese-formal",
  "japanese-informal",
  "kannada",
  "katakana",
  "katakana-iroha",
  "khmer",
  "korean-hangul-formal",
  "korean-hanja-formal",
  "korean-hanja-informal",
  "lao",
  "lower-armenian",
  "malayalam",
  "mongolian",
  "myanmar",
  "oriya",
  "persian",
  "simp-chinese-formal",
  "simp-chinese-informal",
  "tamil",
  "telugu",
  "thai",
  "tibetan",
  "trad-chinese-formal",
  "trad-chinese-informal",
  "upper-armenian",
  "disclosure-open",
  "disclosure-closed",
  // Non-standard extensions (without prefixe)
  "ethiopic-halehame",
  "ethiopic-halehame-am",
  "ethiopic-halehame-ti-er",
  "ethiopic-halehame-ti-et",
  "hangul",
  "hangul-consonant",
  "urdu",
])

keywordSets.listStylePositionKeywords = uniteSets(keywordSets.basicKeywords, [
  "inside",
  "outside",
])

keywordSets.listStyleImageKeywords = uniteSets(keywordSets.basicKeywords, ["none"])

keywordSets.listStyleShorthandKeywords = uniteSets(
  keywordSets.basicKeywords,
  keywordSets.listStyleTypeKeywords,
  keywordSets.listStylePositionKeywords,
  keywordSets.listStyleImageKeywords
)

keywordSets.fontStyleKeywords = uniteSets(keywordSets.basicKeywords, [
  "normal",
  "italic",
  "oblique",
])

keywordSets.fontVariantKeywords = uniteSets(keywordSets.basicKeywords, [
  "normal",
  "none",
  "historical-forms",
  "none",
  "common-ligatures",
  "no-common-ligatures",
  "discretionary-ligatures",
  "no-discretionary-ligatures",
  "historical-ligatures",
  "no-historical-ligatures",
  "contextual",
  "no-contextual",
  "small-caps",
  "small-caps",
  "all-small-caps",
  "petite-caps",
  "all-petite-caps",
  "unicase",
  "titling-caps",
  "lining-nums",
  "oldstyle-nums",
  "proportional-nums",
  "tabular-nums",
  "diagonal-fractions",
  "stacked-fractions",
  "ordinal",
  "slashed-zero",
  "jis78",
  "jis83",
  "jis90",
  "jis04",
  "simplified",
  "traditional",
  "full-width",
  "proportional-width",
  "ruby",
])

keywordSets.fontStretchKeywords = uniteSets(keywordSets.basicKeywords, [
  "semi-condensed",
  "condensed",
  "extra-condensed",
  "ultra-condensed",
  "semi-expanded",
  "expanded",
  "extra-expanded",
  "ultra-expanded",
])

keywordSets.fontSizeKeywords = uniteSets(keywordSets.basicKeywords, [
  "xx-small",
  "x-small",
  "small",
  "medium",
  "large",
  "x-large",
  "xx-large",
  "larger",
  "smaller",
])

keywordSets.lineHeightKeywords = uniteSets(keywordSets.basicKeywords, ["normal"])

keywordSets.fontShorthandKeywords = uniteSets(
  keywordSets.basicKeywords,
  keywordSets.fontStyleKeywords,
  keywordSets.fontVariantKeywords,
  keywordSets.fontWeightKeywords,
  keywordSets.fontStretchKeywords,
  keywordSets.fontSizeKeywords,
  keywordSets.lineHeightKeywords, keywordSets.fontFamilyKeywords
)

keywordSets.keyframeSelectorKeywords = new Set([
  "from",
  "to",
])

// https://developer.mozilla.org/en/docs/Web/CSS/At-rule
keywordSets.atRules = new Set([
  "apply",
  "annotation",
  "character-variant",
  "charset",
  "counter-style",
  "custom-media",
  "custom-selector",
  "document",
  "font-face",
  "font-feature-values",
  "import",
  "keyframes",
  "media",
  "namespace",
  "nest",
  "ornaments",
  "page",
  "styleset",
  "stylistic",
  "supports",
  "swash",
  "viewport",
])

// https://drafts.csswg.org/mediaqueries/#descdef-media-update
keywordSets.deprecatedMediaFeatureNames = new Set([
  "device-aspect-ratio",
  "device-height",
  "device-width",
  "max-device-aspect-ratio",
  "max-device-height",
  "max-device-width",
  "min-device-aspect-ratio",
  "min-device-height",
  "min-device-width",
])

// https://drafts.csswg.org/mediaqueries/#descdef-media-update
keywordSets.mediaFeatureNames = uniteSets(keywordSets.deprecatedMediaFeatureNames, [
  "any-hover",
  "any-pointer",
  "aspect-ratio",
  "color",
  "color-gamut",
  "color-index",
  "grid",
  "height",
  "hover",
  "max-aspect-ratio",
  "max-color",
  "max-color-index",
  "max-height",
  "max-monochrome",
  "max-resolution",
  "max-width",
  "min-aspect-ratio",
  "min-color",
  "min-color-index",
  "min-height",
  "min-monochrome",
  "min-resolution",
  "min-width",
  "monochrome",
  "orientation",
  "overflow-block",
  "overflow-inline",
  "pointer",
  "resolution",
  "scan",
  "scripting",
  "update",
  "width",
])

// https://www.w3.org/TR/CSS22/ui.html#system-colors
keywordSets.systemColors = new Set([
  "activeborder",
  "activecaption",
  "appworkspace",
  "background",
  "buttonface",
  "buttonhighlight",
  "buttonshadow",
  "buttontext",
  "captiontext",
  "graytext",
  "highlight",
  "highlighttext",
  "inactiveborder",
  "inactivecaption",
  "inactivecaptiontext",
  "infobackground",
  "infotext",
  "menu",
  "menutext",
  "scrollbar",
  "threeddarkshadow",
  "threedface",
  "threedhighlight",
  "threedlightshadow",
  "threedshadow",
  "window",
  "windowframe",
  "windowtext",
])

function uniteSets() {
  const sets = Array.from(arguments)

  return new Set(sets.reduce((result, set) => {
    return result.concat(_.toArray(set))
  }, []))
}

module.exports = keywordSets


text:
<?php

declare(strict_types=1);

namespace Gedmo\Tests\Sluggable;

use Doctrine\Common\EventManager;
use Gedmo\Sluggable\Sluggable;
use Gedmo\Sluggable\SluggableListener;
use Gedmo\Tests\Sluggable\Fixture\DateTimeTypes\ArticleDate;
use Gedmo\Tests\Sluggable\Fixture\DateTimeTypes\ArticleDateImmutable;
use Gedmo\Tests\Sluggable\Fixture\DateTimeTypes\ArticleDateTime;
use Gedmo\Tests\Sluggable\Fixture\DateTimeTypes\ArticleDateTimeImmutable;
use Gedmo\Tests\Sluggable\Fixture\DateTimeTypes\ArticleDateTimeTz;
use Gedmo\Tests\Sluggable\Fixture\DateTimeTypes\ArticleDateTimeTzImmutable;
use Gedmo\Tests\Tool\BaseTestCaseORM;

/**
 * These are tests for sluggable behavior
 *
 * @author Gediminas Morkevicius <gediminas.morkevicius@gmail.com>
 */
final class SluggableDateTimeTypesTest extends BaseTestCaseORM
{
    public const ARTICLE_DATE = ArticleDate::class;
    public const ARTICLE_DATE_IMMUTABLE = ArticleDateImmutable::class;
    public const ARTICLE_DATETIME = ArticleDateTime::class;
    public const ARTICLE_DATETIME_IMMUTABLE = ArticleDateTimeImmutable::class;
    public const ARTICLE_DATETIME_TZ = ArticleDateTimeTz::class;
    public const ARTICLE_DATETIME_TZ_IMMUTABLE = ArticleDateTimeTzImmutable::class;

    protected function setUp(): void
    {
        parent::setUp();

        $evm = new EventManager();
        $evm->addEventSubscriber(new SluggableListener());

        $this->getDefaultMockSqliteEntityManager($evm);
    }

    public function testShouldBuildSlugWithAllDateTimeTypes(): void
    {
        $articleDate = new ArticleDate();
        $articleDate->setTitle('the title');
        $articleDate->setCreatedAt(new \DateTime('2022-04-01'));

        $this->em->persist($articleDate);
        $this->em->flush();
        $this->em->clear();
        static::assertSame('the-title-2022-04-01', $articleDate->getSlug(), 'with date');

        $articleDateImmutable = new ArticleDateImmutable();
        $articleDateImmutable->setTitle('the title');
        $articleDateImmutable->setCreatedAt(new \DateTimeImmutable('2022-04-01'));

        $this->em->persist($articleDateImmutable);
        $this->em->flush();
        $this->em->clear();
        static::assertSame('the-title-2022-04-01', $articleDateImmutable->getSlug(), 'with date_immutable');

        $articleDateTime = new ArticleDateTime();
        $articleDateTime->setTitle('the title');
        $articleDateTime->setCreatedAt(new \DateTime('2022-04-01'));

        $this->em->persist($articleDateTime);
        $this->em->flush();
        $this->em->clear();
        static::assertSame('the-title-2022-04-01', $articleDateTime->getSlug(), 'with datetime');

        $articleDateTimeImmutable = new ArticleDateTimeImmutable();
        $articleDateTimeImmutable->setTitle('the title');
        $articleDateTimeImmutable->setCreatedAt(new \DateTimeImmutable('2022-04-01'));

        $this->em->persist($articleDateTimeImmutable);
        $this->em->flush();
        $this->em->clear();
        static::assertSame('the-title-2022-04-01', $articleDateTimeImmutable->getSlug(), 'with datetime_immutable');

        $articleDateTimeTz = new ArticleDateTimeTz();
        $articleDateTimeTz->setTitle('the title');
        $articleDateTimeTz->setCreatedAt(new \DateTime('2022-04-01'));

        $this->em->persist($articleDateTimeTz);
        $this->em->flush();
        $this->em->clear();
        static::assertSame('the-title-2022-04-01', $articleDateTimeTz->getSlug(), 'with datetimetz');

        $articleDateTimeTzImmutable = new ArticleDateTimeTzImmutable();
        $articleDateTimeTzImmutable->setTitle('the title');
        $articleDateTimeTzImmutable->setCreatedAt(new \DateTimeImmutable('2022-04-01'));

        $this->em->persist($articleDateTimeTzImmutable);
        $this->em->flush();
        $this->em->clear();
        static::assertSame('the-title-2022-04-01', $articleDateTimeTzImmutable->getSlug(), 'with datetimetz_immutable');
    }

    protected function getUsedEntityFixtures(): array
    {
        return [
            self::ARTICLE_DATE,
            self::ARTICLE_DATE_IMMUTABLE,
            self::ARTICLE_DATETIME,
            self::ARTICLE_DATETIME_IMMUTABLE,
            self::ARTICLE_DATETIME_TZ,
            self::ARTICLE_DATETIME_TZ_IMMUTABLE,
        ];
    }
}


text:
package org.docksidestage.whitebox.core.dfpm;

import java.util.Map;

import javax.annotation.Resource;

import org.dbflute.helper.mapstring.MapListString;
import org.docksidestage.mylasta.template.bean.WxOrelseVariableTemplateBean;
import org.docksidestage.unit.UnitFortressBasicTestCase;
import org.lastaflute.core.template.TemplateManager;

/**
 * @author jflute
 */
public class WxDfpmBasicTest extends UnitFortressBasicTestCase {

    // ===================================================================================
    //                                                                           Attribute
    //                                                                           =========
    @Resource
    private TemplateManager templateManager;

    // ===================================================================================
    //                                                                            orElse()
    //                                                                            ========
    public void test_orElse_variable_hasValue() {
        // ## Arrange ##

        // ## Act ##
        String parsed = WxOrelseVariableTemplateBean.parsedBy(templateManager, bean -> {
            bean.setSea("bigband");
            bean.setLand("oneman");
        });

        // ## Assert ##
        log("parsed: {}", parsed);
        Map<String, Object> map = new MapListString().generateMap(parsed);
        assertEquals("bigband", map.get("sea"));
        assertEquals("oneman", map.get("land"));
    }

    public void test_orElse_variable_noValue() {
        // ## Arrange ##

        // ## Act ##
        String parsed = WxOrelseVariableTemplateBean.parsedBy(templateManager, bean -> {});

        // ## Assert ##
        log("parsed: {}", parsed);
        Map<String, Object> map = new MapListString().generateMap(parsed);
        assertEquals("mystic", map.get("sea"));
        assertNull(map.get("land"));
    }
}