text:
/**
 * Manage downloads
 */

(function() {

var cache = {};
var form = $('form');
var minified = true;

var dependencies = {};

var qstr = window.location.search.match(/(?:languages|plugins)=[-+\w]+|themes=[-\w]+/g);
if (qstr) {
	qstr.forEach(function(str) {
		var kv = str.split('=', 2),
			category = kv[0],
			ids = kv[1].split('+');
		if (category !== 'meta' && category !== 'core' && components[category]) {
			for (var id in components[category]) {
				if (components[category][id].option) {
					delete components[category][id].option;
				}
			};
			ids.forEach(function(id) {
				if (id !== 'meta') {
					if (components[category][id]) {
						var requireId = id;
						while (requireId && components[category][requireId] && components[category][requireId].option !== 'default') {
							if (typeof components[category][requireId] === 'string') {
								components[category][requireId] = { title: components[category][requireId] }
							}
							components[category][requireId].option = 'default';
							requireId = components[category][requireId].require;
						}
					}
				}
			});
		}
	});
}

for (var category in components) {
	var all = components[category];

	all.meta.section = $u.element.create('section', {
		className: 'options',
		id: 'category-' + category,
		contents: {
			tag: 'h1',
			contents: category.charAt(0).toUpperCase() + category.slice(1)
		},
		inside: '#components'
	});

	for (var id in all) {
		if(id === 'meta') {
			continue;
		}

		var checked = false, disabled = false;
		var option = all[id].option || all.meta.option;

		switch (option) {
			case 'mandatory': disabled = true; // fallthrough
			case 'default': checked = true;
		}

		var filepath = all.meta.path.replace(/\{id}/g, id);

		var info = all[id] = {
			title: all[id].title || all[id],
			noCSS: all[id].noCSS || all.meta.noCSS,
			noJS: all[id].noJS || all.meta.noJS,
			enabled: checked,
			require: all[id].require,
			owner: all[id].owner,
			files: {
				minified: {
					paths: [],
					size: 0
				},
				dev: {
					paths: [],
					size: 0
				}
			}
		};

		if (info.require) {
			dependencies[info.require] = (dependencies[info.require] || []).concat(id);
		}

		if (!all[id].noJS && !/\.css$/.test(filepath)) {
			info.files.minified.paths.push(filepath.replace(/(\.js)?$/, '.min.js'));
			info.files.dev.paths.push(filepath.replace(/(\.js)?$/, '.js'));
		}

		if ((!all[id].noCSS && !/\.js$/.test(filepath)) || /\.css$/.test(filepath)) {
			var cssFile = filepath.replace(/(\.css)?$/, '.css');

			info.files.minified.paths.push(cssFile);
			info.files.dev.paths.push(cssFile);
		}

		$u.element.create('label', {
			attributes: {
				'data-id': id
			},
			contents: [
				{
					tag: 'input',
					properties: {
						type: all.meta.exclusive? 'radio' : 'checkbox',
						name: 'download-' + category,
						value: id,
						checked: checked,
						disabled: disabled,
						onclick: (function(id, category, all){
							return function () {
								$$('input[name="' + this.name + '"]').forEach(function(input) {
									all[input.value].enabled = input.checked;
								});

								if (all[id].require && this.checked) {
									var input = $('label[data-id="' + all[id].require + '"] > input');
									input.checked = true;

									input.onclick();
								}

								if (dependencies[id] && !this.checked) { // It's required by others
									dependencies[id].forEach(function(dependent) {
										var input = $('label[data-id="' + dependent + '"] > input');
										input.checked = false;

										input.onclick();
									});
								}

								update(category, id);
							};
						})(id, category, all)
					}
				},
				all.meta.link? {
					tag: 'a',
					properties: {
						href: all.meta.link.replace(/\{id}/g, id)
					},
					contents: info.title
				} : info.title,
				all[id].owner? {
					tag: 'a',
					properties: {
						href: 'http://github.com/' + all[id].owner,
						className: 'owner',
						target: '_blank'
					},
					contents: all[id].owner
				} : ' ',
				{
					tag: 'strong',
					className: 'filesize'
				}
			],
			inside: all.meta.section
		});
	}
}

form.elements.compression[0].onclick =
form.elements.compression[1].onclick = function() {
	minified = !!+this.value;

	fetchFiles();
}

function fetchFiles() {
	for (var category in components) {
		var all = components[category];

		for (var id in all) {
			if(id === 'meta') {
				continue;
			}

			var distro = all[id].files[minified? 'minified' : 'dev'],
			    files = distro.paths;

			files.forEach(function (filepath) {
				var file = cache[filepath] = cache[filepath] || {};

				if (!file.contents) {

					(function(category, id, file, filepath, distro){

					$u.xhr({
						url: filepath,
						callback: function(xhr) {
							if (xhr.status < 400) {

								file.contents = xhr.responseText;

								file.size = +xhr.getResponseHeader('Content-Length') || file.contents.length;

								distro.size += file.size;

								update(category, id);
							}
						}
					});
					})(category, id, file, filepath, distro);
				}
				else {
					update(category, id);
				}
			});
		}
	}
}

fetchFiles();

function prettySize(size) {
	return Math.round(100 * size / 1024)/100 + 'KB';
}

function update(updatedCategory, updatedId){
	// Update total size
	var total = {js: 0, css: 0}, updated = {js: 0, css: 0};

	for (var category in components) {
		var all = components[category];

		for (var id in all) {
			var info = all[id];

			if (info.enabled || id == updatedId) {
				var distro = info.files[minified? 'minified' : 'dev'];

				distro.paths.forEach(function(path) {
					if (cache[path]) {
						var type = path.match(/\.(\w+)$/)[1],
						    size = cache[path].size || 0;

						if (info.enabled) {
							total[type] += size;
						}

						if (id == updatedId) {
							updated[type] += size;
						}
					}
				});
			}
		}
	}

	total.all = total.js + total.css;
	updated.all = updated.js + updated.css;

	$u.element.prop($('label[data-id="' + updatedId + '"] .filesize'), {
		textContent: prettySize(updated.all),
		title: (updated.js? Math.round(100 * updated.js / updated.all) + '% JavaScript' : '') +
				(updated.js && updated.css? ' + ' : '') +
				(updated.css? Math.round(100 * updated.css / updated.all) + '% CSS' : '')
	});

	$('#filesize').textContent = prettySize(total.all);

	$u.element.prop($('#percent-js'), {
		textContent: Math.round(100 * total.js / total.all) + '%',
		title: prettySize(total.js)
	});

	$u.element.prop($('#percent-css'), {
		textContent: Math.round(100 * total.css / total.all) + '%',
		title: prettySize(total.css)
	});

	delayedGenerateCode();
}

var timerId = 0;
// "debounce" multiple rapid requests to generate and highlight code
function delayedGenerateCode(){
	if ( timerId !== 0 ) {
		clearTimeout(timerId);
	}
	timerId = setTimeout(generateCode, 500);
}
function generateCode(){
	var code = {js: '', css: ''};
	var redownload = {};

	for (var category in components) {
		var all = components[category];

		for (var id in all) {
			if(id === 'meta') {
				continue;
			}

			var info = all[id];
			if (info.enabled) {
				if (category !== 'core') {
					redownload[category] = redownload[category]  || [];
					redownload[category].push(id);
				}
				info.files[minified? 'minified' : 'dev'].paths.forEach(function (path) {
					if (cache[path]) {
						var type = path.match(/\.(\w+)$/)[1];

						code[type] += cache[path].contents + (type === 'js'? ';' : '') + '\n';
					}
				});
			}
		}
	}

	var redownloadUrl = window.location.href.split("?")[0] + "?";
	for (var category in redownload) {
		redownloadUrl += category + "=" + redownload[category].join('+') + "&";
	}
	redownloadUrl = "/* " + redownloadUrl.replace(/&$/,"") + " */";

	for (var type in code) {
		var codeElement = $('#download-' + type + ' code');

		codeElement.textContent = redownloadUrl + "\n" + code[type];
		Prism.highlightElement(codeElement, true);

		$('#download-' + type + ' .download-button').href = 'data:application/octet-stream;charset=utf-8,' + encodeURIComponent(redownloadUrl + "\n" + code[type]);
	}
}

})();


text:
package org.apache.flink.hdfstests;

import java.io.FileOutputStream;
import org.apache.commons.io.FileUtils;
import org.apache.flink.api.common.ExecutionConfig;
import org.apache.flink.api.common.io.FileInputFormat;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.io.TextInputFormat;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.typeutils.TypeExtractor;
import org.apache.flink.core.fs.FileInputSplit;
import org.apache.flink.core.fs.Path;
import org.apache.flink.core.testutils.OneShotLatch;
import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.functions.source.ContinuousFileMonitoringFunction;
import org.apache.flink.streaming.api.functions.source.ContinuousFileReaderOperator;
import org.apache.flink.streaming.api.functions.source.FileProcessingMode;
import org.apache.flink.streaming.api.functions.source.SourceFunction;
import org.apache.flink.streaming.api.functions.source.TimestampedFileInputSplit;
import org.apache.flink.streaming.api.operators.StreamSource;
import org.apache.flink.streaming.api.watermark.Watermark;
import org.apache.flink.streaming.runtime.streamrecord.StreamRecord;
import org.apache.flink.streaming.runtime.tasks.OperatorStateHandles;
import org.apache.flink.streaming.util.AbstractStreamOperatorTestHarness;
import org.apache.flink.streaming.util.OneInputStreamOperatorTestHarness;
import org.apache.flink.streaming.util.OperatorSnapshotUtil;
import org.apache.flink.util.Preconditions;
import org.junit.Assert;
import org.junit.ClassRule;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import java.io.File;
import java.io.IOException;

public class ContinuousFileProcessingFrom12MigrationTest {

	private static final int LINES_PER_FILE = 10;

	private static final long INTERVAL = 100;

	@ClassRule
	public static TemporaryFolder tempFolder = new TemporaryFolder();

