text:
template <typename ProbT>
class GpuCTC {
    public:
        GpuCTC(int alphabet_size,
               int minibatch,
               void *workspace,
               GPUstream stream,
               int blank_label) :
            out_dim_(alphabet_size), minibatch_(minibatch),
            gpu_workspace_(workspace), stream_(stream),
            blank_label_(blank_label) {};

        // Noncopyable
        GpuCTC(const GpuCTC&) = delete;
        GpuCTC& operator=(const GpuCTC&) = delete;

        ctcStatus_t
        cost_and_grad(const ProbT* const activations,
                      ProbT* grads,
                      ProbT* costs,
                      const int* const flat_labels,
                      const int* const label_lengths,
                      const int* const input_lengths);

        ctcStatus_t
        score_forward(const ProbT* const activations,
                      ProbT* costs,
                      const int* const flat_labels,
                      const int* const label_lengths,
                      const int* const input_lengths);

    private:

        template<int NT, int VT>
        ctcStatus_t launch_alpha_beta_kernels(const ProbT* const probs,
                                              ProbT *grads,
                                              bool compute_alpha,
                                              bool compute_beta);

        ctcStatus_t
        launch_gpu_kernels(const ProbT* const probs,
                           ProbT *grads,
                           size_t config,
                           bool launch_alpha,
                           bool launch_beta);

        ctcStatus_t
        setup_gpu_metadata(const int* const flat_labels,
                           const int* const label_lengths,
                           const int* const input_lengths);

        ctcStatus_t
        create_metadata_and_choose_config(const int* const label_lengths,
                                          const int* const flat_labels,
                                          const int* const input_lengths,
                                          size_t& best_config);

        ctcStatus_t
        compute_probs(const ProbT* const activations);

        ctcStatus_t
        compute_cost_and_score(const ProbT* const activations,
                               ProbT* grads,
                               ProbT* costs,
                               const int* const flat_labels,
                               const int* const label_lengths,
                               const int* const input_lengths,
                               bool compute_alpha,
                               bool compute_betas_and_grad);

        int out_dim_; // Number of characters plus blank
        int minibatch_;

        int S_;
        int T_;

        int activation_cols_; // Number of columns in activations

        GPUstream stream_;

        int blank_label_;

        void *gpu_workspace_; // Buffer for all temporary GPU memory
        int *utt_length_; // T
        int *label_sizes_; // L
        int *repeats_; // repeats_
        int *label_offsets_;
        int *labels_without_blanks_;
        int *labels_with_blanks_;
        ProbT *alphas_;
        ProbT *nll_forward_;
        ProbT *nll_backward_;
        ProbT *denoms_; // Temporary storage for denoms for softmax
        ProbT *probs_; // Temporary storage for probabilities (softmax output)
};

template<typename ProbT>
ctcStatus_t
GpuCTC<ProbT>::setup_gpu_metadata(const int* const flat_labels,
                                  const int* const label_lengths,
                                  const int* const input_lengths)
{
    size_t gpu_bytes_used = 0;

    nll_forward_ =
        reinterpret_cast<ProbT *>(static_cast<char*>(gpu_workspace_) +
                                  gpu_bytes_used);
    gpu_bytes_used += minibatch_ * sizeof(ProbT);

    nll_backward_ =
        reinterpret_cast<ProbT *>(static_cast<char*>(gpu_workspace_) +
                                  gpu_bytes_used);
    gpu_bytes_used += minibatch_ * sizeof(ProbT);

    repeats_ =
        reinterpret_cast<int *>(static_cast<char*>(gpu_workspace_) +
                                gpu_bytes_used);
    gpu_bytes_used += minibatch_ * sizeof(int);

    label_offsets_ =
        reinterpret_cast<int *>(static_cast<char*>(gpu_workspace_) +
                                gpu_bytes_used);
    gpu_bytes_used += minibatch_ * sizeof(int);

    // This is the max of all S and T for all valid examples in the minibatch.
    // A valid example is one for which L + repeats <= T
    S_ = 0;
    T_ = 0;

    // This is the max of all timesteps, valid or not. Needed to compute offsets
    int Tmax = 0;

    // This is the max of all labels, valid or not. Needed to compute offsets
    int Lmax = 0;
    int total_label_length = 0;

    constexpr int cpu_buffer_size = 64;
    int repeats[cpu_buffer_size];
    int label_offsets[cpu_buffer_size];

    const int num_passes = ctc_helper::div_up(minibatch_, cpu_buffer_size);

    gpuError_t cuda_status;

    for (int pass = 0; pass < num_passes; ++pass) {

        const int start_idx = pass * cpu_buffer_size;
        const int end_idx = std::min(minibatch_, (pass+1) * cpu_buffer_size);

        for (int j = start_idx; j < end_idx; ++j) {
            const int L = label_lengths[j];
            const int local_T = input_lengths[j];
            const int *label_ptr = &(flat_labels[total_label_length]);

            label_offsets[j % cpu_buffer_size] = total_label_length;
            total_label_length += L;

            int repeat_counter = 0;

            for (int i = 1; i < L; ++i)
                repeat_counter += (label_ptr[i] == label_ptr[i-1]);

            repeats[j % cpu_buffer_size] = repeat_counter;
            const bool valid_label = ((L + repeat_counter) <= local_T);

            // Only update S and T if label is valid
            S_ = (valid_label) ? std::max(S_, L) : S_;
            T_ = (valid_label) ? std::max(T_, local_T) : T_;

            Tmax = std::max(Tmax, local_T);
            Lmax = std::max(Lmax, L);
        }

#ifdef __HIPCC__
        cuda_status = hipMemcpyAsync(&(repeats_[start_idx]), repeats,
                                      (end_idx - start_idx) * sizeof(int),
                                      hipMemcpyHostToDevice, stream_);
#else
        cuda_status = cudaMemcpyAsync(&(repeats_[start_idx]), repeats,
                                      (end_idx - start_idx) * sizeof(int),
                                      cudaMemcpyHostToDevice, stream_);
#endif

        if (cuda_status != gpuSuccess)
            return CTC_STATUS_MEMOPS_FAILED;

#ifdef __HIPCC__
        cuda_status = hipMemcpyAsync(&(label_offsets_[start_idx]), label_offsets,
                                      (end_idx - start_idx) * sizeof(int),
                                      hipMemcpyHostToDevice, stream_);
#else
        cuda_status = cudaMemcpyAsync(&(label_offsets_[start_idx]), label_offsets,
                                      (end_idx - start_idx) * sizeof(int),
                                      cudaMemcpyHostToDevice, stream_);
#endif

        if (cuda_status != gpuSuccess)
            return CTC_STATUS_MEMOPS_FAILED;
    }

    S_ = 2 * S_ + 1;
    const int Smax = 2 * Lmax + 1;

    activation_cols_ = minibatch_ * Tmax;

    // Allocate memory for T
    utt_length_ =
        reinterpret_cast<int *>(static_cast<char*>(gpu_workspace_) +
                                gpu_bytes_used);
    gpu_bytes_used += minibatch_  * sizeof(int);

#ifdef __HIPCC__
    cuda_status = hipMemcpyAsync(utt_length_, input_lengths,
                                  minibatch_ * sizeof(int),
                                  hipMemcpyHostToDevice, stream_);
#else
    cuda_status = cudaMemcpyAsync(utt_length_, input_lengths,
                                  minibatch_ * sizeof(int),
                                  cudaMemcpyHostToDevice, stream_);
#endif

    if (cuda_status != gpuSuccess)
        return CTC_STATUS_MEMOPS_FAILED;

    label_sizes_ =
        reinterpret_cast<int *>(static_cast<char*>(gpu_workspace_) +
                                gpu_bytes_used);
    gpu_bytes_used += minibatch_ * sizeof(int);

#ifdef __HIPCC__
    cuda_status = hipMemcpyAsync(label_sizes_, label_lengths,
                                  minibatch_ * sizeof(int),
                                  hipMemcpyHostToDevice, stream_);
#else
    cuda_status = cudaMemcpyAsync(label_sizes_, label_lengths,
                                  minibatch_ * sizeof(int),
                                  cudaMemcpyHostToDevice, stream_);
#endif

    if (cuda_status != gpuSuccess)
        return CTC_STATUS_MEMOPS_FAILED;

    labels_without_blanks_ =
        reinterpret_cast<int *>(static_cast<char*>(gpu_workspace_) +
                                gpu_bytes_used);
    gpu_bytes_used += Lmax * minibatch_ * sizeof(int);

#ifdef __HIPCC__
    cuda_status = hipMemcpyAsync(labels_without_blanks_, flat_labels,
                                  total_label_length * sizeof(int),
                                  hipMemcpyHostToDevice, stream_);
#else
    cuda_status = cudaMemcpyAsync(labels_without_blanks_, flat_labels,
                                  total_label_length * sizeof(int),
                                  cudaMemcpyHostToDevice, stream_);
#endif

    if (cuda_status != gpuSuccess)
        return CTC_STATUS_MEMOPS_FAILED;

    labels_with_blanks_ =
        reinterpret_cast<int *>(static_cast<char*>(gpu_workspace_) +
                                gpu_bytes_used);
    gpu_bytes_used += Smax * minibatch_ * sizeof(int);

    alphas_ =
        reinterpret_cast<ProbT *>(static_cast<char*>(gpu_workspace_) +
                                  gpu_bytes_used);
    gpu_bytes_used += (S_ * T_) * minibatch_ * sizeof(ProbT);

    denoms_ =
        reinterpret_cast<ProbT *>(static_cast<char*>(gpu_workspace_) +
                                  gpu_bytes_used);
    gpu_bytes_used += activation_cols_ * sizeof(ProbT);

    probs_ =
        reinterpret_cast<ProbT *>(static_cast<char*>(gpu_workspace_) +
                                  gpu_bytes_used);
    gpu_bytes_used += out_dim_ * activation_cols_ * sizeof(ProbT);

    return CTC_STATUS_SUCCESS;
}

