text:
require 'spec_helper'

describe Request::States do
  include Support::ActiveRecord

  let(:repository) { Repository.new }
  let(:commit)     { Commit.new(:repository => repository) }
  let(:request)    { Request.new(:repository => repository, :commit => commit) }

  let(:approval)   { Request::Approval.any_instance }
  let(:github)     { Travis::Github::Config.any_instance }
  let(:config)     { { :from => '.travis.yml' } }

  before :each do
    github.stubs(:fetch).returns(config)
    request.stubs(:build_build) # can't stub on the stupic association?
  end

  it 'has the state :created when just created' do
    request.state.should == :created
  end

  describe 'start' do
    describe 'with an accepted request' do
      before :each do
        approval.stubs(:accepted?).returns(true)
      end

      it 'configures the request' do
        request.expects(:configure)
        request.start
      end

      it 'finishes the request' do
        request.expects(:finish)
        request.start
      end

      it 'sets the state to started' do
        request.start
        request.was_started?.should be_true
      end
    end

    describe 'with a rejected request' do
      before :each do
        approval.stubs(:accepted?).returns(false)
      end

      it 'does not configure the request' do
        request.expects(:configure).never
        request.start
      end

      it 'finishes the request' do
        request.expects(:finish)
        request.start
      end

      it 'sets the state to started' do
        request.start
        request.was_started?.should be_true
      end
    end
  end

  describe 'configure' do
    it 'fetches the .travis.yml config from Github' do
      github.expects(:fetch).returns(config)
      request.configure
    end

    it 'stores the config on the request' do
      request.configure
      request.config.should == config
    end

    it 'sets the state to configured' do
      request.configure
      request.was_configured?.should be_true
    end
  end

  describe 'finish' do
    before :each do
      request.stubs(:was_configured?).returns(true)
    end

    describe 'with an approved request' do
      before :each do
        request.stubs(:was_configured?).returns(true)
        approval.stubs(:approved?).returns(true)
      end

      it 'builds the build' do
        request.expects(:build_build)
        request.finish
      end

      it 'sets the state to finished' do
        request.finish
        request.should be_finished
      end
    end

    describe 'with an unapproved request' do
      before :each do
        approval.stubs(:approved?).returns(false)
      end

      it 'does not build the build' do
        request.expects(:build_build).never
        request.finish
      end

      it 'sets the state to finished' do
        request.finish
        request.should be_finished
      end
    end
  end
end


text:
'use strict';

const { mustCall,
        mustNotCall,
        expectsError,
        hasCrypto, skip } = require('../common');
if (!hasCrypto)
  skip('missing crypto');
const { throws } = require('assert');
const { createServer, connect } = require('http2');

// Http2ServerResponse.write does not imply there is a callback

const expectedError = expectsError({
  code: 'ERR_HTTP2_STREAM_CLOSED',
  message: 'The stream is already closed'
}, 2);

{
  const server = createServer();
  server.listen(0, mustCall(() => {
    const port = server.address().port;
    const url = `http://localhost:${port}`;
    const client = connect(url, mustCall(() => {
      const headers = {
        ':path': '/',
        ':method': 'GET',
        ':scheme': 'http',
        ':authority': `localhost:${port}`
      };
      const request = client.request(headers);
      request.end();
      request.resume();
    }));

    server.once('request', mustCall((request, response) => {
      client.destroy();
      response.stream.session.on('close', mustCall(() => {
        response.on('error', mustNotCall());
        throws(
          () => { response.write('muahaha'); },
          expectsError({
            code: 'ERR_HTTP2_STREAM_CLOSED',
            type: Error,
            message: 'The stream is already closed'
          })
        );
        server.close();
      }));
    }));
  }));
}

{
  const server = createServer();
  server.listen(0, mustCall(() => {
    const port = server.address().port;
    const url = `http://localhost:${port}`;
    const client = connect(url, mustCall(() => {
      const headers = {
        ':path': '/',
        ':method': 'get',
        ':scheme': 'http',
        ':authority': `localhost:${port}`
      };
      const request = client.request(headers);
      request.end();
      request.resume();
    }));

    server.once('request', mustCall((request, response) => {
      client.destroy();
      response.stream.session.on('close', mustCall(() => {
        response.write('muahaha', mustCall(expectedError));
        server.close();
      }));
    }));
  }));
}

{
  const server = createServer();
  server.listen(0, mustCall(() => {
    const port = server.address().port;
    const url = `http://localhost:${port}`;
    const client = connect(url, mustCall(() => {
      const headers = {
        ':path': '/',
        ':method': 'get',
        ':scheme': 'http',
        ':authority': `localhost:${port}`
      };
      const request = client.request(headers);
      request.end();
      request.resume();
    }));

    server.once('request', mustCall((request, response) => {
      response.stream.session.on('close', mustCall(() => {
        response.write('muahaha', 'utf8', mustCall(expectedError));
        server.close();
      }));
      client.destroy();
    }));
  }));
}

redpajama_set_name: RedPajamaGithub


text:
#ifndef __boosting__boosting_core_parallel_h__
#define __boosting__boosting_core_parallel_h__

#include "jml/utils/worker_task.h"
#include "jml/utils/guard.h"
#include <boost/bind.hpp>
#include "jml/utils/smart_ptr_utils.h"

namespace ML {

/*****************************************************************************/
/* UPDATE_WEIGHTS_PARALLEL                                                   */
/*****************************************************************************/

/** This class updates a weights matrix in response to a new stump having
    been learned.
*/

template<class Updater>
struct Update_Weights_Parallel : public Update_Weights<Updater> {
    explicit Update_Weights_Parallel(Worker_Task & worker,
                                     const Updater & updater = Updater())
        : Update_Weights<Updater>(updater), worker(worker), group(-1)
    {
    }

    using Update_Weights<Updater>::updater;
    Worker_Task & worker;
    int group;

    struct Job_Info {
        const Stump & stump;
        const Optimization_Info & opt_info;
        float cl_weight;
        boost::multi_array<float, 2> & weights;
        const Training_Data & data;

        Joint_Index index;
        const std::vector<Label> & labels;

        Lock lock;
        double & total;

        const Update_Weights<Updater> & update_weights;

        Job_Info(const Stump & stump,
                 const Optimization_Info & opt_info,
                 float cl_weight,
                 boost::multi_array<float, 2> & weights,
                 const Training_Data & data,
                 double & total,
                 const Update_Weights<Updater> & update_weights)
            : stump(stump), opt_info(opt_info),
              cl_weight(cl_weight), weights(weights),
              data(data),
              index(data.index().joint
                    (stump.predicted(), stump.split.feature(), BY_EXAMPLE,
                     IC_VALUE | IC_EXAMPLE)),
              labels(data.index().labels(stump.predicted())),
              total(total), update_weights(update_weights)
        {
        }

        /* Update a part of the data. */
        void update_range(int x_begin, int x_end)
        {
            double subtotal
                = update_weights(stump, opt_info, cl_weight, weights, data,
                                 x_begin, x_end);

            Guard guard(lock);
            total += subtotal;
        }
    };

    struct Update_Job {
        Update_Job(std::shared_ptr<Job_Info> info, int n_begin,
                   int n_end)
            : info(info), n_begin(n_begin), n_end(n_end)
        {
        }

        std::shared_ptr<Job_Info> info;
        int n_begin, n_end;

        void operator () ()
        {
            info->update_range(n_begin, n_end);
        }
    };

    /** Apply the given stump to the given weights, given the training
        data.  This will update all of the weights. */
    void operator () (const Stump & stump,
                      const Optimization_Info & opt_info,
                      float cl_weight,
                      boost::multi_array<float, 2> & weights,
                      const Training_Data & data,
                      double & total,
                      Job next, int parent = -1)
    {
        /* Create the job info. */
        std::shared_ptr<Job_Info> info
            = make_sp(new Job_Info(stump, opt_info,
                                   cl_weight, weights, data, total,
                                   *this));

        /* Get our task group for the update. */
        group = worker.get_group(next, format("stump update group under %d", parent),
                                 parent);
        Call_Guard guard(boost::bind(&Worker_Task::unlock_group,
                                     boost::ref(worker),
                                     group));

        /* First we split up the weights matrix into enough bands that we get a
           decent amount of work on each example.

           We want to update at least 10000 weights entries in each chunk,
           otherwise the overhead gets too high.
        */

        size_t nx = weights.shape()[0];

        size_t ENTRIES_PER_CHUNK = 4096;
        size_t examples_per_chunk = ENTRIES_PER_CHUNK / weights.shape()[1];

        total = 0.0;

        size_t chunk_start = 0;
        while (chunk_start < nx) {
            worker.add(Update_Job(info, chunk_start,
                                  std::min(nx, chunk_start + examples_per_chunk)),
                       format("stump update jod %zd-%zd under %d",
                              chunk_start,
                              std::min(nx, chunk_start + examples_per_chunk),
                              group),
                       group);
            chunk_start += examples_per_chunk;
        }
    }

    struct Job_Info_Classifier {
        const Classifier_Impl & classifier;
        const Optimization_Info & opt_info;
        float cl_weight;
        boost::multi_array<float, 2> & weights;
        const Training_Data & data;

        const std::vector<Label> & labels;

        Lock lock;
        double & total;

        const Update_Weights<Updater> & update_weights;

