text:
#include "arm_compute/core/Types.h"
#include "arm_compute/runtime/CL/CLTensor.h"
#include "arm_compute/runtime/CL/CLTensorAllocator.h"
#include "arm_compute/runtime/CL/functions/CLDirectConvolutionLayer.h"
#include "tests/CL/CLAccessor.h"
#include "tests/PaddingCalculator.h"
#include "tests/datasets/DirectConvolutionLayerDataset.h"
#include "tests/datasets/ShapeDatasets.h"
#include "tests/framework/Asserts.h"
#include "tests/framework/Macros.h"
#include "tests/framework/datasets/Datasets.h"
#include "tests/validation/Validation.h"
#include "tests/validation/fixtures/DirectConvolutionLayerFixture.h"

namespace arm_compute
{
namespace test
{
namespace validation
{
namespace
{
RelativeTolerance<half>  tolerance_fp16(half(0.2));  /**< Tolerance for floating point tests */
RelativeTolerance<float> tolerance_fp32(0.05f);      /**< Tolerance for floating point tests */
constexpr float          abs_tolerance_f32(0.0001f); /**< Absolute tolerance for FP32 tests*/

constexpr float                      tolerance_num = 0.07f; /**< Tolerance number */
constexpr AbsoluteTolerance<uint8_t> tolerance_qasymm8(1);  /**< Tolerance for quantized tests */

const auto data_strides          = combine(framework::dataset::make("StrideX", 1, 3), framework::dataset::make("StrideY", 1, 3));
const auto data_strides_small    = combine(framework::dataset::make("StrideX", 1), framework::dataset::make("StrideY", 1));
const auto data_ksize_one        = combine(framework::dataset::make("PadX", 0, 1), combine(framework::dataset::make("PadY", 0, 1), framework::dataset::make("KernelSize", 1)));
const auto data_ksize_one_small  = combine(framework::dataset::make("PadX", 0), combine(framework::dataset::make("PadY", 0), framework::dataset::make("KernelSize", 1)));
const auto data_ksize_three      = combine(framework::dataset::make("PadX", 0, 2), combine(framework::dataset::make("PadY", 0, 2), framework::dataset::make("KernelSize", 3)));
const auto data_ksize_five       = combine(framework::dataset::make("PadX", 0, 3), combine(framework::dataset::make("PadY", 0, 3), framework::dataset::make("KernelSize", 5)));
const auto data_ksize_nine       = combine(framework::dataset::make("PadX", 0, 3), combine(framework::dataset::make("PadY", 0, 3), framework::dataset::make("KernelSize", 9)));
const auto data_ksize_nine_small = combine(framework::dataset::make("PadX", 0, 1), combine(framework::dataset::make("PadY", 0, 1), framework::dataset::make("KernelSize", 9)));

const auto data_all_kernels = concat(concat(data_ksize_one, data_ksize_three), data_ksize_five);

const auto data          = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides, data_all_kernels));
const auto data9x9       = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides, data_ksize_nine));
const auto data_small    = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides_small, data_ksize_one_small));
const auto data_small9x9 = combine(datasets::SmallDirectConvolutionShapes(), combine(data_strides_small, data_ksize_nine_small));

/** Direct convolution nightly data set. */
const auto data_nightly         = combine(data, framework::dataset::make("NumKernels", { 1, 4 }));
const auto data_nightly_9x9     = combine(data9x9, framework::dataset::make("NumKernels", { 1, 4 }));
const auto data_nightly_usecase = combine(framework::dataset::make("InputShape", { TensorShape{ 3U, 800U, 800U } }),
                                          combine(framework::dataset::make("StrideX", { 1 }),
                                                  combine(framework::dataset::make("StrideY", { 1 }),
                                                          combine(framework::dataset::make("PadX", { 4 }),
                                                                  combine(framework::dataset::make("PadY", { 4 }),
                                                                          combine(framework::dataset::make("KernelSize", 9),
                                                                                framework::dataset::make("NumKernels", { 16 })))))));

/** Direct convolution precommit data set. */
const auto data_precommit     = combine(data_small, framework::dataset::make("NumKernels", { 1 }));
const auto data_precommit_9x9 = combine(data_small9x9, framework::dataset::make("NumKernels", { 1 }));

/** Activation function Dataset*/
const auto ActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
{ ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 0.5f) });
} // namespace

TEST_SUITE(CL)
TEST_SUITE(DirectConvolutionLayer)

/** Check whether the configuration of a Direct Convolution layer with no
 * bias leads to a successful execution.
 */
TEST_CASE(NoBias, framework::DatasetMode::PRECOMMIT)
{
    const auto     src_shape     = TensorShape(27U, 13U, 2U);
    const auto     weights_shape = TensorShape(3U, 3U, 2U, 4U);
    const auto     bias_shape    = TensorShape(4U);
    const auto     dst_shape     = TensorShape(25U, 11U, 4U);
    constexpr auto dt            = DataType::F32;

    auto src     = create_tensor<CLTensor>(src_shape, dt);
    auto weights = create_tensor<CLTensor>(weights_shape, dt);
    auto dst     = create_tensor<CLTensor>(dst_shape, dt);

    const auto conv_info = PadStrideInfo(1, 1, 0, 0);

    // Create Direct Convolution function
    CLDirectConvolutionLayer conv{};
    conv.configure(&src, &weights, nullptr, &dst, conv_info);

    src.allocator()->allocate();
    weights.allocator()->allocate();
    dst.allocator()->allocate();

    library->fill_tensor_value(CLAccessor(src), 1.f);
    library->fill_tensor_value(CLAccessor(weights), 1.f);

    conv.run();

    // Compute reference to compare
    SimpleTensor<float> ref_src{ src_shape, dt };
    SimpleTensor<float> ref_weights{ weights_shape, dt };
    SimpleTensor<float> ref_bias{ bias_shape, dt };
    library->fill_tensor_value(ref_src, 1.f);
    library->fill_tensor_value(ref_weights, 1.f);
    // No bias
    library->fill_tensor_value(ref_bias, 0.f);
    auto ref_dst = reference::convolution_layer<float>(ref_src, ref_weights, ref_bias, dst_shape, conv_info);

    validate(CLAccessor(dst), ref_dst);
}

// *INDENT-OFF*
// clang-format off
DATA_TEST_CASE(Validate, framework::DatasetMode::ALL, zip(zip(zip(zip(zip(zip(
               framework::dataset::make("InputInfo", { TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching data type input/weights
                                                       TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Mismatching input feature maps
                                                       TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Unsupported kernel width
                                                       TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Non-rectangular weights dimensions
                                                       TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid weights dimensions
                                                       TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid stride
                                                       TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases size
                                                       TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid biases dimensions
                                                       TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Invalid output size
                                                       TensorInfo(TensorShape(27U, 13U, 2U), 1, DataType::F32), // Window shrink
                                                       TensorInfo(TensorShape(32U, 16U, 2U), 1, DataType::F32),
                                                     }),
               framework::dataset::make("WeightsInfo",{ TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F16),
                                                        TensorInfo(TensorShape(3U, 3U, 3U, 4U), 1, DataType::F32),
                                                        TensorInfo(TensorShape(11U, 11U, 2U, 4U), 1, DataType::F32),
                                                        TensorInfo(TensorShape(5U, 3U, 2U, 4U), 1, DataType::F32),
                                                        TensorInfo(TensorShape(3U, 3U, 2U, 4U, 3U), 1, DataType::F32),
                                                        TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
                                                        TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
                                                        TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
                                                        TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
                                                        TensorInfo(TensorShape(3U, 3U, 2U, 4U), 1, DataType::F32),
                                                        TensorInfo(TensorShape(1U, 1U, 2U, 4U), 1, DataType::F32),
                                                     })),
               framework::dataset::make("BiasesInfo",{ TensorInfo(TensorShape(4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(3U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(4U, 2U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(4U), 1, DataType::F32),
                                                     })),
               framework::dataset::make("OutputInfo",{ TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(26U, 11U, 4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(25U, 11U, 4U), 1, DataType::F32),
                                                       TensorInfo(TensorShape(32U, 16U, 4U), 1, DataType::F32),
                                                     })),
               framework::dataset::make("ConvInfo",  { PadStrideInfo(1, 1, 0, 0),
                                                       PadStrideInfo(1, 1, 0, 0),
                                                       PadStrideInfo(1, 1, 0, 0),
                                                       PadStrideInfo(1, 1, 0, 0),
                                                       PadStrideInfo(1, 1, 0, 0),
                                                       PadStrideInfo(3, 3, 0, 0),
                                                       PadStrideInfo(1, 1, 0, 0),
                                                       PadStrideInfo(1, 1, 0, 0),
                                                       PadStrideInfo(1, 1, 0, 0),
                                                       PadStrideInfo(1, 1, 0, 0),
                                                       PadStrideInfo(1, 1, 0, 0),
                                                      })),
                       framework::dataset::make("ActivationInfo",
{
    ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU)
})),
               framework::dataset::make("Expected", { false, false, false, false, false, false, false, false, false, false, true })),
               input_info, weights_info, biases_info, output_info, conv_info, act_info, expected)
{
    bool is_valid = bool(CLDirectConvolutionLayer::validate(&input_info.clone()->set_is_resizable(false), &weights_info.clone()->set_is_resizable(false), &biases_info.clone()->set_is_resizable(false), &output_info.clone()->set_is_resizable(false), conv_info, act_info));
    ARM_COMPUTE_EXPECT(is_valid == expected, framework::LogLevel::ERRORS);
}

template <typename T>
using CLDirectConvolutionLayerFixture = DirectConvolutionValidationFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>;
template <typename T>
using CLDirectConvolutionLayerMixedDataLayoutFixture = DirectConvolutionValidationFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T, true>;
template <typename T>
using CLDirectConvolutionValidationWithTensorShapesFixture = DirectConvolutionValidationWithTensorShapesFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>;
template <typename T>
using CLDirectConvolutionLayerQuantizedFixture = DirectConvolutionValidationQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>;
template <typename T>
using CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture = DirectConvolutionValidationQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T, true>;
template <typename T>
using CLDirectConvolutionValidationWithTensorShapesQuantizedFixture = DirectConvolutionValidationWithTensorShapesQuantizedFixture<CLTensor, CLAccessor, CLDirectConvolutionLayer, T>;

TEST_SUITE(NHWC)
TEST_SUITE(FP16)
FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT,
               combine(combine(combine(zip(zip(zip(zip(zip(zip(
               framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
                                                        TensorShape(19U, 5U, 16U, 4U),
                                                        TensorShape(13U, 5U, 17U, 2U),
                                                        TensorShape(32U, 37U, 13U) } ),
               framework::dataset::make("StrideX", { 1, 3, 1, 1 })),
               framework::dataset::make("StrideY", { 1, 3, 2, 1 })),
               framework::dataset::make("PadX", { 1, 3, 0, 4 })),
               framework::dataset::make("PadY", { 1, 3, 0, 4 })),
               framework::dataset::make("KernelSize", { 3, 8, 1, 9 })),
               framework::dataset::make("NumKernels", { 17, 3, 1, 19 })),
               framework::dataset::make("DataType",  DataType::F16)),
               framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
               framework::dataset::make("DataLayout", DataLayout::NHWC)))
{
    validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num);
}

FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY,
               combine(combine(combine(zip(zip(zip(zip(zip(zip(
               framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ),
               framework::dataset::make("StrideX", { 1 })),
               framework::dataset::make("StrideY", { 1 })),
               framework::dataset::make("PadX", { 1 })),
               framework::dataset::make("PadY", { 1 })),
               framework::dataset::make("KernelSize", { 9 })),
               framework::dataset::make("NumKernels", { 3 })),
               framework::dataset::make("DataType",  DataType::F16)),
               framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::IDENTITY) )),
               framework::dataset::make("DataLayout", DataLayout::NHWC)))
{
    validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num);
}

TEST_SUITE_END() // FP16

TEST_SUITE(FP32)
FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT,
               combine(combine(combine(zip(zip(zip(zip(zip(zip(
               framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
                                                        TensorShape(19U, 5U, 16U, 4U),
                                                        TensorShape(13U, 5U, 17U, 2U),
                                                        TensorShape(32U, 37U, 13U) } ),
               framework::dataset::make("StrideX", { 1, 3, 1, 1 })),
               framework::dataset::make("StrideY", { 1, 3, 2, 1 })),
               framework::dataset::make("PadX", { 1, 3, 0, 4 })),
               framework::dataset::make("PadY", { 1, 3, 0, 4 })),
               framework::dataset::make("KernelSize", { 3, 8, 1, 9 })),
               framework::dataset::make("NumKernels", { 17, 3, 1, 19 })),
               framework::dataset::make("DataType",  DataType::F32)),
               framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
               framework::dataset::make("DataLayout", DataLayout::NHWC)))
{
    validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
}
FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerMixedDataLayoutFixture<float>, framework::DatasetMode::PRECOMMIT,
               combine(combine(combine(zip(zip(zip(zip(zip(zip(
               framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
                                                        TensorShape(19U, 5U, 16U, 4U),
                                                        TensorShape(13U, 5U, 17U, 2U),
                                                        TensorShape(32U, 37U, 13U) } ),
               framework::dataset::make("StrideX", { 1 })),
               framework::dataset::make("StrideY", { 2 })),
               framework::dataset::make("PadX", { 1 })),
               framework::dataset::make("PadY", { 3 })),
               framework::dataset::make("KernelSize", { 3 })),
               framework::dataset::make("NumKernels", { 3 })),
               framework::dataset::make("DataType",  DataType::F32)),
               framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
               framework::dataset::make("DataLayout", DataLayout::NHWC)))
{
    validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY,
               combine(combine(combine(zip(zip(zip(zip(zip(zip(
               framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ),
               framework::dataset::make("StrideX", { 1 })),
               framework::dataset::make("StrideY", { 1 })),
               framework::dataset::make("PadX", { 1 })),
               framework::dataset::make("PadY", { 1 })),
               framework::dataset::make("KernelSize", { 9 })),
               framework::dataset::make("NumKernels", { 3 })),
               framework::dataset::make("DataType",  DataType::F32)),
               framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::IDENTITY) )),
               framework::dataset::make("DataLayout", DataLayout::NHWC)))
{
    validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
}
TEST_SUITE_END() // FP32

TEST_SUITE(Quantized)
TEST_SUITE(QASYMM8)
FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
               combine(combine(combine(combine(zip(zip(zip(zip(zip(zip(
               framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
                                                        TensorShape(19U, 5U, 16U, 4U),
                                                        TensorShape(13U, 5U, 17U, 2U),
                                                        TensorShape(32U, 37U, 13U) } ),
               framework::dataset::make("StrideX", { 1, 3, 1, 1 })),
               framework::dataset::make("StrideY", { 1, 3, 2, 1 })),
               framework::dataset::make("PadX", { 1, 3, 0, 4 })),
               framework::dataset::make("PadY", { 1, 3, 0, 4 })),
               framework::dataset::make("KernelSize", { 3, 8, 1, 9 })),
               framework::dataset::make("NumKernels", { 7, 3, 1, 3 })),
               framework::dataset::make("DataType",  DataType::QASYMM8)),
               framework::dataset::make("QuantizationInfo", QuantizationInfo(1.1f / 255, 10))),
               framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
               framework::dataset::make("DataLayout", DataLayout::NHWC)))
{
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<uint8_t>, framework::DatasetMode::PRECOMMIT,
               combine(combine(combine(combine(zip(zip(zip(zip(zip(zip(
               framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
                                                        TensorShape(19U, 5U, 16U, 4U),
                                                        TensorShape(13U, 5U, 17U, 2U),
                                                        TensorShape(32U, 37U, 13U) } ),
               framework::dataset::make("StrideX", { 1 })),
               framework::dataset::make("StrideY", { 2 })),
               framework::dataset::make("PadX", { 1 })),
               framework::dataset::make("PadY", { 1 })),
               framework::dataset::make("KernelSize", { 3 })),
               framework::dataset::make("NumKernels", { 3 })),
               framework::dataset::make("DataType",  DataType::QASYMM8)),
               framework::dataset::make("QuantizationInfo", QuantizationInfo(1.1f / 255, 10))),
               framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
               framework::dataset::make("DataLayout", DataLayout::NHWC)))
{
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
               combine(combine(combine(combine(zip(zip(zip(zip(zip(zip(
               framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ),
               framework::dataset::make("StrideX", { 1 })),
               framework::dataset::make("StrideY", { 1 })),
               framework::dataset::make("PadX", { 1 })),
               framework::dataset::make("PadY", { 1 })),
               framework::dataset::make("KernelSize", { 9 })),
               framework::dataset::make("NumKernels", { 3 })),
               framework::dataset::make("DataType",  DataType::QASYMM8)),
               framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))),
               framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
               framework::dataset::make("DataLayout", DataLayout::NHWC)))
{
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}

