text:
using System;
using System.Collections.Generic;
using Valcon.Rules;

namespace Valcon.Registration.Graph
{
    public class ValidationCall : ValidationNode
    {
        private readonly Accessor _accessor;
        public ValidationCall(Type ruleType, Accessor accessor)
            : base(ruleType)
        {
            if(!typeof(IValidationRule).IsAssignableFrom(ruleType))
            {
                throw new ArgumentException("Invalid rule type specified", "ruleType");
            }

            _accessor = accessor;
        }

        public Accessor Accessor
        {
            get { return _accessor; }
        }

        public override RuleDef ToRuleDef()
        {
            return new RuleDef
                       {
                           Name = DetermineRuleName(),
                           Type = DetermineRuleType(),
                           Dependencies = new List<ValueDependency>
                                              {
                                                  new ValueDependency
                                                      {
                                                          DependencyType = typeof(Accessor),
                                                          Value = Accessor
                                                      }
                                              }
                       };
        }

        protected virtual string DetermineRuleName()
        {
            var ruleName = DetermineRuleType().Name;
            if(!ruleName.Contains("ValidationRule"))
            {
                return ruleName;
            }

            return ruleName.Substring(0, ruleName.IndexOf("ValidationRule"));
        }

        protected virtual Type DetermineRuleType()
        {
            if (RuleType.IsGenericTypeDefinition)
            {
                return RuleType.MakeGenericType(Accessor.ModelType);
            }

            return RuleType;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj)) return false;
            if (ReferenceEquals(this, obj)) return true;
            if (obj.GetType() != typeof (ValidationCall)) return false;
            return Equals((ValidationCall) obj);
        }

        public bool Equals(ValidationCall other)
        {
            if (ReferenceEquals(null, other)) return false;
            if (ReferenceEquals(this, other)) return true;
            return Equals(other.RuleType, RuleType) && Equals(other._accessor, _accessor);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return ((RuleType != null ? RuleType.GetHashCode() : 0) * 397) ^ (_accessor != null ? _accessor.GetHashCode() : 0);
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
#include "ServerThread.hpp"

#include "Logger.hpp"
#include "Tools/Exception.hpp"
#include "HTTPRequest.hpp"

proZPRd::ServerThread::ServerThread(const unsigned int ThisThreadId, const volatile bool * ShouldExit, const HTTPRequestProcessor & HRP, std::queue<TCPSocketServer::NewClientPtr_t> & NewClientsQueue, std::mutex & NewClientsQueueMutex, std::condition_variable & NewClientsNewData):
	ThisThreadId(ThisThreadId), ShouldExit(ShouldExit), HRP(HRP),
	NewClientsQueue(NewClientsQueue), NewClientsQueueMutex(NewClientsQueueMutex), NewClientsNewData(NewClientsNewData),
	MainThread(&proZPRd::ServerThread::Main, this)
{
	Logger::Info("Thread #" + std::to_string(ThisThreadId) + " starting");
}
proZPRd::ServerThread::~ServerThread()
{
	Logger::Info("Thread #" + std::to_string(ThisThreadId) + " waiting for finish");
	MainThread.join();
	Logger::Info("Thread #" + std::to_string(ThisThreadId) + " finished");
}
void proZPRd::ServerThread::Main()
{
	while(!*ShouldExit)
	{
		std::unique_lock<std::mutex> NewClientsQueueLock(NewClientsQueueMutex);

			/**
				Jeśli kolejka jest pusta, to uruchamiamy oczekiwanie na zmiennej warunkowej
			*/
			if(NewClientsQueue.size() == 0)
				NewClientsNewData.wait(NewClientsQueueLock);

			/**
				W tym miejscu spędziłem bite 4 godziny.
				Jak się okazuje, wątek może obudzić się również "samodzielnie" - linia wyżej odblokowywała wątek, przechodziła niżej, pobierała wskaźnik i kończyliśmy z segmentation fault.
				Super cool.
			*/
			if(NewClientsQueue.size() == 0)
				continue;

			/**
				Wyciągamy Socket z kolejki
			*/
			std::unique_ptr<TCPSocketClient> ThisClient = std::move(NewClientsQueue.front()); NewClientsQueue.pop();

		NewClientsQueueLock.unlock();

		/**
			Bufor który będzie przyjmował do siebie przychodzące dane
		*/
		static const unsigned int InputBufferSize = 1024;
		char InputBuffer[InputBufferSize];
		std::string Request;

		while(true)
		{
			std::size_t InputLength = 0;

			try
			{
				InputLength = ThisClient->Read(InputBuffer, InputBufferSize);
			}
			catch(...) { break; }

			Request.append(InputBuffer, InputLength);

			/**
				Sprawdzamy, czy dostaliśmy już wszystkie potrzebne dane, jeśli nie - zbieramy dane dalej.
			*/
			try
			{
				HTTPRequest HR = HTTPRequest::TryParse(Request); ///To może rzucić wyjątek, że jeszcze nie gotowe
				Logger::Info("Thread #" + std::to_string(ThisThreadId) + ", client: " + ThisClient->GetRemoteIpPortStr() + " requested: " + HR.GetURL() + " from: " + HR.GetHost());
				HTTPResponse::HTTPResponsePtr Response = HRP.Process(HR);
				std::string ResponeStr = Response->CreateResponse();
				ThisClient->Write(ResponeStr.c_str(), ResponeStr.length());
				break;
			}
			catch(HTTPRequest::HTTPRequestNotComplete &) {}
			catch(std::exception & E) { Logger::Error("Thread #" + std::to_string(ThisThreadId) + ": " + E.what()); break; }
		}
	}
}


text:
<title>dlib C++ Library - structural_svm_problem_threaded.h</title>

// Copyright (C) 2011  Davis E. King (davis@dlib.net)
// License: Boost Software License   See LICENSE.txt for the full license.
#ifndef DLIB_STRUCTURAL_SVM_PRObLEM_THREADED_Hh_
#define DLIB_STRUCTURAL_SVM_PRObLEM_THREADED_Hh_

#include "structural_svm_problem_threaded_abstract.h"
#include "../algs.h"
#include <vector>
#include "structural_svm_problem.h"
#include "../matrix.h"
#include "sparse_vector.h"
#include <iostream>
#include "../threads.h"
#include "../misc_api.h"
#include "../statistics.h"

namespace dlib
{

// ----------------------------------------------------------------------------------------

    template <
        typename matrix_type_,
        typename feature_vector_type_ = matrix_type_
        >
    class structural_svm_problem_threaded : public structural_svm_problem<matrix_type_,feature_vector_type_>
    {
    public:

        typedef matrix_type_ matrix_type;
        typedef typename matrix_type::type scalar_type;
        typedef feature_vector_type_ feature_vector_type;

        explicit structural_svm_problem_threaded (
            unsigned long num_threads
        ) :
            tp(num_threads),
            num_iterations_executed(0)
        {}

        unsigned long get_num_threads (
        ) const { return tp.num_threads_in_pool(); }

    private:

        struct binder
        {
            binder (
                const structural_svm_problem_threaded& self_,
                const matrix_type& w_,
                matrix_type& subgradient_,
                scalar_type& total_loss_,
                bool buffer_subgradients_locally_
            ) : self(self_), w(w_), subgradient(subgradient_), total_loss(total_loss_),
                buffer_subgradients_locally(buffer_subgradients_locally_){}

            void call_oracle (
                long begin,
                long end
            )
            {
                // If we are only going to call the separation oracle once then don't run
                // the slightly more complex for loop version of this code.  Or if we just
                // don't want to run the complex buffering one.  The code later on decides
                // if we should do the buffering based on how long it takes to execute.  We
                // do this because, when the subgradient is really high dimensional it can
                // take a lot of time to add them together.  So we might want to avoid
                // doing that.
                if (end-begin <= 1 || !buffer_subgradients_locally)
                {
                    scalar_type loss;
                    feature_vector_type ftemp;
                    for (long i = begin; i < end; ++i)
                    {
                        self.separation_oracle_cached(i, w, loss, ftemp);

                        auto_mutex lock(self.accum_mutex);
                        total_loss += loss;
                        add_to(subgradient, ftemp);
                    }
                }
                else
                {
                    scalar_type loss = 0;
                    matrix_type faccum(subgradient.size(),1);
                    faccum = 0;

                    feature_vector_type ftemp;

                    for (long i = begin; i < end; ++i)
                    {
                        scalar_type loss_temp;
                        self.separation_oracle_cached(i, w, loss_temp, ftemp);
                        loss += loss_temp;
                        add_to(faccum, ftemp);
                    }

                    auto_mutex lock(self.accum_mutex);
                    total_loss += loss;
                    add_to(subgradient, faccum);
                }
            }

            const structural_svm_problem_threaded& self;
            const matrix_type& w;
            matrix_type& subgradient;
            scalar_type& total_loss;
            bool buffer_subgradients_locally;
        };

        virtual void call_separation_oracle_on_all_samples (
            const matrix_type& w,
            matrix_type& subgradient,
            scalar_type& total_loss
        ) const
        {
            ++num_iterations_executed;

            const uint64 start_time = ts.get_timestamp();

            bool buffer_subgradients_locally = with_buffer_time.mean() < without_buffer_time.mean();

            // every 50 iterations we should try to flip the buffering scheme to see if
            // doing it the other way might be better.
            if ((num_iterations_executed%50) == 0)
            {
                buffer_subgradients_locally = !buffer_subgradients_locally;
            }

            binder b(*this, w, subgradient, total_loss, buffer_subgradients_locally);
            parallel_for_blocked(tp, 0, this->get_num_samples(), b, &binder::call_oracle);

            const uint64 stop_time = ts.get_timestamp();

            if (buffer_subgradients_locally)
                with_buffer_time.add(stop_time-start_time);
            else
                without_buffer_time.add(stop_time-start_time);

        }

        mutable thread_pool tp;
        mutable mutex accum_mutex;
        mutable timestamper ts;
        mutable running_stats<double> with_buffer_time;
        mutable running_stats<double> without_buffer_time;
        mutable unsigned long num_iterations_executed;
    };

// ----------------------------------------------------------------------------------------

}

#endif // DLIB_STRUCTURAL_SVM_PRObLEM_THREADED_Hh_


text:
export async function generateBuildId(
  generate: () => string | null,
  fallback: () => string
): Promise<string> {
  let buildId = await generate()
  // If there's no buildId defined we'll fall back
  if (buildId === null) {
    // We also create a new buildId if it contains the word `ad` to avoid false
    // positives with ad blockers
    while (!buildId || /ad/i.test(buildId)) {
      buildId = fallback()
    }
  }

  if (typeof buildId !== 'string') {
    throw new Error(
      'generateBuildId did not return a string. https://err.sh/zeit/next.js/generatebuildid-not-a-string'
    )
  }

  return buildId.trim()
}


text:
'use strict';

var should = require('should');

var util = require('util');
var fs = require('fs');
var path = require('path');
var profile = require('../../../../lib/util/profile');
var CLITest = require('../../../framework/arm-cli-test');
var testUtil = require('../../../util/util');

var requiredEnvironment = [
  { requiresToken: true },
  { name: 'AZURE_ARM_TEST_LOCATION', defaultValue: 'West US' }
];

var testprefix = 'arm-cli-deployment-tests';
var galleryTemplateName;
var galleryTemplateUrl;
var createdGroups = [];
var createdDeployments = [];
var cleanedUpGroups = 0;

describe('arm', function () {
  describe('deployment', function () {
    var suite;
    var testLocation;
    var normalizedTestLocation;

    before(function (done) {
      suite = new CLITest(testprefix, requiredEnvironment);
      suite.setupSuite(done);
    });

    after(function (done) {
      suite.teardownSuite(done);
    });

    beforeEach(function (done) {
      suite.setupTest(function () {
        testLocation = process.env['AZURE_ARM_TEST_LOCATION'];
        normalizedTestLocation = testLocation.toLowerCase().replace(/ /g, '');
        testUtil.getTemplateInfo(suite, 'Microsoft.ASPNETStarterSite', function(error, templateInfo) {
          if (error) {
            return done(new Error('Could not get template info: ' + error));
          }
          galleryTemplateName = templateInfo.templateName;
          galleryTemplateUrl = templateInfo.templateUrl;
          done();
        });
      });
    });

    afterEach(function (done) {
      suite.teardownTest(done);
    });

    function cleanup(done) {
      function deleteGroups(index, callback) {
        if (index === createdGroups.length) {
          return callback();
        }
        suite.execute('group delete %s --quiet -vv', createdGroups[index], function () {
          deleteGroups(index + 1, callback);
        });
      }

      deleteGroups(cleanedUpGroups, function () {
        cleanedUpGroups = createdGroups.length;
        done();
      });
    }

    describe('list and show', function () {
      it('should all work with switches', function (done) {
        var deploymentState = 'Accepted';
        var parameterFile = path.join(__dirname, '../../../data/arm-deployment-parameters.json');
        var groupName = suite.generateId('xDeploymentTestGroup', createdGroups, suite.isMocked);
        var deploymentName = suite.generateId('Deploy1', createdDeployments, suite.isMocked);
        var templateFile = 'https://testtemplates.blob.core.windows.net/templates/good-website.js';
        var commandToCreateDeployment = util.format('group deployment create -f %s -g %s -n %s -e %s --json -vv',
            templateFile, groupName, deploymentName, parameterFile);

        suite.execute('group create %s --location %s --json', groupName, testLocation, function (result) {
          result.exitStatus.should.equal(0);
          suite.execute(commandToCreateDeployment, function (result) {
            result.exitStatus.should.equal(0);

            suite.execute('group deployment show -g %s -n %s --json', groupName, deploymentName, function (showResult) {
              showResult.exitStatus.should.equal(0);
              showResult.text.indexOf(deploymentName).should.be.above(-1);

              suite.execute('group deployment list -g %s --state %s --json', groupName, deploymentState, function (listResult) {
                listResult.exitStatus.should.equal(0);
                listResult.text.indexOf(deploymentName).should.be.above(-1);
                cleanup(done);
              });
            });
          });
        });
      });

      it('should all work without switches', function (done) {
        var deploymentState = 'Accepted';
        var parameterFile = path.join(__dirname, '../../../data/arm-deployment-parameters.json');
        var groupName = suite.generateId('xDeploymentTestGroup', createdGroups, suite.isMocked);
        var deploymentName = suite.generateId('Deploy1', createdDeployments, suite.isMocked);
        var templateFile = 'https://testtemplates.blob.core.windows.net/templates/good-website.js';
        var commandToCreateDeployment = util.format('group deployment create -f %s -g %s -n %s -e %s --json -vv',
            templateFile, groupName, deploymentName, parameterFile);

        suite.execute('group create %s --location %s --json', groupName, testLocation, function (result) {
          result.exitStatus.should.equal(0);
          suite.execute(commandToCreateDeployment, function (result) {
            result.exitStatus.should.equal(0);

            suite.execute('group deployment show %s %s --json', groupName, deploymentName, function (showResult) {
              showResult.exitStatus.should.equal(0);
              showResult.text.indexOf(deploymentName).should.be.above(-1);

              suite.execute('group deployment list %s %s --json', groupName, deploymentState, function (listResult) {
                listResult.exitStatus.should.equal(0);
                listResult.text.indexOf(deploymentName).should.be.above(-1);
                cleanup(done);
              });
            });
          });
        });
      });
    });

    describe('stop', function () {
      it('should work', function (done) {
        var parameterFile = path.join(__dirname, '../../../data/startersite-parameters.json');
        var groupName = suite.generateId('xDeploymentTestGroup', createdGroups, suite.isMocked);
        var deploymentName = suite.generateId('Deploy1', createdDeployments, suite.isMocked);
        var commandToCreateDeployment = util.format('group deployment create -f %s -g %s -n %s -e %s --json -vv',
            galleryTemplateUrl, groupName, deploymentName, parameterFile);

        suite.execute('group create %s %s --json', groupName, testLocation, function (result) {
          result.exitStatus.should.equal(0);
          suite.execute(commandToCreateDeployment, function (result) {
            result.exitStatus.should.equal(0);

            suite.execute('group deployment stop -g %s -n %s -q --json', groupName, deploymentName, function (listResult) {
              listResult.exitStatus.should.equal(0);

              cleanup(done);
            });
          });
        });
      });

      it('should stop the currently running deployment when deployment name is not provided and only 1 deployment is currently running', function (done) {
        var parameterFile = path.join(__dirname, '../../../data/startersite-parameters.json');
        var groupName = suite.generateId('xDeploymentTestGroup', createdGroups, suite.isMocked);
        var deploymentName = suite.generateId('Deploy1', createdDeployments, suite.isMocked);
        var commandToCreateDeployment = util.format('group deployment create -f %s -g %s -n %s -e %s --json -vv',
            galleryTemplateUrl, groupName, deploymentName, parameterFile);

        suite.execute('group create %s --location %s --json', groupName, testLocation, function (result) {
          result.exitStatus.should.equal(0);
          suite.execute(commandToCreateDeployment, function (result) {
            result.exitStatus.should.equal(0);

            suite.execute('group deployment stop -g %s -q --json', groupName, function (listResult) {
              listResult.exitStatus.should.equal(0);

              cleanup(done);
            });
          });
        });
      });

      it('should fail when the deployment name is not provided and more than 1 deployment is currently running', function (done) {
        var parameterFile = path.join(__dirname, '../../../data/startersite-parameters.json');
        var groupName = suite.generateId('xDeploymentTestGroup', createdGroups, suite.isMocked);
        var deploymentName = suite.generateId('Deploy1', createdDeployments, suite.isMocked);
        var deploymentName1 = suite.generateId('Deploy2', createdDeployments, suite.isMocked);
        var commandToCreateDeployment = util.format('group deployment create -f %s -g %s -n %s -e %s --json -vv',
            galleryTemplateUrl, groupName, deploymentName, parameterFile);

        suite.execute('group create %s --location %s --json', groupName, testLocation, function (result) {
          result.exitStatus.should.equal(0);
          suite.execute(commandToCreateDeployment, function (result) {
            result.exitStatus.should.equal(0);
            suite.execute('group deployment create -f %s -g %s -n %s -e %s --json -vv', galleryTemplateUrl, groupName, deploymentName1, parameterFile, function (result2) {
              result2.exitStatus.should.equal(0);
              suite.execute('group deployment stop -g %s -q --json', groupName, function (listResult) {
                listResult.exitStatus.should.equal(1);
                listResult.errorText.should.include('There are more than 1 deployment in either "Running" or "Accepted" state, please name one.');
                cleanup(done);
              });
            });
          });
        });
      });
    });

    describe('create', function () {
      it('should work with a remote file', function (done) {
        var parameterFile = path.join(__dirname, '../../../data/startersite-parameters.json');
        var groupName = suite.generateId('xDeploymentTestGroup', createdGroups, suite.isMocked);
        var deploymentName = suite.generateId('Deploy1', createdDeployments, suite.isMocked);
        var commandToCreateDeployment = util.format('group deployment create -f %s -g %s -n %s -e %s --json -vv',
            galleryTemplateUrl, groupName, deploymentName, parameterFile);

        suite.execute('group create %s --location %s --json', groupName, testLocation, function (result) {
          result.exitStatus.should.equal(0);
          suite.execute(commandToCreateDeployment, function (result) {
            result.exitStatus.should.equal(0);

            suite.execute('group deployment stop -g %s -n %s -q --json', groupName, deploymentName, function (listResult) {
              listResult.exitStatus.should.equal(0);

              cleanup(done);
            });
          });
        });
      });

      it('should all work with a local file', function (done) {
        var parameterFile = path.join(__dirname, '../../../data/arm-deployment-parameters.json');
        var groupName = suite.generateId('xDeploymentTestGroup', createdGroups, suite.isMocked);
        var deploymentName = suite.generateId('Deploy1', createdDeployments, suite.isMocked);
        var templateFile = path.join(__dirname, '../../../data/arm-deployment-template.json');
        var commandToCreateDeployment = util.format('group deployment create -f %s -g %s -n %s -e %s --json -vv',
            templateFile, groupName, deploymentName, parameterFile);

        suite.execute('group create %s --location %s --json', groupName, testLocation, function (result) {
          result.exitStatus.should.equal(0);
          suite.execute(commandToCreateDeployment, function (result) {
            result.exitStatus.should.equal(0);

            suite.execute('group deployment show -g %s -n %s --json', groupName, deploymentName, function (showResult) {
              showResult.exitStatus.should.equal(0);
              showResult.text.indexOf(deploymentName).should.be.above(-1);

              suite.execute('group deployment list -g %s --json', groupName, function (listResult) {
                listResult.exitStatus.should.equal(0);
                listResult.text.indexOf(deploymentName).should.be.above(-1);
                cleanup(done);
              });
            });
          });
        });
      });

      it('should all work with a string for parameters', function (done) {
        var parameters = fs.readFileSync(path.join(__dirname, '../../../data/arm-deployment-parameters.json')).toString().replace(/\n/g, '').replace(/\r/g, '');
        var groupName = suite.generateId('xDeploymentTestGroup', createdGroups, suite.isMocked);
        var deploymentName = suite.generateId('Deploy1', createdDeployments, suite.isMocked);
        var templateFile = path.join(__dirname, '../../../data/arm-deployment-template.json');

        parameters = JSON.stringify(JSON.parse(parameters));

        suite.execute('group create %s --location %s --json', groupName, testLocation, function (result) {
          result.exitStatus.should.equal(0);
          suite.execute('group deployment create -f %s -g %s -n %s -p %s --json -vv',
            templateFile, groupName, deploymentName, parameters, function (result) {
            result.exitStatus.should.equal(0);

            suite.execute('group deployment show -g %s -n %s --json', groupName, deploymentName, function (showResult) {
              showResult.exitStatus.should.equal(0);
              showResult.text.indexOf(deploymentName).should.be.above(-1);

              suite.execute('group deployment list -g %s --json', groupName, function (listResult) {
                listResult.exitStatus.should.equal(0);
                listResult.text.indexOf(deploymentName).should.be.above(-1);
                cleanup(done);
              });
            });
          });
        });
      });

      it('should all work with a gallery template and a string for parameters', function (done) {
        var parameters = fs.readFileSync(path.join(__dirname, '../../../data/startersite-parameters.json')).toString().replace(/\n/g, '').replace(/\r/g, '');
        var groupName = suite.generateId('xDeploymentTestGroup', createdGroups, suite.isMocked);
        var deploymentName = suite.generateId('Deploy1', createdDeployments, suite.isMocked);

        suite.execute('group create %s --location %s --json', groupName, testLocation, function (result) {
          result.exitStatus.should.equal(0);
          suite.execute('group deployment create -y %s -g %s -n %s -p %s --json -vv',
            galleryTemplateName, groupName, deploymentName, parameters, function (result) {
            result.exitStatus.should.equal(0);

            suite.execute('group deployment show -g %s -n %s --json', groupName, deploymentName, function (showResult) {
              showResult.exitStatus.should.equal(0);
              showResult.text.indexOf(deploymentName).should.be.above(-1);

              suite.execute('group deployment list -g %s --json', groupName, function (listResult) {
                listResult.exitStatus.should.equal(0);
                listResult.text.indexOf(deploymentName).should.be.above(-1);
                cleanup(done);
              });
            });
          });
        });
      });

      it('should fail when both gallery template and file template are provided', function (done) {
        var parameterFile = path.join(__dirname, '../../../data/arm-deployment-parameters.json');
        var groupName = suite.generateId('xDeploymentTestGroup', createdGroups, suite.isMocked);
        var deploymentName = suite.generateId('Deploy1', createdDeployments, suite.isMocked);
        var templateFile = path.join(__dirname, '../../../data/arm-deployment-template.json');
        var commandToCreateDeployment = util.format('group deployment create -f %s -y %s -g %s -n %s -e %s --json',
            templateFile, galleryTemplateName, groupName, deploymentName, parameterFile);

        suite.execute('group create %s --location %s --json', groupName, testLocation, function (result) {
          result.exitStatus.should.equal(0);
          suite.execute(commandToCreateDeployment, function (result) {
            result.exitStatus.should.equal(1);
            result.errorText.should.include('Specify exactly one of the --gallery-template, --template-file, or template-uri options.');
            cleanup(done);
          });
        });
      });

      it('should fail when an incorrect gallery template is provided', function (done) {
        var parameterFile = path.join(__dirname, '../../../data/arm-deployment-parameters.json');
        var groupName = suite.generateId('xDeploymentTestGroup', createdGroups, suite.isMocked);
        var deploymentName = suite.generateId('Deploy1', createdDeployments, suite.isMocked);
        var galleryTemplate = 'Microsoft.ASPNETStarterSite.0.1.0-preview101ABC';
        var commandToCreateDeployment = util.format('group deployment create -y %s -g %s -n %s -e %s --json',
            galleryTemplate, groupName, deploymentName, parameterFile);

        suite.execute('group create %s --location %s --json', groupName, testLocation, function (result) {
          result.exitStatus.should.equal(0);
          suite.execute(commandToCreateDeployment, function (result) {
            result.exitStatus.should.equal(1);
            result.errorText.should.include('Gallery item \'Microsoft.ASPNETStarterSite.0.1.0-preview101ABC\' was not found.');
            cleanup(done);
          });
        });
      });

      it('should fail when a parameter is missing for a deployment template', function (done) {
        var parameterString = "{ \"siteName\":{\"value\":\"xDeploymentTestSite1\"}, \"hostingPlanName\":{ \"value\":\"xDeploymentTestHost1\" }, \"sku\":{ \"value\":\"Free\" }, \"workerSize\":{ \"value\":\"0\" }}";
        var groupName = suite.generateId('xDeploymentTestGroup', createdGroups, suite.isMocked);
        var deploymentName = suite.generateId('Deploy1', createdDeployments, suite.isMocked);

        suite.execute('group create %s --location %s --json', groupName, testLocation, function (result) {
          result.exitStatus.should.equal(0);
          suite.execute('group deployment create -y %s -g %s -n %s -p %s --json', galleryTemplateName, groupName, deploymentName, parameterString, function (result) {
            result.exitStatus.should.equal(1);
            result.errorText.should.include('Deployment template validation failed: \'The value for the template parameter \'siteLocation\' is not provided.\'.');
            cleanup(done);
          });
        });
      });
    });
  });
});


text:
Secure Banking System

## Guidelines
* Do not add anything to master branch directly.
* Create your own branch and use that for your tasks any when you feel good to go to master create a pull request
* To start working with this repo do a clone into the directory you want using `git clone https://github.com/chasethenag420/sbs.git`
* To Create branch you can do something like `git checkout -b YOUR_BRANCH_NAME`
* To add files to repo `git add --all` to push all the modifed files else specify the file name
* To commit the files to repo use `git commit` and fill the description about what this commit is for be as clear as possible
* To Push the code to your branch you can use `git push origin YOUR_BRANCH_NAME`
* To pull latest code to your branch you can use `git pull origin YOUR_BRANCH_NAME`
* Do pull request to master branch but do not merge on your own others will review and merge it.

## Installtion Instructions

* Install jdk7
* Install tomcat8
* Install mysql5.5
* Make sure to install Eclipse Java EE IDE for Web Developers.
* Install maven  you can follow steps here MAVEN http://www.mkyong.com/maven/how-to-install-maven-in-windows/
* Import the cloned project into eclipse as maven project
* Configure tomcat8 directory(eclipse properties -> targeted runttime -> add new) and JDK7(eclipse properties -> compiler) with eclipse
* Do Maven clean from Eclipse -> Run As -> Maven clean
* Do Maven install
* To understand more check out http://www.beingjavaguys.com/2013/08/spring-maven-web-application-in-eclipse.html
* (optional if setup using eclipse) Can create maven project from eclipse or else using below steps and integrate with eclipse
	a. create project structure using maven below command
		mvn archetype:generate -DgroupId=com.chasethenag420.maven -DartifactId=SimpleSpringMaven -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false
	b. to integrate with eclipse run below command inside the project dir SimpleSpringMaven
		mvn eclipse:eclipse -Dwtpversion=2.0


text:
package hu.klayton.wade.sm.service;

import hu.klayton.wade.sm.dto.WareHouseDTO;

import java.util.List;

/**
 * @author Walter Krix <wkrix89@gmail.hu>
 */
public interface WareHouseService {
    List<WareHouseDTO> findAll();

    void save(WareHouseDTO wareHouseDTO);

    void delete(Long id);

    WareHouseDTO findOne(Long id);
}


text:
from __future__ import absolute_import, division, print_function
__metaclass__ = type

ANSIBLE_METADATA = {'status': ['preview'],
                    'supported_by': 'community',
                    'metadata_version': '1.1'}

DOCUMENTATION = '''
---
module: fmgr_secprof_spam
version_added: "2.8"
notes:
    - Full Documentation at U(https://ftnt-ansible-docs.readthedocs.io/en/latest/).
author:
    - Luke Weighall (@lweighall)
    - Andrew Welsh (@Ghilli3)
    - Jim Huber (@p4r4n0y1ng)
short_description: spam filter profile for FMG
description:
  -  Manage spam filter security profiles within FortiManager via API

options:
  adom:
    description:
      - The ADOM the configuration should belong to.
    required: false
    default: root

  mode:
    description:
      - Sets one of three modes for managing the object.
      - Allows use of soft-adds instead of overwriting existing values
    choices: ['add', 'set', 'delete', 'update']
    required: false
    default: add

  spam_rbl_table:
    description:
      - Anti-spam DNSBL table ID.
    required: false

  spam_mheader_table:
    description:
      - Anti-spam MIME header table ID.
    required: false

  spam_log_fortiguard_response:
    description:
      - Enable/disable logging FortiGuard spam response.
    required: false
    choices:
      - disable
      - enable

  spam_log:
    description:
      - Enable/disable spam logging for email filtering.
    required: false
    choices:
      - disable
      - enable

  spam_iptrust_table:
    description:
      - Anti-spam IP trust table ID.
    required: false

  spam_filtering:
    description:
      - Enable/disable spam filtering.
    required: false
    choices:
      - disable
      - enable

  spam_bword_threshold:
    description:
      - Spam banned word threshold.
    required: false

  spam_bword_table:
    description:
      - Anti-spam banned word table ID.
    required: false

  spam_bwl_table:
    description:
      - Anti-spam black/white list table ID.
    required: false

  replacemsg_group:
    description:
      - Replacement message group.
    required: false

  options:
    description:
      - None
      - FLAG Based Options. Specify multiple in list form.
    required: false
    choices:
      - bannedword
      - spamfsip
      - spamfssubmit
      - spamfschksum
      - spamfsurl
      - spamhelodns
      - spamraddrdns
      - spamrbl
      - spamhdrcheck
      - spamfsphish
      - spambwl

  name:
    description:
      - Profile name.
    required: false

  flow_based:
    description:
      - Enable/disable flow-based spam filtering.
    required: false
    choices:
      - disable
      - enable

  external:
    description:
      - Enable/disable external Email inspection.
    required: false
    choices:
      - disable
      - enable

  comment:
    description:
      - Comment.
    required: false

  gmail:
    description:
      - EXPERTS ONLY! KNOWLEDGE OF FMGR JSON API IS REQUIRED!
      - List of multiple child objects to be added. Expects a list of dictionaries.
      - Dictionaries must use FortiManager API parameters, not the ansible ones listed below.
      - If submitted, all other prefixed sub-parameters ARE IGNORED.
      - This object is MUTUALLY EXCLUSIVE with its options.
      - We expect that you know what you are doing with these list parameters, and are leveraging the JSON API Guide.
      - WHEN IN DOUBT, USE THE SUB OPTIONS BELOW INSTEAD TO CREATE OBJECTS WITH MULTIPLE TASKS
    required: false

  gmail_log:
    description:
      - Enable/disable logging.
    required: false
    choices:
      - disable
      - enable

  imap:
    description:
      - EXPERTS ONLY! KNOWLEDGE OF FMGR JSON API IS REQUIRED!
      - List of multiple child objects to be added. Expects a list of dictionaries.
      - Dictionaries must use FortiManager API parameters, not the ansible ones listed below.
      - If submitted, all other prefixed sub-parameters ARE IGNORED.
      - This object is MUTUALLY EXCLUSIVE with its options.
      - We expect that you know what you are doing with these list parameters, and are leveraging the JSON API Guide.
      - WHEN IN DOUBT, USE THE SUB OPTIONS BELOW INSTEAD TO CREATE OBJECTS WITH MULTIPLE TASKS
    required: false

  imap_action:
    description:
      - Action for spam email.
    required: false
    choices:
      - pass
      - tag

  imap_log:
    description:
      - Enable/disable logging.
    required: false
    choices:
      - disable
      - enable

  imap_tag_msg:
    description:
      - Subject text or header added to spam email.
    required: false

  imap_tag_type:
    description:
      - Tag subject or header for spam email.
      - FLAG Based Options. Specify multiple in list form.
    required: false
    choices:
      - subject
      - header
      - spaminfo

  mapi:
    description:
      - EXPERTS ONLY! KNOWLEDGE OF FMGR JSON API IS REQUIRED!
      - List of multiple child objects to be added. Expects a list of dictionaries.
      - Dictionaries must use FortiManager API parameters, not the ansible ones listed below.
      - If submitted, all other prefixed sub-parameters ARE IGNORED.
      - This object is MUTUALLY EXCLUSIVE with its options.
      - We expect that you know what you are doing with these list parameters, and are leveraging the JSON API Guide.
      - WHEN IN DOUBT, USE THE SUB OPTIONS BELOW INSTEAD TO CREATE OBJECTS WITH MULTIPLE TASKS
    required: false

  mapi_action:
    description:
      - Action for spam email.
    required: false
    choices:
      - pass
      - discard

  mapi_log:
    description:
      - Enable/disable logging.
    required: false
    choices:
      - disable
      - enable

  msn_hotmail:
    description:
      - EXPERTS ONLY! KNOWLEDGE OF FMGR JSON API IS REQUIRED!
      - List of multiple child objects to be added. Expects a list of dictionaries.
      - Dictionaries must use FortiManager API parameters, not the ansible ones listed below.
      - If submitted, all other prefixed sub-parameters ARE IGNORED.
      - This object is MUTUALLY EXCLUSIVE with its options.
      - We expect that you know what you are doing with these list parameters, and are leveraging the JSON API Guide.
      - WHEN IN DOUBT, USE THE SUB OPTIONS BELOW INSTEAD TO CREATE OBJECTS WITH MULTIPLE TASKS
    required: false

  msn_hotmail_log:
    description:
      - Enable/disable logging.
    required: false
    choices:
      - disable
      - enable

  pop3:
    description:
      - EXPERTS ONLY! KNOWLEDGE OF FMGR JSON API IS REQUIRED!
      - List of multiple child objects to be added. Expects a list of dictionaries.
      - Dictionaries must use FortiManager API parameters, not the ansible ones listed below.
      - If submitted, all other prefixed sub-parameters ARE IGNORED.
      - This object is MUTUALLY EXCLUSIVE with its options.
      - We expect that you know what you are doing with these list parameters, and are leveraging the JSON API Guide.
      - WHEN IN DOUBT, USE THE SUB OPTIONS BELOW INSTEAD TO CREATE OBJECTS WITH MULTIPLE TASKS
    required: false

  pop3_action:
    description:
      - Action for spam email.
    required: false
    choices:
      - pass
      - tag

  pop3_log:
    description:
      - Enable/disable logging.
    required: false
    choices:
      - disable
      - enable

  pop3_tag_msg:
    description:
      - Subject text or header added to spam email.
    required: false

  pop3_tag_type:
    description:
      - Tag subject or header for spam email.
      - FLAG Based Options. Specify multiple in list form.
    required: false
    choices:
      - subject
      - header
      - spaminfo

  smtp:
    description:
      - EXPERTS ONLY! KNOWLEDGE OF FMGR JSON API IS REQUIRED!
      - List of multiple child objects to be added. Expects a list of dictionaries.
      - Dictionaries must use FortiManager API parameters, not the ansible ones listed below.
      - If submitted, all other prefixed sub-parameters ARE IGNORED.
      - This object is MUTUALLY EXCLUSIVE with its options.
      - We expect that you know what you are doing with these list parameters, and are leveraging the JSON API Guide.
      - WHEN IN DOUBT, USE THE SUB OPTIONS BELOW INSTEAD TO CREATE OBJECTS WITH MULTIPLE TASKS
    required: false

  smtp_action:
    description:
      - Action for spam email.
    required: false
    choices:
      - pass
      - tag
      - discard

  smtp_hdrip:
    description:
      - Enable/disable SMTP email header IP checks for spamfsip, spamrbl and spambwl filters.
    required: false
    choices:
      - disable
      - enable

  smtp_local_override:
    description:
      - Enable/disable local filter to override SMTP remote check result.
    required: false
    choices:
      - disable
      - enable

  smtp_log:
    description:
      - Enable/disable logging.
    required: false
    choices:
      - disable
      - enable

  smtp_tag_msg:
    description:
      - Subject text or header added to spam email.
    required: false

  smtp_tag_type:
    description:
      - Tag subject or header for spam email.
      - FLAG Based Options. Specify multiple in list form.
    required: false
    choices:
      - subject
      - header
      - spaminfo

  yahoo_mail:
    description:
      - EXPERTS ONLY! KNOWLEDGE OF FMGR JSON API IS REQUIRED!
      - List of multiple child objects to be added. Expects a list of dictionaries.
      - Dictionaries must use FortiManager API parameters, not the ansible ones listed below.
      - If submitted, all other prefixed sub-parameters ARE IGNORED.
      - This object is MUTUALLY EXCLUSIVE with its options.
      - We expect that you know what you are doing with these list parameters, and are leveraging the JSON API Guide.
      - WHEN IN DOUBT, USE THE SUB OPTIONS BELOW INSTEAD TO CREATE OBJECTS WITH MULTIPLE TASKS
    required: false

  yahoo_mail_log:
    description:
      - Enable/disable logging.
    required: false
    choices:
      - disable
      - enable
'''

EXAMPLES = '''
  - name: DELETE Profile
    fmgr_secprof_spam:
      name: "Ansible_Spam_Filter_Profile"
      mode: "delete"

  - name: Create FMGR_SPAMFILTER_PROFILE
    fmgr_secprof_spam:
      host: "{{ inventory_hostname }}"
      username: "{{ username }}"
      password: "{{ password }}"
      mode: "set"
      adom: "root"
      spam_log_fortiguard_response: "enable"
      spam_iptrust_table:
      spam_filtering: "enable"
      spam_bword_threshold: 10
      options: ["bannedword", "spamfsip", "spamfsurl", "spamrbl", "spamfsphish", "spambwl"]
      name: "Ansible_Spam_Filter_Profile"
      flow_based: "enable"
      external: "enable"
      comment: "Created by Ansible"
      gmail_log: "enable"
      spam_log: "enable"
'''

RETURN = """
api_result:
  description: full API response, includes status code and message
  returned: always
  type: str
"""

from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.connection import Connection
from ansible.module_utils.network.fortimanager.fortimanager import FortiManagerHandler
from ansible.module_utils.network.fortimanager.common import FMGBaseException
from ansible.module_utils.network.fortimanager.common import FMGRCommon
from ansible.module_utils.network.fortimanager.common import DEFAULT_RESULT_OBJ
from ansible.module_utils.network.fortimanager.common import FAIL_SOCKET_MSG
from ansible.module_utils.network.fortimanager.common import prepare_dict
from ansible.module_utils.network.fortimanager.common import scrub_dict

###############
# START METHODS
###############

def fmgr_spamfilter_profile_modify(fmgr, paramgram):
    """
    :param fmgr: The fmgr object instance from fortimanager.py
    :type fmgr: class object
    :param paramgram: The formatted dictionary of options to process
    :type paramgram: dict
    :return: The response from the FortiManager
    :rtype: dict
    """

    mode = paramgram["mode"]
    adom = paramgram["adom"]

    response = DEFAULT_RESULT_OBJ
    url = ""
    datagram = {}

    # EVAL THE MODE PARAMETER FOR SET OR ADD
    if mode in ['set', 'add', 'update']:
        url = '/pm/config/adom/{adom}/obj/spamfilter/profile'.format(adom=adom)
        datagram = scrub_dict(prepare_dict(paramgram))

    # EVAL THE MODE PARAMETER FOR DELETE
    elif mode == "delete":
        # SET THE CORRECT URL FOR DELETE
        url = '/pm/config/adom/{adom}/obj/spamfilter/profile/{name}'.format(adom=adom, name=paramgram["name"])
        datagram = {}

    response = fmgr.process_request(url, datagram, paramgram["mode"])

    return response

#############
# END METHODS
#############

def main():
    argument_spec = dict(
        adom=dict(type="str", default="root"),
        mode=dict(choices=["add", "set", "delete", "update"], type="str", default="add"),

        spam_rbl_table=dict(required=False, type="str"),
        spam_mheader_table=dict(required=False, type="str"),
        spam_log_fortiguard_response=dict(required=False, type="str", choices=["disable", "enable"]),
        spam_log=dict(required=False, type="str", choices=["disable", "enable"]),
        spam_iptrust_table=dict(required=False, type="str"),
        spam_filtering=dict(required=False, type="str", choices=["disable", "enable"]),
        spam_bword_threshold=dict(required=False, type="int"),
        spam_bword_table=dict(required=False, type="str"),
        spam_bwl_table=dict(required=False, type="str"),
        replacemsg_group=dict(required=False, type="str"),
        options=dict(required=False, type="list", choices=["bannedword",
                                                           "spamfsip",
                                                           "spamfssubmit",
                                                           "spamfschksum",
                                                           "spamfsurl",
                                                           "spamhelodns",
                                                           "spamraddrdns",
                                                           "spamrbl",
                                                           "spamhdrcheck",
                                                           "spamfsphish",
                                                           "spambwl"]),
        name=dict(required=False, type="str"),
        flow_based=dict(required=False, type="str", choices=["disable", "enable"]),
        external=dict(required=False, type="str", choices=["disable", "enable"]),
        comment=dict(required=False, type="str"),
        gmail=dict(required=False, type="dict"),
        gmail_log=dict(required=False, type="str", choices=["disable", "enable"]),
        imap=dict(required=False, type="dict"),
        imap_action=dict(required=False, type="str", choices=["pass", "tag"]),
        imap_log=dict(required=False, type="str", choices=["disable", "enable"]),
        imap_tag_msg=dict(required=False, type="str"),
        imap_tag_type=dict(required=False, type="str", choices=["subject", "header", "spaminfo"]),
        mapi=dict(required=False, type="dict"),
        mapi_action=dict(required=False, type="str", choices=["pass", "discard"]),
        mapi_log=dict(required=False, type="str", choices=["disable", "enable"]),
        msn_hotmail=dict(required=False, type="dict"),
        msn_hotmail_log=dict(required=False, type="str", choices=["disable", "enable"]),
        pop3=dict(required=False, type="dict"),
        pop3_action=dict(required=False, type="str", choices=["pass", "tag"]),
        pop3_log=dict(required=False, type="str", choices=["disable", "enable"]),
        pop3_tag_msg=dict(required=False, type="str"),
        pop3_tag_type=dict(required=False, type="str", choices=["subject", "header", "spaminfo"]),
        smtp=dict(required=False, type="dict"),
        smtp_action=dict(required=False, type="str", choices=["pass", "tag", "discard"]),
        smtp_hdrip=dict(required=False, type="str", choices=["disable", "enable"]),
        smtp_local_override=dict(required=False, type="str", choices=["disable", "enable"]),
        smtp_log=dict(required=False, type="str", choices=["disable", "enable"]),
        smtp_tag_msg=dict(required=False, type="str"),
        smtp_tag_type=dict(required=False, type="str", choices=["subject", "header", "spaminfo"]),
        yahoo_mail=dict(required=False, type="dict"),
        yahoo_mail_log=dict(required=False, type="str", choices=["disable", "enable"]),

    )

    module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=False, )
    # MODULE PARAMGRAM
    paramgram = {
        "mode": module.params["mode"],
        "adom": module.params["adom"],
        "spam-rbl-table": module.params["spam_rbl_table"],
        "spam-mheader-table": module.params["spam_mheader_table"],
        "spam-log-fortiguard-response": module.params["spam_log_fortiguard_response"],
        "spam-log": module.params["spam_log"],
        "spam-iptrust-table": module.params["spam_iptrust_table"],
        "spam-filtering": module.params["spam_filtering"],
        "spam-bword-threshold": module.params["spam_bword_threshold"],
        "spam-bword-table": module.params["spam_bword_table"],
        "spam-bwl-table": module.params["spam_bwl_table"],
        "replacemsg-group": module.params["replacemsg_group"],
        "options": module.params["options"],
        "name": module.params["name"],
        "flow-based": module.params["flow_based"],
        "external": module.params["external"],
        "comment": module.params["comment"],
        "gmail": {
            "log": module.params["gmail_log"],
        },
        "imap": {
            "action": module.params["imap_action"],
            "log": module.params["imap_log"],
            "tag-msg": module.params["imap_tag_msg"],
            "tag-type": module.params["imap_tag_type"],
        },
        "mapi": {
            "action": module.params["mapi_action"],
            "log": module.params["mapi_log"],
        },
        "msn-hotmail": {
            "log": module.params["msn_hotmail_log"],
        },
        "pop3": {
            "action": module.params["pop3_action"],
            "log": module.params["pop3_log"],
            "tag-msg": module.params["pop3_tag_msg"],
            "tag-type": module.params["pop3_tag_type"],
        },
        "smtp": {
            "action": module.params["smtp_action"],
            "hdrip": module.params["smtp_hdrip"],
            "local-override": module.params["smtp_local_override"],
            "log": module.params["smtp_log"],
            "tag-msg": module.params["smtp_tag_msg"],
            "tag-type": module.params["smtp_tag_type"],
        },
        "yahoo-mail": {
            "log": module.params["yahoo_mail_log"],
        }
    }
    module.paramgram = paramgram
    fmgr = None
    if module._socket_path:
        connection = Connection(module._socket_path)
        fmgr = FortiManagerHandler(connection, module)
        fmgr.tools = FMGRCommon()
    else:
        module.fail_json(**FAIL_SOCKET_MSG)

    list_overrides = ['gmail', 'imap', 'mapi', 'msn-hotmail', 'pop3', 'smtp', 'yahoo-mail']
    paramgram = fmgr.tools.paramgram_child_list_override(list_overrides=list_overrides,
                                                         paramgram=paramgram, module=module)

    results = DEFAULT_RESULT_OBJ
    try:

        results = fmgr_spamfilter_profile_modify(fmgr, paramgram)
        fmgr.govern_response(module=module, results=results,
                             ansible_facts=fmgr.construct_ansible_facts(results, module.params, paramgram))

    except Exception as err:
        raise FMGBaseException(err)

    return module.exit_json(**results[1])