	/**
	 * Manually run this to write binary snapshot data. Remove @Ignore to run.
	 */
	@Ignore
	@Test
	public void writeReaderSnapshot() throws Exception {

		File testFolder = tempFolder.newFolder();

		TimestampedFileInputSplit split1 =
				new TimestampedFileInputSplit(0, 3, new Path("test/test1"), 0, 100, null);

		TimestampedFileInputSplit split2 =
				new TimestampedFileInputSplit(10, 2, new Path("test/test2"), 101, 200, null);

		TimestampedFileInputSplit split3 =
				new TimestampedFileInputSplit(10, 1, new Path("test/test2"), 0, 100, null);

		TimestampedFileInputSplit split4 =
				new TimestampedFileInputSplit(11, 0, new Path("test/test3"), 0, 100, null);

		// this always blocks to ensure that the reader doesn't to any actual processing so that
		// we keep the state for the four splits
		final OneShotLatch blockingLatch = new OneShotLatch();
		BlockingFileInputFormat format = new BlockingFileInputFormat(blockingLatch, new Path(testFolder.getAbsolutePath()));

		TypeInformation<FileInputSplit> typeInfo = TypeExtractor.getInputFormatTypes(format);
		ContinuousFileReaderOperator<FileInputSplit> initReader = new ContinuousFileReaderOperator<>(
				format);
		initReader.setOutputType(typeInfo, new ExecutionConfig());
		OneInputStreamOperatorTestHarness<TimestampedFileInputSplit, FileInputSplit> testHarness =
				new OneInputStreamOperatorTestHarness<>(initReader);
		testHarness.setTimeCharacteristic(TimeCharacteristic.EventTime);
		testHarness.open();
		// create some state in the reader
		testHarness.processElement(new StreamRecord<>(split1));
		testHarness.processElement(new StreamRecord<>(split2));
		testHarness.processElement(new StreamRecord<>(split3));
		testHarness.processElement(new StreamRecord<>(split4));
		// take a snapshot of the operator's state. This will be used
		// to initialize another reader and compare the results of the
		// two operators.

		final OperatorStateHandles snapshot;
		synchronized (testHarness.getCheckpointLock()) {
			snapshot = testHarness.snapshot(0L, 0L);
		}

		OperatorSnapshotUtil.writeStateHandle(snapshot, "src/test/resources/reader-migration-test-flink1.2-snapshot");
	}

	@Test
	public void testReaderRestore() throws Exception {
		File testFolder = tempFolder.newFolder();

		final OneShotLatch latch = new OneShotLatch();

		BlockingFileInputFormat format = new BlockingFileInputFormat(latch, new Path(testFolder.getAbsolutePath()));
		TypeInformation<FileInputSplit> typeInfo = TypeExtractor.getInputFormatTypes(format);

		ContinuousFileReaderOperator<FileInputSplit> initReader = new ContinuousFileReaderOperator<>(format);
		initReader.setOutputType(typeInfo, new ExecutionConfig());

		OneInputStreamOperatorTestHarness<TimestampedFileInputSplit, FileInputSplit> testHarness =
			new OneInputStreamOperatorTestHarness<>(initReader);
		testHarness.setTimeCharacteristic(TimeCharacteristic.EventTime);

		testHarness.setup();
		OperatorStateHandles operatorStateHandles = OperatorSnapshotUtil.readStateHandle(
				OperatorSnapshotUtil.getResourceFilename(
						"reader-migration-test-flink1.2-snapshot"));
		testHarness.initializeState(operatorStateHandles);
		testHarness.open();

		latch.trigger();

		// ... and wait for the operators to close gracefully

		synchronized (testHarness.getCheckpointLock()) {
			testHarness.close();
		}

		TimestampedFileInputSplit split1 =
				new TimestampedFileInputSplit(0, 3, new Path("test/test1"), 0, 100, null);

		TimestampedFileInputSplit split2 =
				new TimestampedFileInputSplit(10, 2, new Path("test/test2"), 101, 200, null);

		TimestampedFileInputSplit split3 =
				new TimestampedFileInputSplit(10, 1, new Path("test/test2"), 0, 100, null);

		TimestampedFileInputSplit split4 =
				new TimestampedFileInputSplit(11, 0, new Path("test/test3"), 0, 100, null);

		// compare if the results contain what they should contain and also if
		// they are the same, as they should.

		Assert.assertTrue(testHarness.getOutput().contains(new StreamRecord<>(split1)));
		Assert.assertTrue(testHarness.getOutput().contains(new StreamRecord<>(split2)));
		Assert.assertTrue(testHarness.getOutput().contains(new StreamRecord<>(split3)));
		Assert.assertTrue(testHarness.getOutput().contains(new StreamRecord<>(split4)));
	}

	/**
	 * Manually run this to write binary snapshot data. Remove @Ignore to run.
	 */
	@Ignore
	@Test
	public void writeMonitoringSourceSnapshot() throws Exception {

		File testFolder = tempFolder.newFolder();

		long fileModTime = Long.MIN_VALUE;
		for (int i = 0; i < 1; i++) {
			Tuple2<File, String> file = createFileAndFillWithData(testFolder, "file", i, "This is test line.");
			fileModTime = file.f0.lastModified();
		}

		TextInputFormat format = new TextInputFormat(new Path(testFolder.getAbsolutePath()));

		final ContinuousFileMonitoringFunction<String> monitoringFunction =
			new ContinuousFileMonitoringFunction<>(format, FileProcessingMode.PROCESS_CONTINUOUSLY, 1, INTERVAL);

		StreamSource<TimestampedFileInputSplit, ContinuousFileMonitoringFunction<String>> src =
			new StreamSource<>(monitoringFunction);

		final AbstractStreamOperatorTestHarness<TimestampedFileInputSplit> testHarness =
				new AbstractStreamOperatorTestHarness<>(src, 1, 1, 0);

		testHarness.open();

		final Throwable[] error = new Throwable[1];

		final OneShotLatch latch = new OneShotLatch();

		// run the source asynchronously
		Thread runner = new Thread() {
			@Override
			public void run() {
				try {
					monitoringFunction.run(new DummySourceContext() {
						@Override
						public void collect(TimestampedFileInputSplit element) {
							latch.trigger();
						}

						@Override
						public void markAsTemporarilyIdle() {

						}
					});
				}
				catch (Throwable t) {
					t.printStackTrace();
					error[0] = t;
				}
			}
		};
		runner.start();

		if (!latch.isTriggered()) {
			latch.await();
		}

		final OperatorStateHandles snapshot;
		synchronized (testHarness.getCheckpointLock()) {
			snapshot = testHarness.snapshot(0L, 0L);
		}

		OperatorSnapshotUtil.writeStateHandle(
				snapshot,
				"src/test/resources/monitoring-function-migration-test-" + fileModTime +"-flink1.2-snapshot");

		monitoringFunction.cancel();
		runner.join();

		testHarness.close();
	}

	@Test
	public void testMonitoringSourceRestore() throws Exception {

		File testFolder = tempFolder.newFolder();

		Long expectedModTime = Long.parseLong("1493116191000");
		TextInputFormat format = new TextInputFormat(new Path(testFolder.getAbsolutePath()));

		final ContinuousFileMonitoringFunction<String> monitoringFunction =
			new ContinuousFileMonitoringFunction<>(format, FileProcessingMode.PROCESS_CONTINUOUSLY, 1, INTERVAL);

		StreamSource<TimestampedFileInputSplit, ContinuousFileMonitoringFunction<String>> src =
			new StreamSource<>(monitoringFunction);

		final AbstractStreamOperatorTestHarness<TimestampedFileInputSplit> testHarness =
			new AbstractStreamOperatorTestHarness<>(src, 1, 1, 0);

		testHarness.setup();
		OperatorStateHandles operatorStateHandles = OperatorSnapshotUtil.readStateHandle(
				OperatorSnapshotUtil.getResourceFilename(
						"monitoring-function-migration-test-1493116191000-flink1.2-snapshot"));

		testHarness.initializeState(operatorStateHandles);
		testHarness.open();

		Assert.assertEquals((long) expectedModTime, monitoringFunction.getGlobalModificationTime());

	}

	private static class BlockingFileInputFormat extends FileInputFormat<FileInputSplit> {

		private static final long serialVersionUID = -6727603565381560267L;

		private final OneShotLatch latch;

		private FileInputSplit split;

		private boolean reachedEnd;

		BlockingFileInputFormat(OneShotLatch latch, Path filePath) {
			super(filePath);
			this.latch = latch;
			this.reachedEnd = false;
		}

		@Override
		public void open(FileInputSplit fileSplit) throws IOException {
			this.split = fileSplit;
			this.reachedEnd = false;
		}

		@Override
		public boolean reachedEnd() throws IOException {
			if (!latch.isTriggered()) {
				try {
					latch.await();
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
			return reachedEnd;
		}

		@Override
		public FileInputSplit nextRecord(FileInputSplit reuse) throws IOException {
			this.reachedEnd = true;
			return split;
		}

		@Override
		public void close() {

		}
	}

	private static abstract class DummySourceContext
		implements SourceFunction.SourceContext<TimestampedFileInputSplit> {

		private final Object lock = new Object();

		@Override
		public void collectWithTimestamp(TimestampedFileInputSplit element, long timestamp) {
		}

		@Override
		public void emitWatermark(Watermark mark) {
		}

		@Override
		public Object getCheckpointLock() {
			return lock;
		}

		@Override
		public void close() {
		}
	}

	/**
	 * Create a file with pre-determined String format of the form:
	 * {@code fileIdx +": "+ sampleLine +" "+ lineNo}.
	 * */
	private Tuple2<File, String> createFileAndFillWithData(
		File base, String fileName, int fileIdx, String sampleLine) throws IOException {

		File file = new File(base, fileName + fileIdx);
		Assert.assertFalse(file.exists());

		File tmp = new File(base, "." + fileName + fileIdx);
		FileOutputStream stream = new FileOutputStream(tmp);
		StringBuilder str = new StringBuilder();
		for (int i = 0; i < LINES_PER_FILE; i++) {
			String line = fileIdx +": "+ sampleLine + " " + i +"\n";
			str.append(line);
			stream.write(line.getBytes());
		}
		stream.close();

		FileUtils.moveFile(tmp, file);

		Assert.assertTrue("No result file present", file.exists());
		return new Tuple2<>(file, str.toString());
	}
}

redpajama_set_name: RedPajamaGithub


text:
require_relative '../spec_helper'

module Aws
  module EC2
    describe Instance do

      let(:client) { Client.new(stub_responses: true) }

      describe '#decrypt_windows_password' do

        let(:keypair) { File.expand_path('../../fixtures/keypair', __FILE__) }