        Job_Info_Classifier(const Classifier_Impl & classifier,
                            const Optimization_Info & opt_info,
                            float cl_weight,
                            boost::multi_array<float, 2> & weights,
                            const Training_Data & data,
                            double & total,
                            const Update_Weights<Updater> & update_weights)
            : classifier(classifier), opt_info(opt_info),
              cl_weight(cl_weight), weights(weights),
              data(data),
              labels(data.index().labels(classifier.predicted())),
              total(total), update_weights(update_weights)
        {
        }

        /* Update a part of the data. */
        void update_range(int x_begin, int x_end)
        {
            double subtotal
                = update_weights(classifier, opt_info, cl_weight, weights, data,
                                 x_begin, x_end);

            Guard guard(lock);
            total += subtotal;
        }
    };

    struct Update_Job_Classifier {
        Update_Job_Classifier(std::shared_ptr<Job_Info_Classifier> info,
                              int n_begin, int n_end)
            : info(info), n_begin(n_begin), n_end(n_end)
        {
        }

        std::shared_ptr<Job_Info_Classifier> info;
        int n_begin, n_end;

        void operator () ()
        {
            info->update_range(n_begin, n_end);
        }
    };

    /** Apply the given classifier to the given weights, given the training
        data.  This will update all of the weights. */
    void operator () (const Classifier_Impl & classifier,
                      const Optimization_Info & opt_info,
                      float cl_weight,
                      boost::multi_array<float, 2> & weights,
                      const Training_Data & data,
                      double & total,
                      Job next, int parent = -1)
    {
        /* Create the job info. */
        std::shared_ptr<Job_Info_Classifier> info
            = make_sp(new Job_Info_Classifier
                      (classifier, opt_info, cl_weight, weights, data,
                       total, *this));

        /* Get our task group for the update. */
        group = worker.get_group
            (next, format("classifier update group under %d", parent), parent);
        Call_Guard guard(boost::bind(&Worker_Task::unlock_group,
                                     boost::ref(worker),
                                     group));

        /* First we split up the weights matrix into enough bands that we get a
           decent amount of work on each example.

           We want to update at least 10000 weights entries in each chunk,
           otherwise the overhead gets too high.
        */

        size_t nx = weights.shape()[0];

        size_t ENTRIES_PER_CHUNK = 4096;
        size_t examples_per_chunk = ENTRIES_PER_CHUNK / weights.shape()[1];

        total = 0.0;

        size_t chunk_start = 0;
        while (chunk_start < nx) {
            size_t end = std::min(nx, chunk_start + examples_per_chunk);
            worker.add(Update_Job_Classifier(info, chunk_start, end),
                       format("Update_Job_Classifier %zd-%zd under %d",
                              chunk_start, end, group),
                       group);
            chunk_start = end;
        }
    }

};

/*****************************************************************************/
/* UPDATE_SCORES_PARALLEL                                                    */
/*****************************************************************************/

/** This class updates a scores matrix based on the output of the
    classifier, as well as calculating the accuracy of the classifier.
*/

template<class Output_Updater, class Scorer>
struct Update_Scores_Parallel
    : public Update_Scores<Output_Updater, Scorer> {

    typedef Update_Scores<Output_Updater, Scorer> Updater;

    explicit Update_Scores_Parallel(Worker_Task & worker,
                                    const Output_Updater & output_updater
                                        = Output_Updater())
        : Update_Scores<Output_Updater, Scorer>(output_updater),
          worker(worker), group(-1)
    {
    }

    Worker_Task & worker;
    int group;

    struct Job_Info {
        const Stump & stump;
        const Optimization_Info & opt_info;
        float cl_weight;
        boost::multi_array<float, 2> & output;
        const Training_Data & data;
        const distribution<float> & example_weights;

        Joint_Index index;
        const std::vector<Label> & labels;

        Lock lock;
        double & correct;

        const Updater & updater;

        Job_Info(const Stump & stump,
                 const Optimization_Info & opt_info,
                 float cl_weight,
                 boost::multi_array<float, 2> & output, const Training_Data & data,
                 const distribution<float> & example_weights,
                 double & correct,
                 const Updater & updater)
            : stump(stump), opt_info(opt_info),
              cl_weight(cl_weight), output(output),
              data(data), example_weights(example_weights),
              index(data.index().joint
                    (stump.predicted(), stump.split.feature(), BY_EXAMPLE,
                     IC_VALUE | IC_EXAMPLE)),
              labels(data.index().labels(stump.predicted())),
              correct(correct), updater(updater)
        {
            correct = 0.0;
        }

        /* Update a part of the data. */
        void update_range(int x_begin, int x_end)
        {
            double subtotal
                = updater(stump, opt_info,
                          cl_weight, output, data, example_weights,
                          x_begin, x_end);

            Guard guard(lock);
            correct += subtotal;
        }
    };

    struct Update_Job {
        Update_Job(std::shared_ptr<Job_Info> info, int n_begin,
                   int n_end)
            : info(info), n_begin(n_begin), n_end(n_end)
        {
        }

        std::shared_ptr<Job_Info> info;
        int n_begin, n_end;

        void operator () ()
        {
            info->update_range(n_begin, n_end);
        }
    };

    /** Apply the given stump to the given output, given the training
        data.  This will update all of the output. */
    void operator () (const Stump & stump,
                      const Optimization_Info & opt_info,
                      float cl_weight,
                      boost::multi_array<float, 2> & output,
                      const Training_Data & data,
                      const distribution<float> & example_weights,
                      double & correct,
                      Job next, int parent = -1)
    {
        /* Create the job info. */
        std::shared_ptr<Job_Info> info
            = make_sp(new Job_Info(stump, opt_info, cl_weight, output, data,
                                   example_weights, correct,
                                   *this));

        /* Get our task group for the update.  We make a job to calculate
           the accuracy go to the end. */
        group = worker.get_group
            (next, format("Update_Scores job under %d", parent), parent);
        Call_Guard guard(boost::bind(&Worker_Task::unlock_group,
                                     boost::ref(worker),
                                     group));

        /* First we split up the output matrix into enough bands that we get a
           decent amount of work on each example.

           We want to update at least 10000 output entries in each chunk,
           otherwise the overhead gets too high.
        */

        size_t nx = output.shape()[0];

        size_t ENTRIES_PER_CHUNK = 2048;
        size_t examples_per_chunk = ENTRIES_PER_CHUNK / output.shape()[1];

        size_t chunk_start = 0;
        while (chunk_start < nx) {
            size_t end = std::min(nx, chunk_start + examples_per_chunk);
            worker.add(Update_Job(info, chunk_start, end),
                       format("Update_Job %zd-%zd under %d",
                              chunk_start, end, group),
                       group);
            chunk_start = end;
        }
    }

    struct Job_Info_Classifier {
        const Classifier_Impl & classifier;
        const Optimization_Info & opt_info;
        float cl_weight;
        boost::multi_array<float, 2> & output;
        const Training_Data & data;
        const distribution<float> & example_weights;

        const std::vector<Label> & labels;

        Lock lock;
        double & correct;

        const Updater & updater;

        Job_Info_Classifier(const Classifier_Impl & classifier,
                            const Optimization_Info & opt_info,
                            float cl_weight,
                            boost::multi_array<float, 2> & output,
                            const Training_Data & data,
                            const distribution<float> & example_weights,
                            double & correct,
                            const Updater & updater)
            : classifier(classifier), opt_info(opt_info),
              cl_weight(cl_weight), output(output),
              data(data), example_weights(example_weights),
              labels(data.index().labels(classifier.predicted())),
              correct(correct), updater(updater)
        {
            correct = 0.0;
        }

        /* Update a part of the data. */
        void update_range(int x_begin, int x_end)
        {
            double subtotal
                = updater(classifier, opt_info,
                          cl_weight, output, data, example_weights,
                          x_begin, x_end);

            Guard guard(lock);
            correct += subtotal;
        }
    };

    struct Update_Job_Classifier {
        Update_Job_Classifier(std::shared_ptr<Job_Info_Classifier> info,
                              int n_begin, int n_end)
            : info(info), n_begin(n_begin), n_end(n_end)
        {
        }

        std::shared_ptr<Job_Info_Classifier> info;
        int n_begin, n_end;

        void operator () ()
        {
            info->update_range(n_begin, n_end);
        }
    };

    /** Apply the given classifier to the given output, given the training
        data.  This will update all of the output. */
    void operator () (const Classifier_Impl & classifier,
                      const Optimization_Info & opt_info,
                      float cl_weight,
                      boost::multi_array<float, 2> & output,
                      const Training_Data & data,
                      const distribution<float> & example_weights,
                      double & correct,
                      Job next, int parent = -1)
    {
        /* Create the job info. */
        std::shared_ptr<Job_Info_Classifier> info
            = make_sp(new Job_Info_Classifier
                      (classifier, opt_info, cl_weight, output, data,
                       example_weights, correct, *this));

        /* Get our task group for the update.  We make a job to calculate
           the accuracy go to the end. */
        group = worker.get_group
            (next, format("Update_Scores job under %d", parent), parent);
        Call_Guard guard(boost::bind(&Worker_Task::unlock_group,
                                     boost::ref(worker),
                                     group));

        /* First we split up the output matrix into enough bands that we get a
           decent amount of work on each example.

           We want to update at least 10000 output entries in each chunk,
           otherwise the overhead gets too high.
        */

        size_t nx = output.shape()[0];

        size_t ENTRIES_PER_CHUNK = 2048;
        size_t examples_per_chunk = ENTRIES_PER_CHUNK / output.shape()[1];

        size_t chunk_start = 0;
        while (chunk_start < nx) {
            size_t end = std::min(nx, chunk_start + examples_per_chunk);
            worker.add(Update_Job_Classifier(info, chunk_start, end),
                       format("Update_Job_Classifier %zd-%zd under %d",
                              chunk_start, end, group),
                       group);
            chunk_start = end;
        }
    }

};

/*****************************************************************************/
/* UPDATE_WEIGHTS_AND_SCORES_PARALLEL                                        */
/*****************************************************************************/

/** This class updates a weights matrix in response to a new stump having
    been learned, and updates a scores matrix based on the output of the
    classifier, as well as calculating the accuracy of the classifier.
*/

template<class Weights_Updater, class Output_Updater, class Scorer>
struct Update_Weights_And_Scores_Parallel
    : Update_Weights_And_Scores<Weights_Updater, Output_Updater, Scorer> {
    typedef Update_Weights_And_Scores<Weights_Updater, Output_Updater, Scorer>
        Updater;
    explicit Update_Weights_And_Scores_Parallel
        (Worker_Task & worker,
         const Weights_Updater & weights_updater
             = Weights_Updater(),
         const Output_Updater & output_updater
             = Output_Updater())
            : Updater(weights_updater, output_updater), worker(worker),
              group(-1)
    {
    }

    Worker_Task & worker;
    int group;

    struct Job_Info {
        const Stump & stump;
        const Optimization_Info & opt_info;
        float cl_weight;
        boost::multi_array<float, 2> & weights;
        boost::multi_array<float, 2> & output;
        const Training_Data & data;
        const distribution<float> & example_weights;

        Lock lock;
        double & correct;
        double & total;

        const Updater & updater;

        Job_Info(const Stump & stump,
                 const Optimization_Info & opt_info,
                 float cl_weight,
                 boost::multi_array<float, 2> & weights,
                 boost::multi_array<float, 2> & output,
                 const Training_Data & data,
                 const distribution<float> & example_weights,
                 double & correct,
                 double & total,
                 const Updater & updater)
            : stump(stump), opt_info(opt_info),
              cl_weight(cl_weight), weights(weights),
              output(output),
              data(data), example_weights(example_weights),
              correct(correct), total(total), updater(updater)
        {
        }

        /* Update a part of the data. */
        void update_range(int x_begin, int x_end)
        {
#if 0
            using namespace std;
            cerr << stump.summary() << endl;
            for (unsigned i = x_begin;  i < x_begin + 10;  ++i) {
                if (i >= x_end) break;
                cerr << " " << weights[i][0];
            }
            cerr << endl;

            for (unsigned i = x_begin;  i < x_begin + 10;  ++i) {
                if (i >= x_end) break;
                cerr << " " << output[i][0];
            }
            cerr << endl;
#endif

            //boost::timer timer;
            double sub_correct = 0.0;
            double subtotal
                = updater(stump, opt_info, cl_weight, weights, output, data,
                          example_weights, sub_correct, x_begin, x_end);

#if 0
            cerr << "updating between " << x_begin << " and " << x_end
                //<< " with " << stump.summary()
                 << ": " << timer.elapsed() << endl;

            //if (timer.elapsed() > 0.1)
#endif

            Guard guard(lock);
            total += subtotal;
            correct += sub_correct;
        }
    };

    struct Update_Job {
        Update_Job(std::shared_ptr<Job_Info> info, int n_begin,
                   int n_end)
            : info(info), n_begin(n_begin), n_end(n_end)
        {
        }

        std::shared_ptr<Job_Info> info;
        int n_begin, n_end;

        void operator () ()
        {
            info->update_range(n_begin, n_end);
        }
    };

    /** Apply the given stump to the given output, given the training
        data.  This will update all of the output. */
    void operator () (const Stump & stump,
                      const Optimization_Info & opt_info,
                      float cl_weight,
                      boost::multi_array<float, 2> & weights,
                      boost::multi_array<float, 2> & output,
                      const Training_Data & data,
                      const distribution<float> & example_weights,
                      double & correct,
                      double & total,
                      Job next, int parent = -1)
    {
        /* Create the job info. */
        std::shared_ptr<Job_Info> info
            = make_sp(new Job_Info(stump, opt_info,
                                   cl_weight, weights, output, data,
                                   example_weights, correct, total,
                                   *this));

        /* Get our task group for the update.  We make a job to calculate
           the accuracy go to the end. */
        group = worker.get_group
            (next, format("Update_Weights_And_Scores job under %d", parent), parent);
        Call_Guard guard(boost::bind(&Worker_Task::unlock_group,
                                     boost::ref(worker),
                                     group));

        /* First we split up the output matrix into enough bands that we get a
           decent amount of work on each example.

           We want to update at least 10000 output entries in each chunk,
           otherwise the overhead gets too high.
        */

        size_t nx = output.shape()[0];

        size_t ENTRIES_PER_CHUNK = 2048;
        size_t examples_per_chunk = ENTRIES_PER_CHUNK / output.shape()[1];

        size_t chunk_start = 0;
        while (chunk_start < nx) {
            size_t end = std::min(nx, chunk_start + examples_per_chunk);
            worker.add(Update_Job(info, chunk_start, end),
                       format("Update_Job %zd-%zd under %d",
                              chunk_start, end, group),
                       group);
            chunk_start = end;
        }
    }

    struct Job_Info_Classifier {
        const Classifier_Impl & classifier;
        const Optimization_Info & opt_info;
        float cl_weight;
        boost::multi_array<float, 2> & weights;
        boost::multi_array<float, 2> & output;
        const Training_Data & data;
        const distribution<float> & example_weights;

        Lock lock;
        double & correct;
        double & total;

        const Updater & updater;

        Job_Info_Classifier(const Classifier_Impl & classifier,
                            const Optimization_Info & opt_info,
                            float cl_weight,
                            boost::multi_array<float, 2> & weights,
                            boost::multi_array<float, 2> & output,
                            const Training_Data & data,
                            const distribution<float> & example_weights,
                            double & correct,
                            double & total,
                            const Updater & updater)
            : classifier(classifier), opt_info(opt_info),
              cl_weight(cl_weight), weights(weights),
              output(output),
              data(data), example_weights(example_weights),
              correct(correct), total(total), updater(updater)
        {
        }

        /* Update a part of the data. */
        void update_range(int x_begin, int x_end)
        {
            double sub_correct = 0.0;
            double subtotal
                = updater(classifier, opt_info,
                          cl_weight, weights, output, data,
                          example_weights, sub_correct, x_begin, x_end);

            Guard guard(lock);
            total += subtotal;
            correct += sub_correct;
        }
    };

    struct Update_Job_Classifier {
        Update_Job_Classifier(std::shared_ptr<Job_Info_Classifier> info, int n_begin,
                   int n_end)
            : info(info), n_begin(n_begin), n_end(n_end)
        {
        }

        std::shared_ptr<Job_Info_Classifier> info;
        int n_begin, n_end;

        void operator () ()
        {
            info->update_range(n_begin, n_end);
        }
    };

    /** Apply the given classifier to the given output, given the training
        data.  This will update all of the output. */
    void operator () (const Classifier_Impl & classifier,
                      const Optimization_Info & opt_info,
                      float cl_weight,
                      boost::multi_array<float, 2> & weights,
                      boost::multi_array<float, 2> & output,
                      const Training_Data & data,
                      const distribution<float> & example_weights,
                      double & correct,
                      double & total,
                      Job next, int parent = -1)
    {
        /* Create the job info. */
        std::shared_ptr<Job_Info_Classifier> info
            = make_sp(new Job_Info_Classifier
                      (classifier, opt_info, cl_weight, weights, output, data,
                       example_weights, correct, total, *this));

        /* Get our task group for the update.  We make a job to calculate
           the accuracy go to the end. */
        group = worker.get_group
            (next, format("Update_Weights_And_Scores job under %d", parent), parent);
        Call_Guard guard(boost::bind(&Worker_Task::unlock_group,
                                     boost::ref(worker),
                                     group));

        /* First we split up the output matrix into enough bands that we get a
           decent amount of work on each example.

           We want to update at least 10000 output entries in each chunk,
           otherwise the overhead gets too high.
        */

        size_t nx = output.shape()[0];

        size_t ENTRIES_PER_CHUNK = 2048;
        size_t examples_per_chunk = ENTRIES_PER_CHUNK / output.shape()[1];

        size_t chunk_start = 0;
        while (chunk_start < nx) {
            size_t end = std::min(nx, chunk_start + examples_per_chunk);
            worker.add(Update_Job_Classifier(info, chunk_start, end),
                       format("Update_Job_Classifier %zd-%zd under %d",
                              chunk_start, end, group),
                       group);
            chunk_start = end;
        }
    }
};

} // namespace ML

