text:
package org.apache.commons.lang3;

import java.io.IOException;
import java.io.UncheckedIOException;
import java.lang.reflect.UndeclaredThrowableException;
import java.util.Collection;
import java.util.Objects;
import java.util.concurrent.Callable;
import java.util.function.BiConsumer;
import java.util.function.BiFunction;
import java.util.function.BiPredicate;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.stream.Stream;

import org.apache.commons.lang3.Streams.FailableStream;
import org.apache.commons.lang3.function.FailableBooleanSupplier;

/**
 * This class provides utility functions, and classes for working with the {@code java.util.function} package, or more
 * generally, with Java 8 lambdas. More specifically, it attempts to address the fact that lambdas are supposed not to
 * throw Exceptions, at least not checked Exceptions, AKA instances of {@link Exception}. This enforces the use of
 * constructs like:
 *
 *

 * {@code
 *     Consumer<java.lang.reflect.Method> consumer = (m) -> {
 *         try {
 *             m.invoke(o, args);
 *         } catch (Throwable t) {
 *             throw Functions.rethrow(t);
 *         }
 *     };
 * }

 *
 *

 * By replacing a {@link java.util.function.Consumer Consumer<O>} with a {@link FailableConsumer
 * FailableConsumer<O,? extends Throwable>}, this can be written like follows:
 *

 *
 *

 * {@code
 *   Functions.accept((m) -> m.invoke(o,args));
 * }

 *
 *

 * Obviously, the second version is much more concise and the spirit of Lambda expressions is met better than the second
 * version.
 *

 * @since 3.9
 * @deprecated Use {@link org.apache.commons.lang3.function.Failable}.
 */
@Deprecated
public class Functions {

    /**
     * A functional interface like {@link BiConsumer} that declares a {@code Throwable}.
     *
     *
TODO for 4.0: Move to org.apache.commons.lang3.function.

     *
     * @param <O1> Consumed type 1.
     * @param <O2> Consumed type 2.
     * @param <T> Thrown exception.
     * @deprecated Use {@link org.apache.commons.lang3.function.FailableBiConsumer}.
     */
    @Deprecated
    @FunctionalInterface
    public interface FailableBiConsumer<O1, O2, T extends Throwable> {

        /**
         * Accepts the consumer.
         *
         * @param object1 the first parameter for the consumable to accept
         * @param object2 the second parameter for the consumable to accept
         * @throws T Thrown when the consumer fails.
         */
        void accept(O1 object1, O2 object2) throws T;
    }

    /**
     * A functional interface like {@link BiFunction} that declares a {@code Throwable}.
     *
     *
TODO for 4.0: Move to org.apache.commons.lang3.function.

     *
     * @param <O1> Input type 1.
     * @param <O2> Input type 2.
     * @param <R> Return type.
     * @param <T> Thrown exception.
     * @deprecated Use {@link org.apache.commons.lang3.function.FailableBiFunction}.
     */
    @Deprecated
    @FunctionalInterface
    public interface FailableBiFunction<O1, O2, R, T extends Throwable> {

        /**
         * Applies this function.
         *
         * @param input1 the first input for the function
         * @param input2 the second input for the function
         * @return the result of the function
         * @throws T Thrown when the function fails.
         */
        R apply(O1 input1, O2 input2) throws T;
    }

    /**
     * A functional interface like {@link BiPredicate} that declares a {@code Throwable}.
     *
     *
TODO for 4.0: Move to org.apache.commons.lang3.function.

     *
     * @param <O1> Predicate type 1.
     * @param <O2> Predicate type 2.
     * @param <T> Thrown exception.
     * @deprecated Use {@link org.apache.commons.lang3.function.FailableBiPredicate}.
     */
    @Deprecated
    @FunctionalInterface
    public interface FailableBiPredicate<O1, O2, T extends Throwable> {

        /**
         * Tests the predicate.
         *
         * @param object1 the first object to test the predicate on
         * @param object2 the second object to test the predicate on
         * @return the predicate's evaluation
         * @throws T if the predicate fails
         */
        boolean test(O1 object1, O2 object2) throws T;
    }

    /**
     * A functional interface like {@link java.util.concurrent.Callable} that declares a {@code Throwable}.
     *
     *
TODO for 4.0: Move to org.apache.commons.lang3.function.

     *
     * @param <R> Return type.
     * @param <T> Thrown exception.
     * @deprecated Use {@link org.apache.commons.lang3.function.FailableCallable}.
     */
    @Deprecated
    @FunctionalInterface
    public interface FailableCallable<R, T extends Throwable> {

        /**
         * Calls the callable.
         *
         * @return The value returned from the callable
         * @throws T if the callable fails
         */
        R call() throws T;
    }

    /**
     * A functional interface like {@link Consumer} that declares a {@code Throwable}.
     *
     *
TODO for 4.0: Move to org.apache.commons.lang3.function.

     *
     * @param <O> Consumed type 1.
     * @param <T> Thrown exception.
     * @deprecated Use {@link org.apache.commons.lang3.function.FailableConsumer}.
     */
    @Deprecated
    @FunctionalInterface
    public interface FailableConsumer<O, T extends Throwable> {

        /**
         * Accepts the consumer.
         *
         * @param object the parameter for the consumable to accept
         * @throws T Thrown when the consumer fails.
         */
        void accept(O object) throws T;
    }

    /**
     * A functional interface like {@link Function} that declares a {@code Throwable}.
     *
     *
TODO for 4.0: Move to org.apache.commons.lang3.function.

     *
     * @param  Input type 1.
     * @param <R> Return type.
     * @param <T> Thrown exception.
     * @deprecated Use {@link org.apache.commons.lang3.function.FailableFunction}.
     */
    @Deprecated
    @FunctionalInterface
    public interface FailableFunction {

        /**
         * Applies this function.
         *
         * @param input the input for the function
         * @return the result of the function
         * @throws T Thrown when the function fails.
         */
        R apply(I input) throws T;
    }

    /**
     * A functional interface like {@link Predicate} that declares a {@code Throwable}.
     *
     *
TODO for 4.0: Move to org.apache.commons.lang3.function.

     *
     * @param  Predicate type 1.
     * @param <T> Thrown exception.
     * @deprecated Use {@link org.apache.commons.lang3.function.FailablePredicate}.
     */
    @Deprecated
    @FunctionalInterface
    public interface FailablePredicate {

        /**
         * Tests the predicate.
         *
         * @param object the object to test the predicate on
         * @return the predicate's evaluation
         * @throws T if the predicate fails
         */
        boolean test(I object) throws T;
    }

    /**
     * A functional interface like {@link Runnable} that declares a {@code Throwable}.
     *
     *
TODO for 4.0: Move to org.apache.commons.lang3.function.

     *
     * @param <T> Thrown exception.
     * @deprecated Use {@link org.apache.commons.lang3.function.FailableRunnable}.
     */
    @Deprecated
    @FunctionalInterface
    public interface FailableRunnable<T extends Throwable> {

        /**
         * Runs the function.
         *
         * @throws T Thrown when the function fails.
         */
        void run() throws T;
    }

    /**
     * A functional interface like {@link Supplier} that declares a {@code Throwable}.
     *
     *
TODO for 4.0: Move to org.apache.commons.lang3.function.

     *
     * @param <R> Return type.
     * @param <T> Thrown exception.
     * @deprecated Use {@link org.apache.commons.lang3.function.FailableSupplier}.
     */
    @Deprecated
    @FunctionalInterface
    public interface FailableSupplier<R, T extends Throwable> {

        /**
         * Supplies an object
         *
         * @return a result
         * @throws T if the supplier fails
         */
        R get() throws T;
    }

    /**
     * Consumes a consumer and rethrows any exception as a {@link RuntimeException}.
     *
     * @param consumer the consumer to consume
     * @param object1 the first object to consume by {@code consumer}
     * @param object2 the second object to consume by {@code consumer}
     * @param <O1> the type of the first argument the consumer accepts
     * @param <O2> the type of the second argument the consumer accepts
     * @param <T> the type of checked exception the consumer may throw
     */
    public static <O1, O2, T extends Throwable> void accept(final FailableBiConsumer<O1, O2, T> consumer,
        final O1 object1, final O2 object2) {
        run(() -> consumer.accept(object1, object2));
    }

    /**
     * Consumes a consumer and rethrows any exception as a {@link RuntimeException}.
     *
     * @param consumer the consumer to consume
     * @param object the object to consume by {@code consumer}
     * @param <O> the type the consumer accepts
     * @param <T> the type of checked exception the consumer may throw
     */
    public static <O, T extends Throwable> void accept(final FailableConsumer<O, T> consumer, final O object) {
        run(() -> consumer.accept(object));
    }

    /**
     * Applies a function and rethrows any exception as a {@link RuntimeException}.
     *
     * @param function the function to apply
     * @param input1 the first input to apply {@code function} on
     * @param input2 the second input to apply {@code function} on
     * @param <O1> the type of the first argument the function accepts
     * @param <O2> the type of the second argument the function accepts
     * @param <O> the return type of the function
     * @param <T> the type of checked exception the function may throw
     * @return the value returned from the function
     */
    public static <O1, O2, O, T extends Throwable> O apply(final FailableBiFunction<O1, O2, O, T> function,
        final O1 input1, final O2 input2) {
        return get(() -> function.apply(input1, input2));
    }

    /**
     * Applies a function and rethrows any exception as a {@link RuntimeException}.
     *
     * @param function the function to apply
     * @param input the input to apply {@code function} on
     * @param  the type of the argument the function accepts
     * @param <O> the return type of the function
     * @param <T> the type of checked exception the function may throw
     * @return the value returned from the function
     */
    public static  O apply(final FailableFunction function, final I input) {
        return get(() -> function.apply(input));
    }

    /**
     * Converts the given {@link FailableBiConsumer} into a standard {@link BiConsumer}.
     *
     * @param <O1> the type of the first argument of the consumers
     * @param <O2> the type of the second argument of the consumers
     * @param consumer a failable {@code BiConsumer}
     * @return a standard {@code BiConsumer}
     * @since 3.10
     */
    public static <O1, O2> BiConsumer<O1, O2> asBiConsumer(final FailableBiConsumer<O1, O2, ?> consumer) {
        return (input1, input2) -> accept(consumer, input1, input2);
    }

    /**
     * Converts the given {@link FailableBiFunction} into a standard {@link BiFunction}.
     *
     * @param <O1> the type of the first argument of the input of the functions
     * @param <O2> the type of the second argument of the input of the functions
     * @param <O> the type of the output of the functions
     * @param function a {@code FailableBiFunction}
     * @return a standard {@code BiFunction}
     * @since 3.10
     */
    public static <O1, O2, O> BiFunction<O1, O2, O> asBiFunction(final FailableBiFunction<O1, O2, O, ?> function) {
        return (input1, input2) -> apply(function, input1, input2);
    }