        it 'decrypts the password using the given key pair' do
          expect(client).to receive(:get_password_data).
            with(instance_id:'id').
            and_return(client.stub_data(:get_password_data,
              password_data: "dALtWVWEb9LL1rBz0oluXvTK5sHcJzzS4PtiiX/17pOFs0D6+JV7mWMPG9I4\ngRoW64SZ7hmRz7fFRuJcR5sDzfmgDs6Fimd456WR9/HJ29XBv1HyPHN7EvtR\nxJ4/+iXXhVWrQeZy8aCGhcqQhRw5/xrHE7rpc014rzxRtqybqKoeEJPV+4WP\ngUWyo3BD0ui06B7zLJL2sYfALphelAYzlzehwD63M0nuovleuMeVSJKcqqR9\nuMiXvm8nogZhLUEFvUucWxSHECB9cdTH3rJ0ANs+kl4hSgV/9KX/I3MlQYuY\ngLR4DUSpuYj/XTMyl+zjxPAPbk63zTpMd+T0NKgeWA==\n"
            ))
          instance = Instance.new('id', client: client)
          expect(instance.decrypt_windows_password(keypair)).to eq('password')
        end

        it 'raises an error if the password data is an empty string' do
          client.stub_responses(:get_password_data, password_data: '')
          instance = Instance.new('id', client: client)
          expect {
            instance.decrypt_windows_password(keypair)
          }.to raise_error(/password not available/)
        end

      end

    end
  end
end


text:
package com.docdevevelopers.game.moonstuff;

import com.badlogic.gdx.InputProcessor;

public class KeyHandler implements InputProcessor {

	@Override
	public boolean keyDown(int keycode) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean keyUp(int keycode) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean keyTyped(char character) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean touchDown(int screenX, int screenY, int pointer, int button) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean touchUp(int screenX, int screenY, int pointer, int button) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean touchDragged(int screenX, int screenY, int pointer) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean mouseMoved(int screenX, int screenY) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean scrolled(int amount) {
		// TODO Auto-generated method stub
		return false;
	}

}


text:
#ifndef __MONO_SGEN_CARD_TABLE_INLINES_H__
#define __MONO_SGEN_CARD_TABLE_INLINES_H__

void sgen_card_table_reset_region (mword start, mword end) MONO_INTERNAL;
void* sgen_card_table_align_pointer (void *ptr) MONO_INTERNAL;
void sgen_card_table_mark_range (mword address, mword size) MONO_INTERNAL;
void sgen_cardtable_scan_object (char *obj, mword obj_size, guint8 *cards,
		gboolean mod_union, SgenGrayQueue *queue) MONO_INTERNAL;

gboolean sgen_card_table_get_card_data (guint8 *dest, mword address, mword cards) MONO_INTERNAL;

guint8* sgen_card_table_update_mod_union_from_cards (guint8 *dest, guint8 *start_card, size_t num_cards) MONO_INTERNAL;
guint8* sgen_card_table_update_mod_union (guint8 *dest, char *obj, mword obj_size, size_t *out_num_cards) MONO_INTERNAL;

void sgen_card_table_init (SgenRemeberedSet *remset) MONO_INTERNAL;

/*How many bytes a single card covers*/
#define CARD_BITS 9

/* How many bits of the address space is covered by the card table.
 * If this value is smaller than the number of address bits, card aliasing is required.
 */
#define CARD_TABLE_BITS 32

#define CARD_SIZE_IN_BYTES (1 << CARD_BITS)
#define CARD_COUNT_BITS (CARD_TABLE_BITS - CARD_BITS)
#define CARD_COUNT_IN_BYTES (1 << CARD_COUNT_BITS)
#define CARD_MASK ((1 << CARD_COUNT_BITS) - 1)

#if SIZEOF_VOID_P * 8 > CARD_TABLE_BITS
#define SGEN_HAVE_OVERLAPPING_CARDS	1
#endif

extern guint8 *sgen_cardtable MONO_INTERNAL;

#ifdef SGEN_HAVE_OVERLAPPING_CARDS

static inline guint8*
sgen_card_table_get_card_address (mword address)
{
	return sgen_cardtable + ((address >> CARD_BITS) & CARD_MASK);
}

extern guint8 *sgen_shadow_cardtable MONO_INTERNAL;

static inline guint8*
sgen_card_table_get_shadow_card_address (mword address)
{
	return sgen_shadow_cardtable + ((address >> CARD_BITS) & CARD_MASK);
}

static inline gboolean
sgen_card_table_card_begin_scanning (mword address)
{
	return *sgen_card_table_get_shadow_card_address (address) != 0;
}

static inline void
sgen_card_table_prepare_card_for_scanning (guint8 *card)
{
}

#define sgen_card_table_get_card_scan_address sgen_card_table_get_shadow_card_address

#else

static inline guint8*
sgen_card_table_get_card_address (mword address)
{
	return sgen_cardtable + (address >> CARD_BITS);
}

static inline gboolean
sgen_card_table_card_begin_scanning (mword address)
{
	guint8 *card = sgen_card_table_get_card_address (address);
	gboolean res = *card;
	*card = 0;
	return res;
}

static inline void
sgen_card_table_prepare_card_for_scanning (guint8 *card)
{
	*card = 0;
}

#define sgen_card_table_get_card_scan_address sgen_card_table_get_card_address

#endif

static inline gboolean
sgen_card_table_address_is_marked (mword address)
{
	return *sgen_card_table_get_card_address (address) != 0;
}

static inline void
sgen_card_table_mark_address (mword address)
{
	*sgen_card_table_get_card_address (address) = 1;
}

#endif


text:
<program xmlns="http://ci.uchicago.edu/swift/2009/02/swiftscript"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <procedure name="echo" src="line 2">

      <input
    name="i" type="int"

     xsi:nil="true" />
    <binding>
      <application src="line 2">
        <executable>echo</executable>
        <variableReference>i</variableReference>  </application>
    </binding>
  </procedure>
  <variable name="sa" type="int[]" isGlobal="false" xsi:nil="true"/>
  <foreach var="s"  src="line 5">
  <in><variableReference>sa</variableReference></in>
  <body><call proc="echo" src="line 5">
      <input><variableReference>s</variableReference></input>
    </call></body>
  </foreach>
</program>


text:
package boofcv.examples.tracking;

import boofcv.abst.feature.detect.interest.ConfigFastHessian;
import boofcv.abst.feature.detect.interest.ConfigGeneralDetector;
import boofcv.abst.feature.tracker.PointTrack;
import boofcv.abst.feature.tracker.PointTracker;
import boofcv.alg.filter.derivative.GImageDerivativeOps;
import boofcv.alg.tracker.klt.PkltConfig;
import boofcv.factory.feature.tracker.FactoryPointTracker;
import boofcv.gui.feature.VisualizeFeatures;
import boofcv.gui.image.ImagePanel;
import boofcv.gui.image.ShowImages;
import boofcv.io.image.SimpleImageSequence;
import boofcv.io.video.VideoMjpegCodec;
import boofcv.io.wrapper.images.JpegByteImageSequence;
import boofcv.misc.BoofMiscOps;
import boofcv.struct.image.ImageFloat32;
import boofcv.struct.image.ImageSingleBand;

import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.List;

/**
 * <p>
 * Example of how to use the {@link boofcv.abst.feature.tracker.PointTracker} to track different types of point features.
 * ImagePointTracker hides much of the complexity involved in tracking point features and masks
 * the very different underlying structures used by these different trackers.  The default trackers
 * provided in BoofCV are general purpose trackers, that might not be the best tracker or utility
 * the underlying image features the best in all situations.
 * </p>
 *
 * @author Peter Abeles
 */
public class ExamplePointFeatureTracker< T extends ImageSingleBand, D extends ImageSingleBand>
{
	// type of input image
	Class<T> imageType;
	Class<D> derivType;

	// tracks point features inside the image
	PointTracker<T> tracker;

	// displays the video sequence and tracked features
	ImagePanel gui = new ImagePanel();

	public ExamplePointFeatureTracker(Class<T> imageType) {
		this.imageType = imageType;
		this.derivType = GImageDerivativeOps.getDerivativeType(imageType);
	}

	/**
	 * Processes the sequence of images and displays the tracked features in a window
	 */
	public void process(SimpleImageSequence<T> sequence) {

		// Figure out how large the GUI window should be
		T frame = sequence.next();
		gui.setPreferredSize(new Dimension(frame.getWidth(),frame.getHeight()));
		ShowImages.showWindow(gui,"KTL Tracker");

		// process each frame in the image sequence
		while( sequence.hasNext() ) {
			frame = sequence.next();

			// tell the tracker to process the frame
			tracker.process(frame);

			// if there are too few tracks spawn more
			if( tracker.getActiveTracks(null).size() < 100 )
				tracker.spawnTracks();

			// visualize tracking results
			updateGUI(sequence);

			// wait for a fraction of a second so it doesn't process to fast
			BoofMiscOps.pause(100);
		}
	}

	/**
	 * Draw tracked features in blue, or red if they were just spawned.
	 */
	private void updateGUI(SimpleImageSequence<T> sequence) {
		BufferedImage orig = sequence.getGuiImage();
		Graphics2D g2 = orig.createGraphics();

		// draw active tracks as blue dots
		for( PointTrack p : tracker.getActiveTracks(null) ) {
			VisualizeFeatures.drawPoint(g2, (int)p.x, (int)p.y, Color.blue);
		}

		// draw tracks which have just been spawned green
		for( PointTrack p : tracker.getNewTracks(null) ) {
			VisualizeFeatures.drawPoint(g2, (int)p.x, (int)p.y, Color.green);
		}

		// tell the GUI to update
		gui.setBufferedImage(orig);
		gui.repaint();
	}

	/**
	 * A simple way to create a Kanade-Lucas-Tomasi (KLT) tracker.
	 */
	public void createKLT() {
		PkltConfig config = new PkltConfig();
		config.templateRadius = 3;
		config.pyramidScaling = new int[]{1,2,4,8};

		tracker = FactoryPointTracker.klt(config, new ConfigGeneralDetector(200, 3, 1),
				imageType, derivType);
	}

