text:
![Status](https://img.shields.io/badge/status-beta-yellow.svg)
[![GitHub version](https://badge.fury.io/gh/vitalets%2Fautotester.svg)](https://github.com/vitalets/autotester/releases/latest)
[![Build Status](https://travis-ci.org/vitalets/autotester.svg?branch=master)](https://travis-ci.org/vitalets/autotester)
[![Build status](https://ci.appveyor.com/api/projects/status/156yjw6614quusln/branch/master?svg=true)](https://ci.appveyor.com/project/vitalets/autotester/branch/master)
[![Sauce Test Status](https://saucelabs.com/buildstatus/vitalets1)](https://saucelabs.com/u/vitalets1)

Autotester is Chrome extension that allows to develop and run automation tests right in browser.
Tests are written in Javascript and can be executed over another tab of the same Chrome or any remote browser.

Tested in:
[![Sauce Test Status](https://saucelabs.com/browser-matrix/vitalets1.svg)](https://saucelabs.com/u/vitalets1)

## Contents
* [Demo](#demo)
* [Features](#features)
* [Project status](#project-status)
* [Installation](#installation)
* [Getting started](#getting-started)
* [Usage](#usage)
* [Roadmap](#roadmap)
* [Contribution](#contribution)
* [FAQ](#faq)
* [Links](#links)
* [License](#license)

## Demo

## Features
* **Zero setup**
  The setup is just drag-n-drop extension in chrome. No other stuff like Selenium, Node.js or Chromedriver is needed.

* **Convenient development**
  Developing tests right in browser has some advantages. You can edit tests in first tab and check results in second.
  You can easily run particular test to debug. You can keep tab open after tests to inspect with devtools.

* **Selenium compatible syntax**
  Tests syntax is compatible with [Selenium Javascript API](http://seleniumhq.github.io/selenium/docs/api/javascript/index.html)
  so it can be executed ether in nodejs and visa-versa (except custom commands).

* **Custom commands**
  Because tests are executed via extension all of rich [chrome extensions API](https://developer.chrome.com/extensions/api_index)
  are available. You can define custom commands to work with cookies, downloads, tabs, history etc and use it in your tests.

* **Capture network requests**
  Capturing network requests is working out of box. You can capture page loads, resources (img, script, etc),
  xhr/fetch requests and new tabs. No proxy needed. Please see [example](test/specs/extras/collect_network_requests_test.js).

* **Load tests from anywhere**
  Tests can be stored right in browser, local directory or loaded from any local/remote http server (for example GitHub).

* **Run tests on remote servers**
  Besides running tests in the same chrome instance it is possible to route commands to any selenium server.
  It can be [localhost](https://www.npmjs.com/package/selenium-standalone),
  [Sauce Labs](https://saucelabs.com), [BrowserStack](https://www.browserstack.com), etc.

* **Test other chrome extensions**
  With Autotester it is possible to attach to other extensions background pages for testing.
  Please see [example](test/specs/extras/extension_switching_test.js).

## Project status
Autotester is under **active development** now. Not all webdriver commands are supported. Yet.
And there can be bugs.
But feel free to try it and share your feedback or ideas in [issues](issues) - help us to make it better!

## Installation
1. Download and unpack latest [autotester.zip][1]
2. Drag-n-drop unpacked *autotester* directory on `chrome://extensions` page

## Getting started
Click extension button `A` in browser panel to open Autotester app.
Select `google_search` in dropdown and press **Run** to execute test. Look at the report.
Next, you can change test code or create new file and re-run again.

## Usage
Autotester supports [Selenium Javascript API](http://seleniumhq.github.io/selenium/docs/api/javascript/index.html)
for writing tests. Have a look on [Autotester self tests](test/specs).
Also there are some pre-defined globals available in tests for conveniency:
 * `Driver`
 * `By`
 * `until`
 * `Key`
 * `webdriver`
 * `console`
 * `require`

*More detailed tutorial is coming..*

## How does Autotester work?
When executing tests in the another tab of the same browser Autotester is utilizing
[Chrome Debugging Protocol](https://chromedevtools.github.io/debugger-protocol-viewer/1-2/) available via
[chrome.debugger.*](https://developer.chrome.com/extensions/debugger) extensions API.
It intercepts http requests going from [Selenium Javascript package](http://seleniumhq.github.io/selenium/docs/api/javascript/index.html)
to [W3C Webdriver endpoints](https://w3c.github.io/webdriver/webdriver-spec.html#list-of-endpoints) and loops them back to browser.
When executing tests over remote browser Autotester does not intercept http requests
letting them reach remote Selenium Server and waits for the results.

## Roadmap
There are many directions to grow. The current plan is following:

* implement rest of webdriver commands
* improve docs and tutorials
* add capabilities manager to visually configure targets
* integrate with other webdriver implementations (webdriverio, nightwatchjs, codeceptJS, spectron)
* integrate with Appium
* run tests in parallel
* improve tests editor: autocomplete, breakpoints, etc
* create tests automatically via recording user actions
* ...your idea?

## Contribution
If you have an idea how to fix bug or implement new feature - you are welcome to contribute.
Please see [CONTRIBUTING.md](CONTRIBUTING.md). Thanks for your support!

## FAQ

  What if I get error "Unsupported route command"?
     This error means that some Webdriver command is not implemented in Autotester yet.
     The workaround sometimes can be using `driver.executeScript` to achive the goal directly.
     For example, if `driver.getTitle()` is not implemented, you can retrieve title as:

     driver.executeScript(() => document.title);

Also please search issues for the same unsupported route and vote or create new one
 to let us know which commands you need most of all.

  Where to store tests?

1. You can create as many tests as you like and store them right in browser as snippets.
   This is the easiest way but less reliable: if you occasionally remove extension tests will be lost.
2. For more serious things it is recommended to serve tests from local or remote http server
   and keep them under version control.
3. The third option is to load tests from local directory without http server.
   For that you should create tests inside `/tests` directory of unpacked extension.

## Links
* [Selenium Javascript API](http://seleniumhq.github.io/selenium/docs/api/javascript/index.html)
* [W3C Webdriver](https://w3c.github.io/webdriver/webdriver-spec.html)
* [Chrome Debugger Protocol](https://chromedevtools.github.io/debugger-protocol-viewer)
* [Awesome Javascript Test Automation](https://github.com/atinfo/awesome-test-automation/blob/master/javascript-test-automation.md)
* [Awesome Selenium](https://github.com/christian-bromann/awesome-selenium)

## License
MIT @ [Vitaliy Potapov](https://github.com/vitalets)

[1]: https://github.com/vitalets/autotester/releases/download/v0.1.3/autotester.zip


text:
/**
 * Support and FAQ: visit Atmel Support
 */

#include <compiler.h>
#include <sleepmgr.h>
#include <sysclk.h>
#include <conf_oversampling.h>
#include <adc_oversampling.h>
#include <asf.h>

/**
 * \brief Static variable to store total ADC Offset value for total number
 *        of sample
 */
static int16_t adc_offset = 0;

/* ! \brief Static variable to store offset for single sample */
static int8_t adc_offset_one_sample = 0;

/* ! \brief Static variable to accumulate sampled ADC result */
static volatile int64_t adc_result_accumulator = 0;

/* ! \brief Static variable to to store single sampled ADC result */
static volatile int64_t adc_result_one_sample = 0;

/* ! \brief Static variable to process the accumulated sampled ADC results */
static int64_t adc_result_accum_processed = 0;

/* ! \brief Static variable to process the single ADC result */
static int64_t adc_result_one_sample_processed = 0;

/* ! \brief Static variable to keep number of samples for oversampling */
static volatile uint16_t adc_samplecount = 0;

/**
 * \brief Static variable to find analog value at ADC input after
 *        oversampling process
 */
static int64_t v_input = 0;

/**
 * \brief Static variable to find analog value at ADC Input
 *        without oversampling process
 */
static int64_t v_input_one_sample = 0;

/**
 * \brief Global variable/flag to indicate that one set of
 *         oversampling is done for start processing
 */
volatile bool adc_oversampled_flag = false;

/* ! \brief Static variable to keep ADC configuration parameters */
static struct adc_config adc_conf;

/* ! \brief Static variable to keep ADC channel configuration parameters */
static struct adc_channel_config adc_ch_conf;

/**
 * \brief Static buffer variable to store ASCII value of calculated input
 *        voltage for display
 */
static uint8_t v_input_ascii_buf[ASCII_BUFFER_SIZE] = {"+1.123456"};

/**
 * \brief Callback function for ADCB-CH0 interrupts
 *  - Interrupt is configured for Conversion Complete Interrupt
 *  - ADCA CH0 result is accumulated
 *  - ADC sample count is incremented
 *  - Check If ADC sample count reached up to number of oversampling required
 *  - If so, disable ADC interrupt and set flag to start oversampling process
 *
 * \param adc Pointer to ADC module.
 * \param ch_mask ADC channel mask.
 * \param result Conversion result from ADC channel.
 */
static void adc_handler(ADC_t *adc, uint8_t ch_mask, adc_result_t result)
{
	/*  Get Result from ADCB-CH0 Register and Accumulate */
	adc_result_accumulator +=  result;

	/* Increment sample count */
	adc_samplecount++;

	/* Check if sample count has reached oversample count */
	if (adc_samplecount >= ADC_OVER_SAMPLED_NUMBER) {
		/* Disable ADCB-CHO conversion complete interrupt until stored
		 * samples are processed
		 */
		adcch_disable_interrupt(&adc_ch_conf);
		adcch_write_configuration(&ADCB, ADC_CH0, &adc_ch_conf);

		/* Clear any pending interrupt request by clearing interrupt
		 * flag
		 */
		adc_clear_interrupt_flag(&ADCB, ADC_CH0);

		/*Set adc_oversampled_flag to start oversampling process from
		 * main function
		 */
		adc_oversampled_flag = true;

		/* Store single sample ADC result to find analog input without
		 * oversampling
		 */
		adc_result_one_sample = result;
	}
}

/**
 * \brief This function get the offset of the ADCB when it is configured
 *	      in signed mode
 *  \note The ADC must be configured and enabled before this function is run.
 * \return Offset on the ADCB
 */
static int8_t adc_offset_get_signed(void)
{
	int16_t offset = 0;
	uint8_t i;

	/* Sum four samples */
	for (i = 0; i < 4; i++) {
		/* Do one conversion to find offset */
		adc_start_conversion(&ADCB, ADC_CH0);
		adc_wait_for_interrupt_flag(&ADCB, ADC_CH0);

		/* Accumulate conversion results */
		offset += adc_get_result(&ADCB, ADC_CH0);
	}

	/* Return mean value */
	return ((int8_t)(offset / 4));
}

/**
 * \brief This Function converts a decimal value to ASCII
 *  - It will extract each digit from decimal value and add to
 *	  v_input_ascii_buf
 *  - It will take care to keep decimal point at correct position
 * \param buf_index Pointer to buffer used to store ASCII value.
 * \param dec_val Decimal to be converted as ASCII.
 */
static void convert_to_ascii(uint8_t *buf_index, uint64_t dec_val)
{
	uint8_t digit_count = 0;

	/* Loop through all digits to convert to ASCII */
	for (digit_count = 0; digit_count <= NUMBER_OF_DIGITS_IN_RESULT;
			digit_count++) {
		/*
		 * Check if first digit location has reached,
		 *  - If so,keep Decimal point(.),decrement position
		 */
		if (digit_count == NUMBER_OF_DIGITS_IN_RESULT) {
			buf_index--;
		}

		/*
		 * Extract each Digit by doing %10 and convert to ASCII,
		 *  - Then store to buffer index
		 *	- Initially we will get the right most digit and so on
		 */
		*buf_index = (dec_val % 10) + 48;

		/* Remove extracted digit by doing divide with 10 */
		dec_val = (dec_val / 10);

		/*
		 * Decrement the buffer Index to store next digit ,start from
		 * right most digit and move backwards for extracting each digit
		 */
		buf_index--;
	}
}

/**
 * \brief This Function Display ADC count on LCD
 *  - It will extract each digit from ADC count and convert to ASCII
 *  - Use GFX service for displaying each character
 * \param adc_rawcount ADC raw count value to be displayed.
 * \param x_cordinate X-coordinate where display should end.
 * \param sign_flag Sign of ADC count.If negative sign_flag is set.
 */
void display_adccount( uint64_t adc_rawcount, uint8_t x_cordinate,
		uint8_t sign_flag)
{
	uint8_t digit_count = 0;
	uint8_t adc_count_digit = 0;
	uint8_t sign_digit = '+';

	/* Loop through all digits to convert to ASCII */
	for (digit_count = 0; digit_count <= NUMBER_OF_DIGITS_IN_ADCCOUNT;
			digit_count++) {
		/* Extract each digit from raw ADC count and convert to ASCII
		 * - The Last digit will be extracted first and displayed
		 */
		adc_count_digit =   (adc_rawcount % 10)  + 48;

		/* Display the extracted character on LCD */
		gfx_mono_draw_char((const char)adc_count_digit, x_cordinate, 23,
				&sysfont);

		/* Point to x-coordinate for display of next digit */
		x_cordinate = (x_cordinate - 7);

		/* Remove extracted digit from raw count by doing divide
		 * with 10
		 */
		adc_rawcount = (adc_rawcount / 10);
	}

	/* If sign_flag is set display negative symbol */
	if (sign_flag) {
		sign_digit = '-';
	}

	/* Display the sign character on LCD */
	gfx_mono_draw_char((const char)sign_digit, x_cordinate, 23, &sysfont);
}

/**
 * \brief This function initialize the ADCB,gets ADCB-CH0 offset and configure
 *        ADCB-CH0 for oversampling
 *  - ADCB-CH0 is configured in 12bit, signed differential mode without gain
 *  - To read ADC offset, ADCB-Pin3(PB3) used as both +ve and -ve input
 *  - After reading ADC offset,to start oversampling,ADCB +ve and -ve input
 *    are configured
 */
void init_adc(void)
{
	/* Initialize configuration structures */
	adc_read_configuration(&ADCB, &adc_conf);
	adcch_read_configuration(&ADCB, ADC_CH0, &adc_ch_conf);

	/* Configure the ADCB module:
	 * - Signed, 12-bit resolution
	 * - External reference on AREFB pin.
	 * - 250 KSPS ADC clock rate
	 * - Manual conversion triggering
	 * - Callback function
	 */
	adc_set_conversion_parameters(&adc_conf, ADC_SIGN_ON, ADC_RES_12,
			ADC_REF_AREFB);
	adc_set_clock_rate(&adc_conf, 250000UL);
	adc_set_conversion_trigger(&adc_conf, ADC_TRIG_MANUAL, 1, 0);
	adc_write_configuration(&ADCB, &adc_conf);
	adc_set_callback(&ADCB, &adc_handler);

	/* Configure ADC B channel 0 for offset calculation
	 * - Differential mode without gain
	 * - Selected Pin3 (PB3) as +ve and -ve input for offset calculation
	 */
	adcch_set_input(&adc_ch_conf, ADCCH_POS_PIN3, ADCCH_NEG_PIN3, 1);
	adcch_write_configuration(&ADCB, ADC_CH0, &adc_ch_conf);

	/* Enable ADCB */
	adc_enable(&ADCB);

	/* Get ADC offset in to ADC_Offset variable and disable ADC */
	adc_offset_one_sample = adc_offset_get_signed();

	/* Find ADC_Offset for for total number of samples */
	adc_offset = adc_offset_one_sample * ADC_OVER_SAMPLED_NUMBER;

	/* Disable ADC to configure for oversampling */
	adc_disable(&ADCB);

	/* Configure the ADCB module for oversampling:
	 * - Signed, 12-bit resolution
	 * - External reference on AREFB pin.
	 * - 250 KSPS ADC clock rate
	 * - Free running mode on Channel0 ( First Channel)
	 */

	adc_set_conversion_trigger(&adc_conf, ADC_TRIG_FREERUN_SWEEP, 1, 0);
	adc_write_configuration(&ADCB, &adc_conf);

	/* Configure ADC B channel 0 for oversampling input
	 * - Differential mode without gain
	 * - Selected Pin1 (PB1) as +ve and Pin2 (PB2) as-ve input
	 * - Conversion complete interrupt
	 */
	adcch_set_input(&adc_ch_conf, ADC_OVER_SAMP_POSTIVE_PIN,
			ADC_OVER_SAMP_NEGATIVE_PIN, 1);
	adcch_set_interrupt_mode(&adc_ch_conf, ADCCH_MODE_COMPLETE);
	adcch_enable_interrupt(&adc_ch_conf);
	adcch_write_configuration(&ADCB, ADC_CH0, &adc_ch_conf);

	/* Enable ADCB */
	adc_enable(&ADCB);
}

/**
 * \brief This function processes sampled ADC values and calculate
 *        the oversampling result
 *  - Offset error compensation is applied on accumulated ADC value
 *  - After, scaling is done with scaled factor.
 *  - Finally, Analog value at ADC input pin is calculated
 *  - Reset all variable used in ADC ISR and enable ADC interrupt to start
 *    next oversampling Process.
 */
void adc_oversampled(void)
{
	/* ***********Processing and display of oversampled
	 * Input*************
	 **/

	/* Assign sign as +ve (as zero) in default for Rrw ADC count display */
	uint8_t sign_flag = 0;

	/* Offset error Compensation for entire number of samples */
	adc_result_accum_processed = adc_result_accumulator - adc_offset;

	/* Gain error Compensation for entire number of samples */
	adc_result_accum_processed = (adc_result_accum_processed *
			ADC_GAIN_ERROR_FACTOR) >> 16;

	/* Scale the accumulated result to get over sampled Result */
	adc_result_accum_processed = adc_result_accum_processed >>
			ADC_OVER_SAMP_SCALING_FACTOR;

	/* Calculate the analog input voltage value
	 * - Input Analog value = (ADC_Count * Reference
	 * Volt)/(2^adcresolution))
	 */
	v_input = (adc_result_accum_processed) *
			(ADC_OVER_SAMP_REF_VOLT_IN_MICRO);

	v_input = v_input / ADC_OVER_SAMP_MAX_COUNT;

	/* If input is negative, assign sign for display and use absolute value
	 */
	if (v_input < 0) {
		v_input = abs(v_input);
		v_input_ascii_buf[0] = '-';
	} else {
		v_input_ascii_buf[0] = '+';
	}

	/* Convert calculated analog value to ASCII for display */
	convert_to_ascii(&v_input_ascii_buf[ASCII_BUFFER_SIZE - 1], v_input);

	/* Display the result on LCD display */
	gfx_mono_draw_string(v_input_ascii_buf, 0, 10, &sysfont);

	/* If ADC count is negative, assign sign for display and use absolute
	 * value */
	if (adc_result_accum_processed < 0) {
		adc_result_accum_processed = abs(adc_result_accum_processed);
		sign_flag = 1;
	} else {
		sign_flag = 0;
	}

	/* Display oversampled raw ADC count on LCD display */
	display_adccount((int64_t)adc_result_accum_processed, (uint8_t)42,
			sign_flag );

	/* ***********Processing and display of Single Sampled
	 * Input*************
	 **/

	/* Offset error compensation for one sample */
	adc_result_one_sample_processed = adc_result_one_sample -
			adc_offset_one_sample;

	/* Gain error compensation for one sample */
	adc_result_one_sample_processed = (adc_result_one_sample_processed *
			ADC_GAIN_ERROR_FACTOR) >> 16;

	/* Calculate the analog input voltage value without oversampling
	 * - Input analog value = (ADC_Count * Reference
	 * Volt)/(2^adcresolution))
	 */
	v_input_one_sample = (adc_result_one_sample_processed) *
			(ADC_OVER_SAMP_REF_VOLT_IN_MICRO);

	v_input_one_sample = v_input_one_sample / ADC_NO_OVER_SAMP_MAX_COUNT;

	/* If input is negative, assign sign for display and use absolute value
	 */
	if (v_input_one_sample < 0) {
		v_input_one_sample = abs(v_input_one_sample);
		v_input_ascii_buf[0] = '-';
	} else {
		v_input_ascii_buf[0] = '+';
	}

	/* Convert calculated analog value to ASCII for display(no oversampling)
	 */
	convert_to_ascii(&v_input_ascii_buf[ASCII_BUFFER_SIZE - 1],
			v_input_one_sample);

	/* Display the result on LCD display(no oversampling) */
	gfx_mono_draw_string(v_input_ascii_buf, 75, 10, &sysfont);

	/* If ADC count is negative, assign sign for display and use absolute
	 * value */
	if (adc_result_one_sample_processed < 0) {
		adc_result_one_sample_processed = abs(
				adc_result_one_sample_processed);
		sign_flag = 1;
	} else {
		sign_flag = 0;
	}

	/* Display oversampled raw ADC count on LCD display */
	display_adccount((int64_t)adc_result_one_sample_processed,
			(uint8_t)117, sign_flag );

	/*Reset ADC_result accumulator value and ADC_sample count to zero
	 * for next oversampling process
	 */
	adc_result_accumulator = 0;
	adc_result_accum_processed = 0;
	adc_samplecount = 0;

	adc_result_one_sample = 0;
	adc_result_one_sample_processed = 0;

	/* Configure conversion complete interrupt for  ADCB-CH0 to re-start
	 * over sampling
	 */
	adcch_set_interrupt_mode(&adc_ch_conf, ADCCH_MODE_COMPLETE);
	adcch_enable_interrupt(&adc_ch_conf);
	adcch_write_configuration(&ADCB, ADC_CH0, &adc_ch_conf);
}

redpajama_set_name: RedPajamaGithub


text:
<!DOCTYPE html>

	<meta charset="utf-8">

	<title>SAUITableViewBinding Class Reference</title>

	<link rel="stylesheet" href="../css/style.css">
	<meta name="viewport" content="initial-scale=1, maximum-scale=1.4">
	<meta name="generator" content="appledoc 2.2.1 (build 1334)">

				qudianDoc

				qudian

Index

Hierarchy

							On This Page

							<select id="jump-to">
	<option value="top">Jump To…</option>

	<option value="overview">Overview</option>

	<option value="tasks">Tasks</option>

	<optgroup label="Class Methods">

		<option value="//api/name/typeName">+ typeName</option>

	</optgroup>

</select>

SAUITableViewBinding Class Reference

	Inherits from
	SAEventBinding : NSObject

	Declared in
	SAUITableViewBinding.h
SAUITableViewBinding.m

Overview

  Created by Amanda Canyon on 8/5/14.
  Copyright © 2014 Mixpanel. All rights reserved.

+ typeName

Method stubs. Implement them in subclasses

+ (NSString *)typeName

Discussion

Method stubs. Implement them in subclasses

Declared In

SAEventBinding.h

Copyright © 2016 qudian. All rights reserved. Updated: 2016-11-29

Generated by appledoc 2.2.1 (build 1334).


text:
<Type Name="NSPrintingPaginationMode" FullName="MonoMac.AppKit.NSPrintingPaginationMode">
  <TypeSignature Language="C#" Value="public enum NSPrintingPaginationMode" />
  <TypeSignature Language="ILAsm" Value=".class public auto ansi sealed NSPrintingPaginationMode extends System.Enum" />
  <AssemblyInfo>
    <AssemblyName>MonoMac</AssemblyName>
    <AssemblyVersion>0.0.0.0</AssemblyVersion>
  </AssemblyInfo>
  <Base>
    <BaseTypeName>System.Enum</BaseTypeName>
  </Base>
  <Docs>
    To be added.
    <remarks>To be added.</remarks>
  </Docs>
  <Members>
    <Member MemberName="Auto">
      <MemberSignature Language="C#" Value="Auto" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.AppKit.NSPrintingPaginationMode Auto = int32(0)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.AppKit.NSPrintingPaginationMode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="Clip">
      <MemberSignature Language="C#" Value="Clip" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.AppKit.NSPrintingPaginationMode Clip = int32(2)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.AppKit.NSPrintingPaginationMode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
    <Member MemberName="Fit">
      <MemberSignature Language="C#" Value="Fit" />
      <MemberSignature Language="ILAsm" Value=".field public static literal valuetype MonoMac.AppKit.NSPrintingPaginationMode Fit = int32(1)" />
      <MemberType>Field</MemberType>
      <AssemblyInfo>
        <AssemblyVersion>0.0.0.0</AssemblyVersion>
      </AssemblyInfo>
      <ReturnValue>
        <ReturnType>MonoMac.AppKit.NSPrintingPaginationMode</ReturnType>
      </ReturnValue>
      <Docs>
        To be added.
      </Docs>
    </Member>
  </Members>
</Type>


text:
var autobind = function (target, name, descriptor) {
  var fn = descriptor.value;
  delete descriptor.value;
  delete descriptor.writable;
  descriptor.get = function () {
    return fn.bind(this);
  };
};

class Person {
  constructor() {
    this.first = "Sebastian";
    this.last = "McKenzie";
  }

  @autobind
  getName() {
    return `${this.first} ${this.last}`;
  }
}

assert.equal(new Person().getName.call(null), "Sebastian McKenzie")


text:
using System.Linq;
using CQRS.Demo.Infrastructure.Persistence.SqlServer;

namespace CQRS.Demo.QueryStack.DataAccess
{
    public class Database : IDatabase
    {
        private readonly CQRS_DemoEntities _cqrs;
        public Database()
        {
            //_merlo = new expoware_MerloEntities();
            _cqrs = new CQRS_DemoEntities();
        }

        public IQueryable<images> Images
        {
            get
            {
                return _cqrs.images;
            }
        }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>V-Index</title>
<meta name="date" content="2014-08-06">
<link rel="stylesheet" type="text/css" href="../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes

A B E F G H I J L M N O P R S T U V X Y Z

V

v - Variable in class j3dio.UV

valueOf(String) - Static method in enum j3dio.ply.PlyModel.Format

Returns the enum constant of this type with the specified name.

values() - Static method in enum j3dio.ply.PlyModel.Format

Returns an array containing the constants of this enum type, in
the order they are declared.

vert1 - Variable in class j3dio.stl.FaceT

vert2 - Variable in class j3dio.stl.FaceT

vert3 - Variable in class j3dio.stl.FaceT

vertIndxs - Variable in class j3dio.raw.RawFace

A B E F G H I J L M N O P R S T U V X Y Z

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Letter

Next Letter

Frames

No Frames

All Classes


text:
/* private headers */
#include "pfmlib_priv.h"
#include "pfmlib_intel_x86_priv.h"

#if 0
static int pfm_nhm_lbr_encode(void *this, pfmlib_event_desc_t *e, uint64_t *codes, int *count, pfmlib_perf_attr_t *attrs);
static int pfm_nhm_offcore_encode(void *this, pfmlib_event_desc_t *e, uint64_t *codes, int *count, pfmlib_perf_attr_t *attrs);
#endif

#include "events/intel_nhm_events.h"

static const int nhm_models[] = {
	26,
	30,
	31,
	0
};

static const int nhm_ex_models[] = {
	46,
	0
};

static int
pfm_nhm_init(void *this)
{
	pfm_intel_x86_cfg.arch_version = 3;
	return PFM_SUCCESS;
}

/*
 * the following function implement the model
 * specific API directly available to user
 */

static const char *data_src_encodings[]={
/*  0 */	"unknown L3 cache miss",
/*  1 */	"minimal latency core cache hit. Request was satisfied by L1 data cache",
/*  2 */	"pending core cache HIT. Outstanding core cache miss to same cacheline address already underway",
/*  3 */	"data request satisfied by the L2",
/*  4 */	"L3 HIT. Local or remote home request that hit L3 in the uncore with no coherency actions required (snooping)",
/*  5 */	"L3 HIT. Local or remote home request that hit L3 and was serviced by another core with a cross core snoop where no modified copy was found (clean)",
/*  6 */	"L3 HIT. Local or remote home request that hit L3 and was serviced by another core with a cross core snoop where modified copies were found (HITM)",
/*  7 */	"reserved",
/*  8 */	"L3 MISS. Local homed request that missed L3 and was serviced by forwarded data following a cross package snoop where no modified copy was found (remote home requests are not counted)",
/*  9 */	"reserved",
/* 10 */	"L3 MISS. Local homed request that missed L3 and was serviced by local DRAM (go to shared state)",
/* 11 */	"L3 MISS. Remote homed request that missed L3 and was serviced by remote DRAM (go to shared state)",
/* 12 */	"L3 MISS. Local homed request that missed L3 and was serviced by local DRAM (go to exclusive state)",
/* 13 */	"L3 MISS. Remote homed request that missed L3 and was serviced by remote DRAM (go to exclusive state)",
/* 14 */	"reserved",
/* 15 */	"request to uncacheable memory"
};

/*
 * return data source encoding based on index in val
 * To be used with PEBS load latency filtering to decode
 * source of the load miss
 */
const char *
pfm_nhm_data_src_desc(int val)
{
	if (val > 15 || val < 0)
		return NULL;

	return data_src_encodings[val];
}

#if 0
static int
pfm_nhm_lbr_encode(void *this, pfmlib_event_desc_t *e, uint64_t *codes, int *count, pfmlib_perf_attr_t *attrs)
{
	return PFM_ERR_NOTSUPP;
}

static int
pfm_nhm_offcore_encode(void *this, pfmlib_event_desc_t *e, uint64_t *codes, int *count, pfmlib_perf_attr_t *attrs)
{
	return PFM_ERR_NOTSUPP;
}
#endif

pfmlib_pmu_t intel_nhm_support={
	.desc			= "Intel Nehalem",
	.name			= "nhm",
	.pmu			= PFM_PMU_INTEL_NHM,
	.pme_count		= LIBPFM_ARRAY_SIZE(intel_nhm_pe),
	.type			= PFM_PMU_TYPE_CORE,
	.supported_plm		= INTEL_X86_PLM,
	.num_cntrs		= 4,
	.num_fixed_cntrs	= 3,
	.max_encoding		= 2, /* because of OFFCORE_RESPONSE */
	.pe			= intel_nhm_pe,
	.atdesc			= intel_x86_mods,
	.flags			= PFMLIB_PMU_FL_RAW_UMASK
				| INTEL_X86_PMU_FL_ECMASK,
	.cpu_family		= 6,
	.cpu_models		= nhm_models,
	.pmu_detect		= pfm_intel_x86_model_detect,
	.pmu_init		= pfm_nhm_init,

	.get_event_encoding[PFM_OS_NONE] = pfm_intel_x86_get_encoding,
	 PFMLIB_ENCODE_PERF(pfm_intel_x86_get_perf_encoding),

	.get_event_first	= pfm_intel_x86_get_event_first,
	.get_event_next		= pfm_intel_x86_get_event_next,
	.event_is_valid		= pfm_intel_x86_event_is_valid,
	.validate_table		= pfm_intel_x86_validate_table,
	.get_event_info		= pfm_intel_x86_get_event_info,
	.get_event_attr_info	= pfm_intel_x86_get_event_attr_info,
	PFMLIB_VALID_PERF_PATTRS(pfm_intel_x86_perf_validate_pattrs),
	.get_event_nattrs	= pfm_intel_x86_get_event_nattrs,
	.can_auto_encode	= pfm_intel_x86_can_auto_encode,
};

pfmlib_pmu_t intel_nhm_ex_support={
	.desc			= "Intel Nehalem EX",
	.name			= "nhm_ex",
	.pmu			= PFM_PMU_INTEL_NHM_EX,
	.pme_count		= LIBPFM_ARRAY_SIZE(intel_nhm_pe),
	.type			= PFM_PMU_TYPE_CORE,
	.supported_plm		= INTEL_X86_PLM,
	.num_cntrs		= 4,
	.num_fixed_cntrs	= 3,
	.max_encoding		= 2, /* because of OFFCORE_RESPONSE */
	.pe			= intel_nhm_pe,
	.atdesc			= intel_x86_mods,
	.flags			= PFMLIB_PMU_FL_RAW_UMASK
				| INTEL_X86_PMU_FL_ECMASK,
	.cpu_family		= 6,
	.cpu_models		= nhm_ex_models,
	.pmu_detect		= pfm_intel_x86_model_detect,
	.pmu_init		= pfm_nhm_init,

	.get_event_encoding[PFM_OS_NONE] = pfm_intel_x86_get_encoding,
	 PFMLIB_ENCODE_PERF(pfm_intel_x86_get_perf_encoding),

	.get_event_first	= pfm_intel_x86_get_event_first,
	.get_event_next		= pfm_intel_x86_get_event_next,
	.event_is_valid		= pfm_intel_x86_event_is_valid,
	.validate_table		= pfm_intel_x86_validate_table,
	.get_event_info		= pfm_intel_x86_get_event_info,
	.get_event_attr_info	= pfm_intel_x86_get_event_attr_info,
	PFMLIB_VALID_PERF_PATTRS(pfm_intel_x86_perf_validate_pattrs),
	.get_event_nattrs	= pfm_intel_x86_get_event_nattrs,
	.can_auto_encode	= pfm_intel_x86_can_auto_encode,
};


text:
<!DOCTYPE html>

<meta name="author" content="Open Source Politics" />

<meta property="og:title"
    content="
      20 propositions pour des conseils de quartier 2.0
    ">

<meta property="og:description"
    content="
        Outils numériques de démocratie participative : nous mettons en place des solutions civic tech open source et des méthodes efficaces pour faciliter la participation citoyenne.
      ">

<meta property="og:url" content="http://opensourcepolitics.eu/blog-fr/conseils_de_quartier_2_0/" />

    <meta property="og:site_name" content="Open Source Politics" />

    <meta property="og:locale" content="fr_FR" />

    <meta name="twitter:site" content="@OpenSourcePol" />
    <meta name="twitter:description" content="Outils numériques de démocratie participative : nous mettons en place des solutions civic tech open source et des méthodes efficaces pour faciliter la participation citoyenne." />

  <meta property="og:type" content="article" />

  <meta property="article:section" content="" />

  <meta name="twitter:card" content="summary_large_image" />

  <meta name="twitter:creator" content="@OpenSourcePol" />

  <meta name="twitter:title" content="20 propositions pour des conseils de quartier 2.0" />

    <meta property="og:image" content="/img/thumbnail-osp+decidim.png" />
    <meta name="twitter:image" content="/img/thumbnail-osp+decidim.png" />

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>20 propositions pour des conseils de quartier 2.0</title>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Outils numériques de démocratie participative : nous mettons en place des solutions civic tech open source et des méthodes efficaces pour faciliter la participation citoyenne.">
    <link rel="canonical" href="http://opensourcepolitics.eu/blog-fr/conseils_de_quartier_2_0/">
    <link rel="shortcut icon" type="image/png" href="/img/favicon.png">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <link rel="stylesheet" href="/style.css">
    <link rel="stylesheet" href="/style_custom.css">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
    <link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700" rel="stylesheet">

      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
        Toggle navigation

      </button>

            Réalisations

            Decidim

            Articles

            On recrute !

            Contact

fr

en

  Posté le25 octobre 2016
             par Valentin Chaput

          Voir l'article sur medium

20 propositions pour des conseils de quartier 2.0

Description du projet

L'engagement des citoyens progressera par la pratique démocratique concrète. Avec les associations CivicWise et Democracy OS France, nous nous sommes appliqués cette maxime en proposant au budget participatif de la Ville de Paris de dynamiser les conseils de quartier dans le 19e arrondissement. Notre projet n'a pas été sélectionné, malgré près de 500 votes réunis sur les 8 000 votants dans le 19e. Refusant de nous arrêter à cette déception, nous partageons les leçons que nous retenons de cet exercice et nos propositions pour la suite.

Le premier budget participatif au monde

Fer de lance des nouvelles interactions qu'Anne Hidalgo veut impulser avec les citoyens parisiens, le budget participatif est incontestablement un succès. Près de 93 000 participants cette année — sans compter les 66 000 enfants qui ont participé à la déclinaison dans les écoles — c'est 40 % de plus que l'an dernier et plus du double de la première édition lancée à l'automne 2014. Avec 100 millions d'euros d'investissements directement attribués par les habitants, dont un tiers à destination des quartiers populaires, les Parisiens disposent tout simplement du plus gros budget participatif au monde !

Année après année, la démarche s'approfondit. Limité à la sélection parmi des projets déjà dans les cartons de l'administration en 2014, le budget participatif répartit depuis 2015 les investissements entre des projets directement soumis par des habitants. Cette année, les associations pouvaient candidater et un véritable accompagnement a été organisé au printemps pour associer les porteurs de projets dès la phase d'évaluation par les services municipaux. Ce tamis administratif et collaboratif a fait ressortir les 600 projets soumis au vote parmi les 3 000 propositions déposées en ligne en février dernier.

Le dispositif semble attirer tous les publics : 13 000 votants habitent dans des quartiers populaires ; plus de 15 000 citoyens de moins de 30 ans ont voté en ligne ; le total légèrement supérieur de votes papier (47 000 contre 45 000 votes électroniques) laisse penser que les personnes plus âgées et/ou moins connectées ont également déposé leurs bulletins dans les urnes de nombreux espaces publics.

Dans ce contexte, faut-il conclure de notre résultat que ces citoyens, dans leur grande diversité, ne sont finalement pas si intéressés qu'on le dit par les outils et démarches civic-tech, qui peinent globalement à convaincre le grand public malgré une exposition médiatique grandissante ? Au-delà de notre projet de doter les conseils de quartier de méthodes d'intelligence collective et de plateformes participatives, il est à noter qu'aucun projet labellisé "Ville intelligente et numérique" n'a été retenu à l'échelle de tout Paris. A l'inverse, près de 50 % des projets lauréats concernent le cadre de vie et la propreté. Ce résultat, dans la lignée des premières éditions, pose la question de ce qui est comparable : à l'avenir, ne serait-il pas intéressant pour la diversité des projets soutenus que chaque votant ne dispose que d'un nombre limité de votes par catégorie ?

Nos 20 propositions pour des conseils de quartier 2.0

A l'image du budget participatif qui se perfectionne d'une année sur l'autre, la démocratie est un processus dynamique qui demande du temps pour parvenir à un nouvel équilibre. La période est paradoxale : la "crise démocratique" figure dans tous les discours alors que nos écosystèmes bouillonnent d'initiatives en ligne et hors ligne pour accompagner la transition vers un système et des pratiques politiques qui apportent plus de place et de sens aux citoyens. Rendus modestes par le chemin que nous avons à parcourir, mais porteurs de valeurs ambitieuses, nous adoptons au sein de CivicWise et Democracy OS France une approche locale, basée sur le concret et la coopération. Nous expérimentons à l'échelle de notre quartier, qui rayonne autour de la Place des Fêtes et de Volumes, l'espace de coworking où nous créons et travaillons au quotidien.

Nous avons débuté notre collaboration au premier trimestre 2016 en organisant deux "meetups" pour rassembler une cinquantaine d'habitants des environs. Ces deux ateliers créatifs nous ont permis de définir nos attentes collectives — que les conseils de quartier ne remplissent pas à l'heure actuelle — puis nos idées sur les activités, les méthodes décisionnelles et les supports numériques qu'il faudrait développer pour donner plus d'attractivité et d'impact à ces rendez-vous citoyens. Nous les avons ensuite comparées au fonctionnement existant des conseils de quartier en assistant à plusieurs séances. Nous avons synthétisé ces travaux dans une liste de 20 propositions qui ambitionnent de dynamiser l'engagement démocratique local en attirant des participants plus divers aux réunions, en développant de nouveaux formats débouchant sur de véritables décisions co-construites avec les citoyens et de nouveaux outils numériques adaptés.

Open Source Politics est une entreprise qui développe des plateformes de démocratie participative pour des acteurs publics, privés et associatifs. Contactez-nous si vous souhaitez vous engager dans un dispositif de concertation ou un budget participatif utilisant des outils civic tech !

                Partager sur Twitter
             Partager sur Facebook
          <button type="button" class="btn btn-primary" data-toggle="modal" style = "margin-bottom:5px;" data-target="#news">               Newsletter               </button>

      Autres Articles

Notre Histoire

Depuis le printemps 2016, Open Source Politics est une entreprise relevant du champ de l'économie sociale...

Valentin Chaput
22 septembre 2016

20 propositions pour des conseils de quartier 2.0

L'engagement des citoyens progressera par la pratique démocratique concrète. Avec les associations CivicWise et...

Valentin Chaput
25 octobre 2016

              Partager :
                 Twitter
                 Facebook

                          <button type="button" class="close" data-dismiss="modal">×Close</button>

THE LIGHT SIDE OF DIGITAL DEMOCRACY

                          suivez l'actu d'une entreprise des civic tech libres

Recevez notre newsletter mensuelle : actualités, événements et nouveaux produits civic tech d'OSP.

                            <form action="//opensourcepolitics.us14.list-manage.com/subscribe/post?u=6a0b5966e1f8f34a5f054f60c&id=55bb1b9f49" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>

<input type="email" value="" name="EMAIL" class="form-width form-control margin-bottom" id="mce-EMAIL" placeholder="Adresse email" required>

<input type="submit" value="Inscription" name="subscribe" id="mc-embedded-subscribe" class="btn btn-primary">

<input type="text" name="b_6a0b5966e1f8f34a5f054f60c_dc16a6b5e6" tabindex="-1" value="">

                            </form>

                          <button type="button" class="btn btn-default" data-dismiss="modal">Fermer</button>

      Please enable JavaScript to view the comments powered by Disqus.

Mentions légales

Crédits

Open Source Politics,

              RCS Paris 820 412 161

              32 rue des Cascades

              75020 Paris (France)

Open Source Politics est une SARL relevant du champ de l'économie sociale et solidaire. Elle défend les principes de l'open source dans les outils de participation citoyenne qu'elle déploie, ainsi que dans les relations avec ses partenaires.

contact@opensourcepolitics.eu


text:
import React, { Component } from 'react';
import queryString from 'query-string';
import TextInput from '../../General/components/TextInput';

class SearchBar extends Component {

  state = {
    name: '',
  }

  componentDidMount = () => {
    const parsed = queryString.parse(this.props.location.search);
    if (parsed.name) {
      this.setState({ name: parsed.name });
    }
  }

  componentWillReceiveProps = (nextProps) => {
    const parsed = queryString.parse(nextProps.location.search);
    if (parsed.name) {
      this.setState({ name: parsed.name });
    } else {
      this.setState({ name: '' });
    }
  }

  handleChange = (name, value) => {
    this.setState({ [name]: value });
  }

  handleSubmit = (event) => {
    event.preventDefault();
    this.props.onSearch(this.state.name);
  }

  render() {
    const { name } = this.state;

    return (
      <form className="" onSubmit={this.handleSubmit}>
        <TextInput
          currentValue={name}
          name="name"
          type="text"
          id=""
          className="searchBar-container"
          onChange={this.handleChange}
          autocomplete="off"
          placeholder="gallery.searchPlaceholder"
        />
      </form>
    );
  }
}

export default SearchBar;


text:
<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    android:theme="@style/AppTheme"
    tools:openDrawer="start">

    <include
        layout="@layout/app_bar_nav"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <com.google.android.material.navigation.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:fitsSystemWindows="true"
        app:headerLayout="@layout/nav_header_nav"
        app:menu="@menu/activity_nav_drawer" />

</androidx.drawerlayout.widget.DrawerLayout>


text:
package com.programmaticallyspeaking.ncd.nashorn

import com.programmaticallyspeaking.ncd.host.{Script, ScriptVersion}
import com.programmaticallyspeaking.ncd.infra.{IdGenerator, ScriptURL}
import com.programmaticallyspeaking.ncd.nashorn.NashornDebuggerHost.{NoScriptReason, ScriptClassNamePrefix}
import com.sun.jdi.{AbsentInformationException, Location, ReferenceType, ThreadReference}
import org.slf4s.Logging

import scala.util.control.NonFatal
import scala.util.{Failure, Success, Try}

case class IdentifiedScript(script: Script)

object ScriptFactory {
  type IdentifiedScriptCallback = (Option[IdentifiedScript], Seq[Location]) => Unit
}

class ScriptFactory(virtualMachine: XVirtualMachine) extends Logging {
  import JDIExtensions._
  import ScriptFactory._

  import scala.collection.JavaConverters._

  private val scriptIdGenerator = new IdGenerator("nds")

  def considerReferenceType(thread: Option[ThreadReference], refType: ReferenceType, callback: IdentifiedScriptCallback): Unit = {
    val className = refType.name()

    if (className.startsWith(ScriptClassNamePrefix)) {
      // This is a compiled Nashorn script class.

      //
      if (refType.sourceName() == CodeEval.EvalSourceName) {
        log.trace(s"Found a script evaluated by NCDbg: ${refType.name()} (based on source name ${CodeEval.EvalSourceName})")
        callback(None, Seq.empty)
      } else {
        log.debug(s"Found a script reference type: ${refType.name}")

        scriptUrlAndLocations(refType) match {
          case Success((scriptURL, locations)) =>
            // Note that we no longer try to use the script path for reading the source. If the script contains a
            // sourceURL annotation, Nashorn will use that at script path, so we might end up reading CoffeeScript
            // source instead of the real source.
            val triedScript = Try(scriptFromEval(refType, scriptURL))
            handleScriptResult(thread, triedScript, refType, locations, callback)

          case Failure(t) =>
            log.warn(s"Failed to get line locations for ${refType.name}", t)
            callback(None, Seq.empty)
        }
      }
    }
  }

  private def scriptUrlAndLocations(referenceType: ReferenceType): Try[(ScriptURL, Seq[Location])] = {
    Try(referenceType.allLineLocations().asScala).map { locations =>
      locations.headOption match {
        case Some(firstLocation) =>
          (firstLocation.scriptURL, locations.toSeq)
        case None =>
          (referenceType.scriptURL, locations)
      }
    }.recover {
      case ex: AbsentInformationException =>
        (referenceType.scriptURL, Seq.empty[Location])
    }
  }

  private def handleScriptResult(maybeThread: Option[ThreadReference], result: Try[Either[NoScriptReason.EnumVal, Script]],
                                 refType: ReferenceType, locations: Seq[Location],
                                 callback: IdentifiedScriptCallback): Unit = result match {
    case Success(Right(script)) =>
      callback(Some(identifiedScript(script, locations)), locations)
    case Success(Left(NoScriptReason.EvaluatedCode)) =>
      log.debug(s"Ignoring script ${refType.name} because it contains evaluated code")
      callback(None, Seq.empty)
    case Success(Left(NoScriptReason.NoSource)) =>
      val installPhaseType =
        maybeThread.flatMap(t => t.frames.asScala.view.map(f => f.location().method().declaringType()).find(_.name().endsWith("$InstallPhase")))
      installPhaseType match {
        case Some(ciType) =>
          extractSourceLater(maybeThread, refType, ciType, callback)
        case None =>
          log.warn(s"Cannot get source from ${refType.name}.")
          callback(None, Seq.empty)
      }
    case Failure(t) =>
      log.error(s"Ignoring script type ${refType.name}", t)
      callback(None, Seq.empty)
  }

  private def extractSourceLater(maybeThread: Option[ThreadReference], refType: ReferenceType, ciType: ReferenceType,
                                 callback: IdentifiedScriptCallback): Unit = {
    val theThread = maybeThread.get // .get is safe here, since installPhaseType is defined
    log.debug(s"Will get source from ${refType.name()} when InstallPhase is complete, in thread ${theThread.name()}")
    // Let the stack unwind a bit in order to get hold of the source. This logic is based on the observation that
    // we see the ClassPrepareEvent event inside Context$ContextCodeInstaller (in Java 9, one of its subclasses).
    // In Java 8, it's the initialize method, in Java 9 it's the install method. The source isn't set until in
    // the initialize method, so the safest approach is to wait until the entire install phase (InstallPhase type)
    // is complete.
    val req = virtualMachine.eventRequestManager().createMethodExitRequest()
    req.addClassFilter(ciType)
    req.addThreadFilter(theThread)
    req.addCountFilter(1)
    req.onEventDo { _ =>
      log.debug(s"Getting source from ${refType.name()} at method exit from InstallPhase")
      virtualMachine.eventRequestManager().deleteEventRequest(req) // not sure if this is needed
      // Recursively (-ish) call the callback from here - important thing is that it's done on the NDH
      // thread _before_ we resume the VM, so that we get a chance to add previously requested breakpoints
      // in the new script.
      considerReferenceType(None, refType, callback)
      true // consume the event
    }
    req.enable()
  }

  private def identifiedScript(script: Script, locations: Seq[Location]): IdentifiedScript = {
    IdentifiedScript(script)
  }

  private def scriptFromEval(refType: ReferenceType, scriptURL: ScriptURL): Either[NoScriptReason.EnumVal, Script] = {
    refType.shamelesslyExtractEvalSourceFromPrivatePlaces().map { src =>
      Right(newScript(scriptURL, src, VersionExtractor.extract(refType)))
    }.getOrElse(Left(NoScriptReason.NoSource))
  }

  private def newScript(url: ScriptURL, source: String, version: ScriptVersion) =
    ScriptImpl.fromSource(url, source, scriptIdGenerator.next, version)
}


text:
namespace SoftUni.WebServer.Common
{
    using System;

    public static class Validation
    {
        public static void EnsureNotNull(object obj, string name, string message = null)
        {
            if (message == null)
            {
                message = $"{name} must not be null.";
            }

            if (obj == null)
            {
                throw new ArgumentNullException(name, message);
            }
        }

        public static void EnsureNotNullOrEmptyString(string text, string name, string message = null)
        {
            if (message == null)
            {
                message = $"{name} must not be null or empty.";
            }

            if (string.IsNullOrEmpty(text))
            {
                throw new ArgumentException(message, name);
            }
        }

        public static void EnsureMinLength(string text, string name, int minLength, string message = null)
        {
            if (message == null)
            {
                message = $"{name} cannot be null or less than {minLength} symbols long.";
            }

            if (string.IsNullOrEmpty(text) || text.Length < minLength)
            {
                throw new ArgumentException(message, name);
            }
        }

        public static void EnsureEqualStrings(string first, string second, string firstName, string secondName, string message = null)
        {
            if (message == null)
            {
                message = $"The fields {firstName} and {secondName} don't match.";
            }

            if (first != second)
            {
                throw new ArgumentException(message, firstName);
            }
        }
    }
}


text:
@interface NSArray
-(int)count;
@end

// <rdar://problem/14438917>
char* f(NSArray *array) {
    return _Generic(__builtin_choose_expr(__builtin_types_compatible_p(__typeof__(array.count), void), 0.f, array.count),
                    unsigned int:"uint",
                    float:"void",
                    default: "ignored");
}


text:
/*
  Sender application: puts messages from stdin to a WMQ queue

  Protocol is defined in common.h
 */

#include "common.h"
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>

MQHCONN hCon;

void termination_handler(int signum) {
   disconnect_qm(hCon);
   exit(EXIT_SUCCESS);
}

int main(int argc, char **argv) {

   if (!getenv("AMQ_SSL_ALLOW_DEFAULT_CERT")) {
      MSG("please set environment variable AMQ_SSL_ALLOW_DEFAULT_CERT=1\n");
      exit(678);
   }

   char *config_path;
   handle_cmd_args(argc, argv, &config_path);
   EAIConfig* conf = new_config();
   load_config(config_path, conf);

   create_pidfile(conf->pidfile);

   hCon = connect_qm(conf);
   if (!hCon) { return 1; }
   MQHOBJ  hObj = open_queue(hCon, conf->output_queue, OUTPUT);
   if (!hObj) { return 1; }

   if (signal(SIGINT, termination_handler) == SIG_IGN)
      signal(SIGINT, SIG_IGN);
   if (signal(SIGHUP, termination_handler) == SIG_IGN)
      signal(SIGHUP, SIG_IGN);
   if (signal(SIGTERM, termination_handler) == SIG_IGN)
      signal(SIGTERM, SIG_IGN);

   while (1) {
      EAIMsg* msg = read_next_message();
      send_message(hCon, hObj, msg);
      write_ack();
      free_message(msg);
   }

   disconnect_qm(hCon);
   free_config(conf);
   return 0;
}


text:
#ifndef __IOCTL_CFG80211_H__
#define __IOCTL_CFG80211_H__

#if defined(CONFIG_IOCTL_CFG80211) && !defined(CONFIG_CFG80211) && !defined(CONFIG_CFG80211_MODULE)
	#error "Can't define CONFIG_IOCTL_CFG80211 because neither CONFIG_CFG80211 nor CONFIG_CFG80211_MODULE is defined in kernel"
#endif
#if defined(CONFIG_IOCTL_CFG80211) && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)
	#error "We haven't verify our cfg80211 solution below kernel version 2.6.35"
#endif

#if defined(RTW_USE_CFG80211_STA_EVENT)
	#undef CONFIG_CFG80211_FORCE_COMPATIBLE_2_6_37_UNDER
#endif

struct rtw_wdev_invit_info {
	u8 token;
	u8 flags;
	u8 status;
	u8 req_op_ch;
	u8 rsp_op_ch;
};

#define rtw_wdev_invit_info_init(invit_info) \
	do { \
		(invit_info)->token = 0; \
		(invit_info)->flags = 0x00; \
		(invit_info)->status = 0xff; \
		(invit_info)->req_op_ch = 0; \
		(invit_info)->rsp_op_ch = 0; \
	} while (0)

struct rtw_wdev_priv
{
	struct wireless_dev *rtw_wdev;

	_adapter *padapter;

	struct cfg80211_scan_request *scan_request;
	_lock scan_req_lock;

	struct net_device *pmon_ndev;//for monitor interface
	char ifname_mon[IFNAMSIZ + 1]; //interface name for monitor interface

	u8 p2p_enabled;

	u8 provdisc_req_issued;

	struct rtw_wdev_invit_info invit_info;

	u8 bandroid_scan;
	bool block;
	bool power_mgmt;

#ifdef CONFIG_CONCURRENT_MODE
	ATOMIC_T ro_ch_to;
	ATOMIC_T switch_ch_to;
#endif

};

#define wdev_to_priv(w) ((struct rtw_wdev_priv *)(wdev_priv(w)))

#define wiphy_to_adapter(x) (_adapter *)(((struct rtw_wdev_priv*)wiphy_priv(x))->padapter)

#define wiphy_to_wdev(x) (struct wireless_dev *)(((struct rtw_wdev_priv*)wiphy_priv(x))->rtw_wdev)

int rtw_wdev_alloc(_adapter *padapter, struct device *dev);
void rtw_wdev_free(struct wireless_dev *wdev);
void rtw_wdev_unregister(struct wireless_dev *wdev);

void rtw_cfg80211_init_wiphy(_adapter *padapter);

void rtw_cfg80211_surveydone_event_callback(_adapter *padapter);

void rtw_cfg80211_indicate_connect(_adapter *padapter);
void rtw_cfg80211_indicate_disconnect(_adapter *padapter);
void rtw_cfg80211_indicate_scan_done(struct rtw_wdev_priv *pwdev_priv, bool aborted);

#ifdef CONFIG_AP_MODE
void rtw_cfg80211_indicate_sta_assoc(_adapter *padapter, u8 *pmgmt_frame, uint frame_len);
void rtw_cfg80211_indicate_sta_disassoc(_adapter *padapter, unsigned char *da, unsigned short reason);
#endif //CONFIG_AP_MODE

void rtw_cfg80211_issue_p2p_provision_request(_adapter *padapter, const u8 *buf, size_t len);
void rtw_cfg80211_rx_p2p_action_public(_adapter *padapter, u8 *pmgmt_frame, uint frame_len);
void rtw_cfg80211_rx_action_p2p(_adapter *padapter, u8 *pmgmt_frame, uint frame_len);
void rtw_cfg80211_rx_action(_adapter *adapter, u8 *frame, uint frame_len, const char*msg);

int rtw_cfg80211_set_mgnt_wpsp2pie(struct net_device *net, char *buf, int len, int type);

bool rtw_cfg80211_pwr_mgmt(_adapter *adapter);

#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))  && !defined(COMPAT_KERNEL_RELEASE)
#define rtw_cfg80211_rx_mgmt(dev, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt(dev, freq, buf, len, gfp)
#define rtw_cfg80211_send_rx_assoc(dev, bss, buf, len) cfg80211_send_rx_assoc(dev, buf, len)
#else
#define rtw_cfg80211_rx_mgmt(dev, freq, sig_dbm, buf, len, gfp) cfg80211_rx_mgmt(dev, freq, sig_dbm, buf, len, gfp)
#define rtw_cfg80211_send_rx_assoc(dev, bss, buf, len) cfg80211_send_rx_assoc(dev, bss, buf, len)
#endif

#endif //__IOCTL_CFG80211_H__


text:
"""
Module containing implementations of oracle Programs.
"""
from typing import List

import numpy as np
from pyquil import Program
from pyquil.gates import X, Z

from grove.utils.utility_programs import ControlledProgramBuilder

def basis_selector_oracle(qubits: List[int], bitstring: str) -> Program:
    """
    Defines an oracle that selects the ith element of the computational basis.

    Flips the sign of the state :math:`\\vert x\\rangle>`
    if and only if x==bitstring and does nothing otherwise.

    :param qubits: The qubits the oracle is called on. The qubits are assumed to be ordered from
     most significant qubit to least significant qubit.
    :param bitstring: The desired bitstring, given as a string of ones and zeros. e.g. "101"
    :return: A program representing this oracle.
    """
    if len(qubits) != len(bitstring):
        raise ValueError("The bitstring should be the same length as the number of qubits.")
    oracle_prog = Program()

    # In the case of one qubit, we just want to flip the phase of state relative to the other.
    if len(bitstring) == 1:
        oracle_prog.inst(Z(qubits[0]))
        return oracle_prog
    else:
        bitflip_prog = Program()
        for i, qubit in enumerate(qubits):
            if bitstring[i] == '0':
                bitflip_prog.inst(X(qubit))
        oracle_prog += bitflip_prog
        controls = qubits[:-1]
        target = qubits[-1]
        operation = np.array([[1, 0], [0, -1]])
        gate_name = 'Z'
        n_qubit_controlled_z = (ControlledProgramBuilder()
                                .with_controls(controls)
                                .with_target(target)
                                .with_operation(operation)
                                .with_gate_name(gate_name)
                                .build())
        oracle_prog += n_qubit_controlled_z
        oracle_prog += bitflip_prog
    return oracle_prog


text:
#ifndef FREERDP_CORE_TSG_H
#define FREERDP_CORE_TSG_H

typedef struct rdp_tsg rdpTsg;

#include "rpc.h"
#include "transport.h"

#include <winpr/rpc.h>
#include <winpr/winpr.h>

#include <time.h>
#include <freerdp/types.h>
#include <freerdp/settings.h>
#include <freerdp/utils/stream.h>
#include <freerdp/utils/wait_obj.h>
#include <freerdp/utils/debug.h>

struct rdp_tsg
{
	rdpRpc* rpc;
	rdpSettings* settings;
	rdpTransport* transport;
	uint8 TunnelContext[16];
	uint8 ChannelContext[16];
};

typedef wchar_t* RESOURCENAME;

#define MAX_RESOURCE_NAMES			50

typedef struct _tsendpointinfo
{
	RESOURCENAME* resourceName;
	unsigned long numResourceNames;
	RESOURCENAME* alternateResourceNames;
	unsigned short numAlternateResourceNames;
	unsigned long Port;
} TSENDPOINTINFO, *PTSENDPOINTINFO;

#define TSG_PACKET_TYPE_HEADER			0x00004844
#define TSG_PACKET_TYPE_VERSIONCAPS		0x00005643
#define TSG_PACKET_TYPE_QUARCONFIGREQUEST	0x00005143
#define TSG_PACKET_TYPE_QUARREQUEST		0x00005152
#define TSG_PACKET_TYPE_RESPONSE		0x00005052
#define TSG_PACKET_TYPE_QUARENC_RESPONSE	0x00004552
#define TSG_CAPABILITY_TYPE_NAP			0x00000001
#define TSG_PACKET_TYPE_CAPS_RESPONSE		0x00004350
#define TSG_PACKET_TYPE_MSGREQUEST_PACKET	0x00004752
#define TSG_PACKET_TYPE_MESSAGE_PACKET		0x00004750
#define TSG_PACKET_TYPE_AUTH			0x00004054
#define TSG_PACKET_TYPE_REAUTH			0x00005250
#define TSG_ASYNC_MESSAGE_CONSENT_MESSAGE	0x00000001
#define TSG_ASYNC_MESSAGE_SERVICE_MESSAGE	0x00000002
#define TSG_ASYNC_MESSAGE_REAUTH		0x00000003
#define TSG_TUNNEL_CALL_ASYNC_MSG_REQUEST	0x00000001
#define TSG_TUNNEL_CANCEL_ASYNC_MSG_REQUEST	0x00000002

#define TSG_NAP_CAPABILITY_QUAR_SOH		0x00000001
#define TSG_NAP_CAPABILITY_IDLE_TIMEOUT		0x00000002
#define TSG_MESSAGING_CAP_CONSENT_SIGN		0x00000004
#define TSG_MESSAGING_CAP_SERVICE_MSG		0x00000008
#define TSG_MESSAGING_CAP_REAUTH		0x00000010

typedef struct _TSG_PACKET_HEADER
{
	unsigned short ComponentId;
	unsigned short PacketId;
} TSG_PACKET_HEADER, *PTSG_PACKET_HEADER;

typedef struct _TSG_CAPABILITY_NAP
{
	unsigned long capabilities;
} TSG_CAPABILITY_NAP, *PTSG_CAPABILITY_NAP;

typedef union
{
	TSG_CAPABILITY_NAP tsgCapNap;
} TSG_CAPABILITIES_UNION, *PTSG_CAPABILITIES_UNION;

typedef struct _TSG_PACKET_CAPABILITIES
{
	unsigned long capabilityType;
	TSG_CAPABILITIES_UNION tsgPacket;
} TSG_PACKET_CAPABILITIES, *PTSG_PACKET_CAPABILITIES;

typedef struct _TSG_PACKET_VERSIONCAPS
{
	TSG_PACKET_HEADER tsgHeader;
	PTSG_PACKET_CAPABILITIES tsgCaps;
	unsigned long numCapabilities;
	unsigned short majorVersion;
	unsigned short minorVersion;
	unsigned short quarantineCapabilities;
} TSG_PACKET_VERSIONCAPS, *PTSG_PACKET_VERSIONCAPS;

typedef struct _TSG_PACKET_QUARCONFIGREQUEST
{
	unsigned long flags;
} TSG_PACKET_QUARCONFIGREQUEST, *PTSG_PACKET_QUARCONFIGREQUEST;

typedef struct _TSG_PACKET_QUARREQUEST
{
	unsigned long flags;
	wchar_t* machineName;
	unsigned long nameLength;
	byte* data;
	unsigned long dataLen;
} TSG_PACKET_QUARREQUEST, *PTSG_PACKET_QUARREQUEST;

typedef struct _TSG_REDIRECTION_FLAGS
{
	BOOL enableAllRedirections;
	BOOL disableAllRedirections;
	BOOL driveRedirectionDisabled;
	BOOL printerRedirectionDisabled;
	BOOL portRedirectionDisabled;
	BOOL reserved;
	BOOL clipboardRedirectionDisabled;
	BOOL pnpRedirectionDisabled;
} TSG_REDIRECTION_FLAGS, *PTSG_REDIRECTION_FLAGS;

typedef struct _TSG_PACKET_RESPONSE
{
	unsigned long flags;
	unsigned long reserved;
	byte* responseData;
	unsigned long responseDataLen;
	TSG_REDIRECTION_FLAGS redirectionFlags;
} TSG_PACKET_RESPONSE,	*PTSG_PACKET_RESPONSE;

typedef struct _TSG_PACKET_QUARENC_RESPONSE
{
	unsigned long flags;
	unsigned long certChainLen;
	wchar_t* certChainData;
	GUID nonce;
	PTSG_PACKET_VERSIONCAPS versionCaps;
} TSG_PACKET_QUARENC_RESPONSE, *PTSG_PACKET_QUARENC_RESPONSE;

typedef struct TSG_PACKET_STRING_MESSAGE
{
	long isDisplayMandatory;
	long isConsentMandatory;
	unsigned long msgBytes;
	wchar_t* msgBuffer;
} TSG_PACKET_STRING_MESSAGE, *PTSG_PACKET_STRING_MESSAGE;

typedef struct TSG_PACKET_REAUTH_MESSAGE
{
	unsigned __int64 tunnelContext;
} TSG_PACKET_REAUTH_MESSAGE, *PTSG_PACKET_REAUTH_MESSAGE;

typedef union
{
	PTSG_PACKET_STRING_MESSAGE consentMessage;
	PTSG_PACKET_STRING_MESSAGE serviceMessage;
	PTSG_PACKET_REAUTH_MESSAGE reauthMessage;
} TSG_PACKET_TYPE_MESSAGE_UNION, *PTSG_PACKET_TYPE_MESSAGE_UNION;

typedef struct _TSG_PACKET_MSG_RESPONSE
{
	unsigned long msgID;
	unsigned long msgType;
	long isMsgPresent;
	TSG_PACKET_TYPE_MESSAGE_UNION messagePacket;
} TSG_PACKET_MSG_RESPONSE, *PTSG_PACKET_MSG_RESPONSE;

typedef struct TSG_PACKET_CAPS_RESPONSE
{
	TSG_PACKET_QUARENC_RESPONSE pktQuarEncResponse;
	TSG_PACKET_MSG_RESPONSE pktConsentMessage;
} TSG_PACKET_CAPS_RESPONSE, *PTSG_PACKET_CAPS_RESPONSE;

typedef struct TSG_PACKET_MSG_REQUEST
{
	unsigned long maxMessagesPerBatch;
} TSG_PACKET_MSG_REQUEST, *PTSG_PACKET_MSG_REQUEST;

typedef struct _TSG_PACKET_AUTH
{
	TSG_PACKET_VERSIONCAPS tsgVersionCaps;
	unsigned long cookieLen;
	byte* cookie;
} TSG_PACKET_AUTH, *PTSG_PACKET_AUTH;

typedef union
{
	PTSG_PACKET_VERSIONCAPS packetVersionCaps;
	PTSG_PACKET_AUTH packetAuth;
} TSG_INITIAL_PACKET_TYPE_UNION, *PTSG_INITIAL_PACKET_TYPE_UNION;

typedef struct TSG_PACKET_REAUTH
{
	unsigned __int64 tunnelContext;
	unsigned long packetId;
	TSG_INITIAL_PACKET_TYPE_UNION tsgInitialPacket;
} TSG_PACKET_REAUTH, *PTSG_PACKET_REAUTH;

typedef union
{
	PTSG_PACKET_HEADER packetHeader;
	PTSG_PACKET_VERSIONCAPS packetVersionCaps;
	PTSG_PACKET_QUARCONFIGREQUEST packetQuarConfigRequest;
	PTSG_PACKET_QUARREQUEST packetQuarRequest;
	PTSG_PACKET_RESPONSE packetResponse;
	PTSG_PACKET_QUARENC_RESPONSE packetQuarEncResponse;
	PTSG_PACKET_CAPS_RESPONSE packetCapsResponse;
	PTSG_PACKET_MSG_REQUEST packetMsgRequest;
	PTSG_PACKET_MSG_RESPONSE packetMsgResponse;
	PTSG_PACKET_AUTH packetAuth;
	PTSG_PACKET_REAUTH packetReauth;
} TSG_PACKET_TYPE_UNION;

typedef struct _TSG_PACKET
{
	unsigned long packetId;
	TSG_PACKET_TYPE_UNION tsgPacket;
} TSG_PACKET, *PTSG_PACKET;

void Opnum0NotUsedOnWire(handle_t IDL_handle);

HRESULT TsProxyCreateTunnel(PTSG_PACKET tsgPacket, PTSG_PACKET* tsgPacketResponse,
		PTUNNEL_CONTEXT_HANDLE_SERIALIZE* tunnelContext, unsigned long* tunnelId);

HRESULT TsProxyAuthorizeTunnel(PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunnelContext,
		PTSG_PACKET tsgPacket, PTSG_PACKET* tsgPacketResponse);

HRESULT TsProxyMakeTunnelCall(PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunnelContext,
		unsigned long procId, PTSG_PACKET tsgPacket, PTSG_PACKET* tsgPacketResponse);

HRESULT TsProxyCreateChannel(PTUNNEL_CONTEXT_HANDLE_NOSERIALIZE tunnelContext,
		PTSENDPOINTINFO tsEndPointInfo, PCHANNEL_CONTEXT_HANDLE_SERIALIZE* channelContext, unsigned long* channelId);

void Opnum5NotUsedOnWire(handle_t IDL_handle);

HRESULT TsProxyCloseChannel(PCHANNEL_CONTEXT_HANDLE_NOSERIALIZE* context);

HRESULT TsProxyCloseTunnel(PTUNNEL_CONTEXT_HANDLE_SERIALIZE* context);

DWORD TsProxySetupReceivePipe(handle_t IDL_handle, byte pRpcMessage[]);

DWORD TsProxySendToServer(handle_t IDL_handle, byte pRpcMessage[], uint32 count, uint32* lengths);

boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port);

int tsg_write(rdpTsg* tsg, uint8* data, uint32 length);
int tsg_read(rdpTsg* tsg, uint8* data, uint32 length);

rdpTsg* tsg_new(rdpTransport* transport);
void tsg_free(rdpTsg* tsg);

#ifdef WITH_DEBUG_TSG
#define DEBUG_TSG(fmt, ...) DEBUG_CLASS(TSG, fmt, ## __VA_ARGS__)
#else
#define DEBUG_TSG(fmt, ...) DEBUG_NULL(fmt, ## __VA_ARGS__)
#endif

#endif /* FREERDP_CORE_TSG_H */


text:
tinyMCE.addToLang('',{
preview_desc : 'Prévisualisation'
});


text:
package com.google.copybara.git;

import java.nio.file.FileSystems;
import java.util.Map;
import javax.annotation.Nullable;

/**
 * Utility for getting the git binary executable path.
 */
public final class GitExecPath {

  private GitExecPath() {
  }

  /**
   * Returns a String representing the git binary to be executed.
   *
   *
The env var {@code GIT_EXEC_PATH} determines where Git looks for its sub-programs, but also
   * the regular git binaries (git, git-upload-pack, etc) are duplicated in {@code GIT_EXEC_PATH}.
   *
   *
If the env var is not set, then we will execute "git", that it will be resolved in the path
   * as usual.
   */
  public static String resolveGitBinary(@Nullable Map<String, String> environment) {
    if (environment != null && environment.containsKey("GIT_EXEC_PATH")) {
      return FileSystems.getDefault()
          .getPath(environment.get("GIT_EXEC_PATH"))
          .resolve("git")
          .toString();
    }
    return "git";
  }

}


text:
package core

import akka.actor.ActorSystem
import akka.testkit.{ImplicitSender, TestActorRef, TestKit}
import org.specs2.mutable.{Specification, SpecificationLike}
import spray.http.Uri

import scala.io.Source
import spray.json._

class TwitterModelSpec extends Specification {
  "twitter model" should {
    "decode json" in {
      val body = Source.fromInputStream(getClass.getResourceAsStream("/tweet.json")).mkString

      body.parseJson.convertTo[Tweet] // no exception
      1 mustEqual 1
    }
  }
}


text:
/*-*
 * Copyright © 2010-2015 Atilika Inc. and contributors (see CONTRIBUTORS.md)
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.  A copy of the
 * License is distributed with this work in the LICENSE.md file.  You may
 * also obtain a copy of the License from
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.atilika.kuromoji;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import static org.junit.Assert.*;

public class TestUtils {

    public static void assertTokenSurfacesEquals(List<String> expectedSurfaces,
                    List<? extends TokenBase> actualTokens) {
        List<String> actualSurfaces = new ArrayList<>();

        for (TokenBase token : actualTokens) {
            actualSurfaces.add(token.getSurface());
        }

        assertEquals(expectedSurfaces, actualSurfaces);
    }

    public static void assertCanTokenizeStream(InputStream untokenizedInput, TokenizerBase tokenizer)
                    throws IOException {
        BufferedReader untokenizedInputReader =
                        new BufferedReader(new InputStreamReader(untokenizedInput, StandardCharsets.UTF_8));

        String untokenizedLine;

        while ((untokenizedLine = untokenizedInputReader.readLine()) != null) {
            assertCanTokenizeString(untokenizedLine, tokenizer);
        }

        assertTrue(true);
    }

    public static void assertCanTokenizeString(String input, TokenizerBase tokenizer) {
        List<? extends TokenBase> tokens = tokenizer.tokenize(input);

        if (input.length() > 0) {
            assertFalse(tokens.isEmpty());
        } else {
            assertTrue(tokens.isEmpty());
        }
    }

    public static void assertTokenizedStreamEquals(InputStream tokenizedInput, InputStream untokenizedInput,
                    TokenizerBase tokenizer) throws IOException {
        BufferedReader untokenizedInputReader =
                        new BufferedReader(new InputStreamReader(untokenizedInput, StandardCharsets.UTF_8));
        BufferedReader tokenizedInputReader =
                        new BufferedReader(new InputStreamReader(tokenizedInput, StandardCharsets.UTF_8));

        String untokenizedLine;

        while ((untokenizedLine = untokenizedInputReader.readLine()) != null) {
            List<? extends TokenBase> tokens = tokenizer.tokenize(untokenizedLine);

            for (TokenBase token : tokens) {
                String tokenLine = tokenizedInputReader.readLine();

                assertNotNull(tokenLine);

                // TODO: Verify if this tab handling is correct...
                String[] parts = tokenLine.split("\\t", 2);
                String surface = parts[0];
                String features = parts[1];

                assertEquals(surface, token.getSurface());
                assertEquals(features, token.getAllFeatures());
            }
        }
    }

    public static void assertMultiThreadedTokenizedStreamEquals(int numThreads, final int perThreadRuns,
                    final String tokenizedInputResource, final String untokenizedInputResource,
                    final TokenizerBase tokenizer) throws IOException, InterruptedException {
        List<Thread> threads = new ArrayList<>();

        for (int i = 0; i < numThreads; i++) {
            Thread thread = new Thread(new Runnable() {
                @Override
                public void run() {
                    for (int run = 0; run < perThreadRuns; run++) {

                        //                            System.out.println(Thread.currentThread().getName() + ": tokenizer run " + run);

                        try {
                            InputStream tokenizedInput = getClass().getResourceAsStream(tokenizedInputResource);
                            InputStream untokenizedInput = getClass().getResourceAsStream(untokenizedInputResource);

                            assertTokenizedStreamEquals(tokenizedInput, untokenizedInput, tokenizer);

                            untokenizedInput.close();
                            tokenizedInput.close();
                        } catch (IOException e) {
                            fail(e.getMessage());
                        }
                    }
                }
            });
            threads.add(thread);
            thread.start();
        }

        for (Thread thread : threads) {
            thread.join();
        }

        assertTrue(true);
    }

    public static void assertEqualTokenFeatureLengths(String text, TokenizerBase tokenizer) {
        List<? extends TokenBase> tokens = tokenizer.tokenize(text);
        Set<Integer> lengths = new HashSet<>();

        for (TokenBase token : tokens) {
            lengths.add(token.getAllFeaturesArray().length);
        }

        assertEquals(1, lengths.size());
    }
}