    /**
     * Converts the given {@link FailableBiPredicate} into a standard {@link BiPredicate}.
     *
     * @param <O1> the type of the first argument used by the predicates
     * @param <O2> the type of the second argument used by the predicates
     * @param predicate a {@code FailableBiPredicate}
     * @return a standard {@code BiPredicate}
     * @since 3.10
     */
    public static <O1, O2> BiPredicate<O1, O2> asBiPredicate(final FailableBiPredicate<O1, O2, ?> predicate) {
        return (input1, input2) -> test(predicate, input1, input2);
    }

    /**
     * Converts the given {@link FailableCallable} into a standard {@link Callable}.
     *
     * @param <O> the type used by the callables
     * @param callable a {@code FailableCallable}
     * @return a standard {@code Callable}
     * @since 3.10
     */
    public static <O> Callable<O> asCallable(final FailableCallable<O, ?> callable) {
        return () -> call(callable);
    }

    /**
     * Converts the given {@link FailableConsumer} into a standard {@link Consumer}.
     *
     * @param  the type used by the consumers
     * @param consumer a {@code FailableConsumer}
     * @return a standard {@code Consumer}
     * @since 3.10
     */
    public static  Consumer asConsumer(final FailableConsumer consumer) {
        return input -> accept(consumer, input);
    }

    /**
     * Converts the given {@link FailableFunction} into a standard {@link Function}.
     *
     * @param  the type of the input of the functions
     * @param <O> the type of the output of the functions
     * @param function a {code FailableFunction}
     * @return a standard {@code Function}
     * @since 3.10
     */
    public static  Function asFunction(final FailableFunction function) {
        return input -> apply(function, input);
    }

    /**
     * Converts the given {@link FailablePredicate} into a standard {@link Predicate}.
     *
     * @param  the type used by the predicates
     * @param predicate a {@code FailablePredicate}
     * @return a standard {@code Predicate}
     * @since 3.10
     */
    public static  Predicate asPredicate(final FailablePredicate predicate) {
        return input -> test(predicate, input);
    }

    /**
     * Converts the given {@link FailableRunnable} into a standard {@link Runnable}.
     *
     * @param runnable a {@code FailableRunnable}
     * @return a standard {@code Runnable}
     * @since 3.10
     */
    public static Runnable asRunnable(final FailableRunnable<?> runnable) {
        return () -> run(runnable);
    }

    /**
     * Converts the given {@link FailableSupplier} into a standard {@link Supplier}.
     *
     * @param <O> the type supplied by the suppliers
     * @param supplier a {@code FailableSupplier}
     * @return a standard {@code Supplier}
     * @since 3.10
     */
    public static <O> Supplier<O> asSupplier(final FailableSupplier<O, ?> supplier) {
        return () -> get(supplier);
    }

    /**
     * Calls a callable and rethrows any exception as a {@link RuntimeException}.
     *
     * @param callable the callable to call
     * @param <O> the return type of the callable
     * @param <T> the type of checked exception the callable may throw
     * @return the value returned from the callable
     */
    public static <O, T extends Throwable> O call(final FailableCallable<O, T> callable) {
        return get(callable::call);
    }

    /**
     * Invokes a supplier, and returns the result.
     *
     * @param supplier The supplier to invoke.
     * @param <O> The suppliers output type.
     * @param <T> The type of checked exception, which the supplier can throw.
     * @return The object, which has been created by the supplier
     * @since 3.10
     */
    public static <O, T extends Throwable> O get(final FailableSupplier<O, T> supplier) {
        try {
            return supplier.get();
        } catch (final Throwable t) {
            throw rethrow(t);
        }
    }

    /**
     * Invokes a boolean supplier, and returns the result.
     *
     * @param supplier The boolean supplier to invoke.
     * @param <T> The type of checked exception, which the supplier can throw.
     * @return The boolean, which has been created by the supplier
     */
    private static <T extends Throwable> boolean getAsBoolean(final FailableBooleanSupplier<T> supplier) {
        try {
            return supplier.getAsBoolean();
        } catch (final Throwable t) {
            throw rethrow(t);
        }
    }

    /**
     *

     * Rethrows a {@link Throwable} as an unchecked exception. If the argument is already unchecked, namely a
     * {@code RuntimeException} or {@code Error} then the argument will be rethrown without modification. If the
     * exception is {@code IOException} then it will be wrapped into a {@code UncheckedIOException}. In every other
     * cases the exception will be wrapped into a {@code
     * UndeclaredThrowableException}
     *

     *
     *

     * Note that there is a declared return type for this method, even though it never returns. The reason for that is
     * to support the usual pattern:
     *

     *
     *

     * throw rethrow(myUncheckedException);

     *
     *

     * instead of just calling the method. This pattern may help the Java compiler to recognize that at that point an
     * exception will be thrown and the code flow analysis will not demand otherwise mandatory commands that could
     * follow the method call, like a {@code return} statement from a value returning method.
     *

     *
     * @param throwable The throwable to rethrow ossibly wrapped into an unchecked exception
     * @return Never returns anything, this method never terminates normally.
     */
    public static RuntimeException rethrow(final Throwable throwable) {
        Objects.requireNonNull(throwable, "throwable");
        if (throwable instanceof RuntimeException) {
            throw (RuntimeException) throwable;
        } else if (throwable instanceof Error) {
            throw (Error) throwable;
        } else if (throwable instanceof IOException) {
            throw new UncheckedIOException((IOException) throwable);
        } else {
            throw new UndeclaredThrowableException(throwable);
        }
    }

    /**
     * Runs a runnable and rethrows any exception as a {@link RuntimeException}.
     *
     * @param runnable The runnable to run
     * @param <T> the type of checked exception the runnable may throw
     */
    public static <T extends Throwable> void run(final FailableRunnable<T> runnable) {
        try {
            runnable.run();
        } catch (final Throwable t) {
            throw rethrow(t);
        }
    }

    /**
     * Converts the given collection into a {@link FailableStream}. The {@link FailableStream} consists of the
     * collections elements. Shortcut for
     *
     *

     * Functions.stream(collection.stream());

     *
     * @param collection The collection, which is being converted into a {@link FailableStream}.
     * @param <O> The collections element type. (In turn, the result streams element type.)
     * @return The created {@link FailableStream}.
     * @since 3.10
     */
    public static <O> FailableStream<O> stream(final Collection<O> collection) {
        return new FailableStream<>(collection.stream());
    }

    /**
     * Converts the given stream into a {@link FailableStream}. The {@link FailableStream} consists of the same
     * elements, than the input stream. However, failable lambdas, like {@link FailablePredicate},
     * {@link FailableFunction}, and {@link FailableConsumer} may be applied, rather than {@link Predicate},
     * {@link Function}, {@link Consumer}, etc.
     *
     * @param stream The stream, which is being converted into a {@link FailableStream}.
     * @param <O> The streams element type.
     * @return The created {@link FailableStream}.
     * @since 3.10
     */
    public static <O> FailableStream<O> stream(final Stream<O> stream) {
        return new FailableStream<>(stream);
    }

    /**
     * Tests a predicate and rethrows any exception as a {@link RuntimeException}.
     *
     * @param predicate the predicate to test
     * @param object1 the first input to test by {@code predicate}
     * @param object2 the second input to test by {@code predicate}
     * @param <O1> the type of the first argument the predicate tests
     * @param <O2> the type of the second argument the predicate tests
     * @param <T> the type of checked exception the predicate may throw
     * @return the boolean value returned by the predicate
     */
    public static <O1, O2, T extends Throwable> boolean test(final FailableBiPredicate<O1, O2, T> predicate,
        final O1 object1, final O2 object2) {
        return getAsBoolean(() -> predicate.test(object1, object2));
    }

    /**
     * Tests a predicate and rethrows any exception as a {@link RuntimeException}.
     *
     * @param predicate the predicate to test
     * @param object the input to test by {@code predicate}
     * @param <O> the type of argument the predicate tests
     * @param <T> the type of checked exception the predicate may throw
     * @return the boolean value returned by the predicate
     */
    public static <O, T extends Throwable> boolean test(final FailablePredicate<O, T> predicate, final O object) {
        return getAsBoolean(() -> predicate.test(object));
    }

    /**
     * A simple try-with-resources implementation, that can be used, if your objects do not implement the
     * {@link AutoCloseable} interface. The method executes the {@code action}. The method guarantees, that all
     * the {@code resources} are being executed, in the given order, afterwards, and regardless of success, or failure.
     * If either the original action, or any of the resource action fails, then the first failure (AKA
     * {@link Throwable} is rethrown. Example use:
     *
     *

     * {@code
     *     final FileInputStream fis = new FileInputStream("my.file");
     *     Functions.tryWithResources(useInputStream(fis), null, () -> fis.close());
     * }

     *
     * @param action The action to execute. This object will always be invoked.
     * @param errorHandler An optional error handler, which will be invoked finally, if any error occurred. The error
     *        handler will receive the first error, AKA {@link Throwable}.
     * @param resources The resource actions to execute. All resource actions will be invoked, in the given
     *        order. A resource action is an instance of {@link FailableRunnable}, which will be executed.
     * @see #tryWithResources(FailableRunnable, FailableRunnable...)
     */
    @SafeVarargs
    public static void tryWithResources(final FailableRunnable<? extends Throwable> action,
        final FailableConsumer<Throwable, ? extends Throwable> errorHandler,
        final FailableRunnable<? extends Throwable>... resources) {
        final FailableConsumer<Throwable, ? extends Throwable> actualErrorHandler;
        if (errorHandler == null) {
            actualErrorHandler = Functions::rethrow;
        } else {
            actualErrorHandler = errorHandler;
        }
        if (resources != null) {
            for (final FailableRunnable<? extends Throwable> failableRunnable : resources) {
                Objects.requireNonNull(failableRunnable, "runnable");
            }
        }
        Throwable th = null;
        try {
            action.run();
        } catch (final Throwable t) {
            th = t;
        }
        if (resources != null) {
            for (final FailableRunnable<?> runnable : resources) {
                try {
                    runnable.run();
                } catch (final Throwable t) {
                    if (th == null) {
                        th = t;
                    }
                }
            }
        }
        if (th != null) {
            try {
                actualErrorHandler.accept(th);
            } catch (final Throwable t) {
                throw rethrow(t);
            }
        }
    }

    /**
     * A simple try-with-resources implementation, that can be used, if your objects do not implement the
     * {@link AutoCloseable} interface. The method executes the {@code action}. The method guarantees, that all
     * the {@code resources} are being executed, in the given order, afterwards, and regardless of success, or failure.
     * If either the original action, or any of the resource action fails, then the first failure (AKA
     * {@link Throwable} is rethrown. Example use:
     *
     *

     * {@code
     *     final FileInputStream fis = new FileInputStream("my.file");
     *     Functions.tryWithResources(useInputStream(fis), () -> fis.close());
     * }

     *
     * @param action The action to execute. This object will always be invoked.
     * @param resources The resource actions to execute. All resource actions will be invoked, in the given
     *        order. A resource action is an instance of {@link FailableRunnable}, which will be executed.
     * @see #tryWithResources(FailableRunnable, FailableConsumer, FailableRunnable...)
     */
    @SafeVarargs
    public static void tryWithResources(final FailableRunnable<? extends Throwable> action,
        final FailableRunnable<? extends Throwable>... resources) {
        tryWithResources(action, null, resources);
    }
}