#endif /* __boosting__boosting_core_parallel_h__ */


text:
/**
 *  EJB 3 in Action
 *  Book: http://www.manning.com/panda/
 *  Code: http://code.google.com/p/action-bazaar/
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.actionbazaar.buslogic;

import javax.ejb.Remote;
import com.actionbazaar.persistence.BillingInfo;
import com.actionbazaar.persistence.BiographicalInfo;
import com.actionbazaar.persistence.LoginInfo;

/**
 * Creates a BidderAccountCreator
 */
@Remote
public interface BidderAccountCreator {

    /**
     * Adds a new log info to the system
     * @param loginInfo - login info
     */
    void addLoginInfo(LoginInfo loginInfo);

    /**
     * Returns a biographical info
     * @param biographicalInfo - biographical info
     * @throws WorkflowOrderViolationException - thrown if there is an error
     */
    void addBiographicalInfo(BiographicalInfo biographicalInfo);

    /**
     * Adds a billing info
     * @param billingInfo - billing info
     * @throws WorkflowOrderViolationException
     */
    void addBillingInfo(BillingInfo billingInfo);

    /**
     * Cancel account creation
     */
    void cancelAccountCreation();

    /**
     * Creates a account
     */
    void createAccount();
}


text:
using Gar.Client.Contracts.Profiles;
using Gar.Root.Contracts;