TEST_SUITE_END() // QASYMM8
TEST_SUITE(QASYMM8_SIGNED)
FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
               combine(combine(combine(combine(zip(zip(zip(zip(zip(zip(
               framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
                                                        TensorShape(19U, 5U, 16U, 4U),
                                                        TensorShape(13U, 5U, 17U, 2U),
                                                        TensorShape(32U, 37U, 13U) } ),
               framework::dataset::make("StrideX", { 1, 3, 1, 1 })),
               framework::dataset::make("StrideY", { 1, 3, 2, 1 })),
               framework::dataset::make("PadX", { 1, 3, 0, 4 })),
               framework::dataset::make("PadY", { 1, 3, 0, 4 })),
               framework::dataset::make("KernelSize", { 3, 8, 1, 9 })),
               framework::dataset::make("NumKernels", { 7, 3, 1, 3 })),
               framework::dataset::make("DataType",  DataType::QASYMM8_SIGNED)),
               framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))),
               framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
               framework::dataset::make("DataLayout", DataLayout::NHWC)))
{
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<int8_t>, framework::DatasetMode::PRECOMMIT,
               combine(combine(combine(combine(zip(zip(zip(zip(zip(zip(
               framework::dataset::make("InputShape", { TensorShape(27U, 13U, 23U),
                                                        TensorShape(19U, 5U, 16U, 4U),
                                                        TensorShape(13U, 5U, 17U, 2U),
                                                        TensorShape(32U, 37U, 13U) } ),
               framework::dataset::make("StrideX", { 1 })),
               framework::dataset::make("StrideY", { 1 })),
               framework::dataset::make("PadX", { 1 })),
               framework::dataset::make("PadY", { 1 })),
               framework::dataset::make("KernelSize", { 3 })),
               framework::dataset::make("NumKernels", { 3 })),
               framework::dataset::make("DataType",  DataType::QASYMM8_SIGNED)),
               framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))),
               framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
               framework::dataset::make("DataLayout", DataLayout::NHWC)))
{
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY,
               combine(combine(combine(combine(zip(zip(zip(zip(zip(zip(
               framework::dataset::make("InputShape", { TensorShape(800U, 800U, 3U) } ),
               framework::dataset::make("StrideX", { 1 })),
               framework::dataset::make("StrideY", { 1 })),
               framework::dataset::make("PadX", { 1 })),
               framework::dataset::make("PadY", { 1 })),
               framework::dataset::make("KernelSize", { 9 })),
               framework::dataset::make("NumKernels", { 3 })),
               framework::dataset::make("DataType",  DataType::QASYMM8_SIGNED)),
               framework::dataset::make("QuantizationInfo", QuantizationInfo(2.f / 255, 10))),
               framework::dataset::make("ActivationInfo", ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU) )),
               framework::dataset::make("DataLayout", DataLayout::NHWC)))
{
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
TEST_SUITE_END() // QASYMM8_SIGNED
TEST_SUITE_END() // Quantized
TEST_SUITE_END() // NHWC

// clang-format on
// *INDENT-ON*
TEST_SUITE(NCHW)
TEST_SUITE(Float)
TEST_SUITE(FP16)
FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(data_precommit, framework::dataset::make("DataType", DataType::F16)),
                                                                                ActivationFunctionsDataset),
                                                                                framework::dataset::make("DataLayout", DataLayout::NCHW)))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num);
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<half>, framework::DatasetMode::NIGHTLY, combine(combine(combine(data_nightly, framework::dataset::make("DataType", DataType::F16)),
                                                                                ActivationFunctionsDataset),
                                                                                framework::dataset::make("DataLayout", DataLayout::NCHW)))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_fp16, tolerance_num);
}
TEST_SUITE_END() // FP16

TEST_SUITE(FP32)
FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(data_precommit, framework::dataset::make("DataType",
                                                                                DataType::F32)),
                                                                                ActivationFunctionsDataset),
                                                                                framework::dataset::make("DataLayout", { DataLayout::NCHW })))
{
    validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
}
FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerMixedDataLayoutFixture<float>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(data_precommit,
                       framework::dataset::make("DataType",
                                                DataType::F32)),
                       ActivationFunctionsDataset),
                       framework::dataset::make("DataLayout", { DataLayout::NCHW })))
{
    validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(combine(data_nightly, framework::dataset::make("DataType", DataType::F32)),
                                                                                ActivationFunctionsDataset),
                                                                                framework::dataset::make("DataLayout", { DataLayout::NCHW })))
{
    validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
}
TEST_SUITE_END() // FP32

TEST_SUITE(FP32_CustomDataset)
FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionValidationWithTensorShapesFixture<float>, framework::DatasetMode::NIGHTLY, combine(combine(datasets::DirectConvolutionLayerDataset(),
                       framework::dataset::make("DataType", DataType::F32)),
                       ActivationFunctionsDataset))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_fp32, 0.0, abs_tolerance_f32);
}
TEST_SUITE_END() // FP32_CustomDataset
TEST_SUITE_END() // Float

const auto QuantizedActivationFunctionsDataset = framework::dataset::make("ActivationInfo",
{
    ActivationLayerInfo(),
    ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::RELU),
    ActivationLayerInfo(ActivationLayerInfo::ActivationFunction::LU_BOUNDED_RELU, 6.f)
});
TEST_SUITE(Quantized)
TEST_SUITE(QASYMM8)
FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(data_precommit,
                       framework::dataset::make("DataType", DataType::QASYMM8)),
                       framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10) })),
                       QuantizedActivationFunctionsDataset),
                       framework::dataset::make("DataLayout", { DataLayout::NCHW })))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(data_precommit,
                       framework::dataset::make("DataType", DataType::QASYMM8)),
                       framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, 10) })),
                       QuantizedActivationFunctionsDataset),
                       framework::dataset::make("DataLayout", { DataLayout::NCHW })))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
FIXTURE_DATA_TEST_CASE(RunSmall9x9, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::PRECOMMIT, combine(combine(combine(combine(data_precommit_9x9,
                       framework::dataset::make("DataType",
                                                DataType::QASYMM8)),
                       framework::dataset::make("QuantizationInfo", { QuantizationInfo(3.f / 255, 10), QuantizationInfo(1.1f, 10) })),
                       QuantizedActivationFunctionsDataset),
                       framework::dataset::make("DataLayout", { DataLayout::NCHW })))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
FIXTURE_DATA_TEST_CASE(RunLarge, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(data_nightly, framework::dataset::make("DataType",
                       DataType::QASYMM8)),
                       framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, 10) })),
                       QuantizedActivationFunctionsDataset),
                       framework::dataset::make("DataLayout", { DataLayout::NCHW })))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
FIXTURE_DATA_TEST_CASE(RunLarge9x9, CLDirectConvolutionLayerQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY, combine(combine(combine(combine(data_nightly_9x9,
                       framework::dataset::make("DataType",
                                                DataType::QASYMM8)),
                       framework::dataset::make("QuantizationInfo", { QuantizationInfo(3.f / 255, 10), QuantizationInfo(1.1f, 10) })),
                       QuantizedActivationFunctionsDataset),
                       framework::dataset::make("DataLayout", { DataLayout::NCHW })))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}

TEST_SUITE_END() // QASYMM8

TEST_SUITE(QASYMM8_CustomDataset)
FIXTURE_DATA_TEST_CASE(Run, CLDirectConvolutionValidationWithTensorShapesQuantizedFixture<uint8_t>, framework::DatasetMode::NIGHTLY,
                       combine(combine(combine(combine(datasets::DirectConvolutionLayerDataset(),
                                                       framework::dataset::make("DataType", DataType::QASYMM8)),
                                               framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 127), QuantizationInfo(1.1f, 10) })),
                                       QuantizedActivationFunctionsDataset),
                               framework::dataset::make("DataLayout", { DataLayout::NCHW })))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
TEST_SUITE_END() // QASYMM8_CustomDataset

TEST_SUITE(QASYMM8_SIGNED)

FIXTURE_DATA_TEST_CASE(RunSmall, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(data_precommit, framework::dataset::make("DataType",
                                                                                DataType::QASYMM8_SIGNED)),
                                                                                framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, -10) })),
                                                                                QuantizedActivationFunctionsDataset),
                                                                                framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
FIXTURE_DATA_TEST_CASE(RunMixedDataLayout, CLDirectConvolutionLayerQuantizedMixedDataLayoutFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(data_precommit,
                       framework::dataset::make("DataType",
                                                DataType::QASYMM8_SIGNED)),
                       framework::dataset::make("QuantizationInfo", { QuantizationInfo(1.1f, -10) })),
                       QuantizedActivationFunctionsDataset),
                       framework::dataset::make("DataLayout", { DataLayout::NCHW, DataLayout::NHWC })))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}
FIXTURE_DATA_TEST_CASE(RunSmall9x9, CLDirectConvolutionLayerQuantizedFixture<int8_t>, framework::DatasetMode::ALL, combine(combine(combine(combine(data_precommit_9x9,
                       framework::dataset::make("DataType",
                                                DataType::QASYMM8_SIGNED)),
                       framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 10), QuantizationInfo(1.1f, 10) })),
                       QuantizedActivationFunctionsDataset),
                       framework::dataset::make("DataLayout", { DataLayout::NCHW })))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}

FIXTURE_DATA_TEST_CASE(RunCustomDataset, CLDirectConvolutionValidationWithTensorShapesQuantizedFixture<int8_t>, framework::DatasetMode::NIGHTLY,
                       combine(combine(combine(combine(datasets::DirectConvolutionLayerDataset(),
                                                       framework::dataset::make("DataType", DataType::QASYMM8_SIGNED)),
                                               framework::dataset::make("QuantizationInfo", { QuantizationInfo(2.f / 255, 127), QuantizationInfo(1.1f, 10) })),
                                       QuantizedActivationFunctionsDataset),
                               framework::dataset::make("DataLayout", { DataLayout::NCHW })))
{
    // Validate output
    validate(CLAccessor(_target), _reference, tolerance_qasymm8);
}

TEST_SUITE_END() // QASYMM8_SIGNED
TEST_SUITE_END() // Quantized
TEST_SUITE_END() // NCHW
TEST_SUITE_END() // DirectConvolutionLayer
TEST_SUITE_END() // CL

} // namespace validation
} // namespace test
} // namespace arm_compute


text:
(function() {
    'use strict';

    var   Class         = require('ee-class')
        , type          = require('ee-types')
        , log           = require('ee-log')
        , Base          = require('./Base')
        ;

    module.exports = new Class({
        inherits: Base

        // apply to table
        , tableName: ''

        // apply to column
        , columnName: ''

        // referencedTable
        , referencedTable: null

        // drop the reference ?
        , drop: false

        /**
         * set up the migrator
         */
        , init: function(tableName, columnName, referencedTable, drop) {
            this.tableName = tableName;
            this.columnName = columnName;
            this.referencedTable = referencedTable;
            this.drop = !!drop;
        }

        /**
         * render the modification
         */
        , render: function() {
            return {
                  mode: 'alter'
                , columnName: this.columnName
                , typeName: this.typeName
                , kind: 'type'
                , value: this.typeName
            };
        }
    });
})();