text:
using UnityEngine;
using UniRx;
using sgffu.EventMessage;
using sgffu.Terrain;
using sgffu.Filesystem;
using sgffu.Characters;
using sgffu.Characters.Input;
using sgffu.Characters.Player;
using StrOpe = StringOperationUtil.OptimizedStringOperation;

public class PlayerController : MonoBehaviour, IControlCharacterAction
{
    PlayerInputControlAction input_controller;

    private bool in_action = false;

    private bool window_open = false;

    private bool dash_key = false;
    private bool up_key = false;
    private bool down_key = false;
    private bool left_key = false;
    private bool right_key = false;

    private int terrain_chunk_size = 1;

    private int terrain_chunk_x = 0;
    private int terrain_chunk_z = 0;

/*
    private float mouse_x = 0f;
    private float mouse_y = 0f;
    private float mouse_wheel = 0f;

    private float rotate_x_sensitive = 2f;
    private float rotate_y_sensitive = 2f;
*/

    float player_move_speed_front = 0.2f;
    float player_move_speed_back = -0.1f;
    float player_move_speed_left = -0.2f;
    float player_move_speed_right = 0.2f;
    float player_dash_speed_front = 1f;
    float player_dash_speed_back = -0.8f;
    float player_dash_speed_left = -1f;
    float player_dash_speed_right = 1f;

	// Use this for initialization
	public void Start () {
        input_controller = new PlayerInputControlAction(this);
        this.terrain_chunk_size = TerrainService.terrain_config.chunk_size;
        //Log.write(StrOpe.i + "terrain_chunk_size: " + this.terrain_chunk_size);
	}

	// Update is called once per frame
	public void Update () {
		if (this.window_open) { return; }

        //this.characterRotation(this.getRotateValue());
        this.characterMove(this.getMoveValue());
	}
/*
    private Vector3 getRotateValue() {
        return new Vector3(mouse_x, mouse_y, 0f);
    }

    private void characterRotation(Vector3 rotate) {
        this.transform.Rotate(0f, rotate.x * rotate_x_sensitive, 0f);
    }
*/
    private Vector3 getMoveValue() {
        Vector3 move = new Vector3(0f, 0f, 0f);

        if (this.up_key) {
            move.z += this.dash_key ? player_dash_speed_front : player_move_speed_front;
        }
        if (this.down_key) {
            move.z += this.dash_key ? player_dash_speed_back : player_move_speed_back;
        }
        if (this.left_key) {
            move.x = this.dash_key ? player_dash_speed_left : player_move_speed_left;
        }
        if (this.right_key) {
            move.x = this.dash_key ? player_dash_speed_right : player_move_speed_right;
        }
        if (((move.z < 0f) || (0f < move.z)) && ((move.x < 0f) || (0f < move.x))) {
            move = new Vector3(move.x * 0.7f, 0f, move.z * 0.7f);
        }

        return move;
    }

    private void characterMove(Vector3 move) {
        this.transform.position += move;

        int chunk_x = (int)(this.transform.position.x / this.terrain_chunk_size);
        int chunk_z = (int)(this.transform.position.z / this.terrain_chunk_size);
        if (terrain_chunk_x != chunk_x || terrain_chunk_z != chunk_z) {
            //Debug.Log(StrOpe.i + "updatePostCharaMove: " + chunk_x + " , " + chunk_z + " : " + this.terrain_chunk_x + " , " + this.terrain_chunk_z);
            //Log.write(StrOpe.i + "updatePostCharaMove: " + chunk_x + " , " + chunk_z + " : " + this.terrain_chunk_x + " , " + this.terrain_chunk_z);
            //Log.write("Publish: playerTerrainChunkMove");
            MessageBroker.Default.Publish<playerTerrainChunkMove>(new playerTerrainChunkMove {
                x = chunk_x,
                z = chunk_z
            });
        }
        this.terrain_chunk_x = chunk_x;
        this.terrain_chunk_z = chunk_z;
    }

    public void OnMainAciton()
    {
        if(this.in_action) { return; }
        this.in_action = true;
        this.in_action = false;
    }

    public void OnSubAction()
    {
        if(this.in_action) { return; }
        this.in_action = true;
        this.in_action = false;
    }

    public void OnFocusAction()
    {
        if(this.in_action) { return; }
        this.in_action = true;
        this.in_action = false;
    }

    public void OnJump()
    {
        if(this.in_action) { return; }
        this.in_action = true;
        this.in_action = false;
    }

    public void OnDash()
    {
        this.dash_key = true;
    }

    public void OnRoll()
    {
        if(this.in_action) { return; }
        this.in_action = true;
        this.in_action = false;
    }

    public void OnReload()
    {
        if(this.in_action) { return; }
        this.in_action = true;
        this.in_action = false;
    }

    public void OnCrouch()
    {
        if(this.in_action) { return; }
        this.in_action = true;
        this.in_action = false;
    }

    public void OnLayDown()
    {
        if(this.in_action) { return; }
        this.in_action = true;
        this.in_action = false;
    }

    public void OnUp()
    {
        this.up_key = true;
    }

    public void OnDown()
    {
        this.down_key = true;
    }

    public void OnLeft()
    {
        this.left_key = true;
    }

    public void OnRight()
    {
        this.right_key = true;
    }

    public void OnMenuOpen()
    {
        if(this.window_open) { return; }
        this.window_open = true;
        this.window_open = false;
    }

    public void OnInventoryOpen()
    {
        if(this.window_open) { return; }
        this.window_open = true;
        this.window_open = false;
    }

    public void OnStatusOpen()
    {
        if(this.window_open) { return; }
        this.window_open = true;
        this.window_open = false;
    }

    public void OnSkillOpen()
    {
        if(this.window_open) { return; }
        this.window_open = true;
        this.window_open = false;
    }

    public void OnMapOpen()
    {
        if(this.window_open) { return; }
        this.window_open = true;
        this.window_open = false;
    }

    public void OffDash()
    {
        this.dash_key = false;
    }

    public void OffUp()
    {
        this.up_key = false;
    }

    public void OffDown()
    {
        this.down_key = false;
    }

    public void OffLeft()
    {
        this.left_key = false;
    }

    public void OffRight()
    {
        this.right_key = false;
    }

}

redpajama_set_name: RedPajamaGithub


text:
try:
    from setuptools import setup
except ImportError:
    from distutils.core import setup

with open('README.rst') as readme_file:
    readme = readme_file.read()

with open('HISTORY.rst') as history_file:
    history = history_file.read()

requirements = [
    # TODO: put package requirements here
    'psycopg2==2.6.1'
]

test_requirements = [
    # TODO: put package test requirements here
]

setup(
    name='gobii_ifl',
    version='0.1.0',
    description="This is the GOBII Intermediate File Loader project. Modules here will take in the intermediate file output of the Digesters and process them accordingly before loading into their corresponding tables in the GOBII Flatmeta schema.",
    long_description=readme + '\n\n' + history,
    author="Kevin Palis",
    author_email='kdp44@cornell.edu',
    url='http://cbsugobii05.tc.cornell.edu:6083/scm/gm/data-warehouse-postgresql',
    packages=[
        'gobii_ifl', 'gobii_ifl.db', 'gobii_ifl.res', 'gobii_ifl.res.map', 'gobii_ifl.util'
    ],
    package_dir={'gobii_ifl':
                 'gobii_ifl', 'gobii_ifl.db': 'gobii_ifl/db', 'gobii_ifl.res': 'gobii_ifl/res', 'gobii_ifl.res.map': 'gobii_ifl/res/map', 'gobii_ifl.util': 'gobii_ifl/util'},
    include_package_data=True,
    package_data={'gobii_ifl/res/map': ['*']},
    install_requires=requirements,
    license="ISCL",
    zip_safe=False,
    keywords='gobii_ifl',
    classifiers=[
        'Development Status :: 2 - Pre-Alpha',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: ISC License (ISCL)',
        'Natural Language :: English',
        "Programming Language :: Python :: 2",
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
    ],
    test_suite='tests',
    tests_require=test_requirements
)


text:
var events = new (Npm.require('events').EventEmitter)(),
	collectionName = process.env.MULTIPLE_INSTANCES_COLLECTION_NAME || 'instances',
	defaultPingInterval = (process.env.MULTIPLE_INSTANCES_PING_INTERVAL || 10); // default to 10s

var Instances = new Meteor.Collection(collectionName);

var InstancesRaw = Instances.rawCollection();

// if not set via env var ensures at least 3 ticks before expiring (multiple of 60s)
var indexExpire = parseInt(process.env.MULTIPLE_INSTANCES_EXPIRE || (Math.ceil(defaultPingInterval * 3 / 60) * 60));

InstancesRaw.indexes()
	.catch(function() {
		// the collection should not exists yet, return empty then
		return [];
	})
	.then(function(result) {
		return result.some(function(index) {
			if (index.key && index.key['_updatedAt'] === 1) {
				if (index.expireAfterSeconds !== indexExpire) {
					InstancesRaw.dropIndex(index.name);
					return false;
				}
				return true;
			}
		})
	})
	.then(function(created) {
		if (!created) {
			InstancesRaw.createIndex({_updatedAt: 1}, {expireAfterSeconds: indexExpire});
		}
	});