	/**
	 * Creates a SURF feature tracker.
	 */
	public void createSURF() {
		ConfigFastHessian configDetector = new ConfigFastHessian();
		configDetector.maxFeaturesPerScale = 200;
		configDetector.extractRadius = 3;
		configDetector.initialSampleSize = 2;
		tracker = FactoryPointTracker.dda_FH_SURF_Fast(configDetector, null, null, imageType);
	}

	public static void main( String args[] ) throws FileNotFoundException {

		Class imageType = ImageFloat32.class;

		// loads an MJPEG video sequence
		VideoMjpegCodec codec = new VideoMjpegCodec();
		List<byte[]> data = codec.read(new FileInputStream("../data/applet/zoom.mjpeg"));
		SimpleImageSequence sequence = new JpegByteImageSequence(imageType,data,true);

		ExamplePointFeatureTracker app = new ExamplePointFeatureTracker(imageType);

		// Comment or un-comment to change the type of tracker being used
		app.createKLT();
//		app.createSURF();

		app.process(sequence);
	}
}


text:
package com.github.hburgmeier.jerseyoauth2.testsuite.resource;

import javax.jws.WebParam;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.SecurityContext;

import com.github.hburgmeier.jerseyoauth2.rs.api.IOAuthPrincipal;
import com.github.hburgmeier.jerseyoauth2.rs.api.annotations.AllowedScopes;
import com.github.hburgmeier.jerseyoauth2.rs.api.annotations.OAuth20;
import com.github.hburgmeier.jerseyoauth2.testsuite.base.SampleEntity;

@Path("/sample2")
@OAuth20
@AllowedScopes(scopes={"defaultScope"})
public class Sample2Resource {

	@GET
	@Path("/{id}")
	@Produces({ MediaType.APPLICATION_JSON })
	public SampleEntity getEntity(@WebParam(name="id") String id, @Context SecurityContext securityContext)
	{
		IOAuthPrincipal principal = (IOAuthPrincipal)securityContext.getUserPrincipal();
		return new SampleEntity(id, principal.getUser().getName(), principal.getClientId());
	}

}


text:
// ------------------------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License (MIT). See License.txt in the repo root for license information.
// ------------------------------------------------------------------------------------------------

using Xunit;
using Xunit.Abstractions;

namespace Microsoft.PSharp.TestingServices.Tests
{
    public class IdempotentRegisterMonitorTest : BaseTest
    {
        public IdempotentRegisterMonitorTest(ITestOutputHelper output)
            : base(output)
        {
        }

        private class Counter
        {
            public int Value;

            public Counter()
            {
                this.Value = 0;
            }
        }

        private class E : Event
        {
            public Counter Counter;

            public E(Counter counter)
            {
                this.Counter = counter;
            }
        }

        private class M : Monitor
        {
            [Start]
            [OnEventDoAction(typeof(E), nameof(Check))]
            private class Init : MonitorState
            {
            }

            private void Check()
            {
                var counter = (this.ReceivedEvent as E).Counter;
                counter.Value++;
            }
        }

        private class N : Machine
        {
            [Start]
            [OnEntry(nameof(InitOnEntry))]
            private class Init : MachineState
            {
            }

            private void InitOnEntry()
            {
                Counter counter = new Counter();
                this.Monitor(typeof(M), new E(counter));
                this.Assert(counter.Value == 1, "Monitor created more than once.");
            }
        }

        [Fact(Timeout=5000)]
        public void TestIdempotentRegisterMonitorInvocation()
        {
            this.Test(r =>
            {
                r.RegisterMonitor(typeof(M));
                r.RegisterMonitor(typeof(M));
                MachineId n = r.CreateMachine(typeof(N));
            });
        }
    }
}


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

<title>EdgeTypeData</title>
<meta name="date" content="2013-01-20">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

com.codemelon.graph.edge

Interface EdgeTypeData

All Known Implementing Classes:

DfsEdgeData

public interface EdgeTypeData

Requires that an EdgeData object maintain an EdgeType (TREE, BACK, FORWARD, CROSS, UNKNOWN)

Method Summary

Methods

Modifier and Type
Method and Description

EdgeType
getEdgeType()

Retrieve the type of this EdgeData object

void
setEdgeType(EdgeType edgeType)

Set the EdgeType contained in this EdgeData object

Method Detail

setEdgeType

void setEdgeType(EdgeType edgeType)

Set the EdgeType contained in this EdgeData object

Parameters:

edgeType - value to which to set the edge type

getEdgeType

EdgeType getEdgeType()

Retrieve the type of this EdgeData object

Returns:

the edge type stored in this EdgeData object

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
from .sanetime import SaneTime,sanetime,time,nsanetime,ntime
from .sanetztime import SaneTzTime,sanetztime,tztime,nsanetztime,ntztime
from .sanedelta import SaneDelta,sanedelta,delta,nsanedelta,ndelta
from .sanespan import SaneSpan,sanespan,span,nsanespan,nspan


text:
<vg-player>
    <vg-controls>
        <vg-play-pause></vg-play-pause>

        <vg-scrub-bar>
            <vg-scrub-bar-current-time></vg-scrub-bar-current-time>
        </vg-scrub-bar>

        <vg-fullscreen></vg-fullscreen>
    </vg-controls>

    <video #myVideoRef
           id="myVideo"
           src="http://static.videogular.com/assets/videos/videogular.mp4"
           [vgMedia]="myVideoRef">

    </video>
    <app-time-viewer #myTimeRef
                     id="myTime"
                     [duration]="myVideoRef.duration"
                     [vgMedia]="myTimeRef">
    </app-time-viewer>
</vg-player>


text:
using System;
using EasyEvents.Core.ClientInterfaces;

namespace EasyEvents.Core.Tests.TestEvents
{
    public class HasDateTimePropertyWithNoSetterEvent : IEvent
    {
        public string Stream => "TestStream";

        public DateTime? DateTime { get; }
    }
}


text:
namespace nark {
#if defined(__GLIBC__) || defined(__CYGWIN__) || \
	defined(__DARWIN_C_LEVEL) && defined(__DARWIN_C_FULL) && __DARWIN_C_LEVEL >= __DARWIN_C_FULL
	StrPrintf::StrPrintf(const char* format, ...) {
		assert(NULL != format);
		va_list  ap;
		va_start(ap, format);
		n = vasprintf(&s, format, ap);
		va_end(ap);
		if (n < 0) {
			throw std::bad_alloc();
		}
		return;
	}
	StrPrintf::StrPrintf(std::string& dest, const char* format, ...) {
		assert(NULL != format);
		va_list  ap;
		va_start(ap, format);
		n = vasprintf(&s, format, ap);
		va_end(ap);
		if (n < 0) {
			throw std::bad_alloc();
		}
		dest.append(s, n);
	}
	StrPrintf::~StrPrintf() {
		assert(NULL != s);
		free(s);
	}
	StrPrintf::operator std::string() const {
		assert(NULL != s);
		return std::string(s, n);
	}
#endif

#if defined(__GLIBC__) || defined(__CYGWIN__)
	// StrBuilder

	StrBuilder::StrBuilder() {
		s = NULL;
		n = 0;
		memFile = open_memstream(&s, &n);
		if (NULL == memFile) {
			THROW_STD(runtime_error, "open_memstream");
		}
	}
	StrBuilder::~StrBuilder() {
		assert(NULL != memFile);
		assert(NULL != s);
		fclose(memFile);
		free(s);
	}
	StrBuilder& StrBuilder::printf(const char* format, ...) {
		assert(NULL != format);
		assert(NULL != memFile);
		va_list ap;
		va_start(ap, format);
		int rv = vfprintf(memFile, format, ap);
		va_end(ap);
		if (rv < 0) {
			THROW_STD(runtime_error, "vfprintf on memstream");
		}
		return *this;
	}
	void StrBuilder::clear() {
		assert(NULL != memFile);
		::rewind(memFile);
		this->flush();
	}
	StrBuilder& StrBuilder::flush() {
		assert(NULL != memFile);
		int rv = fflush(memFile);
		if (rv != 0) {
			THROW_STD(runtime_error, "fflush on memstream");
		}
	//	assert(NULL != s);
		return *this;
	}
	const char* StrBuilder::c_str() {
		assert(NULL != memFile);
		int rv = fflush(memFile);
		if (rv != 0) {
			THROW_STD(runtime_error, "fflush on memstream");
		}
		assert(NULL != s);
		return s;
	}
	StrBuilder::operator std::string() const {
		assert(NULL != memFile);
		int rv = fflush(memFile);
		if (rv != 0) {
			THROW_STD(runtime_error, "fflush on memstream");
		}
		assert(NULL != s);
		return std::string(s, n);
	}
	void StrBuilder::setEof(int end_offset) {
		assert(end_offset < 0);
		assert(NULL != memFile);
		int rv = fflush(memFile);
		if (rv != 0) {
			THROW_STD(runtime_error, "fflush on memstream");
		}
		s[n+end_offset] = '\0';
		rv = fseek(memFile, end_offset, SEEK_END);
		if (rv != 0) {
			THROW_STD(runtime_error, "fseek on memstream");
		}
		assert(NULL != s);
		assert((long)n + end_offset >= 0);
	}
	void StrBuilder::setEof(int end_offset, const char* endmark) {
		assert(end_offset < 0);
		assert(NULL != endmark);
		assert(NULL != memFile);
		int rv = fseek(memFile, end_offset, SEEK_END);
		if (rv != 0) {
			THROW_STD(runtime_error, "fflush on memstream");
		}
		rv = fputs(endmark, memFile);
		if (EOF == rv) {
			THROW_STD(runtime_error, "fputs(endmark, memFile)");
		}
		rv = fflush(memFile);
		if (rv != 0) {
			THROW_STD(runtime_error, "fflush on memstream");
		}
		assert(NULL != s);
		assert((long)n + end_offset >= 0);
	}
#else
  #pragma message("strbuilder skiped because not in glibc")
#endif

} // namespace nark


text:
import com.twilio.Twilio;
import com.twilio.rest.video.v1.Composition;
import com.twilio.rest.video.v1.Composition.Format;
import com.twilio.rest.video.v1.Composition.Status;

public class GetCompositionList{

  // Find your credentials at twilio.com/console
  // To set up environment variables, see http://twil.io/secure
  public static final String ACCOUNT_SID = System.getenv("TWILIO_ACCOUNT_SID");
  public static final String API_KEY_SID = System.getenv("TWILIO_API_KEY_SID");
  public static final String API_KEY_SECRET = System.getenv("TWILIO_API_KEY_SECRET");