redpajama_set_name: RedPajamaGithub


text:
using java.lang;

public class VarargsArray {
	public static string method(params string[] values) {
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < sizeof(values); i++) {
			sb.append(values[i]);
		}
		return sb.toString();
	}

	public static string test() {
		return method(new string[] { "ab", "c" });
	}
}


text:
<?xml version="1.0" encoding="utf-8"?>
<set
  xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:duration="100" android:fromYDelta="-50.0%p" android:toYDelta="0.0" />
</set>


text:
import heapq

class MedianFinder:
    def __init__(self):
        """
        Initialize your data structure here.
        """
        self.large, self.small = [], []

    def addNum(self, num):
        """
        Adds a num into the data structure.
        :type num: int
        :rtype: void
        """
        heapq.heappush(self.large, num)
        heapq.heappush(self.small, -heapq.heappop(self.large))
        if len(self.large) < len(self.small):
            heapq.heappush(self.large, -heap.heappop(self.small))

    def findMedian(self):
        """
        Returns the median of current data stream
        :rtype: float
        """
        if len(self.large) > len(self.small):
            res = self.large[0]
        else:
            res = (self.large[0] - self.small[0]) / 2.
        return res

# Your MedianFinder object will be instantiated and called as such:
# mf = MedianFinder()
# mf.addNum(1)
# mf.findMedian()


text:
A simple C# desktop application designed to help you quickly sync any two folder structures. Tested with over 1 terabyte of unsynced data and built using flawless matching algorithms.

* Intuitive interface with step-by-step process
* select individual sub-folders to sync
* live progress bar & info while syncing

### Preresiquites
* Tested with Windows 7 64-bit

###To Do:
* match changed files within existing folders

This was a one-day project, written on April 10th, 2016.


text:
class SymbolTable
{
public:
   struct Symbol
   {
      uintptr_t address;
      size_t size;
   };

   void addSymbol(std::string name, uintptr_t address, size_t size);
   std::pair<Symbol, bool> lookup(std::string name);

private:
   std::map<std::string, Symbol> symbolsM;
};

#endif


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.crest.dlt.ui.utils;

import edu.crest.dlt.transfer.Progress;
import edu.crest.dlt.transfer.ProgressEvent;
import edu.crest.dlt.transfer.ProgressListener;

public class TransferProgressPanel extends javax.swing.JPanel implements ProgressListener
{

	/**
	 * Creates new form TransferProgressPanel
	 */
	public TransferProgressPanel()
	{
		initComponents();
	}

	/**
	 * This method is called from within the constructor to initialize the form.
	 * WARNING: Do NOT modify this code. The content of this method is always
	 * regenerated by the Form Editor.
	 */
	@SuppressWarnings("unchecked")
	// <editor-fold defaultstate="collapsed"
	// <editor-fold defaultstate="collapsed"
	// desc="Generated Code">//GEN-BEGIN:initComponents
	private void initComponents()
	{

		label_filename = new javax.swing.JLabel();
		label_size = new javax.swing.JLabel();
		label_transferred = new javax.swing.JLabel();
		label_speed = new javax.swing.JLabel();
		label_time_expected = new javax.swing.JLabel();
		label_time_elapsed = new javax.swing.JLabel();
		output_filename = new javax.swing.JLabel();
		output_size = new javax.swing.JLabel();
		output_transferred = new javax.swing.JLabel();
		output_speed = new javax.swing.JLabel();
		output_time_expected = new javax.swing.JLabel();
		output_time_elapsed = new javax.swing.JLabel();
		output_progress_bar = new javax.swing.JProgressBar();

		setBorder(javax.swing.BorderFactory.createTitledBorder(null, "File Transfer Progress",
				javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
				javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 1, 12))); // NOI18N
		setPreferredSize(new java.awt.Dimension(500, 154));

		label_filename.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
		label_filename.setText("File Name");

		label_size.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
		label_size.setText("File Size (MB)");

		label_transferred.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
		label_transferred.setText("Transferred (MB)");

		label_speed.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
		label_speed.setText("Speed (MB/s)");

		label_time_expected.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
		label_time_expected.setText("Expected (hh:mm:ss)");

		label_time_elapsed.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
		label_time_elapsed.setText("Elapsed (hh:mm:ss)");

		output_filename.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
		output_filename.setText("-");

		output_size.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
		output_size.setText("-");

		output_transferred.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
		output_transferred.setText("-");

		output_speed.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
		output_speed.setText("-");

		output_time_expected.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
		output_time_expected.setText("00:00:00");

		output_time_elapsed.setHorizontalAlignment(javax.swing.SwingConstants.TRAILING);
		output_time_elapsed.setText("00:00:00");

		output_progress_bar.setFont(new java.awt.Font("Tahoma", 1, 10)); // NOI18N
		output_progress_bar.setAlignmentX(0.0F);
		output_progress_bar.setAlignmentY(0.0F);
		output_progress_bar.setBorderPainted(false);
		output_progress_bar.setFocusable(false);
		output_progress_bar.setMaximumSize(new java.awt.Dimension(32767, 5));
		output_progress_bar.setMinimumSize(new java.awt.Dimension(10, 5));
		output_progress_bar.setPreferredSize(new java.awt.Dimension(146, 5));

		javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
		this.setLayout(layout);
		layout
				.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
						.addGroup(
								layout
										.createSequentialGroup()
										.addGap(0, 0, 0)
										.addGroup(
												layout
														.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
														.addComponent(output_progress_bar,
																javax.swing.GroupLayout.DEFAULT_SIZE,
																javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
														.addGroup(
																layout
																		.createSequentialGroup()
																		.addGroup(
																				layout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING)
																						.addComponent(label_time_expected,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)
																						.addComponent(label_speed,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)
																						.addComponent(label_transferred,
																								javax.swing.GroupLayout.DEFAULT_SIZE, 249,
																								Short.MAX_VALUE)
																						.addComponent(label_size,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)
																						.addComponent(label_filename,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)
																						.addComponent(label_time_elapsed,
																								javax.swing.GroupLayout.Alignment.TRAILING,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE))
																		.addGap(6, 6, 6)
																		.addGroup(
																				layout
																						.createParallelGroup(
																								javax.swing.GroupLayout.Alignment.LEADING)
																						.addComponent(output_size,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)
																						.addComponent(output_transferred,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)
																						.addComponent(output_speed,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)
																						.addComponent(output_time_expected,
																								javax.swing.GroupLayout.DEFAULT_SIZE, 233,
																								Short.MAX_VALUE)
																						.addComponent(output_time_elapsed,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE)
																						.addComponent(output_filename,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								javax.swing.GroupLayout.DEFAULT_SIZE,
																								Short.MAX_VALUE))))));
		layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
				.addGroup(
						javax.swing.GroupLayout.Alignment.TRAILING,
						layout
								.createSequentialGroup()
								.addGap(0, 0, Short.MAX_VALUE)
								.addGroup(
										layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(label_filename).addComponent(output_filename))
								.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addGroup(
										layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(label_size).addComponent(output_size))
								.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addGroup(
										layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(label_transferred).addComponent(output_transferred))
								.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addGroup(
										layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(label_speed).addComponent(output_speed))
								.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addGroup(
										layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(label_time_expected).addComponent(output_time_expected))
								.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addGroup(
										layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
												.addComponent(label_time_elapsed).addComponent(output_time_elapsed))
								.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
								.addComponent(output_progress_bar, javax.swing.GroupLayout.PREFERRED_SIZE, 10,
										javax.swing.GroupLayout.PREFERRED_SIZE)));
	}// </editor-fold>//GEN-END:initComponents

	@Override
	public void progressUpdated(ProgressEvent evt)
	{
		output_transferred.setText(Progress.format_double(evt.completed_total / (1024.0 * 1024.0)));
		output_speed.setText(Progress.format_double(evt.throughput));
		output_time_expected.setText(Progress.format_date((int) evt.time_expected_arrival));
		output_time_elapsed.setText(Progress.format_date((int) evt.time_elapsed));
		output_progress_bar.setIndeterminate(false);
		output_progress_bar.setValue((int) evt.completed_percent);
	}

	@Override
	public void progressDone(ProgressEvent evt)
	{
		output_transferred.setText(Progress.format_double(evt.completed_total / (1024.0 * 1024.0)));
		output_speed.setText(Progress.format_double(evt.throughput));
		output_time_expected.setText(Progress.format_date((int) evt.time_expected_arrival));
		output_time_elapsed.setText(Progress.format_date((int) evt.time_elapsed));
		output_progress_bar.setIndeterminate(false);
		output_progress_bar.setValue(output_progress_bar.getMaximum());
	}

	@Override
	public void progressError(ProgressEvent evt)
	{
		// TODO Auto-generated method stub
	}

	public void clear()
	{
		output_filename.setText("-");
		output_size.setText("-");
		output_transferred.setText("-");
		output_speed.setText("-");
		output_time_expected.setText("00:00:00");
		output_time_elapsed.setText("00:00:00");
		output_progress_bar.setValue(0);
	}

	public void filename(String filename)
	{
		output_filename.setText(filename);
	}

	public void size(long bytes)
	{
		double megabytes = (double) bytes / 1024.0 / 1024.0;
		output_size.setText(Progress.format_double(megabytes));
	}

	// Variables declaration - do not modify//GEN-BEGIN:variables
	private javax.swing.JLabel label_filename;
	private javax.swing.JLabel label_size;
	private javax.swing.JLabel label_speed;
	private javax.swing.JLabel label_time_elapsed;
	private javax.swing.JLabel label_time_expected;
	private javax.swing.JLabel label_transferred;
	private javax.swing.JLabel output_filename;
	private javax.swing.JProgressBar output_progress_bar;
	private javax.swing.JLabel output_size;
	private javax.swing.JLabel output_speed;
	private javax.swing.JLabel output_time_elapsed;
	private javax.swing.JLabel output_time_expected;
	private javax.swing.JLabel output_transferred;
	// End of variables declaration//GEN-END:variables
}