if __name__ == "__main__":
    main()


text:
<?php

namespace Imagine\Exception;

use InvalidArgumentException as BaseInvalidArgumentException;

class InvalidArgumentException extends BaseInvalidArgumentException implements Exception
{
}


text:
class Scene
{
public:
	Scene();
	~Scene();

	void Add(Model* model) {
		m_Models.push_back(model);
	}

	void Render();

private:
	Camera* m_Camera;

	Settings* m_GameSettings;
	GameState* m_GameState;
	ResourceManagement* m_ResourceManagement;

	SkyRenderer* m_SkyRenderer;
	GenericRenderer* m_GenericRenderer;

	Model* m_SkyBox;
	Terrain* m_Terrain;
	std::list<Model*> m_Models;
};


text:
package ca.rasul.dropwizardtest;

import io.dropwizard.Application;
import io.dropwizard.setup.Environment;

/**
 * @author Nasir Rasul {@literal nasir@rasul.ca}
 */
public class HelloApplication extends Application<HelloConfiguration> {
    /**
     * When the application runs, this is called after the {@link Bundle}s are run. Override it to add
     * providers, resources, etc. for your application.
     *
     * @param configuration the parsed {@link Configuration} object
     * @param environment   the application's {@link Environment}
     * @throws Exception if something goes wrong
     */
    @Override
    public void run(HelloConfiguration configuration, Environment environment) throws Exception {

    }

    public static void main(String args[]) throws Exception {
        new HelloApplication().run(args);
    }
}


text:
title: Voicemail using Slack, S3, 46elks and a dash of Go
date: 2015-10-12 00:00:00 UTC
author: henrik
disable_comments: false
---

Telemarketers love to harvest phone numbers from the Swedish company
registry. Our contact details there used to include Per's mobile phone
number, which over time became a threat to his sanity. When he wanted a
break from this and threatened to give them my number instead, I took
this as an excuse to hack together a simple voicemail service using the
[46elks telephony API](http://www.46elks.com).
It plays a pre-recorded message, records whatever the caller says,
uploads the resulting file to S3 and posts a comment in our #phone
channel on [Slack](https://slack.com).

![Telefonista](/images/posts/voicemail-slack-s3-46elks-golang/telefonista-slack.png)

Since telemarketers never leave a message, it's a pretty effective
filter.

Call us today: [+46 (0) 766 862 134](tel:+46766862134)

Source code on GitHub:
[https://github.com/kollegorna/telefonista](https://github.com/kollegorna/telefonista)