text:
package com.amazonaws.auth.profile;

import com.amazonaws.SdkClientException;
import com.amazonaws.auth.AWSCredentials;
import com.amazonaws.auth.AWSCredentialsProvider;
import com.amazonaws.auth.profile.internal.AllProfiles;
import com.amazonaws.auth.profile.internal.AwsProfileNameLoader;
import com.amazonaws.auth.profile.internal.BasicProfile;
import com.amazonaws.auth.profile.internal.BasicProfileConfigLoader;
import com.amazonaws.auth.profile.internal.Profile;
import com.amazonaws.auth.profile.internal.ProfileAssumeRoleCredentialsProvider;
import com.amazonaws.auth.profile.internal.ProfileStaticCredentialsProvider;
import com.amazonaws.auth.profile.internal.securitytoken.ProfileCredentialsService;
import com.amazonaws.auth.profile.internal.securitytoken.STSProfileCredentialsServiceLoader;
import com.amazonaws.internal.StaticCredentialsProvider;
import com.amazonaws.profile.path.AwsProfileFileLocationProvider;
import com.amazonaws.util.ValidationUtils;

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

/**
 * Loads the local AWS credential profiles from the standard location (~/.aws/credentials), which
 * can be easily overridden through the AWS_CREDENTIAL_PROFILES_FILE environment
 * variable or by specifying an alternate credentials file location through this class' constructor.
 *
 The AWS credentials file format allows you to specify multiple profiles, each with their own
 * set of AWS security credentials:
 *

 * [default]
 * aws_access_key_id=testAccessKey
 * aws_secret_access_key=testSecretKey
 * aws_session_token=testSessionToken
 *
 * [test-user]
 * aws_access_key_id=testAccessKey
 * aws_secret_access_key=testSecretKey
 * aws_session_token=testSessionToken
 *

 *
 *
 These credential profiles allow you to share multiple sets of AWS security credentails
 * between different tools such as the AWS SDK for Java and the AWS CLI.
 *
 *
 For more information on setting up AWS credential profiles, see:
 * http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
 *
 * @see ProfileCredentialsProvider
 */
public class ProfilesConfigFile {

    /**
     * Environment variable name for overriding the default AWS profile
     */
    @Deprecated
    public static final String AWS_PROFILE_ENVIRONMENT_VARIABLE = AwsProfileNameLoader.AWS_PROFILE_ENVIRONMENT_VARIABLE;

    /**
     * System property name for overriding the default AWS profile
     */
    @Deprecated
    public static final String AWS_PROFILE_SYSTEM_PROPERTY = AwsProfileNameLoader.AWS_PROFILE_SYSTEM_PROPERTY;

    /**
     * Name of the default profile as specified in the configuration file.
     */
    @Deprecated
    public static final String DEFAULT_PROFILE_NAME = AwsProfileNameLoader.DEFAULT_PROFILE_NAME;

    private final File profileFile;
    private final ProfileCredentialsService profileCredentialsService;
    /**
     * Cache credential providers as credentials from profiles are requested. Doesn't really make a
     * difference for basic credentials but for assume role it's more efficient as each assume role
     * provider has it's own async refresh logic.
     */
    private final ConcurrentHashMap<String, AWSCredentialsProvider> credentialProviderCache = new ConcurrentHashMap<String, AWSCredentialsProvider>();
    private volatile AllProfiles allProfiles;
    private volatile long profileFileLastModified;

    /**
     * Loads the AWS credential profiles file from the default location (~/.aws/credentials) or from
     * an alternate location if AWS_CREDENTIAL_PROFILES_FILE is set.
     */
    public ProfilesConfigFile() throws SdkClientException {
        this(getCredentialProfilesFile());
    }

    /**
     * Loads the AWS credential profiles from the file. The path of the file is specified as a
     * parameter to the constructor.
     */
    public ProfilesConfigFile(String filePath) {
        this(new File(validateFilePath(filePath)));
    }

    /**
     * Loads the AWS credential profiles from the file. The path of the file is specified as a
     * parameter to the constructor.
     */
    public ProfilesConfigFile(String filePath, ProfileCredentialsService credentialsService) throws
            SdkClientException {
        this(new File(validateFilePath(filePath)), credentialsService);
    }

    private static String validateFilePath(String filePath) {
        if (filePath == null) {
            throw new IllegalArgumentException(
                    "Unable to load AWS profiles: specified file path is null.");
        }
        return filePath;
    }

    /**
     * Loads the AWS credential profiles from the file. The reference to the file is specified as a
     * parameter to the constructor.
     */
    public ProfilesConfigFile(File file) throws SdkClientException {
        this(file, STSProfileCredentialsServiceLoader.getInstance());
    }

    /**
     * Loads the AWS credential profiles from the file. The reference to the file is specified as a
     * parameter to the constructor.
     */
    public ProfilesConfigFile(File file, ProfileCredentialsService credentialsService) throws
            SdkClientException {
        profileFile = ValidationUtils.assertNotNull(file, "profile file");
        profileCredentialsService = credentialsService;
        profileFileLastModified = file.lastModified();
        allProfiles = loadProfiles(profileFile);
    }

    /**
     * Returns the AWS credentials for the specified profile.
     */
    public AWSCredentials getCredentials(String profileName) {
        final AWSCredentialsProvider provider = credentialProviderCache.get(profileName);
        if (provider != null) {
            return provider.getCredentials();
        } else {
            BasicProfile profile = allProfiles.getProfile(profileName);
            if (profile == null) {
                throw new IllegalArgumentException("No AWS profile named '" + profileName + "'");
            }
            final AWSCredentialsProvider newProvider = fromProfile(profile);
            credentialProviderCache.put(profileName, newProvider);
            return newProvider.getCredentials();
        }
    }

    /**
     * Reread data from disk.
     */
    public void refresh() {
        if (profileFile.lastModified() > profileFileLastModified) {
            profileFileLastModified = profileFile.lastModified();
            allProfiles = loadProfiles(profileFile);
        }
        credentialProviderCache.clear();
    }

    public Map<String, BasicProfile> getAllBasicProfiles() {
        return allProfiles.getProfiles();
    }

    @Deprecated
    public Map<String, Profile> getAllProfiles() {
        Map<String, Profile> legacyProfiles = new HashMap<String, Profile>();
        for (Map.Entry<String, BasicProfile> entry : getAllBasicProfiles().entrySet()) {
            final String profileName = entry.getKey();
            legacyProfiles.put(profileName,
                               new Profile(profileName, entry.getValue().getProperties(),
                                           new StaticCredentialsProvider(
                                                   getCredentials(profileName))));
        }
        return legacyProfiles;
    }

    private static File getCredentialProfilesFile() {
        return AwsProfileFileLocationProvider.DEFAULT_CREDENTIALS_LOCATION_PROVIDER.getLocation();
    }

    private static AllProfiles loadProfiles(File file) {
        return BasicProfileConfigLoader.INSTANCE.loadProfiles(file);
    }

    private AWSCredentialsProvider fromProfile(BasicProfile profile) {
        if (profile.isRoleBasedProfile()) {
            return new ProfileAssumeRoleCredentialsProvider(profileCredentialsService, allProfiles,
                                                            profile);
        } else {
            return new ProfileStaticCredentialsProvider(profile);
        }
    }

}


text:
<?php

/** Zend_Controller_Action_Helper_AutoComplete_Abstract */
require_once 'Zend/Controller/Action/Helper/AutoComplete/Abstract.php';

/**
 * Create and send Dojo-compatible autocompletion lists
 *
 * @uses       Zend_Controller_Action_Helper_AutoComplete_Abstract
 * @category   Zend
 * @package    Zend_Controller
 * @subpackage Action_Helper
 * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Controller_Action_Helper_AutoCompleteDojo extends Zend_Controller_Action_Helper_AutoComplete_Abstract
{
    /**
     * Validate data for autocompletion
     *
     * @param  mixed $data
     * @return bool
     */
    public function validateData($data)
    {
        if (is_array($data) && isset($data['items']) && is_array($data['items'])) {
            return true;
        }

        return false;
    }

    /**
     * Prepare data for autocompletion
     *
     * @param  mixed $data
     * @param  bool $keepLayouts
     * @return string
     */
    public function prepareAutoCompletion($data, $keepLayouts = false)
    {
        $items = array();
        foreach ($data as $key => $value) {
            $items[] = array('label' => $value, 'name' => $value);
        }
        $final = array(
            'identifier' => 'name',
            'items'      => $items,
        );
        return $this->encodeJson($final, $keepLayouts);
    }
}

redpajama_set_name: RedPajamaGithub


text:
#pragma once

#include "il2cpp-config.h"

#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif

#include <stdint.h>

#include "mscorlib_System_Globalization_Calendar3558528576.h"
#include "mscorlib_System_Globalization_GregorianCalendarTyp1953288343.h"

#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif

// System.Globalization.GregorianCalendar
struct  GregorianCalendar_t613932910  : public Calendar_t3558528576
{
public:
	// System.Globalization.GregorianCalendarTypes System.Globalization.GregorianCalendar::m_type
	int32_t ___m_type_4;

public:
	inline static int32_t get_offset_of_m_type_4() { return static_cast<int32_t>(offsetof(GregorianCalendar_t613932910, ___m_type_4)); }
	inline int32_t get_m_type_4() const { return ___m_type_4; }
	inline int32_t* get_address_of_m_type_4() { return &___m_type_4; }
	inline void set_m_type_4(int32_t value)
	{
		___m_type_4 = value;
	}
};

#ifdef __clang__
#pragma clang diagnostic pop
#endif


text:
package com.mapr.ojai.examples;

import org.ojai.store.Connection;
import org.ojai.store.DocumentMutation;
import org.ojai.store.DocumentStore;
import org.ojai.store.DriverManager;

public class OJAI_012_UpdateDocument {

  public static void main(String[] args) {

    System.out.println("==== Start Application ===");

    // Create an OJAI connection to MapR cluster
    final Connection connection = DriverManager.getConnection("ojai:mapr:");

    // Get an instance of OJAI DocumentStore
    final DocumentStore store = connection.getStore("/demo_table");

    String docId = "user0002";

    // Print the document before update
    System.out.println( "\t"+ store.findById(docId).getMap("address").toString() );

    // Create a DocumentMutation to update the zipCode field
    DocumentMutation mutation = connection.newMutation()
        .set("address.zipCode", 95196L);

    System.out.println("\tUpdating document "+ docId);

    // Update the Document with '_id' = "user0002"
    store.update(docId, mutation);

    // Print the document after update
    System.out.println( "\t"+ store.findById(docId).getMap("address").toString() );

    // Close this instance of OJAI DocumentStore
    store.close();

    // close the OJAI connection and release any resources held by the connection
    connection.close();

    System.out.println("==== End Application ===");
  }

}


text:
/**
 * @since 2.0.0
 */
import { Alt3, Alt3C } from './Alt'
import { Applicative3, Applicative3C, getApplicativeMonoid } from './Applicative'
import {
  ap as ap_,
  apFirst as apFirst_,
  Apply3,
  apS as apS_,
  apSecond as apSecond_,
  getApplySemigroup as getApplySemigroup_
} from './Apply'
import { Bifunctor3 } from './Bifunctor'
import { bind as bind_, Chain3, chainFirst as chainFirst_ } from './Chain'
import { compact as compact_, Compactable3C, separate as separate_ } from './Compactable'
import * as E from './Either'
import * as ET from './EitherT'
import {
  filter as filter_,
  Filterable3C,
  filterMap as filterMap_,
  partition as partition_,
  partitionMap as partitionMap_
} from './Filterable'
import {
  chainEitherK as chainEitherK_,
  chainOptionK as chainOptionK_,
  filterOrElse as filterOrElse_,
  FromEither3,
  fromEitherK as fromEitherK_,
  fromOption as fromOption_,
  fromOptionK as fromOptionK_,
  fromPredicate as fromPredicate_,
  chainFirstEitherK as chainFirstEitherK_
} from './FromEither'
import {
  ask as ask_,
  asks as asks_,
  chainFirstReaderK as chainFirstReaderK_,
  chainReaderK as chainReaderK_,
  FromReader3,
  fromReaderK as fromReaderK_
} from './FromReader'
import { flow, identity, Lazy, pipe, SK } from './function'
import { let as let__, bindTo as bindTo_, flap as flap_, Functor3 } from './Functor'
import * as _ from './internal'
import { Monad3, Monad3C } from './Monad'
import { MonadThrow3, MonadThrow3C } from './MonadThrow'
import { Monoid } from './Monoid'
import { Option } from './Option'
import { Pointed3 } from './Pointed'
import { Predicate } from './Predicate'
import * as R from './Reader'
import { ReadonlyNonEmptyArray } from './ReadonlyNonEmptyArray'
import { Refinement } from './Refinement'
import { Semigroup } from './Semigroup'