text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Windows.Media;
using System.Windows.Media.Media3D;

namespace MahApps.Metro.Controls
{
    ///
    ///   Based on Greg Schechter's Planerator
    ///   http://blogs.msdn.com/b/greg_schechter/archive/2007/10/26/enter-the-planerator-dead-simple-3d-in-wpf-with-a-stupid-name.aspx
    ///
    [ContentProperty(nameof(Child))]
    public class Planerator : FrameworkElement
    {
        /// Identifies the <see cref="RotationX"/> dependency property.
        public static readonly DependencyProperty RotationXProperty
            = DependencyProperty.Register(nameof(RotationX),
                                          typeof(double),
                                          typeof(Planerator),
                                          new UIPropertyMetadata(0.0, (d, args) => ((Planerator)d).UpdateRotation()));

        public double RotationX
        {
            get => (double)this.GetValue(RotationXProperty);
            set => this.SetValue(RotationXProperty, value);
        }

        /// Identifies the <see cref="RotationY"/> dependency property.
        public static readonly DependencyProperty RotationYProperty
            = DependencyProperty.Register(nameof(RotationY),
                                          typeof(double),
                                          typeof(Planerator),
                                          new UIPropertyMetadata(0.0, (d, args) => ((Planerator)d).UpdateRotation()));

        public double RotationY
        {
            get => (double)this.GetValue(RotationYProperty);
            set => this.SetValue(RotationYProperty, value);
        }

        /// Identifies the <see cref="RotationZ"/> dependency property.
        public static readonly DependencyProperty RotationZProperty
            = DependencyProperty.Register(nameof(RotationZ),
                                          typeof(double),
                                          typeof(Planerator),
                                          new UIPropertyMetadata(0.0, (d, args) => ((Planerator)d).UpdateRotation()));

        public double RotationZ
        {
            get => (double)this.GetValue(RotationZProperty);
            set => this.SetValue(RotationZProperty, value);
        }

        /// Identifies the <see cref="FieldOfView"/> dependency property.
        public static readonly DependencyProperty FieldOfViewProperty
            = DependencyProperty.Register(nameof(FieldOfView),
                                          typeof(double),
                                          typeof(Planerator),
                                          new UIPropertyMetadata(45.0, (d, args) => ((Planerator)d).Update3D(), (d, val) => Math.Min(Math.Max((double)val, 0.5), 179.9)));

        public double FieldOfView
        {
            get => (double)this.GetValue(FieldOfViewProperty);
            set => this.SetValue(FieldOfViewProperty, value);
        }

        // clamp to a meaningful range

        private static readonly Point3D[] Mesh =
        {
            new Point3D(0, 0, 0), new Point3D(0, 1, 0), new Point3D(1, 1, 0),
            new Point3D(1, 0, 0)
        };

        private static readonly Point[] TexCoords =
        {
            new Point(0, 1), new Point(0, 0), new Point(1, 0),
            new Point(1, 1)
        };

        private static readonly int[] Indices = { 0, 2, 1, 0, 3, 2 };
        private static readonly Vector3D XAxis = new Vector3D(1, 0, 0);
        private static readonly Vector3D YAxis = new Vector3D(0, 1, 0);
        private static readonly Vector3D ZAxis = new Vector3D(0, 0, 1);
        private readonly QuaternionRotation3D quaternionRotation = new QuaternionRotation3D();
        private readonly RotateTransform3D rotationTransform = new RotateTransform3D();
        private readonly ScaleTransform3D scaleTransform = new ScaleTransform3D();
        private Decorator? logicalChild;
        private FrameworkElement? originalChild;
        private Viewport3D? viewport3D;
        private FrameworkElement? visualChild;
        private Viewport2DVisual3D? frontModel;

        public FrameworkElement? Child
        {
            get => this.originalChild;
            set
            {
                if (this.originalChild == value)
                {
                    return;
                }

                this.RemoveVisualChild(this.visualChild);
                this.RemoveLogicalChild(this.logicalChild);

                // Wrap child with special decorator that catches layout invalidations.
                this.originalChild = value;
                this.logicalChild = new LayoutInvalidationCatcher { Child = this.originalChild };
                this.visualChild = this.CreateVisualChild();

                this.AddVisualChild(this.visualChild);

                // Need to use a logical child here to make sure databinding operations get down to it,
                // since otherwise the child appears only as the Visual to a Viewport2DVisual3D, which
                // doesn't have databinding operations pass into it from above.
                this.AddLogicalChild(this.logicalChild);
                this.InvalidateMeasure();
            }
        }

        protected override int VisualChildrenCount => this.visualChild == null ? 0 : 1;

        protected override Size MeasureOverride(Size availableSize)
        {
            if (this.logicalChild != null)
            {
                // Measure based on the size of the logical child, since we want to align with it.
                this.logicalChild.Measure(availableSize);
                var result = this.logicalChild.DesiredSize;
                this.visualChild?.Measure(result);
                return result;
            }

            return new Size(0, 0);
        }

        protected override Size ArrangeOverride(Size finalSize)
        {
            if (this.logicalChild != null)
            {
                this.logicalChild.Arrange(new Rect(finalSize));
                this.visualChild?.Arrange(new Rect(finalSize));
                this.Update3D();
            }

            return base.ArrangeOverride(finalSize);
        }

        protected override Visual? GetVisualChild(int index)
        {
            return this.visualChild;
        }

        private FrameworkElement CreateVisualChild()
        {
            var simpleQuad = new MeshGeometry3D
                             {
                                 Positions = new Point3DCollection(Mesh),
                                 TextureCoordinates = new PointCollection(TexCoords),
                                 TriangleIndices = new Int32Collection(Indices)
                             };

            // Front material is interactive, back material is not.
            Material frontMaterial = new DiffuseMaterial(Brushes.White);
            frontMaterial.SetValue(Viewport2DVisual3D.IsVisualHostMaterialProperty, true);

            var vb = new VisualBrush(this.logicalChild);
            this.SetCachingForObject(vb); // big perf wins by caching!!
            Material backMaterial = new DiffuseMaterial(vb);

            this.rotationTransform.Rotation = this.quaternionRotation;
            var xfGroup = new Transform3DGroup { Children = { this.scaleTransform, this.rotationTransform } };

            var backModel = new GeometryModel3D { Geometry = simpleQuad, Transform = xfGroup, BackMaterial = backMaterial };
            var m3dGroup = new Model3DGroup
                           {
                               Children =
                               {
                                   new DirectionalLight(Colors.White, new Vector3D(0, 0, -1)),
                                   new DirectionalLight(Colors.White, new Vector3D(0.1, -0.1, 1)),
                                   backModel
                               }
                           };

            // Non-interactive Visual3D consisting of the backside, and two lights.
            var mv3d = new ModelVisual3D { Content = m3dGroup };

            if (this.frontModel != null)
            {
                this.frontModel.Visual = null;
            }

            // Interactive frontside Visual3D
            this.frontModel = new Viewport2DVisual3D
                              {
                                  Geometry = simpleQuad,
                                  Visual = this.logicalChild,
                                  Material = frontMaterial,
                                  Transform = xfGroup
                              };

            // Cache the brush in the VP2V3 by setting caching on it.  Big perf wins.
            this.SetCachingForObject(this.frontModel);

            // Scene consists of both the above Visual3D's.
            this.viewport3D = new Viewport3D { ClipToBounds = false, Children = { mv3d, this.frontModel } };

            this.UpdateRotation();

            return this.viewport3D;
        }

        public void Refresh()
        {
            if (this.logicalChild != null)
            {
                // #3720 I didn't find a better solution to update the child after changing accent/theme
                this.logicalChild.Child = null;
                this.logicalChild.Child = this.Child;

                this.InvalidateVisual();
                this.InvalidateMeasure();
            }
        }

        private void SetCachingForObject(DependencyObject d)
        {
            RenderOptions.SetCachingHint(d, CachingHint.Cache);
            RenderOptions.SetCacheInvalidationThresholdMinimum(d, 0.5);
            RenderOptions.SetCacheInvalidationThresholdMaximum(d, 2.0);
        }

        private void UpdateRotation()
        {
            var qx = new Quaternion(XAxis, this.RotationX);
            var qy = new Quaternion(YAxis, this.RotationY);
            var qz = new Quaternion(ZAxis, this.RotationZ);

            this.quaternionRotation.Quaternion = qx * qy * qz;
        }

