text:
<#
.SYNOPSIS
    Retrieve psGoogleMaps Module Settings
.DESCRIPTION
    Retrieve user specific psGoogleMaps module settings.
#>
function Get-psGoogleMapsSettings {
    [CmdletBinding()]
    param()

    if (test-path $script:moduleSettings) {
        # Import existing setting file
        Write-Verbose "Importing Settings from $($script:moduleSettings)."

        $tmp = Get-Content -Path $script:moduleSettings -Raw | ConvertFrom-Json
        return $tmp
    } else {
        Write-Verbose "No settings file found."
       return $false
    }
}

<#
.SYNOPSIS
    Write out psGoogleMaps Module Settings
.DESCRIPTION
    Store user specific psGoogleMaps module settings.
#>
function Set-psGoogleMapsSettings {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory=$true,Position=0)]
        $InputObject
    )

    #Check if settings exist already. if not create file.
    if (-not (test-path $script:moduleSettings)) {
        New-Item -ItemType File -Path $script:moduleSettings -Force
    }
    $InputObject | ConvertTo-Json | Out-File $script:moduleSettings

}

redpajama_set_name: RedPajamaGithub


text:
/**
 *
A message context implementation that can be extended for use with
 * messages that do not require contents to be encrypted, only to be integrity
 * protected. If encryption is possible the message contents will be
 * encrypted.

 *
 *
Example uses of the public message context would be for the broadcast of
 * authenticated public announcements or the transmission of information that
 * is useless after a short period of time.

 *
 * @author Wesley Miaw <wmiaw@netflix.com>
 */
var PublicMessageContext = MessageContext.extend({
    /** @inheritDoc */
    isEncrypted: function isEncrypted() {
        return false;
    },

    /** @inheritDoc */
    isIntegrityProtected: function isIntegrityProtected() {
        return true;
    },

    /** @inheritDoc */
    isNonReplayable: function isNonReplayable() {
        return false;
    }
});


text:
namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow {
  Q_OBJECT

 public:
  explicit MainWindow(QWidget *parent = 0);
  ~MainWindow();
  static std::string exampleJSON();

 private slots:
  void on_exampleButton_clicked();

  void on_generateButton_clicked();

 private:
  Ui::MainWindow *ui;
};

#endif  // MAINWINDOW_H


text:
oj.YouTubeVideo
============

A YouTube video plugin for OJ.