InstanceStatus = {
	name: undefined,
	extraInformation: undefined,

	events: events,

	getCollection: function() {
		return Instances;
	},

	registerInstance: function(name, extraInformation) {
		InstanceStatus.name = name;
		InstanceStatus.extraInformation = extraInformation;

		if (InstanceStatus.id() === undefined || InstanceStatus.id() === null) {
			return console.error('[multiple-instances-status] only can be called after Meteor.startup');
		}

		var now = new Date(),
			instance = {
				$set: {
					pid: process.pid,
					name: name
				},
				$currentDate: {
					_createdAt: true,
					_updatedAt: true
				}
			};

		if (extraInformation) {
			instance.$set.extraInformation = extraInformation;
		}

		try {
			Instances.upsert({_id: InstanceStatus.id()}, instance);
			var result = Instances.findOne({_id: InstanceStatus.id()});
			InstanceStatus.start();

			events.emit('registerInstance', result, instance);

			process.on('exit', InstanceStatus.onExit);

			return result;
		} catch (e) {
			return e;
		}
	},

	unregisterInstance: function() {
		try {
			var result = Instances.remove({_id: InstanceStatus.id()});
			InstanceStatus.stop();

			events.emit('unregisterInstance', InstanceStatus.id());

			process.removeListener('exit', InstanceStatus.onExit);

			return result;
		} catch (e) {
			return e;
		}
	},

	start: function(interval) {
		InstanceStatus.stop();

		interval = interval || defaultPingInterval;

		InstanceStatus.interval = Meteor.setInterval(function() {
			InstanceStatus.ping();
		}, interval * 1000);
	},

	stop: function(interval) {
		if (InstanceStatus.interval) {
			InstanceStatus.interval.close();
			delete InstanceStatus.interval;
		}
	},

	ping: function() {
		var count = Instances.update(
			{
				_id: InstanceStatus.id()
			},
			{
				$currentDate: {
					_updatedAt: true
				}
			});

		if (count === 0) {
			InstanceStatus.registerInstance(InstanceStatus.name, InstanceStatus.extraInformation);
		}
	},

	onExit: function() {
		InstanceStatus.unregisterInstance();
	},

	activeLogs: function() {
		Instances.find().observe({
			added: function(record) {
				var log = '[multiple-instances-status] Server connected: ' + record.name + ' - ' + record._id;
				if (record._id == InstanceStatus.id()) {
					log += ' (me)';
				}
				console.log(log.green);
			},
			removed: function(record) {
				var log = '[multiple-instances-status] Server disconnected: ' + record.name + ' - ' + record._id;
				console.log(log.red);
			}
		});
	},

	id: function() {}
};

Meteor.startup(function() {
	var ID = Random.id();

	InstanceStatus.id = function() {
		return ID;
	};
});


text:
RSpec.describe SolidusSubscriptions do
  describe '.churn_buster' do
    context 'when Churn Buster was configured' do
      it 'returns a Churn Buster client instance' do
        allow(described_class.configuration).to receive_messages(
          churn_buster?: true,
          churn_buster_account_id: 'account_id',
          churn_buster_api_key: 'api_key',
        )
        churn_buster = instance_double(SolidusSubscriptions::ChurnBuster::Client)
        allow(SolidusSubscriptions::ChurnBuster::Client).to receive(:new).with(
          account_id: 'account_id',
          api_key: 'api_key',
        ).and_return(churn_buster)

        expect(described_class.churn_buster).to eq(churn_buster)
      end
    end

    context 'when Churn Buster was not configured' do
      it 'returns nil' do
        allow(described_class.configuration).to receive_messages(churn_buster?: false)

        expect(described_class.churn_buster).to be_nil
      end
    end
  end
end


text:
package org.apache.drill.exec.store.pojo;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.sql.Timestamp;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import org.apache.drill.common.exceptions.ExecutionSetupException;
import org.apache.drill.exec.exception.SchemaChangeException;
import org.apache.drill.exec.memory.OutOfMemoryException;
import org.apache.drill.exec.ops.OperatorContext;
import org.apache.drill.exec.physical.impl.OutputMutator;
import org.apache.drill.exec.record.MaterializedField.Key;
import org.apache.drill.exec.store.AbstractRecordReader;
import org.apache.drill.exec.store.pojo.Writers.BitWriter;
import org.apache.drill.exec.store.pojo.Writers.DoubleWriter;
import org.apache.drill.exec.store.pojo.Writers.EnumWriter;
import org.apache.drill.exec.store.pojo.Writers.IntWriter;
import org.apache.drill.exec.store.pojo.Writers.LongWriter;
import org.apache.drill.exec.store.pojo.Writers.NBigIntWriter;
import org.apache.drill.exec.store.pojo.Writers.NBooleanWriter;
import org.apache.drill.exec.store.pojo.Writers.NDoubleWriter;
import org.apache.drill.exec.store.pojo.Writers.NIntWriter;
import org.apache.drill.exec.store.pojo.Writers.NTimeStampWriter;
import org.apache.drill.exec.store.pojo.Writers.StringWriter;
import org.apache.drill.exec.vector.AllocationHelper;
import org.apache.drill.exec.vector.ValueVector;

import com.google.common.collect.Lists;

public class PojoRecordReader<T> extends AbstractRecordReader {
  static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(PojoRecordReader.class);

  public final int forJsonIgnore = 1;

  private final Class<T> pojoClass;
  private final Iterator<T> iterator;
  private PojoWriter[] writers;
  private boolean doCurrent;
  private T currentPojo;
  private OperatorContext operatorContext;

  public PojoRecordReader(Class<T> pojoClass, Iterator<T> iterator){
    this.pojoClass = pojoClass;
    this.iterator = iterator;
  }

  public OperatorContext getOperatorContext() {
    return operatorContext;
  }

  public void setOperatorContext(OperatorContext operatorContext) {
    this.operatorContext = operatorContext;
  }

  @Override
  public void setup(OutputMutator output) throws ExecutionSetupException {
    try{
      Field[] fields = pojoClass.getDeclaredFields();
      List<PojoWriter> writers = Lists.newArrayList();

      for(int i = 0; i < fields.length; i++){
        Field f = fields[i];

        if(Modifier.isStatic(f.getModifiers())) continue;

        Class<?> type = f.getType();
        PojoWriter w = null;
        if(type == int.class){
          w = new IntWriter(f);
        }else if(type == Integer.class){
          w = new NIntWriter(f);
        }else if(type == Long.class){
          w = new NBigIntWriter(f);
        }else if(type == Boolean.class){
          w = new NBooleanWriter(f);
        }else if(type == double.class){
          w = new DoubleWriter(f);
        }else if(type == Double.class){
          w = new NDoubleWriter(f);
        }else if(type.isEnum()){
          w = new EnumWriter(f, output.getManagedBuffer());
        }else if(type == boolean.class){
          w = new BitWriter(f);
        }else if(type == long.class){
          w = new LongWriter(f);
        }else if(type == String.class){
          w = new StringWriter(f, output.getManagedBuffer());
        }else if (type == Timestamp.class) {
          w = new NTimeStampWriter(f);
        }else{
          throw new ExecutionSetupException(String.format("PojoRecord reader doesn't yet support conversions from type [%s].", type));
        }
        writers.add(w);
        w.init(output);
      }

      this.writers = writers.toArray(new PojoWriter[writers.size()]);

    }catch(SchemaChangeException e){
      throw new ExecutionSetupException("Failure while setting up schema for PojoRecordReader.", e);
    }

  }

  @Override
  public void allocate(Map<Key, ValueVector> vectorMap) throws OutOfMemoryException {
    for (ValueVector v : vectorMap.values()) {
      AllocationHelper.allocate(v, Character.MAX_VALUE, 50, 10);
    }
  }

  private void allocate(){
    for(PojoWriter writer : writers){
      writer.allocate();
    }
  }

  private void setValueCount(int i){
    for(PojoWriter writer : writers){
      writer.setValueCount(i);
    }
  }

  @Override
  public int next() {
    boolean allocated = false;

    try{
      int i =0;
      outside:
      while(doCurrent || iterator.hasNext()){
        if(doCurrent){
          doCurrent = false;
        }else{
          currentPojo = iterator.next();
        }

        if(!allocated){
          allocate();
          allocated = true;
        }

        for(PojoWriter writer : writers){
          if(!writer.writeField(currentPojo, i)){
            doCurrent = true;
            if(i == 0) throw new IllegalStateException("Got into a position where we can't write data but the batch is empty.");
            break outside;
          };
        }
        i++;
      }

      if(i != 0 ) setValueCount(i);
      return i;
    } catch (IllegalArgumentException | IllegalAccessException e) {
      throw new RuntimeException("Failure while trying to use PojoRecordReader.", e);
    }
  }

  @Override
  public void cleanup() {
  }

}


text:
<?php
/* Prevent direct access */
defined('ABSPATH') or die("You can't access this file directly.");

class aspDebug {

    private static $procesStart = array();

    public static function start($process = 'default') {
        if (ASP_DEBUG != 1) return;

        print $process .' START
';
        self::$procesStart[$process] = microtime(true);
    }

    public static function stop($process = 'default') {
        if (ASP_DEBUG != 1) return;
        print $process. " END | runtime: ".number_format(microtime(true) - self::$procesStart[$process], 3, '.', '').'s
';
    }
}


text:
From version 1.8 onwards, Kubernetes provides resource usage metrics, such as the container CPU and memory usage, through the Metrics API. These metrics can be directly accessed by users \(for example, by using the  **kubectl top**  command\) or used by controllers \(for example, Horizontal Pod Autoscaler\) in a cluster for decision-making. The specific component is Metrics-Server, which is used to substitute for heapster for providing the similar functions. heapster has been gradually abandoned since v1.11.

Metrics-Server is a cluster-wide aggregator of resource usage data. You can quickly install this add-on on the CCE console.