namespace Gar.Client.Contracts.ViewModels
{
    public interface IGroupersViewModel : IViewModelRoot, ISqlOutputProfile, ICSharpOutputProfile, IJsonOutputProfile, ICsvOutputProfile
    {
        #region properties

        bool Apostrophes { get; set; }
        bool Braces { get; set; }
        bool Brackets { get; set; }
        bool Conditional { get; set; }
        bool Custom { get; set; }
        string CustomGroupEnd { get; set; }
        string CustomGroupStart { get; set; }
        bool Forced { get; set; }
        char? GroupEnd { get; }
        char? GroupStart { get; }
        bool LtGt { get; set; }
        bool Parentheses { get; set; }
        bool Quotes { get; set; }
        bool Standard { get; }

        #endregion

        #region methods

        void Deselect(char? c);

        #endregion
    }
}


text:
var gulp 			= require('gulp'),
	plumber 		= require('gulp-plumber'),
	config 			= require('../util/utils').getConfig(),
	fontName 		= 'iconfont';

gulp.task('iconfonts', function(){

	// require here so it doesn't break the gulp watch
	var iconfont 		= require('gulp-iconfont'),
			iconfontCss = require('gulp-iconfont-css');

  return gulp.src(config.iconfont.svg.src)
			  		.pipe(plumber())
			  		.pipe(iconfontCss({
				      fontName: fontName,
				      path: config.iconfont.css.src,
				      targetPath: config.iconfont.stylus.dest,
				      fontPath: config.iconfont.fontPath
				    }))
				    .pipe(iconfont({
				      fontName: fontName,
				      normalize: true,
				      appendCodepoints: true
				    }))
			    	.pipe(gulp.dest(config.iconfont.dest))
});


text:
@interface NPhotoBrowser : UIViewController

+ (instancetype)browserWithPhoto:(NSArray<NPhoto *> *)photo selectedIndex:(NSUInteger)selectedIndex;

- (instancetype)initWithPhoto:(NSArray<NPhoto *> *)photo selectedIndex:(NSUInteger)selectedindex;

- (void)showFromViewController:(UIViewController *)vc;

@end


text:
package org.envbuild.environment.pattern;

import org.envbuild.exception.PatternInitializationException;

/**
 * Паттерн, который имеет привязку к каким-либо объектам или окружению.
 * @author kovlyashenko
 */
public interface BindedPattern {

    /**
     * Привязан ли паттерн к целевым объектам
     * @return true - привязан, false - нет
     */
    boolean isBinded();

    /**
     * Произвести инициализацию паттерна - настроить его на работу с привязкой
     * @throws org.envbuild.exception.PatternInitializationException ошибка инициализации
     */
    void initializePattern() throws PatternInitializationException ;
}


text:
namespace syncer {

const size_t ProtocolEventBuffer::kBufferSize = 6;

ProtocolEventBuffer::ProtocolEventBuffer() : buffer_deleter_(&buffer_) {}

ProtocolEventBuffer::~ProtocolEventBuffer() {}

void ProtocolEventBuffer::RecordProtocolEvent(const ProtocolEvent& event) {
  buffer_.push_back(event.Clone().release());
  if (buffer_.size() > kBufferSize) {
    ProtocolEvent* to_delete = buffer_.front();
    buffer_.pop_front();
    delete to_delete;
  }
}

ScopedVector<ProtocolEvent> ProtocolEventBuffer::GetBufferedProtocolEvents()
    const {
  ScopedVector<ProtocolEvent> ret;
  for (std::deque<ProtocolEvent*>::const_iterator it = buffer_.begin();
       it != buffer_.end(); ++it) {
    ret.push_back((*it)->Clone());
  }
  return ret;
}

}  // namespace syncer


text:
require 'spec_helper'

describe Devise::Oauth::Client do
  before { @client = create(:client) }
  subject { @client }

  it { should validate_presence_of(:name) }
  it { should validate_presence_of(:site_uri) }

  it { should belong_to(:owner) }

  it { should have_many(:access_tokens) }
  it { should have_many(:authorizations) }

  it { should have_db_index(:identifier).unique(true) }
  it { should have_db_index(:secret).unique(true) }
  it { should have_db_index(:owner_id).unique(false) }

  its(:identifier) { should_not be_nil }
  its(:secret) { should_not be_nil }

  it { should_not be_blocked }

  it ".granted!" do
    lambda{ subject.granted! }.should change{ subject.reload; subject.granted_times }.by(1)
  end

  it ".revoked!" do
    lambda{ subject.revoked! }.should change{ subject.reload; subject.revoked_times }.by(1)
  end
end


text:
module ProjectsHelper
end


text:
package cn.demoz.www.demos.fragment;

import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
import android.widget.TextView;

import cn.demoz.www.R;
import cn.demoz.www.base.BaseDemosFragment;
import cn.demoz.www.demos.view.ClockView;

public class ClockViewFragment extends BaseDemosFragment implements View.OnClickListener{

    ClockView clockView;
//    LinearLayout demoDesc;
    private String mDemoDesc = "Android自定义控件 - ClockView实现时钟效果,参照博客http://www.jianshu.com/p/fe65f5d7a60b";

    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    public View setDemoContentView(Context context, LayoutInflater inflater) {
        View view = inflater.inflate(R.layout.layout_clock_view_fragment, null);
        final TextView tv = (TextView) view.findViewById(R.id.tv);
        clockView = (ClockView) view.findViewById(R.id.clockView);
//        demoDesc = (LinearLayout) view.findViewById(R.id.demo_desc);

        view.findViewById(R.id.btn1).setOnClickListener(this);
        view.findViewById(R.id.btn2).setOnClickListener(this);
        view.findViewById(R.id.btn3).setOnClickListener(this);

        clockView.setOnTimeChangeListener(new ClockView.OnTimeChangeListener() {
            @Override
            public void onTimeChange(View view, int hour, int minute, int second) {
                tv.setText(String.format("%s-%s-%s", hour, minute, second));
            }
        });

//        demoDesc.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                toggleDemoDesc(demoDesc);
//            }
//        });
        demoDesc.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
            @Override
            public void onGlobalLayout() {
                demoDesc.getViewTreeObserver().removeOnGlobalLayoutListener(this);
                demoFoldedHeight = demoDesc.getHeight();
                if(demoFoldedHeight > DEMO_FOLDED_MAX_HEIGHT){
                    demoFoldedHeight = DEMO_FOLDED_MAX_HEIGHT;
                }
            }
        });
        return view;
    }

    @Override
    protected String getDemoDesc() {
        return mDemoDesc!=null?mDemoDesc:"";
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn1:
                clockView.setTime(11, 59, 55);
                break;
            case R.id.btn2:
                clockView.setTime(20, 30, 0);
                break;
            case R.id.btn3:
                clockView.setTime(23, 59, 55);
                break;
        }
    }

}


text:
<?php

namespace Admin\Controller;

use Admin\Controller\AppController;
use Cake\ORM\Query;

/**
 * Disciplinas Controller
 *
 * @property \Admin\Model\Table\DisciplinasTable $Disciplinas
 */
class DisciplinasController extends AppController {

    /**
     * Index method
     *
     * @return \Cake\Network\Response|null
     */
    public function index() {
        $this->paginate = [
            'contain' => []
        ];
        $disciplinas = $this->paginate($this->Disciplinas);

        $this->set(compact('disciplinas'));
        $this->set('_serialize', ['disciplinas']);
    }

    /**
     * View method
     *
     * @param string|null $id Disciplina id.
     * @return \Cake\Network\Response|null
     * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
     */
    public function view($id = null) {
        $retorno = [];

        $disciplina = $this->Disciplinas->get($id, [
            'contain' => [
                'Aulas' => [
                    'queryBuilder' => function (Query $q) {
                        return $q->order(['Aulas.ordem' => 'ASC']);
                    }
                        ]
                    ]
                ]);
                if (!empty($disciplina) && isset($disciplina)) {
                    $retorno['disciplina'] = $disciplina;
                    $retorno['sucesso'] = 'ok';
                } else {
                    $retorno['sucesso'] = 'no';
                }
                die(json_encode($retorno));
                $this->set('disciplina', $disciplina);
                $this->set('_serialize', ['disciplina']);
            }