  public static void main( String[] args ) throws IOException{
      // Initialize the client
      Twilio.init(API_KEY_SID, API_KEY_SECRET, ACCOUNT_SID);

      ResourceSet<Composition> compositions = Composition.reader()
              .setRoomSid("RMXXXX")
              .read();

      for(Composition c : compositions){
        System.out.println("Read Composition with SID=" + c.getSid());
      }
  }
}


text:
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;

namespace Auth0.ManagementApi.Models
{

    /// <summary>
    ///
    /// </summary>
    public class ClientUpdateRequest : ClientBase
    {
        /// <summary>
        /// The type of application this client represents
        /// </summary>
        [JsonProperty("app_type")]
        [JsonConverter(typeof(StringEnumConverter))]
        public ClientApplicationType? ApplicationType { get; set; }

        /// <summary>
        /// Defines the requested authentication method for the token endpoint.
        /// </summary>
        /// <remarks>
        ///
        /// </remarks>
        [JsonProperty("token_endpoint_auth_method")]
        [JsonConverter(typeof(StringEnumConverter))]
        public TokenEndpointAuthMethod? TokenEndpointAuthMethod { get; set; }
    }

}


text:
extern const base::Feature kUmaCellular;

#endif  // COMPONENTS_UKM_IOS_FEATURES_H_


text:
<?php

namespace Helmut\Forms\Fields\NewPassword;

use Helmut\Forms\Field;
use Helmut\Forms\Utility\Validate;

class NewPassword extends Field {

    protected $value = '';
    protected $value_confirmation = '';

    public function hash($value)
    {
        if (strlen($value) === 0) {
            return '';
        }

        return password_hash($value, PASSWORD_BCRYPT, ['cost' => 10]);
    }

    public function getValue()
    {
        return $this->hash($this->value);
    }

    public function getButtonName()
    {
        //
    }

    public function renderWith()
    {
        return [
            'name' => $this->name,
            'name_confirmation' => $this->name.'_confirmation',
            'value' => $this->value,
            'value_confirmation' => $this->value_confirmation,
        ];
    }

    public function setValueFromDefault()
    {
        //
    }

    public function setValueFromModel($model)
    {
        //
    }

    public function setValueFromRequest($request)
    {
        $this->value = $request->get($this->name);
        $this->value_confirmation = $request->get($this->name.'_confirmation');
    }

    public function fillModelWithValue($model)
    {
        $model->{$this->name} = $this->hash($this->value);
    }

    public function validate()
    {
        $this->matches();
    }

    public function validateMatches()
    {
        return Validate::matches($this->value, $this->value_confirmation);
    }

    public function validateRequired()
    {
        return Validate::required($this->value);
    }

}


text:
/*jslint
browser: true,
nomen: false,
debug: true,
forin: true,
undef: true,
white: false,
onevar: false
 */
var sc, DOMParser;

/**
 * Given a string, this returns an XMLDocument
 * @param {string} string an xml string
 * @return {XMLDocument}
 */
sc.helpers.createXMLFromString = function (string) {
	var xmlParser, xmlDocument;
	try {
		xmlParser = new DOMParser();
		xmlDocument = xmlParser.parseFromString(string, 'text/xml');
		return xmlDocument;
	} catch (e) {
		sc.helpers.dump(e.name + ":" + e.message);
		return null;
	}
};


text:
Easiest to use tool that I have found is DigiCert Certificate Utility for Windows. It's free.

1. In DigiCert utility click Create CSR
2. Upload CSR to SSL provider's system
3. Download certificate from SSL provider's system
4. Import it to DigiCert Certificate Utility via Import function
5. a) If you will be using it in IIS: go to IIS to configure the certificate
b) If you will be using it in Azure: export it to *.pfx and upload to Azure


text:
package com.turn.tpmml.evaluator;

import com.turn.tpmml.DataField;
import com.turn.tpmml.DataType;
import com.turn.tpmml.Interval;
import com.turn.tpmml.InvalidValueTreatmentMethodType;
import com.turn.tpmml.MiningField;
import com.turn.tpmml.OpType;
import com.turn.tpmml.OutlierTreatmentMethodType;
import com.turn.tpmml.Value;
import com.turn.tpmml.manager.TPMMLException.TPMMLCause;

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

public class ParameterUtil {

	private ParameterUtil() {
	}

	@SuppressWarnings("unused")
	public static Object prepare(DataField dataField, MiningField miningField, Object value)
			throws EvaluationException {

		if (dataField == null) {
			throw new EvaluationException("DataField is null");
		}

		outlierTreatment: if (isOutlier(dataField, value)) {

			if (miningField == null) {
				throw new EvaluationException("MiningField is null");
			}

			OutlierTreatmentMethodType outlierTreatmentMethod = miningField.getOutlierTreatment();
			switch (outlierTreatmentMethod) {
			case AS_IS:
				break;
			case AS_MISSING_VALUES:
				value = null;
				break;
			case AS_EXTREME_VALUES:
				Double lowValue = miningField.getLowValue();
				Double highValue = miningField.getHighValue();

				if (lowValue == null || highValue == null) {
					throw new EvaluationException("There are no limits");
				}

				DataType dataType = dataField.getDataType();

				if (compare(dataType, value, lowValue) < 0) {
					value = lowValue;
				} else

				if (compare(dataType, value, highValue) > 0) {
					value = highValue;
				}
				break;
			default:
				throw new EvaluationException(TPMMLCause.UNSUPPORTED_OPERATION,
						outlierTreatmentMethod.name());
			}
		}

		missingValueTreatment: if (isMissing(dataField, value)) {

			if (miningField == null) {
				return null;
			}

			value = miningField.getMissingValueReplacement();
			if (value != null) {
				break missingValueTreatment;
			}

			return null;
		}

		invalidValueTreatment: if (isInvalid(dataField, value)) {

			if (miningField == null) {
				throw new EvaluationException("MiningField is null");
			}

			InvalidValueTreatmentMethodType invalidValueTreatmentMethod =
					miningField.getInvalidValueTreatment();
			switch (invalidValueTreatmentMethod) {
			case RETURN_INVALID:
				throw new EvaluationException("Invalid evaluation");
			case AS_IS:
				break invalidValueTreatment;
			case AS_MISSING:
				value = miningField.getMissingValueReplacement();
				if (value != null) {
					break invalidValueTreatment;
				}

				return null;
			default:
				throw new EvaluationException(TPMMLCause.UNSUPPORTED_OPERATION,
						invalidValueTreatmentMethod.name());
			}
		}

		return cast(dataField.getDataType(), value);
	}

	private static boolean isOutlier(DataField dataField, Object value) throws EvaluationException {

		if (value == null) {
			return false;
		}

		OpType opType = dataField.getOptype();
		switch (opType) {
		case CONTINUOUS:
			List<Double> range = new ArrayList<Double>();

			List<Interval> fieldIntervals = dataField.getIntervals();
			for (Interval fieldInterval : fieldIntervals) {
				range.add(fieldInterval.getLeftMargin());
				range.add(fieldInterval.getRightMargin());
			}

			List<Value> fieldValues = dataField.getValues();
			for (Value fieldValue : fieldValues) {
				Value.Property property = fieldValue.getProperty();

				switch (property) {
				case VALID:
					range.add(toDouble(fieldValue.getValue()));
					break;
				default:
					break;
				}
			}

			if (range.isEmpty()) {
				return false;
			}

			Double doubleValue = toDouble(value);

			Double minValue = Collections.min(range);
			if ((doubleValue).compareTo(minValue) < 0) {
				return true;
			}

			Double maxValue = Collections.max(range);
			if ((doubleValue).compareTo(maxValue) > 0) {
				return true;
			}
			break;
		case CATEGORICAL:
		case ORDINAL:
			break;
		default:
			throw new EvaluationException(TPMMLCause.UNSUPPORTED_OPERATION, opType.name());
		}

		return false;
	}

	private static boolean isMissing(DataField dataField, Object value) throws EvaluationException {

		if (value == null) {
			return true;
		}

		List<Value> fieldValues = dataField.getValues();
		for (Value fieldValue : fieldValues) {
			Value.Property property = fieldValue.getProperty();

			switch (property) {
			case MISSING:
				boolean equals = equals(DataType.STRING, value, fieldValue.getValue());
				if (equals) {
					return true;
				}
				break;
			default:
				break;
			}
		}

		return false;
	}

	private static boolean isInvalid(DataField dataField, Object value) throws EvaluationException {
		return !isValid(dataField, value);
	}

	@SuppressWarnings("fallthrough")
	private static boolean isValid(DataField dataField, Object value) throws EvaluationException {
		DataType dataType = dataField.getDataType();

		// Speed up subsequent conversions
		value = cast(dataType, value);

		OpType opType = dataField.getOptype();
		switch (opType) {
		case CONTINUOUS:
			Double doubleValue = toDouble(value);

			int intervalCount = 0;

			List<Interval> fieldIntervals = dataField.getIntervals();
			for (Interval fieldInterval : fieldIntervals) {
				++intervalCount;

				if (DiscretizationUtil.contains(fieldInterval, doubleValue)) {
					return true;
				}
			}

			if (intervalCount > 0) {
				return false;
			}
			// Falls through
		case CATEGORICAL:
		case ORDINAL:
			int validValueCount = 0;

			List<Value> fieldValues = dataField.getValues();
			for (Value fieldValue : fieldValues) {
				Value.Property property = fieldValue.getProperty();

				switch (property) {
				case VALID:
					validValueCount += 1;

					boolean equals = equals(dataType, value, fieldValue.getValue());
					if (equals) {
						return true;
					}
					break;
				case INVALID:
					boolean equals2 = equals(dataType, value, fieldValue.getValue());
					if (equals2) {
						return false;
					}
					break;
				case MISSING:
					break;
				default:
					throw new EvaluationException(TPMMLCause.UNSUPPORTED_OPERATION,
							property.name());
				}
			}

			if (validValueCount > 0) {
				return false;
			}
			break;
		default:
			throw new EvaluationException(TPMMLCause.UNSUPPORTED_OPERATION,
					opType.name());
		}

		return true;
	}