The official community project and documentation are available at  [https://github.com/kubernetes-sigs/metrics-server](https://github.com/kubernetes-sigs/metrics-server).

## Constraints

This add-on can be installed only in hybrid and BMS clusters of v1.13 or later.

## Installing the Add-on

After metrics-server is installed, you can create an HPA policy on the  **Workload Scaling**  tab page of the  **Auto Scaling**  page. For details, see  [Scaling a Workload](scaling-a-workload.md).

1.  Log in to the CCE console. In the navigation pane, choose  **Add-ons**. On the  **Add-on Marketplace**  tab page, click  **Install Add-on**  under  **metrics-server**.
2.  On the  **Install Add-on**  page, select the cluster and the add-on version, and click  **Next: Configuration**.
3.  Select  **Single**  or  **HA**  for  **Add-on Specifications**, and click  **Install**.

    After the add-on is installed, click  **Back to Add-on List**. On the  **Add-on Instance**  tab page, select the corresponding cluster to view the running instance. This indicates that the add-on has been installed on each node in the cluster.

## Uninstalling the Add-on

1.  Log in to the CCE console. In the navigation pane, choose  **Add-ons**. On the  **Add-on Instance**  tab page, click  **Uninstall**  under  **metrics-server**.
2.  In the dialog box that is displayed, click  **OK**  to uninstall the add-on.


text:
import React from 'react'
import assert from 'assert'
import ReactShallowRenderer from 'react-test-renderer/shallow'
import Tooltip from '../src'

const renderer = (Component) => {
  const shallowRenderer = new ReactShallowRenderer()
  shallowRenderer.render(Component)
  return shallowRenderer.getRenderOutput()
}

describe('React Portal Tooltip', () => {
  it('should export a react component', () => {
    assert.equal(typeof Tooltip, 'function')
  })

  it('should render null', () => {
    let tooltip = renderer(<Tooltip parent="#hey" position="top" arrow="center" active={false}>Hey this is a tooltip</Tooltip>)

    assert.equal(tooltip, null)
  })
})


text:
require '../ex1/call'
require '../ex1/called'
require 'rspec'

describe "callメソッド" do
  context 'idを100と指定した時' do
    let(:param) { {'id' => 100} }
    let(:expected) { {:name => 'foo', :value => 777} }
    it 'idが100のデータが返されること' do
      called_ins = double("called")
      allow(called_ins).to receive(:get).and_return({:name => 'foo', :value => 777})
      allow(Call).to receive(:new).and_return(called_ins)

      expect(called_ins).to receive(:get).with(param)
      expect(called_ins.get).to eq(expected)

      # 実行
      ins = Call.new
      ins.get(param)
    end
  end
end


text:
import pyaudio
import numpy as np
import matplotlib.pyplot as plt
import struct
import scipy.io.wavfile as wavefile

CHUNK = 16000 * 2             # samples per frame
FORMAT = pyaudio.paInt16     # audio format (bytes per sample?)
CHANNELS = 1                 # single channel for microphone
RATE = 16000                 # samples per second

p = pyaudio.PyAudio()

stream = p.open(
    format=FORMAT,
    channels=CHANNELS,
    rate=RATE,
    input=True,
    output=True,
    frames_per_buffer=CHUNK
)

# binary data
data = stream.read(CHUNK)

len(data)

# convert data to integers, make np array, then offset it by 127
data_int = struct.unpack(str(2 * CHUNK) + 'B', data)

test_int = np.array(data_int)

plt.plot(test_int)
plt.show()

# create np array and offset by 128
data_np = np.array(data_int, dtype='b')[::2] + 128

wavefile.write('d:/test.wav', 16000, test_int)


text:
import javax.annotation.Resource;

import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.alibaba.fastjson.JSON;
import com.cn.lpd.entity.User;
import com.cn.lpd.service.UserService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring-mybatis.xml"})
public class TestMybatis {
		private static Logger logger = Logger.getLogger(TestMybatis.class);

		@Resource
		private UserService userService = null;

		@Test
		public void test(){
			User user = userService.findUserById(1);
			logger.info(JSON.toJSONString(user));
		}
}


text:
package org.apache.wicket.markup.html.form;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;

import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.model.PropertyModel;

/**
 * @author Juergen Donnerstag
 */
public class DropDownChoiceTestPage extends WebPage
{
	/** */
	public class DocumentType
	{
		private String name;
		private boolean hasExpiryDate;

		/**
		 * Construct.
		 *
		 * @param name
		 * @param expiryDate
		 */
		public DocumentType(String name, boolean expiryDate)
		{
			this.name = name;
			hasExpiryDate = expiryDate;
		}

		/**
		 * Gets name.
		 *
		 * @return name
		 */
		public String getName()
		{
			return name;
		}

		/**
		 * Sets name.
		 *
		 * @param name
		 *            name
		 */
		public void setName(String name)
		{
			this.name = name;
		}

		/**
		 * Gets hasExpiryDate.
		 *
		 * @return hasExpiryDate
		 */
		public boolean getHasExpiryDate()
		{
			return hasExpiryDate;
		}

		/**
		 * Sets hasExpiryDate.
		 *
		 * @param hasExpiryDate
		 *            hasExpiryDate
		 */
		public void setHasExpiryDate(boolean hasExpiryDate)
		{
			this.hasExpiryDate = hasExpiryDate;
		}
	}

	/**
	 *
	 */
	public enum MyEnum {
		A("a"), B("b"), C("c"), D("d"), E("e");

		MyEnum(String text)
		{
		}
	}

	public DocumentType dtype;

	public String myDate;

	/**
	 * Construct.
	 *
	 * @param name
	 */
	public DropDownChoiceTestPage()
	{
		Form<String> form = new MyForm("form");
		add(form);

		DocumentType[] docTypes = new DocumentType[3];
		docTypes[0] = new DocumentType("a", true);
		docTypes[1] = new DocumentType("b", false);
		docTypes[2] = new DocumentType("c", true);

		List<DocumentType> docTypes2 = new ArrayList<DocumentType>();
		docTypes2.add(new DocumentType("a", true));
		docTypes2.add(new DocumentType("b", false));
		docTypes2.add(new DocumentType("c", true));

		// List<DocumentType> allDocumentTypes = docTypes2;
		// List<DocumentType> allDocumentTypes = Arrays.asList(docTypes);
		List<MyEnum> allDocumentTypes = Arrays.asList(MyEnum.values());

		final DropDownChoice ddc = new DropDownChoice("dropdown", new PropertyModel(this, "dtype"),
			allDocumentTypes, new ChoiceRenderer("name"));

		TextField expiryDate = new TextField("text", new PropertyModel(this, "myDate"), Date.class)
		{
			@Override
			public boolean isRequired()
			{
				// ddc.validate();
				DocumentType dt = (DocumentType)ddc.getConvertedInput();
				return dt != null && dt.getHasExpiryDate();
			}
		};

		form.add(ddc);
		form.add(expiryDate);
	}

	/**
	 *
	 */
	public class MyForm extends Form<String>
	{
		private static final long serialVersionUID = 1L;

		/**
		 * Construct.
		 *
		 * @param id
		 */
		public MyForm(String id)
		{
			super(id);
		}
	}

	/**
	 * Gets dtype.
	 *
	 * @return dtype
	 */
	public DocumentType getDtype()
	{
		return dtype;
	}

	/**
	 * Sets dtype.
	 *
	 * @param dtype
	 *            dtype
	 */
	public void setDtype(DocumentType dtype)
	{
		this.dtype = dtype;
	}

	/**
	 * Gets myDate.
	 *
	 * @return myDate
	 */
	public String getMyDate()
	{
		return myDate;
	}

	/**
	 * Sets myDate.
	 *
	 * @param myDate
	 *            myDate
	 */
	public void setMyDate(String myDate)
	{
		this.myDate = myDate;
	}
}


text:
namespace Tdlr.Migrations
{
    using System;
    using System.Data.Entity.Migrations;

    public partial class init : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.AadObjects",
                c => new
                    {
                        AadObjectID = c.String(nullable: false, maxLength: 128),
                        DisplayName = c.String(nullable: false),
                    })
                .PrimaryKey(t => t.AadObjectID);

            CreateTable(
                "dbo.Tasks",
                c => new
                    {
                        TaskID = c.Int(nullable: false, identity: true),
                        TaskText = c.String(nullable: false),
                        Status = c.String(nullable: false),
                        Creator = c.String(nullable: false),
                        CreatorName = c.String(nullable: false),
                    })
                .PrimaryKey(t => t.TaskID);

            CreateTable(
                "dbo.TokenCacheEntries",
                c => new
                    {
                        TokenCacheEntryID = c.Int(nullable: false, identity: true),
                        userObjId = c.String(),
                        cacheBits = c.Binary(),
                        LastWrite = c.DateTime(nullable: false),
                    })
                .PrimaryKey(t => t.TokenCacheEntryID);

            CreateTable(
                "dbo.Shares",
                c => new
                    {
                        TaskID = c.Int(nullable: false),
                        AadObjectID = c.String(nullable: false, maxLength: 128),
                    })
                .PrimaryKey(t => new { t.TaskID, t.AadObjectID })
                .ForeignKey("dbo.Tasks", t => t.TaskID, cascadeDelete: true)
                .ForeignKey("dbo.AadObjects", t => t.AadObjectID, cascadeDelete: true)
                .Index(t => t.TaskID)
                .Index(t => t.AadObjectID);

        }

        public override void Down()
        {
            DropForeignKey("dbo.Shares", "AadObjectID", "dbo.AadObjects");
            DropForeignKey("dbo.Shares", "TaskID", "dbo.Tasks");
            DropIndex("dbo.Shares", new[] { "AadObjectID" });
            DropIndex("dbo.Shares", new[] { "TaskID" });
            DropTable("dbo.Shares");
            DropTable("dbo.TokenCacheEntries");
            DropTable("dbo.Tasks");
            DropTable("dbo.AadObjects");
        }
    }
}


text:
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="it.thoson.uipattern.player.ExoPlayerFragment">

    <com.google.android.exoplayer2.ui.SimpleExoPlayerView
        android:id="@+id/player_view"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:focusable="true"
        app:controller_layout_id="@layout/player_custom_controller" />

</FrameLayout>


text:
package tracedvm

import (
	"context"

	"go.opentelemetry.io/otel/attribute"

	oteltrace "go.opentelemetry.io/otel/trace"

	"github.com/ava-labs/avalanchego/ids"
	"github.com/ava-labs/avalanchego/snow/engine/snowman/block"
)

func (vm *blockVM) VerifyHeightIndex(ctx context.Context) error {
	if vm.hVM == nil {
		return block.ErrHeightIndexedVMNotImplemented
	}

	ctx, span := vm.tracer.Start(ctx, "blockVM.VerifyHeightIndex")
	defer span.End()

	return vm.hVM.VerifyHeightIndex(ctx)
}

func (vm *blockVM) GetBlockIDAtHeight(ctx context.Context, height uint64) (ids.ID, error) {
	if vm.hVM == nil {
		return ids.Empty, block.ErrHeightIndexedVMNotImplemented
	}

	ctx, span := vm.tracer.Start(ctx, "blockVM.GetBlockIDAtHeight", oteltrace.WithAttributes(
		attribute.Int64("height", int64(height)),
	))
	defer span.End()

	return vm.hVM.GetBlockIDAtHeight(ctx, height)
}


text:
function showText( number )
{
	// show the output box
	document.getElementById( "output-box" ).style.display = "block";
	if( number == 1 )
	{
		document.getElementById( "output-text" ).innerHTML = "Tutor.com is a 24/7 tutoring service that assists with various subjects, including research.";
	}
	else if( number == 2 )
	{
		document.getElementById( "output-text" ).innerHTML = "Merriam-Webster.com has quizzes and fun facts about words. A free version is also available.";
	}
	else if( number == 3 )
	{
		document.getElementById( "output-text" ).innerHTML = "Bartleby.com allows you to search for specific quotes at no cost.";
	}
	else if( number == 4 )
	{
		document.getElementById( "output-text" ).innerHTML = "Thesaurus.com allows you to search for specific words and synonyms, and includes a pronunciation tool.";
	}
}

function hideOutput()
{
	document.getElementById( "output-box" ).style.display = "none";
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Shopping_Website
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );

            routes.MapRoute(
              name: "Products",
              url: "{controller}/{action}/{id}",
              defaults: new { controller = "Product", action = "Index", id = UrlParameter.Optional }
            );

            routes.MapRoute(
              name: "Login",
              url: "{controller}/{action}/{id}",
              defaults: new { controller = "Login", action = "Index", id = UrlParameter.Optional }
            );

            routes.MapRoute(
             name: "Admin",
             url: "{controller}/{action}/{id}",
             defaults: new { controller = "Admin", action = "Index", id = UrlParameter.Optional }
           );

            routes.MapRoute(
             name: "Customer",
             url: "{controller}/{action}/{id}",
             defaults: new { controller = "Customer", action = "Index", id = UrlParameter.Optional }
           );

        }
    }
}


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace Microsoft.DocAsCode.Metadata.ManagedReference
{
    using System;
    using System.IO;

    using Microsoft.DocAsCode.Common;
    using Microsoft.DocAsCode.Plugins;

    internal static class FileInformationExtension
    {
        public static bool IsSupportedProject(this FileInformation file)
        {
            return file.Type == FileType.Project || file.Type == FileType.ProjectJsonProject;
        }
    }
}