        private void Update3D()
        {
            if (this.viewport3D is null
                || this.logicalChild is null)
            {
                return;
            }

            // Use GetDescendantBounds for sizing and centering since DesiredSize includes layout whitespace, whereas GetDescendantBounds
            // is tighter
            Rect logicalBounds = VisualTreeHelper.GetDescendantBounds(this.logicalChild);
            double w = logicalBounds.Width;
            double h = logicalBounds.Height;

            // Create a camera that looks down -Z, with up as Y, and positioned right halfway in X and Y on the element,
            // and back along Z the right distance based on the field-of-view is the same projected size as the 2D content
            // that it's looking at.  See http://blogs.msdn.com/greg_schechter/archive/2007/04/03/camera-construction-in-parallaxui.aspx
            // for derivation of this camera.
            double fovInRadians = this.FieldOfView * (Math.PI / 180);
            double zValue = w / Math.Tan(fovInRadians / 2) / 2;
            this.viewport3D.Camera = new PerspectiveCamera(new Point3D(w / 2, h / 2, zValue), -ZAxis, YAxis, this.FieldOfView);

            this.scaleTransform.ScaleX = w;
            this.scaleTransform.ScaleY = h;
            this.rotationTransform.CenterX = w / 2;
            this.rotationTransform.CenterY = h / 2;
        }
    }
}


text:
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;

namespace live.asp.net
{
    public class Program
    {
        public static void Main(string[] args)
        {
            CreateWebHostBuilder(args).Build().Run();
        }

        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args)
                .UseApplicationInsights()
                .UseStartup<Startup>();
    }
}


text:
package com.guiying.module.common.utils;

import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.support.annotation.NonNull;
import android.support.annotation.StringRes;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.view.View;

/**
 *
Utils初始化相关

 */
public class Utils {

    private static Context context;

    private Utils() {
        throw new UnsupportedOperationException("u can't instantiate me...");
    }

    /**
     * 初始化工具类
     *
     * @param context 上下文
     */
    public static void init(Context context) {
        Utils.context = context.getApplicationContext();
    }

    /**
     * 获取ApplicationContext
     *
     * @return ApplicationContext
     */
    public static Context getContext() {
        if (context != null) return context;
        throw new NullPointerException("u should init first");
    }

    /**
     * View获取Activity的工具
     *
     * @param view view
     * @return Activity
     */
    public static
    @NonNull
    Activity getActivity(View view) {
        Context context = view.getContext();

        while (context instanceof ContextWrapper) {
            if (context instanceof Activity) {
                return (Activity) context;
            }
            context = ((ContextWrapper) context).getBaseContext();
        }

        throw new IllegalStateException("View " + view + " is not attached to an Activity");
    }

    /**
     * 全局获取String的方法
     *
     * @param id 资源Id
     * @return String
     */
    public static String getString(@StringRes int id) {
        return context.getResources().getString(id);
    }

    /**
     * 判断App是否是Debug版本
     *
     * @return {@code true}: 是
{@code false}: 否
     */
    public static boolean isAppDebug() {
        if (StringUtils.isSpace(context.getPackageName())) return false;
        try {
            PackageManager pm = context.getPackageManager();
            ApplicationInfo ai = pm.getApplicationInfo(context.getPackageName(), 0);
            return ai != null && (ai.flags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
            return false;
        }
    }

    /**
     * The {@code fragment} is added to the container view with id {@code frameId}. The operation is
     * performed by the {@code fragmentManager}.
     */
    public static void addFragmentToActivity(@NonNull FragmentManager fragmentManager,
                                             @NonNull Fragment fragment, int frameId) {
        checkNotNull(fragmentManager);
        checkNotNull(fragment);
        FragmentTransaction transaction = fragmentManager.beginTransaction();
        transaction.add(frameId, fragment);
        transaction.commit();
    }

    public static <T> T checkNotNull(T obj) {
        if (obj == null) {
            throw new NullPointerException();
        }
        return obj;
    }

}


text:
{% extends "site_base.html" %}
{% load i18n %}
{% block extratitle %}{% trans 'Password reset complete' %}{% endblock %}

{% block breadcrumbs %}

{% trans 'Password reset complete' %}

{% endblock %}

{% block content %}

{% trans 'Password reset complete' %}

{% trans "Your password has been set.  You may go ahead and log in now." %}

{% trans 'Log in' %}

{% endblock %}


text:
CHIP-8 emulator as an UEFI application
## Building
You'll have to build latest `gnu-efi` library. It is included as a submodule, so you should clone this repo:
```
git clone --recursive https://github.com/Reisse/uefi-chip8.git
```
Then, make and install `gnu-efi`:
```
cd ./uefi-chip8/gnu-efi-code/ && make && sudo make install
```
Finally, build uefi-chip8 itself:
```
cd .. && make
```
This builds `uc8.efi` file, which is an UEFI application that you could run either in QEMU or on any UEFI device with secure boot switched off.
## Testing in QEMU
Make sure you have QEMU installed. Then, build as explained in previous section and run `qemu-start.sh`. Wait for EFI Shell prompt and run:
```
fs0:\uc8.efi
```
Follow the instructions on your screen. In case of trouble, press `Z`.
## License
* The "qemu-env" directory contains its own LICENSE file with licensing information, please read it.
* "gnu-efi" submodule also contains its own license information in `gnu-efi-code/README` file
* For everything else, see LICENSE.md


text:
<!DOCTYPE html>

    {% block head %}
        <meta charset="UTF-8">
	<title>{% block title %}{% endblock %}</title>

    {% endblock %}
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">

    {% if rtl %}
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-rtl/3.2.0-rc2/css/bootstrap-rtl.min.css">
    {% endif %}

    {% block meta %}
    {% endblock %}

        	<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            	    Toggle navigation

                </button>
                imigo

{% trans %}Home{% endtrans %}

{% block content %}{% endblock %}

	{% block footer %}
        	© {% trans %}Copyright{% endtrans %} {{ footer_year }}, {% trans %}me{% endtrans %}.
	{% endblock %}

{% block end %}
{% endblock %}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Ann. R. bot. Gdns Peradeniya 4: 307 (1909)

#### Original name
Cerebella anthistiriae Petch

### Remarks
null


text: export * from './Request';


text:
import { WebsiteSettingName } from './tune_settings';

// Types of message actions that can be sent with the chrome message API.
export type ChromeMessageName = 'SCORE_TEXT' | 'SUBMIT_FEEDBACK' | 'GET_CURRENT_WEBSITE';

// Enum with values corresponding to the options in the ChromeMessageName type.
export enum ChromeMessageEnum {
  SCORE_TEXT = 'SCORE_TEXT',
  SUBMIT_FEEDBACK = 'SUBMIT_FEEDBACK',
  GET_CURRENT_WEBSITE = 'GET_CURRENT_WEBSITE'
}

export interface ChromeMessage {
  action: ChromeMessageName;
}

export interface ScoreTextRequest extends ChromeMessage {
  text: string;
}

export interface SendFeedbackRequest extends ChromeMessage {
  text: string;
  attribute: string;
  score: number;
  site: string;
}

export interface GetCurrentWebsiteResponse {
  siteName: WebsiteSettingName;
}


text:
<!DOCTYPE html>

        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">

        <title>Sky Cinema - Moodslider</title>

        <link href="../moodslider/css/bootstrap.min.css" rel="stylesheet" type="text/css">
        <link href="../moodslider/css/bootstrap.css" rel="stylesheet" type="text/css">

        <link href="../moodslider/css/moodslider.css" rel="stylesheet" type="text/css">

        <link href="../moodslider/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">
        <link href="../moodslider/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css">
        <link href="../moodslider/css/fonts.css" rel="stylesheet" type="text/css">

        <link href="../moodslider/css/angular-material.css" rel="stylesheet" type="text/css">
        <link href="../moodslider/css/demo.css" rel="stylesheet" type="text/css">

                    Moodslider

                    Home

                    Get Started

                    Upload Content

                    Contact

Welcome to Moodslider

                Let's Get Started!

How do you feel?

                            <md-content style="margin: 16px; padding: 16px 16px 16px 16px;">

                                        Sad

                                    <md-slider flex="" ng-model="mood1" min="0" max="100" aria-label="rating"></md-slider>

                                        Happy

                                        Tired

                                    <md-slider flex="" class="md-warn" ng-model="mood2" min="0" max="100" aria-label="rating"></md-slider>

                                        Energetic

                                        Restless

                                    <md-slider flex="" class="md-primary" ng-model="mood3" min="0" max="100" aria-label="rating"></md-slider>

                                        Calm

                                        Scared

                                    <md-slider flex="" class="" ng-model="mood4" min="0" max="100" aria-label="rating"></md-slider>

                                        Fearless

                            </md-content>

                            Alice in Wonderland
                            Avatar
                            Bruce Almighty
                            Star Wars: Rogue One
                            Passengers

Got Your Own Content?

                        <button onclick="helpFunction()" class="btn btn-dark btn">Need help?</button>

                            Please ensure your content is uploaded as an XML file with the following format:

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

                                    <programmeList>

                                    <programme id="UNIQUE NUMBER">

                                    <name>INSERT TITLE OF MOVIE</name>

                                    <image>INSERT MOVIE POSTER IMAGE</image>

                                    <mood>INSERT MOOD THAT BEST CHARACTERIZES MOVIE OUT OF:

