text:
commands Package
================

:mod:`graph_yawf_effects` Module
--------------------------------

.. automodule:: yawf.management.commands.graph_yawf_effects
    :members:
    :undoc-members:
    :show-inheritance:

:mod:`graph_yawf_handlers` Module
---------------------------------

.. automodule:: yawf.management.commands.graph_yawf_handlers
    :members:
    :undoc-members:
    :show-inheritance:


text:
package cli

import (
	"context"
	"strings"

	"github.com/alecthomas/kingpin"
	"github.com/pkg/errors"

	"github.com/kopia/kopia/repo"
	"github.com/kopia/kopia/snapshot"
)

type commandSnapshotCopyMoveHistory struct {
	snapshotCopyOrMoveDryRun      bool
	snapshotCopyOrMoveSource      string
	snapshotCopyOrMoveDestination string
}

func (c *commandSnapshotCopyMoveHistory) setup(svc appServices, parent commandParent, isMove bool) {
	var cmd *kingpin.CmdClause
	if isMove {
		cmd = parent.Command("move-history", snapshotCopyMoveHelp("move"))
	} else {
		cmd = parent.Command("copy-history", snapshotCopyMoveHelp("copy"))
	}

	cmd.Flag("dry-run", "Do not actually copy snapshots, only print what would happen").Short('n').BoolVar(&c.snapshotCopyOrMoveDryRun)
	cmd.Arg("source", "Source (user@host or user@host:path)").Required().StringVar(&c.snapshotCopyOrMoveSource)
	cmd.Arg("destination", "Destination (defaults to current user@host)").StringVar(&c.snapshotCopyOrMoveDestination)

	cmd.Action(svc.repositoryWriterAction(func(ctx context.Context, rep repo.RepositoryWriter) error {
		return c.run(ctx, rep, isMove)
	}))
}

func snapshotCopyMoveHelp(verb string) string {
	return strings.ReplaceAll(`Performs a VERB of the history of snapshots from another user or host.
	This command will VERB snapshot manifests of the specified source to the respective destination.
	This is typically used when renaming a host, switching username or moving directory
	around to maintain snapshot history.

	Both source and destination can be specified using user@host, @host or user@host:/path
	where destination values override the corresponding parts of the source, so both targeted
	and mass VERB is supported.

	Source:             Destination         Behavior
	---------------------------------------------------
	@host1              @host2              VERB snapshots from all users of host1
	@host1              user2@host2         (disallowed as it would potentially collapse users)
	@host1              user2@host2:/path2  (disallowed as it would potentially collapse paths)
	user1@host1         @host2              VERB all snapshots to user1@host2
	user1@host1         user2@host2         VERB all snapshots to user2@host2
	user1@host1         user2@host2:/path2  (disallowed as it would potentially collapse paths)
	user1@host1:/path1  @host2              VERB to user1@host2:/path1
	user1@host1:/path1  user2@host2         VERB to user2@host2:/path1
	user1@host1:/path1  user2@host2:/path2  VERB snapshots from single path.
`, "VERB", verb)
}

// run copies snapshot manifests of the specified source
// to the respective destination. This is typically used when renaming a host,
// switching username or moving directory around to maintain snapshot history.
//
// Both source and destination can be specified using user@host, @host or user@host:/path
// where destination values override the corresponding parts of the source, so both targeted
// and mass copying is supported.
//
// Source:             Destination         Behavior
// ---------------------------------------------------
// @host1              @host2              copy snapshots from all users of host1
// @host1              user2@host2         (disallowed as it would potentially collapse users)
// @host1              user2@host2:/path2  (disallowed as it would potentially collapse paths)
//
// user1@host1         @host2              copy all snapshots to user1@host2
// user1@host1         user2@host2         copy all snapshots to user2@host2
// user1@host1         user2@host2:/path2  (disallowed as it would potentially collapse paths)
//
// user1@host1:/path1  @host2              copy to user1@host2:/path1
// user1@host1:/path1  user2@host2         copy to user2@host2:/path1
// user1@host1:/path1  user2@host2:/path2  copy snapshots from single path.
func (c *commandSnapshotCopyMoveHistory) run(ctx context.Context, rep repo.RepositoryWriter, isMoveCommand bool) error {
	si, di, err := c.getCopySourceAndDestination(rep)
	if err != nil {
		return err
	}

	// At this point si and di are possibly incomplete snapshot.SourceInfo
	// could be hostname, user@hostname or user@hostname:/path

	srcSnapshots, err := snapshot.ListSnapshots(ctx, rep, si)
	if err != nil {
		return errors.Wrap(err, "error listing source snapshots")
	}

	dstSnapshots, err := snapshot.ListSnapshots(ctx, rep, di)
	if err != nil {
		return errors.Wrap(err, "error listing destination snapshots")
	}

	for _, manifest := range srcSnapshots {
		dstSource := getCopyDestination(manifest.Source, di)

		if dstSource == manifest.Source {
			log(ctx).Debugf("%v is the same as destination, ignoring", dstSource)
			continue
		}

		if snapshotExists(dstSnapshots, dstSource, manifest) {
			if isMoveCommand && !c.snapshotCopyOrMoveDryRun {
				log(ctx).Infof("%v (%v) already exists - deleting source", dstSource, formatTimestamp(manifest.StartTime.ToTime()))

				if err := rep.DeleteManifest(ctx, manifest.ID); err != nil {
					return errors.Wrap(err, "unable to delete source manifest")
				}
			} else {
				log(ctx).Infof("%v (%v) already exists", dstSource, formatTimestamp(manifest.StartTime.ToTime()))
			}

			continue
		}

		srcID := manifest.ID

		log(ctx).Infof("%v %v (%v) => %v", c.getCopySnapshotAction(isMoveCommand), manifest.Source, formatTimestamp(manifest.StartTime.ToTime()), dstSource)

		if c.snapshotCopyOrMoveDryRun {
			continue
		}

		manifest.ID = ""
		manifest.Source = dstSource

		if _, err := snapshot.SaveSnapshot(ctx, rep, manifest); err != nil {
			return errors.Wrap(err, "unable to save snapshot")
		}

		if isMoveCommand {
			if err := rep.DeleteManifest(ctx, srcID); err != nil {
				return errors.Wrap(err, "unable to delete source manifest")
			}
		}
	}

	return nil
}

func (c *commandSnapshotCopyMoveHistory) getCopySnapshotAction(isMoveCommand bool) string {
	action := "copying"
	if isMoveCommand {
		action = "moving"
	}

	if c.snapshotCopyOrMoveDryRun {
		action += " (dry run)"
	}

	return action
}

func (c *commandSnapshotCopyMoveHistory) getCopySourceAndDestination(rep repo.RepositoryWriter) (si, di snapshot.SourceInfo, err error) {
	si, err = snapshot.ParseSourceInfo(c.snapshotCopyOrMoveSource, rep.ClientOptions().Hostname, rep.ClientOptions().Username)
	if err != nil {
		return si, di, errors.Wrap(err, "invalid source")
	}

	if c.snapshotCopyOrMoveDestination == "" {
		// no destination - assume current user@hostname
		di.UserName = rep.ClientOptions().Username
		di.Host = rep.ClientOptions().Hostname
	} else {
		di, err = snapshot.ParseSourceInfo(c.snapshotCopyOrMoveDestination, rep.ClientOptions().Hostname, rep.ClientOptions().Username)
		if err != nil {
			return si, di, errors.Wrap(err, "invalid destination")
		}
	}

	if di.Path != "" && si.Path == "" {
		// it is illegal to specify source without path, but destination with a path
		// as it would result in multiple individual paths being squished together.
		return si, di, errors.Errorf("path specified on destination but not source")
	}

	if di.UserName != "" && si.UserName == "" {
		// it is illegal to specify source without username, but destination with a username
		// as it would result in multiple individual paths being squished together.
		return si, di, errors.Errorf("username specified on destination but not source")
	}

	return si, di, nil
}

func snapshotExists(snaps []*snapshot.Manifest, src snapshot.SourceInfo, srcManifest *snapshot.Manifest) bool {
	for _, s := range snaps {
		if src != s.Source {
			continue
		}

		if sameSnapshot(srcManifest, s) {
			return true
		}
	}

	return false
}

// sameSnapshot returns true if snapshot manifests have the same start time and root object ID.
func sameSnapshot(a, b *snapshot.Manifest) bool {
	if !a.StartTime.Equal(b.StartTime) {
		return false
	}

	if a.RootObjectID() != b.RootObjectID() {
		return false
	}

	return true
}

// getCopyDestination returns the source modified by applying non-empty fields specified in the overrides.
func getCopyDestination(source, overrides snapshot.SourceInfo) snapshot.SourceInfo {
	dst := source

	if overrides.Host != "" {
		dst.Host = overrides.Host
	}

	if overrides.UserName != "" {
		dst.UserName = overrides.UserName
	}

	if overrides.Path != "" {
		dst.Path = overrides.Path
	}

	return dst
}

redpajama_set_name: RedPajamaGithub


text:
<?php
use Vks\Core\ST;
use Vks\Core\Token;

Auth::isAdminOrDie(App::$instance);
include_once(REAL_PATH . "public/views/main.php");
ST::setUserCss('attendance/style.css');
ST::setUserCss('attendance/manage-style.css');

?>

<a class="btn btn-default" href="?route=Attendance/edit/<?= $data['parent']->id ?>"> Назад

Импортировать вложенные точки в <?=  $data['parent']->name ?>

        <form class="form-horizontal"  method="post" action="<?=
ST::route("InnerPoints/storeFromXml/".$data['parent']->id) ?>" enctype="multipart/form-data">
            <?= Token::castTokenField() ?>

                Выберите файл, до 5 мб ('xml')  Скачать (выберите сохранить объект как..) пример файла, можно открыть в Excel и заполнить своими данными
                <input name="file" type="file"/>

                <button class="btn btn-success">Отправить</button>

        </form>


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

using Microsoft.Azure.Documents;

using Newtonsoft.Json;

namespace DocumentDB.Framework.History
{
    /// <summary>
    ///     Backup object
    /// </summary>
    public class Backup : Document
    {
        /// <summary>
        ///     The backup time in local time
        /// </summary>
        public override DateTime Timestamp => base.Timestamp.ToLocalTime();

        /// <summary>
        ///     Gets the document type.
        /// </summary>
        [JsonProperty(PropertyName = "type")]
        public string Type => "backup";

        /// <summary>
        ///     Gets or sets a description of this backup.
        /// </summary>
        [JsonProperty(PropertyName = "description")]
        public string Description { get; set; }

        /// <summary>
        ///     Gets or sets the content of the backup.
        /// </summary>
        [JsonProperty(PropertyName = "content")]
        public List<Document> Content { get; set; }
    }
}


text:
require 'spec_helper'