text:
// Copyright 2016 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#import <CoreBluetooth/CoreBluetooth.h>
#import <Foundation/Foundation.h>
#import "CBAdvertisingDriver.h"
#import "CBScanningDriver.h"

extern NSString *_Nonnull kCBDriverErrorDomain;

typedef enum {
  CBDriverErrorUnsupportedHardware = -100,
  CBDriverErrorUnauthorized = -101,
  CBDriverErrorServiceAlreadyAdded = -102,
} CBDriverError;

@interface CBDriver : NSObject

@property(nonatomic, strong) dispatch_queue_t _Nonnull queue;
@property(nonatomic) CBAdvertisingDriver *_Nullable advertisingDriver;
@property(nonatomic) CBScanningDriver *_Nullable scanningDriver;

/** Shared instance for the CBDriver -- only one can ever be alive to correctly use CoreBluetooth.
 */
+ (CBDriver *_Nonnull)instance;

/** Call to remove all services, stop all scans, and remove central/peripheral managers. */
+ (void)shutdown;

@end

#pragma mark - CGO exports

typedef struct {
  char *_Nonnull uuid;
  const void *_Nonnull data;
  int dataLength;
} CBDriverCharacteristicMapEntry;

// Debug String via CGO
char *_Nonnull v23_cbdriver_debug_string();

// Advertising via CGO
BOOL v23_cbdriver_addService(const char *_Nonnull uuid,
                             CBDriverCharacteristicMapEntry *_Nonnull entries, int entriesLength,
                             char *_Nullable *_Nullable errorOut);
int v23_cbdriver_advertisingServiceCount();
void v23_cbdriver_removeService(const char *_Nonnull uuid);
void v23_cbdriver_setAdRotateDelay(float seconds);

// Discovery via CGO
BOOL v23_cbdriver_startScan(const char *_Nonnull *_Nonnull uuids, int uuidsLength,
                            const char *_Nonnull baseUuid, const char *_Nonnull maskUuid,
                            char *_Nullable *_Nullable errorOut);
void v23_cbdriver_stopScan();

// Removes the driver from memory and stops all bluetooth activity
void v23_cbdriver_clean();


text:
package info.motteke.annotation_mapper.internal.utils;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class MultiValueMap<K, V> implements Map<K, Collection<V>> {

    private final Map<K, Collection<V>> base;

    public MultiValueMap() {
        this(new HashMap<K, Collection<V>>());
    }

    public MultiValueMap(Map<K, Collection<V>> base) {
        this.base = base;
    }

    protected Collection<V> newCollection() {
        return new ArrayList<V>();
    }

    @Override
    public int size() {
        return base.size();
    }

    @Override
    public boolean isEmpty() {
        return base.isEmpty();
    }

    @Override
    public boolean containsKey(Object key) {
        return base.containsKey(key);
    }

    @Override
    public boolean containsValue(Object value) {
        return base.containsValue(value);
    }

    @Override
    @SuppressWarnings("unchecked")
    public Collection<V> get(Object key) {
        Collection<V> value = base.get(key);

        if (value == null) {
            value = newCollection();
            base.put((K) key, value);
        }

        return value;
    }

    @Override
    public Collection<V> put(K key, Collection<V> value) {
        return base.get(key);
    }

    @Override
    public Collection<V> remove(Object key) {
        return base.remove(key);
    }

    @Override
    public void putAll(Map<? extends K, ? extends Collection<V>> m) {
        base.putAll(m);
    }

    @Override
    public void clear() {
        base.clear();
    }

    @Override
    public Set<K> keySet() {
        return base.keySet();
    }

    @Override
    public Collection<Collection<V>> values() {
        return base.values();
    }

    @Override
    public Set<java.util.Map.Entry<K, Collection<V>>> entrySet() {
        return base.entrySet();
    }

    @Override
    public int hashCode() {
        return base.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        return base.equals(obj);
    }

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


text:
from django.template import TemplateSyntaxError, TemplateDoesNotExist, Variable
from django.template import Library, Node, TextNode
from django.template.loader import get_template, get_template_from_string, find_template_source
from django.conf import settings
from django.utils.safestring import mark_safe

register = Library()

class ExtendsError(Exception):
    pass

class BlockNode(Node):
    def __init__(self, name, nodelist, parent=None):
        self.name, self.nodelist, self.parent = name, nodelist, parent

    def __repr__(self):
        return "<Block Node: %s. Contents: %r>" % (self.name, self.nodelist)

    def render(self, context):
        context.push()
        # Save context in case of block.super().
        self.context = context
        context['block'] = self
        result = self.nodelist.render(context)
        context.pop()
        return result

    def super(self):
        if self.parent:
            return mark_safe(self.parent.render(self.context))
        return ''

    def add_parent(self, nodelist):
        if self.parent:
            self.parent.add_parent(nodelist)
        else:
            self.parent = BlockNode(self.name, nodelist)

class ExtendsNode(Node):
    must_be_first = True

    def __init__(self, nodelist, parent_name, parent_name_expr, template_dirs=None):
        self.nodelist = nodelist
        self.parent_name, self.parent_name_expr = parent_name, parent_name_expr
        self.template_dirs = template_dirs

    def __repr__(self):
        if self.parent_name_expr:
            return "<ExtendsNode: extends %s>" % self.parent_name_expr.token
        return '<ExtendsNode: extends "%s">' % self.parent_name

    def get_parent(self, context):
        if self.parent_name_expr:
            self.parent_name = self.parent_name_expr.resolve(context)
        parent = self.parent_name
        if not parent:
            error_msg = "Invalid template name in 'extends' tag: %r." % parent
            if self.parent_name_expr:
                error_msg += " Got this from the '%s' variable." % self.parent_name_expr.token
            raise TemplateSyntaxError, error_msg
        if hasattr(parent, 'render'):
            return parent # parent is a Template object
        try:
            source, origin = find_template_source(parent, self.template_dirs)
        except TemplateDoesNotExist:
            raise TemplateSyntaxError, "Template %r cannot be extended, because it doesn't exist" % parent
        else:
            return get_template_from_string(source, origin, parent)

    def render(self, context):
        compiled_parent = self.get_parent(context)
        parent_blocks = dict([(n.name, n) for n in compiled_parent.nodelist.get_nodes_by_type(BlockNode)])
        for block_node in self.nodelist.get_nodes_by_type(BlockNode):
            # Check for a BlockNode with this node's name, and replace it if found.
            try:
                parent_block = parent_blocks[block_node.name]
            except KeyError:
                # This BlockNode wasn't found in the parent template, but the
                # parent block might be defined in the parent's *parent*, so we
                # add this BlockNode to the parent's ExtendsNode nodelist, so
                # it'll be checked when the parent node's render() is called.

                # Find out if the parent template has a parent itself
                for node in compiled_parent.nodelist:
                    if not isinstance(node, TextNode):
                        # If the first non-text node is an extends, handle it.
                        if isinstance(node, ExtendsNode):
                            node.nodelist.append(block_node)
                        # Extends must be the first non-text node, so once you find
                        # the first non-text node you can stop looking.
                        break
            else:
                # Keep any existing parents and add a new one. Used by BlockNode.
                parent_block.parent = block_node.parent
                parent_block.add_parent(parent_block.nodelist)
                parent_block.nodelist = block_node.nodelist
        return compiled_parent.render(context)

class ConstantIncludeNode(Node):
    def __init__(self, template_path):
        try:
            t = get_template(template_path)
            self.template = t
        except:
            if settings.TEMPLATE_DEBUG:
                raise
            self.template = None

    def render(self, context):
        if self.template:
            return self.template.render(context)
        else:
            return ''

class IncludeNode(Node):
    def __init__(self, template_name):
        self.template_name = Variable(template_name)

    def render(self, context):
        try:
            template_name = self.template_name.resolve(context)
            t = get_template(template_name)
            return t.render(context)
        except TemplateSyntaxError, e:
            if settings.TEMPLATE_DEBUG:
                raise
            return ''
        except:
            return '' # Fail silently for invalid included templates.

def do_block(parser, token):
    """
    Define a block that can be overridden by child templates.
    """
    bits = token.contents.split()
    if len(bits) != 2:
        raise TemplateSyntaxError, "'%s' tag takes only one argument" % bits[0]
    block_name = bits[1]
    # Keep track of the names of BlockNodes found in this template, so we can
    # check for duplication.
    try:
        if block_name in parser.__loaded_blocks:
            raise TemplateSyntaxError, "'%s' tag with name '%s' appears more than once" % (bits[0], block_name)
        parser.__loaded_blocks.append(block_name)
    except AttributeError: # parser.__loaded_blocks isn't a list yet
        parser.__loaded_blocks = [block_name]
    nodelist = parser.parse(('endblock', 'endblock %s' % block_name))
    parser.delete_first_token()
    return BlockNode(block_name, nodelist)

def do_extends(parser, token):
    """
    Signal that this template extends a parent template.

    This tag may be used in two ways: ``{% extends "base" %}`` (with quotes)
    uses the literal value "base" as the name of the parent template to extend,
    or ``{% extends variable %}`` uses the value of ``variable`` as either the
    name of the parent template to extend (if it evaluates to a string) or as
    the parent tempate itelf (if it evaluates to a Template object).
    """
    bits = token.contents.split()
    if len(bits) != 2:
        raise TemplateSyntaxError, "'%s' takes one argument" % bits[0]
    parent_name, parent_name_expr = None, None
    if bits[1][0] in ('"', "'") and bits[1][-1] == bits[1][0]:
        parent_name = bits[1][1:-1]
    else:
        parent_name_expr = parser.compile_filter(bits[1])
    nodelist = parser.parse()
    if nodelist.get_nodes_by_type(ExtendsNode):
        raise TemplateSyntaxError, "'%s' cannot appear more than once in the same template" % bits[0]
    return ExtendsNode(nodelist, parent_name, parent_name_expr)

def do_include(parser, token):
    """
    Loads a template and renders it with the current context.

    Example::

        {% include "foo/some_include" %}
    """
    bits = token.contents.split()
    if len(bits) != 2:
        raise TemplateSyntaxError, "%r tag takes one argument: the name of the template to be included" % bits[0]
    path = bits[1]
    if path[0] in ('"', "'") and path[-1] == path[0]:
        return ConstantIncludeNode(path[1:-1])
    return IncludeNode(bits[1])

register.tag('block', do_block)
register.tag('extends', do_extends)
register.tag('include', do_include)


text:
#ifndef _SYS_GMON_H_
#define _SYS_GMON_H_

#include <machine/profile.h>

/*
 * Structure prepended to gmon.out profiling data file.
 */
struct gmonhdr {
	u_long	lpc;		/* base pc address of sample buffer */
	u_long	hpc;		/* max pc address of sampled buffer */
	int	ncnt;		/* size of sample buffer (plus this header) */
	int	version;	/* version number */
	int	profrate;	/* profiling clock rate */
	int	histcounter_type; /* size (in bits) and sign of HISTCOUNTER */
	int	spare[2];	/* reserved */
};
#define GMONVERSION	0x00051879

/*
 * Type of histogram counters used in the kernel.
 */
#ifdef GPROF4
#define	HISTCOUNTER	int64_t
#else
#define	HISTCOUNTER	unsigned short
#endif

/*
 * Fraction of text space to allocate for histogram counters.
 * We allocate counters at the same or higher density as function
 * addresses, so that each counter belongs to a unique function.
 * A lower density of counters would give less resolution but a
 * higher density would be wasted.
 */
#define	HISTFRACTION	(FUNCTION_ALIGNMENT / sizeof(HISTCOUNTER) == 0 \
			 ? 1 : FUNCTION_ALIGNMENT / sizeof(HISTCOUNTER))