template<typename ProbT>
template<int NT, int VT>
ctcStatus_t GpuCTC<ProbT>::launch_alpha_beta_kernels(const ProbT* const probs,
                                                     ProbT* grads,
                                                     bool compute_alpha,
                                                     bool compute_beta ) {

    // One thread block per utterance
    const int grid_size = minibatch_;

    // The data is laid out so that the next timestep is minibatch entries
    // away
    const int stride = minibatch_;

    if (compute_alpha)
        compute_alpha_kernel<ProbT, NT, VT><<<grid_size, NT, 0, stream_>>>
            (probs, label_sizes_, utt_length_,
             repeats_, labels_without_blanks_, label_offsets_,
             labels_with_blanks_, alphas_, nll_forward_,
             stride, out_dim_, S_, T_, blank_label_);

    if (compute_beta) {
        compute_betas_and_grad_kernel<ProbT, NT, VT><<<grid_size, NT, 0, stream_>>>
            (probs, label_sizes_, utt_length_, repeats_,
             labels_with_blanks_, alphas_, nll_forward_, nll_backward_,
             grads, stride, out_dim_, S_, T_, blank_label_);

#ifdef __HIPCC__
        hipStreamSynchronize(stream_);
#else
        cudaStreamSynchronize(stream_);
#endif
    }

#ifdef __HIPCC__
    gpuError_t err = hipGetLastError();
#else
    gpuError_t err = cudaGetLastError();
#endif

    if (err != gpuSuccess)
        return CTC_STATUS_EXECUTION_FAILED;

    return CTC_STATUS_SUCCESS;
}

template<typename ProbT>
ctcStatus_t
GpuCTC<ProbT>::create_metadata_and_choose_config(const int* const flat_labels,
                                                 const int* const label_lengths,
                                                 const int* const input_lengths,
                                                 size_t& best_config) {

    // Setup the metadata for GPU
    ctcStatus_t status = setup_gpu_metadata(flat_labels, label_lengths, input_lengths);
    if (status != CTC_STATUS_SUCCESS)
        return status;

    constexpr int num_configs = 12;

    int config_NT[num_configs] =
        {32, 64, 128, 64, 128, 32, 64, 128, 64, 128, 128, 128};
    int config_VT[num_configs] =
        { 1,  1,   1,  3,   2,  9,  6,   4,  9,   6,   9,  10};

    best_config = 0;

    for (int i = 0; i < num_configs; ++i) {
        if ((config_NT[i]* config_VT[i]) >= S_)
            break;
        else
            best_config++;
    }

    if (best_config >= num_configs)
        return CTC_STATUS_UNKNOWN_ERROR;

    return CTC_STATUS_SUCCESS;
}

template<typename ProbT>
ctcStatus_t
GpuCTC<ProbT>::launch_gpu_kernels(const ProbT* const probs,
                                  ProbT* grads,
                                  size_t config,
                                  bool l_a,
                                  bool l_b) {

    switch(config) {
        case 0:   {return launch_alpha_beta_kernels<32,   1>(probs, grads, l_a, l_b);}
        case 1:   {return launch_alpha_beta_kernels<64,   1>(probs, grads, l_a, l_b);}
        case 2:   {return launch_alpha_beta_kernels<128,  1>(probs, grads, l_a, l_b);}
        case 3:   {return launch_alpha_beta_kernels<64,   3>(probs, grads, l_a, l_b);}
        case 4:   {return launch_alpha_beta_kernels<128,  2>(probs, grads, l_a, l_b);}
        case 5:   {return launch_alpha_beta_kernels<32,   9>(probs, grads, l_a, l_b);}
        case 6:   {return launch_alpha_beta_kernels<64,   6>(probs, grads, l_a, l_b);}
        case 7:   {return launch_alpha_beta_kernels<128,  4>(probs, grads, l_a, l_b);}
        case 8:   {return launch_alpha_beta_kernels<64,   9>(probs, grads, l_a, l_b);}
        case 9:   {return launch_alpha_beta_kernels<128,  6>(probs, grads, l_a, l_b);}
        case 10:  {return launch_alpha_beta_kernels<128,  9>(probs, grads, l_a, l_b);}
        case 11:  {return launch_alpha_beta_kernels<128, 10>(probs, grads, l_a, l_b);}
    }

    return CTC_STATUS_EXECUTION_FAILED;
}

template<typename ProbT>
ctcStatus_t
GpuCTC<ProbT>::compute_probs(const ProbT* const activations) {

    gpuError_t cuda_status;

#ifdef __HIPCC__
    cuda_status =
        hipMemcpyAsync(probs_, activations,
                        activation_cols_ * out_dim_ *sizeof(ProbT),
                        hipMemcpyDeviceToDevice, stream_);
#else
    cuda_status =
        cudaMemcpyAsync(probs_, activations,
                        activation_cols_ * out_dim_ *sizeof(ProbT),
                        cudaMemcpyDeviceToDevice, stream_);
#endif

    if (cuda_status != gpuSuccess)
        return CTC_STATUS_MEMOPS_FAILED;

    // Numerically stable SM
    ctcStatus_t ctc_status =
        reduce_max<ProbT>(probs_, denoms_, out_dim_,
                   activation_cols_, 1, stream_);
    if (ctc_status != CTC_STATUS_SUCCESS)
        return ctc_status;

    // Kernel launch to subtract maximum
    const int NT = 128;
    const int VT = 1;
    const int NV = NT * VT;
    const int num_elements = out_dim_ * activation_cols_;
    const int grid_size = ctc_helper::div_up(num_elements, NV);

    prepare_stable_SM_kernel<ProbT, VT> <<< grid_size, NT, 0, stream_>>>
       (ctc_helper::identity<ProbT>(), probs_,
        denoms_, out_dim_, num_elements);

    // Reduce along columns to calculate denominator
    ctc_status =
        reduce_exp<ProbT>(probs_, denoms_, out_dim_,
                   activation_cols_, 1, stream_);
    if (ctc_status != CTC_STATUS_SUCCESS)
        return ctc_status;

    // Kernel launch to calculate probabilities
    compute_probs_kernel<ProbT, VT><<<grid_size, NT, 0, stream_>>>
        (ctc_helper::exponential<ProbT>(), probs_,
         denoms_, out_dim_, num_elements);

    truncate_probs_kernel<ProbT, VT><<<grid_size, NT, 0, stream_>>>
        (probs_, num_elements);

    return CTC_STATUS_SUCCESS;
}

template<typename ProbT>
ctcStatus_t
GpuCTC<ProbT>::compute_cost_and_score(const ProbT* const activations,
                                      ProbT* grads,
                                      ProbT* costs,
                                      const int* const flat_labels,
                                      const int* const label_lengths,
                                      const int* const input_lengths,
                                      bool compute_alpha,
                                      bool compute_betas_and_grad) {

    size_t best_config;
    ctcStatus_t status = create_metadata_and_choose_config(flat_labels,
                                                           label_lengths,
                                                           input_lengths,
                                                           best_config);
    if (status != CTC_STATUS_SUCCESS)
        return status;

    status = compute_probs(activations);
    if (status != CTC_STATUS_SUCCESS)
        return status;

    launch_gpu_kernels(probs_, grads, best_config,
                       compute_alpha, compute_betas_and_grad);

    gpuError_t cuda_status_mem, cuda_status_sync;

#ifdef __HIPCC__
    cuda_status_mem = hipMemcpyAsync(costs, nll_forward_,
                                      sizeof(ProbT) * minibatch_,
                                      hipMemcpyDeviceToHost, stream_);
#else
    cuda_status_mem = cudaMemcpyAsync(costs, nll_forward_,
                                      sizeof(ProbT) * minibatch_,
                                      cudaMemcpyDeviceToHost, stream_);
#endif

#ifdef __HIPCC__
    cuda_status_sync = hipStreamSynchronize(stream_);
#else
    cuda_status_sync = cudaStreamSynchronize(stream_);
#endif

    if (cuda_status_mem != gpuSuccess || cuda_status_sync != gpuSuccess)
        return CTC_STATUS_MEMOPS_FAILED;

    return CTC_STATUS_SUCCESS;
}

template<typename ProbT>
ctcStatus_t
GpuCTC<ProbT>::cost_and_grad(const ProbT* const activations,
                             ProbT* grads,
                             ProbT* costs,
                             const int* const flat_labels,
                             const int* const label_lengths,
                             const int* const input_lengths) {
    if (activations == nullptr ||
        grads == nullptr ||
        costs == nullptr ||
        flat_labels == nullptr ||
        label_lengths == nullptr ||
        input_lengths == nullptr
        )
        return CTC_STATUS_INVALID_VALUE;

    return compute_cost_and_score(activations, grads, costs, flat_labels,
                                  label_lengths, input_lengths, true, true);
}

template<typename ProbT>
ctcStatus_t
GpuCTC<ProbT>::score_forward(const ProbT* const activations,
                             ProbT* costs,
                             const int* const flat_labels,
                             const int* const label_lengths,
                             const int* const input_lengths) {
    if (activations == nullptr ||
        costs == nullptr ||
        flat_labels == nullptr ||
        label_lengths == nullptr ||
        input_lengths == nullptr
        )
        return CTC_STATUS_INVALID_VALUE;

    return compute_cost_and_score(activations, nullptr, costs, flat_labels,
                                  label_lengths, input_lengths, true, false);
}


text:
package com.fs.xml2json.cli;

import com.fs.xml2json.core.Config;
import java.io.File;
import java.io.FileNotFoundException;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Specific class which responsible for parsing input arguments and validation.
 *
 * @author Anton Mykolaienko
 * @since 1.2.0
 */
public class ApplicationCommandLine {

    private static final Logger LOGGER = LoggerFactory.getLogger(ApplicationCommandLine.class);

    private static final Boolean DEFAULT_FORCE_OVERWRITE = false;
    private static final String PARAMETER_MISSING_TEPLATE = "Parameter '--%s' is not set";
    private static final String PARAM_SIGN = "--";
    /**
     * Size of help text.
     */
    private static final int HELP_WINDOW_SIZE = 120;
    private static final Options OPTIONS = new Options();