describe NYNY::App do
  describe 'namespace' do
    let (:app) do
      mock_app do
        helpers do
          def le_helper
            :lulwut
          end
        end

        namespace '/foo' do
          get '/' do
            le_helper.should == :lulwut
            'bar'
          end
        end

        namespace '/nested' do
          namespace '/space' do
            get '/' do
              le_helper.should == :lulwut
              'caramba'
            end
          end
        end

        get '/' do
          'no namespace here'
        end
      end
    end

    it 'accepts a app as a parameter' do
      mounted = mock_app_class do
        get '/' do
          'mounted!'
        end
      end

      app = mock_app do
        namespace '/mounted', mounted

        get '/' do
          'root'
        end
      end

      app.get('/').body.should == 'root'
      app.get('/mounted').body.should == 'mounted!'
    end

    it 'allows to use middlewares inside namespace' do
      kls = Class.new(NYNY::Base) do
        get '/' do
          'foo'
        end
      end

      app = mock_app do
        namespace '/foo' do
          use kls
        end
      end

      app.get('/foo')
    end

    it 'allows to specify stuff in namespaces' do
      app.get('/foo').body.should == 'bar'
    end

    it 'does not break the main app' do
      app.get('/').body.should == 'no namespace here'
    end

    it 'can be nested as well' do
      app.get('/nested/space/').body.should == 'caramba'
    end
  end
end


text:
COMMAND="bash -c \"\`curl -sL https://raw.githubusercontent.com/buildbox/agent/master/install.sh\`\""

LATEST_BETA="1.0-beta.6"

if [ "$VERSION" = "1.0-beta.1" ]
then
  echo "NOTICE: Installing 1.0-beta.1 is no longer supported...sorry. Please install 1.0-beta.6"
  exit 1
fi

if [ "$VERSION" = "1.0-beta.2" ]
then
  echo "NOTICE: Installing 1.0-beta.2 is no longer supported...sorry. Please install 1.0-beta.6"
  exit 1
fi

if [ "$BETA" = "true" ]
then
  VERSION=$LATEST_BETA
fi

# Allow custom setting of the version
if [ -z "$VERSION" ]; then
  VERSION="0.2"
fi

set -e

function buildbox-download {
  if command -v wget >/dev/null
  then
    if [ "$DEBUG" = "true" ]
    then
      wget $1 -O $2
    else
      wget -q $1 -O $2
    fi
  else
    if [ "$DEBUG" = "true" ]
    then
      curl -L -o $2 $1
    else
      curl -L -s -o $2 $1
    fi
  fi
}