            /**
             * Add method
             *
             * @return \Cake\Network\Response|void Redirects on successful add, renders view otherwise.
             */
            public function add() {
                $retorno = [];
                $disciplina = $this->Disciplinas->newEntity();
                if ($this->request->is('ajax')) {
                    $disciplina = $this->Disciplinas->patchEntity($disciplina, $this->request->data);
//            die(var_dump($disciplina));

                    if ($this->Disciplinas->save($disciplina)) {
                        $retorno['sucesso'] = 'ok';
                        $retorno['id'] = $disciplina->id;
                        $retorno['titulo'] = $this->request->data['titulo'];
                        $retorno['curso_id'] = $this->request->data['curso_id'];
                        $retorno['slug'] = $this->request->data['slug'];
                    } else {
                        $retorno['sucesso'] = 'no';
                    }
                    die(json_encode($retorno));
                }
            }

            /**
             * Edit method
             *
             * @param string|null $id Disciplina id.
             * @return \Cake\Network\Response|void Redirects on successful edit, renders view otherwise.
             * @throws \Cake\Network\Exception\NotFoundException When record not found.
             */
            public function edit($id = null) {
                $retorno = [];
                $disciplina = $this->Disciplinas->get($id, [
                    'contain' => ['Aulas']
                ]);

                if ($this->request->is(['patch', 'post', 'put', 'ajax'])) {
                    $disciplina = $this->Disciplinas->patchEntity($disciplina, $this->request->data);
                    if ($this->Disciplinas->save($disciplina)) {
                        $this->Flash->success(__('The disciplina has been saved.'));

                        return $this->redirect(['action' => 'index']);
                    } else {
                        $this->Flash->error(__('The disciplina could not be saved. Please, try again.'));
                    }
                }
            }

            /**
             * Delete method
             *
             * @param string|null $id Disciplina id.
             * @return \Cake\Network\Response|null Redirects to index.
             * @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
             */
            public function delete($id = null) {
                $retorno = [];
                $disciplina = $this->Disciplinas->get($id, [
                    'contain' => ['Aulas']
                ]);
                $this->request->data['status'] = 0;
                $this->request->data['excluido'] = 1;
                $this->request->data['deleted_at'] = date('Y-m-d H:i:s');
                foreach ($disciplina->aulas as $aula) {
                    $this->request->data['aulas'][] = [
                        'id' => $aula->id,
                        'status' => 0,
                        'excluido' => 1,
                        'deleted_at' => date('Y-m-d H:i:s')
                    ];
                }
                $disciplina = $this->Disciplinas->patchEntity($disciplina, $this->request->data, ['associated' => ['Aulas' => ['accessibleFields' => ['id' => true]]]]);
                $this->request->allowMethod(['post', 'delete', 'ajax']);
                if ($this->Disciplinas->save($disciplina, ['associated' => ['Aulas']])) {
                    $retorno['sucesso'] = 'ok';
                } else {
                    $retorno['sucesso'] = 'no';
                }
                die(json_encode($retorno));
            }

        }


text:
/*
 * Generated by the Jasper component of Apache Tomcat
 * Version: Apache Tomcat/8.0.18
 * Generated at: 2017-08-09 16:03:14 UTC
 * Note: The last modified time of this file was set to
 *       the last modified time of the source file after
 *       generation to assist with modification tracking.
 */
package org.apache.jsp.WEB_002dINF.views.tspd;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;