/*
 * Fraction of text space to allocate for from hash buckets.
 * The value of HASHFRACTION is based on the minimum number of bytes
 * of separation between two subroutine call points in the object code.
 * Given MIN_SUBR_SEPARATION bytes of separation the value of
 * HASHFRACTION is calculated as:
 *
 *	HASHFRACTION = MIN_SUBR_SEPARATION / (2 * sizeof(short) - 1);
 *
 * For example, on the VAX, the shortest two call sequence is:
 *
 *	calls	$0,(r0)
 *	calls	$0,(r0)
 *
 * which is separated by only three bytes, thus HASHFRACTION is
 * calculated as:
 *
 *	HASHFRACTION = 3 / (2 * 2 - 1) = 1
 *
 * Note that the division above rounds down, thus if MIN_SUBR_FRACTION
 * is less than three, this algorithm will not work!
 *
 * In practice, however, call instructions are rarely at a minimal
 * distance.  Hence, we will define HASHFRACTION to be 2 across all
 * architectures.  This saves a reasonable amount of space for
 * profiling data structures without (in practice) sacrificing
 * any granularity.
 */
/*
 * XXX I think the above analysis completely misses the point.  I think
 * the point is that addresses in different functions must hash to
 * different values.  Since the hash is essentially division by
 * sizeof(unsigned short), the correct formula is:
 *
 * 	HASHFRACTION = MIN_FUNCTION_ALIGNMENT / sizeof(unsigned short)
 *
 * Note that he unsigned short here has nothing to do with the one for
 * HISTFRACTION.
 *
 * Hash collisions from a two call sequence don't matter.  They get
 * handled like collisions for calls to different addresses from the
 * same address through a function pointer.
 */
#define	HASHFRACTION	(FUNCTION_ALIGNMENT / sizeof(unsigned short) == 0 \
			 ? 1 : FUNCTION_ALIGNMENT / sizeof(unsigned short))

/*
 * percent of text space to allocate for tostructs with a minimum.
 */
#define ARCDENSITY	2
#define MINARCS		50

/*
 * Limit on the number of arcs to so that arc numbers can be stored in
 * `*froms' and stored and incremented without overflow in links.
 */
#define MAXARCS		(((u_long)1 << (8 * sizeof(u_short))) - 2)

struct tostruct {
	u_long	selfpc;
	long	count;
	u_short	link;
	u_short pad;
};

/*
 * a raw arc, with pointers to the calling site and
 * the called site and a count.
 */
struct rawarc {
	u_long	raw_frompc;
	u_long	raw_selfpc;
	long	raw_count;
};

/*
 * general rounding functions.
 */
#define ROUNDDOWN(x,y)	rounddown(x,y)
#define ROUNDUP(x,y)	roundup(x,y)

/*
 * The profiling data structures are housed in this structure.
 */
struct gmonparam {
	int		state;
	HISTCOUNTER	*kcount;
	u_long		kcountsize;
	u_short		*froms;
	u_long		fromssize;
	struct tostruct	*tos;
	u_long		tossize;
	long		tolimit;
	uintfptr_t	lowpc;
	uintfptr_t	highpc;
	u_long		textsize;
	u_long		hashfraction;
	int		profrate;	/* XXX wrong type to match gmonhdr */
	HISTCOUNTER	*cputime_count;
	int		cputime_overhead;
	HISTCOUNTER	*mcount_count;
	int		mcount_overhead;
	int		mcount_post_overhead;
	int		mcount_pre_overhead;
	HISTCOUNTER	*mexitcount_count;
	int		mexitcount_overhead;
	int		mexitcount_post_overhead;
	int		mexitcount_pre_overhead;
	int		histcounter_type;
};
extern struct gmonparam _gmonparam;

/*
 * Possible states of profiling.
 */
#define	GMON_PROF_ON	0
#define	GMON_PROF_BUSY	1
#define	GMON_PROF_ERROR	2
#define	GMON_PROF_OFF	3
#define	GMON_PROF_HIRES	4

/*
 * Sysctl definitions for extracting profiling information from the kernel.
 */
#define	GPROF_STATE	0	/* int: profiling enabling variable */
#define	GPROF_COUNT	1	/* struct: profile tick count buffer */
#define	GPROF_FROMS	2	/* struct: from location hash bucket */
#define	GPROF_TOS	3	/* struct: destination/count structure */
#define	GPROF_GMONPARAM	4	/* struct: profiling parameters (see above) */

#ifdef _KERNEL

#define	KCOUNT(p,index) \
	((p)->kcount[(index) / (HISTFRACTION * sizeof(HISTCOUNTER))])
#define	PC_TO_I(p, pc)	((uintfptr_t)(pc) - (uintfptr_t)(p)->lowpc)

#ifdef GUPROF

#define	CALIB_SCALE	1000

extern int	cputime_bias;

int	cputime(void);
void	nullfunc_loop_profiled(void);
void	nullfunc_profiled(void);
void	startguprof(struct gmonparam *p);
void	stopguprof(struct gmonparam *p);

#else /* !GUPROF */

#define	startguprof(p)
#define	stopguprof(p)

#endif /* GUPROF */

void	empty_loop(void);
void	kmupetext(uintfptr_t nhighpc);
void	mexitcount(uintfptr_t selfpc);
void	nullfunc(void);
void	nullfunc_loop(void);

#else /* !_KERNEL */

#include <sys/cdefs.h>

__BEGIN_DECLS
void	moncontrol(int);
void	monstartup(u_long, u_long);
__END_DECLS

#endif /* _KERNEL */

#endif /* !_SYS_GMON_H_ */


text:
@interface FTRCollectionViewController : UIViewController <
    UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout>

@property(weak, nonatomic) IBOutlet UICollectionView *collectionView;
@end