import Reader = R.Reader
import Either = E.Either

// -------------------------------------------------------------------------------------
// model
// -------------------------------------------------------------------------------------

/**
 * @category model
 * @since 2.0.0
 */
export interface ReaderEither<R, E, A> extends Reader<R, Either<E, A>> {}

// -------------------------------------------------------------------------------------
// constructors
// -------------------------------------------------------------------------------------

/**
 * @category constructors
 * @since 2.0.0
 */
export const left: <R, E = never, A = never>(e: E) => ReaderEither<R, E, A> = /*#__PURE__*/ ET.left(R.Pointed)

/**
 * @category constructors
 * @since 2.0.0
 */
export const right: <R, E = never, A = never>(a: A) => ReaderEither<R, E, A> = /*#__PURE__*/ ET.right(R.Pointed)

/**
 * @category constructors
 * @since 2.0.0
 */
export const rightReader: <R, E = never, A = never>(ma: Reader<R, A>) => ReaderEither<R, E, A> =
  /*#__PURE__*/ ET.rightF(R.Functor)

/**
 * @category constructors
 * @since 2.0.0
 */
export const leftReader: <R, E = never, A = never>(me: Reader<R, E>) => ReaderEither<R, E, A> = /*#__PURE__*/ ET.leftF(
  R.Functor
)

// -------------------------------------------------------------------------------------
// conversions
// -------------------------------------------------------------------------------------

/**
 * @category conversions
 * @since 2.0.0
 */
export const fromEither: <E, A, R = unknown>(fa: Either<E, A>) => ReaderEither<R, E, A> = R.of

/**
 * @category conversions
 * @since 2.11.0
 */
export const fromReader: <R, A, E = never>(fa: Reader<R, A>) => ReaderEither<R, E, A> = rightReader

/**
 * @category pattern matching
 * @since 2.10.0
 */
export const match: <E, B, A>(
  onLeft: (e: E) => B,
  onRight: (a: A) => B
) => <R>(ma: ReaderEither<R, E, A>) => Reader<R, B> = /*#__PURE__*/ ET.match(R.Functor)

/**
 * Less strict version of [`match`](#match).
 *
 * The `W` suffix (short for **W**idening) means that the handler return types will be merged.
 *
 * @category pattern matching
 * @since 2.10.0
 */
export const matchW: <E, B, A, C>(
  onLeft: (e: E) => B,
  onRight: (a: A) => C
) => <R>(ma: Reader<R, Either<E, A>>) => Reader<R, B | C> = match as any

/**
 * The `E` suffix (short for **E**ffect) means that the handlers return an effect (`Reader`).
 *
 * @category pattern matching
 * @since 2.10.0
 */
export const matchE: <R, E, A, B>(
  onLeft: (e: E) => Reader<R, B>,
  onRight: (a: A) => Reader<R, B>
) => (ma: ReaderEither<R, E, A>) => Reader<R, B> = /*#__PURE__*/ ET.matchE(R.Monad)

/**
 * Alias of [`matchE`](#matche).
 *
 * @category pattern matching
 * @since 2.0.0
 */
export const fold = matchE

/**
 * Less strict version of [`matchE`](#matche).
 *
 * The `W` suffix (short for **W**idening) means that the handler return types will be merged.
 *
 * @category pattern matching
 * @since 2.10.0
 */
export const matchEW: <E, R2, B, A, R3, C>(
  onLeft: (e: E) => Reader<R2, B>,
  onRight: (a: A) => Reader<R3, C>
) => <R1>(ma: ReaderEither<R1, E, A>) => Reader<R1 & R2 & R3, B | C> = matchE as any

/**
 * Alias of [`matchEW`](#matchew).
 *
 * @category pattern matching
 * @since 2.10.0
 */
export const foldW = matchEW

/**
 * @category error handling
 * @since 2.0.0
 */
export const getOrElse: <E, R, A>(onLeft: (e: E) => Reader<R, A>) => (ma: ReaderEither<R, E, A>) => Reader<R, A> =
  /*#__PURE__*/ ET.getOrElse(R.Monad)

/**
 * Less strict version of [`getOrElse`](#getorelse).
 *
 * The `W` suffix (short for **W**idening) means that the handler return type will be merged.
 *
 * @category error handling
 * @since 2.6.0
 */
export const getOrElseW: <R2, E, B>(
  onLeft: (e: E) => Reader<R2, B>
) => <R1, A>(ma: ReaderEither<R1, E, A>) => Reader<R1 & R2, A | B> = getOrElse as any

/**
 * @category conversions
 * @since 2.10.0
 */
export const toUnion: <R, E, A>(fa: ReaderEither<R, E, A>) => Reader<R, E | A> = /*#__PURE__*/ ET.toUnion(R.Functor)

// -------------------------------------------------------------------------------------
// combinators
// -------------------------------------------------------------------------------------

/**
 * Changes the value of the local context during the execution of the action `ma` (similar to `Contravariant`'s
 * `contramap`).
 *
 * @since 2.0.0
 */
export const local: <R2, R1>(f: (r2: R2) => R1) => <E, A>(ma: ReaderEither<R1, E, A>) => ReaderEither<R2, E, A> =
  R.local

/**
 * Less strict version of [`asksReaderEither`](#asksreadereither).
 *
 * The `W` suffix (short for **W**idening) means that the environment types will be merged.
 *
 * @category constructors
 * @since 2.11.0
 */
export const asksReaderEitherW: <R1, R2, E, A>(f: (r1: R1) => ReaderEither<R2, E, A>) => ReaderEither<R1 & R2, E, A> =
  R.asksReaderW

/**
 * Effectfully accesses the environment.
 *
 * @category constructors
 * @since 2.11.0
 */
export const asksReaderEither: <R, E, A>(f: (r: R) => ReaderEither<R, E, A>) => ReaderEither<R, E, A> =
  asksReaderEitherW

/**
 * @category error handling
 * @since 2.0.0
 */
export const orElse: <E1, R, E2, A>(
  onLeft: (e: E1) => ReaderEither<R, E2, A>
) => (ma: ReaderEither<R, E1, A>) => ReaderEither<R, E2, A> = /*#__PURE__*/ ET.orElse(R.Monad)

/**
 * Less strict version of [`orElse`](#orelse).
 *
 * The `W` suffix (short for **W**idening) means that the environment types and the return types will be merged.
 *
 * @category error handling
 * @since 2.10.0
 */
export const orElseW: <E1, R1, E2, B>(
  onLeft: (e: E1) => ReaderEither<R1, E2, B>
) => <R2, A>(ma: ReaderEither<R2, E1, A>) => ReaderEither<R1 & R2, E2, A | B> = orElse as any

/**
 * @category error handling
 * @since 2.11.0
 */
export const orElseFirst: <E, R, B>(
  onLeft: (e: E) => ReaderEither<R, E, B>
) => <A>(ma: ReaderEither<R, E, A>) => ReaderEither<R, E, A> = /*#__PURE__*/ ET.orElseFirst(R.Monad)

/**
 * The `W` suffix (short for **W**idening) means that the environment types and the return types will be merged.
 *
 * @category error handling
 * @since 2.11.0
 */