echo -e "\033[33m
  _           _ _     _ _                                        _
 | |         (_) |   | | |                                      | |
 | |__  _   _ _| | __| | |__   _____  __   __ _  __ _  ___ _ __ | |_
 | '_ \| | | | | |/ _\` | '_ \ / _ \ \/ /  / _\` |/ _\` |/ _ \ '_ \| __|
 | |_) | |_| | | | (_| | |_) | (_) >  <  | (_| | (_| |  __/ | | | |_
 |_.__/ \__,_|_|_|\__,_|_.__/ \___/_/\_\  \__,_|\__, |\___|_| |_|\__|
                                                 __/ |
                                                |___/\033[0m
-- https://buildbox.io

Installing Version: \033[35mv$VERSION\033[0m"

UNAME=`uname -sp | awk '{print tolower($0)}'`

if [[ ($UNAME == *"mac os x"*) || ($UNAME == *darwin*) ]]
then
  PLATFORM="darwin"
else
  PLATFORM="linux"
fi

if [[ ($UNAME == *x86_64*) || ($UNAME == *amd64*) ]]
then
  ARCH="amd64"
else
  ARCH="386"
fi

# Allow custom setting of the destination
if [ -z "$DESTINATION" ]; then
  # But default to the home directory
  DESTINATION="$HOME/.buildbox"
  mkdir -p $DESTINATION
fi

if [ ! -w "$DESTINATION" ]
then
  echo -e "\n\033[31mUnable to write to destination \`$DESTINATION\`\n\nYou can change the destination by running:\n\nDESTINATION=/my/path $COMMAND\033[0m\n"
  exit 1
fi

echo -e "Destination: \033[35m$DESTINATION\033[0m"

# Download and unzip the file to the destination
DOWNLOAD="buildbox-agent-$PLATFORM-$ARCH.tar.gz"
URL="https://github.com/buildbox/agent/releases/download/v$VERSION/$DOWNLOAD"
echo -e "\nDownloading $URL"

# Remove the download if it already exists
rm -f $DESTINATION/$DOWNLOAD

# If the file already exists in a folder called pkg, just use that. :)
if [[ -e pkg/$DOWNLOAD ]]
then
  cp pkg/$DOWNLOAD $DESTINATION/$DOWNLOAD
else
  buildbox-download "$URL" "$DESTINATION/$DOWNLOAD"
fi

# Extract the download to the destination folder
tar -C $DESTINATION -zxf $DESTINATION/$DOWNLOAD

INSTALLED_VERSION=`$DESTINATION/buildbox-agent --version`

if [[ "$INSTALLED_VERSION" = "buildbox-agent version $LATEST_BETA" ]]
then
  # Move the buildbox binary into a bin folder
  mkdir -p $DESTINATION/bin
  mv $DESTINATION/buildbox-agent $DESTINATION/bin
  chmod +x $DESTINATION/bin/buildbox-agent

  function shim {
    echo "#!/bin/bash
DIR=\$(cd \"\$( dirname \"\${BASH_SOURCE[0]}\" )\" && pwd)
echo \"###################################################################
DEPRECATED: This binary is deprecated.

Please use: \\\`$DESTINATION/bin/buildbox-agent$1\\\`
###################################################################
\"
exit 1"
  }

  # Deprecate the old 1.0-beta.1 binary.
  if [[ -e $DESTINATION/bin/buildbox ]]
  then
    shim "" > $DESTINATION/bin/buildbox
    chmod +x $DESTINATION/bin/buildbox
  fi

  # Was there a previous agent installed?
  if [[ -e $DESTINATION/buildbox-artifact ]]
  then
    shim " start --token 123" > $DESTINATION/buildbox-agent
    shim " build-artifact" > $DESTINATION/buildbox-artifact
    shim " build-data" > $DESTINATION/buildbox-data
  fi
fi

chmod +x $DESTINATION/buildbox-*

# Clean up the download
rm -f $DESTINATION/$DOWNLOAD

# Copy the bootstrap sample and make sure it's writable
if [[ -e $DESTINATION/bootstrap.sh ]]
then
  echo -e "\n\033[34mSkipping bootstrap.sh installation as it already exists\033[0m"
else
  BOOTSTRAP_URL=https://raw.githubusercontent.com/buildbox/agent/master/templates/bootstrap.sh
  BOOTSTRAP_DESTINATION=$DESTINATION/bootstrap.sh

  echo -e "Downloading $BOOTSTRAP_URL"

  buildbox-download "$BOOTSTRAP_URL" "$BOOTSTRAP_DESTINATION"

  chmod +x $DESTINATION/bootstrap.sh
fi

# Allow custom setting of the version
if [ -z "$TOKEN" ]; then
  TOKEN="token123"
fi

# Switch the start command depending on the version
if [[ -e $DESTINATION/bin/buildbox-agent ]]
then
  START_COMMAND="bin/buildbox-agent start --token $TOKEN"
else
  START_COMMAND="buildbox-agent start --access-token $TOKEN"
fi

echo -e "\n\033[32mSuccessfully installed to $DESTINATION\033[0m

You can now run the Buildbox agent like so:

  $DESTINATION/$START_COMMAND

You can find your agent's Access Token on your Account Settings
page under \"Agents\".

To customize how builds are run on your server, you can edit:

  $DESTINATION/bootstrap.sh

This file is run for every build and it's responsible for checking out
the source code and running the build script.

The source code of the agent is available here:

  https://github.com/buildbox/agent

If you have any questions or need a hand getting things setup,
please email us at: hello@buildbox.io

Happy Building!

<3 Buildbox"


text:
package com.android.identity;

import android.content.Context;
import android.content.pm.PackageManager;
import android.os.Build;
import android.security.keystore.KeyGenParameterSpec;
import android.security.keystore.KeyProperties;
import android.util.Log;

import androidx.annotation.NonNull;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.security.InvalidAlgorithmParameterException;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.KeyStore;
import java.security.KeyStoreException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;
import java.security.PrivateKey;
import java.security.cert.Certificate;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Collection;

import co.nstant.in.cbor.CborBuilder;
import co.nstant.in.cbor.CborEncoder;
import co.nstant.in.cbor.CborException;
import co.nstant.in.cbor.builder.ArrayBuilder;
import co.nstant.in.cbor.builder.MapBuilder;
import co.nstant.in.cbor.model.DataItem;
import co.nstant.in.cbor.model.UnicodeString;

class KeystoreWritableIdentityCredential extends WritableIdentityCredential {

    private static final String TAG = "KSWritableIC"; // limit to <= 23 chars

    private KeyPair mKeyPair = null;
    private Collection<X509Certificate> mCertificates = null;
    private final String mDocType;
    private final String mCredentialName;
    private final Context mContext;
    private final File mStorageDirectory;

    KeystoreWritableIdentityCredential(@NonNull Context context,
                                       @NonNull File storageDirectory,
                                       @NonNull String credentialName,
                                       @NonNull String docType) throws AlreadyPersonalizedException {
        mContext = context;
        mStorageDirectory = storageDirectory;
        mDocType = docType;
        mCredentialName = credentialName;
        if (CredentialData.credentialAlreadyExists(context, storageDirectory, credentialName)) {
            throw new AlreadyPersonalizedException("Credential with given name already exists");
        }
    }

    /**
     * Generates CredentialKey.
     *
     * If called a second time on the same object, does nothing and returns null.
     *
     * @param challenge The attestation challenge.
     * @return Attestation mCertificate chain or null if called a second time.
     * @throws AlreadyPersonalizedException     if this credential has already been personalized.
     * @throws CipherSuiteNotSupportedException if the cipher suite is not supported
     * @throws IdentityCredentialException      if unable to communicate with secure hardware.
     */
    private Collection<X509Certificate> ensureCredentialKey(byte[] challenge) {

        if (mKeyPair != null) {
            return null;
        }

        String aliasForCredential = CredentialData.getAliasFromCredentialName(mCredentialName);

        try {
            KeyStore ks = KeyStore.getInstance("AndroidKeyStore");
            ks.load(null);
            if (ks.containsAlias(aliasForCredential)) {
                ks.deleteEntry(aliasForCredential);
            }

            // TODO: We most likely want to constrain the life of CredentialKey (through
            // setKeyValidityStart() and setKeyValidityEnd()) so it's limited to e.g. 5 years
            // or how long the credential might be valid. For US driving licenses it's typically
            // up to 5 years, where it expires on your birth day).
            //
            // This is likely something the issuer would want to specify.

            KeyPairGenerator kpg = KeyPairGenerator.getInstance(
                    KeyProperties.KEY_ALGORITHM_EC, "AndroidKeyStore");
            KeyGenParameterSpec.Builder builder = new KeyGenParameterSpec.Builder(
                    aliasForCredential,
                    KeyProperties.PURPOSE_SIGN | KeyProperties.PURPOSE_VERIFY)
                    .setDigests(KeyProperties.DIGEST_SHA256, KeyProperties.DIGEST_SHA512);
            // Attestation is only available in Nougat and onwards.
            if (challenge == null) {
                challenge = new byte[0];
            }
            builder.setAttestationChallenge(challenge);

            mKeyPair = null;
            boolean isStrongBoxBacked = false;
            PackageManager pm = mContext.getPackageManager();
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P &&
                    pm.hasSystemFeature(PackageManager.FEATURE_STRONGBOX_KEYSTORE)) {
                isStrongBoxBacked = true;
                builder.setIsStrongBoxBacked(true);
            }
            kpg.initialize(builder.build());
            mKeyPair = kpg.generateKeyPair();
            Log.i(TAG, "CredentialKey created, strongBoxBacked=" + isStrongBoxBacked);

            Certificate[] certificates = ks.getCertificateChain(aliasForCredential);
            mCertificates = new ArrayList<>();
            for (Certificate certificate : certificates) {
                mCertificates.add((X509Certificate) certificate);
            }
        } catch (InvalidAlgorithmParameterException
                | NoSuchAlgorithmException
                | NoSuchProviderException
                | CertificateException
                | KeyStoreException
                | IOException e) {
            throw new RuntimeException("Error creating CredentialKey", e);
        }
        return mCertificates;
    }

    @Override
    public @NonNull Collection<X509Certificate> getCredentialKeyCertificateChain(
            @NonNull byte[] challenge) {
        Collection<X509Certificate> certificates = ensureCredentialKey(challenge);
        if (certificates == null) {
            throw new RuntimeException(
                    "getCredentialKeyCertificateChain() must be called before personalize()");
        }
        return certificates;
    }

    // Returns COSE_Sign1 with payload set to ProofOfProvisioning
    static DataItem buildProofOfProvisioningWithSignature(String docType,
            PersonalizationData personalizationData,
            PrivateKey key) {

        CborBuilder accessControlProfileBuilder = new CborBuilder();
        ArrayBuilder<CborBuilder> arrayBuilder = accessControlProfileBuilder.addArray();
        for (AccessControlProfile profile : personalizationData.getAccessControlProfiles()) {
            arrayBuilder.add(CredentialData.accessControlProfileToCbor(profile));
        }

        CborBuilder dataBuilder = new CborBuilder();
        MapBuilder<CborBuilder> dataMapBuilder = dataBuilder.addMap();
        for (PersonalizationData.NamespaceData namespaceData :
                personalizationData.getNamespaceDatas()) {
            dataMapBuilder.put(
                    new UnicodeString(namespaceData.getNamespaceName()),
                    CredentialData.namespaceDataToCbor(namespaceData));
        }

        CborBuilder signedDataBuilder = new CborBuilder();
        signedDataBuilder.addArray()
                .add("ProofOfProvisioning")
                .add(docType)
                .add(accessControlProfileBuilder.build().get(0))
                .add(dataBuilder.build().get(0))
                .add(false);

        DataItem signature;
        try {
            ByteArrayOutputStream dtsBaos = new ByteArrayOutputStream();
            CborEncoder dtsEncoder = new CborEncoder(dtsBaos).nonCanonical();
            dtsEncoder.encode(signedDataBuilder.build().get(0));
            byte[] dataToSign = dtsBaos.toByteArray();

            signature = Util.coseSign1Sign(key,
                    "SHA256withECDSA", dataToSign,
                    null,
                    null);
        } catch (CborException e) {
            throw new RuntimeException("Error building ProofOfProvisioning", e);
        }
        return signature;
    }

    @NonNull
    @Override
    public byte[] personalize(@NonNull PersonalizationData personalizationData) {

        try {
            ensureCredentialKey(null);

            DataItem signature = buildProofOfProvisioningWithSignature(mDocType,
                    personalizationData,
                    mKeyPair.getPrivate());

            byte[] proofOfProvisioning = Util.coseSign1GetData(signature);
            byte[] proofOfProvisioningSha256 = MessageDigest.getInstance("SHA-256").digest(
                    proofOfProvisioning);

            CredentialData.createCredentialData(
                    mContext,
                    mStorageDirectory,
                    mDocType,
                    mCredentialName,
                    CredentialData.getAliasFromCredentialName(mCredentialName),
                    mCertificates,
                    personalizationData,
                    proofOfProvisioningSha256,
                    false);

            return Util.cborEncode(signature);
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException("Error digesting ProofOfProvisioning", e);
        }
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace ZD.Gui.Zen
{
    /// <summary>
    /// Vertical scrollbar with built-in inertia and bounceback capability.
    /// </summary>
    public class ZenScrollBar : ZenControl, IMessageFilter
    {
        public delegate void SubscribeScrollTimerDelegate();
        private readonly SubscribeScrollTimerDelegate subscribeScrollTimer;

        /// <summary>
        /// Padding inside, around scroll thumb. Also used for painting up/down triangles in buttons.
        /// </summary>
        private readonly int pad;

        /// <summary>
        /// See <see cref="Maximum"/>.
        /// </summary>
        private int maximum = 100;

        /// <summary>
        /// See <see cref="PageSize"/>.
        /// </summary>
        private int pageSize = 10;

        /// <summary>
        /// See <see cref="SmallChange"/>.
        /// </summary>
        private int smallSchange = 1;

        /// <summary>
        /// See <see cref="Position"/>.
        /// </summary>
        private int position = 0;

        /// <summary>
        /// See <see cref="SpringFactor"/>.
        /// </summary>
        private float springFactor = 1F;

        /// <summary>
        /// The actual size of the spring zone (page size times spring factor).
        /// </summary>
        private int springSize = 0;

        private float acceleration = 4F;
        private float deceleration = 2F;
        private float maxSpeed = 100F;

        /// <summary>
        /// Ctor: take parent.
        /// </summary>
        public ZenScrollBar(ZenControlBase parent, SubscribeScrollTimerDelegate subscribeScrollTimer)
            : base(parent)
        {
            this.subscribeScrollTimer = subscribeScrollTimer;
            Width = (int)(Scale * ((float)ZenParams.ScrollBarWidth));
            pad = Width / 4;
            acceleration = acceleration * Scale;
            deceleration = deceleration * Scale;
            maxSpeed = maxSpeed * Scale;
            doInitAnimVals();
            Application.AddMessageFilter(this);
        }

        /// <summary>
        /// <para>Gets or sets the scroll bar's maximum value. Cannot be smaller than 1.</para>
        /// </summary>
        public int Maximum
        {
            get { return maximum; }
            set
            {
                if (maximum < 1) throw new ArgumentException("Maximum must be 1 or greater.");
                if (pageSize > value) pageSize = value;
                doStopAnyScroll();
                maximum = value;
                if (position + pageSize > maximum) position = maximum - pageSize;
                //MakeMePaint(false, RenderMode.Invalidate);
            }
        }

        /// <summary>
        /// <para>Gets or sets the scroll bar's page size.</para>
        /// </summary>
        public int PageSize
        {
            get { return pageSize; }
            set
            {
                if (value < 1) throw new ArgumentException("Page size must 1 or greater.");
                if (value > maximum) throw new ArgumentException("Page size cannot be greater than maximum value.");
                doStopAnyScroll();
                pageSize = value;
                if (position + pageSize > maximum) position = maximum - pageSize;
                springSize = (int)(springFactor * ((float)pageSize));
                //MakeMePaint(false, RenderMode.Invalidate);
            }
        }

        /// <summary>
        /// Gets or sets the small change value, i.e., the amount the scroll moves on a single click at the up/down buttons.
        /// </summary>
        public int SmallChange
        {
            get { return smallSchange; }
            set
            {
                if (value < 1) throw new ArgumentException("Small change must 1 or greater.");
                if (value > pageSize) throw new ArgumentException("Small change cannot be greater than page size.");
                doStopAnyScroll();
                smallSchange = value;
                //MakeMePaint(false, RenderMode.Invalidate);
            }
        }

        /// <summary>
        /// <para>Gets or sets the scroll bar's current position.</para>
        /// <para>Unless in spring zone, <see cref="Position"/> + <see cref="PageSize"/> <= <see cref="Maximum"/> always.</para>
        /// <para>Cannot be set programatically in the spring zone - e.g., must always be positive.</para>
        /// </summary>
        public int Position
        {
            get { return position; }
            set
            {
                if (value < 0) throw new ArgumentException("Position must be positive.");
                if (value + pageSize > maximum) throw new ArgumentException("Position plus page size must not exceed maximum value.");
                if (position == value) return;
                doStopAnyScroll();
                position = value;
                //MakeMePaint(false, RenderMode.Invalidate);
            }
        }

        /// <summary>
        /// <para>Gets or sets the spring factor. Must be between 0 and 0.8.</para>
        /// <para>A spring factor of 0 means scrolling stops at top and bottom abruptly.</para>
        /// <para>0.5 means inertia or tap-and-move can go half a page into negative or beyond maximum.</para>
        /// </summary>
        public float SpringFactor
        {
            get { return springFactor; }
            set
            {
                doStopAnyScroll();
                springFactor = value;
                springSize = (int)(springFactor * ((float)pageSize));
            }
        }

        /// <summary>
        /// Stop whatever momentum-based scrolling is currently going on.
        /// </summary>
        public void StopAnyScrolling()
        {
            doStopAnyScroll();
        }

        #region Interaction / event handling

        /// <summary>
        /// <para>The mouse Y position, in my coordinates, at the time the thumb was pressed (mouse down).</para>
        /// <para>Value irrelevant if <see cref="pressedPart"/> is not the thumb.</para>
        /// </summary>
        private int thumbHoldStartMouseY = -1;

        /// <summary>
        /// Top of thumb when dragging started.
        /// </summary>
        private int thumbHoldStartThumbTop = -1;

        /// <summary>
        /// The <see cref="Position"/> when dragging started.
        /// </summary>
        private int thumbHoldStartPos = -1;

        /// <summary>
        /// Gets the thumb's rectangle (depend on position, page size, full control size).
        /// </summary>
        /// <param name="pos">Rectangle corresponding to position, and current size and page size.</param>
        private Rectangle getThumbRect(int pos)
        {
            // Adjust position so it's never out of bounds when we're in spring range
            int adjPos = position;
            if (adjPos < 0) adjPos = 0;
            else if (adjPos + pageSize > maximum) adjPos = maximum - pageSize;

            // Size is flexible based on proportion of page size to maximum
            // But never smaller than 2 times width
            int vSpace = Height - 2 * Width; // Playig field of the thumb
            int hThumb = (int)(((float)vSpace) * ((float)pageSize) / ((float)maximum));
            if (hThumb < 2 * Width) hThumb = 2 * Width;
            // Y in (Free playing field outside thumb area) ~~ Position in (Maximum - PageSize)
            int yThumb = (int)(((float)(vSpace - hThumb)) * ((float)adjPos) / ((float)(maximum - pageSize)));
            // Got it
            return new Rectangle(0, yThumb + Width, Width, hThumb);
        }

        /// <summary>
        /// Parts that can be "working", i.e., pressed and held.
        /// </summary>
        private enum WorkingPart
        {
            None,
            TopBtn,
            TopJump,
            Thumb,
            BottomJump,
            BottomBtn,
        }

        /// <summary>
        /// Component that is currently being pressed and held.
        /// </summary>
        private WorkingPart pressedPart = WorkingPart.None;

        public override bool DoMouseDown(Point p, MouseButtons button)
        {
            // No righties
            if (button != MouseButtons.Left) return true;

            // Figure out what's been pressed
            Rectangle thumbRect = getThumbRect(position);
            bool overTopBtn = new Rectangle(0, 0, Width, Width).Contains(p);
            bool overThumb = thumbRect.Contains(p);
            bool overBottomBtn = new Rectangle(0, Height - Width, Width, Width).Contains(p);
            if (overTopBtn) pressedPart = WorkingPart.TopBtn;
            else if (overThumb) pressedPart = WorkingPart.Thumb;
            else if (overBottomBtn) pressedPart = WorkingPart.BottomBtn;
            else if (p.Y < thumbRect.Top) pressedPart = WorkingPart.TopJump;
            else if (p.Y > thumbRect.Bottom) pressedPart = WorkingPart.BottomJump;
            else pressedPart = WorkingPart.None;

            // UI goodies, ease colors in and out
            doAnimateTo(true, overTopBtn, overThumb, overBottomBtn, pressedPart);

            // Thumb now gets dragged around
            if (pressedPart == WorkingPart.Thumb)
            {
                // Dragging the thumb means any scrolling in progress stops right now
                // But: record mandatory scroll position
                doStopAnyScroll(position);
                // Remember where we started dragging
                thumbHoldStartMouseY = p.Y;
                thumbHoldStartThumbTop = thumbRect.Top;
                thumbHoldStartPos = position;
                // Start capturing mouse. We want to keep tracking even if pointer leaves to left or right while
                // button is pressed.
                CaptureMouse();
            }
            // Jumpy-holdy parts (buttons and full page scroll)
            else
            {
                int fuelToBuy;
                int repeatBuy;
                if (pressedPart == WorkingPart.TopBtn) { fuelToBuy = -smallSchange; repeatBuy = fuelToBuy / 2; }
                else if (pressedPart == WorkingPart.BottomBtn) { fuelToBuy = smallSchange; repeatBuy = fuelToBuy / 2; }
                else if (pressedPart == WorkingPart.TopJump) { fuelToBuy = -pageSize / 4; repeatBuy = fuelToBuy / 6; }
                else { fuelToBuy = pageSize / 4; repeatBuy = fuelToBuy / 6; }
                // Buy the fuel
                doBuyScrollFuel(fuelToBuy);
                // Commission repeated purchases: "repeat fire" effect if button is kept pressed
                lock (animLOScroll)
                {
                    animRepeatCounter = 0;
                    animRepeatPurchase = ((float)repeatBuy);
                    if (pressedPart == WorkingPart.TopJump || pressedPart == WorkingPart.BottomJump)
                        animRepeatBarrierY = p.Y;
                    else
                    {
                        if (pressedPart == WorkingPart.TopBtn) animRepeatBarrierY = Width + 1;
                        else animRepeatBarrierY = Height - Width - 1;
                    }
                }
            }

            // We're done here.
            return true;
        }

        public override bool DoMouseUp(Point p, MouseButtons button)
        {
            // No righties
            if (button != MouseButtons.Left) return true;

            // If we've been tracking thumb, stoppit.
            if (pressedPart == WorkingPart.Thumb) StopCapturingMouse();

            pressedPart = WorkingPart.None;
            lock (animLOScroll)
            {
                // No forced positioning
                animPosInDrag = int.MinValue;
                // Cancel any repeat purchase order
                animRepeatCounter = int.MinValue;
                animRepeatPurchase = float.MinValue;
            }
            doAnimateTo(true, false, false, false, pressedPart);
            return true;
        }

        public override bool DoMouseMove(Point p, MouseButtons button)
        {
            // If thumb is being dragged, handled that first
            if (pressedPart == WorkingPart.Thumb)
            {
                // How far we've moved vertically since user pressed and held thumb
                int diff = p.Y - thumbHoldStartMouseY;
                // How high is thumb
                int thumbH = getThumbRect(0).Height;
                // Where thumb's top goes - but only within bounds!
                // Note: "width" stands for height of up/down buttons
                int thumbY = thumbHoldStartThumbTop + diff;
                if (thumbY < Width) thumbY = Width;
                else if (thumbY + thumbH > Height - Width) thumbY = Height - Width - thumbH;
                // Calculate new position - thumb's top divides area whose height is my height - thumb height - two buttons
                float uiRange = (float)(Height - 2 * Width - thumbH);
                float uiProportion = ((float)(thumbY - Width)) / uiRange;
                float posRange = (float)(maximum - pageSize);
                float newPos = posRange * uiProportion;
                // Let scroll animation thread know about this
                lock (animLOScroll) { animPosInDrag = (int)newPos; }
            }

            // Do display niceties
            bool overTopBtn = false;
            bool overThumb = false;
            bool overBottomBtn = false;
            if (pressedPart == WorkingPart.None)
            {
                overTopBtn = new Rectangle(0, 0, Width, Width).Contains(p);
                overThumb = getThumbRect(position).Contains(p);
                overBottomBtn = new Rectangle(0, Height - Width, Width, Width).Contains(p);
            }
            doAnimateTo(true, overTopBtn, overThumb, overBottomBtn, pressedPart);
            return true;
        }

        public override void DoMouseLeave()
        {
            // When we leave, that unpresses whatever's currently pressed, except held thumb
            if (pressedPart != WorkingPart.Thumb)
            {
                // If we're holding on to thumb, pretend we don't leave
                pressedPart = WorkingPart.None;
                // Cancel any repeat purchase order (pressed up/down buttons)
                lock (animLOScroll)
                {
                    animRepeatCounter = int.MinValue;
                    animRepeatPurchase = float.MinValue;
                }
            }
            // Update our make-up.
            doAnimateTo(false, false, false, false, pressedPart);
        }

        #endregion

        #region Animation and paint

        /// <summary>
        /// Animated values.
        /// </summary>
        private struct AnimVals
        {
            public Color TopBtnBg;
            public Color TopBtnArrow;
            public Color BottomBtnBg;
            public Color BottomBtnArrow;
            public Color Thumb;
        }

        /// <summary>
        /// Set of all animation states.
        /// </summary>
        private class AnimState
        {
            /// <summary>
            /// Each component's starting color, in case component is being animated.
            /// </summary>
            public AnimVals From;
            /// <summary>
            /// Each component's target color, in case component's is being animated.
            /// </summary>
            public AnimVals To;
            /// <summary>
            /// -1: no animation in progress. 0 to 1: slow; 2..3: fast.
            /// </summary>
            public float StateTopBtn = -1;
            /// <summary>
            /// -1: no animation in progress. 0 to 1: slow; 2..3: fast.
            /// </summary>
            public float StateBottomBtn = -1;
            /// <summary>
            /// -1: no animation in progress. 0 to 1: slow; 2..3: fast.
            /// </summary>
            public float StateThumb = -1;
        }

        /// <summary>
        /// Lock object around my own anim states and values
        /// Ie stuff touched in <see cref="DoTimer"/>.
        /// </summary>
        private object animLO = new object();

        /// <summary>
        /// Current animated values.
        /// </summary>
        private AnimVals animVals;

        /// <summary>
        /// Current animation state.
        /// </summary>
        private readonly AnimState animState = new AnimState();

        /// <summary>
        /// Handles timer to nudge around scrollbar's own animations (everything except inertia scrolling).
        /// </summary>
        public override void DoTimer(out bool? needBackground, out RenderMode? renderMode)
        {
            needBackground = null;
            renderMode = null;
            bool needTimer = false;
            bool needPaint = false;
            lock (animLO)
            {
                // Top button
                if (animState.StateTopBtn != -1)
                {
                    needPaint = true;
                    if (animState.StateTopBtn > 1.99) animState.StateTopBtn += 0.2F;
                    else animState.StateTopBtn += 0.07F;
                    bool pastEnd = animState.StateTopBtn > 3 || (animState.StateTopBtn > 1 && animState.StateTopBtn < 1.99F);
                    if (pastEnd)
                    {
                        animState.StateTopBtn = -1;
                        animVals.TopBtnBg = animState.To.TopBtnBg;
                        animVals.TopBtnArrow = animState.To.TopBtnArrow;
                    }
                    else
                    {
                        float val = animState.StateTopBtn;
                        if (val > 2) val -= 2;
                        animVals.TopBtnBg = MixColors(animState.From.TopBtnBg, animState.To.TopBtnBg, val);
                        animVals.TopBtnArrow = MixColors(animState.From.TopBtnArrow, animState.To.TopBtnArrow, val);
                        needTimer = true;
                    }
                }
                // Bottom button
                if (animState.StateBottomBtn != -1)
                {
                    needPaint = true;
                    if (animState.StateBottomBtn > 1.99) animState.StateBottomBtn += 0.2F;
                    else animState.StateBottomBtn += 0.07F;
                    bool pastEnd = animState.StateBottomBtn > 3 || (animState.StateBottomBtn > 1 && animState.StateBottomBtn < 1.99F);
                    if (pastEnd)
                    {
                        animState.StateBottomBtn = -1;
                        animVals.BottomBtnBg = animState.To.BottomBtnBg;
                        animVals.BottomBtnArrow = animState.To.BottomBtnArrow;
                    }
                    else
                    {
                        float val = animState.StateBottomBtn;
                        if (val > 2) val -= 2;
                        animVals.BottomBtnBg = MixColors(animState.From.BottomBtnBg, animState.To.BottomBtnBg, val);
                        animVals.BottomBtnArrow = MixColors(animState.From.BottomBtnArrow, animState.To.BottomBtnArrow, val);
                        needTimer = true;
                    }
                }
                // Thumb
                if (animState.StateThumb != -1)
                {
                    needPaint = true;
                    if (animState.StateThumb > 1.99) animState.StateThumb += 0.2F;
                    else animState.StateThumb += 0.07F;
                    bool pastEnd = animState.StateThumb > 3 || (animState.StateThumb > 1 && animState.StateThumb < 1.99F);
                    if (pastEnd)
                    {
                        animState.StateThumb = -1;
                        animVals.Thumb = animState.To.Thumb;
                    }
                    else
                    {
                        float val = animState.StateThumb;
                        if (val > 2) val -= 2;
                        animVals.Thumb = MixColors(animState.From.Thumb, animState.To.Thumb, val);
                        needTimer = true;
                    }
                }
            }
            if (!needTimer) UnsubscribeFromTimer();
            if (needPaint)
            {
                needBackground = false;
                renderMode = RenderMode.Invalidate;
            }
        }

        /// <summary>
        /// Inits animated values at creation time.
        /// </summary>
        private void doInitAnimVals()
        {
            animVals.TopBtnBg = ZenParams.ScrollColBg;
            animVals.TopBtnArrow = ZenParams.ScrollColArrowBase;
            animVals.BottomBtnBg = ZenParams.ScrollColBg;
            animVals.BottomBtnArrow = ZenParams.ScrollColArrowBase;
            animVals.Thumb = ZenParams.ScrollColThumbBase;
        }

        /// <summary>
        /// Updates animations to target new states for our components.
        /// </summary>
        private void doAnimateTo(bool mouseIn, bool overTop, bool overThumb, bool overBottom,
            WorkingPart wp)
        {
            // Figure out each component's desired color based on arguments
            // First, just hover stuff
            Color topBtnBg = overTop ? ZenParams.ScrollColBtnHover : ZenParams.ScrollColBg;
            Color topBtnArrow = overTop ? ZenParams.ScrollColArrowHover : ZenParams.ScrollColArrowBase;
            Color bottomBtnBg = overBottom ? ZenParams.ScrollColBtnHover : ZenParams.ScrollColBg;
            Color bottomBtnArrow = overBottom ? ZenParams.ScrollColArrowHover : ZenParams.ScrollColArrowBase;
            Color thumb = mouseIn ? ZenParams.ScrollColThumbSemiHover : ZenParams.ScrollColThumbBase;
            if (overThumb) thumb = ZenParams.ScrollColThumbHover;
            // Then, pressed stuff
            if (wp == WorkingPart.TopBtn)
            {
                topBtnBg = ZenParams.ScrollColBtnPress;
                topBtnArrow = ZenParams.ScrollColArrowPress;
            }
            else if (wp == WorkingPart.BottomBtn)
            {
                bottomBtnBg = ZenParams.ScrollColBtnPress;
                bottomBtnArrow = ZenParams.ScrollColArrowPress;
            }
            else if (wp == WorkingPart.Thumb) thumb = ZenParams.ScrollColThumbActive;
            // Go from here to there, if we have to
            lock (animLO)
            {
                // If something is "working", i.e., pressed, we need timer for repeat action fires
                bool needTimer = wp != WorkingPart.None;
                // Must change top button colors, or not
                if (animVals.TopBtnBg == topBtnBg) animState.StateTopBtn = -1;
                else
                {
                    animState.StateTopBtn = (overTop || wp == WorkingPart.TopBtn) ? 2 : 0;
                    animState.From.TopBtnBg = animVals.TopBtnBg;
                    animState.From.TopBtnArrow = animVals.TopBtnArrow;
                    animState.To.TopBtnBg = topBtnBg;
                    animState.To.TopBtnArrow = topBtnArrow;
                    needTimer |= true;
                }
                // Must change bottom button colors, or not
                if (animVals.BottomBtnBg == bottomBtnBg) animState.StateBottomBtn = -1;
                else
                {
                    animState.StateBottomBtn = (overBottom || wp == WorkingPart.BottomBtn) ? 2 : 0;
                    animState.From.BottomBtnBg = animVals.BottomBtnBg;
                    animState.From.BottomBtnArrow = animVals.BottomBtnArrow;
                    animState.To.BottomBtnBg = bottomBtnBg;
                    animState.To.BottomBtnArrow = bottomBtnArrow;
                    needTimer |= true;
                }
                // Must change thumb color, or not
                if (animVals.Thumb == thumb) animState.StateThumb = -1;
                else
                {
                    animState.StateThumb = (overThumb || wp == WorkingPart.Thumb) ? 2 : 0;
                    animState.From.Thumb = animVals.Thumb;
                    animState.To.Thumb = thumb;
                    needTimer |= true;
                }
                // Donee. Make sure we got timer, or not.
                if (needTimer) SubscribeToTimer();
                else UnsubscribeFromTimer();
            }
        }

        /// <summary>
        /// Lock object around inertia and thumb drag scroll's members
        /// Ie stuff touched in <see cref="DoScrollTimer"/>, that is, my parent's timer handler
        /// </summary>
        private object animLOScroll = new object();

        /// <summary>
        /// Current scrolling speed.
        /// </summary>
        private float animScrollSpeed = 0;

        /// <summary>
        /// Fuel for thruster to burn.
        /// </summary>
        private float animFuel = 0;

        /// <summary>
        /// <para>Authoritative, no-animation scroll position to be signaled in timer.</para>
        /// <para>Used when scroll thumb is being dragged around. int.MinValue if thumb is not being dragged.</para>
        /// </summary>
        private int animPosInDrag = int.MinValue;

        /// <summary>
        /// <para>Counter for repeat fuel purchases (repeat fire while something is held pressed).</para>
        /// <para>Starts at 0 if we have a repeat order; int.MinValue if we don't.</para>
        /// </summary>
        private int animRepeatCounter = int.MinValue;

        /// <summary>
        /// Amount to purchase if we have a repeat purchase order.
        /// </summary>
        private float animRepeatPurchase = float.MinValue;

        /// <summary>
        /// <para>Barrier to repeat purchases.</para>
        /// <para>If repeat purchase is negative, order is canceled when top of thumb hits this Y value.</para>
        /// <para>If repeat purchase is positive, order is canceled when bottom of thumb hits this Y value.</para>
        /// </summary>
        private int animRepeatBarrierY = int.MinValue;

        /// <summary>
        /// Called in host control's timer event handler to animate inertia-based scrolling.
        /// </summary>
        /// <param name="needTimer">True if timer is still needed.</param>
        /// <param name="valueChanged">True if scroll value changed (host timer must repositing content).</param>
        public void DoScrollTimer(out bool needTimer, out bool valueChanged)
        {
            needTimer = false;
            valueChanged = false;

            lock (animLOScroll)
            {
                // Thumb is pressed, held and dragged around - no inertia
                if (animPosInDrag != int.MinValue)
                {
                    // We sure need timer
                    needTimer = true;
                    // Handle dragging and return
                    if (animPosInDrag != position)
                    {
                        position = animPosInDrag;
                        valueChanged = true;
                    }
                    return;
                }

                // Any repeat purchase?
                if (animRepeatCounter != int.MinValue)
                {
                    // Sure need timer - must keep buying
                    needTimer = true;
                    // Count; at intervals, buy
                    ++animRepeatCounter;
                    // First order is delayed by ticksDelay; repeat orders then come at tickFreq
                    int tickDelay = 5;
                    int tickFreq = 3;
                    if ((animRepeatCounter - tickDelay) % tickFreq == 0)
                        animFuel += animRepeatPurchase;
                }

                // Animated, inertia scrolling from here on
                bool inSpringZoneBefore = position < 0 || position + pageSize > maximum;
                // If we have fuel, keep accelerating until hitting speed limit
                // Burn fuel equivalent to our speed
                if (animFuel > 0)
                {
                    float speedToAdd = 0;
                    if (animScrollSpeed < maxSpeed)
                    {
                        speedToAdd = Math.Min(animFuel, acceleration);
                        if (animScrollSpeed + speedToAdd > maxSpeed) speedToAdd = maxSpeed - animScrollSpeed;
                    }
                    animScrollSpeed += speedToAdd;
                    animFuel -= animScrollSpeed;
                    if (animFuel < 0) animFuel = 0;
                }
                // If we have negative fuel, keep accelerating the other way
                else if (animFuel < 0)
                {
                    float speedToAdd = 0;
                    if (-animScrollSpeed < maxSpeed)
                    {
                        speedToAdd = -Math.Min(-animFuel, acceleration);
                        if (-(animScrollSpeed + speedToAdd) > maxSpeed) speedToAdd = -(maxSpeed - animScrollSpeed);
                    }
                    animScrollSpeed += speedToAdd;
                    animFuel -= animScrollSpeed;
                    if (animFuel > 0) animFuel = 0;
                }
                // If we have no fuel, decelerate
                else
                {
                    if (animScrollSpeed < 0)
                    {
                        animScrollSpeed += deceleration;
                        if (animScrollSpeed > 0) animScrollSpeed = 0;
                    }
                    else if (animScrollSpeed > 0)
                    {
                        animScrollSpeed -= deceleration;
                        if (animScrollSpeed < 0) animScrollSpeed = 0;
                    }
                }

                // So, if speed is not null here, move by that much.
                int iScrollSpeed = (int)animScrollSpeed;
                if (iScrollSpeed != 0 || inSpringZoneBefore)
                {
                    needTimer = true;
                    // Update position; see if that takes us into spring zone
                    valueChanged = true;
                    position = position + iScrollSpeed;
                    bool inSpringZoneAfter = position < 0 || position + pageSize > maximum;
                    // If springiness is not tolerated at all: stop at edge; stop all this scrolling business
                    if (inSpringZoneAfter && springSize == 0)
                    {
                        if (position < 0) position = 0;
                        else if (position + pageSize > maximum) position = maximum - pageSize;
                        animFuel = 0;
                        animScrollSpeed = 0;
                        // Timer not needed - scrolling's over
                        needTimer = false;
                    }
                    // Handle bounceback
                    else if (inSpringZoneBefore)
                    {
                        // Stop at spring's edge
                        if (position < -springSize) position = -springSize;
                        else if (position > maximum - pageSize + springSize) position = maximum - pageSize + springSize;
                        // Normal speed is over; empty tank
                        if (animFuel > 0) animFuel = Math.Min(maxSpeed, animFuel);
                        else animFuel = Math.Max(-maxSpeed, animFuel);
                        animFuel = 0;
                        animScrollSpeed /= 2F;
                        // If we were already in spring zone, move back towards real edge
                        if (inSpringZoneBefore)
                        {
                            int inSpring = position < 0 ? -position : position - maximum + pageSize;
                            int proportionalBack = inSpring / 4;
                            // We move towards real edge with a combination of proportional force plus deceleration
                            int pushBack = proportionalBack + (int)(deceleration);
                            // But never cross over to real territory because of pushback
                            int inSpringAfter = inSpring - pushBack;
                            if (inSpringAfter < 0) inSpringAfter = 0;
                            if (position < 0) position = -inSpringAfter;
                            else position = maximum - pageSize + inSpringAfter;
                        }
                        // Timer still needed to bounce back
                        needTimer = true;
                    }
                    // Cancel repeat purchase if we have to
                    if (animRepeatCounter != int.MinValue)
                    {
                        Rectangle tr = getThumbRect(position);
                        if (animRepeatPurchase < 0 && tr.Top < animRepeatBarrierY) animRepeatCounter = int.MinValue;
                        else if (animRepeatPurchase > 0 && tr.Bottom > animRepeatBarrierY) animRepeatCounter = int.MinValue;
                        if (animRepeatCounter == int.MinValue) animRepeatPurchase = float.MinValue;
                    }
                }
            }
        }

        /// <summary>
        /// Adds fuel to the scrolling momentum tank.
        /// </summary>
        private void doBuyScrollFuel(int howMuch)
        {
            if (howMuch == 0) return;
            lock (animLO)
            {
                // Reversing course
                if (howMuch < 0 && animScrollSpeed > 0 || howMuch > 0 && animScrollSpeed < 0)
                {
                    animFuel = (float)howMuch;
                    animScrollSpeed = 0;
                }
                // Speeding more
                else animFuel += (float)howMuch;
                subscribeScrollTimer();
            }
        }

        /// <summary>
        /// Stops *any* scrolling in progress; leaves flexible band if we're in it.
        /// </summary>
        /// <param name="posInDrag">Mandatory position, or int.MinValue if no position is mandated.</param>
        private void doStopAnyScroll(int posInDrag = int.MinValue)
        {
            lock (animLO)
            {
                // Empty tank, grind to a halt.
                animFuel = 0;
                animScrollSpeed = 0;
                // Leave spring zone.
                if (position < 0) position = 0;
                else if (position + pageSize > maximum) position = maximum - pageSize;
                // Also stop any ongoing repeat purchase
                animRepeatCounter = int.MinValue;
                animRepeatPurchase = float.MinValue;
                // Any mandatory position? Used when scroll thumb starts getting dragged.
                animPosInDrag = posInDrag;
                if (animPosInDrag != int.MinValue) subscribeScrollTimer();
            }
        }

        public static ushort HIWORD(IntPtr l) { return (ushort)((l.ToInt64() >> 16) & 0xFFFF); }
        public static ushort LOWORD(IntPtr l) { return (ushort)((l.ToInt64()) & 0xFFFF); }

        /// <summary>
        /// Pre-filters Windows messages to fish out mouse wheel events.
        /// </summary>
        public bool PreFilterMessage(ref Message m)
        {
            // If we're not even on screen, don't.
            if (Parent == null) return false;
            // Look for mouse wheel event
            if (m.Msg == 0x020A) //WM_MOUSEWHEEL
            {
                Point p = new Point((int)m.LParam);
                int delta = (Int16)HIWORD(m.WParam);
                MouseEventArgs e = new MouseEventArgs(MouseButtons.None, 0, p.X, p.Y, delta);
                m.Result = IntPtr.Zero; //don't pass it to the parent window
                onMouseWheel(e);
            }
            return false;
        }

        /// <summary>
        /// Handles the mouse wheel event: adds momentum to animated scrolling.
        /// </summary>
        private void onMouseWheel(MouseEventArgs e)
        {
            // Input from the mouse wheel adds momentum to animated scrolling.
            float extraMomentum = -((float)e.Delta) * ((float)PageSize) / 1500.0F;
            doBuyScrollFuel((int)extraMomentum);
        }

        public override void DoPaint(Graphics g)
        {
            // Get current animation values
            AnimVals av;
            lock (animLO) { av = animVals; }

            g.SmoothingMode = SmoothingMode.None;
            // Background
            using (Brush b = new SolidBrush(ZenParams.ScrollColBg))
            {
                g.FillRectangle(b, 0, 0, Width, Height);
            }
            // Top button
            using (Brush b = new SolidBrush(av.TopBtnBg))
            {
                g.FillRectangle(b, 0, 0, Width, Width);
            }
            using (Brush b = new SolidBrush(av.TopBtnArrow))
            {
                PointF[] pts = new PointF[]
                {
                    new PointF(pad, Width - pad),
                    new PointF(((float)Width) / 2.0F, pad),
                    new PointF(Width - pad, Width - pad),
                    new PointF(pad, Width - pad),
                };
                g.SmoothingMode = SmoothingMode.AntiAlias;
                g.FillPolygon(b, pts);
                g.SmoothingMode = SmoothingMode.None;
            }
            // Bottom button
            using (Brush b = new SolidBrush(av.BottomBtnBg))
            {
                g.FillRectangle(b, 0, Height - Width, Width, Width);
            }
            using (Brush b = new SolidBrush(av.BottomBtnArrow))
            {
                PointF[] pts = new PointF[]
                {
                    new PointF(pad, Height - Width + pad),
                    new PointF(((float)Width) / 2.0F, Height - pad),
                    new PointF(Width - pad, Height - Width + pad),
                    new PointF(pad, Height - Width + pad),
                };
                g.SmoothingMode = SmoothingMode.AntiAlias;
                g.FillPolygon(b, pts);
                g.SmoothingMode = SmoothingMode.None;
            }
            // Scroll thumb
            Rectangle thRect = getThumbRect(position);
            using (Brush b = new SolidBrush(av.Thumb))
            {
                g.FillRectangle(b, pad, thRect.Top + pad / 2, Width - 2 * pad, thRect.Height - pad);
            }
        }

        #endregion
    }
}


text:
<?php

namespace __VendorPrefix\Domain\Shared\Event;

trait DomainEventNotifer
{
    protected function notifyDomainEvent(DomainEvent $domainEvent)
    {
        foreach ($domainEvent->getEventNames() as $eventName) {
            $this->dispatcher->dispatch($eventName, $domainEvent);
        }
    }
}


text:
using System;

namespace FarseerGames.FarseerPhysics.Dynamics.Springs
{
    /// <summary>
    /// Puts a body at an angle at the body's current position. The angle is variable.
    /// </summary>
    public class FixedAngleSpring : Spring
    {
        public event FixedSpringDelegate SpringUpdated;

        private Body _body;
        private float _maxTorque = float.MaxValue;
        private float _targetAngle;
        private float _torqueMultiplier = 1f;

        public FixedAngleSpring()
        {
        }

        public FixedAngleSpring(Body body, float springConstant, float dampingConstant)
        {
            _body = body;
            SpringConstant = springConstant;
            DampingConstant = dampingConstant;
            _targetAngle = body.TotalRotation;
        }

        /// <summary>
        /// Gets or sets the body.
        /// </summary>
        /// <Value>The body.</Value>
        public Body Body
        {
            get { return _body; }
            set { _body = value; }
        }

        /// <summary>
        /// Gets or sets the target angle.
        /// </summary>
        /// <Value>The target angle.</Value>
        public float TargetAngle
        {
            get { return _targetAngle; }
            set { _targetAngle = value; }
        }

        /// <summary>
        /// Gets or sets the max torque.
        /// </summary>
        /// <Value>The max torque.</Value>
        public float MaxTorque
        {
            get { return _maxTorque; }
            set { _maxTorque = value; }
        }

        /// <summary>
        /// The resultant torque will be multiplied by this Value prior to being applied to the bodies.
        /// For normal spring behavior this Value should be 1
        /// </summary>
        public float TorqueMultiplier
        {
            get { return _torqueMultiplier; }
            set { _torqueMultiplier = value; }
        }

        public override void Validate()
        {
            //if body is disposed then dispose the spring.
            if (_body.IsDisposed)
            {
                Dispose();
            }
        }

        public override void Update(float dt)
        {
            base.Update(dt);

            if (_body.isStatic)
                return;

            if (!_body.Enabled)
                return;

            //Calculate and apply spring force
            float angleDifference = _targetAngle - _body.totalRotation;
            float springTorque = SpringConstant * angleDifference;
            SpringError = angleDifference;

            //apply torque at anchor
            float torque1 = springTorque - DampingConstant * _body.AngularVelocity;
            torque1 = Math.Min(Math.Abs(torque1 * _torqueMultiplier), _maxTorque) * Math.Sign(torque1);

            if (torque1 != 0f)
            {
                _body.ApplyTorque(torque1);

                if (SpringUpdated != null)
                    SpringUpdated(this, _body);
            }
        }
    }
}


text:
package org.apache.spark.rdd

import org.apache.spark.{OneToOneDependency, SparkContext, Partition, TaskContext}
import java.io.{ObjectOutputStream, IOException}

private[spark] class ZippedPartitionsPartition(
    idx: Int,
    @transient rdds: Seq[RDD[_]])
  extends Partition {

  override val index: Int = idx
  var partitionValues = rdds.map(rdd => rdd.partitions(idx))
  def partitions = partitionValues

  @throws(classOf[IOException])
  private def writeObject(oos: ObjectOutputStream) {
    // Update the reference to parent split at the time of task serialization
    partitionValues = rdds.map(rdd => rdd.partitions(idx))
    oos.defaultWriteObject()
  }
}

abstract class ZippedPartitionsBaseRDD[V: ClassManifest](
    sc: SparkContext,
    var rdds: Seq[RDD[_]])
  extends RDD[V](sc, rdds.map(x => new OneToOneDependency(x))) {

  override def getPartitions: Array[Partition] = {
    val sizes = rdds.map(x => x.partitions.size)
    if (!sizes.forall(x => x == sizes(0))) {
      throw new IllegalArgumentException("Can't zip RDDs with unequal numbers of partitions")
    }
    val array = new Array[Partition](sizes(0))
    for (i <- 0 until sizes(0)) {
      array(i) = new ZippedPartitionsPartition(i, rdds)
    }
    array
  }

  override def getPreferredLocations(s: Partition): Seq[String] = {
    val parts = s.asInstanceOf[ZippedPartitionsPartition].partitions
    val prefs = rdds.zip(parts).map { case (rdd, p) => rdd.preferredLocations(p) }
    // Check whether there are any hosts that match all RDDs; otherwise return the union
    val exactMatchLocations = prefs.reduce((x, y) => x.intersect(y))
    if (!exactMatchLocations.isEmpty) {
      exactMatchLocations
    } else {
      prefs.flatten.distinct
    }
  }

  override def clearDependencies() {
    super.clearDependencies()
    rdds = null
  }
}

class ZippedPartitionsRDD2[A: ClassManifest, B: ClassManifest, V: ClassManifest](
    sc: SparkContext,
    f: (Iterator[A], Iterator[B]) => Iterator[V],
    var rdd1: RDD[A],
    var rdd2: RDD[B])
  extends ZippedPartitionsBaseRDD[V](sc, List(rdd1, rdd2)) {

  override def compute(s: Partition, context: TaskContext): Iterator[V] = {
    val partitions = s.asInstanceOf[ZippedPartitionsPartition].partitions
    f(rdd1.iterator(partitions(0), context), rdd2.iterator(partitions(1), context))
  }

  override def clearDependencies() {
    super.clearDependencies()
    rdd1 = null
    rdd2 = null
  }
}

class ZippedPartitionsRDD3
  [A: ClassManifest, B: ClassManifest, C: ClassManifest, V: ClassManifest](
    sc: SparkContext,
    f: (Iterator[A], Iterator[B], Iterator[C]) => Iterator[V],
    var rdd1: RDD[A],
    var rdd2: RDD[B],
    var rdd3: RDD[C])
  extends ZippedPartitionsBaseRDD[V](sc, List(rdd1, rdd2, rdd3)) {

  override def compute(s: Partition, context: TaskContext): Iterator[V] = {
    val partitions = s.asInstanceOf[ZippedPartitionsPartition].partitions
    f(rdd1.iterator(partitions(0), context),
      rdd2.iterator(partitions(1), context),
      rdd3.iterator(partitions(2), context))
  }

  override def clearDependencies() {
    super.clearDependencies()
    rdd1 = null
    rdd2 = null
    rdd3 = null
  }
}

class ZippedPartitionsRDD4
  [A: ClassManifest, B: ClassManifest, C: ClassManifest, D:ClassManifest, V: ClassManifest](
    sc: SparkContext,
    f: (Iterator[A], Iterator[B], Iterator[C], Iterator[D]) => Iterator[V],
    var rdd1: RDD[A],
    var rdd2: RDD[B],
    var rdd3: RDD[C],
    var rdd4: RDD[D])
  extends ZippedPartitionsBaseRDD[V](sc, List(rdd1, rdd2, rdd3, rdd4)) {

  override def compute(s: Partition, context: TaskContext): Iterator[V] = {
    val partitions = s.asInstanceOf[ZippedPartitionsPartition].partitions
    f(rdd1.iterator(partitions(0), context),
      rdd2.iterator(partitions(1), context),
      rdd3.iterator(partitions(2), context),
      rdd4.iterator(partitions(3), context))
  }

  override def clearDependencies() {
    super.clearDependencies()
    rdd1 = null
    rdd2 = null
    rdd3 = null
    rdd4 = null
  }
}


text:
'use strict';

let _ = require('lodash');
let colors = require('colors');

let logLevels = {};
let levelOrdering = {};
_.each(['DEBUG', 'INFO', 'WARN', 'ERROR'], function(l, i){
	logLevels[l] = l;
	levelOrdering[l] = i;
});

let levelTypes = _.extend({
	SUCCESS: 'SUCCESS'
}, logLevels);

let parseDataObject = function(data){
	data = data || {};

	// move the error into a property of data for consistency
	if(data instanceof Error){
		data = { error: data };
	}

	if(data.error && data.error instanceof Error){
		data.error = {
			message: data.error.message || data.error.toString(),
			stack: data.error.stack || ''
		};
	}
	return data;
};

// Logwrangler module prototype stub
function LogwranglerModule(){};
LogwranglerModule.prototype.log = function(){};

function SimpleConsoleModule(options){
	let defaults = {
		colors: true,
		outputFormat: 'text'
	};
	this.options = _.defaults(_.pick(options || {}, _.keys(defaults)), defaults);

};
SimpleConsoleModule.prototype = Object.create(LogwranglerModule.prototype);
SimpleConsoleModule.prototype.getColorForType = function(type){
	let color = 'grey';
	switch(type){
		case levelTypes.WARN:
			color = 'yellow';
			break;
		case levelTypes.ERROR:
			color = 'red';
			break;
		case levelTypes.SUCCESS:
			color = 'green';
			break;
		case levelTypes.DEBUG:
		case levelTypes.INFO:
		default:
			color = 'grey';
			break;
	}
	return color;
};

SimpleConsoleModule.prototype.stringifyLogMessage = function(data){
	let logString = [];
	logString.push('{' + data.level + '}');
	logString.push('[' + data.ts.toString() + ']');
	logString.push('(' + data.cluster + ')');
	logString.push('(' + data.node + ')');
	logString.push('(' + data.ns + ')');
	logString.push('(' + data.ident + ')');
	logString = [logString.join('')];
	logString.push(data.message);
	logString = [logString.join(' - ')];
	logString.push(_.isObject(data.data) ? JSON.stringify(data.data) : data.data);
	logString = logString.join(' :: ');

	if('COLOR: ', this.options.colors){
		logString = logString[this.getColorForType(data.type)];
	}

	return logString;
};

SimpleConsoleModule.prototype.jsonifyLogMessage = function(data){
	data = data || {};

	let output = {};

	output = _.reduce(data, function(out, val, key){
		if(!_.isString(val) || (_.isString(val) && val.length)){
			out[key] = val;
		}
		return out;
	}, output);
	return JSON.stringify(output);
};

SimpleConsoleModule.prototype.log = function(initOptions, data){
	if(levelOrdering[data.level] >= levelOrdering[initOptions.level]){

		if(this.options.outputFormat == 'json'){
			console.log(this.jsonifyLogMessage(data));
			return;
		}

		let message = this.stringifyLogMessage(data);
		switch(data.level){
			case 'WARN':
				console.warn(message);
				break;
			case 'ERROR':
				console.error(message);
				break;
			default:
				console.log(message);
		}

	}
};

function Logwrangler(initOptions){
	let self = this;
	initOptions = initOptions || {};
	initOptions.level = initOptions.level || logLevels.DEBUG;

	initOptions.logOptions = _.defaults(initOptions.logOptions || {}, {
		level: logLevels.DEBUG,
		node: '',
		cluster: '',
		ns: '',
		ident: '',
		message: '',
		data: {}
	});

	let outputs = initOptions.outputs || [];

	let useModule = function(module){
		outputs.push(module);
	};

	useModule(new SimpleConsoleModule(initOptions));

	_.extend(self, {
		levels: logLevels,
		types: levelTypes,
		log: function(data){
			data = data || {};

			data = _.defaults(data, initOptions.logOptions);

			if(!data.type){
				data.type = data.level;
			}

			data.data = parseDataObject(data.data);
			data.ts = new Date();

			_.each(outputs, function(out){
				out.log(initOptions, data);
			});

		},
		info: function(data){
			data.level = logLevels.INFO,
			this.log(data);
		},
		error: function(data){
			data.level = logLevels.ERROR;

			this.log(data);
		},
		warn: function(data){
			data.level = logLevels.WARN;

			this.log(data);
		},
		success: function(data){
			data.level = logLevels.INFO;
			data.type = levelTypes.SUCCESS;

			this.log(data);
		},
		use: useModule,
		clone: function(){
			return _.cloneDeep(self);
		},
		setLogOption: function(name, value){
			initOptions.logOptions[key] = value;
		},
		setLogOptions: function(values){
			_.each(options, function(val, key){
				initOptions.logOptions[key] = val;
			});
		}
	});
	return self;
};

let inst;
exports.levels = logLevels;
exports.types = levelTypes;
exports.LogwranglerModule = LogwranglerModule;
exports.SimpleConsoleModule = SimpleConsoleModule;

exports.create = function(initOptions, forceNew){
	if(_.isBoolean(initOptions)){
		forceNew = initOptions;
		initOptions = {};
	}
	if(inst && !forceNew){
		return inst;
	}

	let localInst = new Logwrangler(initOptions);

	if(forceNew){
		return localInst;
	}
	inst = localInst;
	return inst;
};


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

-->

<Keyboard xmlns:latin="http://schemas.android.com/apk/res-auto">
    <include
        latin:keyboardLayout="@xml/key_styles_common" />

    <switch>
        <case latin:showNumberRow="true">
            <include latin:keyboardLayout="@xml/rowkeys_qwerty0" />

            <include
                latin:keyboardLayout="@xml/rows_spanish"
                latin:rowHeight="21.25%p"/>
        </case>
        <default>
            <include latin:keyboardLayout="@xml/rows_spanish" />
        </default>
    </switch>
</Keyboard>


text:
layout: corporate/page
title: Contact
brand: corporate
permalink: /corporate/contact/
---
{% include common/contact.md %}


text:
    <a href="<?=base_url()?>index.php/ead/nosotros/directorio_ead">
        <button class="btn_secciones btn_nosotros">

Directorio EAD

    </button>

    <a href="<?=base_url()?>index.php/ead/nosotros/antecedentes">
        <button class="btn_secciones btn_nosotros">

Antecedentes

    </button>

    <a href="<?=base_url()?>index.php/ead/nosotros/mision_vision_valores">
        <button class="btn_secciones btn_nosotros">

Misión, Visión, Valores

    </button>

    <a href="<?=base_url()?>index.php/ead/nosotros/modelo_educativo">
        <button class="btn_secciones btn_nosotros">

Modelo Educativo

    </button>

    <a href="<?=base_url()?>index.php/ead/nosotros/organigrama">
        <button class="btn_secciones btn_nosotros">

Organigrama

    </button>

    <a href="<?=base_url()?>index.php/ead/nosotros/centro_de_datos">
        <button class="btn_secciones btn_nosotros">

Centro de Datos

    </button>

<?php
if (!$ruta == ""){
    include_once 'nosotros/'.$ruta.'.php';
}else{
    include_once 'nosotros/directorio_ead.php';
}
 ?>


text:
/*
* Filters
* (C) 1999-2007 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/

#ifndef BOTAN_FILTERS_H__
#define BOTAN_FILTERS_H__

#include <botan/block_cipher.h>
#include <botan/stream_cipher.h>
#include <botan/hash.h>
#include <botan/mac.h>

#include <botan/pipe.h>
#include <botan/basefilt.h>
#include <botan/key_filt.h>
#include <botan/data_snk.h>

#include <botan/scan_name.h>

#if defined(BOTAN_HAS_CODEC_FILTERS)
  #include <botan/b64_filt.h>
  #include <botan/hex_filt.h>
#endif

namespace Botan {

/**
* Stream Cipher Filter.
*/
class BOTAN_DLL StreamCipher_Filter : public Keyed_Filter
   {
   public:

      std::string name() const { return cipher->name(); }

      /**
      * Write input data
      * @param input data
      * @param input_len length of input in bytes
      */
      void write(const byte input[], size_t input_len);

      bool valid_iv_length(size_t iv_len) const
         { return cipher->valid_iv_length(iv_len); }

      /**
      * Set the initialization vector for this filter.
      * @param iv the initialization vector to set
      */
      void set_iv(const InitializationVector& iv);

      /**
      * Set the key of this filter.
      * @param key the key to set
      */
      void set_key(const SymmetricKey& key) { cipher->set_key(key); }

      /**
      * Check whether a key length is valid for this filter.
      * @param length the key length to be checked for validity
      * @return true if the key length is valid, false otherwise
      */
      bool valid_keylength(size_t length) const
         { return cipher->valid_keylength(length); }

      /**
      * Construct a stream cipher filter.
      * @param cipher_obj a cipher object to use
      */
      StreamCipher_Filter(StreamCipher* cipher_obj);

      /**
      * Construct a stream cipher filter.
      * @param cipher_obj a cipher object to use
      * @param key the key to use inside this filter
      */
      StreamCipher_Filter(StreamCipher* cipher_obj, const SymmetricKey& key);

      /**
      * Construct a stream cipher filter.
      * @param cipher the name of the desired cipher
      */
      StreamCipher_Filter(const std::string& cipher);

      /**
      * Construct a stream cipher filter.
      * @param cipher the name of the desired cipher
      * @param key the key to use inside this filter
      */
      StreamCipher_Filter(const std::string& cipher, const SymmetricKey& key);

      ~StreamCipher_Filter() { delete cipher; }
   private:
      SecureVector<byte> buffer;
      StreamCipher* cipher;
   };

/**
* Hash Filter.
*/
class BOTAN_DLL Hash_Filter : public Filter
   {
   public:
      void write(const byte input[], size_t len) { hash->update(input, len); }
      void end_msg();

      std::string name() const { return hash->name(); }

      /**
      * Construct a hash filter.
      * @param hash_fun the hash function to use
      * @param len the output length of this filter. Leave the default
      * value 0 if you want to use the full output of the hashfunction
      * hash. Otherwise, specify a smaller value here so that the
      * output of the hash algorithm will be cut off.
      */
      Hash_Filter(HashFunction* hash_fun, size_t len = 0) :
         OUTPUT_LENGTH(len), hash(hash_fun) {}

      /**
      * Construct a hash filter.
      * @param request the name of the hash algorithm to use
      * @param len the output length of this filter. Leave the default
      * value 0 if you want to use the full output of the hashfunction
      * hash. Otherwise, specify a smaller value here so that the
      * output of the hash algorithm will be cut off.
      */
      Hash_Filter(const std::string& request, size_t len = 0);

      ~Hash_Filter() { delete hash; }
   private:
      const size_t OUTPUT_LENGTH;
      HashFunction* hash;
   };

/**
* MessageAuthenticationCode Filter.
*/
class BOTAN_DLL MAC_Filter : public Keyed_Filter
   {
   public:
      void write(const byte input[], size_t len) { mac->update(input, len); }
      void end_msg();

      std::string name() const { return mac->name(); }

      /**
      * Set the key of this filter.
      * @param key the key to set
      */
      void set_key(const SymmetricKey& key) { mac->set_key(key); }

      /**
      * Check whether a key length is valid for this filter.
      * @param length the key length to be checked for validity
      * @return true if the key length is valid, false otherwise
      */
      bool valid_keylength(size_t length) const
         { return mac->valid_keylength(length); }

      /**
      * Construct a MAC filter. The MAC key will be left empty.
      * @param mac_obj the MAC to use
      * @param out_len the output length of this filter. Leave the default
      * value 0 if you want to use the full output of the
      * MAC. Otherwise, specify a smaller value here so that the
      * output of the MAC will be cut off.
      */
      MAC_Filter(MessageAuthenticationCode* mac_obj,
                 size_t out_len = 0) : OUTPUT_LENGTH(out_len)
         {
         mac = mac_obj;
         }

      /**
      * Construct a MAC filter.
      * @param mac_obj the MAC to use
      * @param key the MAC key to use
      * @param out_len the output length of this filter. Leave the default
      * value 0 if you want to use the full output of the
      * MAC. Otherwise, specify a smaller value here so that the
      * output of the MAC will be cut off.
      */
      MAC_Filter(MessageAuthenticationCode* mac_obj,
                 const SymmetricKey& key,
                 size_t out_len = 0) : OUTPUT_LENGTH(out_len)
         {
         mac = mac_obj;
         mac->set_key(key);
         }

      /**
      * Construct a MAC filter. The MAC key will be left empty.
      * @param mac the name of the MAC to use
      * @param len the output length of this filter. Leave the default
      * value 0 if you want to use the full output of the
      * MAC. Otherwise, specify a smaller value here so that the
      * output of the MAC will be cut off.
      */
      MAC_Filter(const std::string& mac, size_t len = 0);

      /**
      * Construct a MAC filter.
      * @param mac the name of the MAC to use
      * @param key the MAC key to use
      * @param len the output length of this filter. Leave the default
      * value 0 if you want to use the full output of the
      * MAC. Otherwise, specify a smaller value here so that the
      * output of the MAC will be cut off.
      */
      MAC_Filter(const std::string& mac, const SymmetricKey& key,
                 size_t len = 0);

      ~MAC_Filter() { delete mac; }
   private:
      const size_t OUTPUT_LENGTH;
      MessageAuthenticationCode* mac;
   };

}

#endif


text:
package de.aima13.whoami.modules.syntaxcheck.languages.settings;

import de.aima13.whoami.modules.syntaxcheck.languages.LanguageSetting;
import de.aima13.whoami.modules.syntaxcheck.languages.antlrgen.CLexer;
import de.aima13.whoami.modules.syntaxcheck.languages.antlrgen.CParser;

/**
 * Einstellungen für die Sprache C
 *
 * @author Marco Dörfler
 */
public class CSetting extends LanguageSetting {
	/**
	 * Einstellungen der Sprache werden gesetzt
	 */
	public CSetting() {
		super(
				"C",
				"c",
				CParser.class,
				CLexer.class,
				"compilationUnit"
		);
	}
}


text:
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**docs** | [**Array<models.Template>**](models.Template.md) |  | [optional] [default to null]
**total** | **number** |  | [optional] [default to null]
**limit** | **number** |  | [optional] [default to null]
**page** | **number** |  | [optional] [default to null]
**pages** | **number** |  | [optional] [default to null]


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>ArcLineData</title>
<meta name="date" content="2015-03-12">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.xclcharts.chart

Class ArcLineData

java.lang.Object

org.xclcharts.chart.ArcLineData

public class ArcLineData
extends java.lang.Object

Author:

XiongChuanLiang
(xcl_168@aliyun.com)

ClassName:

ArcLineData

Description:

弧线比较图数据类

Constructor Summary

Constructors

Constructor and Description

ArcLineData()

ArcLineData(java.lang.String label,
           double percent,
           int color)

ArcLineData(java.lang.String key,
           java.lang.String label,
           double percent,
           int color)

Method Summary

Methods

Modifier and Type
Method and Description

int
getBarColor()

返回扇区颜色

java.lang.String
getKey()

返回Key值

java.lang.String
getLabel()

返回标签

double
getPercentage()

返回当前百分比

float
getSliceAngle()

将百分比转换为图显示角度

void
setBarColor(int color)

设置扇区颜色

void
setKey(java.lang.String key)

设置Key值

void
setLabel(java.lang.String label)

设置标签

void
setPercentage(double value)

设置百分比,绘制时,会将其转换为对应的圆心角

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

ArcLineData

public ArcLineData()

ArcLineData

public ArcLineData(java.lang.String label,
           double percent,
           int color)

Parameters:

label - 标签

percent - 百分比

color - 显示颜色

ArcLineData

public ArcLineData(java.lang.String key,
           java.lang.String label,
           double percent,
           int color)

Parameters:

key - 键值

label - 标签

percent - 百分比

color - 显示颜色

Method Detail

setKey

public void setKey(java.lang.String key)

设置Key值

Parameters:

key - Key值

getKey

public java.lang.String getKey()

返回Key值

Returns:

Key值

setLabel

public void setLabel(java.lang.String label)

设置标签

Parameters:

label - 标签

setPercentage

public void setPercentage(double value)

设置百分比,绘制时,会将其转换为对应的圆心角

Parameters:

value - 百分比

setBarColor

public void setBarColor(int color)

设置扇区颜色

Parameters:

color - 颜色

getLabel

public java.lang.String getLabel()

返回标签

Returns:

标签

getPercentage

public double getPercentage()

返回当前百分比

Returns:

百分比

getBarColor

public int getBarColor()

返回扇区颜色

Returns:

颜色

getSliceAngle

public float getSliceAngle()

将百分比转换为图显示角度

Returns:

圆心角度

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
const path = require('path');
const test = require('tape');
const glob = require('glob');
const load = require('load-json-file');
const write = require('write-json-file');
const { featureEach } = require('@turf/meta');
const { featureCollection, lineString } = require('@turf/helpers');
const centroid = require('.').default;

const directories = {
    in: path.join(__dirname, 'test', 'in') + path.sep,
    out: path.join(__dirname, 'test', 'out') + path.sep,
};

const fixtures = glob.sync(directories.in + '*.geojson').map(input => {
    const name = path.parse(input).name;
    const base = path.parse(input).base;
    return {
        name,
        filename: base,
        geojson: load.sync(input),
        out: directories.out + base,
    };
});

test('centroid', t => {
    fixtures.forEach(fixture => {
        const name = fixture.name;
        const geojson = fixture.geojson;
        const out = fixture.out;
        const centered = centroid(geojson, {properties: {'marker-symbol': 'circle'}});
        const result = featureCollection([centered]);
        featureEach(geojson, feature => result.features.push(feature));

        if (process.env.REGEN) write.sync(out, result);
        t.deepEqual(result, load.sync(out), name);
    });
    t.end();
});

test('centroid -- properties', t => {
    const line = lineString([[0, 0], [1, 1]]);
    const pt = centroid(line, {properties: {foo: 'bar'}});
    t.equal(pt.properties.foo, 'bar', 'translate properties');
    t.end();
});


text:
import { Stack } from './Stack'
import { lock, unlock, isLocked } from './lock'
import { zIndexManager } from '../zIndexManager'
import { maskZIndexTracker } from './linkDomAndMask'

let mask: HTMLElement | null = null
const stack = /*@__PURE__*/ new Stack<string>()

const createElementIfNeeded = function () {
  mask = mask || document.body.appendChild(document.createElement('div'))
  return mask
}

export const onModalEnter = function (modalDOM: HTMLElement) {
  const mask = createElementIfNeeded()

  if (stack.isEmpty) {
    mask.className = 'c-mask c-mask-active'

    if (isLocked() === false) {
      lock()
    }
  }

  const zIndex = zIndexManager.next()
  stack.push(zIndex)

  mask.style.zIndex = zIndex
  modalDOM.style.zIndex = zIndexManager.next()
  maskZIndexTracker.linkMaskZIndexToModalDOM(modalDOM, zIndex)
}

export const onModalLeave = function (modalDOM: Element) {
  // Between enter and leave, there might be a time gap,
  // during which new modal(s) could enter
  // e.g.
  // - modal#1 enter
  // - modal#2 enter
  // - modal#1 leave
  // When modal#1 leave, if we simply pop out the last item of `stack`,
  // then what we pop is the z-index of mask linked to modal#2, not modal#1.
  // And the `stack.peek` would be the z-index of mask linked to modal#1.
  // This could be problematic the modal#2 is not the only thing become visible
  // during the time gap that is using `zIndexManager`. (Which is a rare case)
  // e.g.
  // - modal#1 enter
  // - item#1 enter
  // - modal#2 enter
  // - modal#1 leave
  // Item#1 would be on top of the mask, which is not idea nor correct.
  // The following codes try to handle such case.
  const zIndex = maskZIndexTracker.retrieveMaskZIndexFromModalDOM(modalDOM)
  if (typeof zIndex === 'string') {
    stack.remove(zIndex)
  } else {
    stack.pop()
  }

  if (mask) {
    // remove mask
    if (stack.isEmpty) {
      mask.className = 'c-mask c-mask-deactive'
    } else {
      // move mask down
      // @ts-ignore
      mask.style.zIndex = stack.peek
    }
  }
}

export const onModalLeaveDone = function () {
  // remove mask if no modal is present
  if (mask && stack.isEmpty) {
    document.body.removeChild(mask)
    mask = null

    if (isLocked() === true) {
      unlock()
    }
  }
}