	/**
	 * Checks the equality between different value representations.
	 *
	 * @param value
	 *            The {@link #getDataType(Object) runtime data type representation} of the value.
	 * @param string
	 *            The String representation of the value.
	 * @throws EvaluationException
	 */
	public static boolean equals(Object value, String string) throws EvaluationException {
		return equals(getDataType(value), value, string);
	}

	private static boolean equals(DataType dataType, Object left, Object right)
			throws EvaluationException {
		return (cast(dataType, left)).equals(cast(dataType, right));
	}

	/**
	 * Calculates the order between the value and the reference value.
	 *
	 * @param value
	 *            The {@link #getDataType(Object) runtime data type representation} of the value.
	 * @param string
	 *            The String representation of the reference value.
	 * @throws EvaluationException
	 *
	 * @see Comparable#compareTo(Object)
	 */
	public static int compare(Object value, String string) throws EvaluationException {
		return compare(getDataType(value), value, string);
	}

	@SuppressWarnings({ "cast", "rawtypes", "unchecked" })
	private static int compare(DataType dataType, Object left, Object right)
			throws EvaluationException {
		return ((Comparable) cast(dataType, left)).compareTo((Comparable) cast(dataType, right));
	}

	public static Object parse(DataType dataType, String string) throws EvaluationException {

		switch (dataType) {
		case STRING:
			return string;
		case INTEGER:
			return new Integer(string);
		case FLOAT:
			return new Float(string);
		case DOUBLE:
			return new Double(string);
		default:
			break;
		}

		throw new EvaluationException(TPMMLCause.UNSUPPORTED_OPERATION,
				dataType.name());
	}

	/**
	 * @return The data type of the value.
	 * @throws EvaluationException
	 */
	public static DataType getDataType(Object value) throws EvaluationException {

		if (value instanceof String) {
			return DataType.STRING;
		} else if (value instanceof Integer) {
			return DataType.INTEGER;
		} else if (value instanceof Float) {
			return DataType.FLOAT;
		} else if (value instanceof Double) {
			return DataType.DOUBLE;
		}

		throw new EvaluationException(value + " is not a valid type.");
	}

	/**
	 * @return The least restrictive data type of the data types of two values
	 * @throws EvaluationException
	 *
	 * @see #getResultDataType(DataType, DataType)
	 */
	public static DataType getResultDataType(Object left, Object right) throws EvaluationException {
		return getResultDataType(getDataType(left), getDataType(right));
	}

	public static DataType getResultDataType(DataType left, DataType right)
			throws EvaluationException {

		if ((left).equals(right)) {
			return left;
		} // End if

		DataType[] dataTypes = ParameterUtil.PRECEDENCE_SEQUENCE;
		for (DataType dataType : dataTypes) {

			if ((dataType).equals(left) || (dataType).equals(right)) {
				return dataType;
			}
		}

		throw new EvaluationException("Unable to find a result data type");
	}

	public static Object cast(DataType dataType, Object value) throws EvaluationException {

		switch (dataType) {
		case STRING:
			return toString(value);
		case INTEGER:
			return toInteger(value);
		case FLOAT:
			return toFloat(value);
		case DOUBLE:
			return toDouble(value);
		default:
			break;
		}

		throw new EvaluationException("Can't cast [" + value + "] to " + dataType.name());
	}

	/**
	 * Converts the specified value to String data type.
	 * @throws EvaluationException
	 *
	 * @see DataType#STRING
	 */
	public static String toString(Object value) throws EvaluationException {

		if (value instanceof String) {
			return (String) value;
		} else
		if (value instanceof Number) {
			Number number = (Number) value;

			return number.toString();
		}

		throw new EvaluationException("Can't transform [" + value + "] into a string");
	}

	/**
	 * Converts the specified value to Integer data type.
	 * @throws EvaluationException
	 *
	 * @see DataType#INTEGER
	 */
	public static Integer toInteger(Object value) throws EvaluationException {

		if (value instanceof String) {
			String string = (String) value;

			return Integer.valueOf(string);
		} else

		if (value instanceof Integer) {
			return (Integer) value;
		} else

		if (value instanceof Number) {
			Number number = (Number) value;

			return Integer.valueOf(number.intValue());
		}

		throw new EvaluationException("Can't cast [" + value + "] to an integer");
	}

	/**
	 * Converts the specified value to Float data type.
	 * @throws EvaluationException
	 *
	 * @see DataType#FLOAT
	 */
	public static Float toFloat(Object value) throws EvaluationException {

		if (value instanceof String) {
			String string = (String) value;

			return Float.valueOf(string);
		} else

		if (value instanceof Float) {
			return (Float) value;
		} else

		if (value instanceof Number) {
			Number number = (Number) value;

			return Float.valueOf(number.floatValue());
		}

		throw new EvaluationException("Can't cast [" + value + "] to a float");
	}

	/**
	 * Converts the specified value to Double data type.
	 * @throws EvaluationException
	 *
	 * @see DataType#DOUBLE
	 */
	public static Double toDouble(Object value) throws EvaluationException {

		if (value instanceof String) {
			String string = (String) value;

			return Double.valueOf(string);
		} else if (value instanceof Double) {
			return (Double) value;
		} else if (value instanceof Number) {
			Number number = (Number) value;

			return Double.valueOf(number.doubleValue());
		}

		throw new EvaluationException("Can't cast [" + value + "] to a double");
	}

	public static DataType getConstantDataType(String string) {

		try {
			if (string.indexOf('.') > -1) {
				Float.parseFloat(string);

				return DataType.FLOAT;
			} else {
				Integer.parseInt(string);

				return DataType.INTEGER;
			}
		} catch (NumberFormatException nfe) {
			return DataType.STRING;
		}
	}

	private static final DataType[] PRECEDENCE_SEQUENCE = { DataType.STRING, DataType.DOUBLE,
			DataType.FLOAT, DataType.INTEGER };
}


text:
class BookableSlotSerializer < ActiveModel::Serializer
  attribute :start_at, key: :start
  attribute :end_at, key: :end
  attribute :resourceId do
    object.guider_id
  end
  attribute :scheduleType do
    object.schedule_type.dasherize
  end
end


text:
package no.uio.ifi.trackfind.backend.scripting;

/**
 * Scripting Engine for performing dynamic attribute mappings.
 *
 * @author Dmytro Titov
 */
public interface ScriptingEngine {

    /**
     * Gets the scripting language.
     *
     * @return Scripting language.
     */
    String getLanguage();

    /**
     * Execute script.
     *
     * @param script  Mappings script.
     * @param content Dataset's content to process.
     * @return Content with mapped values.
     * @throws Exception When script can't be interpreted/executed.
     */
    String execute(String script, String content) throws Exception;

}


text:
module BestInPlace
  module ControllerExtensions
    def respond_with_bip(obj)
      obj.changed? ? respond_bip_error(obj) : respond_bip_ok(obj)
    end

  private
    def respond_bip_ok(obj)
      if obj.respond_to?(:id)
        klass = "#{obj.class}_#{obj.id}"
      else
        klass = obj.class.to_s
      end
      param_key = BestInPlace::Utils.object_to_key(obj)
      updating_attr = params[param_key].keys.first

      if renderer = BestInPlace::DisplayMethods.lookup(klass, updating_attr)
        render :json => renderer.render_json(obj)
      else
        head :ok
      end
    end

    def respond_bip_error(obj)
      render :json => obj.errors.full_messages, :status => :unprocessable_entity
    end
  end
end