export const orElseFirstW: <E1, R2, E2, B>(
  onLeft: (e: E1) => ReaderEither<R2, E2, B>
) => <R1, A>(ma: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E1 | E2, A> = orElseFirst as any

/**
 * @category error handling
 * @since 2.11.0
 */
export const orLeft: <E1, R, E2>(
  onLeft: (e: E1) => Reader<R, E2>
) => <A>(fa: ReaderEither<R, E1, A>) => ReaderEither<R, E2, A> = /*#__PURE__*/ ET.orLeft(R.Monad)

/**
 * @since 2.0.0
 */
export const swap: <R, E, A>(ma: ReaderEither<R, E, A>) => ReaderEither<R, A, E> = /*#__PURE__*/ ET.swap(R.Functor)

/* istanbul ignore next */
const _map: Monad3<URI>['map'] = (fa, f) => pipe(fa, map(f))
/* istanbul ignore next */
const _bimap: Bifunctor3<URI>['bimap'] = (fa, f, g) => pipe(fa, bimap(f, g))
/* istanbul ignore next */
const _mapLeft: Bifunctor3<URI>['mapLeft'] = (fa, f) => pipe(fa, mapLeft(f))
/* istanbul ignore next */
const _ap: Monad3<URI>['ap'] = (fab, fa) => pipe(fab, ap(fa))
/* istanbul ignore next */
const _chain: Monad3<URI>['chain'] = (ma, f) => pipe(ma, chain(f))
/* istanbul ignore next */
const _alt: Alt3<URI>['alt'] = (fa, that) => pipe(fa, alt(that))

/**
 * `map` can be used to turn functions `(a: A) => B` into functions `(fa: F<A>) => F<B>` whose argument and return types
 * use the type constructor `F` to represent some computational context.
 *
 * @category mapping
 * @since 2.0.0
 */
export const map: <A, B>(f: (a: A) => B) => <R, E>(fa: ReaderEither<R, E, A>) => ReaderEither<R, E, B> =
  /*#__PURE__*/ ET.map(R.Functor)

/**
 * Map a pair of functions over the two last type arguments of the bifunctor.
 *
 * @category mapping
 * @since 2.0.0
 */
export const bimap: <E, G, A, B>(
  f: (e: E) => G,
  g: (a: A) => B
) => <R>(fa: ReaderEither<R, E, A>) => ReaderEither<R, G, B> = /*#__PURE__*/ ET.bimap(R.Functor)

/**
 * Map a function over the second type argument of a bifunctor.
 *
 * @category error handling
 * @since 2.0.0
 */
export const mapLeft: <E, G>(f: (e: E) => G) => <R, A>(fa: ReaderEither<R, E, A>) => ReaderEither<R, G, A> =
  /*#__PURE__*/ ET.mapLeft(R.Functor)

/**
 * @since 2.0.0
 */
export const ap: <R, E, A>(
  fa: ReaderEither<R, E, A>
) => <B>(fab: ReaderEither<R, E, (a: A) => B>) => ReaderEither<R, E, B> = /*#__PURE__*/ ET.ap(R.Apply)

/**
 * Less strict version of [`ap`](#ap).
 *
 * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
 *
 * @since 2.8.0
 */
export const apW: <R2, E2, A>(
  fa: ReaderEither<R2, E2, A>
) => <R1, E1, B>(fab: ReaderEither<R1, E1, (a: A) => B>) => ReaderEither<R1 & R2, E1 | E2, B> = ap as any

/**
 * @category constructors
 * @since 2.8.5
 */
export const of: <R = unknown, E = never, A = never>(a: A) => ReaderEither<R, E, A> = right

/**
 * Composes computations in sequence, using the return value of one computation to determine the next computation.
 *
 * @category sequencing
 * @since 2.0.0
 */
export const chain: <R, E, A, B>(
  f: (a: A) => ReaderEither<R, E, B>
) => (ma: ReaderEither<R, E, A>) => ReaderEither<R, E, B> = /*#__PURE__*/ ET.chain(R.Monad)

/**
 * Less strict version of [`chain`](#chain).
 *
 * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
 *
 * @category sequencing
 * @since 2.6.0
 */
export const chainW: <R2, E2, A, B>(
  f: (a: A) => ReaderEither<R2, E2, B>
) => <R1, E1>(ma: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E1 | E2, B> = chain as any

/**
 * Less strict version of [`flatten`](#flatten).
 *
 * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
 *
 * @category sequencing
 * @since 2.11.0
 */
export const flattenW: <R1, R2, E1, E2, A>(
  mma: ReaderEither<R1, E1, ReaderEither<R2, E2, A>>
) => ReaderEither<R1 & R2, E1 | E2, A> = /*#__PURE__*/ chainW(identity)

/**
 * @category sequencing
 * @since 2.0.0
 */
export const flatten: <R, E, A>(mma: ReaderEither<R, E, ReaderEither<R, E, A>>) => ReaderEither<R, E, A> = flattenW

/**
 * Identifies an associative operation on a type constructor. It is similar to `Semigroup`, except that it applies to
 * types of kind `* -> *`.
 *
 * @category error handling
 * @since 2.0.0
 */
export const alt: <R, E, A>(that: () => ReaderEither<R, E, A>) => (fa: ReaderEither<R, E, A>) => ReaderEither<R, E, A> =
  /*#__PURE__*/ ET.alt(R.Monad)

/**
 * Less strict version of [`alt`](#alt).
 *
 * The `W` suffix (short for **W**idening) means that the environment, the error and the return types will be merged.
 *
 * @category error handling
 * @since 2.9.0
 */
export const altW: <R2, E2, B>(
  that: () => ReaderEither<R2, E2, B>
) => <R1, E1, A>(fa: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E2, A | B> = alt as any

/**
 * @since 2.7.0
 */
export const throwError: MonadThrow3<URI>['throwError'] = left

/**
 * @category type lambdas
 * @since 2.0.0
 */
export const URI = 'ReaderEither'

/**
 * @category type lambdas
 * @since 2.0.0
 */
export type URI = typeof URI

declare module './HKT' {
  interface URItoKind3<R, E, A> {
    readonly [URI]: ReaderEither<R, E, A>
  }
}

/**
 * @category filtering
 * @since 2.10.0
 */
export const getCompactable = <E>(M: Monoid<E>): Compactable3C<URI, E> => {
  const C = E.getCompactable(M)
  return {
    URI,
    _E: undefined as any,
    compact: compact_(R.Functor, C),
    separate: separate_(R.Functor, C, E.Functor)
  }
}

/**
 * @category filtering
 * @since 2.10.0
 */
export function getFilterable<E>(M: Monoid<E>): Filterable3C<URI, E> {
  const F = E.getFilterable(M)
  const C = getCompactable(M)

  const filter = filter_(R.Functor, F)
  const filterMap = filterMap_(R.Functor, F)
  const partition = partition_(R.Functor, F)
  const partitionMap = partitionMap_(R.Functor, F)
  return {
    URI,
    _E: undefined as any,
    map: _map,
    compact: C.compact,
    separate: C.separate,
    filter: <R, A>(fa: ReaderEither<R, E, A>, predicate: Predicate<A>) => pipe(fa, filter(predicate)),
    filterMap: (fa, f) => pipe(fa, filterMap(f)),
    partition: <R, A>(fa: ReaderEither<R, E, A>, predicate: Predicate<A>) => pipe(fa, partition(predicate)),
    partitionMap: (fa, f) => pipe(fa, partitionMap(f))
  }
}

/**
 * The default [`Applicative`](#applicative) instance returns the first error, if you want to
 * get all errors you need to provide a way to concatenate them via a `Semigroup`.
 *
 * See [`getApplicativeValidation`](./Either.ts.html#getapplicativevalidation).
 *
 * @category error handling
 * @since 2.7.0
 */
export function getApplicativeReaderValidation<E>(S: Semigroup<E>): Applicative3C<URI, E> {
  const ap = ap_(R.Apply, E.getApplicativeValidation(S))
  return {
    URI,
    _E: undefined as any,
    map: _map,
    ap: (fab, fa) => pipe(fab, ap(fa)),
    of
  }
}

/**
 * The default [`Alt`](#alt) instance returns the last error, if you want to
 * get all errors you need to provide a way to concatenate them via a `Semigroup`.
 *
 * See [`getAltValidation`](./Either.ts.html#getaltvalidation).
 *
 * @category error handling
 * @since 2.7.0
 */
export function getAltReaderValidation<E>(S: Semigroup<E>): Alt3C<URI, E> {
  const alt = ET.altValidation(R.Monad, S)
  return {
    URI,
    _E: undefined as any,
    map: _map,
    alt: (fa, that) => pipe(fa, alt(that))
  }
}

/**
 * @category instances
 * @since 2.7.0
 */
export const Functor: Functor3<URI> = {
  URI,
  map: _map
}

/**
 * @category mapping
 * @since 2.10.0
 */
export const flap = /*#__PURE__*/ flap_(Functor)

/**
 * @category instances
 * @since 2.10.0
 */
export const Pointed: Pointed3<URI> = {
  URI,
  of
}

/**
 * @category instances
 * @since 2.10.0
 */
export const Apply: Apply3<URI> = {
  URI,
  map: _map,
  ap: _ap
}

/**
 * Combine two effectful actions, keeping only the result of the first.
 *
 * @since 2.0.0
 */
export const apFirst = /*#__PURE__*/ apFirst_(Apply)

/**
 * Less strict version of [`apFirst`](#apfirst)
 *
 * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
 *
 * @since 2.12.0
 */
export const apFirstW: <R2, E2, B>(
  second: ReaderEither<R2, E2, B>
) => <R1, E1, A>(first: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E1 | E2, A> = apFirst as any

/**
 * Combine two effectful actions, keeping only the result of the second.
 *
 * @since 2.0.0
 */
export const apSecond = /*#__PURE__*/ apSecond_(Apply)

/**
 * Less strict version of [`apSecond`](#apsecond)
 *
 * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
 *
 * @since 2.12.0
 */
export const apSecondW: <R2, E2, B>(
  second: ReaderEither<R2, E2, B>
) => <R1, E1, A>(first: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E1 | E2, B> = apSecond as any

/**
 * @category instances
 * @since 2.7.0
 */
export const Applicative: Applicative3<URI> = {
  URI,
  map: _map,
  ap: _ap,
  of
}

/**
 * @category instances
 * @since 2.10.0
 */
export const Chain: Chain3<URI> = {
  URI,
  map: _map,
  ap: _ap,
  chain: _chain
}

/**
 * @category instances
 * @since 2.7.0
 */
export const Monad: Monad3<URI> = {
  URI,
  map: _map,
  ap: _ap,
  of,
  chain: _chain
}

/**
 * Composes computations in sequence, using the return value of one computation to determine the next computation and
 * keeping only the result of the first.
 *
 * @category sequencing
 * @since 2.0.0
 */
export const chainFirst: <R, E, A, B>(
  f: (a: A) => ReaderEither<R, E, B>
) => (ma: ReaderEither<R, E, A>) => ReaderEither<R, E, A> = /*#__PURE__*/ chainFirst_(Chain)

/**
 * Less strict version of [`chainFirst`](#chainfirst)
 *
 * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
 *
 * @category sequencing
 * @since 2.8.0
 */
export const chainFirstW: <R2, E2, A, B>(
  f: (a: A) => ReaderEither<R2, E2, B>
) => <R1, E1>(ma: ReaderEither<R1, E1, A>) => ReaderEither<R1 & R2, E1 | E2, A> = chainFirst as any

/**
 * @category instances
 * @since 2.7.0
 */
export const Bifunctor: Bifunctor3<URI> = {
  URI,
  bimap: _bimap,
  mapLeft: _mapLeft
}

/**
 * @category instances
 * @since 2.7.0
 */
export const Alt: Alt3<URI> = {
  URI,
  map: _map,
  alt: _alt
}

/**
 * @category instances
 * @since 2.11.0
 */
export const FromReader: FromReader3<URI> = {
  URI,
  fromReader
}

/**
 * Reads the current context.
 *
 * @category constructors
 * @since 2.0.0
 */
export const ask: <R, E = never>() => ReaderEither<R, E, R> = /*#__PURE__*/ ask_(FromReader)

/**
 * Projects a value from the global context in a `ReaderEither`.
 *
 * @category constructors
 * @since 2.0.0
 */
export const asks: <R, A, E = never>(f: (r: R) => A) => ReaderEither<R, E, A> = /*#__PURE__*/ asks_(FromReader)

/**
 * @category lifting
 * @since 2.11.0
 */
export const fromReaderK: <A extends ReadonlyArray<unknown>, R, B>(
  f: (...a: A) => Reader<R, B>
) => <E = never>(...a: A) => ReaderEither<R, E, B> = /*#__PURE__*/ fromReaderK_(FromReader)

/**
 * @category sequencing
 * @since 2.11.0
 */
export const chainReaderK: <A, R, B>(
  f: (a: A) => Reader<R, B>
) => <E>(ma: ReaderEither<R, E, A>) => ReaderEither<R, E, B> = /*#__PURE__*/ chainReaderK_(FromReader, Chain)

/**
 * Less strict version of [`chainReaderK`](#chainreaderk).
 *
 * The `W` suffix (short for **W**idening) means that the environment types will be merged.
 *
 * @category sequencing
 * @since 2.11.0
 */
export const chainReaderKW: <A, R2, B>(
  f: (a: A) => Reader<R2, B>
) => <R1, E>(ma: ReaderEither<R1, E, A>) => ReaderEither<R1 & R2, E, B> = chainReaderK as any

/**
 * @category sequencing
 * @since 2.11.0
 */
export const chainFirstReaderK: <A, R, B>(
  f: (a: A) => Reader<R, B>
) => <E>(ma: ReaderEither<R, E, A>) => ReaderEither<R, E, A> = /*#__PURE__*/ chainFirstReaderK_(FromReader, Chain)

/**
 * Less strict version of [`chainReaderK`](#chainreaderk).
 *
 * The `W` suffix (short for **W**idening) means that the environment types will be merged.
 *
 * @category sequencing
 * @since 2.11.0
 */
export const chainFirstReaderKW: <A, R1, B>(
  f: (a: A) => Reader<R1, B>
) => <R2, E>(ma: ReaderEither<R2, E, A>) => ReaderEither<R1 & R2, E, A> = chainFirstReaderK as any

/**
 * @category instances
 * @since 2.7.0
 */
export const MonadThrow: MonadThrow3<URI> = {
  URI,
  map: _map,
  ap: _ap,
  of,
  chain: _chain,
  throwError
}

/**
 * @category instances
 * @since 2.10.0
 */
export const FromEither: FromEither3<URI> = {
  URI,
  fromEither
}

/**
 * @category conversions
 * @since 2.0.0
 */
export const fromOption: <E>(onNone: Lazy<E>) => <A, R = unknown>(fa: Option<A>) => ReaderEither<R, E, A> =
  /*#__PURE__*/ fromOption_(FromEither)

/**
 * @category lifting
 * @since 2.10.0
 */
export const fromOptionK: <E>(
  onNone: Lazy<E>
) => <A extends ReadonlyArray<unknown>, B>(
  f: (...a: A) => Option<B>
) => <R = unknown>(...a: A) => ReaderEither<R, E, B> = /*#__PURE__*/ fromOptionK_(FromEither)

/**
 * @category sequencing
 * @since 2.10.0
 */
export const chainOptionK: <E>(
  onNone: Lazy<E>
) => <A, B>(f: (a: A) => Option<B>) => <R>(ma: ReaderEither<R, E, A>) => ReaderEither<R, E, B> =
  /*#__PURE__*/ chainOptionK_(FromEither, Chain)

/**
 * @category sequencing
 * @since 2.4.0
 */
export const chainEitherK: <E, A, B>(
  f: (a: A) => E.Either<E, B>
) => <R>(ma: ReaderEither<R, E, A>) => ReaderEither<R, E, B> = /*#__PURE__*/ chainEitherK_(FromEither, Chain)

/**
 * Less strict version of [`chainEitherK`](#chaineitherk).
 *
 * The `W` suffix (short for **W**idening) means that the error types will be merged.
 *
 * @category sequencing
 * @since 2.6.1
 */
export const chainEitherKW: <E2, A, B>(
  f: (a: A) => Either<E2, B>
) => <R, E1>(ma: ReaderEither<R, E1, A>) => ReaderEither<R, E1 | E2, B> = chainEitherK as any

/**
 * @category sequencing
 * @since 2.12.0
 */
export const chainFirstEitherK: <A, E, B>(
  f: (a: A) => E.Either<E, B>
) => <R>(ma: ReaderEither<R, E, A>) => ReaderEither<R, E, A> = /*#__PURE__*/ chainFirstEitherK_(FromEither, Chain)

/**
 * Less strict version of [`chainFirstEitherK`](#chainfirsteitherk).
 *
 * The `W` suffix (short for **W**idening) means that the environment types will be merged.
 *
 * @category sequencing
 * @since 2.12.0
 */
export const chainFirstEitherKW: <A, E2, B>(
  f: (a: A) => Either<E2, B>
) => <R, E1>(ma: ReaderEither<R, E1, A>) => ReaderEither<R, E1 | E2, A> = chainFirstEitherK as any

/**
 * @category lifting
 * @since 2.0.0
 */
export const fromPredicate: {
  <E, A, B extends A>(refinement: Refinement<A, B>, onFalse: (a: A) => E): <R = unknown>(a: A) => ReaderEither<R, E, B>
  <E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R = unknown, B extends A = A>(b: B) => ReaderEither<R, E, B>
  <E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R = unknown>(a: A) => ReaderEither<R, E, A>
} = /*#__PURE__*/ fromPredicate_(FromEither)

/**
 * @category filtering
 * @since 2.0.0
 */
export const filterOrElse: {
  <E, A, B extends A>(refinement: Refinement<A, B>, onFalse: (a: A) => E): <R>(
    ma: ReaderEither<R, E, A>
  ) => ReaderEither<R, E, B>
  <E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R, B extends A>(
    mb: ReaderEither<R, E, B>
  ) => ReaderEither<R, E, B>
  <E, A>(predicate: Predicate<A>, onFalse: (a: A) => E): <R>(ma: ReaderEither<R, E, A>) => ReaderEither<R, E, A>
} = /*#__PURE__*/ filterOrElse_(FromEither, Chain)

/**
 * Less strict version of [`filterOrElse`](#filterorelse).
 *
 * The `W` suffix (short for **W**idening) means that the error types will be merged.
 *
 * @category filtering
 * @since 2.9.0
 */
export const filterOrElseW: {
  <A, B extends A, E2>(refinement: Refinement<A, B>, onFalse: (a: A) => E2): <R, E1>(
    ma: ReaderEither<R, E1, A>
  ) => ReaderEither<R, E1 | E2, B>
  <A, E2>(predicate: Predicate<A>, onFalse: (a: A) => E2): <R, E1, B extends A>(
    mb: ReaderEither<R, E1, B>
  ) => ReaderEither<R, E1 | E2, B>
  <A, E2>(predicate: Predicate<A>, onFalse: (a: A) => E2): <R, E1>(
    ma: ReaderEither<R, E1, A>
  ) => ReaderEither<R, E1 | E2, A>
} = filterOrElse

/**
 * @category lifting
 * @since 2.4.0
 */
export const fromEitherK: <E, A extends ReadonlyArray<unknown>, B>(
  f: (...a: A) => E.Either<E, B>
) => <R = unknown>(...a: A) => ReaderEither<R, E, B> = /*#__PURE__*/ fromEitherK_(FromEither)

// -------------------------------------------------------------------------------------
// do notation
// -------------------------------------------------------------------------------------

/**
 * @category do notation
 * @since 2.9.0
 */
export const Do: ReaderEither<unknown, never, {}> = /*#__PURE__*/ of(_.emptyRecord)

/**
 * @category do notation
 * @since 2.8.0
 */
export const bindTo = /*#__PURE__*/ bindTo_(Functor)

const let_ = /*#__PURE__*/ let__(Functor)

export {
  /**
   * @category do notation
   * @since 2.13.0
   */
  let_ as let
}

/**
 * @category do notation
 * @since 2.8.0
 */
export const bind = /*#__PURE__*/ bind_(Chain)

/**
 * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
 *
 * @category do notation
 * @since 2.8.0
 */
export const bindW: <N extends string, A, R2, E2, B>(
  name: Exclude<N, keyof A>,
  f: (a: A) => ReaderEither<R2, E2, B>
) => <R1, E1>(
  fa: ReaderEither<R1, E1, A>
) => ReaderEither<R1 & R2, E1 | E2, { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B }> = bind as any

/**
 * @category do notation
 * @since 2.8.0
 */
export const apS = /*#__PURE__*/ apS_(Apply)

/**
 * Less strict version of [`apS`](#aps).
 *
 * The `W` suffix (short for **W**idening) means that the environment types and the error types will be merged.
 *
 * @category do notation
 * @since 2.8.0
 */
export const apSW: <A, N extends string, R2, E2, B>(
  name: Exclude<N, keyof A>,
  fb: ReaderEither<R2, E2, B>
) => <R1, E1>(
  fa: ReaderEither<R1, E1, A>
) => ReaderEither<R1 & R2, E1 | E2, { readonly [K in keyof A | N]: K extends keyof A ? A[K] : B }> = apS as any

/**
 * @since 2.11.0
 */
export const ApT: ReaderEither<unknown, never, readonly []> = /*#__PURE__*/ of(_.emptyReadonlyArray)

// -------------------------------------------------------------------------------------
// array utils
// -------------------------------------------------------------------------------------

/**
 * Equivalent to `ReadonlyNonEmptyArray#traverseWithIndex(Applicative)`.
 *
 * @category traversing
 * @since 2.11.0
 */
export const traverseReadonlyNonEmptyArrayWithIndex = <A, R, E, B>(
  f: (index: number, a: A) => ReaderEither<R, E, B>
): ((as: ReadonlyNonEmptyArray<A>) => ReaderEither<R, E, ReadonlyNonEmptyArray<B>>) =>
  flow(R.traverseReadonlyNonEmptyArrayWithIndex(f), R.map(E.traverseReadonlyNonEmptyArrayWithIndex(SK)))

/**
 * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.
 *
 * @category traversing
 * @since 2.11.0
 */
export const traverseReadonlyArrayWithIndex = <A, R, E, B>(
  f: (index: number, a: A) => ReaderEither<R, E, B>
): ((as: ReadonlyArray<A>) => ReaderEither<R, E, ReadonlyArray<B>>) => {
  const g = traverseReadonlyNonEmptyArrayWithIndex(f)
  return (as) => (_.isNonEmpty(as) ? g(as) : ApT)
}

/**
 * Equivalent to `ReadonlyArray#traverseWithIndex(Applicative)`.
 *
 * @category traversing
 * @since 2.9.0
 */
export const traverseArrayWithIndex: <R, E, A, B>(
  f: (index: number, a: A) => ReaderEither<R, E, B>
) => (as: ReadonlyArray<A>) => ReaderEither<R, E, ReadonlyArray<B>> = traverseReadonlyArrayWithIndex

/**
 * Equivalent to `ReadonlyArray#traverse(Applicative)`.
 *
 * @category traversing
 * @since 2.9.0
 */
export const traverseArray = <R, E, A, B>(
  f: (a: A) => ReaderEither<R, E, B>
): ((as: ReadonlyArray<A>) => ReaderEither<R, E, ReadonlyArray<B>>) => traverseReadonlyArrayWithIndex((_, a) => f(a))

/**
 * Equivalent to `ReadonlyArray#sequence(Applicative)`.
 *
 * @category traversing
 * @since 2.9.0
 */
export const sequenceArray: <R, E, A>(
  arr: ReadonlyArray<ReaderEither<R, E, A>>
) => ReaderEither<R, E, ReadonlyArray<A>> = /*#__PURE__*/ traverseArray(identity)

// -------------------------------------------------------------------------------------
// deprecated
// -------------------------------------------------------------------------------------

/**
 * This instance is deprecated, use small, specific instances instead.
 * For example if a function needs a `Functor` instance, pass `RE.Functor` instead of `RE.readerEither`
 * (where `R` is from `import R from 'fp-ts/ReaderEither'`)
 *
 * @category zone of death
 * @since 2.0.0
 * @deprecated
 */
export const readerEither: Monad3<URI> & Bifunctor3<URI> & Alt3<URI> & MonadThrow3<URI> = {
  URI,
  bimap: _bimap,
  mapLeft: _mapLeft,
  map: _map,
  of,
  ap: _ap,
  chain: _chain,
  alt: _alt,
  throwError: left
}

/**
 * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.
 *
 * @category zone of death
 * @since 2.0.0
 * @deprecated
 */
export const getApplySemigroup: <R, E, A>(S: Semigroup<A>) => Semigroup<ReaderEither<R, E, A>> =
  /*#__PURE__*/ getApplySemigroup_(Apply)

/**
 * Use [`getApplicativeMonoid`](./Applicative.ts.html#getapplicativemonoid) instead.
 *
 * @category zone of death
 * @since 2.0.0
 * @deprecated
 */
export const getApplyMonoid: <R, E, A>(M: Monoid<A>) => Monoid<ReaderEither<R, E, A>> =
  /*#__PURE__*/ getApplicativeMonoid(Applicative)

/**
 * Use [`getApplySemigroup`](./Apply.ts.html#getapplysemigroup) instead.
 *
 * @category zone of death
 * @since 2.0.0
 * @deprecated
 */
export const getSemigroup = <R, E, A>(S: Semigroup<A>): Semigroup<ReaderEither<R, E, A>> =>
  getApplySemigroup_(R.Apply)(E.getSemigroup(S))

/**
 * Use [`getApplicativeReaderValidation`](#getapplicativereadervalidation) and [`getAltReaderValidation`](#getaltreadervalidation) instead.
 *
 * @category zone of death
 * @since 2.3.0
 * @deprecated
 */
export function getReaderValidation<E>(
  SE: Semigroup<E>
): Monad3C<URI, E> & Bifunctor3<URI> & Alt3C<URI, E> & MonadThrow3C<URI, E> {
  const applicativeReaderValidation = getApplicativeReaderValidation(SE)
  const altReaderValidation = getAltReaderValidation(SE)
  return {
    URI,
    _E: undefined as any,
    map: _map,
    ap: applicativeReaderValidation.ap,
    of,
    chain: _chain,
    bimap: _bimap,
    mapLeft: _mapLeft,
    alt: altReaderValidation.alt,
    throwError
  }
}


text:
package org.elasticsearch.action.delete;

import org.elasticsearch.action.DocWriteResponse;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.xcontent.XContentBuilder;
import org.elasticsearch.index.shard.ShardId;
import org.elasticsearch.rest.RestStatus;

import java.io.IOException;

/**
 * The response of the delete action.
 *
 * @see org.elasticsearch.action.delete.DeleteRequest
 * @see org.elasticsearch.client.Client#delete(DeleteRequest)
 */
public class DeleteResponse extends DocWriteResponse {

    private boolean found;

    public DeleteResponse() {

    }

    public DeleteResponse(ShardId shardId, String type, String id, long version, boolean found) {
        super(shardId, type, id, version);
        this.found = found;
    }

    /**
     * Returns <tt>true</tt> if a doc was found to delete.
     */
    public boolean isFound() {
        return found;
    }

    @Override
    public void readFrom(StreamInput in) throws IOException {
        super.readFrom(in);
        found = in.readBoolean();
    }

    @Override
    public void writeTo(StreamOutput out) throws IOException {
        super.writeTo(out);
        out.writeBoolean(found);
    }

    @Override
    public RestStatus status() {
        if (found == false) {
            return RestStatus.NOT_FOUND;
        }
        return super.status();
    }

    static final class Fields {
        static final String FOUND = "found";
    }

    @Override
    public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
        builder.field(Fields.FOUND, isFound());
        super.toXContent(builder, params);
        return builder;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        builder.append("DeleteResponse[");
        builder.append("index=").append(getIndex());
        builder.append(",type=").append(getType());
        builder.append(",id=").append(getId());
        builder.append(",version=").append(getVersion());
        builder.append(",found=").append(found);
        builder.append(",shards=").append(getShardInfo());
        return builder.append("]").toString();
    }
}


text:
FROM debian:latest
MAINTAINER Casey Strouse <casey.strouse@gmail.com>

RUN apt-get update && apt-get install -yqq --no-install-recommends \
  build-essential \
  ca-certificates \
  curl \
  git \
  libbz2-dev \
  libssl-dev \
  libreadline-dev \
  libsqlite3-dev \
  pandoc \
  tcl-dev \
  xz-utils \
  zlib1g-dev \
&& rm -rf /var/lib/apt/lists/*

RUN git clone git://github.com/yyuu/pyenv.git .pyenv
ENV PYENV_ROOT $HOME/.pyenv
RUN git clone git://github.com/yyuu/pyenv-virtualenv.git $PYENV_ROOT/plugins/pyenv-virtualenv
ENV PATH $PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH

RUN pyenv install 2.7.13 && \
    pyenv install 3.5.2

RUN pyenv global 2.7.13 && \
    pyenv local 2.7.13 3.5.2 && \
    pyenv rehash

COPY . /icecake
WORKDIR /icecake

RUN pip install -r requirements.txt && \
    pip install tox && \
    pip install .

CMD ["tox"]


text:
/*	$NetBSD: npfext_normalize.c,v 1.1 2013/03/10 21:49:26 christos Exp $	*/

/*-
 * Copyright (c) 2012 The NetBSD Foundation, Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

#include <sys/cdefs.h>
__RCSID("$NetBSD: npfext_normalize.c,v 1.1 2013/03/10 21:49:26 christos Exp $");

#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include <errno.h>

#include <npf.h>

int		npfext_normalize_init(void);
nl_ext_t *	npfext_normalize_construct(const char *);
int		npfext_normalize_param(nl_ext_t *, const char *, const char *);

int
npfext_normalize_init(void)
{
	/* Nothing to initialize. */
	return 0;
}

nl_ext_t *
npfext_normalize_construct(const char *name)
{
	assert(strcmp(name, "normalize") == 0);
	return npf_ext_construct(name);
}

int
npfext_normalize_param(nl_ext_t *ext, const char *param, const char *val)
{
	enum ptype {
		PARAM_BOOL,
		PARAM_U32
	};
	static const struct param {
		const char *	name;
		enum ptype	type;
		bool		reqval;
	} params[] = {
		{ "random-id",	PARAM_BOOL,	false	},
		{ "no-df",	PARAM_BOOL,	false	},
		{ "min-ttl",	PARAM_U32,	true	},
		{ "max-mss",	PARAM_U32,	true	},
	};

	for (unsigned i = 0; i < __arraycount(params); i++) {
		const char *name = params[i].name;

		if (strcmp(name, param) != 0) {
			continue;
		}
		if (val == NULL && params[i].reqval) {
			return EINVAL;
		}

		switch (params[i].type) {
		case PARAM_BOOL:
			npf_ext_param_bool(ext, name, true);
			break;
		case PARAM_U32:
			npf_ext_param_u32(ext, name, atol(val));
			break;
		default:
			assert(false);
		}
		return 0;
	}

	/* Invalid parameter, if not found. */
	return EINVAL;
}


text:
import { moduleForComponent, test } from 'ember-qunit';
import hbs from 'htmlbars-inline-precompile';

moduleForComponent('bc-tabs', 'Integration | Component | bc tabs', {
  integration: true
});

test('it renders', function(assert) {
  // Set any properties with this.set('myProperty', 'value');
  // Handle any actions with this.on('myAction', function(val) { ... });

  this.render(hbs`{{bc-tabs router=null}}`);

  assert.equal(this.$().text().trim(), '');
});


text:
@implementation MBCircularProgressBarView

- (instancetype)initWithCoder:(NSCoder *)coder
{
    self = [super initWithCoder:coder];
    if (self) {
        [self initView:[self frame]];
    }
    return self;
}

-(instancetype)init{
    self = [super init];
    if (self) {
        [self initView:CGRectNull];
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self initView:frame];
    }
    return self;
}

-(void)initView:(CGRect)frame{
    //Without setting the content scale factor the layer would be pixelated
    [self setContentScaleFactor:[[UIScreen mainScreen] scale]];

    [self setUnitString:@"%"];
    [self setValue:0.f];
    [self setMaxValue:100.f];
    [self setProgressRotationAngle:0.f];
    [self setProgressStrokeColor:[UIColor orangeColor]];
    [self setProgressColor:[UIColor orangeColor]];
    [self setProgressCapType:kCGLineCapRound];
    [self setEmptyLineColor:[UIColor lightGrayColor]];
    [self setFontColor:[UIColor blackColor]];
    [self setEmptyLineWidth:1.f];
    [self setProgressLineWidth:14.f];
    [self setProgressAngle:80.f];
    [self setUnitFontSize:-1];
    [self setValueFontSize:-1];
}

#pragma mark - Getters and Setters for layer properties

-(void)setValue:(CGFloat)value{
    self.progressLayer.value = value;

    //CALayer autogenerated setter using @dynamic doesn't refresh the layer when the value is 0
    if(value == 0){
        [self.layer setNeedsDisplay];
    }
}

-(CGFloat)value{
    return self.progressLayer.value;
}

-(void)setMaxValue:(CGFloat)maxValue{
    self.progressLayer.maxValue = maxValue;

    //CALayer autogenerated setter using @dynamic doesn't refresh the layer when the value is 0
    if(maxValue == 0){
        [self.layer setNeedsDisplay];
    }
}

-(CGFloat)maxValue{
    return self.progressLayer.maxValue;
}

-(void)setProgressLineWidth:(CGFloat)width{
    self.progressLayer.progressLineWidth = width;
}

-(CGFloat)progressLineWidth{
    return self.progressLayer.progressLineWidth;
}

-(void)setEmptyLineWidth:(CGFloat)width{
    self.progressLayer.emptyLineWidth = width;
}

-(CGFloat)emptyLineWidth{
    return self.progressLayer.emptyLineWidth;
}

-(void)setProgressColor:(UIColor*)color{
    self.progressLayer.progressColor = color;
}

-(UIColor*)progressColor{
    return self.progressLayer.progressColor;
}

-(void)setUnitFontSize:(CGFloat)unitFontSize{
    self.progressLayer.unitFontSize = unitFontSize;
}

-(CGFloat)unitFontSize{
    return self.progressLayer.unitFontSize;
}

-(void)setValueFontSize:(CGFloat)valueFontSize{
    self.progressLayer.valueFontSize = valueFontSize;
}

-(CGFloat)valueFontSize{
    return self.progressLayer.valueFontSize;
}

-(void)setUnitString:(NSString *)unitString{
    self.progressLayer.unitString = unitString;
}

-(NSString*)unitString{
    return self.progressLayer.unitString;
}

-(void)setFontColor:(UIColor*)color{
    self.progressLayer.fontColor = color;
}

-(UIColor*)fontColor{
    return self.progressLayer.fontColor;
}

-(void)setProgressStrokeColor:(UIColor*)color{
    self.progressLayer.progressStrokeColor = color;
}

-(UIColor*)progressStrokeColor{
    return self.progressLayer.progressStrokeColor;
}

-(void)setEmptyLineColor:(UIColor *)emptyLineColor{
    self.progressLayer.emptyLineColor = emptyLineColor;
}

-(UIColor*)emptyLineColor{
    return self.progressLayer.emptyLineColor;
}

-(void)setProgressAngle:(CGFloat)progressAngle{
    self.progressLayer.progressAngle = progressAngle;
}

-(CGFloat)progressAngle{
    return self.progressLayer.progressAngle;
}

-(void)setProgressRotationAngle:(CGFloat)progressRootationAngle{
    self.progressLayer.progressRotationAngle = progressRootationAngle;
}

-(CGFloat)progressRootationAngle{
    return self.progressLayer.progressRotationAngle;
}

-(void)setProgressCapType:(NSInteger)progressCapType{
    self.progressLayer.progressCapType = [self safeCapType:progressCapType];
}

-(NSInteger)progressCapType{
    return self.progressLayer.progressCapType;
}

-(void)setEmptyCapType:(NSInteger)emptyCapType{
    self.progressLayer.emptyCapType = [self safeCapType:emptyCapType];
}

-(NSInteger)EmptyCapType{
    return self.progressLayer.emptyCapType;
}

-(CGLineCap)safeCapType:(NSInteger)type{
    if(kCGLineCapButt <= type && type <= kCGLineCapSquare){
        return (CGLineCap)type;
    }

    return kCGLineCapRound;
}

#pragma mark - CALayer

-(MBCircularProgressBarLayer*)progressLayer{
    MBCircularProgressBarLayer* layer = (MBCircularProgressBarLayer*) self.layer;
    return layer;
}

+ (Class) layerClass
{
    return [MBCircularProgressBarLayer class];
}

@end


text:
namespace ell
{
    /// Alternative, left first match
    template <typename Token, typename Left, typename Right>
    struct Alt : public BinaryNode<Token, Alt<Token, Left, Right>, Left, Right>
    {
        typedef BinaryNode<Token, Alt<Token, Left, Right>, Left, Right> Base;
        using Base::right;
        using Base::left;

        Alt(const Left & left, const Right & right)
          : Base(left, right)
        { }

        std::string get_kind() const { return "alternative"; }

        using Base::parse;

        template <typename V>
        bool parse(Parser<Token> * parser, Storage<V> & s) const
        {
            ELL_BEGIN_PARSE
            match = left.parse(parser, s) || right.parse(parser, s);
            ELL_END_PARSE
        }
    };

    /// Longest alternative
    template <typename Token, typename Left, typename Right>
    struct LAl : public BinaryNode<Token, LAl<Token, Left, Right>, Left, Right>
    {
        typedef BinaryNode<Token, LAl<Token, Left, Right>, Left, Right> Base;
        using Base::right;
        using Base::left;

        LAl(const Left & left, const Right & right)
          : Base(left, right)
        { }

        std::string get_kind() const { return "longest"; }

        using Base::parse;

        template <typename V>
        bool parse(Parser<Token> * parser, Storage<V> & s) const
        {
            ELL_BEGIN_PARSE
            typename Parser<Token>::Context sav_pos(parser);

            size_t left_s = 0;
            size_t right_s = 0;
            // Parse a first time to find length
            {
              SafeModify<> no_actions(parser->flags.action, false);

              if (left.parse(parser, s))
                  left_s = parser->measure(sav_pos);
              sav_pos.restore(parser);

              if (right.parse(parser, s))
                  right_s = parser->measure(sav_pos);
              sav_pos.restore(parser);
            }

            if ((left_s != 0) | (right_s != 0))
            {
                // Reparse the right one with actions
                if (left_s >= right_s)
                    match = left.parse(parser, s);
                else
                    match = right.parse(parser, s);
            }
            ELL_END_PARSE
        }
    };

    /// Combination (equivalent to a >> b | b >> a)
    template <typename Token, typename Left, typename Right>
    struct Asc : public BinaryNode<Token, Asc<Token, Left, Right>, Left, Right>
    {
        typedef BinaryNode<Token, Asc<Token, Left, Right>, Left, Right> Base;
        using Base::right;
        using Base::left;

        Asc(const Left & left, const Right & right)
          : Base(left, right)
        { }

        std::string get_kind() const { return "combination"; }

        using Base::parse;
        template <typename T>
        bool parse(Parser<Token> * parser, Storage<T> & s) const
        {
            ELL_BEGIN_PARSE
            s.clear();
            typename Storage<T>::Unit se;
            if (left.parse(parser, se))
            {
                s.enqueue(se);
                if (right.parse(parser, se))
                {
                    s.enqueue(se);
                    match = true;
                }
            }
            else if (right.parse(parser, se))
            {
                s.enqueue(se);
                if (left.parse(parser, se))
                {
                    s.enqueue(se);
                    match = true;
                }
            }
            ELL_END_PARSE
        }
    };

    /// Aggregation (sequence)
    template <typename Token, typename Left, typename Right>
    struct Agg : public BinaryNode<Token, Agg<Token, Left, Right>, Left, Right>
    {
        typedef BinaryNode<Token, Agg<Token, Left, Right>, Left, Right> Base;
        using Base::right;
        using Base::left;

        Agg(const Left & left, const Right & right)
          : Base(left, right)
        { }

        std::string get_kind() const { return "aggregation"; }

        using Base::parse;

        template <typename V>
        bool parse(Parser<Token> * parser, Storage<V> & s) const
        {
            ELL_BEGIN_PARSE
            typename Parser<Token>::Context sav_pos(parser);

            typename Storage<V>::Unit s1;
            if (left.parse(parser, s1))
            {
                parser->skip();
                typename Storage<V>::Unit s2;
                if (right.parse(parser, s2))
                {
                    s.enqueue(s1);
                    s.enqueue(s2);
                    match=true;
                }
                else
                {
                    if (not parser->flags.look_ahead)
                        parser->mismatch(right);

                    sav_pos.restore(parser);
                }
            }
            else
                sav_pos.restore(parser);
            ELL_END_PARSE
        }
    };

    template <typename Token, typename Left, typename Right>
    struct Dif : public BinaryNode<Token, Dif<Token, Left, Right>, Left, Right>
    {
        typedef BinaryNode<Token, Dif<Token, Left, Right>, Left, Right> Base;
        using Base::right;
        using Base::left;

        Dif(const Left & left, const Right & right)
          : Base(left, right)
        { }

        std::string get_kind() const { return "exclusion"; }

        using Base::parse;

        template <typename V>
        bool parse(Parser<Token> * parser, Storage<V> & s) const
        {
            ELL_BEGIN_PARSE
            typename Parser<Token>::Context sav_pos(parser);
            if (right.parse(parser))
                sav_pos.restore(parser);
            else
                match = left.parse(parser, s);
            ELL_END_PARSE
        }
    };

    template <typename Token, typename Left, typename Right>
    struct Lst : public BinaryNode<Token, Lst<Token, Left, Right>, Left, Right>
    {
        typedef BinaryNode<Token, Lst<Token, Left, Right>, Left, Right> Base;
        using Base::right;
        using Base::left;

        Lst(const Left & left, const Right & right)
          : Base(left, right)
        { }

        std::string get_kind() const { return "list"; }

        using Base::parse;

        template <typename T>
        bool parse(Parser<Token> * parser, Storage<T> & s) const
        {
            ELL_BEGIN_PARSE
            typename Parser<Token>::Context sav_pos(parser);
            typename Storage<T>::Unit se;
            s.clear();

            while (left.parse(parser, se))
            {
                s.enqueue(se);
                match = true;
                parser->skip();
                sav_pos = typename Parser<Token>::Context(parser);

                if (! right.parse(parser))
                    break;

                parser->skip();
            }

            sav_pos.restore(parser);
            ELL_END_PARSE
        }
    };

    /// Bound repetition, equivalent to `* (left - right) >> right`
    template <typename Token, typename Left, typename Right>
    struct BRp : public BinaryNode<Token, BRp<Token, Left, Right>, Left, Right>
    {
        typedef BinaryNode<Token, BRp<Token, Left, Right>, Left, Right> Base;
        using Base::right;
        using Base::left;

        BRp(const Left & left, const Right & right)
          : Base(left, right)
        { }

        std::string get_kind() const { return "bound-repetition"; }

        using Base::parse;
        template <typename T>
        bool parse(Parser<Token> * parser, Storage<T> & s) const
        {
            ELL_BEGIN_PARSE
            s.clear();
            typename Storage<T>::Unit se;
            while (1)
            {
                match = right.parse(parser);
                if (match || not left.parse(parser, se))
                    break;
                s.enqueue(se);
                parser->skip();
            }
            ELL_END_PARSE
        }
    };

    /// No suffix
    template <typename Token, typename Left, typename Right>
    struct NSx : public BinaryNode<Token, NSx<Token, Left, Right>, Left, Right>
    {
        typedef BinaryNode<Token, NSx<Token, Left, Right>, Left, Right> Base;
        using Base::right;
        using Base::left;

        NSx(const Left & left, const Right & right)
          : Base(left, right)
        { }

        std::string get_kind() const { return "no-suffix"; }

        using Base::parse;
        template <typename T>
        bool parse(Parser<Token> * parser, Storage<T> & s) const
        {
            ELL_BEGIN_PARSE
            SafeModify<> m1(parser->flags.look_ahead, true);
            typename Parser<Token>::Context sav_pos(parser);
            match = left.parse(parser, s);
            if (match && right.parse(parser))
            {
                sav_pos.restore(parser);
                match = false;
            }
            ELL_END_PARSE
        }
    };

    /// Skipper enabling directive, like the skip() directive, but taking the skipper to use as a second parameter.
    template <typename Token, typename Left, typename Right>
    struct SSk : public BinaryNode<Token, SSk<Token, Left, Right>, Left, Right>
    {
        typedef BinaryNode<Token, SSk<Token, Left, Right>, Left, Right> Base;
        using Base::right;
        using Base::left;

        SSk(const Left & left, const Right & right)
          : Base(left, right)
        { }

        std::string get_kind() const { return "with-skipper"; }

        using Base::parse;
        template <typename T>
        bool parse(Parser<Token> * parser, Storage<T> & s) const
        {
            ELL_BEGIN_PARSE
            typename Parser<Token>::Context sav_pos(parser);
            {
                SafeModify<const Node<Token> *> m1(parser->skipper, &right);
                SafeModify<> m2(parser->flags.skip, true);

                parser->skip();
                match = left.parse(parser, s);
            }
            if (match)
            {
                parser->skip(); // Advance with restored skipper
            }
            else
            {
                sav_pos.restore(parser);
            }
            ELL_END_PARSE
        }
    };
}

#endif // INCLUDED_ELL_BINARY_NODES_H


text:
date: 2018-12-23
title: "hugo check ulimit"
slug: hugo_check_ulimit
url: /commands/hugo_check_ulimit/
---
## hugo check ulimit

Check system ulimit settings

### Synopsis

Hugo will inspect the current ulimit settings on the system.
This is primarily to ensure that Hugo can watch enough files on some OSs

```
hugo check ulimit [flags]
```

### Options

```
  -h, --help   help for ulimit
```

### Options inherited from parent commands

```
      --config string      config file (default is path/config.yaml|json|toml)
      --configDir string   config dir (default "config")
      --debug              debug output
      --log                enable Logging
      --logFile string     log File path (if set, logging enabled automatically)
      --quiet              build in quiet mode
  -v, --verbose            verbose output
      --verboseLog         verbose logging
```

### SEE ALSO

* [hugo check](/commands/hugo_check/)	 - Contains some verification checks

###### Auto generated by spf13/cobra on 23-Dec-2018


text:
'use strict';

let paperScope = require('js/PaperScopeManager'),
    licenses = require('js/licenses'),
    fileSaver = require('js/FileSaver'),
    IconBase = require('js/IconBase'),
    Banner = require('js/Banner');

const EXPORT_SETTINGS = [
    {folderName: 'mipmap-mdpi', fileName: 'ic_launcher.png', factor: 1},
    {folderName: 'mipmap-hdpi', fileName: 'ic_launcher.png', factor: 1.5},
    {folderName: 'mipmap-xhdpi', fileName: 'ic_launcher.png', factor: 2},
    {folderName: 'mipmap-xxhdpi', fileName: 'ic_launcher.png', factor: 3},
    {folderName: 'mipmap-xxxhdpi', fileName: 'ic_launcher.png', factor: 4},
    {folderName: 'playstore', fileName: 'icon.png', factor: 512 / 48}
];

/**
 * Creates a downloadable ZIP file.
 */
class ExportManager {

    /**
     * Creates + downloads the final ZIP file.
     */
    createAndDownloadZip() {
        let zip = new JSZip();
        let rootFolder = zip.folder('icons');

        // generate content
        this.createAndZipImages(rootFolder);
        this.createAndZipLicenses(rootFolder);

        // download
        fileSaver.saveAs(zip.generate({type: 'blob'}), 'icons.zip');
    }

    createAndZipImages(rootFolder) {
        const drawProject = paperScope.draw().project;
        for (let i = 0; i < EXPORT_SETTINGS.length; ++i) {
            let exportSettings = EXPORT_SETTINGS[i];

            paperScope.activateExpo(i);
            let exportProject = paperScope.expo(i).project;

            // copy draw layer over to export canvas
            exportProject.clear();
            let layer = new paper.Layer();
            for (let j = 0; j < drawProject.layers[0].children.length; ++j) {
                let child = drawProject.layers[0].children[j];
                if (!child.fillColor || !child.visible) continue;
                let clonedChild = child.clone(false);
                layer.addChild(clonedChild);
            }
            paperScope.expo(i).view.center = new paper.Point(24, 24); // center at icon center (which is 48 px big)
            paperScope.expo(i).view.zoom = exportSettings.factor;
            paperScope.expo(i).view.draw();

            // copy png
            let pngData = paperScope.expoCanvas(i)[0].toDataURL('image/png').split(',')[1];
            let pngFileName = exportSettings.fileName;
            rootFolder.folder(exportSettings.folderName).file(pngFileName, pngData, {base64: true});

            if (i !== 0) continue;

            // manually created shadow for raw svg
            // huge thanks at the guys from paper js!
            // https://github.com/paperjs/paper.js/issues/1003
            let svgNode = exportProject.exportSVG();

            let baseFilter = document.createElementNS('http://www.w3.org/2000/svg', 'filter');
            baseFilter.innerHTML = '<feColorMatrix type="matrix" values="0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .8 0" /> <feOffset dx="0" dy="1"/> <feGaussianBlur stdDeviation="1"/> <feComposite in="SourceGraphic" />';
            baseFilter.setAttribute('id', 'dropshadow-base');
            svgNode.getElementsByTagName('defs')[0].appendChild(baseFilter);
            let baseNode = svgNode.getElementById(IconBase.ID() + ' 1');
            if (baseNode) baseNode.setAttribute('filter', 'url(#dropshadow-base)');

            let bannerFilter = document.createElementNS('http://www.w3.org/2000/svg', 'filter');
            bannerFilter.innerHTML = '<feColorMatrix type="matrix" values="0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .4 0" /> <feOffset dx="0" dy="1"/> <feGaussianBlur stdDeviation="0.5"/> <feComposite in="SourceGraphic" />';
            bannerFilter.setAttribute('id', 'dropshadow-banner');
            bannerFilter.setAttribute('x', '-10%');
            bannerFilter.setAttribute('y', '-10%');
            bannerFilter.setAttribute('width', '120%');
            bannerFilter.setAttribute('height', '130%');
            svgNode.getElementsByTagName('defs')[0].appendChild(bannerFilter);
            let bannerNode = svgNode.getElementById(Banner.ID() + ' 1');
            if (bannerNode) bannerNode.setAttribute('filter', 'url(#dropshadow-banner)');

            // export svg!
            let svgData = btoa(svgNode.outerHTML);
            let svgFileName = 'icon.svg';
            rootFolder.file(svgFileName, svgData, {base64: true});
        }

        // reactivate draw scope
        paperScope.activateDraw();
    }

    createAndZipLicenses(rootFolder) {
        let licenseFolder = rootFolder.folder('LICENSE');
        licenseFolder.file('LICENSE.txt', licenses.LICENSE_GENERAL);
        licenseFolder.file('LICENSE.CC_BY_NC_3.txt', licenses.LICENSE_CC_BY_NC_3);
    }

}

module.exports = new ExportManager();


text:
/************************************************************************************
 * Included Files
 ************************************************************************************/

#include <nuttx/config.h>

#include <debug.h>

#include <nuttx/board.h>

#include "sam4s-xplained.h"

/************************************************************************************
 * Definitions
 ************************************************************************************/

/************************************************************************************
 * Private Functions
 ************************************************************************************/

/************************************************************************************
 * Public Functions
 ************************************************************************************/

/************************************************************************************
 * Name: sam_boardinitialize
 *
 * Description:
 *   All SAM3U architectures must provide the following entry point.  This entry point
 *   is called early in the intitialization -- after all memory has been configured
 *   and mapped but before any devices have been initialized.
 *
 ************************************************************************************/

void sam_boardinitialize(void)
{
#ifdef CONFIG_SAM34_EXTSRAM0
  /* Configure and enable SRAM on board the SAM4S Xplained */

  sam_sram_initialize();
#endif

#ifdef CONFIG_ARCH_LEDS
  /* Configure on-board LEDs if LED support has been selected. */

  board_led_initialize();
#endif

#ifdef CONFIG_SAM34_ADC12B
  board_adc_initialize();
#endif

#if defined(CONFIG_PWM) && defined(CONFIG_SAM34_PWM)
  board_pwm_initialize();
#endif

#ifdef CONFIG_TIMER
  board_timerinitialize();
#endif
}


text:
This is a project to decode and visualize CAN messages of cars.

* For development: IntelliJ
* Arduino with "CAN-BUS Shield"
* npm start
* http://localhost:3000
* select the USB port which the arduino is connected to
* Communication nodejs <-> Webpage via WebSockets

![sequence image][sequence]

### Quick Usage guide
* Select an input on the top left
* "Ignore Start" to start capturing bytes that should be ignored
* Click on a hex value, to watch this byte
* STRG+Click on a Hex value, to toggle ignore of that Byte
* "M" to save the Value to the "known" list

### Screenshots ###

#### Main GUI
![main gui image][maingui]

#### Watching Values
![watching values image][watchingvalues]

#### Sidebar
![sequence image][sidebar]

### Example Data ###

Car Model: Hyundai i30
* logs/logfile_2016-08-05T21:35:08.329Z.txt

Test/Demo data can be loaded by clicking "Random"

[sequence]: doc/sequence.png "Sequence Diagram"
[maingui]: doc/gui01.png "Main GUI"
[watchingvalues]: doc/watching_values.png "Watching Values"
[sidebar]: doc/sidebar.png "Sidebar"


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <?php include_http_metas() ?>
    <?php include_metas() ?>
    <?php include_title() ?>
    <link rel="shortcut icon" href="/favicon.ico" />

Plugin Test Layout

    <?php echo $sf_content ?>


text:
.regtitlebg {
    position: relative;

    background-color:#FFCC00;
    border: 1px solid #FFFFFF;
    font-size: 13px;
    color: #FFFFFF;
    font-weight: bold;
    font-family: sans-serif;
    margin:0px 0 0px 0px;
    padding: 0px;
}

.regtables {
	position: relative;
	margin: auto;
	overflow: hidden;
	border: 1px solid #CCCCCC;
	text-align: center;
	padding: 0px;
	table-layout: fixed;
}


text:
(function() {
    angular
        .module("WebAppMaker")
        .controller("WebsiteListController", WebsiteListController)
        .controller("NewWebsiteController", NewWebsiteController)
        .controller("EditWebsiteController", EditWebsiteController);

    function WebsiteListController($routeParams, WebsiteService) {
        var vm = this;
        vm.userId = $routeParams.uid;
        function init() {
            WebsiteService.findWebsitesByUser(vm.userId)
                .success(function (websites) {
                    vm.websites = websites;
                });
        }
        init();
    }

    function NewWebsiteController($routeParams, $location, WebsiteService) {
        var vm = this;
        vm.userId = $routeParams.uid;
        function init() {
            WebsiteService.findWebsitesByUser(vm.userId)
                .success(function (websites) {
                    vm.websites = websites;
                });
        }
        init();

        vm.createWebsite = function (website) {
            WebsiteService.createWebsite(vm.userId, website)
                .success(function (res) {
                    alert("New website created!");
                    $location.url("/user/" + vm.userId + "/website");
                });
        }
    }

    function EditWebsiteController($routeParams, $location, WebsiteService) {
        var vm = this;
        vm.userId = $routeParams.uid;
        vm.websiteId = $routeParams.wid;
        function init() {
            WebsiteService.findWebsitesByUser(vm.userId)
                .success(function (websites) {
                    vm.websites = websites;
                });
            WebsiteService.findWebsiteById(vm.websiteId)
                .success(function (website) {
                    vm.website = website;
                });
        }
        init();

        vm.updateWebsite = function (website) {
            WebsiteService.updateWebsite(vm.websiteId, website)
                .success(function (res) {
                    alert("Website updated!");
                    $location.url("/user/" + vm.userId + "/website");
                });
        }

        vm.deleteWebsite = function () {
            WebsiteService.deleteWebsite(vm.websiteId)
                .success(function (res) {
                    alert("Website deleted!");
                    $location.url("/user/" + vm.userId + "/website");
                });
        }
    }

})();


text:
package auth

import (
	"net/http"
	"simple-auth/model"
)

type (
	CreateAuthService struct {
		userModel       model.UserModel
		credentialModel model.CredentialModel
	}

	ResultCreateToken struct {
		Credential model.Credentials `json:"credential"`
	}
)

func NewCreateAuthService(
	userModel model.UserModel,
	credentialModel model.CredentialModel,
) CreateAuthService {
	return CreateAuthService{
		userModel:       userModel,
		credentialModel: credentialModel,
	}
}

func (cas CreateAuthService) CreateAuth(u *model.Users, c *model.Credentials) (res interface{}, code int, err error) {
	err = cas.userModel.Create(u)
	if err != nil {
		return res, http.StatusInternalServerError, err
	}

	err = cas.credentialModel.Create(c)
	if err != nil {
		return res, http.StatusInternalServerError, err
	}

	res = ResultCreateToken{
		Credential: *c,
	}

	return res, http.StatusOK, nil
}


text:
// $Id: kprefs.cpp,v 1.1.1.1 2003/10/05 17:39:28 sheldonl Exp $

#include <kconfig.h>
#include <kstandarddirs.h>
#include <kglobal.h>
#include <kdebug.h>

#include "kprefs.h"

class KPrefsItemBool : public KPrefsItem {
  public:
    KPrefsItemBool(const QString &group,const QString &name,bool *,bool defaultValue=true);
    virtual ~KPrefsItemBool() {}

    void setDefault();
    void readConfig(KConfig *);
    void writeConfig(KConfig *);

  private:
    bool *mReference;
    bool mDefault;
};

class KPrefsItemInt : public KPrefsItem {
  public:
    KPrefsItemInt(const QString &group,const QString &name,int *,int defaultValue=0);
    virtual ~KPrefsItemInt() {}

    void setDefault();
    void readConfig(KConfig *);
    void writeConfig(KConfig *);

  private:
    int *mReference;
    int mDefault;
};

class KPrefsItemColor : public KPrefsItem {
  public:
    KPrefsItemColor(const QString &group,const QString &name,QColor *,
                    const QColor &defaultValue=QColor(128,128,128));
    virtual ~KPrefsItemColor() {}

    void setDefault();
    void readConfig(KConfig *);
    void writeConfig(KConfig *);

  private:
    QColor *mReference;
    QColor mDefault;
};

class KPrefsItemFont : public KPrefsItem {
  public:
    KPrefsItemFont(const QString &group,const QString &name,QFont *,
                   const QFont &defaultValue=QFont("helvetica",12));
    virtual ~KPrefsItemFont() {}

    void setDefault();
    void readConfig(KConfig *);
    void writeConfig(KConfig *);

  private:
    QFont *mReference;
    QFont mDefault;
};

class KPrefsItemString : public KPrefsItem {
  public:
    KPrefsItemString(const QString &group,const QString &name,QString *,
                     const QString &defaultValue="");
    virtual ~KPrefsItemString() {}

    void setDefault();
    void readConfig(KConfig *);
    void writeConfig(KConfig *);

  private:
    QString *mReference;
    QString mDefault;
};

class KPrefsItemStringList : public KPrefsItem {
  public:
    KPrefsItemStringList(const QString &group,const QString &name,QStringList *,
                         const QStringList &defaultValue=QStringList());
    virtual ~KPrefsItemStringList() {}

    void setDefault();
    void readConfig(KConfig *);
    void writeConfig(KConfig *);

  private:
    QStringList *mReference;
    QStringList mDefault;
};

class KPrefsItemIntList : public KPrefsItem {
  public:
    KPrefsItemIntList(const QString &group,const QString &name,QValueList<int> *,
                      const QValueList<int> &defaultValue=QValueList<int>());
    virtual ~KPrefsItemIntList() {}

    void setDefault();
    void readConfig(KConfig *);
    void writeConfig(KConfig *);

  private:
    QValueList<int> *mReference;
    QValueList<int> mDefault;
};

KPrefsItemBool::KPrefsItemBool(const QString &group,const QString &name,
                               bool *reference,bool defaultValue) :
  KPrefsItem(group,name)
{
  mReference = reference;
  mDefault = defaultValue;
}

void KPrefsItemBool::setDefault()
{
  *mReference = mDefault;
}

void KPrefsItemBool::writeConfig(KConfig *config)
{
  config->setGroup(mGroup);
  config->writeEntry(mName,*mReference);
}

void KPrefsItemBool::readConfig(KConfig *config)
{
  config->setGroup(mGroup);
  *mReference = config->readBoolEntry(mName,mDefault);
}

KPrefsItemInt::KPrefsItemInt(const QString &group,const QString &name,
                             int *reference,int defaultValue) :
  KPrefsItem(group,name)
{
  mReference = reference;
  mDefault = defaultValue;
}

void KPrefsItemInt::setDefault()
{
  *mReference = mDefault;
}

void KPrefsItemInt::writeConfig(KConfig *config)
{
  config->setGroup(mGroup);
  config->writeEntry(mName,*mReference);
}

void KPrefsItemInt::readConfig(KConfig *config)
{
  config->setGroup(mGroup);
  *mReference = config->readNumEntry(mName,mDefault);
}

KPrefsItemColor::KPrefsItemColor(const QString &group,const QString &name,
                                 QColor *reference,const QColor &defaultValue) :
  KPrefsItem(group,name)
{
  mReference = reference;
  mDefault = defaultValue;
}

void KPrefsItemColor::setDefault()
{
  *mReference = mDefault;
}

void KPrefsItemColor::writeConfig(KConfig *config)
{
  config->setGroup(mGroup);
  config->writeEntry(mName,*mReference);
}

void KPrefsItemColor::readConfig(KConfig *config)
{
  config->setGroup(mGroup);
  *mReference = config->readColorEntry(mName,&mDefault);
}

KPrefsItemFont::KPrefsItemFont(const QString &group,const QString &name,
                               QFont *reference,const QFont &defaultValue) :
  KPrefsItem(group,name)
{
  mReference = reference;
  mDefault = defaultValue;
}

void KPrefsItemFont::setDefault()
{
  *mReference = mDefault;
}

void KPrefsItemFont::writeConfig(KConfig *config)
{
  config->setGroup(mGroup);
  config->writeEntry(mName,*mReference);
}

void KPrefsItemFont::readConfig(KConfig *config)
{
  config->setGroup(mGroup);
  *mReference = config->readFontEntry(mName,&mDefault);
}

KPrefsItemString::KPrefsItemString(const QString &group,const QString &name,
                                   QString *reference,const QString &defaultValue) :
  KPrefsItem(group,name)
{
  mReference = reference;
  mDefault = defaultValue;
}

void KPrefsItemString::setDefault()
{
  *mReference = mDefault;
}

void KPrefsItemString::writeConfig(KConfig *config)
{
  config->setGroup(mGroup);
  config->writeEntry(mName,*mReference);
}

void KPrefsItemString::readConfig(KConfig *config)
{
  config->setGroup(mGroup);
  *mReference = config->readEntry(mName,mDefault);
}

KPrefsItemStringList::KPrefsItemStringList(const QString &group,const QString &name,
                                           QStringList *reference,const QStringList &defaultValue) :
  KPrefsItem(group,name)
{
  mReference = reference;
  mDefault = defaultValue;
}

void KPrefsItemStringList::setDefault()
{
  *mReference = mDefault;
}

void KPrefsItemStringList::writeConfig(KConfig *config)
{
  config->setGroup(mGroup);
  config->writeEntry(mName,*mReference);
}

void KPrefsItemStringList::readConfig(KConfig *config)
{
  config->setGroup(mGroup);
  *mReference = config->readListEntry(mName);
}

KPrefsItemIntList::KPrefsItemIntList(const QString &group,const QString &name,
                                     QValueList<int> *reference,const QValueList<int> &defaultValue) :
  KPrefsItem(group,name)
{
  mReference = reference;
  mDefault = defaultValue;
}

void KPrefsItemIntList::setDefault()
{
  *mReference = mDefault;
}

void KPrefsItemIntList::writeConfig(KConfig *config)
{
  config->setGroup(mGroup);
  config->writeEntry(mName,*mReference);
}

void KPrefsItemIntList::readConfig(KConfig *config)
{
  config->setGroup(mGroup);
  *mReference = config->readIntListEntry(mName);
}

QString *KPrefs::mCurrentGroup = 0;

KPrefs::KPrefs(const QString &configname)
{
  if (!configname.isEmpty()) {
    mConfig = new KConfig(locateLocal("config",configname));
  } else {
    mConfig = KGlobal::config();
  }

  mItems.setAutoDelete(true);

  // Set default group
  if (mCurrentGroup == 0) mCurrentGroup = new QString("No Group");
}

KPrefs::~KPrefs()
{
  if (mConfig != KGlobal::config()) {
    delete mConfig;
  }
}

void KPrefs::setCurrentGroup(const QString &group)
{
  if (mCurrentGroup) delete mCurrentGroup;
  mCurrentGroup = new QString(group);
}

KConfig *KPrefs::config() const
{
  return mConfig;
}

void KPrefs::setDefaults()
{
  KPrefsItem *item;
  for(item = mItems.first();item;item = mItems.next()) {
    item->setDefault();
  }

  usrSetDefaults();
}

void KPrefs::readConfig()
{
  KPrefsItem *item;
  for(item = mItems.first();item;item = mItems.next()) {
    item->readConfig(mConfig);
  }

  usrReadConfig();
}

void KPrefs::writeConfig()
{
  KPrefsItem *item;
  for(item = mItems.first();item;item = mItems.next()) {
    item->writeConfig(mConfig);
  }

  usrWriteConfig();

  mConfig->sync();
}

void KPrefs::addItem(KPrefsItem *item)
{
  mItems.append(item);
}

void KPrefs::addItemBool(const QString &key,bool *reference,bool defaultValue)
{
  addItem(new KPrefsItemBool(*mCurrentGroup,key,reference,defaultValue));
}

void KPrefs::addItemInt(const QString &key,int *reference,int defaultValue)
{
  addItem(new KPrefsItemInt(*mCurrentGroup,key,reference,defaultValue));
}

void KPrefs::addItemColor(const QString &key,QColor *reference,const QColor &defaultValue)
{
  addItem(new KPrefsItemColor(*mCurrentGroup,key,reference,defaultValue));
}

void KPrefs::addItemFont(const QString &key,QFont *reference,const QFont &defaultValue)
{
  addItem(new KPrefsItemFont(*mCurrentGroup,key,reference,defaultValue));
}

void KPrefs::addItemString(const QString &key,QString *reference,const QString &defaultValue)
{
  addItem(new KPrefsItemString(*mCurrentGroup,key,reference,defaultValue));
}

void KPrefs::addItemStringList(const QString &key,QStringList *reference,
                               const QStringList &defaultValue)
{
  addItem(new KPrefsItemStringList(*mCurrentGroup,key,reference,defaultValue));
}

void KPrefs::addItemIntList(const QString &key,QValueList<int> *reference,
                            const QValueList<int> &defaultValue)
{
  addItem(new KPrefsItemIntList(*mCurrentGroup,key,reference,defaultValue));
}


text:
using Microsoft.AspNet.SignalR;
using PlayFoos.Core.Services;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;

namespace PlayFoos.API.Communication
{
    public class NotifyHub : Hub
    {
        public static IGameService GameServiceInstance { get; set; }

        public NotifyHub() { }

        public override async Task OnConnected()
        {
            if (GameServiceInstance != null)
                Clients.Caller.updateGameState(await GameServiceInstance.GetCurrentAsync());

            await base.OnConnected();
        }
    }
}


text:
$ErrorActionPreference = 'Stop'

$toolsPath = Split-Path -parent $MyInvocation.MyCommand.Definition
$silentArgs = '/S'
$fileType   = 'exe'

$packageArgs = @{
  packageName = 'oldcalc'
  file        = gi $toolsPath\*_x32.zip
  destination = $toolsPath
}

Get-ChocolateyUnzip @packageArgs
Remove-Item $toolsPath\*.zip -ea 0

$FileFullPath = Get-ChildItem $toolsPath -Recurse -Include *.exe | Sort-Object -Descending | Select-Object -First 1

Install-ChocolateyInstallPackage -packageName 'oldcalc' $fileType $silentArgs $FileFullPath


text:
[![](https://images.microbadger.com/badges/image/ajhaydock/texlive.svg)](https://microbadger.com/images/ajhaydock/texlive "Get your own image badge on microbadger.com")

# texlive
This container is not meant to be run in itself, but is intended to serve as a base for my TeXstudio and JabRef containers.


text:
<footer class="container text-center">
	<h6>© 2014 | Developed by ITESM CEM Students</h6>
</footer>


text:
package org.slf4j;

import java.util.logging.Level;

/**
 * GWT Override for Log
 */
public class Logger {
    private final java.util.logging.Logger log;

    public Logger(java.util.logging.Logger log) {
        this.log = log;
    }

    public void debug(String msg) {
        log.log(Level.FINE, msg);
    }

    public void debug(String format, Object... arguments) {
        doFormat(Level.FINE, format, arguments);
    }

    public void debug(String msg, Throwable t) {
        log.log(Level.FINE, msg, t);
    }

    public void error(String msg) {
        log.log(Level.SEVERE, msg);
    }

    public void error(String format, Object... arguments) {
        doFormat(Level.SEVERE, format, arguments);
    }

    public void error(String msg, Throwable t) {
        log.log(Level.SEVERE, msg, t);
    }

    public void info(String msg) {
        log.log(Level.INFO, msg);
    }

    public void info(String format, Object... arguments) {
        doFormat(Level.INFO, format, arguments);
    }

    public void info(String msg, Throwable t) {
        log.log(Level.INFO, msg, t);
    }

    public void trace(String msg) {
        log.log(Level.FINER, msg);
    }

    public void trace(String format, Object... arguments) {
        doFormat(Level.FINER, format, arguments);
    }

    public void trace(String msg, Throwable t) {
        log.log(Level.FINER, msg, t);
    }

    public void warn(String msg) {
        log.log(Level.WARNING, msg);
    }

    public void warn(String format, Object... arguments) {
        doFormat(Level.WARNING, format, arguments);
    }

    public void warn(String msg, Throwable t) {
        log.log(Level.WARNING, msg, t);
    }

    public boolean isDebugEnabled() {
        return log.isLoggable(Level.FINE);
    }

    public boolean isErrorEnabled() {
        return log.isLoggable(Level.SEVERE);
    }

    public boolean isFatalEnabled() {
        return log.isLoggable(Level.SEVERE);
    }

    public boolean isInfoEnabled() {
        return log.isLoggable(Level.INFO);
    }

    public boolean isTraceEnabled() {
        return log.isLoggable(Level.FINER);
    }

    public boolean isWarnEnabled() {
        return log.isLoggable(Level.WARNING);
    }

    private void doFormat(Level level, String format, Object... arguments) {
        if (log.isLoggable(level) && format != null) {
            StringBuilder msg = new StringBuilder();
            int i = 0;
            int last = 0;
            int current;
            while ((current = format.indexOf("{}", last)) != -1) {
                msg.append(format, last, current);
                msg.append(arguments[i++]);
                last = current + 2;
            }
            msg.append(format, last, format.length());
            log.log(level, msg.toString());
        }
    }
}


text:
import { Component, OnInit, OnDestroy } from '@angular/core';
import { AppService } from './app.service';

@Component({
    moduleId: module.id,
    selector: 'my-app',
    templateUrl: 'app.component.html',
    styleUrls: ['app.component.css']
})
export class AppComponent implements OnInit, OnDestroy {

    constructor(private appService: AppService) {}

    ngOnInit() {
        console.log(this.appService.getData());
    }

    ngOnDestroy() {}
}


text:
// Declaration of PluginMain
#include "core_generic_plugin/generic_plugin.hpp"

// Declaration of the Panel
#include "qml_preferences_panel.hpp"

#include "core_reflection/type_class_definition.hpp"

#include <memory>

WGT_INIT_QRC_RESOURCE

namespace wgt
{
/**
* A plugin which creates a preferences option in the menu bar that lets you select different UI colours
*
* @ingroup plugins
* @image html plg_qml_preferences.png
* @note Requires Plugins:
*       - @ref coreplugins
*       - ColorPickerPlugin
*/
class QmlPreferencesPanelPlugin : public PluginMain
{
public:
	QmlPreferencesPanelPlugin(IComponentContext& componentContext)
	{
	}

	bool PostLoad(IComponentContext& componentContext) override
	{
		// Create the panel
		qmlPreferencesPanel_.reset(new QmlPreferencesPanel);
		return true;
	}

	void Initialise(IComponentContext& componentContext) override
	{
		qmlPreferencesPanel_->addPanel();
	}

	bool Finalise(IComponentContext& componentContext) override
	{
		qmlPreferencesPanel_->removePanel();
		return true;
	}

	void Unload(IComponentContext& componentContext) override
	{
		qmlPreferencesPanel_.reset();
	}

private:
	std::unique_ptr<QmlPreferencesPanel> qmlPreferencesPanel_;
};

PLG_CALLBACK_FUNC(QmlPreferencesPanelPlugin)
} // end namespace wgt


text:
package co.yiiu.pybbs.service.impl;

import co.yiiu.pybbs.mapper.TagMapper;
import co.yiiu.pybbs.model.Tag;
import co.yiiu.pybbs.model.TopicTag;
import co.yiiu.pybbs.service.ISystemConfigService;
import co.yiiu.pybbs.service.ITagService;
import co.yiiu.pybbs.service.ITopicTagService;
import co.yiiu.pybbs.util.MyPage;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.collect.Lists;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Service
@Transactional
public class TagService implements ITagService {

    @Autowired
    private TagMapper tagMapper;
    @Autowired
    private ITopicTagService topicTagService;
    @Autowired
    private ISystemConfigService systemConfigService;

    @Override
    public void selectTagsByTopicId(MyPage<Map<String, Object>> page) {
        page.getRecords().forEach(map -> {
            List<TopicTag> topicTags = topicTagService.selectByTopicId((Integer) map.get("id"));
            if (!topicTags.isEmpty()) {
                List<Integer> tagIds = topicTags.stream().map(TopicTag::getTagId).collect(Collectors.toList());
                List<Tag> tags = this.selectByIds(tagIds);
                map.put("tags", tags);
            }
        });
    }

    @Override
    public Tag selectById(Integer id) {
        return tagMapper.selectById(id);
    }

    @Override
    public Tag selectByName(String name) {
        QueryWrapper<Tag> wrapper = new QueryWrapper<>();
        wrapper.lambda().eq(Tag::getName, name);
        return tagMapper.selectOne(wrapper);
    }

    @Override
    public List<Tag> selectByIds(List<Integer> ids) {
        QueryWrapper<Tag> wrapper = new QueryWrapper<>();
        wrapper.lambda().in(Tag::getId, ids);
        return tagMapper.selectList(wrapper);
    }

    // 根据话题查询关联的所有标签
    @Override
    public List<Tag> selectByTopicId(Integer topicId) {
        List<TopicTag> topicTags = topicTagService.selectByTopicId(topicId);
        if (!topicTags.isEmpty()) {
            List<Integer> tagIds = topicTags.stream().map(TopicTag::getTagId).collect(Collectors.toList());
            QueryWrapper<Tag> wrapper = new QueryWrapper<>();
            wrapper.lambda().in(Tag::getId, tagIds);
            return tagMapper.selectList(wrapper);
        }
        return Lists.newArrayList();
    }

    // 将创建话题时填的tag处理并保存
    @Override
    public List<Tag> insertTag(String newTags) {
        // 使用工具将字符串按逗号分隔成数组
        String[] _tags = StringUtils.commaDelimitedListToStringArray(newTags);
        List<Tag> tagList = new ArrayList<>();
        for (String _tag : _tags) {
            Tag tag = this.selectByName(_tag);
            if (tag == null) {
                tag = new Tag();
                tag.setName(_tag);
                tag.setTopicCount(1);
                tag.setInTime(new Date());
                tagMapper.insert(tag);
            } else {
                tag.setTopicCount(tag.getTopicCount() + 1);
                tagMapper.updateById(tag);
            }
            tagList.add(tag);
        }
        return tagList;
    }

    // 将标签的话题数都-1
    @Override
    public void reduceTopicCount(Integer id) {
        List<Tag> tags = this.selectByTopicId(id);
        tags.forEach(tag -> {
            tag.setTopicCount(tag.getTopicCount() - 1);
            tagMapper.updateById(tag);
        });
    }

    // 查询标签关联的话题
    @Override
    public MyPage<Map<String, Object>> selectTopicByTagId(Integer tagId, Integer pageNo) {
        MyPage<Map<String, Object>> iPage = new MyPage<>(pageNo, Integer.parseInt(systemConfigService.selectAllConfig()
                .get("page_size").toString()));
        return tagMapper.selectTopicByTagId(iPage, tagId);
    }

    // 查询标签列表
    @Override
    public IPage<Tag> selectAll(Integer pageNo, Integer pageSize, String name) {
        IPage<Tag> iPage = new MyPage<>(pageNo, pageSize == null ? Integer.parseInt(systemConfigService.selectAllConfig()
                .get("page_size").toString()) : pageSize);
        QueryWrapper<Tag> wrapper = new QueryWrapper<>();
        // 当传进来的name不为null的时候,就根据name查询
        if (!StringUtils.isEmpty(name)) {
            wrapper.lambda().eq(Tag::getName, name);
        }
        wrapper.orderByDesc("topic_count");
        return tagMapper.selectPage(iPage, wrapper);
    }

    @Override
    public void update(Tag tag) {
        tagMapper.updateById(tag);
    }

    // 如果 topic_tag 表里还有关联的数据,这里删除会报错
    @Override
    public void delete(Integer id) {
        tagMapper.deleteById(id);
    }

    // ---------------------------- admin ----------------------------

    //同步标签的话题数
    @Override
    public void async() {
        List<Tag> tags = tagMapper.selectList(null);
        tags.forEach(tag -> {
            List<TopicTag> topicTags = topicTagService.selectByTagId(tag.getId());
            tag.setTopicCount(topicTags.size());
            this.update(tag);
        });
    }

    // 查询今天新增的标签数
    @Override
    public int countToday() {
        return tagMapper.countToday();
    }
}


text:
package test.testclasses;

public interface GenericInterface<T> {

}


text:
Puppet::Type.newtype(:db_migration) do
  @doc = "db_migration allows you to run a Datical DB hammer migration from a Datical DB project.
  "

  ensurable do
    desc "Whether to perform schema updates or not"

    newvalue(:latest) do
      provider.update
    end

    newvalue(:present) do
    end
  end

  autorequire(:package) do
    "DaticalDB"
  end

  newparam(:path) do
    desc "the path of the Datical DB project this will deploy"

    #FIXME, validate physical path?
  end

  newparam(:db_instance) do
    desc "the DB Instance path of the Datical DB project this will deploy"
  end

  newparam(:name) do
    isnamevar
    desc ""
  end
end