                                    HAPPY-SAD-ENERGETIC-TIRED-CALM-RESTLESS-FEARLESS-SCARED</mood>

                                    </programme>

                                    </programmeList>

Still having issues? Please contact a member of the team here

Sky plc

Grant Way

                            Isleworth

                            TW7 5QD

                                 08442 411 411

                                startingout@sky.uk

Copyright © Moodslider 2017


text:
import PropTypes from 'prop-types';
import React from 'react';

import DraggableDiv from './DraggableDiv';
import TrackArea from './TrackArea';

// See commented out block in "render()".
//
// const checkMousePosVsEl = (x, y, el) => {
//   const bBox = el.getBoundingClientRect();
//   return isWithin(
//     x, y, bBox.left, bBox.left + bBox.width, bBox.top, bBox.top + bBox.height
//   );
// };

class MoveableTrack extends TrackArea {
  constructor(props) {
    super(props);

    this.moveable = true;
  }

  render() {
    return (
      <div
        ref={(r) => {
          this.el = r;
        }}
        className={this.props.className}
        onMouseEnter={this.handleMouseEnter.bind(this)}
        onMouseLeave={
          (/* e */) => {
            // This let to https://github.com/higlass/higlass/issues/263
            // Therefore I disabled it.
            // if (checkMousePosVsEl(
            //   e.nativeEvent.clientX, e.nativeEvent.clientY, this.el
            // )) {
            //   return;
            // }
            this.handleMouseLeave();
          }
        }
        style={{
          height: this.props.height,
          width: this.props.width,
        }}
      >
        <DraggableDiv
          key={this.props.uid}
          height={this.props.height}
          resizeHandles={
            this.props.editable ? this.props.resizeHandles : new Set()
          }
          sizeChanged={(stuff) =>
            this.props.handleResizeTrack(
              this.props.uid,
              stuff.width,
              stuff.height,
            )
          }
          style={{ background: 'transparent' }}
          uid={this.props.uid}
          width={this.props.width}
        />
        {this.props.editable &&
          this.getControls(
            this.state.controlsVisible || this.props.item.configMenuVisible,
          )}
      </div>
    );
  }
}

MoveableTrack.propTypes = {
  className: PropTypes.string,
  uid: PropTypes.string,
  item: PropTypes.object,
  height: PropTypes.number,
  width: PropTypes.number,
};

export default MoveableTrack;


text:
package engine

import (
	"errors"
)

var (
	// ErrWithdrawRequestNotFound message to display when no record is found
	ErrWithdrawRequestNotFound = errors.New("request not found")
)

// WithdrawManager is responsible for performing withdrawal requests and
// saving them to the database
type WithdrawManager struct {
	exchangeManager  iExchangeManager
	portfolioManager iPortfolioManager
	isDryRun         bool
}


text:
namespace Microsoft.Skype.UCWA.Enums
{
    /// <summary>
    /// Represents the direction of the call, message, etc.
    /// </summary>
    public enum Direction
    {
        /// <summary>
        /// Represents the incoming direction.
        /// </summary>
        Incoming,
        /// <summary>
        /// Represents the outgoing direction.
        /// </summary>
        Outgoing
    }
}


text:
var mongoose = require('mongoose');
var Schema = mongoose.Schema;

var CommentSchema = new Schema({
	product: {
		type: Schema.Types.ObjectId,
		ref: 'Product'
	},
	content: {
		type: String,
		required: true
	},
	user: {
		type: Schema.Types.ObjectId,
		ref: 'User'
	}
});

module.exports = mongoose.model('Comment', CommentSchema);


text:
"use strict";

const _ = require('lodash');
const fs = require('fs');
const path = require('path');
const {promisify} = require('util');
const readdirPromise = promisify(fs.readdir);
const moment = require('moment');
const readline = require('readline');
const stream = require('stream');
const baseFolder = path.join('logs');

const AU = require('ansi_up');
const ansi_up = new AU.default;

module.exports = {
    getTasks,
    read
};

function getTasks() {
    return new Promise(async (resolve, reject) => {
        await readdirPromise(baseFolder).then(fileNames => {
            let files = fileNames.filter(name => {
                return name !== '.gitkeep';
            });

            let tasks = [];

            files.map(name => {
                if (name.match(/_[0-9]{8}.log/g)) {
                    const fileInfo = name.split('_');
                    const taskName = fileInfo.shift();
                    const date = fileInfo.pop().replace('.log', '');

                    const index = tasks.findIndex((task => task.taskName === taskName));
                    if (index === -1) {
                        tasks.push({
                            taskName: taskName,
                            dates: [date]
                        });
                    } else {
                        tasks[index].dates.push(date);

                        tasks[index].dates = _.orderBy(tasks[index].dates, date => {
                            return new moment(date).format('YYYYMMDD');
                        }, ['desc']);
                    }
                }
            });

            resolve(tasks);
        }).catch(err => {
            reject(err);
        });
    }).then(tasks => {
        return {
            type: 'success',
            tasks: tasks
        };
    }).catch(err => {
        return {
            type: 'failed',
            message: err
        };
    });
}

function read(req) {
    return new Promise(async (resolve, reject) => {
        const taskName = req.params.taskName;
        const date = req.params.date;

        await readdirPromise(baseFolder).then(async fileNames => {
            let files = fileNames.filter(name => {
                return name !== '.gitkeep' && name.match(/_[0-9]{8}.log/g);
            });

            files = files.map(name => {
                const fileInfo = name.split('_');
                return {
                    fileName: name,
                    taskName: fileInfo.shift(),
                    date: fileInfo.pop().replace('.log', '')
                };
            });

            files = files.filter(file => {
                return file.taskName === taskName;
            });

            files = _.orderBy(files, file => {
                return new moment(file.date).format('YYYMMDD');
            }, ['desc']);

            if (date) {
                files = files.filter(file => {
                    return file.date === date;
                });
            }
            const file = _.head(files);
            const filePath = path.join(baseFolder, file.fileName);
            const instream = fs.createReadStream(filePath);
            const outstream = new (stream)();
            const rl = readline.createInterface(instream, outstream);
            let output = [];

            rl.on('line', line => {
                ansi_up.use_classes = true;
                const lineHtml = ansi_up.ansi_to_html(line);
                output.push(lineHtml);
            });

            rl.on('close', () => {
                const limit = 1000;
                if (output.length > limit) {
                    output = output.slice(Math.max(output.length - limit, 0));
                    output.unshift(`<strong>Only showing last ${limit} lines, please login into the server to see the complete log file</strong>`);
                }

                resolve(output.join('<br>'));
            });
        }).catch(err => {
            reject(err);
        });
    }).then(logs => {
        return {
            type: 'success',
            logs: logs
        };
    }).catch(err => {
        return {
            type: 'failed',
            message: err
        };
    });
}


text:
package io.reactivex.internal.operators.observable;

import io.reactivex.*;
import io.reactivex.annotations.Experimental;
import io.reactivex.annotations.Nullable;
import io.reactivex.functions.Consumer;
import io.reactivex.internal.observers.BasicFuseableObserver;

/**
 * Calls a consumer after pushing the current item to the downstream.
 * @param <T> the value type
 * @since 2.0.1 - experimental
 */
@Experimental
public final class ObservableDoAfterNext<T> extends AbstractObservableWithUpstream<T, T> {

    final Consumer<? super T> onAfterNext;

    public ObservableDoAfterNext(ObservableSource<T> source, Consumer<? super T> onAfterNext) {
        super(source);
        this.onAfterNext = onAfterNext;
    }

    @Override
    protected void subscribeActual(Observer<? super T> s) {
        source.subscribe(new DoAfterObserver<T>(s, onAfterNext));
    }

    static final class DoAfterObserver<T> extends BasicFuseableObserver<T, T> {

        final Consumer<? super T> onAfterNext;

        DoAfterObserver(Observer<? super T> actual, Consumer<? super T> onAfterNext) {
            super(actual);
            this.onAfterNext = onAfterNext;
        }

        @Override
        public void onNext(T t) {
            actual.onNext(t);

            if (sourceMode == NONE) {
                try {
                    onAfterNext.accept(t);
                } catch (Throwable ex) {
                    fail(ex);
                }
            }
        }

        @Override
        public int requestFusion(int mode) {
            return transitiveBoundaryFusion(mode);
        }

        @Nullable
        @Override
        public T poll() throws Exception {
            T v = qs.poll();
            if (v != null) {
                onAfterNext.accept(v);
            }
            return v;
        }
    }
}


text:
oneview_server_profile_template 'ServerProfileTemplate1' do
  client node['oneview_test']['client']
  action :delete
end


text:
<!DOCTYPE html>

      <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

	  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.98.0/css/materialize.min.css">

      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>

# UoPeople

		Convenient Tools for Students of University of the People

		I thought it's convenient if I can shrink all posts in the discussion forums.

		So I made this bookmarklet.

		# How to use updated Feb 2020

 Drag this ->

 div > article").each(function(){$(this).css('box-shadow','-20px 0 0 #76AFB5')});})();})();})();">shrink
		  <- link into the bookmark bar of your browser.

Open any discussion forum in moodle

Click the bookmarklet that you dragged into your bookmark bar

If all of the posts are shrunk in short boxes, it means working correctly.

 Example:

# Expand textarea in WA, DB and LJ

Expand

Choose quiz