text:
typedef enum _State: uint8_t
	{
	STATE_NONE = 255,
	STATE_ROOT = 0,

#ifdef INCLUDE_ARPEGGIATOR
	STATE_ARPEGGIATOR,
#endif

#ifdef INCLUDE_STEP_SEQUENCER
	STATE_STEP_SEQUENCER,
#endif

#ifdef INCLUDE_RECORDER
	STATE_RECORDER,
#endif

#ifdef INCLUDE_GAUGE
	STATE_GAUGE,
#endif

#ifdef INCLUDE_CONTROLLER
	STATE_CONTROLLER,
#endif

#ifdef INCLUDE_SPLIT
	STATE_SPLIT,
#endif

#ifdef INCLUDE_THRU
	STATE_THRU,
#endif

#ifdef INCLUDE_SYNTH
	STATE_SYNTH,
#endif

#ifdef INCLUDE_MEASURE
	STATE_MEASURE,
#endif

#ifdef INCLUDE_SYSEX
	STATE_SYSEX,
	STATE_SYSEX_SLOT,
	STATE_SYSEX_ARP,
	STATE_SYSEX_GO,
#endif

	STATE_OPTIONS,
	STATE_UNDEFINED_1,	// leave all these alone, they're buffer space for 12 apps; there's some stuff which does additive math off of the "application" variable, and we don't want it to overflow
	STATE_UNDEFINED_2,
	STATE_UNDEFINED_3,
	STATE_UNDEFINED_4,
	STATE_UNDEFINED_5,
	STATE_UNDEFINED_6,
	STATE_UNDEFINED_7,
	STATE_UNDEFINED_8,
	STATE_UNDEFINED_9,
	STATE_UNDEFINED_10,
	STATE_UNDEFINED_11,
	STATE_UNDEFINED_12,

#ifdef INCLUDE_ARPEGGIATOR
	STATE_ARPEGGIATOR_PLAY,
	STATE_ARPEGGIATOR_PLAY_OCTAVES,
	STATE_ARPEGGIATOR_PLAY_VELOCITY,
	STATE_ARPEGGIATOR_MENU,
	STATE_ARPEGGIATOR_CREATE,
	STATE_ARPEGGIATOR_CREATE_EDIT,
	STATE_ARPEGGIATOR_CREATE_SAVE,
	STATE_ARPEGGIATOR_CREATE_SURE,
#endif

#ifdef INCLUDE_EXTENDED_ARPEGGIATOR
	STATE_ARPEGGIATOR_PLAY_PERFORMANCE,
	STATE_ARPEGGIATOR_PLAY_TRANSPOSE,
#endif

#ifdef INCLUDE_STEP_SEQUENCER
	STATE_STEP_SEQUENCER_FORMAT,
	STATE_STEP_SEQUENCER_PLAY,
	STATE_STEP_SEQUENCER_MENU,
	STATE_STEP_SEQUENCER_MIDI_CHANNEL_OUT,
	STATE_STEP_SEQUENCER_VELOCITY,
	STATE_STEP_SEQUENCER_FADER,
	STATE_STEP_SEQUENCER_LENGTH,
	STATE_STEP_SEQUENCER_SURE,
	STATE_STEP_SEQUENCER_SAVE,
#endif

#ifdef 	INCLUDE_EXTENDED_STEP_SEQUENCER
	STATE_STEP_SEQUENCER_MENU_TYPE,
	STATE_STEP_SEQUENCER_MENU_TYPE_PARAMETER,
	STATE_STEP_SEQUENCER_MENU_PATTERN,
	STATE_STEP_SEQUENCER_MENU_EDIT,
	STATE_STEP_SEQUENCER_MENU_EDIT_MARK,
	STATE_STEP_SEQUENCER_MENU_EDIT_COPY,
	STATE_STEP_SEQUENCER_MENU_EDIT_SPLAT,
	STATE_STEP_SEQUENCER_MENU_EDIT_MOVE,
	STATE_STEP_SEQUENCER_MENU_EDIT_DUPLICATE,
	STATE_STEP_SEQUENCER_MENU_PERFORMANCE,
	STATE_STEP_SEQUENCER_MENU_PERFORMANCE_KEYBOARD,
	STATE_STEP_SEQUENCER_MENU_PERFORMANCE_REPEAT,
	STATE_STEP_SEQUENCER_MENU_PERFORMANCE_NEXT,
	STATE_STEP_SEQUENCER_MENU_NO,
#endif

#ifdef INCLUDE_RECORDER
	STATE_RECORDER_FORMAT,
	STATE_RECORDER_PLAY,
	STATE_RECORDER_SAVE,
	STATE_RECORDER_SURE,
#endif

#ifdef INCLUDE_EXTENDED_RECORDER
	STATE_RECORDER_MENU,
#endif

#ifdef INCLUDE_CONTROLLER
	STATE_CONTROLLER_PLAY,
	STATE_CONTROLLER_SET_LEFT_KNOB_TYPE,
	STATE_CONTROLLER_SET_RIGHT_KNOB_TYPE,
	STATE_CONTROLLER_SET_MIDDLE_BUTTON_TYPE,
	STATE_CONTROLLER_SET_SELECT_BUTTON_TYPE,
#endif

#ifdef INCLUDE_EXTENDED_CONTROLLER
	STATE_CONTROLLER_WAVE_ENVELOPE,
	STATE_CONTROLLER_RANDOM,
	STATE_CONTROLLER_SET_A2_TYPE,
	STATE_CONTROLLER_SET_A3_TYPE,
	STATE_CONTROLLER_PLAY_WAVE_ENVELOPE,
	STATE_CONTROLLER_SET_WAVE_ENVELOPE_TYPE,
	STATE_CONTROLLER_SET_WAVE_ENVELOPE,
	STATE_CONTROLLER_WAVE_ENVELOPE_SET_MODE,
	STATE_CONTROLLER_WAVE_ENVELOPE_SET_CLOCK,
	STATE_CONTROLLER_SET_WAVE_ENVELOPE_VALUE,
	STATE_CONTROLLER_RESET_WAVE_ENVELOPE_VALUES,
	STATE_CONTROLLER_RESET_WAVE_ENVELOPE_VALUES_GO,
	STATE_CONTROLLER_SET_WAVE_ENVELOPE_NUMBER,
	STATE_CONTROLLER_PLAY_RANDOM,
	STATE_CONTROLLER_RANDOM_SET_TYPE,
	STATE_CONTROLLER_RANDOM_SET_MODE,
	STATE_CONTROLLER_RANDOM_SET_RANGE,
	STATE_CONTROLLER_RANDOM_SET_INITIAL_VALUE,
	STATE_CONTROLLER_RANDOM_SET_LENGTH,
	STATE_CONTROLLER_RANDOM_SET_CLOCK,
	STATE_CONTROLLER_SET_RANDOM_NUMBER,
	STATE_CONTROLLER_SET_A2_NUMBER,
	STATE_CONTROLLER_SET_A3_NUMBER,
#endif

#ifdef INCLUDE_CONTROLLER
	STATE_CONTROLLER_SET_LEFT_KNOB_NUMBER,
	STATE_CONTROLLER_SET_RIGHT_KNOB_NUMBER,
	STATE_CONTROLLER_SET_MIDDLE_BUTTON_NUMBER,
	STATE_CONTROLLER_SET_SELECT_BUTTON_NUMBER,
	STATE_CONTROLLER_SET_MIDDLE_BUTTON_VALUE_ON,
	STATE_CONTROLLER_SET_SELECT_BUTTON_VALUE_ON,
	STATE_CONTROLLER_SET_MIDDLE_BUTTON_VALUE_OFF,
	STATE_CONTROLLER_SET_SELECT_BUTTON_VALUE_OFF,
#endif

	STATE_OPTIONS_TEMPO,
	STATE_OPTIONS_NOTE_SPEED,
	STATE_OPTIONS_SWING,

#ifdef INCLUDE_OPTIONS_TRANSPOSE_AND_VOLUME
	STATE_OPTIONS_TRANSPOSE,
	STATE_OPTIONS_VOLUME,
#endif

	STATE_OPTIONS_PLAY_LENGTH,
	STATE_OPTIONS_MIDI_CHANNEL_IN,
	STATE_OPTIONS_MIDI_CHANNEL_OUT,
	STATE_OPTIONS_MIDI_CHANNEL_CONTROL,
	STATE_OPTIONS_MIDI_CLOCK,

#ifdef INCLUDE_OPTIONS_MIDI_CLOCK_DIVIDE
	STATE_OPTIONS_MIDI_CLOCK_DIVIDE,
#endif

	STATE_OPTIONS_CLICK,
	STATE_OPTIONS_SCREEN_BRIGHTNESS,

#ifdef INCLUDE_OPTIONS_MENU_DELAY
	STATE_OPTIONS_MENU_DELAY,
#endif

#ifdef INCLUDE_IMMEDIATE_RETURN
	STATE_OPTIONS_AUTO_RETURN,
#endif

	STATE_OPTIONS_ABOUT,

#ifdef INCLUDE_SPLIT
	STATE_SPLIT_CHANNEL,
	STATE_SPLIT_NOTE,
	STATE_SPLIT_LAYER_NOTE,
#endif

#ifdef INCLUDE_THRU
	STATE_THRU_PLAY,
	STATE_THRU_EXTRA_NOTES,
	STATE_THRU_DISTRIBUTE_NOTES,
	STATE_THRU_CHORD_MEMORY,
	STATE_THRU_DEBOUNCE,
	STATE_THRU_MERGE_CHANNEL_IN,
//	STATE_THRU_CC_NRPN,
	STATE_THRU_BLOCK_OTHER_CHANNELS,
#endif

#ifdef INCLUDE_MEASURE
	STATE_MEASURE_MENU,
	STATE_MEASURE_BEATS_PER_BAR,
	STATE_MEASURE_BARS_PER_PHRASE,
#endif

#ifdef INCLUDE_SYNTH
	STATE_SYNTH_WALDORF_BLOFELD,
	STATE_SYNTH_KAWAI_K4,
	STATE_SYNTH_KAWAI_K5,
	STATE_SYNTH_OBERHEIM_MATRIX_1000,
	STATE_SYNTH_KORG_MICROSAMPLER,
	STATE_SYNTH_YAMAHA_TX81Z,
#endif
	} State;

#define FIRST_APPLICATION (STATE_ROOT + 1)
#define MAX_APPLICATIONS        12        // How many applications do we have slots for?
extern uint8_t state;                     // The current state
extern uint8_t application;               // The top-level non-root state (the application, so to speak)
extern uint8_t optionsReturnState;        // If we're in STATE_OPTIONS and the user presses BACK, where should we go?
extern uint8_t defaultState;              // If we have just BACKed up into a menu state, what state should be the first one displayed?  This can be STATE_NONE
#ifdef INCLUDE_EXTENDED_MENU_DEFAULTS
extern uint8_t defaultMenuValue;
#endif

extern uint8_t entry;                     // Are we just entering a state?

// top-level state machine
void go();

//// BYPASSING

extern uint8_t bypass;                                  // are we bypassing MIDI right now?
extern uint8_t bypassOut;                                  // are we bypassing MIDI right now?
extern uint8_t shouldBypassOut;

// some shorthand so we can save a bit of program space.  Of course
// this increases our stack by 14 bytes
extern const char* nrpn_p;// = PSTR("NRPN");
extern const char* rpn_p;// = PSTR("RPN");
extern const char* cc_p;// = PSTR("CC");
extern const char* v_p;// = PSTR("IS");
extern const char* up_p;// = PSTR("UP");
extern const char* down_p;// = PSTR("DOWN");
extern const char* options_p;

///// LOCAL

union _local
    {
#ifdef INCLUDE_STEP_SEQUENCER
    struct _stepSequencerLocal stepSequencer;
#endif
#ifdef INCLUDE_ARPEGGIATOR
    struct _arpLocal arp;
#endif
#ifdef INCLUDE_RECORDER
    struct _recorderLocal recorder;
#endif
#ifdef INCLUDE_GAUGE
    struct _gaugeLocal gauge;
#endif
#ifdef INCLUDE_THRU
    struct _thruLocal thru;
#endif
#ifdef INCLUDE_CONTROLLER
    struct _controlLocal control;
#endif
#ifdef INCLUDE_MEASURE
    struct _measureLocal measure;
#endif
#ifdef INCLUDE_SPLIT
    struct _splitLocal split;
#endif
#ifdef INCLUDE_SYNTH
    struct _synthLocal synth;
#endif
#ifdef INCLUDE_SYSEX
    struct _sysexLocal sysex;
#endif
    };

extern _local local;

//// BUTTONS AND POTS

#define BUTTON_PRESSED_COUNTDOWN_DEBOUNCE 313     // about 1/10 of a second must have transpired before we consider another button press  (313 / 3125 == 1/10)
#define BUTTON_PRESSED_COUNTDOWN_MAX 1612         // 1/2 second before a button is considered RELEASED LONG  (1612 / 3125
#define MINIMUM_POT_DEVIATION 8                   // A pot just be turned more than this value before we consider it changed

/// Button and Pot numbers
#define BACK_BUTTON 0
#define MIDDLE_BUTTON 1
#define SELECT_BUTTON 2
#define LEFT_POT 0
#define RIGHT_POT 1