    static {
        OPTIONS.addOption("g", Config.PAR_NO_GUI, false,
                "Flag to start Application without GUI in command line mode");
        OPTIONS.addOption("s", Config.PAR_SOURCE_FOLDER, true,
                "Path to folder with files to convert\n\tExample: C:\\temp\\input");
        OPTIONS.addOption("d", Config.PAR_DESTINATION_FOLDER, true,
                "Path to folder for converted files\n\tExample: C:\\temp\\output");
        OPTIONS.addOption("p", Config.PAR_SOURCE_FILE_PATTERN, true,
                "Pattern for filtering input files\n\tExample: *.json");
        OPTIONS.addOption("o", Config.PAR_FORCE_OVERWRITE, false,
                "Force overwrite existing converted files (Default: false)");
    }

    private final CommandLine cmd;

    // source file or folder with files to convert.
    private File sourcePath = null;
    // path to destination folder, where converted files must be stored
    private File destinationPath = null;
    // pattern for filtering files
    private String pattern = null;
    // flag to overwrite existing files
    private Boolean forceOverwrite;

    /**
     * Private constructor.
     *
     * @param cmd parsed command line
     */
    private ApplicationCommandLine(CommandLine cmd) {
        this.cmd = cmd;
    }

    /**
     * Parses application's input arguments and returns {@link ApplicationCommandLine} with parsed values.
     *
     * @param args command line arguments
     * @return {@link ApplicationCommandLine}
     * @throws java.text.ParseException if there are any problems encountered
     * while parsing the command line tokens.
     * @throws FileNotFoundException if source folder not found (only for NoGUI mode)
     */
    public static ApplicationCommandLine parse(String[] args) throws java.text.ParseException, FileNotFoundException {
        CommandLineParser parser = new DefaultParser();

        ApplicationCommandLine cmd = null;
        try {
            cmd = new ApplicationCommandLine(parser.parse(OPTIONS, args, true));
            cmd.checkInputParameters();
        } catch (ParseException ex) {
            throw new java.text.ParseException(ex.getMessage(), 0);
        }

        return cmd;
    }

    /**
     * Prints description for application's parameters and examples.
     */
    public static void printHelp() {
        HelpFormatter formatter = new HelpFormatter();
        formatter.printHelp(HELP_WINDOW_SIZE, "\n  java -jar xml2json.jar "
                + PARAM_SIGN + Config.PAR_NO_GUI + " "
                + PARAM_SIGN + Config.PAR_SOURCE_FOLDER + "=[path_to_source_folder] "
                + PARAM_SIGN + Config.PAR_DESTINATION_FOLDER + "=[path_to_destination_folder] "
                + PARAM_SIGN + Config.PAR_SOURCE_FILE_PATTERN + "=[*.json|*.xml]",
                ", where:",
                OPTIONS,
                "example:\n  java -jar xml2json.jar "
                + PARAM_SIGN + Config.PAR_NO_GUI + " "
                + PARAM_SIGN + Config.PAR_SOURCE_FOLDER + "=C:\\temp\\input "
                + PARAM_SIGN + Config.PAR_DESTINATION_FOLDER + "=C:\\temp\\output "
                + PARAM_SIGN + Config.PAR_SOURCE_FILE_PATTERN + "=*.json\n\n");
    }

    /**
     * Checks input parameters and throws exception if mandatory values are missing.
     *
Creates Destination directories.
     * @throws FileNotFoundException if source folder is not exist
     */
    private void checkInputParameters() throws FileNotFoundException {
        boolean isNoGuiEnabled = cmd.hasOption(Config.PAR_NO_GUI);
        String sourceFolderTxt = cmd.getOptionValue(Config.PAR_SOURCE_FOLDER);
        String destinationFolderTxt = cmd.getOptionValue(Config.PAR_DESTINATION_FOLDER);
        String patternTxt = cmd.getOptionValue(Config.PAR_SOURCE_FILE_PATTERN);

        if (isNoGuiEnabled) {
            if (null == sourceFolderTxt) {
                throw new IllegalArgumentException(String.format(PARAMETER_MISSING_TEPLATE,
                        Config.PAR_SOURCE_FOLDER));
            }
            if (null == destinationFolderTxt) {
                throw new IllegalArgumentException(String.format(PARAMETER_MISSING_TEPLATE,
                        Config.PAR_DESTINATION_FOLDER));
            }
            if (null == patternTxt) {
                throw new IllegalArgumentException(String.format(PARAMETER_MISSING_TEPLATE,
                        Config.PAR_SOURCE_FILE_PATTERN));
            }
            File sourceFolder = new File(sourceFolderTxt);
            if (sourceFolder.exists() && sourceFolder.isFile()) {
                throw new IllegalArgumentException(String.format("Parameter '%s' should point "
                        + "to Directory not to File", Config.PAR_SOURCE_FILE_PATTERN));
            }
            if (!sourceFolder.exists()) {
                throw new FileNotFoundException("Directory '" + sourceFolderTxt + "' not found, nothing to convert...");
            } else if (sourceFolder.list().length == 0) {
                LOGGER.info("Source directory ('{}') is empty, nothing to convert", sourceFolderTxt);
            }

            File destinationFolder = new File(destinationFolderTxt);
            if (!destinationFolder.exists()) {
                destinationFolder.mkdirs();
            }
        }
    }

    /**
     * Returns true if application started with nogui flag.
     *
     * @return true or false
     */
    public boolean isNoGuiEnabled() {
        return cmd.hasOption(Config.PAR_NO_GUI);
    }

    /**
     * Returns link to source File (or Folder with files) to convert.
     *
     * @return link to File (or Folder with files) to convert
     */
    public File getSourceFolder() {
        if (null == sourcePath && isNoGuiEnabled()) {
            sourcePath = new File(cmd.getOptionValue(Config.PAR_SOURCE_FOLDER));
        }

        return sourcePath;
    }

    /**
     * Returns link to Folder where converted files must be stored.
     *
     * @return link to Folder
     */
    public File getDestinationFolder() {
        if (null == destinationPath && isNoGuiEnabled()) {
            destinationPath = new File(cmd.getOptionValue(Config.PAR_DESTINATION_FOLDER));
        }

        return destinationPath;
    }

    /**
     * Returns pattern for filtering files in source folder.
     *
     * @return pattern value
     */
    public String getPattern() {
        if (null == pattern && isNoGuiEnabled()) {
            pattern = cmd.getOptionValue(Config.PAR_SOURCE_FILE_PATTERN);
        }

        return pattern;
    }

    /**
     * Returns true if existing files must be overwritten at Destination folder,
     * othervise returns false (Default value).
     *
     * @return true or false
     */
    public boolean isForceOverwrite() {
        if (null == forceOverwrite) {
            forceOverwrite = cmd.hasOption(Config.PAR_FORCE_OVERWRITE) || DEFAULT_FORCE_OVERWRITE;
        }

        return forceOverwrite;
    }
}

redpajama_set_name: RedPajamaGithub


text:
using System;

namespace SpirvNet.Spirv.Enums
{
    /// <summary>
    /// Used by OpFunction.
    /// </summary>
    [Flags]
    public enum FunctionControlMask
    {
        None = 0,
        /// <summary>
        /// Strong request, to the extent possible, to inline the function
        /// </summary>
        InLine = 1,
        /// <summary>
        /// Strong request, to the extent possible, to not inline the
        /// function
        /// </summary>
        DontInline = 2,
        /// <summary>
        /// Compiler can assume this function has no side effect, but
        /// might read global memory or read through dereferenced
        /// function parameters. Always computes the same result for
        /// the same argument values
        /// </summary>
        Pure = 4,
        /// <summary>
        /// Compiler can assume this function has no side effects, and
        /// will not access global memory or dereference function
        /// parameters. Always computes the same result for the same
        /// argument values
        /// </summary>
        Const = 8
    }
}


text:
namespace gfx {

class GL_EXPORT GLImageEGL : public GLImage {
 public:
  explicit GLImageEGL(gfx::Size size);

  bool Initialize(gfx::GpuMemoryBufferHandle buffer);

  // Implement GLImage.
  virtual void Destroy() OVERRIDE;
  virtual gfx::Size GetSize() OVERRIDE;
  virtual bool BindTexImage(unsigned target) OVERRIDE;
  virtual void ReleaseTexImage(unsigned target) OVERRIDE;
  virtual void WillUseTexImage() OVERRIDE;
  virtual void DidUseTexImage() OVERRIDE;
  virtual void SetReleaseAfterUse() OVERRIDE;

 protected:
  virtual ~GLImageEGL();

 private:
  EGLImageKHR egl_image_;
  gfx::Size size_;
  bool release_after_use_;
  bool in_use_;
  unsigned target_;

  DISALLOW_COPY_AND_ASSIGN(GLImageEGL);
};

}  // namespace gfx

#endif  // UI_GL_GL_IMAGE_EGL_H_


text:
require File.expand_path('../../spec_helper', __FILE__)
require 'net/https'

if ( System.get_property('platform') != 'ANDROID' )