text:
"""
   Copyright 2014 CryptoIM Development Team

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

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

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

import cryptoim.xmpp as xmpp
from cryptoim.cli import CryptoShell

from nose.tools import ok_, eq_, nottest
import time

def init_messengers():
    """
        Initializes the messengers and connects them
    """

    crypto_shell = CryptoShell('main.cfg')

    messenger = xmpp.XMPPMessenger('cryptoim@jabbim.sk', 'crypto_test', crypto_shell)
    messenger.connect_server(should_block=False)

    crypto_shell2 = CryptoShell('main.cfg')
    messenger2 = xmpp.XMPPMessenger('cryptoim2@jabbim.sk', 'crypto_test2', crypto_shell2)
    messenger2.connect_server(should_block=False)

    waitForConnection(messenger, True)
    waitForConnection(messenger2, True)
    return messenger, messenger2

def test_connect():

    messenger, messenger2 = init_messengers()
    eq_(messenger.is_connected(), True)
    eq_(messenger2.is_connected(), True)

    messenger.disconnect_server()
    waitForConnection(messenger, False)
    messenger2.disconnect_server()
    waitForConnection(messenger2, False)

def test_send_message():

    messenger, messenger2 = init_messengers()
    waitForConnection(messenger, True)
    waitForConnection(messenger2, True)
    waitForSession(messenger, True)
    waitForSession(messenger2, True)
    msg = 'Hello, CryptoIM check_send_message!'
    recipient = messenger2.client.boundjid.full
    messenger.send_message(recipient, msg)

    waitForNonEmptyList(messenger.client.sent_msg_list)

    messenger.disconnect_server()
    messenger2.disconnect_server()
    waitForConnection(messenger, False)
    waitForConnection(messenger2, False)

    # Assert that messenger sent the message (it is bound to be sent after disconnect if it waits)
    ok_(1 == len(messenger.client.sent_msg_list))
    eq_(len(messenger.client.sent_jid_list), len(messenger.client.sent_msg_list))
    eq_(msg, messenger.client.sent_msg_list[-1])
    eq_(recipient, messenger.client.sent_jid_list[-1])

def test_connect_fail():

    crypto_shell = CryptoShell('main.cfg')

    # Wrong host
    messenger = xmpp.XMPPMessenger('cryptoim@jabbim2.sk', 'crypto_test', crypto_shell)
    assertDisconnect(messenger)

    # Wrong pass
    messenger = xmpp.XMPPMessenger('cryptoim@jabbim.sk', 'wrong_pass', crypto_shell)
    assertDisconnect(messenger)

    # Wrong name
    messenger = xmpp.XMPPMessenger('cryptoim0@jabbim.sk', 'crypto_test', crypto_shell)
    assertDisconnect(messenger)

def assertDisconnect(messenger):

    messenger.connect_server(should_block=False, should_reattempt=False)

    waitForConnection(messenger, False)

    messenger.disconnect_server()
    waitForConnection(messenger, False)

def test_receive_message():

    messenger, messenger2 = init_messengers()

    # Assert connected
    waitForConnection(messenger, True)
    waitForConnection(messenger2, True)
    waitForSession(messenger, True)
    waitForSession(messenger2, True)

    # Send and receive message
    plaintext = 'Hello, CryptoIM check_receive_message!'
    messenger.client.send_message(mto = messenger2.client.boundjid.full, mbody = 'test', mtype = 'error') # Test for dropping non-chat messages
    ciphertext = messenger.send_message(messenger2.client.boundjid.full, plaintext)

    waitForNonEmptyList(messenger2.client.received_msg_list)

    # Disconnect
    messenger.disconnect_server()
    waitForConnection(messenger, False)
    messenger2.disconnect_server()
    waitForConnection(messenger2, False)

    # Assert that messenger2 got it (it is bound to be received after disconnect if it waits)
    print(('Received msg list: ', messenger2.client.received_msg_list))
    print(('Received jid list: ', messenger2.client.received_jid_list))

    ok_(1 == len(messenger2.client.received_msg_list))
    eq_(len(messenger2.client.received_jid_list), len(messenger2.client.received_msg_list))
    eq_(plaintext, messenger2.client.received_msg_list[-1])
    eq_(messenger.client.boundjid.full, messenger2.client.received_jid_list[-1])

# Test tools

def waitForNonEmptyList(lst, timeout=100):
    """
        Waits until the list is non-empty.
        Timeout is set to 100 (in tenths of a second).
    """

    counter = 0
    while len(lst) < 1:
        if counter > timeout: break
        time.sleep(0.1)
        counter += 1
    ok_(len(lst) > 0)

def waitForConnection(messenger, should_be_connected, timeout=100):
    """
        Waits until a connection is estabilished.
        Timeout is set to 100 (in tenths of a second).
    """

    counter = 0
    while not messenger.is_connected() == should_be_connected:
        if counter > timeout: break
        time.sleep(0.1)
        counter += 1
    eq_(messenger.is_connected(), should_be_connected)

def waitForSession(messenger, should_be_in_session, timeout=100):
    """
        Waits until a session is estabilished.
        Timeout is set to 100 (in tenths of a second).
    """

    counter = 0
    while not messenger.is_in_session() == should_be_in_session:
        if counter > timeout: break
        time.sleep(0.1)
        counter += 1
    eq_(messenger.is_in_session(), should_be_in_session)


text:
package org.araqne.logdb.query.parser;

import java.util.List;

import org.araqne.logdb.AbstractQueryCommandParser;
import org.araqne.logdb.QueryCommand;
import org.araqne.logdb.QueryContext;
import org.araqne.logdb.QueryParserService;
import org.araqne.logdb.query.command.Union;

/**
 * @since 2.2.13
 * @author xeraph
 *
 */
public class UnionParser extends AbstractQueryCommandParser {

	private QueryParserService queryParserService;

	public UnionParser(QueryParserService queryParserService) {
		this.queryParserService = queryParserService;
		setDescriptions("Merge result set of sub-query. `union` runs in parallel, and do not guarantee order.",
				"서브 쿼리의 결과를 병합합니다. union은 다른 쿼리와 병행하여 실행되므로 출력 순서를 보장하지 않습니다. 통계 처리를 수행하는 경우처럼, 순서가 중요하지 않으면서 높은 수행 성능이 필요할 때에 주로 사용합니다.");
	}

	@Override
	public String getCommandName() {
		return "union";
	}

	@Override
	public QueryCommand parse(QueryContext context, String commandString) {
		int b = commandString.indexOf('[');
		int e = commandString.lastIndexOf(']');

		QueryContext subQueryContext = new QueryContext(context.getSession(), context);
		String subQueryString = commandString.substring(b + 1, e).trim();
		List<QueryCommand> commands = queryParserService.parseCommands(subQueryContext, subQueryString);
		return new Union(context, commands);
	}
}


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

<!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

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

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

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.apache.jackrabbit</groupId>
    <artifactId>oak-parent</artifactId>
    <version>1.45-SNAPSHOT</version>
    <relativePath>../oak-parent/pom.xml</relativePath>
  </parent>

  <artifactId>oak-exercise</artifactId>
  <name>Oak Exercises</name>
  <packaging>bundle</packaging>

  <properties>
    <skip.deployment>false</skip.deployment>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-failsafe-plugin</artifactId>
        <configuration>
          <systemPropertyVariables>
            <java.util.logging.config.file>
              src/test/resources/logging.properties
            </java.util.logging.config.file>
          </systemPropertyVariables>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <configuration>
          <instructions>
            <Embed-Dependency>
            </Embed-Dependency>
            <Embed-Transitive>true</Embed-Transitive>
            <Import-Package>
              <!-- OAK-7182 -->${guava.osgi.import},
              *;resolution:=optional
            </Import-Package>
            <Export-Package>
            </Export-Package>
            <DynamicImport-Package>
              org.apache.felix.jaas.boot
            </DynamicImport-Package>
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>javax.jcr</groupId>
      <artifactId>jcr</artifactId>
      <version>2.0</version>
    </dependency>

    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-jackrabbit-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-core</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-security-spi</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-commons</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-auth-external</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-authorization-cug</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-authorization-principalbased</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>jackrabbit-jcr-commons</artifactId>
      <version>${jackrabbit.version}</version>
    </dependency>

    <!-- Nullability annotations -->
    <dependency>
      <groupId>org.jetbrains</groupId>
      <artifactId>annotations</artifactId>
    </dependency>

    <!-- OSGi -->
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.annotation</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.service.component.annotations</artifactId>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.service.metatype.annotations</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.felix</groupId>
      <artifactId>org.apache.felix.jaas</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.compendium</artifactId>
      <scope>provided</scope>
    </dependency>

    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>jackrabbit-jcr-tests</artifactId>
      <version>${jackrabbit.version}</version>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-core</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-jcr</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-jcr</artifactId>
      <version>${project.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-segment-tar</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.jackrabbit</groupId>
      <artifactId>oak-store-composite</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.sling</groupId>
      <artifactId>org.apache.sling.testing.osgi-mock</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
</project>


text:
DELIMITER $$
CREATE PROCEDURE `udp_login`(`username` VARCHAR(30), `password` VARCHAR(30))
BEGIN

IF (`username` NOT IN(SELECT u.`username` FROM `users` AS u)) THEN
	     SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Username does not exist!';
         ROLLBACK;
  END IF;

  IF (`password` NOT IN(SELECT u.`password` FROM `users` AS u)) THEN
	     SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'Password is incorrect!';
         ROLLBACK;
  END IF;

  IF (`username` IN(SELECT lu.`username` FROM `logged_in_users` AS lu)) THEN
	     SIGNAL SQLSTATE '45000' SET MESSAGE_TEXT = 'User is already logged in!';
         ROLLBACK;
  END IF;

  INSERT INTO `logged_in_users`(`id`, `username`, `password`, `email`)
  VALUES((SELECT u.`id` FROM `users` AS u WHERE `username` = u.`username`),
  `username`, `password`, (SELECT u.`email` FROM `users` AS u WHERE `username` = u.`username`));

END$$
DELIMITER ;


text:
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="org.dita-community.xhml-adjct">

  <!-- Use dc-preprocess instead normal preprocess -->
  <target name="dita2xhtml-adjct"
      depends="
      build-init,
      dc-preprocess,
      dita.map.xhtml,
      copy-css ,
      dita.topics.xhtml,
      dita.inner.topics.xhtml,
      dita.outer.topics.xhtml
      ">
    </target>

</project>


text:
package com.bardframework.bard.basic.filter;

import com.bardframework.bard.basic.ErrorResult;
import com.bardframework.bard.basic.GenericTester;
import com.bardframework.bard.core.Handler;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.hamcrest.CoreMatchers;
import org.junit.Test;

import javax.servlet.ServletException;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.io.IOException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;

public class ProduceFilterTest extends GenericTester {

    private ObjectMapper mapper = new ObjectMapper();

    @Test
    public void jsonTest() throws ServletException, IOException {
        request.setPathInfo("/produce-test/json");
        servlet.service(request, response);
        String content = response.getContentAsString();
        TesterClass tester = mapper.readValue(content, TesterClass.class);
        assertEquals(1, tester.a);
        assertThat(response.getHeader("Content-Type"),
            CoreMatchers.containsString("application/json"));
    }

    @Test
    public void otherTest() throws ServletException, IOException {
        request.setPathInfo("/produce-test/other");
        servlet.service(request, response);
        String content = response.getContentAsString();
        ErrorResult result = mapper.readValue(content, ErrorResult.class);
        assertEquals(500, result.code);
        assertThat(response.getHeader("Content-Type"),
            CoreMatchers.containsString("application/json"));
    }

    public static class TesterClass {
        public int a = 1;
    }

    @Path("/produce-test")
    public static class ProduceTestHandler extends Handler {
        @Path("/json")
        @Produces("application/json")
        public TesterClass jsonTest() {
            return new TesterClass();
        }

        @Path("/other")
        @Produces("application/other")
        public TesterClass otherTest() {
            return new TesterClass();
        }
    }

}


text:
package com.wyt.test.cxf.client;

/**
 * Please modify this class to meet your needs
 * This class is not complete
 */

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

/**
 * This class was generated by Apache CXF 2.7.18
 * 2016-07-31T22:05:51.360+08:00
 * Generated source version: 2.7.18
 *
 */
public final class HelloWebservice_HelloWebserviceImplPort_Client {

    private static final QName SERVICE_NAME = new QName("http://www.baidu.com", "HelloWebserviceImplService");

    private HelloWebservice_HelloWebserviceImplPort_Client() {
    }

    public static void main(String args[]) throws java.lang.Exception {
        URL wsdlURL = HelloWebserviceImplService.WSDL_LOCATION;
        if (args.length > 0 && args[0] != null && !"".equals(args[0])) {
            File wsdlFile = new File(args[0]);
            try {
                if (wsdlFile.exists()) {
                    wsdlURL = wsdlFile.toURI().toURL();
                } else {
                    wsdlURL = new URL(args[0]);
                }
            } catch (MalformedURLException e) {
                e.printStackTrace();
            }
        }

        HelloWebserviceImplService ss = new HelloWebserviceImplService(wsdlURL, SERVICE_NAME);
        HelloWebserviceClient port = ss.getHelloWebserviceImplPort();

        {
        System.out.println("Invoking sayhi...");
        java.lang.String _sayhi_userID = "Tom";
        java.lang.String _sayhi_location = "China";
        java.lang.String _sayhi__return = port.sayhi(_sayhi_userID, _sayhi_location);
        System.out.println("sayhi.result=" + _sayhi__return);

        }

        System.exit(0);
    }

}


text:
package sanchez.sergio.persistence.entities;

/**
 *
 * @author sergio
 */
public enum AuthorityEnum {
    ROLE_ADMIN, ROLE_USER, ROLE_ANONYMOUS;
}


text:
ACCEPTED

#### According to
International Plant Names Index

#### Published in
null

#### Original name
Rhysolepis emaciata H.Rob. & A.J.Moore

### Remarks
null


text:
'user strict';

var assert = require('chai').assert;
var authenticate = require('../index');

// assert.typeOf(authenticate, 'function');


text:
usergrid-sample-.net-messagee
=============================
Directions for use

1. Sign up for a free Apigee App Services account
2. In the organization that is created for you, create a user and give that user administrative privileges
3. Create an app in the organization
4. In the app, create as many test users as you like
5. Clone the following branch for the Usergrid sdk: https://github.com/apigee/usergrid-.net-sdk/tree/spike-thick-client and build it
6. Clone this repository.  Open the Messagee solution file in the top level folder.  Add references to the .dll files located in the UsergridSdk\bin\debug folder to the project
7. Build Messagee
8. Run the solution.  On the main screen choose the Settings menu item and input the admin user credentials, the org name and the application name

At this point, the users for that app should be populated.  Choosing a particular user and then choosing the User Settings menu option will allow you to control who that user is following
Connect a few users and do some posts.  Posts are automatically routed to users who are connected as followers