// Update states
#define NO_CHANGE 0                             		// No change in the button or pot yet
#define CHANGED 1                                       // The value pot has been changed
#define PRESSED 1                                       // The button has been pressed
#define PRESSED_AND_RELEASED 2          				// The button was pressed and released before isUpdated was called to check
#define RELEASED 3                                      // The button has been released
#define RELEASED_LONG 4                         // the button was released after being pressed for 1/2 second or more

#ifdef INCLUDE_EXTENDED_CONTROLLER
extern uint8_t button[3];                                       // Is button #i presently being held down?
extern uint16_t pot[4];                                         // What is the current value of pot #i?
extern uint8_t potUpdated[4];       // has the left pot been updated?  CHANGED or NO_CHANGE
extern uint8_t buttonUpdated[3];    // has the back button been updated?  PRESSED, RELEASED, PRESSED_AND_RELEASED, RELEASED_LONG, or NO_CHANGE
extern uint8_t lockoutPots;                     // Set to TRUE when we we want to ignore changes to the pots (perhaps we're changing with NRPN messages)
#else
extern uint8_t button[3];                                       // Is button #i presently being held down?
extern uint16_t pot[2];                                         // What is the current value of pot #i?
extern uint8_t potUpdated[2];       // has the left pot been updated?  CHANGED or NO_CHANGE
extern uint8_t buttonUpdated[3];    // has the back button been updated?  PRESSED, RELEASED, PRESSED_AND_RELEASED, RELEASED_LONG, or NO_CHANGE
extern uint8_t lockoutPots;                     // Set to TRUE when we we want to ignore changes to the pots (perhaps we're changing with NRPN messages)
#endif

// SETUP POTS
// initializes the pots
void setupPots();

void clearReleased();

void updateButtons(uint8_t buttonPressed[]);

// Returns if the given button is in the given value state (PRESSED, RELEASED, PRESSED_AND_RELEASED, RELEASED_LONG)
// ALSO:
uint8_t isUpdated(uint8_t button, uint8_t val);

// FULLRESET()
// This resets all the parameters to their default values in the EEPROM,
// then reboots the board.

void fullReset();
void semiReset();

//// BYPASS TOGGLE
void toggleBypass(uint8_t channel);

///// THE DISPLAY

// We're going to try to handle both 8-column and 16-column displays.  The 8-column
// display buffer is stored in led.  The "second" display (if using 16 columns) is
// stored in led2.  Note that the second display is to the LEFT of the first display.
//
// We don't update the display every tick because it is costly.  Instead we update
// it every 4 ticks.
//
// The MIDI board also has two small LEDs.

extern uint8_t updateDisplay;                                   // indicates whether we should update the display
extern unsigned char led[LED_WIDTH];
extern unsigned char led2[LED_WIDTH];

// Set this to schedule the screen brightness to be revised (because this is
// costly and shouldn't be done constantly in response to, say, turning a pot).
extern uint8_t scheduleScreenBrightnessUpdate;

#endif


text:
package com.maukaming.aes.order;

public class Order {
    private String from;
    private String clOrdID;
    private OrderStatus status = OrderStatus.NEW;
    private OrderSide side;
    private OrderType type;
    private String symbol;
    private double price;
    private long quantity;
    private double avgPrice;
    private long cumQuantity;

    public Order() {
    }

    private Order(Builder builder) {
        this.from = builder.senderID;
        this.clOrdID = builder.clOrdID;
        this.side = builder.side;
        this.type = builder.type;
        this.symbol = builder.symbol;
        this.price = builder.price;
        this.quantity = builder.quantity;
    }

    public void applyFill(double price, long quantity) {
        avgPrice = (avgPrice * cumQuantity + price * quantity) / (cumQuantity + quantity);
        cumQuantity += quantity;

        if (cumQuantity >= this.quantity) {
            status = OrderStatus.FILLED;
        } else {
            status = OrderStatus.PARTIALLY_FILLED;
        }
    }

    public void setRejected() {
        status = OrderStatus.REJECTED;
    }

    public void setCanceled() {
        status = OrderStatus.CANCELED;
    }

    public String getFrom() {
        return from;
    }

    public String getClOrdID() {
        return clOrdID;
    }

    public OrderStatus getStatus() {
        return status;
    }

    public OrderSide getSide() {
        return side;
    }

    public OrderType getType() {
        return type;
    }

    public String getSymbol() {
        return symbol;
    }

    public double getPrice() {
        return price;
    }

    public long getQuantity() {
        return quantity;
    }

    public double getAvgPrice() {
        return avgPrice;
    }

    public long getCumQuantity() {
        return cumQuantity;
    }

    public long getLeaveQuantity() {
        return quantity - cumQuantity;
    }

    public boolean isActive() {
        return status == OrderStatus.NEW || status == OrderStatus.PARTIALLY_FILLED;
    }

    public static class Builder {
        private String senderID;
        private String clOrdID;
        private OrderSide side;
        private OrderType type;
        private String symbol;
        private double price;
        private long quantity;

        public Builder from(String senderID) {
            this.senderID = senderID;
            return this;
        }

        public Builder clOrdID(String clOrdID) {
            this.clOrdID = clOrdID;
            return this;
        }

        public Builder side(OrderSide side) {
            this.side = side;
            return this;
        }

        public Builder type(OrderType type) {
            this.type = type;
            return this;
        }

        public Builder symbol(String symbol) {
            this.symbol = symbol;
            return this;
        }

        public Builder price(double price) {
            this.price = price;
            return this;
        }

        public Builder quantity(long quantity) {
            this.quantity = quantity;
            return this;
        }

        public Order build() {
            return new Order(this);
        }
    }
}


text:
/*********************************************************************************************************************
 *
 * Abstract behaviour for stats date filters.
 *
 *********************************************************************************************************************/

function StatFilters( elRoot, options )
{
  let elButtons;

  /**
   * Triggers a load event.
   *
   * @param {Object} oData - the data to load
   */
  function triggerLoad( oData )
  {
    document.querySelectorAll( '[data-filterable]' ).forEach( el =>
    {
      el.dispatchEvent( new CustomEvent( 'statsRangeChanged', { detail: oData }));
    });

    // toggle classes
    const sPeriod = ( oData.period === undefined ) ? 'x' : oData.period;
    elButtons.forEach( el => el.classList.toggle( '-current', el.dataset.period === sPeriod ));
  }

  /** Constructor */
  return (function init()
  {
    // get buttons
    elButtons = elRoot.querySelectorAll( '[data-period]' );

    // bind to clicking on them
    elButtons.forEach( el => el.addEventListener( 'click', () => triggerLoad({ period: el.dataset.period })));

    // fire a default once everything is bound
    document.addEventListener( 'allBehavioursBound', () => triggerLoad({ period: options.period }));
  }());
}

module.exports = {
  name: 'stats-filters',
  init: StatFilters,
  defaults: {
    period: '1W'
  }
};


text:
package ru.job4j.PaintTask;

public class Square implements Shape {
    @Override
    public String pic() {
        StringBuilder sb = new StringBuilder();
        sb.append("****\n");
        sb.append("****\n");
        sb.append("****\n");
        sb.append("****\n");
        return sb.toString();
    }
}


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     此代码由工具生成。
//     运行时版本:4.0.30319.42000
//
//     对此文件的更改可能会导致不正确的行为,并且如果
//     重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------

namespace CountDown.Properties {

    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0")]
    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {

        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));

        public static Settings Default {
            get {
                return defaultInstance;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("2015-06-07")]
        public global::System.DateTime DestDate {
            get {
                return ((global::System.DateTime)(this["DestDate"]));
            }
            set {
                this["DestDate"] = value;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("200, 200")]
        public global::System.Drawing.Point WindowLocation {
            get {
                return ((global::System.Drawing.Point)(this["WindowLocation"]));
            }
            set {
                this["WindowLocation"] = value;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("")]
        public string AvatarPath {
            get {
                return ((string)(this["AvatarPath"]));
            }
            set {
                this["AvatarPath"] = value;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("")]
        public string Text {
            get {
                return ((string)(this["Text"]));
            }
            set {
                this["Text"] = value;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("False")]
        public bool TopMost {
            get {
                return ((bool)(this["TopMost"]));
            }
            set {
                this["TopMost"] = value;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("Gray")]
        public global::System.Drawing.Color TextColor {
            get {
                return ((global::System.Drawing.Color)(this["TextColor"]));
            }
            set {
                this["TextColor"] = value;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("WhiteSmoke")]
        public global::System.Drawing.Color DaysColor {
            get {
                return ((global::System.Drawing.Color)(this["DaysColor"]));
            }
            set {
                this["DaysColor"] = value;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("WhiteSmoke")]
        public global::System.Drawing.Color RectColor {
            get {
                return ((global::System.Drawing.Color)(this["RectColor"]));
            }
            set {
                this["RectColor"] = value;
            }
        }

        [global::System.Configuration.UserScopedSettingAttribute()]
        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.Configuration.DefaultSettingValueAttribute("Gainsboro")]
        public global::System.Drawing.Color TransparencyKey {
            get {
                return ((global::System.Drawing.Color)(this["TransparencyKey"]));
            }
            set {
                this["TransparencyKey"] = value;
            }
        }
    }
}


text:
/**
 * TrackerTest.
 */
 package ru.models;


text:
<?php

function testRuleNotAppliesToLocalVariableInFunctionWithNameLongerThanThreshold()
{
    $foo = "BAR";
}


text:
package com.sanluan.common.base;

import java.io.IOException;
import java.util.Map;

import com.sanluan.common.handler.DirectiveHandler;

import freemarker.core.Environment;
import freemarker.template.TemplateDirectiveBody;
import freemarker.template.TemplateDirectiveModel;
import freemarker.template.TemplateException;
import freemarker.template.TemplateModel;

/**
 * @author zhangxd
 *
 */
public abstract class BaseDirective implements TemplateDirectiveModel {

	@SuppressWarnings("unchecked")
	@Override
	public void execute(Environment environment, @SuppressWarnings("rawtypes") Map parameters, TemplateModel[] loopVars,
			TemplateDirectiveBody templateDirectiveBody) throws TemplateException, IOException {
		execute(new DirectiveHandler(environment, parameters,loopVars, templateDirectiveBody));
	}

	public abstract void execute(DirectiveHandler handler) throws TemplateException, IOException;
}