[ojjs.org/plugins#YouTubeVideo](http://ojjs.org/plugins#YouTubeVideo)


text:
<?php echo theme_partial('header'); ?>

    <?php if ($this->secure->is_auth()): ?>

    <?php endif; ?>

    <?php echo  $content; ?>

<?php echo theme_partial('footer'); ?>


text:
import pytest

from proposals.forms import (
    TalkProposalCancelForm, TutorialProposalCancelForm,
    TalkProposalCreateForm, TutorialProposalCreateForm,
    TalkProposalUpdateForm, TutorialProposalUpdateForm,
)
from proposals.models import TalkProposal, TutorialProposal

@pytest.fixture
def talk_proposal_data():
    return {
        'title': 'Beyond the Style Guides',
        'category': 'PRAC',
        'duration': 'PREF45',
        'language': 'CHI',
        'python_level': 'INTERMEDIATE',
        'recording_policy': True,
    }

def test_talk_proposal_create_form():
    form = TalkProposalCreateForm()
    assert list(form.fields) == [
        'title', 'category', 'duration', 'language',
        'python_level', 'recording_policy',
    ]

def test_talk_proposal_create_form_no_request(talk_proposal_data):
    form = TalkProposalCreateForm(data=talk_proposal_data)
    assert not form.is_valid()
    assert form.errors == {
        '__all__': ['Talk proposal creation requires a request object.'],
    }

def test_talk_proposal_create_form_invalid_user(
        talk_proposal_data, request, invalid_user):
    request.user = invalid_user
    form = TalkProposalCreateForm(request=request, data=talk_proposal_data)
    assert not form.is_valid()
    assert form.errors == {
        '__all__': [
            'Only authenticated user with complete speaker profile may '
            'create a talk proposal.',
        ],
    }

def test_talk_proposal_create_form_valid(talk_proposal_data, request, user):
    request.user = user
    form = TalkProposalCreateForm(request=request, data=talk_proposal_data)
    assert form.is_valid()

@pytest.fixture
def tutorial_proposal_data():
    return {
        'title': 'Beyond the Style Guides',
        'category': 'PRAC',
        'duration': 'HALFDAY',
        'language': 'CHI',
        'python_level': 'INTERMEDIATE',
        'recording_policy': True,
    }

def test_tutorial_proposal_create_form():
    form = TutorialProposalCreateForm()
    assert list(form.fields) == [
        'title', 'category', 'duration', 'language',
        'python_level', 'recording_policy',
    ]

def test_tutorial_proposal_create_form_no_request(tutorial_proposal_data):
    form = TutorialProposalCreateForm(data=tutorial_proposal_data)
    assert not form.is_valid()
    assert form.errors == {
        '__all__': ['Tutorial proposal creation requires a request object.'],
    }

def test_tutorial_proposal_create_form_anonymous(
        tutorial_proposal_data, request, invalid_user):
    request.user = invalid_user
    form = TutorialProposalCreateForm(
        request=request, data=tutorial_proposal_data,
    )
    assert not form.is_valid()
    assert form.errors == {
        '__all__': [
            'Only authenticated user with complete speaker profile may '
            'create a tutorial proposal.',
        ],
    }

def test_tutorial_proposal_create_form_valid(
        tutorial_proposal_data, request, user):
    request.user = user
    form = TutorialProposalCreateForm(
        request=request, data=tutorial_proposal_data,
    )
    assert form.is_valid()

@pytest.mark.parametrize('form_class', [
    TalkProposalUpdateForm, TutorialProposalUpdateForm,
])
def test_proposal_update_form(form_class):
    form = form_class()
    assert list(form.fields) == [
        'title', 'category', 'duration', 'language',
        'abstract', 'python_level', 'objective', 'detailed_description',
        'outline', 'supplementary', 'recording_policy', 'slide_link',
    ]

@pytest.mark.parametrize('form_class', [
    TalkProposalCancelForm, TutorialProposalCancelForm,
])
def test_proposal_cancel_form_no_instance(form_class):
    with pytest.raises(ValueError) as ctx:
        form_class()
    assert str(ctx.value) == (
        'Proposal cancel form must be initialized with an instance.'
    )

def test_talk_proposal_cancel_form(talk_proposal):
    form = TalkProposalCancelForm(instance=talk_proposal)
    assert list(form.fields) == ['cancelled']

def test_tutorial_proposal_cancel_form(tutorial_proposal):
    form = TutorialProposalCancelForm(instance=tutorial_proposal)
    assert list(form.fields) == ['cancelled']

def test_talk_proposal_cancel_form_save(talk_proposal):
    assert not talk_proposal.cancelled
    form = TalkProposalCancelForm(
        data={'cancelled': 'true'}, instance=talk_proposal,
    )
    form.save()
    assert TalkProposal.objects.get(pk=talk_proposal.pk).cancelled

def test_tutorial_proposal_cancel_form_save(tutorial_proposal):
    assert not tutorial_proposal.cancelled
    form = TutorialProposalCancelForm(
        data={'cancelled': 'true'}, instance=tutorial_proposal,
    )
    form.save()
    assert TutorialProposal.objects.get(pk=tutorial_proposal.pk).cancelled


text:
/**
 * \mainpage
 *
 * \section intro Introduction
 * This simple example shows how to use the \ref tc_group for generation of
 * pulsed width modulation signals.
 *
 * \section files Main files:
 * - tc.c timer/counter driver implementation
 * - tc.h timer/counter driver definitions
 * - tc_example3.c: tc driver example application
 * - conf_tc.h: configuration of the tc driver
 *
 * \section apiinfo tc driver API
 * The tc driver API can be found \ref tc_group "here".
 *
 * \section deviceinfo Device Info
 * All AVR XMEGA devices with tc and awex modules can be used.
 *
 * \section example_description Description of the example
 * The example will configure the Timer E0 (TCE0) in waveform generator mode.
 * AWex is used to output PWM signals from Compare modules CCA and CCB.
 * These complementary signals are output on Port E0 and E1. Deadtimes are
 * inserted. This example is dimming the duty-cycle of the two signals in an
 * opposite way.
 *
 * In addition the example configures the CCA and CCB interrupts to update the
 * duty-cycle
 *
 * Summary of Timer Counter configuration:
 *  - TCE0 : Timer
 *  - Compare/Capture modules A/B : Compare and waveform generation in Dual
 *  slope mode
 *  - AXexE : Deadtime Low and High insertion and override of Port E0/E1
 *
 * This example uses the on-board LEDs to provide user feedback, the output
 * from the LEDs are as follows:
 *  - LED0: fades out
 *  - LED1: fades in

 * \section compinfo Compilation Info
 * This software was written for the GNU GCC and IAR for AVR.
 * Other compilers may or may not work.
 *
 * \section contactinfo Contact Information
 * For further information, visit
 * Atmel.\n
 */
 /**
 * Support and FAQ: visit Atmel Support
 */
#include <conf_example.h>
#include <string.h>
#include <asf.h>

uint16_t cca_pwm_index;
uint16_t ccb_pwm_index;

/**
 * \brief Compare/Capture detection interrupt callback function
 *
 * This function is called when an interrupt has occurred on a Compare A channel.
 * It increments the CC detection level and thus modify the duty-cycle.
 */
static void example_cca_interrupt_callback(void)
{
	cca_pwm_index += 0x01;
	if (cca_pwm_index >= 0xFE) cca_pwm_index=0;
	tc_write_cc_buffer(&TIMER_EXAMPLE, TC_CCA, cca_pwm_index);
}

/**
 * \brief Compare/Capture detection interrupt callback function
 *
 * This function is called when an interrupt has occurred on a Compare B channel.
 * It decrements the CC detection level and thus modify the duty-cycle.
 */
static void example_ccb_interrupt_callback(void)
{
	ccb_pwm_index -= 0x01;
	if (ccb_pwm_index <= 0x01) ccb_pwm_index=0xFF;
	tc_write_cc_buffer(&TIMER_EXAMPLE, TC_CCB, ccb_pwm_index);
}

int main(void)
{
	pmic_init();
	board_init();
	sysclk_init();
	sleepmgr_init();
	cpu_irq_enable();

	/* Enables the Timer defined in conf_example.h : TCE0 in this example */
	tc_enable(&TIMER_EXAMPLE);

	/* Configures the interrupt level of CCA and CCB modules : low */
	tc_set_cca_interrupt_level(&TIMER_EXAMPLE, TC_INT_LVL_LO);
	tc_set_ccb_interrupt_level(&TIMER_EXAMPLE, TC_INT_LVL_LO);

	/* Configures the waveform generator of this Timer mode in NORMAL mode */
	tc_set_wgm(&TIMER_EXAMPLE, TC_WG_NORMAL);

	/* Declares the interrupt functions which will be called when CCA and CCB
	interrupts will occur */
	tc_set_cca_interrupt_callback(&TIMER_EXAMPLE,
			example_cca_interrupt_callback);
	tc_set_ccb_interrupt_callback(&TIMER_EXAMPLE,
			example_ccb_interrupt_callback);

	/* Configures the Timer period*/
	tc_write_period(&TIMER_EXAMPLE, TIMER_EXAMPLE_PERIOD);

	/* Configures the CCA and CCB levels*/
	tc_write_cc(&TIMER_EXAMPLE, TC_CCA, TIMER_EXAMPLE_PERIOD/2);
	tc_write_cc(&TIMER_EXAMPLE, TC_CCB, TIMER_EXAMPLE_PERIOD/2);

	/* Enables the CCA and CCB channels*/
	tc_enable_cc_channels(&TIMER_EXAMPLE,TC_CCAEN);
	tc_enable_cc_channels(&TIMER_EXAMPLE,TC_CCAEN);

	/* Configures the waveform genertaor in Dual Slope mode and Top*/
	tc_set_wgm(&TIMER_EXAMPLE,TC_WG_DS_T);

	/* Enables and configures the deadtime of CCA and CCB outputs*/
	tc_awex_enable_cca_deadtime(&AWEXE);
	tc_awex_enable_ccb_deadtime(&AWEXE);
	tc_awex_set_dti_high(&AWEXE, TIMER_EXAMPLE_PERIOD/6);
	tc_awex_set_dti_low(&AWEXE, TIMER_EXAMPLE_PERIOD/6);

	/* Outputs CCA and CCB on Port E0 and E1*/
	tc_awex_set_output_override(&AWEXE, 0x03);

	tc_set_resolution(&TIMER_EXAMPLE, 10000);

	do {
		/* Go to sleep, everything is handled by interrupts. */
		sleepmgr_enter_sleep();
	} while (1);
}


text:
Pluff — Studentenrooster [![Build Status](https://travis-ci.org/Fontys-Hogeschool-ICT/Pluff.svg?branch=master)](https://travis-ci.org/Fontys-Hogeschool-ICT/Pluff)
========================
[Pluff](https://pluff.venus.fhict.nl) is een open-source roostersysteem, gemaakt door Fontys ICT studenten. Het is onze visie, hoe het eigenlijk zou moeten. De webpagina's uit het gebruikte roosterpakket, zijn niet echt van deze tijd.

Uiteraard kan het altijd beter. Wij zijn geïnteresseerd in je feedback! Aarzel niet om hiervoor een issue aan te maken. Meehelpen is ook zeer welkom.

## [Master](https://github.com/Fontys-Hogeschool-ICT/Pluff/tree/master/) [![Build Status](https://travis-ci.org/Fontys-Hogeschool-ICT/Pluff.svg?branch=master)](https://travis-ci.org/Fontys-Hogeschool-ICT/Pluff)
This is the main branch, hosted on [pluff.venus.fhict.nl](https://pluff.venus.fhict.nl). It is automatically deployed by Travis, but this branch isn't used for development.

## [Dev branch](https://github.com/Fontys-Hogeschool-ICT/Pluff/tree/dev/) [![Build Status](https://travis-ci.org/Fontys-Hogeschool-ICT/Pluff.svg?branch=dev)](https://travis-ci.org/Fontys-Hogeschool-ICT/Pluff)
This is our development branch, so please submit all your pull-requests to this branch. It is also automatically deployed by travis to [pluff-dev.venus.fhict.nl](https://pluff-dev.venus.fhict.nl). This version of pluff is deployed on every push, so you'll see regular updates.

## Development

Om Pluff lokaal te draaien heb je [node.js](http://nodejs.org/) (v6 of hoger) en npm (meestal meegeleverd bij node.js) nodig.

Clone deze repository. Type (eenmalig) in je Pluff folder `npm install` om de benodigde dependencies te installeren. Daarna type je simpelweg `npm start` om de 'server' te starten. Ga nu naar `http://localhost:8080`, waar je als het goed is meteen een werkende Pluff ziet staan.

Houd je bij het ontwikkelen aan de  [Airbnb Javascript Style Guide](https://github.com/airbnb/javascript). Check of je voldoet aan deze standaard met `npm run lint`. Ook wordt [EditorConfig](http://editorconfig.org/) gebruikt zodat iedereen dezelfde line endings etc. gebruikt. Deze kun je voor vrijwel elke editor installeren.

## Nieuwe feature?

Heb je een nieuwe feature gemaakt, die je graag met de rest van de wereld wil delen? Stuur ons een pull-request van je nieuwe code. Wij zullen dit pull-request vervolgens in onze `dev` branch zetten zodat we het online kunnen testen op [pluff-dev](https://pluff-dev.venus.fhict.nl). Eens in de zoveel tijd zullen we al deze nieuwe features dan op de `master` zetten.

## Uploaden via FTP

Om Pluff op een website te plaatsen, kopieer je eerst `.env.example` naar `.env`. Vul vervolgens je FTP gegevens hier in. Daarna kun je de bestanden bouwen en uploaden op je FTP server door `npm run deploy-auto` uit te voeren.

Inmiddels wordt er gebruikt gemaakt van Travis om automatisch de laatste commit op de master te deployen naar de [pluff website](https://pluff.venus.fhict.nl).

## Credits

De mensen achter Pluff:

- [Kees Kluskens](https://www.webduck.nl) - Founder (bedenker/ontwikkelaar) - Afgestudeerd
- Tim van den Biggelaar - Ontwikkelaar
- [Stephan van Rooij](https://svrooij.nl) - Ontwikkelaar FHICT Api
- Jeroen - (oud)Serverbeheer
- Jasper Stam - _Programmeer schildknaap_
- Rutger Schimmel - _Bugtester_ & kleurentovenaar
- [Jort Polderdijk](https://github.com/JortPolderdijk) - Ontwikkelaar

Voor het rooster systeem maken we gebruik van de volgende projecten:

- [Angular](https://angularjs.org/) - JS framework
- [Webpack](https://webpack.github.io/) - Module bundler
- [Sass](http://sass-lang.com/) - *CSS with superpowers*


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

    <string name="app_name">Acc Manager</string>
    <string name="action_close_session">Close session</string>

</resources>


text:
<?php
/**
 * The template for displaying Search Results pages.
 *
 * @package _s
 * @since _s 1.0
 */

get_header(); ?>

			<?php if ( have_posts() ) : ?>

<?php printf( __( 'Search Results for: %s', '_s' ), '' . get_search_query() . '' ); ?>

				<?php _s_content_nav( 'nav-above' ); ?>

				<?php /* Start the Loop */ ?>
				<?php while ( have_posts() ) : the_post(); ?>

					<?php get_template_part( 'content', 'search' ); ?>

				<?php endwhile; ?>

				<?php _s_content_nav( 'nav-below' ); ?>

			<?php else : ?>

				<?php get_template_part( 'no-results', 'search' ); ?>

			<?php endif; ?>

<?php get_sidebar(); ?>
<?php get_footer(); ?>


text:
#ifndef LIBMINIFI_INCLUDE_THREAD_POOL_H
#define LIBMINIFI_INCLUDE_THREAD_POOL_H

#include <chrono>
#include <iostream>
#include <atomic>
#include <mutex>
#include <map>
#include <vector>
#include <queue>
#include <future>
#include <thread>
#include <functional>

#include "capi/expect.h"
#include "controllers/ThreadManagementService.h"
#include "concurrentqueue.h"
#include "core/controller/ControllerService.h"
#include "core/controller/ControllerServiceProvider.h"
namespace org {
namespace apache {
namespace nifi {
namespace minifi {
namespace utils {

/**
 * Worker task helper that determines
 * whether or not we will run
 */
template<typename T>
class AfterExecute {
 public:
  virtual ~AfterExecute() {

  }

  explicit AfterExecute() {

  }

  explicit AfterExecute(AfterExecute &&other) {

  }
  virtual bool isFinished(const T &result) = 0;
  virtual bool isCancelled(const T &result) = 0;
  /**
   * Time to wait before re-running this task if necessary
   * @return milliseconds since epoch after which we are eligible to re-run this task.
   */
  virtual int64_t wait_time() = 0;
};

/**
 * Worker task
 * purpose: Provides a wrapper for the functor
 * and returns a future based on the template argument.
 */
template<typename T>
class Worker {
 public:
  explicit Worker(std::function<T()> &task, const std::string &identifier, std::unique_ptr<AfterExecute<T>> run_determinant)
      : identifier_(identifier),
        time_slice_(0),
        task(task),
        run_determinant_(std::move(run_determinant)) {
    promise = std::make_shared<std::promise<T>>();
  }

  explicit Worker(std::function<T()> &task, const std::string &identifier)
      : identifier_(identifier),
        time_slice_(0),
        task(task),
        run_determinant_(nullptr) {
    promise = std::make_shared<std::promise<T>>();
  }

  explicit Worker(const std::string identifier = "")
      : identifier_(identifier),
        time_slice_(0) {
  }

  virtual ~Worker() {

  }

  /**
   * Move constructor for worker tasks
   */
  Worker(Worker &&other)
      : identifier_(std::move(other.identifier_)),
        time_slice_(std::move(other.time_slice_)),
        task(std::move(other.task)),
        run_determinant_(std::move(other.run_determinant_)),
        promise(other.promise) {
  }

  /**
   * Runs the task and takes the output from the functor
   * setting the result into the promise
   * @return whether or not to continue running
   *   false == finished || error
   *   true == run again
   */
  virtual bool run() {
    T result = task();
    if (run_determinant_ == nullptr || (run_determinant_->isFinished(result) || run_determinant_->isCancelled(result))) {
      promise->set_value(result);
      return false;
    }
    time_slice_ = increment_time(run_determinant_->wait_time());
    return true;
  }

  virtual void setIdentifier(const std::string identifier) {
    identifier_ = identifier;
  }

  virtual uint64_t getTimeSlice() {
    return time_slice_;
  }

  virtual uint64_t getWaitTime() {
    return run_determinant_->wait_time();
  }

  Worker<T>(const Worker<T>&) = delete;
  Worker<T>& operator =(const Worker<T>&) = delete;

  Worker<T>& operator =(Worker<T> &&);

  std::shared_ptr<std::promise<T>> getPromise();

  const std::string &getIdentifier() {
    return identifier_;
  }
 protected:

  inline uint64_t increment_time(const uint64_t &time) {
    std::chrono::time_point<std::chrono::system_clock> now = std::chrono::system_clock::now();
    auto millis = std::chrono::duration_cast<std::chrono::milliseconds>(now.time_since_epoch()).count();
    return millis + time;
  }

  std::string identifier_;
  uint64_t time_slice_;
  std::function<T()> task;
  std::unique_ptr<AfterExecute<T>> run_determinant_;
  std::shared_ptr<std::promise<T>> promise;
};

template<typename T>
class WorkerComparator {
 public:
  bool operator()(Worker<T> &a, Worker<T> &b) {
    return a.getTimeSlice() < b.getTimeSlice();
  }
};

template<typename T>
Worker<T>& Worker<T>::operator =(Worker<T> && other) {
  task = std::move(other.task);
  promise = other.promise;
  time_slice_ = std::move(other.time_slice_);
  identifier_ = std::move(other.identifier_);
  run_determinant_ = std::move(other.run_determinant_);
  return *this;
}

template<typename T>
std::shared_ptr<std::promise<T>> Worker<T>::getPromise() {
  return promise;
}

class WorkerThread {
 public:
  explicit WorkerThread(std::thread thread)
      : is_running_(false),
        thread_(std::move(thread)) {

  }
  WorkerThread()
      : is_running_(false) {

  }
  std::atomic<bool> is_running_;
  std::thread thread_;
};

/**
 * Thread pool
 * Purpose: Provides a thread pool with basic functionality similar to
 * ThreadPoolExecutor
 * Design: Locked control over a manager thread that controls the worker threads
 */
template<typename T>
class ThreadPool {
 public:

  ThreadPool(int max_worker_threads = 2, bool daemon_threads = false, const std::shared_ptr<core::controller::ControllerServiceProvider> &controller_service_provider = nullptr)
      : daemon_threads_(daemon_threads),
        thread_reduction_count_(0),
        max_worker_threads_(max_worker_threads),
        adjust_threads_(false),
        running_(false),
        controller_service_provider_(controller_service_provider) {
    current_workers_ = 0;
    task_count_ = 0;
    thread_manager_ = nullptr;
  }

  ThreadPool(const ThreadPool<T> &&other)
      : daemon_threads_(std::move(other.daemon_threads_)),
        thread_reduction_count_(0),
        max_worker_threads_(std::move(other.max_worker_threads_)),
        adjust_threads_(false),
        running_(false),
        controller_service_provider_(std::move(other.controller_service_provider_)),
        thread_manager_(std::move(other.thread_manager_)) {
    current_workers_ = 0;
    task_count_ = 0;
  }

  ~ThreadPool() {
    shutdown();
  }

  /**
   * Execute accepts a worker task and returns
   * a future
   * @param task this thread pool will subsume ownership of
   * the worker task
   * @param future future to move new promise to
   * @return true if future can be created and thread pool is in a running state.
   */
  bool execute(Worker<T> &&task, std::future<T> &future);

  /**
   * attempts to stop tasks with the provided identifier.
   * @param identifier for worker tasks. Note that these tasks won't
   * immediately stop.
   */
  void stopTasks(const std::string &identifier);

  /**
   * Returns true if a task is running.
   */
  bool isRunning(const std::string &identifier) {
    return task_status_[identifier] == true;
  }

  /**
   * Starts the Thread Pool
   */
  void start();
  /**
   * Shutdown the thread pool and clear any
   * currently running activities
   */
  void shutdown();
  /**
   * Set the max concurrent tasks. When this is done
   * we must start and restart the thread pool if
   * the number of tasks is less than the currently configured number
   */
  void setMaxConcurrentTasks(uint16_t max) {
    std::lock_guard<std::recursive_mutex> lock(manager_mutex_);
    if (running_) {
      shutdown();
    }
    max_worker_threads_ = max;
    if (!running_)
      start();
  }

  ThreadPool<T> operator=(const ThreadPool<T> &other) = delete;
  ThreadPool(const ThreadPool<T> &other) = delete;

  ThreadPool<T> &operator=(ThreadPool<T> &&other) {
    std::lock_guard<std::recursive_mutex> lock(manager_mutex_);
    if (other.running_) {
      other.shutdown();
    }
    if (running_) {
      shutdown();
    }
    max_worker_threads_ = std::move(other.max_worker_threads_);
    daemon_threads_ = std::move(other.daemon_threads_);
    current_workers_ = 0;
    thread_reduction_count_ = 0;

    thread_queue_ = std::move(other.thread_queue_);
    worker_queue_ = std::move(other.worker_queue_);

    controller_service_provider_ = std::move(other.controller_service_provider_);
    thread_manager_ = std::move(other.thread_manager_);

    adjust_threads_ = false;

    if (!running_) {
      start();
    }
    return *this;
  }

 protected:

  std::thread createThread(std::function<void()> &&functor) {
    return std::thread([ functor ]() mutable {
      functor();
    });
  }

  /**
   * Drain will notify tasks to stop following notification
   */
  void drain() {
    while (current_workers_ > 0) {
      tasks_available_.notify_one();
    }
  }
// determines if threads are detached
  bool daemon_threads_;
  std::atomic<int> thread_reduction_count_;
// max worker threads
  int max_worker_threads_;
// current worker tasks.
  std::atomic<int> current_workers_;
  std::atomic<int> task_count_;
// thread queue
  std::vector<std::shared_ptr<WorkerThread>> thread_queue_;
// manager thread
  std::thread manager_thread_;
// conditional that's used to adjust the threads
  std::atomic<bool> adjust_threads_;
// atomic running boolean
  std::atomic<bool> running_;
// controller service provider
  std::shared_ptr<core::controller::ControllerServiceProvider> controller_service_provider_;
// integrated power manager
  std::shared_ptr<controllers::ThreadManagementService> thread_manager_;
  // thread queue for the recently deceased threads.
  moodycamel::ConcurrentQueue<std::shared_ptr<WorkerThread>> deceased_thread_queue_;
// worker queue of worker objects
  moodycamel::ConcurrentQueue<Worker<T>> worker_queue_;
  std::priority_queue<Worker<T>, std::vector<Worker<T>>, WorkerComparator<T>> worker_priority_queue_;
// notification for available work
  std::condition_variable tasks_available_;
// map to identify if a task should be
  std::map<std::string, bool> task_status_;
// manager mutex
  std::recursive_mutex manager_mutex_;
// work queue mutex
  std::mutex worker_queue_mutex_;

  /**
   * Call for the manager to start worker threads
   */
  void manageWorkers();

  /**
   * Function to adjust the workers up and down.
   */
  void adjustWorkers(int count);

  /**
   * Runs worker tasks
   */
  void run_tasks(std::shared_ptr<WorkerThread> thread);
};

template<typename T>
bool ThreadPool<T>::execute(Worker<T> &&task, std::future<T> &future) {
  {
    std::unique_lock<std::mutex> lock(worker_queue_mutex_);
    task_status_[task.getIdentifier()] = true;
  }
  future = std::move(task.getPromise()->get_future());
  bool enqueued = worker_queue_.enqueue(std::move(task));
  if (running_) {
    tasks_available_.notify_one();
  }

  task_count_++;

  return enqueued;
}

template<typename T>
void ThreadPool<T>::manageWorkers() {
  for (int i = 0; i < max_worker_threads_; i++) {
    auto worker_thread = std::make_shared<WorkerThread>();
    worker_thread->thread_ = createThread(std::bind(&ThreadPool::run_tasks, this, worker_thread));
    thread_queue_.push_back(worker_thread);
    current_workers_++;
  }

  if (daemon_threads_) {
    for (auto &thread : thread_queue_) {
      thread->thread_.detach();
    }
  }

// likely don't have a thread manager
  if (LIKELY(nullptr != thread_manager_)) {
    while (running_) {
      auto waitperiod = std::chrono::milliseconds(1) * 500;
      {
        if (thread_manager_->isAboveMax(current_workers_)) {
          auto max = thread_manager_->getMaxConcurrentTasks();
          auto differential = current_workers_ - max;
          thread_reduction_count_ += differential;
        } else if (thread_manager_->shouldReduce()) {
          if (current_workers_ > 1)
            thread_reduction_count_++;
          thread_manager_->reduce();
        } else if (thread_manager_->canIncrease() && max_worker_threads_ - current_workers_ > 0) {  // increase slowly
          std::unique_lock<std::mutex> lock(worker_queue_mutex_);
          auto worker_thread = std::make_shared<WorkerThread>();
          worker_thread->thread_ = createThread(std::bind(&ThreadPool::run_tasks, this, worker_thread));
          if (daemon_threads_) {
            worker_thread->thread_.detach();
          }
          thread_queue_.push_back(worker_thread);
          current_workers_++;
        }
      }
      {
        std::shared_ptr<WorkerThread> thread_ref;
        while (deceased_thread_queue_.try_dequeue(thread_ref)) {
          std::unique_lock<std::mutex> lock(worker_queue_mutex_);
          if (thread_ref->thread_.joinable())
            thread_ref->thread_.join();
          thread_queue_.erase(std::remove(thread_queue_.begin(), thread_queue_.end(), thread_ref), thread_queue_.end());
        }
      }
      std::this_thread::sleep_for(waitperiod);
    }
  } else {
    for (auto &thread : thread_queue_) {
      if (thread->thread_.joinable())
        thread->thread_.join();
    }
  }
}
template<typename T>
void ThreadPool<T>::run_tasks(std::shared_ptr<WorkerThread> thread) {
  auto waitperiod = std::chrono::milliseconds(1) * 100;
  uint64_t wait_decay_ = 0;
  uint64_t yield_backoff = 10;  // start at 10 ms
  while (running_.load()) {
    if (UNLIKELY(thread_reduction_count_ > 0)) {
      if (--thread_reduction_count_ >= 0) {
        deceased_thread_queue_.enqueue(thread);
        thread->is_running_ = false;
        break;
      } else {
        thread_reduction_count_++;
      }
    }
    // if we exceed 500ms of wait due to not being able to run any tasks and there are tasks available, meaning
    // they are eligible to run per the fact that the thread pool isn't shut down and the tasks are in a runnable state
    // BUT they've been continually timesliced, we will lower the wait decay to 100ms and continue incrementing from
    // there. This ensures we don't have arbitrarily long sleep cycles.
    if (wait_decay_ > 500000000L) {
      wait_decay_ = 100000000L;
    }
    // if we are spinning, perform a wait. If something changes in the worker such that the timeslice has changed, we will pick that information up. Note that it's possible
    // we could starve for processing time if all workers are waiting. In the event that the number of workers far exceeds the number of threads, threads will spin and potentially
    // wait until they arrive at a task that can be run. In this case we reset the wait_decay and attempt to pick up a new task. This means that threads that recently ran should
    // be more likely to run. This is intentional.

    if (wait_decay_ > 2000) {
      std::this_thread::sleep_for(std::chrono::nanoseconds(wait_decay_));
    }

    if (current_workers_ < max_worker_threads_) {
      // we are in a reduced state. due to thread management
      // let's institute a backoff up to 500ms
      if (yield_backoff < 500) {
        yield_backoff += 10;
      }
      std::this_thread::sleep_for(std::chrono::milliseconds(yield_backoff));
    } else {
      yield_backoff = 10;
    }
    Worker<T> task;

    bool prioritized_task = false;

    if (!prioritized_task) {
      if (!worker_queue_.try_dequeue(task)) {
        std::unique_lock<std::mutex> lock(worker_queue_mutex_);
        if (worker_priority_queue_.size() > 0) {
          // this is safe as we are going to immediately pop the queue
          while (!worker_priority_queue_.empty()) {
            task = std::move(const_cast<Worker<T>&>(worker_priority_queue_.top()));
            worker_priority_queue_.pop();
            worker_queue_.enqueue(std::move(task));
            continue;
          }

        }
        tasks_available_.wait_for(lock, waitperiod);
        continue;
      } else {
        std::unique_lock<std::mutex> lock(worker_queue_mutex_);
        if (!task_status_[task.getIdentifier()]) {
          continue;
        }
      }

      bool wait_to_run = false;
      if (task.getTimeSlice() > 1) {
        double wt = (double) task.getWaitTime();
        auto now = std::chrono::system_clock::now().time_since_epoch();
        auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(now).count();

        // if our differential is < 10% of the wait time we will not put the task into a wait state
        // since requeuing will break the time slice contract.
        if ((double) task.getTimeSlice() > ms && ((double) (task.getTimeSlice() - ms)) > (wt * .10)) {
          wait_to_run = true;
        }
      }
      // if we have to wait we re-queue the worker.
      if (wait_to_run) {
        {
          std::unique_lock<std::mutex> lock(worker_queue_mutex_);
          if (!task_status_[task.getIdentifier()]) {
            continue;
          }
          // put it on the priority queue
          worker_priority_queue_.push(std::move(task));
        }

        wait_decay_ += 25;
        continue;
      }
    }
    const bool task_renew = task.run();
    wait_decay_ = 0;
    if (task_renew) {

      if (UNLIKELY(task_count_ > current_workers_)) {
        // even if we have more work to do we will not
        std::unique_lock<std::mutex> lock(worker_queue_mutex_);
        if (!task_status_[task.getIdentifier()]) {
          continue;
        }

        worker_priority_queue_.push(std::move(task));
      } else {
        worker_queue_.enqueue(std::move(task));
      }
    }
  }
  current_workers_--;
}
template<typename T>
void ThreadPool<T>::start() {
  if (nullptr != controller_service_provider_) {
    auto thread_man = controller_service_provider_->getControllerService("ThreadPoolManager");
    thread_manager_ = thread_man != nullptr ? std::dynamic_pointer_cast<controllers::ThreadManagementService>(thread_man) : nullptr;
  } else {
    thread_manager_ = nullptr;
  }
  std::lock_guard<std::recursive_mutex> lock(manager_mutex_);
  if (!running_) {
    running_ = true;
    manager_thread_ = std::move(std::thread(&ThreadPool::manageWorkers, this));
    if (worker_queue_.size_approx() > 0) {
      tasks_available_.notify_all();
    }
  }
}

template<typename T>
void ThreadPool<T>::stopTasks(const std::string &identifier) {
  std::unique_lock<std::mutex> lock(worker_queue_mutex_);
  task_status_[identifier] = false;
}

template<typename T>
void ThreadPool<T>::shutdown() {
  if (running_.load()) {
    std::lock_guard<std::recursive_mutex> lock(manager_mutex_);
    running_.store(false);

    drain();
    task_status_.clear();
    if (manager_thread_.joinable())
      manager_thread_.join();
    {
      std::unique_lock<std::mutex> lock(worker_queue_mutex_);
      thread_queue_.clear();
      current_workers_ = 0;
      while (worker_queue_.size_approx() > 0) {
        Worker<T> task;
        worker_queue_.try_dequeue(task);
      }
    }
  }
}

} /* namespace utils */
} /* namespace minifi */
} /* namespace nifi */
} /* namespace apache */
} /* namespace org */

#endif


text:
package scala.slick.direct

import scala.slick.SlickException
import scala.language.implicitConversions
import scala.slick.driver._
import scala.slick.driver.BasicDriver.Table
import scala.slick.lifted._
import scala.slick.{ast => sq}
import scala.slick.ast.{Library,FunctionSymbol}
import scala.slick.ast.Dump
import scala.slick.util.{CollectionLinearizer,RecordLinearizer,ValueLinearizer}
import scala.slick.session.{Session}
import scala.reflect.ClassTag
import scala.slick.compiler.CompilationState
import scala.reflect.runtime.universe.TypeRef
import scala.reflect.runtime.universe.compat._

trait QueryableBackend

class SlickBackend( driver:BasicDriver, mapper:Mapper ) extends QueryableBackend{
  import scala.reflect.runtime.universe._
  import scala.reflect.runtime.{currentMirror=>cm}

  val typeMappers = Map( // FIXME use symbols instead of strings for type names here
     "Int"              /*typeOf[Int]*/    -> TypeMapper.IntTypeMapper
    ,"Double"           /*typeOf[Double]*/ -> TypeMapper.DoubleTypeMapper
    ,"String"           /*typeOf[String]*/ -> TypeMapper.StringTypeMapper
    ,"scala.Int"        /*typeOf[Int]*/    -> TypeMapper.IntTypeMapper
    ,"scala.Double"     /*typeOf[Double]*/ -> TypeMapper.DoubleTypeMapper
    ,"scala.String"     /*typeOf[String]*/ -> TypeMapper.StringTypeMapper
    ,"java.lang.String" /*typeOf[String]*/ -> TypeMapper.StringTypeMapper // FIXME: typeOf[String] leads to java.lang.String, but param.typeSignature to String
  )

  //def resolveSym( lhs:Type, name:String, rhs:Type* ) = lhs.member(newTermName(name).encodedName).asTerm.resolveOverloaded(actuals = rhs.toList)

  val operatorMap : Vector[ (Map[String, FunctionSymbol], List[List[Type]]) ] = {
    import Library._
    Vector(
      Map( "==" -> Library.== )
      ->
      List(
        List(typeOf[Any]),
        List(typeOf[Any])
      ),
      Map( "+" -> Library.+, "<" -> <, ">" -> > )
      ->
      List(
        List(typeOf[Int],typeOf[Double]),
        List(typeOf[Int],typeOf[Double])
      ),
      Map( "+" -> Concat )
      ->
      List(
        List(typeOf[String],typeOf[java.lang.String]),
        List(typeOf[String],typeOf[java.lang.String])
      ),
      Map( "||" -> <, "&&" -> > )
      ->
      List(
        List(typeOf[Boolean]),
        List(typeOf[Boolean])
      )
    )
  }

  object removeTypeAnnotations extends Transformer {
    def apply( tree:Tree ) = transform(tree)
    override def transform(tree: Tree): Tree = {
      super.transform {
        tree match {
          case  TypeApply( tree, _ ) => tree
          case  Typed( tree, _ ) => tree
          case tree => tree
        }
      }
    }
  }

  type Scope = Map[Symbol,sq.Node]
  def Scope() : Scope = Map()
  class Query(
               val node : sq.Node,
               val scope : Scope
               )

  def getConstructorArgs( tpe:Type ) =
    tpe.member( nme.CONSTRUCTOR ).typeSignature match {
      case MethodType( params, resultType ) => params // TODO check that the field order is correct
    }

  def extractColumn( sym:Symbol, sq_symbol:sq.Node ) = {
    val column_name = mapper.fieldToColumn( sym )
    sq.Select(sq_symbol, sq.FieldSymbol(column_name)(List(),null))
  }

  def typetagToQuery(typetag:TypeTag[_]) : Query = {
    val table = new sq.TableNode with sq.NullaryNode with sq.WithOp {
      val tableName = mapper.typeToTable( typetag.tpe )
      def columns = getConstructorArgs( typetag.tpe ).map{extractColumn(_,sq.Node(this))} // use def here, not val, so expansion is still correct after cloning

      def nodeShaped_* = ShapedValue(sq.ProductNode(columns), Shape.selfLinearizingShape.asInstanceOf[Shape[sq.ProductNode, Any, _]])
    }
    new Query( table, Scope() )
  }

  def toQuery( tree:Tree, scope : Scope = Scope() ) : (Type,Query) = {
    import scala.tools.reflect._
    // external references (symbols) are preserved by reify, so cm suffices (its class loader does not need to load any new classes)
    val toolbox = cm.mkToolBox()//mkConsoleFrontEnd().asInstanceOf[scala.tools.reflect.FrontEnd],"") // FIXME cast
    val typed_tree = try
      toolbox.typeCheck(tree) // TODO: can we get rid of this to remove the compiler dependency?
    catch{
      case e:Throwable => println("Failed to typecheck: "+showRaw(tree));throw e
    }
    ( typed_tree.tpe, scala2scalaquery_typed( removeTypeAnnotations(typed_tree), scope ) )
  }
  private def eval( tree:Tree ) :Any = {
    tree match {
      case Select(from,name) => {
        val i = cm.reflect( eval(from) )
        val m = i.symbol.typeSignature.member( name ).asMethod
        val mm = i.reflectMethod( m )
        mm()
      }
      case ident:Ident => ident.symbol.asFreeTerm.value
      case o:This if o.symbol.isStatic => cm.reflectModule(o.symbol.companionSymbol.asModule).instance
      case o:This => throw new SlickException( "Cannot handle reference to a query in non-static symbol "+o.symbol )
      case _ => throw new SlickException("Cannot eval: " + showRaw(tree))
    }
  }

  private def scala2scalaquery_typed( tree:Tree, scope : Scope ) : Query = {
    def s2sq( tree:Tree, scope:Scope=scope ) : Query = scala2scalaquery_typed( tree, scope )
    implicit def node2Query(node:sq.Node) = new Query( node, scope )
    try{
      val string_types = List("String","java.lang.String")
      tree match {
        // explicitly state types here until SQ removes type parameters and type mapper from ConstColumn
        case Literal(Constant(x:Int))    => ConstColumn[Int](x)
        case Literal(Constant(x:String)) => ConstColumn[String](x)
        case Literal(Constant(x:Double)) => ConstColumn[Double](x)
        case ident@Ident(name) if !scope.contains(ident.symbol) => // TODO: move this into a separate inlining step in queryable
          ident.symbol.asFreeTerm.value match {
            case q:BaseQueryable[_] => val (tpe,query) = toQuery( q ); query
            case x => s2sq( Literal(Constant(x)) )
          }
        case ident@Ident(name) => scope(ident.symbol)

        case Select( t, term ) if t.tpe.erasure <:< typeOf[BaseQueryable[_]].erasure && term.decoded == "queryable" => s2sq(t)

        // match columns
        case Select(from,name) if mapper.isMapped( from.tpe.widen )
        =>
          extractColumn( getConstructorArgs( from.tpe.widen ).filter(_.name==name).head, scope(from.symbol) )
/*
        // TODO: Where is this needed?
        case Select(a:This,b) =>
          val obj = companionInstance( a.symbol )
          val value = invoke( obj, a.tpe.nonPrivateMember(b) )()
          value match{
            case q:BaseQueryable[_] => toQuery( q )
            case x => s2sq( Literal(Constant(x)) )
          }
*/

        case Apply( Select( queryOps, term ), queryable::Nil )
          if queryOps.tpe <:< typeOf[QueryOps.type] && queryable.tpe.erasure <:< typeOf[BaseQueryable[_]].erasure && term.decoded == "query"
        => s2sq( queryable ).node

        // match queryable methods
        case Apply(Select(scala_lhs,term),Function( arg::Nil, body )::Nil)
          if scala_lhs.tpe.erasure <:< typeOf[QueryOps[_]].erasure
        =>
          val sq_lhs = s2sq( scala_lhs ).node
          val sq_symbol = new sq.AnonSymbol
          val new_scope = scope+(arg.symbol -> sq.Ref(sq_symbol))
          val rhs = s2sq(body, new_scope)
          new Query( term.decoded match {
            case "filter"     => sq.Filter( sq_symbol, sq_lhs, rhs.node )
            case "map"        => sq.Bind( sq_symbol, sq_lhs, sq.Pure(rhs.node) )
            case "flatMap"    => sq.Bind( sq_symbol, sq_lhs, rhs.node )
            case e => throw new UnsupportedMethodException( scala_lhs.tpe.erasure+"."+term.decoded )
          },
            new_scope
          )

        // FIXME: this case is required because of a bug, but should be covered by the next case
        case d@Apply(Select(lhs,term),rhs::Nil)
          if {
            /*println("_a__")
            println(showRaw(d))
            println(showRaw(lhs))
            println(rhs.symbol.asInstanceOf[scala.reflect.internal.Symbols#FreeTerm].value)
            println(rhs.tpe)
            println("_b__")*/
            (
              (string_types contains lhs.tpe.widen.toString) //(lhs.tpe <:< typeOf[String])
                && (string_types contains rhs.tpe.widen.toString) // (rhs.tpe <:< typeOf[String] )
                && (List("+").contains( term.decoded ))
              )
          }
        =>
          term.decoded match {
            case "+" => Library.Concat(s2sq( lhs ).node, s2sq( rhs ).node )
          }

        case Apply(op@Select(lhs,term),rhs::Nil) => {
          val actualTypes = lhs.tpe :: rhs.tpe :: Nil //.map(_.tpe).toList
          val matching_ops = ( operatorMap.collect{
              case (str2sym, types)
                    if str2sym.isDefinedAt( term.decoded )
                      && types.zipWithIndex.forall{
                           case (expectedTypes, index) => expectedTypes.exists( actualTypes(index) <:< _ )
                         }
              => str2sym( term.decoded )
          })
          matching_ops.size match{
            case 0 => throw new SlickException("Operator not supported: "+ lhs.tpe +"."+term.decoded+"("+ rhs.tpe +")")
            case 1 => matching_ops.head( s2sq( lhs ).node, s2sq( rhs ).node )
            case _ => throw new SlickException("Internal Slick error: resolution of "+ lhs.tpe +" "+term.decoded+" "+ rhs.tpe +" was ambigious")
          }
        }

        // Tuples
        case Apply(
            Select(Select(Ident(package_), class_), method_),
            components
        )
        if package_.decoded == "scala" && class_.decoded.startsWith("Tuple") && method_.decoded == "apply" // FIXME: match smarter than matching strings
        =>
            sq.ProductNode( components.map(s2sq(_).node) )

        case Select(scala_lhs, term)
          if scala_lhs.tpe.erasure <:< typeOf[QueryOps[_]].erasure && (term.decoded == "length" || term.decoded == "size")
          => sq.Pure( Library.CountAll( s2sq(scala_lhs).node ) )

        case tree if tree.tpe.erasure <:< typeOf[BaseQueryable[_]].erasure
            => val (tpe,query) = toQuery( eval(tree).asInstanceOf[BaseQueryable[_]] ); query

        case tree => throw new Exception( "You probably used currently not supported scala code in a query. No match for:\n" + showRaw(tree) )
      }
    } catch{
      case e:java.lang.NullPointerException => { println("NPE in tree "+showRaw(tree));throw e}
    }
  }
  protected[slick] def dump( queryable:BaseQueryable[_] ) = {
    val (_,query) = this.toQuery(queryable)
    Dump(query.node)
  }
  import scala.collection.generic.CanBuildFrom
  import scala.slick.session.{PositionedParameters, PositionedResult}
  import scala.slick.ast.Node
  import scala.slick.lifted.TypeMapper

  private def queryable2cstate[R]( queryable:BaseQueryable[R], session:Session ) : (Type,CompilationState) = {
    val (tpe,query) = this.toQuery(queryable)
    (tpe,driver.compiler.run(query.node))
  }

  private def queryablevalue2cstate[R]( queryablevalue:QueryableValue[R], session:Session ) : (Type,CompilationState) = {
    val (tpe,query) = this.toQuery(queryablevalue.value.tree)
    (tpe,driver.compiler.run(query.node))
  }

  protected def resultByType( expectedType : Type, rs: PositionedResult, session:Session) : Any = {
    def createInstance( args:Seq[Any] ) = {
      val constructor = expectedType.member( nme.CONSTRUCTOR ).asMethod
      val cls = cm.reflectClass( cm.classSymbol(cm.runtimeClass(expectedType)) )
      cls.reflectConstructor( constructor )( args:_* )
    }
    import TupleTypes.tupleTypes
    (expectedType match {
      case t if typeMappers.isDefinedAt(expectedType.toString) => typeMappers( expectedType.toString )(driver).nextValue(rs)
      case t if tupleTypes.exists( expectedType <:< _ ) =>
        val typeArgs = expectedType match { case TypeRef(_,_,args_) => args_ }
        val args = typeArgs.map{
          tpe => resultByType( tpe, rs, session )
        }
        createInstance( args )
      case t if t.typeSymbol.asClass.isCaseClass =>
        val args = expectedType.member( nme.CONSTRUCTOR ).typeSignature match {
          case MethodType( params, resultType ) => params.map{ // TODO check that the field order is correct
            param =>  resultByType( param.typeSignature, rs, session )
          }
        }
        createInstance( args )
    })
  }
  def result[R]( queryable:BaseQueryable[R], session:Session) : Vector[R] = {
    val (tpe,query) = queryable2cstate( queryable, session )
    result(tpe,query, session)
  }
  def result[R]( queryablevalue:QueryableValue[R], session:Session) : R = {
    val (tpe,query) = queryablevalue2cstate( queryablevalue, session )
    val res = result(tpe,query, session)
    res(0)
  }
  def result[R]( tpe:Type, cstate:CompilationState, session:Session) : Vector[R] = {
    val linearizer = new CollectionLinearizer[Vector,R]{
      def elementLinearizer: ValueLinearizer[R] = new RecordLinearizer[R]{
          def getResult(profile: BasicProfile, rs: PositionedResult): R
            = resultByType( tpe, rs, session ).asInstanceOf[R]
          def updateResult(profile: BasicProfile, rs: PositionedResult, value: R): Unit = ???
          def setParameter(profile: BasicProfile, ps: PositionedParameters, value: Option[R]): Unit = ???
          def getLinearizedNodes: IndexedSeq[Node] = ???
        }
        def canBuildFrom: CanBuildFrom[Nothing, R, Vector[R]] = implicitly[CanBuildFrom[Nothing, R, Vector[R]]]
    }
    new driver.QueryExecutor[Vector[R]](new QueryBuilderInput(cstate, linearizer)).run(session)
  }
  protected[slick] def toSql( queryable:BaseQueryable[_], session:Session ) = {
    val (_,cstate) = queryable2cstate( queryable, session )
    val builder = driver.createQueryBuilder(new QueryBuilderInput(cstate, null))
    builder.buildSelect.sql
  }
  protected[slick] def toQuery(queryable:BaseQueryable[_]) : (Type,this.Query) = queryable.expr_or_typetag match {
    case Right((typetag,classtag)) => (typetag.tpe, this.typetagToQuery( typetag ))
    case Left(expr_)    =>
        val (tpe,query) = this.toQuery(expr_.tree)
        val args = tpe match { case TypeRef(_,_,args_) => args_ }
        (args(0), query)
  }

  def toList[T]( queryable:BaseQueryable[T] ) : List[T] = {
    import this.driver.Implicit._
    val (_,query) = this.toQuery(queryable)
    val node = query.node : scala.slick.ast.Node
    null
  }
}


text:
package com.github.toastshaman.pitest.model;

import com.google.common.base.Preconditions;

import java.util.Map;

public class TodoItem {

    public final String id;
    public final String user;
    public final String category;
    public final String subject;
    public final String description;

    public TodoItem(String id, String user, String category, String subject, String description) {
        this.id = id;
        this.user = user;
        this.category = category;
        this.subject = subject;
        this.description = description;
    }

    public static TodoItem from(Map data) {
        Preconditions.checkNotNull(data);
        String id = required("id", data);
        String user = required("user", data);
        String category = required("category", data);
        String subject = required("subject", data);
        String description = required("description", data);
        return new TodoItem(id, user, category, subject, description);
    }

    private static String required(String key, Map data) {
        Preconditions.checkArgument(data.containsKey(key));
        return (String) data.get(key);
    }
}


text:
<!DOCTYPE html>

    <title>Functions  Reference</title>
    <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="css/highlight.css" />
    <meta charset='utf-8'>

 Docs (50% documented)

         Reference

        Functions  Reference

            Classes

                Authentication

                Comment

                Location

                Media

                Pagination

                Promise

                Tag

                User

            Enums

                RelationshipAction

                Scope

            Functions

                register(_:secret:redirectURI:)

            Protocols

                JSONConvertible

            Structs

                UserDefaults

Functions

The following functions are available globally.

                    register(_:secret:redirectURI:)

Register with necessary information.

Declaration

Swift

public func register(clientId: String, secret: String, redirectURI: String)

Parameters

                                clientId

Instagram client id.

                                secret

Instagram client secret.

                                redirectURI

Instagram redirect uri.

© 2016 . All rights reserved. (Last updated: 2016-05-16)

Generated by jazzy ♪♫ v0.6.0, a Realm project.


text:
<?php

namespace Dotdigitalgroup\Email\Model\Sync;

use Magento\Framework\App\Config\ScopeConfigInterface;
use Dotdigitalgroup\Email\Model\Sales\OrderFactory;

/**
 * Sync Reviews.
 */
class Review implements SyncInterface
{
    /**
     * @var mixed
     */
    private $start;

    /**
     * @var array
     */
    private $reviews;

    /**
     * @var int
     */
    private $countReviews;

    /**
     * @var \Dotdigitalgroup\Email\Helper\Data
     */
    private $helper;

    /**
     * @var array
     */
    private $reviewIds;

    /**
     * @var \Dotdigitalgroup\Email\Model\ImporterFactory
     */
    private $importerFactory;

    /**
     * @var \Dotdigitalgroup\Email\Model\Customer\ReviewFactory
     */
    private $connectorReviewFactory;

    /**
     * @var \Dotdigitalgroup\Email\Model\Customer\Review\RatingFactory
     */
    private $ratingFactory;

    /**
     * @var \Dotdigitalgroup\Email\Model\ResourceModel\Review\CollectionFactory
     */
    private $reviewCollection;

    /**
     * @var \Magento\Framework\Stdlib\DateTime\DateTime
     */
    private $coreDate;

    /**
     * @var \Dotdigitalgroup\Email\Model\ResourceModel\ReviewFactory
     */
    private $reviewResourceFactory;

    /**
     * @var ScopeConfigInterface
     */
    private $scopeConfig;

    /**
     * @var OrderFactory
     */
    private $orderFactory;

    /**
     * Review constructor.
     *
     * @param \Dotdigitalgroup\Email\Model\ResourceModel\Review\CollectionFactory $reviewCollection
     * @param \Magento\Framework\Stdlib\DateTime\DateTime $coreDate
     * @param \Dotdigitalgroup\Email\Model\Customer\Review\RatingFactory $ratingFactory
     * @param \Dotdigitalgroup\Email\Model\Customer\ReviewFactory $connectorFactory
     * @param \Dotdigitalgroup\Email\Model\ImporterFactory $importerFactory
     * @param \Dotdigitalgroup\Email\Helper\Data $data
     * @param \Dotdigitalgroup\Email\Model\ResourceModel\ReviewFactory $reviewResourceFactory
     * @param ScopeConfigInterface $scopeConfig
     * @param OrderFactory $orderFactory
     */
    public function __construct(
        \Dotdigitalgroup\Email\Model\ResourceModel\Review\CollectionFactory $reviewCollection,
        \Magento\Framework\Stdlib\DateTime\DateTime $coreDate,
        \Dotdigitalgroup\Email\Model\Customer\Review\RatingFactory $ratingFactory,
        \Dotdigitalgroup\Email\Model\Customer\ReviewFactory $connectorFactory,
        \Dotdigitalgroup\Email\Model\ImporterFactory $importerFactory,
        \Dotdigitalgroup\Email\Helper\Data $data,
        \Dotdigitalgroup\Email\Model\ResourceModel\ReviewFactory $reviewResourceFactory,
        ScopeConfigInterface $scopeConfig,
        OrderFactory $orderFactory
    ) {
        $this->coreDate               = $coreDate;
        $this->reviewCollection       = $reviewCollection;
        $this->ratingFactory          = $ratingFactory;
        $this->connectorReviewFactory = $connectorFactory;
        $this->importerFactory        = $importerFactory;
        $this->helper                 = $data;
        $this->reviewResourceFactory  = $reviewResourceFactory;
        $this->scopeConfig = $scopeConfig;
        $this->orderFactory = $orderFactory;
    }

    /**
     * Sync
     * - Create campaigns for review automations
     * - Sync reviews to Engagement Cloud
     *
     * @param \DateTime|null $from
     * @return array
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    public function sync(\DateTime $from = null)
    {
        $this->orderFactory->create()
            ->createReviewCampaigns();

        return $this->syncReviews();
    }

    /**
     * Sync.
     *
     * @return array
     * @throws \Magento\Framework\Exception\LocalizedException
     */
    private function syncReviews()
    {
        $response = ['success' => true, 'message' => 'Done.'];

        $limit = $this->scopeConfig->getValue(
            \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_TRANSACTIONAL_DATA_SYNC_LIMIT
        );

        $this->countReviews = 0;
        $this->reviews      = [];
        $this->start        = microtime(true);
        $websites           = $this->helper->getwebsites(true);
        foreach ($websites as $website) {
            $apiEnabled = $this->helper->isEnabled($website);
            $reviewEnabled = $this->helper->getWebsiteConfig(
                \Dotdigitalgroup\Email\Helper\Config::XML_PATH_CONNECTOR_SYNC_REVIEW_ENABLED,
                $website
            );
            $storeIds = $website->getStoreIds();
            if ($apiEnabled && $reviewEnabled && !empty($storeIds)) {
                $this->_exportReviewsForWebsite($website, $limit);
            }

            if (isset($this->reviews[$website->getId()])) {
                $reviews = $this->reviews[$website->getId()];
                //send reviews as transactional data
                //register in queue with importer
                $this->importerFactory->create()
                    ->registerQueue(
                        \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_REVIEWS,
                        $reviews,
                        \Dotdigitalgroup\Email\Model\Importer::MODE_BULK,
                        $website->getId()
                    );
                //if no error then set imported
                $this->_setImported($this->reviewIds);
                $this->countReviews += count($reviews);
            }
        }

        $message = '----------- Review sync ----------- : ' .
            gmdate('H:i:s', (int) (microtime(true) - $this->start)) .
            ', synced = ' . $this->countReviews;

        if ($this->countReviews) {
            $this->helper->log($message);
        }

        $response['message'] = $message;

        return $response;
    }

    /**
     * Export reviews for website.
     *
     * @param \Magento\Store\Model\Website $website
     * @param string|int $limit
     * @return void
     */
    public function _exportReviewsForWebsite(\Magento\Store\Model\Website $website, $limit)
    {
        $emailReviews = $this->_getReviewsToExport($website, $limit);
        $this->reviewIds = [];

        if (!empty($emailReviews)) {
            $reviewResourceFactory = $this->reviewResourceFactory->create();
            $reviews = $reviewResourceFactory->getMageReviewsByIds(array_keys($emailReviews));

            foreach ($reviews as $mageReview) {
                try {
                    $storeId = $emailReviews[$mageReview->getId()]['store_id'];
                    $mageReview->setStoreId($storeId);

                    $product = $reviewResourceFactory
                        ->getProductByIdAndStore(
                            $mageReview->getEntityPkValue(),
                            $storeId
                        );

                    $connectorReview = $this->connectorReviewFactory->create()
                        ->setReviewData($mageReview)
                        ->setProduct($product);

                    $votesCollection = $reviewResourceFactory
                        ->getVoteCollectionByReview($mageReview->getReviewId());

                    foreach ($votesCollection as $ratingItem) {
                        $rating = $this->ratingFactory->create()
                            ->setRating($ratingItem);
                        $connectorReview->createRating(
                            $ratingItem->getRatingCode(),
                            $rating
                        );
                    }
                    $this->reviews[$website->getId()][$connectorReview->getId()] = $connectorReview->expose();
                    $this->reviewIds[]                  = $mageReview->getReviewId();
                } catch (\Exception $e) {
                    $this->helper->debug((string)$e, []);
                }
            }
        }
    }

    /**
     * Get reviews for export.
     *
     * @param \Magento\Store\Model\Website $website
     * @param int $limit
     * @return array
     */
    private function _getReviewsToExport(\Magento\Store\Model\Website $website, $limit = 100)
    {
        $reviews = [];
        $collection = $this->reviewCollection->create()
            ->getReviewsToExportByWebsite($website, $limit);

        foreach ($collection as $review) {
            $reviews[$review->getReviewId()] = [
                "store_id" => $review->getStoreId()
            ];
        }
        return $reviews;
    }

    /**
     * Set imported in bulk query.
     *
     * @param array $ids
     *
     * @return null
     */
    public function _setImported($ids)
    {
        $nowDate = $this->coreDate->gmtDate();
        $this->reviewResourceFactory->create()
            ->setImported($ids, $nowDate);
    }
}


text:
<!DOCTYPE html>

        <title>Atlant - Responsive Bootstrap Admin Template</title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />

        <link rel="icon" href="favicon.ico" type="image/x-icon" />

        <link rel="stylesheet" type="text/css" id="theme" href="css/theme-default.css"/>

                        ATLANT

John Doe

Web Developer/Designer

Navigation

                         Dashboard

                         Pages

 Gallery

 Profile

 Address Book

                                 Timeline

 Default

 Full Width

                                 Mailbox

 Inbox

 Message

 Compose

 Messages

 Calendar

 Tasks

 Content Table

 FAQ

 Search

                                 Blog

 List of Posts

Single Post

                                 Login

App Login

Website Login

 Website Login Light

                                 Error Pages

Error 404 Sample 1

Error 404 Sample 2

 Error 500

                         Layouts

Boxed

Navigation Toggled

Navigation Top

Navigation Right

Top Navigation Fixed

Custom Navigation

Frame Left Column

Frame Right Column

Search Left Side

Blank Page

Components

                         UI Kits

 Widgets

 Elements

 Buttons

 Panels

 Icons
+679

 Typography

 Portlet

 Sliders

 Alerts & Popups

 Lists

 Tour

                         Forms

                                 Form Layouts

New

 One Column

 Two Column

 Tabbed

 Separated Rows

 Elements

 Validation

 Wizards

 WYSIWYG Editors

 File Handling

                         Tables

 Basic

 Data Tables

 Export Tables

                         Charts

Morris

NVD3

Rickshaw

Other

                         Maps

                         Navigation Levels

                                Second Level

                                        Third Level

                                                Fourth Level

Fifth Level

                        <form role="form">
                            <input type="text" name="search" placeholder="Search..."/>
                        </form>

4

 Messages

                                    4 new

                                    John Doe

Praesent placerat tellus id augue condimentum

                                    Dmitry Ivaniuk

Donec risus sapien, sagittis et magna quis

                                    Nadia Ali

Mauris vel eros ut nunc rhoncus cursus sed

                                    Darth Vader

I want my money back!

                                Show all messages

3

 Tasks

                                    3 active

                                    Phasellus augue arcu, elementum

50%

                                    John Doe, 25 Sep 2014 / 50%

                                    Aenean ac cursus

80%

                                    Dmitry Ivaniuk, 24 Sep 2014 / 80%

                                    Lorem ipsum dolor

95%

                                    John Doe, 23 Sep 2014 / 95%

                                    Cras suscipit ac quam at tincidunt.

100%

                                    John Doe, 21 Sep 2014 / Done

                                Show all tasks

Home

Layouts

Frame Left Column

 Frame Title

                            <button class="btn btn-default content-frame-left-toggle"></button>

Left Column

                                Left side disappear on mobile devices, and can be shown by pressing toggle button.

Responsive Body

                                This is responsive frame body. Can be used for all elements of template.

 Log Out ?

Are you sure you want to log out?

Press No if youwant to continue work. Press Yes to logout current user.

                            Yes
                            <button class="btn btn-default btn-lg mb-control-close">No</button>

        <audio id="audio-alert" src="audio/alert.mp3" preload="auto"></audio>
        <audio id="audio-fail" src="audio/fail.mp3" preload="auto"></audio>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Configuration;
using Imgix_CSharp;
using Sitecore.Resources.Media;

namespace Sitecore.S3.MediaLibrary
{
    public class RewriteUrl
    {
        public void Process(GetMediaStreamPipelineArgs args)
        {
            if (args.MediaData.Extension.Equals("PNG"))
            {
                var builder = new UrlBuilder("bensterrett.imgix.net")
                {
                    SignKey = WebConfigurationManager.AppSettings["imgixSecret"]
                };

                HttpContext.Current.Response.Redirect(builder.BuildUrl(HttpUtility.UrlEncode(args.MediaData.MediaItem.ID.ToString())));

                args.AbortPipeline();
            }
        }
    }
}


text:
export connectReget, {RegetProvider} from './connectReget'

export AutoRunner from './AutoRunner'

export Reget from './Reget'
export CacheStore from './CacheStore'
export CallContext from './CallContext'

export compose from './compose'
export mount from './mount'
export route from './route'
export toMiddleware from './toMiddleware'

export SyncPromise from './SyncPromise'

function onceWarning(func, msg) {
  let deprecateWarned = false
  return function wrap() {
    if (!deprecateWarned) {
      deprecateWarned = true
      console.warn(msg)
    }
    return func.apply(null, arguments)
  }
}

import _browserMiddleware from './middlewares/browser'
import _cacheMiddleware from './middlewares/cache'
import _localStorageMiddleware from './middlewares/localStorage'
import _cookieMiddleware from './middlewares/cookie'
import _koaCookieMiddleware from './middlewares/koaCookie'

export const browserMiddleware = onceWarning(_browserMiddleware, 'Please use import browser from \'reget/lib/middlewares/browser\'')
export const cacheMiddleware = onceWarning(_cacheMiddleware, 'Please use import cache from \'reget/lib/middlewares/cache\'')
export const localStorageMiddleware = onceWarning(_localStorageMiddleware, 'Please use import localStorage from \'reget/lib/middlewares/localStorage\'')
export const cookieMiddleware = onceWarning(_cookieMiddleware, 'Please use import cookie from \'reget/lib/middlewares/cookie\'')
export const koaCookieMiddleware = onceWarning(_koaCookieMiddleware, 'Please use import koaCookie from \'reget/lib/middlewares/koaCookie\'')


text:
package org.apache.geronimo.jaxws.provider;

public class WebProviderTest extends ProviderTest {

    protected String getTestServlet() {
        return "/test-provider-web";
    }
}


text:
package godoc

import (
	"net/http"
	"runtime"
)

// Page describes the contents of the top-level godoc webpage.
type Page struct {
	Title    string
	Tabtitle string
	Subtitle string
	Query    string
	Body     []byte
	Share    bool

	// filled in by servePage
	SearchBox  bool
	Playground bool
	Version    string
}

func (p *Presentation) ServePage(w http.ResponseWriter, page Page) {
	if page.Tabtitle == "" {
		page.Tabtitle = page.Title
	}
	page.SearchBox = p.Corpus.IndexEnabled
	page.Playground = p.ShowPlayground
	page.Version = runtime.Version()
	applyTemplateToResponseWriter(w, p.GodocHTML, page)
}

func (p *Presentation) ServeError(w http.ResponseWriter, r *http.Request, relpath string, err error) {
	w.WriteHeader(http.StatusNotFound)
	p.ServePage(w, Page{
		Title:    "File " + relpath,
		Subtitle: relpath,
		Body:     applyTemplate(p.ErrorHTML, "errorHTML", err), // err may contain an absolute path!
		Share:    allowShare(r),
	})
}

var onAppengine = false // overriden in appengine.go when on app engine

func allowShare(r *http.Request) bool {
	if !onAppengine {
		return true
	}
	switch r.Header.Get("X-AppEngine-Country") {
	case "", "ZZ", "HK", "CN", "RC":
		return false
	}
	return true
}


text:
from fontbakery.profiles.universal import UNIVERSAL_PROFILE_CHECKS
from fontbakery.section import Section
from fontbakery.status import WARN, PASS #, INFO, ERROR, SKIP, FAIL
from fontbakery.callable import check #, disable
from fontbakery.message import Message
from fontbakery.fonts_profile import profile_factory
from fontbakery.constants import (PlatformID,
                                  WindowsEncodingID,
                                  UnicodeEncodingID,
                                  MacintoshEncodingID)

from .googlefonts_conditions import * # pylint: disable=wildcard-import,unused-wildcard-import
profile_imports = ('fontbakery.profiles.universal',) # Maybe this should be .googlefonts instead...
profile = profile_factory(default_section=Section("Noto Fonts"))

# Maybe this should be GOOGLEFONTS_PROFILE_CHECKS instead...
NOTOFONTS_PROFILE_CHECKS = \
    UNIVERSAL_PROFILE_CHECKS + [
    'com.google.fonts/check/cmap/unexpected_subtables',
    'com.google.fonts/check/unicode_range_bits',
]

@check(
    id = 'com.google.fonts/check/cmap/unexpected_subtables',
    rationale = """
        There are just a few typical types of cmap subtables that are used in fonts.
        If anything different is declared in a font, it will be treated as a FAIL.
    """,
    proposal = 'https://github.com/googlefonts/fontbakery/issues/2676'
)
def com_google_fonts_check_cmap_unexpected_subtables(ttFont):
    """Ensure all cmap subtables are the typical types expected in a font."""
    from fontbakery.profiles.shared_conditions import is_cjk_font

    passed = True
    # Note:
    #   Format 0 = Byte encoding table
    #   Format 4 = Segment mapping to delta values
    #   Format 6 = Trimmed table mapping
    #   Format 12 = Segmented coverage
    #   Format 14 = Unicode Variation Sequences
    EXPECTED_SUBTABLES = [
        ( 0, PlatformID.MACINTOSH, MacintoshEncodingID.ROMAN),     # 13.7% of GFonts TTFs (389 files)
        #( 4, PlatformID.MACINTOSH, MacintoshEncodingID.ROMAN),     # only the Sansation family has this on GFonts
        ( 6, PlatformID.MACINTOSH, MacintoshEncodingID.ROMAN),     # 38.1% of GFonts TTFs (1.082 files)
        #( 4, PlatformID.UNICODE,   UnicodeEncodingID.UNICODE_1_0), # only the Gentium family has this on GFonts
        #(12, PlatformID.UNICODE, 10), # INVALID? - only the Overpass family and SawarabiGothic-Regular has this on GFonts
        # -----------------------------------------------------------------------
        ( 4, PlatformID.WINDOWS, WindowsEncodingID.UNICODE_BMP),                 # Absolutely all GFonts TTFs have this table :-)
        (12, PlatformID.WINDOWS, WindowsEncodingID.UNICODE_FULL_REPERTOIRE),     #   5.7% of GFonts TTFs (162 files)
        (14, PlatformID.UNICODE, UnicodeEncodingID.UNICODE_VARIATION_SEQUENCES), #   1.1% - Only 4 families (30 TTFs),
                                                                                #          including SourceCodePro, have this on GFonts
        ( 4, PlatformID.UNICODE, UnicodeEncodingID.UNICODE_2_0_BMP_ONLY),        #  97.0% of GFonts TTFs (only 84 files lack it)
        (12, PlatformID.UNICODE, UnicodeEncodingID.UNICODE_2_0_FULL)             #   2.9% of GFonts TTFs (82 files)
    ]
    if is_cjk_font(ttFont):
        EXPECTED_SUBTABLES.extend([
            # Adobe says historically some programs used these to identify
            # the script in the font.  The encodingID is the quickdraw
            # script manager code.  These are dummy tables.
            (6, PlatformID.MACINTOSH, MacintoshEncodingID.JAPANESE),
            (6, PlatformID.MACINTOSH, MacintoshEncodingID.CHINESE_TRADITIONAL),
            (6, PlatformID.MACINTOSH, MacintoshEncodingID.KOREAN),
            (6, PlatformID.MACINTOSH, MacintoshEncodingID.CHINESE_SIMPLIFIED)
        ])

    for subtable in ttFont['cmap'].tables:
        if (subtable.format,
            subtable.platformID,
            subtable.platEncID) not in EXPECTED_SUBTABLES:
            passed = False
            yield WARN,\
                  Message("unexpected-subtable",
                          f"'cmap' has a subtable of"
                          f" (format={subtable.format}, platform={subtable.platformID},"
                          f" encoding={subtable.platEncID}), which it shouldn't have.")
    if passed:
        yield PASS, "All cmap subtables look good!"

@check(
    id = 'com.google.fonts/check/unicode_range_bits',
    rationale = """
        When the UnicodeRange bits on the OS/2 table are not properly set, some programs running on Windows may not recognize the font and use a system fallback font instead. For that reason, this check calculates the proper settings by inspecting the glyphs declared on the cmap table and then ensures that their corresponding ranges are enabled.
    """,
    conditions = ["unicoderange",
                  "preferred_cmap"],
    proposal = 'https://github.com/googlefonts/fontbakery/issues/2676'
)
def com_google_fonts_check_unicode_range_bits(ttFont, unicoderange, preferred_cmap):
    """Ensure UnicodeRange bits are properly set."""
    from fontbakery.constants import UNICODERANGE_DATA
    from fontbakery.utils import (compute_unicoderange_bits,
                                  unicoderange_bit_name,
                                  chars_in_range)
    expected_unicoderange = compute_unicoderange_bits(ttFont)
    difference = unicoderange ^ expected_unicoderange
    if not difference:
        yield PASS, "Looks good!"
    else:
        for bit in range(128):
            if difference & (1 << bit):
                range_name = unicoderange_bit_name(bit)
                num_chars = len(chars_in_range(ttFont, bit))
                range_size = sum(entry[3] - entry[2] + 1 for entry in UNICODERANGE_DATA[bit])
                set_unset = "1"
                if num_chars == 0:
                    set_unset = "0"
                    num_chars = "none"
                yield WARN, \
                      Message("bad-range-bit",
                              f'UnicodeRange bit {bit} "{range_name}" should be {set_unset} because'
                              f' cmap has {num_chars} of the {range_size} codepoints in this range.')

profile.auto_register(globals())
profile.test_expected_checks(NOTOFONTS_PROFILE_CHECKS, exclusive=True)


text:
<?php
Class User extends CI_Model
{
 function login($email, $password)
 {
   $this -> db -> select('email, password');
   $this -> db -> from('customer');
   $this -> db -> where('email', $email);
   $this -> db -> where('password', md5($password));
   $this -> db -> limit(1);

   $query = $this -> db -> get();

   if($query -> num_rows() == 1)
   {
     return $query->result();
   }
   else
   {
     return false;
   }
 }
 function reg(){
    $data = array(
      'name' => $this -> input ->post('name'),
      'address' => $this -> input ->post('address'),
      'district' => $this -> input ->post('district'),
      'contact_no' => $this -> input ->post('contact_no'),
      'email' => $this -> input ->post('email'),
      'password' => md5($this -> input ->post('password'))

            );
    $insert = $this -> db -> insert('customer', $data);
    return $insert;
 }

 function updateprofile($username){

    $data = array(
      'name' => $this -> input ->post('name'),
      'address' => $this -> input ->post('address'),
      'district' => $this -> input ->post('district'),
      'contact_no' => $this -> input ->post('contact_no'),
        'imgurl' => $this -> input ->post('imgurl'),
      'password' => md5($this -> input ->post('password'))

    );

    $this-> db ->where('email', $username);
    $this-> db ->update('customer', $data);

 }
 function getOne($username){
    $query=$this->db->query("SELECT * FROM customer WHERE email = '$username'");
    return $query->result();
}

}
?>


text:
/*
 * ATAPI Masks
 */

#ifndef __BFIN_PERIPHERAL_PATA__
#define __BFIN_PERIPHERAL_PATA__

/* Bit masks for ATAPI_CONTROL */
#define                 PIO_START  0x1        /* Start PIO/Reg Op */
#define               MULTI_START  0x2        /* Start Multi-DMA Op */
#define               ULTRA_START  0x4        /* Start Ultra-DMA Op */
#define                  XFER_DIR  0x8        /* Transfer Direction */
#define                  IORDY_EN  0x10       /* IORDY Enable */
#define                FIFO_FLUSH  0x20       /* Flush FIFOs */
#define                  SOFT_RST  0x40       /* Soft Reset */
#define                   DEV_RST  0x80       /* Device Reset */
#define                TFRCNT_RST  0x100      /* Trans Count Reset */
#define               END_ON_TERM  0x200      /* End/Terminate Select */
#define               PIO_USE_DMA  0x400      /* PIO-DMA Enable */
#define          UDMAIN_FIFO_THRS  0xf000     /* Ultra DMA-IN FIFO Threshold */

/* Bit masks for ATAPI_STATUS */
#define               PIO_XFER_ON  0x1        /* PIO transfer in progress */
#define             MULTI_XFER_ON  0x2        /* Multi-word DMA transfer in progress */
#define             ULTRA_XFER_ON  0x4        /* Ultra DMA transfer in progress */
#define               ULTRA_IN_FL  0xf0       /* Ultra DMA Input FIFO Level */

/* Bit masks for ATAPI_DEV_ADDR */
#define                  DEV_ADDR  0x1f       /* Device Address */

/* Bit masks for ATAPI_INT_MASK */
#define        ATAPI_DEV_INT_MASK  0x1        /* Device interrupt mask */
#define             PIO_DONE_MASK  0x2        /* PIO transfer done interrupt mask */
#define           MULTI_DONE_MASK  0x4        /* Multi-DMA transfer done interrupt mask */
#define          UDMAIN_DONE_MASK  0x8        /* Ultra-DMA in transfer done interrupt mask */
#define         UDMAOUT_DONE_MASK  0x10       /* Ultra-DMA out transfer done interrupt mask */
#define       HOST_TERM_XFER_MASK  0x20       /* Host terminate current transfer interrupt mask */
#define           MULTI_TERM_MASK  0x40       /* Device terminate Multi-DMA transfer interrupt mask */
#define          UDMAIN_TERM_MASK  0x80       /* Device terminate Ultra-DMA-in transfer interrupt mask */
#define         UDMAOUT_TERM_MASK  0x100      /* Device terminate Ultra-DMA-out transfer interrupt mask */

/* Bit masks for ATAPI_INT_STATUS */
#define             ATAPI_DEV_INT  0x1        /* Device interrupt status */
#define              PIO_DONE_INT  0x2        /* PIO transfer done interrupt status */
#define            MULTI_DONE_INT  0x4        /* Multi-DMA transfer done interrupt status */
#define           UDMAIN_DONE_INT  0x8        /* Ultra-DMA in transfer done interrupt status */
#define          UDMAOUT_DONE_INT  0x10       /* Ultra-DMA out transfer done interrupt status */
#define        HOST_TERM_XFER_INT  0x20       /* Host terminate current transfer interrupt status */
#define            MULTI_TERM_INT  0x40       /* Device terminate Multi-DMA transfer interrupt status */
#define           UDMAIN_TERM_INT  0x80       /* Device terminate Ultra-DMA-in transfer interrupt status */
#define          UDMAOUT_TERM_INT  0x100      /* Device terminate Ultra-DMA-out transfer interrupt status */

/* Bit masks for ATAPI_LINE_STATUS */
#define                ATAPI_INTR  0x1        /* Device interrupt to host line status */
#define                ATAPI_DASP  0x2        /* Device dasp to host line status */
#define                ATAPI_CS0N  0x4        /* ATAPI chip select 0 line status */
#define                ATAPI_CS1N  0x8        /* ATAPI chip select 1 line status */
#define                ATAPI_ADDR  0x70       /* ATAPI address line status */
#define              ATAPI_DMAREQ  0x80       /* ATAPI DMA request line status */
#define             ATAPI_DMAACKN  0x100      /* ATAPI DMA acknowledge line status */
#define               ATAPI_DIOWN  0x200      /* ATAPI write line status */
#define               ATAPI_DIORN  0x400      /* ATAPI read line status */
#define               ATAPI_IORDY  0x800      /* ATAPI IORDY line status */

/* Bit masks for ATAPI_SM_STATE */
#define                PIO_CSTATE  0xf        /* PIO mode state machine current state */
#define                DMA_CSTATE  0xf0       /* DMA mode state machine current state */
#define             UDMAIN_CSTATE  0xf00      /* Ultra DMA-In mode state machine current state */
#define            UDMAOUT_CSTATE  0xf000     /* ATAPI IORDY line status */

/* Bit masks for ATAPI_TERMINATE */
#define           ATAPI_HOST_TERM  0x1        /* Host terminationation */

/* Bit masks for ATAPI_REG_TIM_0 */
#define                    T2_REG  0xff       /* End of cycle time for register access transfers */
#define                  TEOC_REG  0xff00     /* Selects DIOR/DIOW pulsewidth */

/* Bit masks for ATAPI_PIO_TIM_0 */
#define                    T1_REG  0xf        /* Time from address valid to DIOR/DIOW */
#define                T2_REG_PIO  0xff0      /* DIOR/DIOW pulsewidth */
#define                    T4_REG  0xf000     /* DIOW data hold */

/* Bit masks for ATAPI_PIO_TIM_1 */
#define              TEOC_REG_PIO  0xff       /* End of cycle time for PIO access transfers. */

/* Bit masks for ATAPI_MULTI_TIM_0 */
#define                        TD  0xff       /* DIOR/DIOW asserted pulsewidth */
#define                        TM  0xff00     /* Time from address valid to DIOR/DIOW */

/* Bit masks for ATAPI_MULTI_TIM_1 */
#define                       TKW  0xff       /* Selects DIOW negated pulsewidth */
#define                       TKR  0xff00     /* Selects DIOR negated pulsewidth */

/* Bit masks for ATAPI_MULTI_TIM_2 */
#define                        TH  0xff       /* Selects DIOW data hold */
#define                      TEOC  0xff00     /* Selects end of cycle for DMA */

/* Bit masks for ATAPI_ULTRA_TIM_0 */
#define                      TACK  0xff       /* Selects setup and hold times for TACK */
#define                      TENV  0xff00     /* Selects envelope time */

/* Bit masks for ATAPI_ULTRA_TIM_1 */
#define                      TDVS  0xff       /* Selects data valid setup time */
#define                 TCYC_TDVS  0xff00     /* Selects cycle time - TDVS time */

/* Bit masks for ATAPI_ULTRA_TIM_2 */
#define                       TSS  0xff       /* Selects time from STROBE edge to negation of DMARQ or assertion of STOP */
#define                      TMLI  0xff00     /* Selects interlock time */

/* Bit masks for ATAPI_ULTRA_TIM_3 */
#define                      TZAH  0xff       /* Selects minimum delay required for output */
#define               READY_PAUSE  0xff00     /* Selects ready to pause */

/* Bit masks for ATAPI_CONTROL */
#define                 PIO_START  0x1        /* Start PIO/Reg Op */
#define               MULTI_START  0x2        /* Start Multi-DMA Op */
#define               ULTRA_START  0x4        /* Start Ultra-DMA Op */
#define                  XFER_DIR  0x8        /* Transfer Direction */
#define                  IORDY_EN  0x10       /* IORDY Enable */
#define                FIFO_FLUSH  0x20       /* Flush FIFOs */
#define                  SOFT_RST  0x40       /* Soft Reset */
#define                   DEV_RST  0x80       /* Device Reset */
#define                TFRCNT_RST  0x100      /* Trans Count Reset */
#define               END_ON_TERM  0x200      /* End/Terminate Select */
#define               PIO_USE_DMA  0x400      /* PIO-DMA Enable */
#define          UDMAIN_FIFO_THRS  0xf000     /* Ultra DMA-IN FIFO Threshold */

/* Bit masks for ATAPI_STATUS */
#define               PIO_XFER_ON  0x1        /* PIO transfer in progress */
#define             MULTI_XFER_ON  0x2        /* Multi-word DMA transfer in progress */
#define             ULTRA_XFER_ON  0x4        /* Ultra DMA transfer in progress */
#define               ULTRA_IN_FL  0xf0       /* Ultra DMA Input FIFO Level */

/* Bit masks for ATAPI_DEV_ADDR */
#define                  DEV_ADDR  0x1f       /* Device Address */

/* Bit masks for ATAPI_INT_MASK */
#define        ATAPI_DEV_INT_MASK  0x1        /* Device interrupt mask */
#define             PIO_DONE_MASK  0x2        /* PIO transfer done interrupt mask */
#define           MULTI_DONE_MASK  0x4        /* Multi-DMA transfer done interrupt mask */
#define          UDMAIN_DONE_MASK  0x8        /* Ultra-DMA in transfer done interrupt mask */
#define         UDMAOUT_DONE_MASK  0x10       /* Ultra-DMA out transfer done interrupt mask */
#define       HOST_TERM_XFER_MASK  0x20       /* Host terminate current transfer interrupt mask */
#define           MULTI_TERM_MASK  0x40       /* Device terminate Multi-DMA transfer interrupt mask */
#define          UDMAIN_TERM_MASK  0x80       /* Device terminate Ultra-DMA-in transfer interrupt mask */
#define         UDMAOUT_TERM_MASK  0x100      /* Device terminate Ultra-DMA-out transfer interrupt mask */

/* Bit masks for ATAPI_INT_STATUS */
#define             ATAPI_DEV_INT  0x1        /* Device interrupt status */
#define              PIO_DONE_INT  0x2        /* PIO transfer done interrupt status */
#define            MULTI_DONE_INT  0x4        /* Multi-DMA transfer done interrupt status */
#define           UDMAIN_DONE_INT  0x8        /* Ultra-DMA in transfer done interrupt status */
#define          UDMAOUT_DONE_INT  0x10       /* Ultra-DMA out transfer done interrupt status */
#define        HOST_TERM_XFER_INT  0x20       /* Host terminate current transfer interrupt status */
#define            MULTI_TERM_INT  0x40       /* Device terminate Multi-DMA transfer interrupt status */
#define           UDMAIN_TERM_INT  0x80       /* Device terminate Ultra-DMA-in transfer interrupt status */
#define          UDMAOUT_TERM_INT  0x100      /* Device terminate Ultra-DMA-out transfer interrupt status */

/* Bit masks for ATAPI_LINE_STATUS */
#define                ATAPI_INTR  0x1        /* Device interrupt to host line status */
#define                ATAPI_DASP  0x2        /* Device dasp to host line status */
#define                ATAPI_CS0N  0x4        /* ATAPI chip select 0 line status */
#define                ATAPI_CS1N  0x8        /* ATAPI chip select 1 line status */
#define                ATAPI_ADDR  0x70       /* ATAPI address line status */
#define              ATAPI_DMAREQ  0x80       /* ATAPI DMA request line status */
#define             ATAPI_DMAACKN  0x100      /* ATAPI DMA acknowledge line status */
#define               ATAPI_DIOWN  0x200      /* ATAPI write line status */
#define               ATAPI_DIORN  0x400      /* ATAPI read line status */
#define               ATAPI_IORDY  0x800      /* ATAPI IORDY line status */

/* Bit masks for ATAPI_SM_STATE */
#define                PIO_CSTATE  0xf        /* PIO mode state machine current state */
#define                DMA_CSTATE  0xf0       /* DMA mode state machine current state */
#define             UDMAIN_CSTATE  0xf00      /* Ultra DMA-In mode state machine current state */
#define            UDMAOUT_CSTATE  0xf000     /* ATAPI IORDY line status */

/* Bit masks for ATAPI_TERMINATE */
#define           ATAPI_HOST_TERM  0x1        /* Host terminationation */

/* Bit masks for ATAPI_REG_TIM_0 */
#define                    T2_REG  0xff       /* End of cycle time for register access transfers */
#define                  TEOC_REG  0xff00     /* Selects DIOR/DIOW pulsewidth */

/* Bit masks for ATAPI_PIO_TIM_0 */
#define                    T1_REG  0xf        /* Time from address valid to DIOR/DIOW */
#define                T2_REG_PIO  0xff0      /* DIOR/DIOW pulsewidth */
#define                    T4_REG  0xf000     /* DIOW data hold */

/* Bit masks for ATAPI_PIO_TIM_1 */
#define              TEOC_REG_PIO  0xff       /* End of cycle time for PIO access transfers. */

/* Bit masks for ATAPI_MULTI_TIM_0 */
#define                        TD  0xff       /* DIOR/DIOW asserted pulsewidth */
#define                        TM  0xff00     /* Time from address valid to DIOR/DIOW */

/* Bit masks for ATAPI_MULTI_TIM_1 */
#define                       TKW  0xff       /* Selects DIOW negated pulsewidth */
#define                       TKR  0xff00     /* Selects DIOR negated pulsewidth */

/* Bit masks for ATAPI_MULTI_TIM_2 */
#define                        TH  0xff       /* Selects DIOW data hold */
#define                      TEOC  0xff00     /* Selects end of cycle for DMA */

/* Bit masks for ATAPI_ULTRA_TIM_0 */
#define                      TACK  0xff       /* Selects setup and hold times for TACK */
#define                      TENV  0xff00     /* Selects envelope time */

/* Bit masks for ATAPI_ULTRA_TIM_1 */
#define                      TDVS  0xff       /* Selects data valid setup time */
#define                 TCYC_TDVS  0xff00     /* Selects cycle time - TDVS time */

/* Bit masks for ATAPI_ULTRA_TIM_2 */
#define                       TSS  0xff       /* Selects time from STROBE edge to negation of DMARQ or assertion of STOP */
#define                      TMLI  0xff00     /* Selects interlock time */

/* Bit masks for ATAPI_ULTRA_TIM_3 */
#define                      TZAH  0xff       /* Selects minimum delay required for output */
#define               READY_PAUSE  0xff00     /* Selects ready to pause */

#endif /* __BFIN_PERIPHERAL_PATA__ */


text: ps -eLo pid,tid,psr,args | grep nested


text:
class Position < ActiveRecord::Base
  has_many :candidates
  has_many :vote

  def Position.select_options
    Position.all.map { |p| [ p.title, p.id] }
  end
end