	    1. div:nth-child("+num+") input:checkbox").each(function(){$(this).attr("checked",true)});$("div.answer>div:nth-child("+num+") input:radio").each(function(){$(this).prop("checked",true)});}(function(){var num=prompt('which answer you choose? 1 to 5:','1');var rand=Math.floor(Math.random()*(3-1)+1);choose(rand);choose(num);$("html, body").animate({scrollTop:$(document).height()},"slow");$("form .submitbtns input").click();})();})();">quiz

	    2.  div").children('.submitbtns').eq(1).find('button').click();setTimeout(function(){console.log(1);$(".moodle-dialogue-bd .btn-primary").click();},1000);setTimeout(function(){const exp=/http.*cmid=(\d+)/ig;const url=document.URL.replace(exp,"https://my.uopeople.edu/mod/quiz/view.php?id=$1");window.open(url);},500);})();">quiz-submit

# Get APA citation

 Drag this bookmarklet to your bookmark bar

	    apatab

 Open your reference page

 (Select the author name or date of the article or both if exists)

 Click the registered bookmarklet

 Copy the auto-generated apa citation and use

 Fix the author or date if it is wrong

 Sort elements by name

	    Use at the top page of each class.

	    <a id="codeOut" href="javascript:(function(){FIND=["Discussion Forum","Learning Journal","Written Assignment","Self Quiz","Graded Quiz","Final Exam"];OUT="";$.each(FIND,function(key,find){OUT=OUT+get(find);});document.write(OUT);function get(FIND){RES="
"+FIND+"
";$("a").each(function(){str=$(this).text();if(str.match(FIND)){console.log(str);text=$(this).text();url=$(this).attr("href");RES=RES+""+text+"

";}});return RES;}})();">sort

 Nice View on Javanotes

	    CSS and hilight java syntax
<a id="codeOut" href="javascript:(function(){var colorScheme='darkula';var link=document.createElement('link');link.setAttribute('rel','stylesheet');link.setAttribute('type','text/css');link.setAttribute('href','//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.1.0/styles/'+colorScheme+'.min.css');document.getElementsByTagName('head')[0].appendChild(link);var script=document.createElement('script');script.setAttribute('type','text/javascript');script.setAttribute('src','//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.1.0/highlight.min.js');document.getElementsByTagName('head')[0].appendChild(script);script.addEventListener('load',function(){var pres=document.querySelectorAll('pre');for(var i=0;i<pres.length;++i){if(!pres[i].querySelector('code')){window.hljs.highlightBlock(pres[i]);}else{window.hljs.highlightBlock(pres[i].querySelectorAll('code')[0]);}}});})();">javanotes

 Stylish CSS

body, p span.code {
    font-family: Helvetica, Arial !important;
    line-height: 1.5;
}
div.page {
    color: #333;
}
pre {
    font-size: 110%;
    background: #333;
    color: #eee;
    padding: 20px;
    line-height: 1.7;
}
small {
    font-size: 130%;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>

        <variable
            name="presenter"
            type="com.fabiolee.architecture.mvp.ui.userlist.UserListPresenter" />

        <variable
            name="user"
            type="com.fabiolee.architecture.mvp.data.model.User" />
    </data>

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:padding="16dp">

        <ImageView
            android:id="@+id/iv_avatar"
            android:layout_width="80dp"
            android:layout_height="80dp"
            android:background="@color/grey"
            android:contentDescription="@null"
            app:loadImage="@{user.avatar_url}" />

        <TextView
            android:id="@+id/tv_title"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_toEndOf="@id/iv_avatar"
            android:layout_toRightOf="@id/iv_avatar"
            android:padding="8dp"
            android:text="@{@string/lbl_title(user.login, user.id)}"
            android:textStyle="bold" />

        <TextView
            android:id="@+id/tv_subtitle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_below="@id/tv_title"
            android:layout_toEndOf="@id/iv_avatar"
            android:layout_toRightOf="@id/iv_avatar"
            android:onClick="@{() -> presenter.openWebsite(user.html_url)}"
            android:padding="8dp"
            android:text="@{user.html_url}" />

    </RelativeLayout>
</layout>


text:
from robot.errors import PassExecution

class Failure(object):

    def __init__(self):
        self.setup = None
        self.test = None
        self.teardown = None

    def __nonzero__(self):
        return bool(self.setup or self.test or self.teardown)

class Exit(object):

    def __init__(self, failure_mode=False, error_mode=False,
                 skip_teardown_mode=False):
        self.failure_mode = failure_mode
        self.error_mode = error_mode
        self.skip_teardown_mode = skip_teardown_mode
        self.failure = False
        self.error = False
        self.fatal = False

    @property
    def teardown_allowed(self):
        return not (self.skip_teardown_mode and self)

    def __nonzero__(self):
        return self.failure or self.error or self.fatal

class _ExecutionStatus(object):

    def __init__(self, parent=None, *exit_modes):
        self.parent = parent
        self.children = []
        self.failure = Failure()
        self.exit = parent.exit if parent else Exit(*exit_modes)
        self._teardown_allowed = False
        if parent:
            parent.children.append(self)

    def setup_executed(self, failure=None):
        if failure and not isinstance(failure, PassExecution):
            self.failure.setup = unicode(failure)
            self._handle_possible_fatal(failure)
        self._teardown_allowed = True

    def _handle_possible_fatal(self, failure):
        if getattr(failure, 'exit', False):
            self.exit.fatal = True

    def teardown_executed(self, failure=None):
        if failure and not isinstance(failure, PassExecution):
            self.failure.teardown = unicode(failure)
            self._handle_possible_fatal(failure)

    def error_occurred(self):
        if self.exit.error_mode:
            self.exit.error = True

    @property
    def teardown_allowed(self):
        return self.exit.teardown_allowed and self._teardown_allowed

    @property
    def failures(self):
        return bool(self.parent and self.parent.failures or
                    self.failure or self.exit)

    def _parent_failures(self):
        return self.parent and self.parent.failures

    @property
    def status(self):
        return 'FAIL' if self.failures else 'PASS'

    @property
    def message(self):
        if self.failure or self.exit:
            return self._my_message()
        if self.parent and self.parent.failures:
            return self._parent_message()
        return ''

    def _my_message(self):
        raise NotImplementedError

    def _parent_message(self):
        return ParentMessage(self.parent).message

class SuiteStatus(_ExecutionStatus):

    def __init__(self, parent=None, exit_on_failure_mode=False,
                 exit_on_error_mode=False,
                 skip_teardown_on_exit_mode=False):
        _ExecutionStatus.__init__(self, parent, exit_on_failure_mode,
                                  exit_on_error_mode,
                                  skip_teardown_on_exit_mode)

    def critical_failure(self):
        if self.exit.failure_mode:
            self.exit.failure = True

    def fatal_failure(self):
        self.exit.fatal = True

    def _my_message(self):
        return SuiteMessage(self).message

class TestStatus(_ExecutionStatus):

    def __init__(self, parent):
        _ExecutionStatus.__init__(self, parent)
        self.exit = parent.exit

    def test_failed(self, failure, critical):
        self.failure.test = unicode(failure)
        if critical and self.exit.failure_mode:
            self.exit.failure = True
        self._handle_possible_fatal(failure)

    def _my_message(self):
        return TestMessage(self).message

class _Message(object):
    setup_message = NotImplemented
    teardown_message = NotImplemented
    also_teardown_message = NotImplemented

    def __init__(self, status):
        self.failure = status.failure

    @property
    def message(self):
        msg = self._get_message_before_teardown()
        return self._get_message_after_teardown(msg)

    def _get_message_before_teardown(self):
        if self.failure.setup:
            return self.setup_message % self.failure.setup
        return self.failure.test or ''

    def _get_message_after_teardown(self, msg):
        if not self.failure.teardown:
            return msg
        if not msg:
            return self.teardown_message % self.failure.teardown
        return self.also_teardown_message % (msg, self.failure.teardown)

class TestMessage(_Message):
    setup_message = 'Setup failed:\n%s'
    teardown_message = 'Teardown failed:\n%s'
    also_teardown_message = '%s\n\nAlso teardown failed:\n%s'
    exit_on_fatal_message = 'Test execution stopped due to a fatal error.'
    exit_on_failure_message = \
        'Critical failure occurred and exit-on-failure mode is in use.'
    exit_on_error_message = 'Error occurred and exit-on-error mode is in use.'

    def __init__(self, status):
        _Message.__init__(self, status)
        self.exit = status.exit

    @property
    def message(self):
        message = super(TestMessage, self).message
        if message:
            return message
        if self.exit.failure:
            return self.exit_on_failure_message
        if self.exit.fatal:
            return self.exit_on_fatal_message
        if self.exit.error:
            return self.exit_on_error_message
        return ''

class SuiteMessage(_Message):
    setup_message = 'Suite setup failed:\n%s'
    teardown_message = 'Suite teardown failed:\n%s'
    also_teardown_message = '%s\n\nAlso suite teardown failed:\n%s'

class ParentMessage(SuiteMessage):
    setup_message = 'Parent suite setup failed:\n%s'
    teardown_message = 'Parent suite teardown failed:\n%s'
    also_teardown_message = '%s\n\nAlso parent suite teardown failed:\n%s'

    def __init__(self, status):
        while status.parent and status.parent.failures:
            status = status.parent
        SuiteMessage.__init__(self, status)