describe "NetHttp#https" do

  it "gets web page content by https" do

    uri = URI('https://docs.rhomobile.com/')

    req = Net::HTTP::Get.new(uri.request_uri)
    res = Net::HTTP.start(uri.host, uri.port,
                   :use_ssl => uri.scheme == 'https',
                   :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
      http.request req
    end

    res.code.should == "200"
    res.message.should == "OK"
    res.class.name.should == "Net::HTTPOK"
  end

end

end


text:
namespace Einstein.DataAccess.Operation
{
	public class InputCommandParameter : ICommandParameter
	{
		public InputCommandParameter(string name, object value)
		{
			Name = name;
			Value = value;
		}

		public string Name { get; private set; }
		public object Value { get; private set; }
	}
}


text:
using System;

namespace OpenLiveWriter.Extensibility.ImageEditing
{
    public interface IImageDecoratorUndoUnit : IDisposable
    {
        void Commit();
    }
}


text:
<?php

namespace phpDocumentor\Descriptor;

use Mockery as m;
use phpDocumentor\Descriptor\Tag\AuthorDescriptor;
use phpDocumentor\Descriptor\Tag\VersionDescriptor;

/**
 * Tests the functionality for the InterfaceDescriptor class.
 */
class InterfaceDescriptorTest extends \PHPUnit_Framework_TestCase
{
    /** @var InterfaceDescriptor $fixture */
    protected $fixture;

    /**
     * Creates a new (empty) fixture object.
     */
    protected function setUp()
    {
        $this->fixture = new InterfaceDescriptor();
    }

    /**
     * Tests whether all collection objects are properly initialized.
     *
     * @covers phpDocumentor\Descriptor\InterfaceDescriptor::__construct
     */
    public function testInitialize()
    {
        $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'parents', $this->fixture);
        $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'constants', $this->fixture);
        $this->assertAttributeInstanceOf('phpDocumentor\Descriptor\Collection', 'methods', $this->fixture);
    }

    /**
     * @covers phpDocumentor\Descriptor\InterfaceDescriptor::setParent
     * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getParent
     */
    public function testSettingAndGettingParentInterfaces()
    {
        $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getParent());

        $mock = m::mock('phpDocumentor\Descriptor\Collection');

        $this->fixture->setParent($mock);

        $this->assertSame($mock, $this->fixture->getParent());
    }

    /**
     * @covers phpDocumentor\Descriptor\InterfaceDescriptor::setConstants
     * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getConstants
     */
    public function testSettingAndGettingConstants()
    {
        $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getConstants());

        $mock = m::mock('phpDocumentor\Descriptor\Collection');

        $this->fixture->setConstants($mock);

        $this->assertSame($mock, $this->fixture->getConstants());
    }

    /**
     * @covers phpDocumentor\Descriptor\InterfaceDescriptor::setMethods
     * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getMethods
     */
    public function testSettingAndGettingMethods()
    {
        $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $this->fixture->getMethods());

        $mock = m::mock('phpDocumentor\Descriptor\Collection');

        $this->fixture->setMethods($mock);

        $this->assertSame($mock, $this->fixture->getMethods());
    }

    /**
     * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getInheritedConstants
     */
    public function testGetInheritedConstantsNoParent()
    {
        $descriptor = new InterfaceDescriptor();
        $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedConstants());

        $descriptor->setParent(new \stdClass());
        $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $descriptor->getInheritedConstants());
    }

    /**
     * @covers phpDocumentor\Descriptor\DescriptorAbstract::getSummary
     */
    public function testSummaryInheritsWhenNoneIsPresent()
    {
        // Arrange
        $summary = 'This is a summary';
        $this->fixture->setSummary(null);
        $parentInterface = $this->whenFixtureHasParentInterface();
        $parentInterface->setSummary($summary);

        // Act
        $result = $this->fixture->getSummary();

        // Assert
        $this->assertSame($summary, $result);
    }

    /**
     * @covers phpDocumentor\Descriptor\DescriptorAbstract::getDescription
     */
    public function testDescriptionInheritsWhenNoneIsPresent()
    {
        // Arrange
        $description = 'This is a description';
        $this->fixture->setDescription(null);
        $parentInterface = $this->whenFixtureHasParentInterface();
        $parentInterface->setDescription($description);

        // Act
        $result = $this->fixture->getDescription();

        // Assert
        $this->assertSame($description, $result);
    }

    /**
     * @covers phpDocumentor\Descriptor\DescriptorAbstract::getAuthor
     */
    public function testAuthorTagsInheritWhenNoneArePresent()
    {
        // Arrange
        $authorTagDescriptor = new AuthorDescriptor('author');
        $authorCollection = new Collection(array($authorTagDescriptor));
        $this->fixture->getTags()->clear();
        $parentProperty = $this->whenFixtureHasParentInterface();
        $parentProperty->getTags()->set('author', $authorCollection);

        // Act
        $result = $this->fixture->getAuthor();

        // Assert
        $this->assertSame($authorCollection, $result);
    }

    /**
     * @covers phpDocumentor\Descriptor\DescriptorAbstract::getCopyright
     */
    public function testCopyrightTagsInheritWhenNoneArePresent()
    {
        // Arrange
        $copyrightTagDescriptor = new TagDescriptor('copyright');
        $copyrightCollection = new Collection(array($copyrightTagDescriptor));
        $this->fixture->getTags()->clear();
        $parentProperty = $this->whenFixtureHasParentInterface();
        $parentProperty->getTags()->set('copyright', $copyrightCollection);

        // Act
        $result = $this->fixture->getCopyright();

        // Assert
        $this->assertSame($copyrightCollection, $result);
    }

    /**
     * @covers phpDocumentor\Descriptor\DescriptorAbstract::getVersion
     */
    public function testVersionTagsInheritWhenNoneArePresent()
    {
        // Arrange
        $versionTagDescriptor = new VersionDescriptor('version');
        $versionCollection = new Collection(array($versionTagDescriptor));
        $this->fixture->getTags()->clear();
        $parentProperty = $this->whenFixtureHasParentInterface();
        $parentProperty->getTags()->set('version', $versionCollection);

        // Act
        $result = $this->fixture->getVersion();

        // Assert
        $this->assertSame($versionCollection, $result);
    }
    /**
     * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getInheritedConstants
     */
    public function testGetInheritedConstantsWithClassDescriptorParent()
    {
        $parentDescriptor = new ConstantDescriptor();
        $parentDescriptor->setName('parent');
        $parentDescriptorCollection = new Collection();
        $parentDescriptorCollection->add($parentDescriptor);
        $parent = new InterfaceDescriptor();
        $parent->setConstants($parentDescriptorCollection);

        $grandParentDescriptor = new ConstantDescriptor();
        $grandParentDescriptor->setName('grandparent');
        $grandParentDescriptorCollection = new Collection();
        $grandParentDescriptorCollection->add($grandParentDescriptor);
        $grandParent = new InterfaceDescriptor();
        $grandParent->setConstants($grandParentDescriptorCollection);

        $grandParentCollection = new Collection();
        $grandParentCollection->add($grandParent);
        $parent->setParent($grandParentCollection);

        $parentCollection = new Collection();
        $parentCollection->add($parent);

        $this->fixture->setParent($parentCollection);
        $result = $this->fixture->getInheritedConstants();

        $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result);

        $this->assertSame(array($parentDescriptor, $grandParentDescriptor), $result->getAll());
    }

    /**
     * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getInheritedMethods
     */
    public function testRetrievingInheritedMethodsReturnsEmptyCollectionWithoutParent()
    {
        $inheritedMethods = $this->fixture->getInheritedMethods();
        $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $inheritedMethods);
        $this->assertCount(0, $inheritedMethods);
    }

    /**
     * @covers phpDocumentor\Descriptor\InterfaceDescriptor::getInheritedMethods
     */
    public function testRetrievingInheritedMethodsReturnsCollectionWithParent()
    {
        $parentDescriptor = new MethodDescriptor();
        $parentDescriptor->setName('parent');
        $parentDescriptorCollection = new Collection();
        $parentDescriptorCollection->add($parentDescriptor);
        $parent = new InterfaceDescriptor();
        $parent->setMethods($parentDescriptorCollection);
        $parentCollection = new Collection();
        $parentCollection->add($parent);

        $grandParentDescriptor = new MethodDescriptor();
        $grandParentDescriptor->setName('grandparent');
        $grandParentDescriptorCollection = new Collection();
        $grandParentDescriptorCollection->add($grandParentDescriptor);
        $grandParent = new InterfaceDescriptor();
        $grandParent->setMethods($grandParentDescriptorCollection);
        $grandParentCollection = new Collection();
        $grandParentCollection->add($grandParent);

        $parent->setParent($grandParentCollection);

        $this->fixture->setParent($parentCollection);
        $result = $this->fixture->getInheritedMethods();

        $this->assertInstanceOf('phpDocumentor\Descriptor\Collection', $result);

        $this->assertSame(array($parentDescriptor, $grandParentDescriptor), $result->getAll());
    }

    /**
     * @return InterfaceDescriptor
     */
    protected function whenFixtureHasParentInterface()
    {
        $interface = new InterfaceDescriptor();
        $this->fixture->getParent()->set('IA', $interface);

        return $interface;
    }
}


text:
.nav-tree { height: 100%; overflow: auto; }
.nav-tree > li > a:before {
    position: relative;
    /*top: 2px;*/
    display: inline-block;
    font-family: 'Glyphicons Halflings';
    -webkit-font-smoothing: antialiased;
    font-style: normal;
    font-weight: normal;
    line-height: 1;
    content: "\2b";
    font-size: 80%;
}
.nav-tree li a { padding: 3px 5px; }
.nav-tree li ul { margin-left: 10px; }
.nav-tree li li a { padding: 2px 5px; font-size: 90%; }

#skillPanel span.rank { font-size: 80%; margin: 0 10px; }
#skillPanel h4 { display: inline-block; margin-right: 12px; margin-top: 0; }
#skillPanel ul { list-style: none; list-style-type: none; padding-left: 20px; }