public final class tspdssolveHome_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent,
                 org.apache.jasper.runtime.JspSourceImports {

  private static final javax.servlet.jsp.JspFactory _jspxFactory =
          javax.servlet.jsp.JspFactory.getDefaultFactory();

  private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;

  static {
    _jspx_dependants = new java.util.HashMap<java.lang.String,java.lang.Long>(2);
    _jspx_dependants.put("/WEB-INF/lib/spring-webmvc-3.2.6.RELEASE.jar", Long.valueOf(1423481836151L));
    _jspx_dependants.put("jar:file:/C:/DungPQ/research/projects/cblsvr/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/slp/WEB-INF/lib/spring-webmvc-3.2.6.RELEASE.jar!/META-INF/spring-form.tld", Long.valueOf(1386784424000L));
  }

  private static final java.util.Set<java.lang.String> _jspx_imports_packages;

  private static final java.util.Set<java.lang.String> _jspx_imports_classes;

  static {
    _jspx_imports_packages = new java.util.HashSet<>();
    _jspx_imports_packages.add("javax.servlet");
    _jspx_imports_packages.add("javax.servlet.http");
    _jspx_imports_packages.add("javax.servlet.jsp");
    _jspx_imports_classes = null;
  }

  private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005fform_0026_005frole_005fmethod_005fid_005fenctype_005fcommandName_005fclass_005faction;
  private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fstyle_005fpath_005fname_005fid_005fclass_005fnobody;
  private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005fform_0026_005frole_005fmethod_005fcommandName_005fclass_005faction;
  private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody;
  private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fname_005fid_005fnobody;

  private javax.el.ExpressionFactory _el_expressionfactory;
  private org.apache.tomcat.InstanceManager _jsp_instancemanager;

  public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
    return _jspx_dependants;
  }

  public java.util.Set<java.lang.String> getPackageImports() {
    return _jspx_imports_packages;
  }

  public java.util.Set<java.lang.String> getClassImports() {
    return _jspx_imports_classes;
  }

  public void _jspInit() {
    _005fjspx_005ftagPool_005fform_005fform_0026_005frole_005fmethod_005fid_005fenctype_005fcommandName_005fclass_005faction = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fstyle_005fpath_005fname_005fid_005fclass_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _005fjspx_005ftagPool_005fform_005fform_0026_005frole_005fmethod_005fcommandName_005fclass_005faction = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fname_005fid_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
  }

  public void _jspDestroy() {
    _005fjspx_005ftagPool_005fform_005fform_0026_005frole_005fmethod_005fid_005fenctype_005fcommandName_005fclass_005faction.release();
    _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fstyle_005fpath_005fname_005fid_005fclass_005fnobody.release();
    _005fjspx_005ftagPool_005fform_005fform_0026_005frole_005fmethod_005fcommandName_005fclass_005faction.release();
    _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.release();
    _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fname_005fid_005fnobody.release();
  }

  public void _jspService(final javax.servlet.http.HttpServletRequest request, final javax.servlet.http.HttpServletResponse response)
        throws java.io.IOException, javax.servlet.ServletException {

final java.lang.String _jspx_method = request.getMethod();
if (!"GET".equals(_jspx_method) && !"POST".equals(_jspx_method) && !"HEAD".equals(_jspx_method) && !javax.servlet.DispatcherType.ERROR.equals(request.getDispatcherType())) {
response.sendError(HttpServletResponse.SC_METHOD_NOT_ALLOWED, "JSPs only permit GET POST or HEAD");
return;
}

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;

    try {
      response.setContentType("text/html; charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("
\r\n");
      out.write("\t
\r\n");
      out.write("\t\t
\r\n");
      out.write("\t\t\t
TSPD
\r\n");
      out.write("\t\t
\r\n");
      out.write("\t
\r\n");
      out.write("\t\r\n");
      out.write("\t
\r\n");
      out.write("\t\t");
      if (_jspx_meth_form_005fform_005f0(_jspx_page_context))
        return;
      out.write("\r\n");
      out.write("\t\t

\r\n");
      out.write("\t\t\r\n");
      out.write("\t\t\r\n");
      out.write("\t\t");
      if (_jspx_meth_form_005fform_005f1(_jspx_page_context))
        return;
      out.write("\r\n");
      out.write("\t\t\r\n");
      out.write("\t
\r\n");
      out.write("
\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("");
    } catch (java.lang.Throwable t) {
      if (!(t instanceof javax.servlet.jsp.SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            if (response.isCommitted()) {
              out.flush();
            } else {
              out.clearBuffer();
            }
          } catch (java.io.IOException e) {}
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }

  private boolean _jspx_meth_form_005fform_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  form:form
    org.springframework.web.servlet.tags.form.FormTag _jspx_th_form_005fform_005f0 = (org.springframework.web.servlet.tags.form.FormTag) _005fjspx_005ftagPool_005fform_005fform_0026_005frole_005fmethod_005fid_005fenctype_005fcommandName_005fclass_005faction.get(org.springframework.web.servlet.tags.form.FormTag.class);
    _jspx_th_form_005fform_005f0.setPageContext(_jspx_page_context);
    _jspx_th_form_005fform_005f0.setParent(null);
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(12,2) name = action type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005fform_005f0.setAction((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${baseUrl}/tsp-drone/uploadSolutionkDrone", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(12,2) name = method type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005fform_005f0.setMethod("POST");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(12,2) name = id type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005fform_005f0.setId("tspdsolution");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(12,2) name = commandName type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005fform_005f0.setCommandName("tspdsolution");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(12,2) name = enctype type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005fform_005f0.setEnctype("multipart/form-data");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(12,2) null
    _jspx_th_form_005fform_005f0.setDynamicAttribute(null, "role", "form");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(12,2) null
    _jspx_th_form_005fform_005f0.setDynamicAttribute(null, "class", "form-horizontal");
    int[] _jspx_push_body_count_form_005fform_005f0 = new int[] { 0 };
    try {
      int _jspx_eval_form_005fform_005f0 = _jspx_th_form_005fform_005f0.doStartTag();
      if (_jspx_eval_form_005fform_005f0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
        do {
          out.write("\r\n");
          out.write("\t\t\t");
          if (_jspx_meth_form_005finput_005f0(_jspx_th_form_005fform_005f0, _jspx_page_context, _jspx_push_body_count_form_005fform_005f0))
            return true;
          out.write("\r\n");
          out.write("\t\t\tUpload Solution\r\n");
          out.write("\t\t");
          int evalDoAfterBody = _jspx_th_form_005fform_005f0.doAfterBody();
          if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
            break;
        } while (true);
      }
      if (_jspx_th_form_005fform_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
    } catch (java.lang.Throwable _jspx_exception) {
      while (_jspx_push_body_count_form_005fform_005f0[0]-- > 0)
        out = _jspx_page_context.popBody();
      _jspx_th_form_005fform_005f0.doCatch(_jspx_exception);
    } finally {
      _jspx_th_form_005fform_005f0.doFinally();
      _005fjspx_005ftagPool_005fform_005fform_0026_005frole_005fmethod_005fid_005fenctype_005fcommandName_005fclass_005faction.reuse(_jspx_th_form_005fform_005f0);
    }
    return false;
  }

  private boolean _jspx_meth_form_005finput_005f0(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f0, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f0)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  form:input
    org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f0 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fstyle_005fpath_005fname_005fid_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class);
    _jspx_th_form_005finput_005f0.setPageContext(_jspx_page_context);
    _jspx_th_form_005finput_005f0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f0);
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(13,3) name = id type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f0.setId("input-solution");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(13,3) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f0.setPath("tspdSolutionFile");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(13,3) null
    _jspx_th_form_005finput_005f0.setDynamicAttribute(null, "name", "tspdSolutionFile");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(13,3) null
    _jspx_th_form_005finput_005f0.setDynamicAttribute(null, "type", "file");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(13,3) null
    _jspx_th_form_005finput_005f0.setDynamicAttribute(null, "class", "file file-loading ");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(13,3) null
    _jspx_th_form_005finput_005f0.setDynamicAttribute(null, "style", "display:none");
    int[] _jspx_push_body_count_form_005finput_005f0 = new int[] { 0 };
    try {
      int _jspx_eval_form_005finput_005f0 = _jspx_th_form_005finput_005f0.doStartTag();
      if (_jspx_th_form_005finput_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
    } catch (java.lang.Throwable _jspx_exception) {
      while (_jspx_push_body_count_form_005finput_005f0[0]-- > 0)
        out = _jspx_page_context.popBody();
      _jspx_th_form_005finput_005f0.doCatch(_jspx_exception);
    } finally {
      _jspx_th_form_005finput_005f0.doFinally();
      _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fstyle_005fpath_005fname_005fid_005fclass_005fnobody.reuse(_jspx_th_form_005finput_005f0);
    }
    return false;
  }

  private boolean _jspx_meth_form_005fform_005f1(javax.servlet.jsp.PageContext _jspx_page_context)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  form:form
    org.springframework.web.servlet.tags.form.FormTag _jspx_th_form_005fform_005f1 = (org.springframework.web.servlet.tags.form.FormTag) _005fjspx_005ftagPool_005fform_005fform_0026_005frole_005fmethod_005fcommandName_005fclass_005faction.get(org.springframework.web.servlet.tags.form.FormTag.class);
    _jspx_th_form_005fform_005f1.setPageContext(_jspx_page_context);
    _jspx_th_form_005fform_005f1.setParent(null);
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(19,2) name = action type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005fform_005f1.setAction((java.lang.String) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${baseUrl}/tsp-drone/tspds-solve", java.lang.String.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null));
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(19,2) name = method type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005fform_005f1.setMethod("POST");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(19,2) name = commandName type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005fform_005f1.setCommandName("tspd");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(19,2) null
    _jspx_th_form_005fform_005f1.setDynamicAttribute(null, "role", "form");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(19,2) null
    _jspx_th_form_005fform_005f1.setDynamicAttribute(null, "class", "form-horizontal");
    int[] _jspx_push_body_count_form_005fform_005f1 = new int[] { 0 };
    try {
      int _jspx_eval_form_005fform_005f1 = _jspx_th_form_005fform_005f1.doStartTag();
      if (_jspx_eval_form_005fform_005f1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
        do {
          out.write("\r\n");
          out.write("\t\t
\r\n");
          out.write("\t\t\t
\r\n");
          out.write("\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t\tTruck speed (km/h)\r\n");
          out.write("\t\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t\t\t");
          if (_jspx_meth_form_005finput_005f1(_jspx_th_form_005fform_005f1, _jspx_page_context, _jspx_push_body_count_form_005fform_005f1))
            return true;
          out.write("\r\n");
          out.write("\t\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t\tDrone speed (km/h)\r\n");
          out.write("\t\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t\t\t");
          if (_jspx_meth_form_005finput_005f2(_jspx_th_form_005fform_005f1, _jspx_page_context, _jspx_push_body_count_form_005fform_005f1))
            return true;
          out.write("\r\n");
          out.write("\t\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t
\r\n");
          out.write("\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t\tCost per unit (km) of truck\r\n");
          out.write("\t\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t\t\t");
          if (_jspx_meth_form_005finput_005f3(_jspx_th_form_005fform_005f1, _jspx_page_context, _jspx_push_body_count_form_005fform_005f1))
            return true;
          out.write("\r\n");
          out.write("\t\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t\tCost per unit (km) of drone\r\n");
          out.write("\t\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t\t\t");
          if (_jspx_meth_form_005finput_005f4(_jspx_th_form_005fform_005f1, _jspx_page_context, _jspx_push_body_count_form_005fform_005f1))
            return true;
          out.write("\r\n");
          out.write("\t\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t
\r\n");
          out.write("\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t\tWait time (Delta) (minute)\r\n");
          out.write("\t\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t\t\t");
          if (_jspx_meth_form_005finput_005f5(_jspx_th_form_005fform_005f1, _jspx_page_context, _jspx_push_body_count_form_005fform_005f1))
            return true;
          out.write("\r\n");
          out.write("\t\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t\tDrone endurance (e) (km)\r\n");
          out.write("\t\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t\t\t");
          if (_jspx_meth_form_005finput_005f6(_jspx_th_form_005fform_005f1, _jspx_page_context, _jspx_push_body_count_form_005fform_005f1))
            return true;
          out.write("\r\n");
          out.write("\t\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t
\r\n");
          out.write("\t\t\t\t
\r\n");
          out.write("\t\t\t\t
\r\n");
          out.write("\t\t\t\t\t");
          if (_jspx_meth_form_005finput_005f7(_jspx_th_form_005fform_005f1, _jspx_page_context, _jspx_push_body_count_form_005fform_005f1))
            return true;
          out.write("\r\n");
          out.write("\t\t\t\t\t<button class=\"btn btn-primary col-lg-offset-5\" onclick=\"run_algorithm();\" type=\"submit\">Run</button>\r\n");
          out.write("\t\t\t\t\tSave\r\n");
          out.write("\t\t\t\t\tUpload\r\n");
          out.write("\t\t\t\t\t<input id=\"file-tsp-data\" class=\"file file-loading\" type=\"file\" style=\"display:none\"/>\t\r\n");
          out.write("\t\t\t\t
\r\n");
          out.write("\t\t\t
\t\t\r\n");
          out.write("\t\t
\r\n");
          out.write("\t\t");
          int evalDoAfterBody = _jspx_th_form_005fform_005f1.doAfterBody();
          if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
            break;
        } while (true);
      }
      if (_jspx_th_form_005fform_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
    } catch (java.lang.Throwable _jspx_exception) {
      while (_jspx_push_body_count_form_005fform_005f1[0]-- > 0)
        out = _jspx_page_context.popBody();
      _jspx_th_form_005fform_005f1.doCatch(_jspx_exception);
    } finally {
      _jspx_th_form_005fform_005f1.doFinally();
      _005fjspx_005ftagPool_005fform_005fform_0026_005frole_005fmethod_005fcommandName_005fclass_005faction.reuse(_jspx_th_form_005fform_005f1);
    }
    return false;
  }

  private boolean _jspx_meth_form_005finput_005f1(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f1, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f1)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  form:input
    org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f1 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class);
    _jspx_th_form_005finput_005f1.setPageContext(_jspx_page_context);
    _jspx_th_form_005finput_005f1.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f1);
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(26,7) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f1.setPath("truckSpeed");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(26,7) null
    _jspx_th_form_005finput_005f1.setDynamicAttribute(null, "name", "truckSpeed");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(26,7) name = id type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f1.setId("truckSpeed");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(26,7) null
    _jspx_th_form_005finput_005f1.setDynamicAttribute(null, "class", "form-control");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(26,7) null
    _jspx_th_form_005finput_005f1.setDynamicAttribute(null, "placeholder", "Truck speed");
    int[] _jspx_push_body_count_form_005finput_005f1 = new int[] { 0 };
    try {
      int _jspx_eval_form_005finput_005f1 = _jspx_th_form_005finput_005f1.doStartTag();
      if (_jspx_th_form_005finput_005f1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
    } catch (java.lang.Throwable _jspx_exception) {
      while (_jspx_push_body_count_form_005finput_005f1[0]-- > 0)
        out = _jspx_page_context.popBody();
      _jspx_th_form_005finput_005f1.doCatch(_jspx_exception);
    } finally {
      _jspx_th_form_005finput_005f1.doFinally();
      _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.reuse(_jspx_th_form_005finput_005f1);
    }
    return false;
  }

  private boolean _jspx_meth_form_005finput_005f2(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f1, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f1)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  form:input
    org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f2 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class);
    _jspx_th_form_005finput_005f2.setPageContext(_jspx_page_context);
    _jspx_th_form_005finput_005f2.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f1);
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(30,7) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f2.setPath("droneSpeed");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(30,7) null
    _jspx_th_form_005finput_005f2.setDynamicAttribute(null, "name", "droneSpeed");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(30,7) name = id type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f2.setId("droneSpeed");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(30,7) null
    _jspx_th_form_005finput_005f2.setDynamicAttribute(null, "class", "form-control");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(30,7) null
    _jspx_th_form_005finput_005f2.setDynamicAttribute(null, "placeholder", "Drone speed");
    int[] _jspx_push_body_count_form_005finput_005f2 = new int[] { 0 };
    try {
      int _jspx_eval_form_005finput_005f2 = _jspx_th_form_005finput_005f2.doStartTag();
      if (_jspx_th_form_005finput_005f2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
    } catch (java.lang.Throwable _jspx_exception) {
      while (_jspx_push_body_count_form_005finput_005f2[0]-- > 0)
        out = _jspx_page_context.popBody();
      _jspx_th_form_005finput_005f2.doCatch(_jspx_exception);
    } finally {
      _jspx_th_form_005finput_005f2.doFinally();
      _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.reuse(_jspx_th_form_005finput_005f2);
    }
    return false;
  }

  private boolean _jspx_meth_form_005finput_005f3(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f1, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f1)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  form:input
    org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f3 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class);
    _jspx_th_form_005finput_005f3.setPageContext(_jspx_page_context);
    _jspx_th_form_005finput_005f3.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f1);
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(38,7) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f3.setPath("truckCost");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(38,7) null
    _jspx_th_form_005finput_005f3.setDynamicAttribute(null, "name", "truckCost");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(38,7) name = id type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f3.setId("truckCost");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(38,7) null
    _jspx_th_form_005finput_005f3.setDynamicAttribute(null, "class", "form-control");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(38,7) null
    _jspx_th_form_005finput_005f3.setDynamicAttribute(null, "placeholder", "Cost per unit of truck");
    int[] _jspx_push_body_count_form_005finput_005f3 = new int[] { 0 };
    try {
      int _jspx_eval_form_005finput_005f3 = _jspx_th_form_005finput_005f3.doStartTag();
      if (_jspx_th_form_005finput_005f3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
    } catch (java.lang.Throwable _jspx_exception) {
      while (_jspx_push_body_count_form_005finput_005f3[0]-- > 0)
        out = _jspx_page_context.popBody();
      _jspx_th_form_005finput_005f3.doCatch(_jspx_exception);
    } finally {
      _jspx_th_form_005finput_005f3.doFinally();
      _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.reuse(_jspx_th_form_005finput_005f3);
    }
    return false;
  }

  private boolean _jspx_meth_form_005finput_005f4(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f1, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f1)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  form:input
    org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f4 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class);
    _jspx_th_form_005finput_005f4.setPageContext(_jspx_page_context);
    _jspx_th_form_005finput_005f4.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f1);
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(42,7) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f4.setPath("droneCost");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(42,7) null
    _jspx_th_form_005finput_005f4.setDynamicAttribute(null, "name", "droneCost");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(42,7) name = id type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f4.setId("droneCost");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(42,7) null
    _jspx_th_form_005finput_005f4.setDynamicAttribute(null, "class", "form-control");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(42,7) null
    _jspx_th_form_005finput_005f4.setDynamicAttribute(null, "placeholder", "Cost per unit of drone");
    int[] _jspx_push_body_count_form_005finput_005f4 = new int[] { 0 };
    try {
      int _jspx_eval_form_005finput_005f4 = _jspx_th_form_005finput_005f4.doStartTag();
      if (_jspx_th_form_005finput_005f4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
    } catch (java.lang.Throwable _jspx_exception) {
      while (_jspx_push_body_count_form_005finput_005f4[0]-- > 0)
        out = _jspx_page_context.popBody();
      _jspx_th_form_005finput_005f4.doCatch(_jspx_exception);
    } finally {
      _jspx_th_form_005finput_005f4.doFinally();
      _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.reuse(_jspx_th_form_005finput_005f4);
    }
    return false;
  }

  private boolean _jspx_meth_form_005finput_005f5(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f1, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f1)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  form:input
    org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f5 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class);
    _jspx_th_form_005finput_005f5.setPageContext(_jspx_page_context);
    _jspx_th_form_005finput_005f5.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f1);
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(50,7) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f5.setPath("delta");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(50,7) null
    _jspx_th_form_005finput_005f5.setDynamicAttribute(null, "name", "delta");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(50,7) name = id type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f5.setId("delta");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(50,7) null
    _jspx_th_form_005finput_005f5.setDynamicAttribute(null, "class", "form-control");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(50,7) null
    _jspx_th_form_005finput_005f5.setDynamicAttribute(null, "placeholder", "Wait time");
    int[] _jspx_push_body_count_form_005finput_005f5 = new int[] { 0 };
    try {
      int _jspx_eval_form_005finput_005f5 = _jspx_th_form_005finput_005f5.doStartTag();
      if (_jspx_th_form_005finput_005f5.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
    } catch (java.lang.Throwable _jspx_exception) {
      while (_jspx_push_body_count_form_005finput_005f5[0]-- > 0)
        out = _jspx_page_context.popBody();
      _jspx_th_form_005finput_005f5.doCatch(_jspx_exception);
    } finally {
      _jspx_th_form_005finput_005f5.doFinally();
      _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.reuse(_jspx_th_form_005finput_005f5);
    }
    return false;
  }

  private boolean _jspx_meth_form_005finput_005f6(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f1, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f1)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  form:input
    org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f6 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class);
    _jspx_th_form_005finput_005f6.setPageContext(_jspx_page_context);
    _jspx_th_form_005finput_005f6.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f1);
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(54,7) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f6.setPath("endurance");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(54,7) null
    _jspx_th_form_005finput_005f6.setDynamicAttribute(null, "name", "endurance");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(54,7) name = id type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f6.setId("endurance");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(54,7) null
    _jspx_th_form_005finput_005f6.setDynamicAttribute(null, "class", "form-control");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(54,7) null
    _jspx_th_form_005finput_005f6.setDynamicAttribute(null, "placeholder", "endurance");
    int[] _jspx_push_body_count_form_005finput_005f6 = new int[] { 0 };
    try {
      int _jspx_eval_form_005finput_005f6 = _jspx_th_form_005finput_005f6.doStartTag();
      if (_jspx_th_form_005finput_005f6.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
    } catch (java.lang.Throwable _jspx_exception) {
      while (_jspx_push_body_count_form_005finput_005f6[0]-- > 0)
        out = _jspx_page_context.popBody();
      _jspx_th_form_005finput_005f6.doCatch(_jspx_exception);
    } finally {
      _jspx_th_form_005finput_005f6.doFinally();
      _005fjspx_005ftagPool_005fform_005finput_0026_005fplaceholder_005fpath_005fname_005fid_005fclass_005fnobody.reuse(_jspx_th_form_005finput_005f6);
    }
    return false;
  }

  private boolean _jspx_meth_form_005finput_005f7(javax.servlet.jsp.tagext.JspTag _jspx_th_form_005fform_005f1, javax.servlet.jsp.PageContext _jspx_page_context, int[] _jspx_push_body_count_form_005fform_005f1)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  form:input
    org.springframework.web.servlet.tags.form.InputTag _jspx_th_form_005finput_005f7 = (org.springframework.web.servlet.tags.form.InputTag) _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fname_005fid_005fnobody.get(org.springframework.web.servlet.tags.form.InputTag.class);
    _jspx_th_form_005finput_005f7.setPageContext(_jspx_page_context);
    _jspx_th_form_005finput_005f7.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_form_005fform_005f1);
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(59,5) name = path type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f7.setPath("listPoints");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(59,5) null
    _jspx_th_form_005finput_005f7.setDynamicAttribute(null, "name", "listPoints");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(59,5) name = id type = null reqTime = true required = false fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_form_005finput_005f7.setId("listPoints");
    // /WEB-INF/views/tspd/tspdssolveHome.jsp(59,5) null
    _jspx_th_form_005finput_005f7.setDynamicAttribute(null, "type", "hidden");
    int[] _jspx_push_body_count_form_005finput_005f7 = new int[] { 0 };
    try {
      int _jspx_eval_form_005finput_005f7 = _jspx_th_form_005finput_005f7.doStartTag();
      if (_jspx_th_form_005finput_005f7.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
        return true;
      }
    } catch (java.lang.Throwable _jspx_exception) {
      while (_jspx_push_body_count_form_005finput_005f7[0]-- > 0)
        out = _jspx_page_context.popBody();
      _jspx_th_form_005finput_005f7.doCatch(_jspx_exception);
    } finally {
      _jspx_th_form_005finput_005f7.doFinally();
      _005fjspx_005ftagPool_005fform_005finput_0026_005ftype_005fpath_005fname_005fid_005fnobody.reuse(_jspx_th_form_005finput_005f7);
    }
    return false;
  }
}


text:
package com.thinkbiganalytics.feedmgr.nifi.cache;

import com.thinkbiganalytics.metadata.rest.model.nifi.NifiFlowCacheSimpleProcessorDTO;

import org.apache.nifi.web.api.dto.ConnectionDTO;
import org.apache.nifi.web.api.dto.ProcessorDTO;

import java.util.Collection;
import java.util.List;
import java.util.stream.Collectors;

/**
 * update nifi flow cache using nifi processors and connections instead of the flow order processors/connections
 */
public class NifiFlowCacheFeedUpdate2 {

    private String feedName;
    private boolean isStream;
    private String feedProcessGroupId;
    private Collection<ProcessorDTO> processors;
    private Collection<ConnectionDTO> connections;
    private List<String> feedToInputProcessorIds;
    private Collection<NifiFlowCacheSimpleProcessorDTO> simpleProcessors;

    public NifiFlowCacheFeedUpdate2() {

    }

    public NifiFlowCacheFeedUpdate2(String feedName, boolean isStream, String feedProcessGroupId, Collection<ProcessorDTO> processors,
                                    Collection<ConnectionDTO> connections, List<String> feedToInputProcessorIds) {
        this.feedName = feedName;
        this.isStream = isStream;
        this.feedProcessGroupId = feedProcessGroupId;
        this.processors = processors;
        this.connections = connections;
        this.feedToInputProcessorIds = feedToInputProcessorIds;
    }

    public NifiFlowCacheFeedUpdate2(String feedName, boolean isStream, String feedProcessGroupId, Collection<ProcessorDTO> processors, Collection<NifiFlowCacheSimpleProcessorDTO> simpleProcessors,
                                    Collection<ConnectionDTO> connections) {
        this.feedName = feedName;
        this.isStream = isStream;
        this.feedProcessGroupId = feedProcessGroupId;
        this.processors = processors;
        this.simpleProcessors = simpleProcessors;
        this.connections = connections;

        if ((processors == null || processors.isEmpty()) && simpleProcessors != null) {
            this.processors = simpleProcessors.stream().map(simpleProcessor -> {
                ProcessorDTO dto = new ProcessorDTO();
                dto.setName(simpleProcessor.getName());
                dto.setParentGroupId(simpleProcessor.getParentGroupId());
                dto.setType(simpleProcessor.getType());
                dto.setId(simpleProcessor.getId());
                return dto;
            }).collect(Collectors.toList());
        }
    }

    public String getFeedName() {
        return feedName;
    }

    public void setFeedName(String feedName) {
        this.feedName = feedName;
    }

    public boolean isStream() {
        return isStream;
    }

    public void setStream(boolean stream) {
        isStream = stream;
    }

    public String getFeedProcessGroupId() {
        return feedProcessGroupId;
    }

    public void setFeedProcessGroupId(String feedProcessGroupId) {
        this.feedProcessGroupId = feedProcessGroupId;
    }

    public Collection<ProcessorDTO> getProcessors() {
        return processors;
    }

    public void setProcessors(Collection<ProcessorDTO> processors) {
        this.processors = processors;
    }

    public Collection<ConnectionDTO> getConnections() {
        return connections;
    }

    public void setConnections(Collection<ConnectionDTO> connections) {
        this.connections = connections;
    }

}


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <link rel="shortcut icon" type="image/ico" href="http://www.datatables.net/favicon.ico">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=2.0">

    <title>Editor example - Join tables - working with multiple SQL tables</title>
    <link rel="stylesheet" type="text/css" href="../../../../media/css/jquery.dataTables.css">
    <link rel="stylesheet" type="text/css" href="../../../TableTools/css/dataTables.tableTools.css">
    <link rel="stylesheet" type="text/css" href="../../css/dataTables.editor.css">
    <link rel="stylesheet" type="text/css" href="../../../../examples/resources/syntax/shCore.css">
    <link rel="stylesheet" type="text/css" href="../../../../examples/resources/demo.css">

Editor example Join tables - working with multiple SQL tables

Data in relational databases is often stored over multiple tables, partitioned by the data type and
                then joined together using SQL JOIN queries. Editor makes working with multiple tables super easy
                through its, and DataTables', ability to work with nested Javascript objects. Additional the PHP
                libraries leftJoin() method make working with joins on the server-side just as easy as on
                the client-side - see the PHP join documentation
                for further information on the library options.

This example shows the simplest, but also most common, use case for joined data - a foreign
                reference key, pointing to another record. In this case the users database table has a column
                called site which is a reference to the sites database table. Using the
                leftJoin() PHP method in Editor server-side classes, the returned data structure for each
                row looks like:

{
    "DT_RowId": "row_1",
    "users": {
    "first_name": "Quynn",
    "last_name": "Contreras",
    "phone": "1-971-977-4681",
    "site": "1"
    },
    "sites": {
    "name": "Edinburgh"
    }
    }

To display these fields in DataTables we use the columns.dataDT option to access the
                nested
                data - for example users.first_name (using dotted Javascript object notation).

On create, edit and remove Editor will also update the database accordingly for these actions
                automatically. With Editor, editing joined tables takes seconds to configure saving you a huge amount
                of time.

                First name
                Last name
                Phone #
                Location

                First name
                Last name
                Phone #
                Location

Javascript

HTML

CSS

Ajax

Server-side script

The Javascript shown below is used to initialise the table shown in this
                    example:
var editor; // use a global for the submit and return
                data rendering in the examples

                $(document).ready(function() {
                editor = new $.fn.dataTable.Editor( {
                ajax: "../php/join.php",
                table: "#example",
                fields: [ {
                label: "First name:",
                name: "users.first_name"
                }, {
                label: "Last name:",
                name: "users.last_name"
                }, {
                label: "Phone #:",
                name: "users.phone"
                }, {
                label: "Site:",
                name: "users.site",
                type: "select"
                }
                ]
                } );

                $('#example').dataTable( {
                dom: "Tfrtip",
                ajax: {
                url: "../php/join.php",
                type: 'POST'
                },
                columns: [
                { data: "users.first_name" },
                { data: "users.last_name" },
                { data: "users.phone" },
                { data: "sites.name" }
                ],
                tableTools: {
                sRowSelect: "os",
                aButtons: [
                { sExtends: "editor_create", editor: editor },
                { sExtends: "editor_edit", editor: editor },
                { sExtends: "editor_remove", editor: editor }
                ]
                },
                initComplete: function ( settings, json ) {
                // Populate the site select list with the data available in the
                // database on load
                editor.field( 'users.site' ).update( json.sites );
                }
                } );
                } );

In addition to the above code, the following Javascript library files are loaded for use in this
                    example:

../../../../media/js/jquery.js

../../../../media/js/jquery.dataTables.js

../../../TableTools/js/dataTables.tableTools.js

../../js/dataTables.editor.js

The HTML shown below is the raw HTML table element, before it has been enhanced by
                    DataTables:

This example uses a little bit of additional CSS beyond what is loaded from the library
                        files (below), in order to correctly display the table. The additional CSS used is shown
                        below:

The following CSS library files are loaded for use in this example to provide the styling of the
                    table:

../../../../media/css/jquery.dataTables.css

../../../TableTools/css/dataTables.tableTools.css

../../css/dataTables.editor.css

This table loads data by Ajax. The latest data that has been loaded is shown below. This data
                    will update automatically as any additional data is loaded.

The script used to perform the server-side processing for this table is shown below. Please note
                    that this is just an example script using PHP. Server-side processing scripts can be written in any
                    language, using the protocol described in the
                        DataTables documentation.

Other examples

Simple initialisation

Basic initialisation

Setting defaults

Field types

Dates (with jQuery UI datepicker)

Internationalisation

In table form controls

Responsive table extension

Server-side processing

Join tables - working with multiple SQL
                            tables

Advanced initialisation

Data shown only in the form

Data shown in table only

Complex (nested) JSON data source

REST interface

Ajax override - using localStorage for the data
                            source

Row ID source specification

DOM sourced table

Export buttons

Join tables - self referencing join

Join tables - link table

Join tables - one-to-many join

Bubble editing

Simple bubble editing

Multiple fields in a bubble

Form control and display options

Default control and display
                            options

Bubble editing with in table row
                            controls

Inline editing

Simple inline editing

Tab between columns

Editing options - submit on blur

Inline editing with a submit
                            button

Edit icon

API

Events - unsaved changes close confirmation

Client-side validation

Customised control buttons

Previous / next editing buttons

Duplicate button

Standalone

Simple standalone editing

Bubble editing

Inline editing

Styling

Envelope display controller

Envelope display with in table
                            controls

Styled for stacked inputs

Bootstrap

jQuery UI

Plug-ins

Custom field type plug-ins

Custom display controller

Please refer to the DataTables documentation for full
                    information about its API properties and methods.

                    Additionally, there are a wide range of extras and
                    plug-ins which extend the capabilities of
                    DataTables.

DataTables designed and created by SpryMedia
                    Ltd © 2007-2014

                    DataTables is licensed under the MIT license.


text:
require File.dirname(__FILE__) + '/../test_helper'
require 'blog_controller'

# Re-raise errors caught by the controller.
class BlogController; def rescue_action(e) raise e end; end

class BlogControllerTest < ActionController::TestCase
  def setup
    @controller = BlogController.new
    @request    = ActionController::TestRequest.new
    @response   = ActionController::TestResponse.new
  end

  # Replace this with your real tests.
  def test_truth
    assert true
  end
end