.history { position: absolute; top: 0; right: 0; }
.history span { margin: 10px; color: #ddd; }
.history span.active { cursor: pointer; color: #000; }


text:
var firebaseRef = firebase.database().ref();

var discussionControlView = document.getElementById("discussionControlView");
var students;
var studentNames = [];
var studentInfo = [];
var currentMeeting;
var oldStudentInfo = null;
var started = false;

discussionControlView.style = '';

function getCookie (name) {
	var cookieName = name + "=";
	var decodedCookies = decodeURIComponent(document.cookie);
	var cookies = decodedCookies.split("; ");
	console.log(cookies);
	for(var i = 0; i < cookies.length; i++) {
		if ((cookies[i]).includes(name)) {
			console.log(cookies[i].substring(5, cookies.length));
			return cookies[i].substring(cookieName.length, cookies[i].length);
		}
	}
	return null
}

// currentMeeting = getCookie('code');
currentMeeting = '0001';

firebaseRef.child(currentMeeting).child("Speakers").on('value', snap => {
	students = snap.val();
	// console.log(studentInfo instanceof Array);
	var holderStudentNames = Object.keys(students);
	var holderStudentInfo = Object.values(students);
	studentInfo = new Array();
	studentNames = new Array();
	for (var i = 0; i < holderStudentNames.length; i++) {
		if (holderStudentNames[i] === "Current Speaker") {
			continue;
		}
		studentNames.push(holderStudentNames[i]);
		studentInfo.push(holderStudentInfo[i]);
	}
	if (started) {
		console.log("UPDATED");
		console.log(oldStudentInfo);
		console.log(studentInfo);
		updateInfo();
	}
	console.log("Student Information: " + studentInfo);
});

function updateInfo() {
	if (oldStudentInfo == null) {
		oldStudentInfo = studentInfo;
		console.log(oldStudentInfo);
		return;
	}
	for (var i = 0; i < oldStudentInfo.length; i++) {
		if (oldStudentInfo[i] != studentInfo[i]) {
			var table = document.getElementById("studentsTable");
			console.log("Changed:\n" + studentInfo);

			var children = document.getElementById('' + i).children;
			console.log(studentInfo[i]["Number of times Raised Hand But Not Chosen"] + "");

			children[1].innerHTML = formatTime(studentInfo[i]["Time Spoken"]);
			children[2].innerHTML = studentInfo[i]["Number of times Spoken"] + "";
			children[3].innerHTML = studentInfo[i]["Number of times Raised Hand But Not Chosen"] + "";
		}
	}
}

function tableAddRow(student) {
	var tableRow = tableCreateRow(student);
	var table = document.getElementById("studentsTable");

	tableRow.setAttribute('style', 'opacity:0');

	table.appendChild(tableRow);
	console.log(tableRow);
	openElementWithObject(tableRow);
}

function openElementWithObject(element) {
	setTimeout(function() {
		setTimeout(function() {
			setTimeout(function() {
				setTimeout(function() {
					setTimeout(function() {
						setTimeout(function() {
							setTimeout(function() {
								setTimeout(function() {
									setTimeout(function() {	element.setAttribute("style","opacity:"+1.0+"; -moz-opacity:0.5; filter:alpha(opacity=50)");}, 10);
									element.setAttribute("style","opacity:"+0.9+"; -moz-opacity:0.5; filter:alpha(opacity=50)");
								}, 8);
								element.setAttribute("style","opacity:"+0.8+"; -moz-opacity:0.5; filter:alpha(opacity=50)");
							}, 10);
							element.setAttribute("style","opacity:"+0.7+"; -moz-opacity:0.5; filter:alpha(opacity=50)");
						}, 12);
						element.setAttribute("style","opacity:"+0.6+"; -moz-opacity:0.5; filter:alpha(opacity=50)");
					}, 14);
					element.setAttribute("style","opacity:"+0.5+"; -moz-opacity:0.5; filter:alpha(opacity=50)");
				}, 14);
				element.setAttribute("style","opacity:"+0.4+"; -moz-opacity:0.5; filter:alpha(opacity=50)");
			}, 14);
			element.setAttribute("style","opacity:"+0.25+"; -moz-opacity:0.5; filter:alpha(opacity=50)");
		}, 16);
		element.setAttribute("style","opacity:"+0.1+"; -moz-opacity:0.5; filter:alpha(opacity=50)");
	}, 18);
	element.setAttribute("style","opacity:"+0.0+"; -moz-opacity:0.5; filter:alpha(opacity=50)");
}

function startMeeting() {
	started = true;
	console.log("STARTED");
	console.log("Students:\n\n" + studentNames);
	firebaseRef.child(currentMeeting).child("Started").set(true);
	for (var i = 0; i < studentNames.length; i++) {
		console.log(studentNames[i]);
		tableAddRow(studentInfo[i]);
	}
	updateInfo();
}

function arrayIndexOf(array, element) {
	var index = 0;
	for (var i = 0; i < array.length; i++) {
		var arrayElement = array[i];
		if (arrayElement == element) {
			return index;
		}
		++index;
	}
}

function tableCreateRow(student) {
	var index = arrayIndexOf(studentInfo, student);
	var name = studentNames[index];
	console.log(index);
	var timeSpoken = student["Time Spoken"];
	var timesCalledOn = student["Number of times Spoken"];
	var raisedHands = student["Number of times Raised Hand But Not Chosen"];

	var tableRow = document.createElement("TR");
	var tableName = document.createElement("TD");
	var tableTimeSpoken = document.createElement("TD");
	var tableTimesCalledOn = document.createElement("TD");
	var tableRaisedHands = document.createElement("TD");

	tableName.id = "tableName";
	tableTimeSpoken.id = "tableData";
	tableTimesCalledOn.id = "tableData";
	tableRaisedHands.id = "tableData";

	tableName.innerHTML = name;
	tableTimeSpoken.innerHTML = formatTime(timeSpoken);
	tableTimesCalledOn.innerHTML = timesCalledOn;
	tableRaisedHands.innerHTML = raisedHands;

	tableRow.appendChild(tableName);
	tableRow.appendChild(tableTimeSpoken);
	tableRow.appendChild(tableTimesCalledOn);
	tableRow.appendChild(tableRaisedHands);

	tableRow.id = "" + index;

	return tableRow;

}

function formatTime(time) {
	if (time%60 < 10) {
		return ("" + Math.trunc(time/60))+":0"+(time%60);
	} else {
		return ("" + Math.trunc(time/60))+":"+(time%60);
	}
}


text:
require 'spec_helper'

describe StompOut::ProtocolError do

  context :initialize do
    it "initializes message, headers, receipt, and frame" do
      frame = StompOut::Frame.new("MESSAGE", {"receipt" => "123"}, "message")
      error = StompOut::ProtocolError.new("Missing header", frame, {"version" => "1.1"})
      error.message.should == "Missing header"
      error.headers.should == {"version" => "1.1"}
      error.frame.should == frame
    end
  end
end

describe StompOut::ApplicationError do

  context :initialize do
    it "initializes message and frame" do
      frame = StompOut::Frame.new("MESSAGE", {"ack" => "123"}, "message")
      error = StompOut::ApplicationError.new("Duplicate ack", frame)
      error.message.should == "Duplicate ack"
      error.frame.should == frame
    end
  end
end


text:
<!doctype html>

    <title>Code coverage report for lib/properties/fontSize.js</title>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="../../prettify.css" />
    <link rel="stylesheet" href="../../base.css" />
    <meta name="viewport" content="width=device-width, initial-scale=1">

      All files / lib/properties fontSize.js

        0%
        Statements
        0/16

        0%
        Branches
        0/8

        0%
        Functions
        0/5

        0%
        Lines
        0/16

      Press n or j to go to the next uncovered block, b, p or k for the previous block.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

'use strict';

var TYPES = require('../parsers').TYPES;
var valueType = require('../parsers').valueType;
var parseMeasurement = require('../parsers').parseMeasurement;

var absoluteSizes = ['xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'];
var relativeSizes = ['larger', 'smaller'];

module.exports.isValid = function(v) {
  var type = valueType(v.toLowerCase());
  return (
    type === TYPES.LENGTH ||
    type === TYPES.PERCENT ||
    (type === TYPES.KEYWORD && absoluteSizes.indexOf(v.toLowerCase()) !== -1) ||
    (type === TYPES.KEYWORD && relativeSizes.indexOf(v.toLowerCase()) !== -1)
  );
};

function parse(v) {
  const valueAsString = String(v).toLowerCase();
  const optionalArguments = absoluteSizes.concat(relativeSizes);
  const isOptionalArgument = optionalArguments.some(
    stringValue => stringValue.toLowerCase() === valueAsString
  );
  return isOptionalArgument ? valueAsString : parseMeasurement(v);
}

module.exports.definition = {
  set: function(v) {
    this._setProperty('font-size', parse(v));
  },
  get: function() {
    return this.getPropertyValue('font-size');
  },
  enumerable: true,
  configurable: true,
};

  Code coverage
  generated by istanbul at Mon Jul 01 2019 09:17:46 GMT-0600 (Mountain Daylight Time)


text:
'use strict';

/**
 * Module dependencies.
 */
var _ = require('lodash'),
	path = require('path'),
	mongoose = require('mongoose'),
	NewsFeed = mongoose.model('NewsFeed'),
	errorHandler = require(path.resolve('./modules/core/server/controllers/errors.server.controller'));

/**
 * Create a News feed
 */
exports.create = function(req, res) {
	var newsFeed = new NewsFeed(req.body);
	newsFeed.user = req.user;

	newsFeed.save(function(err) {
		if (err) {
			return res.status(400).send({
				message: errorHandler.getErrorMessage(err)
			});
		} else {
			res.jsonp(newsFeed);
		}
	});
};

/**
 * Show the current News feed
 */
exports.read = function(req, res) {
	res.jsonp(req.newsFeed);
};

/**
 * Update a News feed
 */
exports.update = function(req, res) {
	var newsFeed = req.newsFeed ;

	newsFeed = _.extend(newsFeed , req.body);

	newsFeed.save(function(err) {
		if (err) {
			return res.status(400).send({
				message: errorHandler.getErrorMessage(err)
			});
		} else {
			res.jsonp(newsFeed);
		}
	});
};

/**
 * Delete an News feed
 */
exports.delete = function(req, res) {
	var newsFeed = req.newsFeed ;

	newsFeed.remove(function(err) {
		if (err) {
			return res.status(400).send({
				message: errorHandler.getErrorMessage(err)
			});
		} else {
			res.jsonp(newsFeed);
		}
	});
};

/**
 * List of News feeds
 */
exports.list = function(req, res) { NewsFeed.find().sort('-position').populate('user', 'displayName').exec(function(err, newsFeeds) {
		if (err) {
			return res.status(400).send({
				message: errorHandler.getErrorMessage(err)
			});
		} else {
			res.jsonp(newsFeeds);
		}
	});
};

/**
 * News feed middleware
 */
exports.newsFeedByID = function(req, res, next, id) { NewsFeed.findById(id).populate('user', 'displayName').exec(function(err, newsFeed) {
		if (err) return next(err);
		if (! newsFeed) return next(new Error('Failed to load News feed ' + id));
		req.newsFeed = newsFeed ;
		next();
	});
};


text:
namespace SpotifyAPI.Web
{
  public class TrackAudio
  {
    public float Duration { get; set; }
    public string SampleMd5 { get; set; } = default!;
    public int OffsetSeconds { get; set; }
    public int WindowSeconds { get; set; }
    public int AnalysisSampleRate { get; set; }
    public int AnalysisChannels { get; set; }
    public float EndOfFadeIn { get; set; }
    public float StartOfFadeOut { get; set; }
    public float Loudness { get; set; }
    public float Tempo { get; set; }
    public float TempConfidence { get; set; }
    public int TimeSignature { get; set; }
    public float TimeSignatureConfidence { get; set; }
    public int Key { get; set; }
    public float KeyConfidence { get; set; }
    public int Mode { get; set; }
    public float ModeConfidence { get; set; }
    public string Codestring { get; set; } = default!;
    public float CodeVersion { get; set; }
    public string Echoprintstring { get; set; } = default!;
    public float EchoprintVersion { get; set; }
    public string Synchstring { get; set; } = default!;
    public float SynchVersion { get; set; }
    public string Rhythmstring { get; set; } = default!;
    public float RhythmVersion { get; set; }
  }
}


text:
package main

import (
	"context"

	securitycenter "cloud.google.com/go/securitycenter/apiv1p1beta1"
	"google.golang.org/api/iterator"
	securitycenterpb "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1"
)

func main() {
	ctx := context.Background()
	c, err := securitycenter.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &securitycenterpb.ListFindingsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1#ListFindingsRequest.
	}
	it := c.ListFindings(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

// [END securitycenter_v1p1beta1_generated_SecurityCenter_ListFindings_sync]


text:
title: Jubilee Campus
city: Nottingham
---


text:
package com.prolificinteractive.materialcalendarview;

import android.support.annotation.NonNull;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import com.prolificinteractive.materialcalendarview.MaterialCalendarView.ShowOtherDates;
import com.prolificinteractive.materialcalendarview.format.DayFormatter;
import com.prolificinteractive.materialcalendarview.format.TitleFormatter;
import com.prolificinteractive.materialcalendarview.format.WeekDayFormatter;

import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collections;
import java.util.List;

/**
 * Pager adapter backing the calendar view
 */
abstract class CalendarPagerAdapter<V extends CalendarPagerView> extends PagerAdapter {

    private final ArrayDeque<V> currentViews;

    protected final MaterialCalendarView mcv;
    private final CalendarDay today;

    private TitleFormatter titleFormatter = null;
    private Integer color = null;
    private Integer dateTextAppearance = null;
    private Integer weekDayTextAppearance = null;
    @ShowOtherDates
    private int showOtherDates = MaterialCalendarView.SHOW_DEFAULTS;
    private CalendarDay minDate = null;
    private CalendarDay maxDate = null;
    private DateRangeIndex rangeIndex;
    private List<CalendarDay> selectedDates = new ArrayList<>();
    private WeekDayFormatter weekDayFormatter = WeekDayFormatter.DEFAULT;
    private DayFormatter dayFormatter = DayFormatter.DEFAULT;
    private List<DayViewDecorator> decorators = new ArrayList<>();
    private List<DecoratorResult> decoratorResults = null;
    private boolean selectionEnabled = true;

    CalendarPagerAdapter(MaterialCalendarView mcv) {
        this.mcv = mcv;
        this.today = CalendarDay.today();
        currentViews = new ArrayDeque<>();
        currentViews.iterator();
        setRangeDates(null, null);
    }

    public void setDecorators(List<DayViewDecorator> decorators) {
        this.decorators = decorators;
        invalidateDecorators();
    }

    public void invalidateDecorators() {
        decoratorResults = new ArrayList<>();
        for (DayViewDecorator decorator : decorators) {
            DayViewFacade facade = new DayViewFacade();
            decorator.decorate(facade);
            if (facade.isDecorated()) {
                decoratorResults.add(new DecoratorResult(decorator, facade));
            }
        }
        for (V pagerView : currentViews) {
            pagerView.setDayViewDecorators(decoratorResults);
        }
    }

    @Override
    public int getCount() {
        return rangeIndex.getCount();
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return titleFormatter == null ? "" : titleFormatter.format(getItem(position));
    }

    public CalendarPagerAdapter<?> migrateStateAndReturn(CalendarPagerAdapter<?> newAdapter) {
        newAdapter.titleFormatter = titleFormatter;
        newAdapter.color = color;
        newAdapter.dateTextAppearance = dateTextAppearance;
        newAdapter.weekDayTextAppearance = weekDayTextAppearance;
        newAdapter.showOtherDates = showOtherDates;
        newAdapter.minDate = minDate;
        newAdapter.maxDate = maxDate;
        newAdapter.selectedDates = selectedDates;
        newAdapter.weekDayFormatter = weekDayFormatter;
        newAdapter.dayFormatter = dayFormatter;
        newAdapter.decorators = decorators;
        newAdapter.decoratorResults = decoratorResults;
        newAdapter.selectionEnabled = selectionEnabled;
        return newAdapter;
    }

    public int getIndexForDay(CalendarDay day) {
        if (day == null) {
            return getCount() / 2;
        }
        if (minDate != null && day.isBefore(minDate)) {
            return 0;
        }
        if (maxDate != null && day.isAfter(maxDate)) {
            return getCount() - 1;
        }
        return rangeIndex.indexOf(day);
    }

    protected abstract V createView(int position);

    protected abstract int indexOf(V view);

    protected abstract boolean isInstanceOfView(Object object);

    protected abstract DateRangeIndex createRangeIndex(CalendarDay min, CalendarDay max);

    @Override
    public int getItemPosition(Object object) {
        if (!(isInstanceOfView(object))) {
            return POSITION_NONE;
        }
        CalendarPagerView pagerView = (CalendarPagerView) object;
        CalendarDay firstViewDay = pagerView.getFirstViewDay();
        if (firstViewDay == null) {
            return POSITION_NONE;
        }
        int index = indexOf((V) object);
        if (index < 0) {
            return POSITION_NONE;
        }
        return index;
    }

    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        V pagerView = createView(position);
        pagerView.setContentDescription(mcv.getCalendarContentDescription());
        pagerView.setAlpha(0);
        pagerView.setSelectionEnabled(selectionEnabled);

        pagerView.setWeekDayFormatter(weekDayFormatter);
        pagerView.setDayFormatter(dayFormatter);
        if (color != null) {
            pagerView.setSelectionColor(color);
        }
        if (dateTextAppearance != null) {
            pagerView.setDateTextAppearance(dateTextAppearance);
        }
        if (weekDayTextAppearance != null) {
            pagerView.setWeekDayTextAppearance(weekDayTextAppearance);
        }
        pagerView.setShowOtherDates(showOtherDates);
        pagerView.setMinimumDate(minDate);
        pagerView.setMaximumDate(maxDate);
        pagerView.setSelectedDates(selectedDates);

        container.addView(pagerView);
        currentViews.add(pagerView);

        pagerView.setDayViewDecorators(decoratorResults);

        return pagerView;
    }

    public void setSelectionEnabled(boolean enabled) {
        selectionEnabled = enabled;
        for (V pagerView : currentViews) {
            pagerView.setSelectionEnabled(selectionEnabled);
        }
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        CalendarPagerView pagerView = (CalendarPagerView) object;
        currentViews.remove(pagerView);
        container.removeView(pagerView);
    }

    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view == object;
    }

    public void setTitleFormatter(@NonNull TitleFormatter titleFormatter) {
        this.titleFormatter = titleFormatter;
    }

    public void setSelectionColor(int color) {
        this.color = color;
        for (V pagerView : currentViews) {
            pagerView.setSelectionColor(color);
        }
    }

    public void setDateTextAppearance(int taId) {
        if (taId == 0) {
            return;
        }
        this.dateTextAppearance = taId;
        for (V pagerView : currentViews) {
            pagerView.setDateTextAppearance(taId);
        }
    }

    public void setShowOtherDates(@ShowOtherDates int showFlags) {
        this.showOtherDates = showFlags;
        for (V pagerView : currentViews) {
            pagerView.setShowOtherDates(showFlags);
        }
    }

    public void setWeekDayFormatter(WeekDayFormatter formatter) {
        this.weekDayFormatter = formatter;
        for (V pagerView : currentViews) {
            pagerView.setWeekDayFormatter(formatter);
        }
    }

    public void setDayFormatter(DayFormatter formatter) {
        this.dayFormatter = formatter;
        for (V pagerView : currentViews) {
            pagerView.setDayFormatter(formatter);
        }
    }

    @ShowOtherDates
    public int getShowOtherDates() {
        return showOtherDates;
    }

    public void setWeekDayTextAppearance(int taId) {
        if (taId == 0) {
            return;
        }
        this.weekDayTextAppearance = taId;
        for (V pagerView : currentViews) {
            pagerView.setWeekDayTextAppearance(taId);
        }
    }

    public void setRangeDates(CalendarDay min, CalendarDay max) {
        this.minDate = min;
        this.maxDate = max;
        for (V pagerView : currentViews) {
            pagerView.setMinimumDate(min);
            pagerView.setMaximumDate(max);
        }

        if (min == null) {
            min = CalendarDay.from(today.getYear() - 200, today.getMonth(), today.getDay());
        }

        if (max == null) {
            max = CalendarDay.from(today.getYear() + 200, today.getMonth(), today.getDay());
        }

        rangeIndex = createRangeIndex(min, max);

        notifyDataSetChanged();
        invalidateSelectedDates();
    }

    public DateRangeIndex getRangeIndex() {
        return rangeIndex;
    }

    public void clearSelections() {
        selectedDates.clear();
        invalidateSelectedDates();
    }

    public void setDateSelected(CalendarDay day, boolean selected) {
        if(!day.equals(CalendarDay.from(Calendar.getInstance()))) return;  //TODO 其他的日期不允许背选中
        if (selected) {
            if (!selectedDates.contains(day)) {
                selectedDates.add(day);
                invalidateSelectedDates();
            }
        } else {
//            if (selectedDates.contains(day)) {
//                selectedDates.remove(day);
//                invalidateSelectedDates();
//            }
        }
    }

    private void invalidateSelectedDates() {
        validateSelectedDates();
        for (V pagerView : currentViews) {
            pagerView.setSelectedDates(selectedDates);
        }
    }

    private void validateSelectedDates() {
        for (int i = 0; i < selectedDates.size(); i++) {
            CalendarDay date = selectedDates.get(i);

            if ((minDate != null && minDate.isAfter(date)) || (maxDate != null && maxDate.isBefore(date))) {
                selectedDates.remove(i);
                mcv.onDateUnselected(date);
                i -= 1;
            }
        }
    }

    public CalendarDay getItem(int position) {
        return rangeIndex.getItem(position);
    }

    @NonNull
    public List<CalendarDay> getSelectedDates() {
        return Collections.unmodifiableList(selectedDates);
    }

    protected int getDateTextAppearance() {
        return dateTextAppearance == null ? 0 : dateTextAppearance;
    }

    protected int getWeekDayTextAppearance() {
        return weekDayTextAppearance == null ? 0 : weekDayTextAppearance;
    }

    public void showSubject(List<SubjectCalendar> subjectCalendars) {
        for (V pagerView : currentViews) {
            pagerView.showSubject(subjectCalendars);
        }
    }
}


text:
title: 'Sve Novo'
date: 24/12/2022
---

### Biblijski tekstovi:
2.Petrova 3,13; Otkrivenje 21,3.22; 1. Ivanova 3,2.3; 1. Petrova 1,22; Izaija 25,8; Otkrivenje 22,3-5.

`"Tada onaj koji sjedi na prijestolju reče: 'Evo, sve činim novo.' I nadoda: 'Piši: Ove su riječi pouzdane i istinite!'"  (Otkrivenje 21,5)`

Sveto pismo pruža nam ovu nadu: "Ali  mi očekujemo, prema njegovu obećanju, nova nebesa i novu zemlju, gdje prebiva pravednost." (2. Petrova 3,13)

Nekima, međutim, obećanje o "novom nebu i novoj zemlji" (Otkrivenje 21,1) djeluje kao neka izmišljena priča onih koji su na vlasti i koji nadu u zagrobni život koriste kako bi držali ljude u pokornosti. Ideja je navodno sljedeća: Premda vam je trenutačno teško, jednog ćete dana primiti nagradu na Nebu, i slično.

I premda su neki ljudi nadu u budućnost kako je prikazana u Bibliji doista koristili na taj način, njihova zloupotreba ne mijenja istinu o obećanjima koja imamo u vezi s novim Nebom i novom Zemljom.

U posljednje dane rugači će ismijavati našu blaženu nadu (2. Petrova 3,3-7). Ali kao što je prorečeno, čak i njihovo ruganje može se smatrati dodatnim dokazom da je ono što Biblija kaže istina, jer se rugaju upravo onako kao što je u njoj i prorečeno.

Ovog ćemo tjedna razmišljati o slavnom obećanju o novom Nebu i novoj Zemlji, što uključuje nebeski hram, Božju prisutnost, kraj smrti i suza i konačnu pobjedu Božje ljubavi.

**OIKOS: Ovog tjedna čitamo iz knjige Ellen G. White, Patrijarsi i proroci, Znaci vremena, 2020., stranice 456—468.**


text:
import { createSelector } from 'reselect';

import { calculatePayments } from '../helpers/saving';

const getSavings = (state) => state.saving;

export default createSelector(
  [ getSavings ],
  (saving) => {
    return calculatePayments({ ...saving })
  }
);


text:
use 5.10.0;
use strict;
use warnings;

use Thrift;

#
# Data types that can be sent via Thrift
#
package Thrift::TType;
use version 0.77; our $VERSION = version->declare("$Thrift::VERSION");

use constant STOP   => 0;
use constant VOID   => 1;
use constant BOOL   => 2;
use constant BYTE   => 3;
use constant I08    => 3;
use constant DOUBLE => 4;
use constant I16    => 6;
use constant I32    => 8;
use constant I64    => 10;
use constant STRING => 11;
use constant UTF7   => 11;
use constant STRUCT => 12;
use constant MAP    => 13;
use constant SET    => 14;
use constant LIST   => 15;
use constant UTF8   => 16;
use constant UTF16  => 17;

1;


text:
package io.lettuce.core.dynamic.segment;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;

import io.lettuce.core.dynamic.CommandMethod;
import io.lettuce.core.dynamic.DeclaredCommandMethod;
import io.lettuce.core.dynamic.annotation.Command;
import io.lettuce.core.dynamic.annotation.CommandNaming;
import io.lettuce.core.dynamic.annotation.CommandNaming.LetterCase;
import io.lettuce.core.dynamic.annotation.CommandNaming.Strategy;
import io.lettuce.core.dynamic.support.ReflectionUtils;

/**
 * @author Mark Paluch
 */
class AnnotationCommandSegmentFactoryUnitTests {

    private AnnotationCommandSegmentFactory factory = new AnnotationCommandSegmentFactory();

    @Test
    void notAnnotatedDotAsIs() {

        CommandMethod commandMethod = DeclaredCommandMethod.create(ReflectionUtils.findMethod(CommandMethods.class,
                "notAnnotated"));

        CommandSegments commandSegments = factory.createCommandSegments(commandMethod);

        assertThat(commandSegments).isEmpty();
        assertThat(commandSegments.getCommandType().name()).isEqualTo("not.Annotated");
    }

    @Test
    void uppercaseDot() {

        CommandMethod commandMethod = DeclaredCommandMethod.create(ReflectionUtils
                .findMethod(CommandMethods.class, "upperCase"));

        CommandSegments commandSegments = factory.createCommandSegments(commandMethod);

        assertThat(commandSegments).isEmpty();
        assertThat(commandSegments.getCommandType().name()).isEqualTo("UPPER.CASE");
    }

    @Test
    void methodNameAsIs() {

        CommandMethod commandMethod = DeclaredCommandMethod.create(ReflectionUtils.findMethod(CommandMethods.class,
                "methodName"));

        CommandSegments commandSegments = factory.createCommandSegments(commandMethod);

        assertThat(commandSegments).isEmpty();
        assertThat(commandSegments.getCommandType().name()).isEqualTo("methodName");
    }

    @Test
    void splitAsIs() {

        CommandMethod commandMethod = DeclaredCommandMethod.create(ReflectionUtils.findMethod(CommandMethods.class,
                "clientSetname"));

        CommandSegments commandSegments = factory.createCommandSegments(commandMethod);

        assertThat(commandSegments).hasSize(1).extracting(CommandSegment::asString).contains("Setname");
        assertThat(commandSegments.getCommandType().name()).isEqualTo("client");
    }

    @Test
    void commandAnnotation() {

        CommandMethod commandMethod = DeclaredCommandMethod.create(ReflectionUtils
                .findMethod(CommandMethods.class, "atCommand"));

        CommandSegments commandSegments = factory.createCommandSegments(commandMethod);

        assertThat(commandSegments).hasSize(1).extracting(CommandSegment::asString).contains("WORLD");
        assertThat(commandSegments.getCommandType().name()).isEqualTo("HELLO");
    }

    @Test
    void splitDefault() {

        CommandMethod commandMethod = DeclaredCommandMethod
                .create(ReflectionUtils.findMethod(Defaulted.class, "clientSetname"));

        CommandSegments commandSegments = factory.createCommandSegments(commandMethod);

        assertThat(commandSegments).hasSize(1).extracting(CommandSegment::asString).contains("SETNAME");
        assertThat(commandSegments.getCommandType().name()).isEqualTo("CLIENT");
    }

    @CommandNaming(strategy = Strategy.DOT, letterCase = LetterCase.AS_IS)
    private static interface CommandMethods {

        void notAnnotated();

        @CommandNaming(letterCase = LetterCase.UPPERCASE)
        void upperCase();

        @CommandNaming(strategy = Strategy.METHOD_NAME)
        void methodName();

        @CommandNaming(strategy = Strategy.SPLIT)
        void clientSetname();

        @Command("HELLO WORLD")
        void atCommand();
    }

    private static interface Defaulted {

        void clientSetname();
    }
}


text:
package com.github.perf;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.Reader;
import java.text.DecimalFormat;
import java.text.Format;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CountDownLatch;

import org.slf4j.LoggerFactory;

import com.github.perf.util.Stat;

import ch.qos.logback.classic.Logger;

public class App {

	private static Reader[] NO_READERS = new Reader[0];

	static final String URL_NAME = "url";

	static final String USERS_NAME = "users";

	static final String ON_START_EVENT = "onStart";
	static final String ON_STOP_EVENT = "onStop";

	static final String BEFORE_HANDLER = "before";
	static final String AFTER_HANDLER = "after";

	static final Logger LOG = (Logger) LoggerFactory.getLogger(App.class);

	boolean isInitialized = false;
	private AppConf conf;
	private List<User> users = new ArrayList<User>(50);

	public App(Reader[] confReaders) {
		try {
			Stat.init();
			conf = AppConf.initConf(confReaders);
			initUsers();
			isInitialized = true;
			if (conf.isLocalStatEnabled())
				Stat.getLocalStat();
			Map<String, Object> remoteMap = conf.getRemoteStatHost();
			if (conf.isStatEnabled() && remoteMap != null) {
				String name = (String) remoteMap.get("name");
				String host = (String) remoteMap.get("host");
				Double port = (Double) remoteMap.get("port");
				if (name != null && host != null && port != null)
					Stat.getRemoteStat(name, host, port.intValue());
			}
		} catch (Throwable t) {
			LOG.warn("Configuration error", t);
		}
	}

	public static Reader[] getConfFiles(String[] strings) {
		if (strings != null) {
			Reader[] result = new Reader[strings.length];
			try {
				for (int i = 0; i < strings.length; i++)
					result[i] = new FileReader(strings[i]);
				return result;
			} catch (FileNotFoundException e) {
				LOG.warn("File not found " + e);
			}
		}
		return NO_READERS;
	}

	private void initUsers() {
		for (UserGroup group : conf.getUserGroups())
			for (Map<String, Object> user : group.getUsers()) {
				Boolean isPattern = (Boolean) user.get("pattern");
				if (isPattern != null && isPattern.booleanValue())
					initUsersByPattern(user, group);
				else {
					User anUser = new User(this, (String) user.get("name"), group);
					for (Map.Entry<String, Object> entry : user.entrySet()) {
						anUser.set(entry.getKey(), entry.getValue());
					}
					users.add(anUser);
				}
			}
	}

	private void initUsersByPattern(Map<String, Object> user, UserGroup group) {
		int first = ((Double) user.get("first")).intValue();
		int last = ((Double) user.get("last")).intValue();
		user.remove("pattern");
		user.remove("first");
		user.remove("last");

		int i = 0;
		int size = user.size();
		String[] fields = new String[size];
		String[] patterns = new String[size];
		Format[] fieldFormats = new Format[size];
		for (Map.Entry<String, Object> entry : user.entrySet()) {
			fields[i] = entry.getKey();
			patterns[i] = (String) entry.getValue();
			if (patterns[i] == null || patterns[i].trim().length() == 0 || patterns[i].indexOf('0') == -1)
				fieldFormats[i] = null;
			else
				fieldFormats[i] = new DecimalFormat(patterns[i]);
			i++;
		}

		try {
			if (first > 0 && last > 0)
				for (i = first; i < last + 1; i++) {
					User anUser = new User(this, fieldFormats[0].format(i), group);
					for (int j = 0; j < fieldFormats.length; j++) {
						if (fieldFormats[j] == null)
							anUser.set(fields[j], patterns[j]);
						else
							anUser.set(fields[j], fieldFormats[j].format(i));
					}
					users.add(anUser);
				}
		} catch (Exception e) {
			// catching runtime exceptions
			LOG.warn("User initialization error", e);
		}
	}

	AppConf getConf() {
		return conf;
	}

	List<User> getUsers() {
		return users;
	}

	public void execute() {
		if (!isInitialized) {
			LOG.warn("Application is not initialized, execution is not possible");
			return;
		}

		long start = System.currentTimeMillis();
		int size = users.size();
		if (LOG.isInfoEnabled())
			LOG.info("Starting " + size + " users");
		final CountDownLatch latch = new CountDownLatch(size);
		for (final User user : users) {
			user.preinit();
			Thread t = new Thread(new Runnable() {

				public void run() {
					user.execute();
					latch.countDown();
				}

			}, user.get("name").toString());
			t.start();
		}
		try {
			latch.await();
		} catch (InterruptedException e) {
			LOG.warn("Execution is interrupted", e);
		}
		if (conf.isActionStatEnabled())
			Stat.logAction(Stat.SYSTEM, "EXECUTE", (System.currentTimeMillis() - start));
		if (conf.doStatPlotting())
			Stat.plotting();
	}

	public static void main(String[] args) {
		if (args.length == 0)
			System.out.println("Usage: App js-files");
		else {
			App app = new App(getConfFiles(args));
			app.execute();
		}
	}

}


text:
***********
Minicluster
***********
.. automodule:: snakebite.minicluster

.. autoclass:: MiniCluster
    :members:


text:
package org.schoellerfamily.gedbrowser.renderer;

import java.text.DateFormat;
import java.util.Locale;

/**
 * @author Dick Schoeller
 */
public interface Renderer {
    /**
     * @return the application name.
     */
    String getApplicationName();

    /**
     * @return the application URL.
     */
    String getApplicationURL();

    /**
     * @return the standard URL for home.
     */
    String getHomeUrl();

    /**
     * @return the standard URL for home.
     */
    String getMaintainerEmail();

    /**
     * @return the maintainer's name
     */
    String getMaintainerName();

    /**
     * @return the version string
     */
    String getVersion();

    /**
     * @param separate whether to return the separator.
     * @return the separator
     */
    default String getSeparator(final boolean separate) {
        if (separate) {
            return ", ";
        } else {
            return "";
        }
    }

    /**
     * Get the HTML header for a page.
 This method is public for testing
     * purposes only. Do not try to call it outside of the context of the
     * rendering engine.
     * @param title the title string.
     * @param keywords any keywords.
     * @return a string containing the HTML header.
     */
    default String getHeaderHtml(final String title, final String keywords) {
        return "Content-type: text/html\n\n"
                + "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\"\n"
                + "  \"http://www.w3.org/TR/html4/strict.dtd\">\n"
                + "\n  \n"
                + "    <meta http-equiv=\"Content-Type\" "
                + "content=\"text/html; charset=utf-8\">\n"
                + "    <meta name=\"Author\" content=\"gedbrowser\">\n"
                + "    <meta name=\"Description\" content=\"genealogy\">\n"
                + "    <meta name=\"Keywords\" content=\"genealogy gedbrowser "
                + keywords + "\">\n"
                + "    <meta http-equiv=\"Content-Style-Type\" "
                + "content=\"text/css\">\n"
                + "    <link href=\"/gedbrowser/gedbrowser.css\" "
                + "rel=\"stylesheet\" type=\"text/css\">\n"
                + "    <title>" + title + "</title>\n"
                + "  \n  \n";
    }

    /**
     * This method is public for testing purposes only. Do not try to call it
     * outside of the context of the rendering engine.
     *
     * @return trailer HTML with no omissions.
     */
    default String getTrailerHtml() {
        return getTrailerHtml("");
    }

    /**
     * This method is public for testing purposes only. Do not try to call it
     * outside of the context of the rendering engine.
     *
     * @param omit title of section to leave out.
     * @return trailer HTML
     */
    default String getTrailerHtml(final String omit) {
        final java.util.Date javaDate = new java.util.Date();
        final String timeString = DateFormat.getDateInstance(DateFormat.LONG,
                Locale.getDefault()).format(javaDate);
        final String retVal =
        "\n
"
        + menuInsertions(omit)
        + "\n
"
        + "\n
"
        + "\n
\n    "
        + "\n
\n    Maintained by " + getMaintainerName()
        + ".
\n    Created with GEDbrowser, version " + getVersion() + " on " + timeString
        + "\n
\n    	\n    "
        + "\n
"
        + "\n"
        + ""
        + "\n
\n    	\n
\n
\n
\n  "
        + "\n\n";
        return retVal;
    }

    /**
     * Insert menu items specific to context.
     *
     * @param omit if true don't add them
     * @return the built string of extra menu stuff
     */
    default String menuInsertions(final String omit) {
        return "";
    }
}


text:
#ifndef RAW2DARRAY_H
#define RAW2DARRAY_H

#include "adapter.h"

template<typename Data> class Std2dVectorAdapter : public Adapter<Data,std::vector<std::vector <Data>>>
{
public:
    virtual Matrix<Data> convertToMatrix(const std::vector<std::vector <Data>> &vector) const override
    {
        const int rows = vector.size();
        const int cols = vector[0].size();
        Matrix <Data> matrix (rows, cols);
        for (int i = 0; i < rows; ++i)
        {
            for (int j = 0; j < cols; ++j)
            {
                matrix(i, j) = vector[i][j];
            }
        }
        return matrix;
    }

    virtual void convertFromMatrix(std::vector<std::vector <Data>> &vector,const Matrix<Data> &matrix) const override
    {
        vector.clear();

        const int rows = matrix.rows();
        const int cols = matrix.columns();
        for (int i = 0; i < rows; ++i)
        {
            std::vector <Data> temp;
            for (int j = 0; j < cols; ++j)
            {
                temp.push_back(matrix(i,j));
            }

            vector.push_back(temp);
        }
    }
};

#endif // RAW2DARRAY_H


text:
package ca.qc.johnabbott.cs603.Views;

import ca.qc.johnabbott.cs603.Controllers.Picture;
import ca.qc.johnabbott.cs603.Shapes.Shape;
import ca.qc.johnabbott.cs603.Controllers.ToolBox;
import ca.qc.johnabbott.cs603.Tools.ToolName;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;

public class DrawingView extends View {
    private Picture picture;
    private ToolBox toolbox;
    private Paint paint;

    public DrawingView(Context context, AttributeSet attrs) {
        super(context, attrs);
        this.picture = new Picture();
        this.toolbox = new ToolBox(this);
        toolbox.changeTool(ToolName.LINE);
        paint = new Paint();
        paint.setAntiAlias(true);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        picture.draw(paint, canvas);
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        switch(event.getActionMasked()) {
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_POINTER_DOWN:
                toolbox.getCurrentTool().touchStart(event);
                break;

            case MotionEvent.ACTION_UP:
            case MotionEvent.ACTION_POINTER_UP:
                toolbox.getCurrentTool().touchEnd(event);
                break;

            default:
                toolbox.getCurrentTool().touchMove(event);
        }
        return true;
    }

    public void addShape(Shape s) {
        picture.add(s);
    }

    public void addRubberBand(Shape rubber) { picture.addRubberBand(rubber); }

    public ToolBox getToolBox() {
        return toolbox;
    }

    public void erase() {
        picture.clear();
    }

    public void undo() { picture.undo(); }

    public Picture getPicture() {
        return picture;
    }
}