text:
/*
---
description: FileManager Uploader
longdescription: Implements Upload functionality into the FileManager based on [FancyUpload](http://digitarald.de)

authors:
  - Christoph Pojer

requires:
  core/1.2.4: '*'

provides:
  - filemanager.uploader

license:
  MIT-style license

options:
  - upload: (boolean, defaults to *true*)
  - uploadAuthData: (object) Data to be send with the GET-Request of an Upload as Flash ignores authenticated clients
  - resizeImages: (boolean, defaults to *true*) Whether to show the option to resize big images or not
...
*/

FileManager.implement({

	options: {
		resizeImages: true,
		upload: true,
		uploadAuthData: {}
	},

	hooks: {
		show: {
			upload: function(){
				this.startUpload();
			}
		},

		cleanup: {
			upload: function(){
				if (!this.options.upload || !this.upload) return;

				if (this.upload.uploader) this.upload.uploader.set('opacity', 0).dispose();
			}
		}
	},

	onDialogOpen: function(){
		if (this.swf && this.swf.box) this.swf.box.setStyle('visibility', 'hidden');
	},

	onDialogClose: function(){
		if (this.swf && this.swf.box) this.swf.box.setStyle('visibility', 'visible');
	},

	startUpload: function(){
		if (!this.options.upload || this.swf) return;

		var self = this;
		this.upload = {
			button: this.addMenuButton('upload').inject(this.menu, 'bottom').addEvents({
				click: function(){
					return false;
				},
				mouseenter: function(){
					this.addClass('hover');
				},
				mouseleave: function(){
					this.removeClass('hover');
					this.blur();
				},
				mousedown: function(){
					this.focus();
				}
			}),
			list: new Element('ul', {'class': 'filemanager-uploader-list'}),
			uploader: new Element('div', {opacity: 0, 'class': 'filemanager-uploader-area'}).adopt(
				new Element('h2', {text: this.language.upload}),
				new Element('div', {'class': 'filemanager-uploader'})
			)
		};
		this.upload.uploader.getElement('div').adopt(this.upload.list);
		this.closeIcon.appearOn(this.upload.button, 0.8);

		if (this.options.resizeImages){
			var resizer = new Element('div', {'class': 'checkbox'}),
				check = (function(){ this.toggleClass('checkboxChecked'); }).bind(resizer);
			check();
			this.upload.label = new Element('label').adopt(
				resizer, new Element('span', {text: this.language.resizeImages})
			).addEvent('click', check).inject(this.menu);
		}

		var File = new Class({

			Extends: Swiff.Uploader.File,

			initialize: function(base, data){
				this.parent(base, data);
				this.setOptions({
					url: self.options.url + (self.options.url.indexOf('?') == -1 ? '?' : '&') + Hash.toQueryString($merge({}, self.options.uploadAuthData, {
						event: 'upload',
						directory: self.normalize(self.Directory),
						resize: self.options.resizeImages && resizer.hasClass('checkboxChecked') ? 1 : 0
					}))
				});
			},

			render: function(){
				if (this.invalid){
					var message = self.language.uploader.unknown, sub = {
						name: this.name,
						size: Swiff.Uploader.formatUnit(this.size, 'b')
					};

					if (self.language.uploader[this.validationError])
						message = self.language.uploader[this.validationError];

					if (this.validationError == 'sizeLimitMin')
							sub.size_min = Swiff.Uploader.formatUnit(this.base.options.fileSizeMin, 'b');
					else if (this.validationError == 'sizeLimitMax')
							sub.size_max = Swiff.Uploader.formatUnit(this.base.options.fileSizeMax, 'b');

					new Dialog(new Element('div', {html: message.substitute(sub, /\\?\$\{([^{}]+)\}/g)}) , {language: {confirm: self.language.ok}, buttons: ['confirm']});
					return this;
				}

				this.addEvents({
					open: this.onOpen,
					remove: this.onRemove,
					requeue: this.onRequeue,
					progress: this.onProgress,
					stop: this.onStop,
					complete: this.onComplete
				});

				this.ui = {};
				this.ui.icon = new Asset.image(self.options.assetBasePath+'Icons/' + this.extension + '.png', {
					onerror: function(){ new Asset.image(self.options.assetBasePath + 'Icons/default.png').replaces(this); }
				});
				this.ui.element = new Element('li', {'class': 'file', id: 'file-' + this.id});
				this.ui.title = new Element('span', {'class': 'file-title', text: this.name});
				this.ui.size = new Element('span', {'class': 'file-size', text: Swiff.Uploader.formatUnit(this.size, 'b')});

				var file = this;
				this.ui.cancel = new Asset.image(self.options.assetBasePath+'cancel.png', {'class': 'file-cancel', title: self.language.cancel}).addEvent('click', function(){
					file.remove();
					self.tips.hide();
					self.tips.detach(this);
				});
				self.tips.attach(this.ui.cancel);

				var progress = new Element('img', {'class': 'file-progress', src: self.options.assetBasePath+'bar.gif'});

				this.ui.element.adopt(
					this.ui.cancel,
					progress,
					this.ui.icon,
					this.ui.title,
					this.ui.size
				).inject(self.upload.list).highlight();

				this.ui.progress = new Fx.ProgressBar(progress).set(0);

				this.base.reposition();

				return this.parent();
			},

			onOpen: function(){
				this.ui.element.addClass('file-running');
			},

			onRemove: function(){
				this.ui = this.ui.element.destroy();
			},

			onProgress: function(){
				this.ui.progress.start(this.progress.percentLoaded);
			},

			onStop: function(){
				this.remove();
			},

			onComplete: function(){
				this.ui.progress = this.ui.progress.cancel().element.destroy();
				this.ui.cancel = this.ui.cancel.destroy();

				var response = JSON.decode(this.response.text);
				if (!response.status)
					new Dialog(('' + response.error).substitute(self.language, /\\?\$\{([^{}]+)\}/g) , {language: {confirm: self.language.ok}, buttons: ['confirm']});

				this.ui.element.set('tween', {duration: 2000}).highlight(response.status ? '#e6efc2' : '#f0c2c2');
				(function(){
					this.ui.element.setStyle('overflow', 'hidden').morph({
						opacity: 0,
						height: 0
					}).get('morph').chain(function(){
						this.element.destroy();
						if (!self.upload.list.getElements('li').length)
							self.upload.uploader.fade(0).get('tween').chain(function(){
								self.fillInfo();
							});
					});
				}).delay(5000, this);
			}

		});

		this.swf = new Swiff.Uploader({
			id: 'SwiffFileManagerUpload',
			path: this.options.assetBasePath + 'Swiff.Uploader.swf',
			queued: false,
			target: this.upload.button,
			allowDuplicates: true,
			instantStart: true,
			fileClass: File,
			fileSizeMax: 25 * 1024 * 1024,
			zIndex: this.SwiffZIndex || 9999,
			onSelectSuccess: function(){
				self.fillInfo();
				self.info.getElement('h2.filemanager-headline').setStyle('display', 'none');
				self.info.adopt(self.upload.uploader);
				self.upload.uploader.fade(1);
			},
			onComplete: function(){
				self.load(self.Directory, true);
			},
			onFail: function(error){
				$$(self.upload.button, self.upload.label).dispose();
				new Dialog(new Element('div', {html: self.language.flash[error] || self.language.flash.flash}), {language: {confirm: self.language.ok}, buttons: ['confirm']});
			}
		});
	}

});


text:
"""
Tests for Cloudwatch to Graphite (leadbutt)
"""
from __future__ import unicode_literals

import unittest

import plumbum

class get_cli_optionsTest(unittest.TestCase):
    def test_trivial_case(self):
        argv = []
        with self.assertRaises(IndexError):
            plumbum.interpret_options(argv)

    def test_minimal(self):
        argv = ['foo.j2', 'ec2']
        templ, ns, region, filter_by, extras = plumbum.interpret_options(argv)
        self.assertEqual(templ, 'foo.j2')
        self.assertEqual(ns, 'ec2')
        self.assertEqual(region, plumbum.DEFAULT_REGION)
        self.assertFalse(len(filter_by))
        self.assertFalse(len(extras))

    def test_namespace_can_use_cloudwatch_syntax(self):
        argv = ['foo.j2', 'AWS/EC2']
        templ, ns, region, filter_by, extras = plumbum.interpret_options(argv)
        self.assertEqual(templ, 'foo.j2')
        self.assertEqual(ns, 'ec2')

    def test_region_can_be_specified(self):
        argv = ['foo.j2', 'ec2', 'avengers-west-2']
        templ, ns, region, filter_by, extras = plumbum.interpret_options(argv)
        self.assertEqual(templ, 'foo.j2')
        self.assertEqual(ns, 'ec2')
        self.assertEqual(region, 'avengers-west-2')
        self.assertFalse(len(filter_by))
        self.assertFalse(len(extras))

        # more regions
        argv = ['foo.j2', 'ec2', 'us-east-1']
        templ, ns, region, filter_by, extras = plumbum.interpret_options(argv)
        self.assertEqual(region, 'us-east-1')
        argv = ['foo.j2', 'ec2', 'cn-north-1']
        templ, ns, region, filter_by, extras = plumbum.interpret_options(argv)
        self.assertEqual(region, 'cn-north-1')
        argv = ['foo.j2', 'ec2', 'ap-northeast-1']
        templ, ns, region, filter_by, extras = plumbum.interpret_options(argv)
        self.assertEqual(region, 'ap-northeast-1')
        argv = ['foo.j2', 'ec2', 'us-gov-west-1']
        templ, ns, region, filter_by, extras = plumbum.interpret_options(argv)
        self.assertEqual(region, 'us-gov-west-1')

    def test_filters_and_extras_found(self):
        argv = ['foo.j2', 'ec2', 'bar=mars', '--whee', 'xyzzy']
        templ, ns, region, filter_by, extras = plumbum.interpret_options(argv)
        self.assertEqual(templ, 'foo.j2')
        self.assertEqual(ns, 'ec2')
        self.assertEqual(region, plumbum.DEFAULT_REGION)
        self.assertEqual(len(filter_by), 1)
        self.assertEqual(len(extras), 2)

    def test_filters_and_extras_with_region_specified(self):
        argv = ['foo.j2', 'ec2', 'avengers-west-2', 'bar=mars', '--whee', 'xyzzy']
        templ, ns, region, filter_by, extras = plumbum.interpret_options(argv)
        self.assertEqual(templ, 'foo.j2')
        self.assertEqual(ns, 'ec2')
        self.assertEqual(region, 'avengers-west-2')
        self.assertEqual(len(filter_by), 1)
        self.assertEqual(len(extras), 2)

if __name__ == '__main__':
    unittest.main()

redpajama_set_name: RedPajamaGithub


text:
. ../assert.sh
FLOW=$1

printf "\nStop any already-running server.\n"
assert_ok "$FLOW" stop .

printf "\nQuick start.\n"
assert_ok "$FLOW" start --lazy --file-watcher none .

printf "\nExpect no errors.\n"
assert_ok "$FLOW" status --no-auto-start .

printf "\nChange @flow file with dependency on a @flow file, expect no error.\n"
echo "// change" >> b.js
assert_ok "$FLOW" force-recheck b.js
assert_ok "$FLOW" status --no-auto-start .

printf "\nDone!\n"


text:
<?php

namespace Bundle\PlacesBundle\Entities;

use Doctrine\ORM\Mapping as ORM;

/**
 * PlaceDetails
 */
class PlaceDetails
{

    /**
     * @var integer
     */
    private $placeId;

    /**
     * @var string
     */
    private $placeName;

    /**
     * @var string
     */
    private $placePhonenumber;

    /**
     * @var string
     */
    private $placeVicinity;

    /**
     * @var string
     */
    private $placeLat;

    /**
     * @var string
     */
    private $placeLng;

    /**
     * @var string
     */
    private $placeRating;

    /**
     * @var string
     */
    private $placeIcon;

    /**
     * @var string
     */
    private $placeUrl;

    /**
     * @var string
     */
    private $placeWebsite;

    /**
     * @var \Bundle\PlacesBundle\Entities\Places
     */
    private $place;

    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set placeId
     *
     * @param integer $placeId
     * @return PlaceDetails
     */
    public function setPlaceId($placeId)
    {
        $this->placeId = $placeId;

        return $this;
    }

    /**
     * Get placeId
     *
     * @return integer
     */
    public function getPlaceId()
    {
        return $this->placeId;
    }

    /**
     * Set placeName
     *
     * @param string $placeName
     * @return PlaceDetails
     */
    public function setPlaceName($placeName)
    {
        $this->placeName = $placeName;

        return $this;
    }

    /**
     * Get placeName
     *
     * @return string
     */
    public function getPlaceName()
    {
        return $this->placeName;
    }

    /**
     * Set placePhonenumber
     *
     * @param string $placePhonenumber
     * @return PlaceDetails
     */
    public function setPlacePhonenumber($placePhonenumber)
    {
        $this->placePhonenumber = $placePhonenumber;

        return $this;
    }

    /**
     * Get placePhonenumber
     *
     * @return string
     */
    public function getPlacePhonenumber()
    {
        return $this->placePhonenumber;
    }

    /**
     * Set placeVicinity
     *
     * @param string $placeVicinity
     * @return PlaceDetails
     */
    public function setPlaceVicinity($placeVicinity)
    {
        $this->placeVicinity = $placeVicinity;

        return $this;
    }

    /**
     * Get placeVicinity
     *
     * @return string
     */
    public function getPlaceVicinity()
    {
        return $this->placeVicinity;
    }

    /**
     * Set placeLat
     *
     * @param string $placeLat
     * @return PlaceDetails
     */
    public function setPlaceLat($placeLat)
    {
        $this->placeLat = $placeLat;

        return $this;
    }

    /**
     * Get placeLat
     *
     * @return string
     */
    public function getPlaceLat()
    {
        return $this->placeLat;
    }

    /**
     * Set placeLng
     *
     * @param string $placeLng
     * @return PlaceDetails
     */
    public function setPlaceLng($placeLng)
    {
        $this->placeLng = $placeLng;

        return $this;
    }

    /**
     * Get placeLng
     *
     * @return string
     */
    public function getPlaceLng()
    {
        return $this->placeLng;
    }

    /**
     * Set placeRating
     *
     * @param string $placeRating
     * @return PlaceDetails
     */
    public function setPlaceRating($placeRating)
    {
        $this->placeRating = $placeRating;

        return $this;
    }

    /**
     * Get placeRating
     *
     * @return string
     */
    public function getPlaceRating()
    {
        return $this->placeRating;
    }

    /**
     * Set placeIcon
     *
     * @param string $placeIcon
     * @return PlaceDetails
     */
    public function setPlaceIcon($placeIcon)
    {
        $this->placeIcon = $placeIcon;

        return $this;
    }

    /**
     * Get placeIcon
     *
     * @return string
     */
    public function getPlaceIcon()
    {
        return $this->placeIcon;
    }

    /**
     * Set placeUrl
     *
     * @param string $placeUrl
     * @return PlaceDetails
     */
    public function setPlaceUrl($placeUrl)
    {
        $this->placeUrl = $placeUrl;

        return $this;
    }

    /**
     * Get placeUrl
     *
     * @return string
     */
    public function getPlaceUrl()
    {
        return $this->placeUrl;
    }

    /**
     * Set placeWebsite
     *
     * @param string $placeWebsite
     * @return PlaceDetails
     */
    public function setPlaceWebsite($placeWebsite)
    {
        $this->placeWebsite = $placeWebsite;

        return $this;
    }

    /**
     * Get placeWebsite
     *
     * @return string
     */
    public function getPlaceWebsite()
    {
        return $this->placeWebsite;
    }

    /**
     * Set place
     *
     * @param \Bundle\PlacesBundle\Entities\Places $place
     * @return Comment
     */

    public function setPlace(\Bundle\PlacesBundle\Entities\Places $place = null) {
        $this->place = $place;

        return $this;
    }

    /**
     * Get place
     *
     * @return \Bundle\PlacesBundle\Entities\Places
     */

    public function getPlace() {
        return $this->place;
    }
}


text:
(function() {
	'use strict';

	angular
		.module('catalogue.shops')
		.factory('shopsService', shopsService);

	shopsService.$inject = ['dataService'];

	/* @ngInject */
	function shopsService(dataService) {
		var service = {
			all: all
		};
		return service;

		// ******************************************************************

		function all() {
			return dataService.getShops();
		}
	}
})();


text:
#include "trikRuntimeUploaderPlugin.h"

#include <QtCore/QProcess>
#include <QtWidgets/QApplication>

#include <qrkernel/settingsManager.h>
#include <qrkernel/settingsListener.h>

using namespace trik;

TrikRuntimeUploaderPlugin::TrikRuntimeUploaderPlugin()
	: mAction(new QAction(QIcon(":/trik/images/flashRobot.svg"), tr("Upload Runtime"), nullptr))
{
	connect(mAction, &QAction::triggered, this, &TrikRuntimeUploaderPlugin::uploadRuntime);
	mAction->setVisible(qReal::SettingsManager::value("SelectedRobotKit").toString() == "trikKit");
	qReal::SettingsListener::listen("SelectedRobotKit", [this](const QString selectedKit) {
		mAction->setVisible(selectedKit == "trikKit");
	});
}

void TrikRuntimeUploaderPlugin::init(const qReal::PluginConfigurator &configurator)
{
	mMainWindowInterface = &configurator.mainWindowInterpretersInterface();
}

QList<qReal::ActionInfo> TrikRuntimeUploaderPlugin::actions()
{
	return { qReal::ActionInfo(mAction, "", "tools") };
}

void TrikRuntimeUploaderPlugin::uploadRuntime()
{
	QProcess scpProcess;
	const QString openConnection = QString("\"open scp://root@%1\"")
			.arg(qReal::SettingsManager::value("TrikTcpServer").toString());

	const QString killTrikGui = "\"call killall trikGui\"";
	const QString createTrikDirectory = "\"call mkdir -p /home/root/trik\"";
	const QString removePermissions = "\"call chmod a-x trik/trik*\"";
	const QString restorePermissions = "\"call chmod a+x trik/trik*\"";
	const QString restartTrikGui = "\"call /bin/sh -c '/etc/trik/trikGui.sh &'\"";

	const QString moveCommand = " \"synchronize remote trikRuntime /home/root/trik\"";

	const QString rawWinscpPath = qReal::SettingsManager::value("WinScpPath").toString();
	const QString winscpPath = rawWinscpPath.startsWith("./")
			? QApplication::applicationDirPath() + rawWinscpPath.mid(1)
			: rawWinscpPath;

	const QString command = QString("\"%1\" /command %2 %3 %4 %5 %6 %7 %8")
			.arg(winscpPath)
			.arg(openConnection)
			.arg(createTrikDirectory)
			.arg(removePermissions)
			.arg(killTrikGui)
			.arg(moveCommand)
			.arg(restorePermissions)
			.arg(restartTrikGui);

	if (!scpProcess.startDetached(command + " \"exit\" ")) {
		mMainWindowInterface->errorReporter()->addError(
			tr("WinSCP process failed to launch, check path in settings.")
		);
	} else {
		mMainWindowInterface->errorReporter()->addWarning(
			tr("Attention! Started to download the runtime. Please do not turn off the robot.")
		);
	}
}


text:
using System;
using System.Collections.Generic;
using System.IO;
class Solution
{
    /*	author:@shivkrthakur  */
    static void Main(String[] args)
    {
        /* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution */
        string input = Console.ReadLine();
        HashSet<char> hashSet = new HashSet<char>(input.ToLower().ToCharArray());
        if (hashSet.Contains(' ') && hashSet.Count == 27)
            Console.WriteLine("pangram");
        else Console.WriteLine("not pangram");
    }
}


text:
package com.dream.library.utils;

import android.content.Context;
import android.widget.Toast;

/**
 * ToastUtils
 *
 * @author Trinea 2013-12-9
 */
public class ToastUtils {

    private ToastUtils() {
        throw new AssertionError();
    }

    public static void show(Context context, int resId) {
        show(context, context.getResources().getText(resId), Toast.LENGTH_SHORT);
    }

    public static void show(Context context, int resId, int duration) {
        show(context, context.getResources().getText(resId), duration);
    }

    public static void show(Context context, CharSequence text) {
        show(context, text, Toast.LENGTH_SHORT);
    }

    public static void show(Context context, CharSequence text, int duration) {
        Toast.makeText(context, text, duration).show();
    }

    public static void show(Context context, int resId, Object... args) {
        show(context, String.format(context.getResources().getString(resId), args), Toast.LENGTH_SHORT);
    }

    public static void show(Context context, String format, Object... args) {
        show(context, String.format(format, args), Toast.LENGTH_SHORT);
    }

    public static void show(Context context, int resId, int duration, Object... args) {
        show(context, String.format(context.getResources().getString(resId), args), duration);
    }

    public static void show(Context context, String format, int duration, Object... args) {
        show(context, String.format(format, args), duration);
    }
}


text:
// testsuite/unittests/u0003_errno.c
// some trivial tests to exercise sg_errno.h
//////////////////////////////////////////////////////////////////

#include <sg.h>

#include "unittests.h"

//////////////////////////////////////////////////////////////////

int u0003_errno__test_errno(void)
{
	char buf[SG_ERROR_BUFFER_SIZE];

	// verify argument validation.

	SG_error__get_message(SG_ERR_UNSPECIFIED,NULL,0);

	// verify that we get the expected message.

	SG_error__get_message(SG_ERR_UNSPECIFIED,buf,sizeof(buf));
	VERIFY_COND( "test_errno", (strcmp(buf,"Error 1 (sglib): Unspecified error") == 0) );

	// verify that we get a properly truncated message for a short buffer.

	SG_error__get_message(SG_ERR_UNSPECIFIED,buf,10);
	VERIFY_COND( "test_errno", (strcmp(buf,"Error 1 (") == 0) );

	SG_error__get_message(SG_ERR_UNSPECIFIED,buf,1);
	VERIFY_COND( "test_errno", (buf[0] == 0) );

	return 1;
}

int u0003_errno__get_message(void)
{
	// we now have different types of errors.  verify that we get the proper message.

	char buf[SG_ERROR_BUFFER_SIZE];

	// errno-based messages will vary by platform.
	SG_error__get_message(SG_ERR_ERRNO(ENOENT), buf, sizeof(buf));
	VERIFYP_COND("get_message",(strcmp(buf,"No such file or directory")==0),
			("ENOENT: received[%s] expected[%s]",buf,"No such file or directory"));

#if defined(WINDOWS)
	// GetLastError-based messages
	SG_error__get_message(SG_ERR_GETLASTERROR(ERROR_PATH_NOT_FOUND), buf, sizeof(buf));
	VERIFYP_COND("get_message",(strcmp(buf,"The system cannot find the path specified. ")==0),
			("ERROR_PATH_NOT_FOUND: received[%s] expected[%s]",buf,"The system cannot find the path specified. "));
#endif

	// sg-library-based error codes.
	SG_error__get_message(SG_ERR_INVALIDARG, buf, sizeof(buf));
	VERIFYP_COND("get_message",(strcmp(buf,"Error 2 (sglib): Invalid argument")==0),
		("SG_ERR_INVALIDARG: received[%s] expected[%s]",buf,"Error 2 (sglib): Invalid argument"));

	return 1;
}

TEST_MAIN(u0003_errno)
{
	TEMPLATE_MAIN_START;

	BEGIN_TEST(  u0003_errno__test_errno()  );
	BEGIN_TEST(  u0003_errno__get_message()  );

	TEMPLATE_MAIN_END;
}


text:
namespace content {

class RenderWidgetHostView;
class RenderWidgetHostViewMac;

// A helper class to bring up definition of word for a RWHV.
//
// This is triggered by "Lookup in Dictionary" context menu item.
// Either uses Dictionary.app or a light-weight dictionary panel, based on
// system settings.
class RenderWidgetHostViewMacDictionaryHelper {
 public:
  explicit RenderWidgetHostViewMacDictionaryHelper(RenderWidgetHostView* view);

  // Overrides the view to use to bring up dictionary panel.
  // This |target_view| can be different from |view_|, |view_| is used to get
  // the current selection value where |target_view| is used to bring up the
  // cocoa dictionary panel.
  void SetTargetView(RenderWidgetHostView* target_view);
  void set_offset(const gfx::Vector2d& offset) { offset_ = offset; }

  // Brings up either Dictionary.app or a light-weight dictionary panel,
  // depending on system settings.
  void ShowDefinitionForSelection();

 private:
  // This class shows definition for this view.
  RenderWidgetHostViewMac* view_;
  // This view is use to bring up the dictionary panel. Generally this is the
  // same as |view_|. One can override the view to use via SetTargetView().
  RenderWidgetHostViewMac* target_view_;
  // The extra offset to use while positioning the dicitonary panel.
  gfx::Vector2d offset_;

  DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMacDictionaryHelper);
};

}  // namespace content

#endif  // CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_DICTIONARY_HELPER_H_


text:
<?php

/**
 * @file
 * Definition of Drupal\search\Plugin\views\field\Score.
 */

namespace Drupal\search\Plugin\views\field;

use Drupal\views\Plugin\views\field\Numeric;
use Drupal\Component\Annotation\PluginID;

/**
 * Field handler to provide simple renderer that allows linking to a node.
 *
 * @ingroup views_field_handlers
 *
 * @PluginID("search_score")
 */
class Score extends Numeric {

  protected function defineOptions() {
    $options = parent::defineOptions();

    $options['alternate_sort'] = array('default' => '');
    $options['alternate_order'] = array('default' => 'asc');

    return $options;
  }

  public function buildOptionsForm(&$form, &$form_state) {
    $style_options = $this->view->display_handler->getOption('style_options');
    if (isset($style_options['default']) && $style_options['default'] == $this->options['id']) {
      $handlers = $this->view->display_handler->getHandlers('field');
      $options = array('' => t('No alternate'));
      foreach ($handlers as $id => $handler) {
        $options[$id] = $handler->adminLabel();
      }

      $form['alternate_sort'] = array(
        '#type' => 'select',
        '#title' => t('Alternative sort'),
        '#description' => t('Pick an alternative default table sort field to use when the search score field is unavailable.'),
        '#options' => $options,
        '#default_value' => $this->options['alternate_sort'],
      );

      $form['alternate_order'] = array(
        '#type' => 'select',
        '#title' => t('Alternate sort order'),
        '#options' => array('asc' => t('Ascending'), 'desc' => t('Descending')),
        '#default_value' => $this->options['alternate_order'],
      );
    }

    parent::buildOptionsForm($form, $form_state);
  }

  public function query() {
    // Check to see if the search filter added 'score' to the table.
    // Our filter stores it as $handler->search_score -- and we also
    // need to check its relationship to make sure that we're using the same
    // one or obviously this won't work.
    foreach ($this->view->filter as $handler) {
      if (isset($handler->search_score) && $handler->relationship == $this->relationship) {
        $this->field_alias = $handler->search_score;
        $this->tableAlias = $handler->tableAlias;
        return;
      }
    }

    // Hide this field if no search filter is in place.
    $this->options['exclude'] = TRUE;
    if (!empty($this->options['alternate_sort'])) {
      if (isset($this->view->style_plugin->options['default']) && $this->view->style_plugin->options['default'] == $this->options['id']) {
        // Since the style handler initiates fields, we plug these values right into the active handler.
        $this->view->style_plugin->options['default'] = $this->options['alternate_sort'];
        $this->view->style_plugin->options['order'] = $this->options['alternate_order'];
      }
    }
  }

  public function render($values) {
    // Only render if we exist.
    if (isset($this->tableAlias)) {
      return parent::render($values);
    }
  }

}


text:
var MIDI = (function() {

    var MIDI = function() {
        this._midiAccess = null;
    };

    MIDI.prototype.requestAccess = function(onSuccess, onError) {
        var thisMIDI = this;
        if (navigator.requestMIDIAccess) {
            navigator.requestMIDIAccess({
                sysex: false // this defaults to 'false' and we won't be covering sysex in this article.
            }).then(function(midiAccess) {
                //Success!
                thisMIDI._midiAccess = midiAccess;
                onSuccess();
            }, function(error) {
                //Error!
                onError('No access to MIDI devices or your browser does not support WebMIDI API. Please use WebMIDIAPIShim.', error);
            });
        } else {
            onError('No MIDI support in your browser.')
        }
    };

    MIDI.prototype.getInputs = function() {
        var devices = [];
        var inputs = this._midiAccess.inputs.values();
        for (var input = inputs.next(); input && !input.done; input = inputs.next()) {
            var device = new MIDIInputDevice(input.value);
            devices.push(device);
        }
        return devices;
    };

    MIDI.prototype.getInput = function(name) {
        var inputs = this._midiAccess.inputs.values();
        for (var input = inputs.next(); input && !input.done; input = inputs.next()) {
            if (input.value.name === name) {
                return new MIDIInputDevice(input.value);
            }
        }
        throw new Error('No input device \"' + name + '\" found.');
    };

    var MIDIInputDevice = function(midiInput) {
        if (! midiInput instanceof MIDIInput)
            throw new Error('invalid MIDI input device');

        this._midiInput = midiInput;

        this._midiInput.onmidimessage = function(message) {
            this._onMIDIMessage(message);
        }.bind(this);

        this._listeners = {};
        this.name = this._midiInput.name;
    };

    MIDIInputDevice.prototype._onMIDIMessage = function(message) {

        var data = message.data,
            cmd = data[0] >> 4,
            channel = (data[0] & 0xf) + 1,
            type = data[0] & 0xf0,
            note = data[1],
            velocity = data[2];

        if (type === 144) {
            this.noteOn(channel, note, velocity);
        } else if (type === 128) {
            this.noteOff(channel, note);
        } else if (type === 176) {
            this.cc(channel, note, velocity);
        } else {
            console.log('Unsupported message. type: ', type, 'note: ', note, 'velocity: ', velocity);
        }
    };

    MIDIInputDevice.prototype.on = function(eventName, callback) {
        this._listeners[eventName] = callback;
    };

    MIDIInputDevice.prototype.noteOn = function(channel, note, velocity) {
        if (typeof this._listeners.noteon === 'function') {
            this._listeners.noteon(channel, note, velocity);
        }
    };

    MIDIInputDevice.prototype.noteOff = function(channel, note) {
        if (typeof this._listeners.noteoff === 'function') {
            this._listeners.noteoff(channel, note);
        }
    };

    MIDIInputDevice.prototype.cc = function(channel, number, value) {
        if (typeof this._listeners.cc === 'function') {
            this._listeners.cc(channel, number, value);
        }
    };

    return MIDI;

})();


text:
package com.learnncode.mediachooser;

import java.util.ArrayList;

import android.graphics.Bitmap;
import android.media.ThumbnailUtils;
import android.os.AsyncTask;
import android.provider.MediaStore.Video.Thumbnails;
import android.support.v4.app.Fragment;
import android.support.v4.util.LruCache;
import android.widget.ImageView;

import com.learnncode.mediachooser.adapter.BucketGridAdapter;
import com.learnncode.mediachooser.adapter.GridViewAdapter;
import com.learnncode.mediachooser.fragment.BucketVideoFragment;
import com.learnncode.mediachooser.fragment.VideoFragment;

public class GalleryCache {
	private LruCache<String, Bitmap> mBitmapCache;
	private ArrayList<String> mCurrentTasks;
	private int mMaxWidth;
	private int mMaxHeight;

	public GalleryCache(int size, int maxWidth, int maxHeight) {
		mMaxWidth = maxWidth;
		mMaxHeight = maxHeight;

		mBitmapCache = new LruCache<String, Bitmap>(size) {
			@Override
			protected int sizeOf(String key, Bitmap b) {
				// Assuming that one pixel contains four bytes.
				return b.getHeight() * b.getWidth() * 4;
			}
		};

		mCurrentTasks = new ArrayList<String>();
	}

	private void addBitmapToCache(String key, Bitmap bitmap) {
		if (getBitmapFromCache(key) == null) {
			mBitmapCache.put(key, bitmap);
		}
	}

	private Bitmap getBitmapFromCache(String key) {
		return mBitmapCache.get(key);
	}

	/**
	 * Gets a bitmap from cache.

	 *

	 * If it is not in cache, this method will:

	 * 1: check if the bitmap url is currently being processed in the
	 * BitmapLoaderTask and cancel if it is already in a task (a control to see
	 * if it's inside the currentTasks list).

	 * 2: check if an internet connection is available and continue if
	 * so.

	 * 3: download the bitmap, scale the bitmap if necessary and put it
	 * into the memory cache.

	 * 4: Remove the bitmap url from the currentTasks list.

	 * 5: Notify the ListAdapter.
	 *
	 * @param mainActivity
	 *            - Reference to activity object, in order to call
	 *            notifyDataSetChanged() on the ListAdapter.
	 * @param imageKey
	 *            - The bitmap url (will be the key).
	 * @param imageView
	 *            - The ImageView that should get an available bitmap or a
	 *            placeholder image.
	 * @param isScrolling
	 *            - If set to true, we skip executing more tasks since the user
	 *            probably has flinged away the view.
	 */
	public void loadBitmap(Fragment mainActivity, String imageKey,
			ImageView imageView, boolean isScrolling) {
		final Bitmap bitmap = getBitmapFromCache(imageKey);

		if (bitmap != null) {
			imageView.setImageBitmap(bitmap);
		} else {
			imageView.setImageResource(R.drawable.loading);
			//			imageView.setImageResource(R.drawable.transprent_drawable);
			if (!isScrolling && !mCurrentTasks.contains(imageKey)) {
				if(mainActivity instanceof VideoFragment){
					BitmapLoaderTask task = new BitmapLoaderTask(imageKey, ((VideoFragment)mainActivity).getAdapter());
					task.execute();

				}else if(mainActivity instanceof BucketVideoFragment){
					BitmapLoaderTask task = new BitmapLoaderTask(imageKey, ((BucketVideoFragment)mainActivity).getAdapter());
					task.execute();
				}
			}
		}
	}

	private class BitmapLoaderTask extends AsyncTask<Void, Void, Bitmap> {
		private GridViewAdapter mAdapter;
		private BucketGridAdapter mBucketGridAdapter;
		private String mImageKey;

		public BitmapLoaderTask(String imageKey, GridViewAdapter adapter) {
			mAdapter = adapter;
			mImageKey = imageKey;
		}

		public BitmapLoaderTask(String imageKey, BucketGridAdapter adapter) {
			mBucketGridAdapter = adapter;
			mImageKey = imageKey;
		}

		@Override
		protected void onPreExecute() {
			mCurrentTasks.add(mImageKey);
		}

		@Override
		protected Bitmap doInBackground(Void... params) {
			Bitmap bitmap = null;
			try {
				bitmap = ThumbnailUtils.createVideoThumbnail(mImageKey, Thumbnails.FULL_SCREEN_KIND);

				if (bitmap != null) {
					bitmap = Bitmap.createScaledBitmap(bitmap, mMaxWidth, mMaxWidth, false);
					addBitmapToCache(mImageKey, bitmap);
					return bitmap;
				}
				return null;
			} catch (Exception e) {
				if (e != null) {
					e.printStackTrace();
				}
				return null;
			}
		}

		@Override
		protected void onPostExecute(Bitmap param) {
			mCurrentTasks.remove(mImageKey);
			if (param != null) {
				if(mAdapter != null){
					mAdapter.notifyDataSetChanged();
				}else{
					mBucketGridAdapter.notifyDataSetChanged();
				}
			}
		}
	}

	public void clear() {
		mBitmapCache.evictAll();
	}

}


text:
<?php

namespace KtogiasZendLib\Application\User\Model;

use KtogiasZendLib\Model\ValidatingDbTableModel;

/**
 * Description of UserLdapModel
 *
 * @author ktogias
 */
class UserLdapModel extends ValidatingDbTableModel implements UserLdapModelInterface{
    /**
     *
     * @var integer
     */
    protected $user_id;

    /**
     *
     * @var string
     */
    protected $cn;

    /**
     *
     * @var string
     */
    protected $dn;

    /**
     *
     * @var string
     */
    protected $employeeid;

    /**
     *
     * @var string
     */
    protected $mail;

    /**
     *
     * @var string
     */
    protected $program;

    /**
     *
     * @var string
     */
    protected $uid;

    /**
     *
     * @var string
     */
    protected $created_at;

    /**
     *
     * @var string
     */
    protected $updated_at;

    /**
     *
     * @var string
     */
    protected $title;

    protected $fields = ['user_id', 'cn', 'dn', 'employeeid', 'mail', 'program', 'uid', 'created_at', 'updated_at', 'title'];

    /**
     * @return \KtogiasZendLib\Application\User\Model\UserModel
     */
    protected $user;

    /**
     *
     * @var \KtogiasZendLib\Application\Log\Model\LogModelInterface
     */
    protected $logModel;

    /**
     *
     * @return \KtogiasZendLib\Application\Log\Model\LogModelInterface
     */
    public function getLogModel() {
        if (!$this->logModel){
            $this->setLogModel(clone $this->serviceLocator->get('KtogiasZendLib\Application\Log\Model\LogModel'));
        }
        return $this->logModel;
    }

    public function setLogModel(\KtogiasZendLib\Application\Log\Model\LogModelInterface $logModel) {
        $this->logModel = $logModel;
    }

    /**
     * @return string
     */
    public function getCn() {
        return $this->cn;
    }

    /**
     * @return \DateTime
     */
    public function getCreatedAt() {
        return $this->created_at?new \DateTime($this->created_at):null;
    }

    /**
     * @return string
     */
    public function getDn() {
        return $this->dn;
    }

    /**
     * @return string
     */
    public function getEmployeeid() {
        return $this->employeeid;
    }

    /**
     * @return string
     */
    public function getMail() {
        return $this->mail;
    }

    /**
     * @return string
     */
    public function getProgram() {
        return $this->program;
    }

    /**
     * @return string
     */
    public function getUid() {
        return $this->uid;
    }

    /**
     * @return \DateTime
     */
    public function getUpdatedAt() {
        return $this->updated_at?new \DateTime($this->updated_at):null;
    }

    /**
     *
     * @return integer
     */
    public function getUserId() {
        return $this->user_id;
    }

    /**
     * @return \KtogiasZendLib\Application\User\Model\UserModel
     */
    public function getUser(){
        if ($this->user == NULL){
            $user = clone $this->serviceLocator->get('KtogiasZendLib\Application\User\Model\UserModel');
            /*@var $user \KtogiasZendLib\Application\User\Model\UserModel*/
            $this->user = $user->load($this->user_id);
        }
        return $this->user;
    }

    /**
     *
     * @param \KtogiasZendLib\Application\User\Model\UserModelInterface $user
     * @return $this
     * @throws Exception\WrongUserIdException
     */
    public function setUser(UserModelInterface $user){
        if ($user->getId() != $this->user_id){
            throw new Exception\WrongUserIdException('the id of the provided user is not the same with user_id.');
        }
        $this->user = $user;
        return $this;
    }

    /**
     * @param $dn string
     * @return $this
     */
    public function loadByDn($dn){
        $modelObject = $this->table->fetchOne(['dn' => $dn], true, true);
        $this->exchangeArray($modelObject->getArrayCopy());
        $this->getLogModel()->log('debug', get_class($this), 'loadByDn', NULL, NULL, $dn);
        return $this;
    }

    /**
     * @param $uid string
     * @return $this
     */
    public function loadByUid($uid){
        $modelObject = $this->table->fetchOne(['uid' => $uid], true, true);
        $this->exchangeArray($modelObject->getArrayCopy());
        $this->getLogModel()->log('debug', get_class($this), 'loadByUid', NULL, NULL, $uid);
        return $this;
    }

    /**
     *
     * @param array $data
     * @return $this
     * @throws Exception\LdapUidHasChangedException
     */
    public function updateFromData(array $data){
        if (!empty($_SERVER['APPLICATION_ENV'])
                && $_SERVER['APPLICATION_ENV'] == 'development'
                && $data['mail'][0] == 'ktogias@math.upatras.gr'){
           $data['title'][0] = 'S';
        }
        if ($this->uid != $data['uid'][0]){
            throw new Exception\LdapUidHasChangedException('Ldap uid has changed!');
        }
        if ($this->cn != $data['cn'][0]
                || $this->dn != $data['dn']
                || $this->employeeid != $data['employeeid'][0]
                || $this->mail != $data['mail'][0]
                || $this->program != (!empty($data['program'])?$data['program'][0]:NULL)
                || $this->uid != $data['uid'][0]
                || $this->title != $data['title'][0]
        ){
            $this->getTable()->getTableGateway()->getAdapter()->getDriver()->getConnection()->beginTransaction();
            try {
                if ($this->title != $data['title'][0]){
                    $user = $this->getUser();
                    $userRoles = $user->getRoles();
                    $ldapRole = clone $this->serviceLocator->get('KtogiasZendLib\Application\Role\Model\RoleModel');
                    /*@var $ldapRole \KtogiasZendLib\Application\Role\Model\RoleModel*/
                    try {
                        $ldapRole->loadByLdapTitle($data['title'][0]);
                    }
                    catch (\KtogiasZendLib\Db\Table\Exception\DbTableNoResultException $ex){
                        throw new Exception\RoleByLdapTitleNotFoundException('Role for title '.$data['title'][0].' not found!');
                    }
                    foreach ($userRoles as $role){
                        /*@var $role \KtogiasZendLib\Application\Role\Model\RoleModel*/
                        if ($role->isLdap(TRUE) && $role->getId() != $ldapRole->getId() && !$role->isDescendantOf($ldapRole)){
                            $user->removeRole($role);
                        }
                    }
                    if (!$user->hasRole($ldapRole, true)){
                        $user->addRole($ldapRole);
                    }
                }
                $this->set([
                    'user_id' => $this->user_id,
                    'cn' => $data['cn'][0],
                    'dn' => $data['dn'],
                    'employeeid' => $data['employeeid'][0],
                    'mail' => $data['mail'][0],
                    'program' => !empty($data['program'])?$data['program'][0]:NULL,
                    'uid' => $data['uid'][0],
                    'title' => $data['title'][0],
                    'created_at' => $this->created_at,
                    'updated_at' => (new \DateTime())->format('Y-m-d H:i:s'),
                ])->save();
                $this->getTable()->getTableGateway()->getAdapter()->getDriver()->getConnection()->commit();
            }
            catch (\Exception $e){
                $this->getTable()->getTableGateway()->getAdapter()->getDriver()->getConnection()->rollback();
                throw $e;
            }
        }
        return $this;
    }

    /**
     *
     * @param array $data
     * @return $this
     * @throws \Exception
     */
    public function createFromData(array $data){
        $user = clone $this->serviceLocator->get('KtogiasZendLib\Application\User\Model\UserModel');
        /*@var $user \KtogiasZendLib\Application\User\Model\UserModel*/
        $role = clone $this->serviceLocator->get('KtogiasZendLib\Application\Role\Model\RoleModel');
        /*@var $role \KtogiasZendLib\Application\Role\Model\RoleModel*/
        try {
            $role->loadByLdapTitle($data['title'][0]);
        } catch (\KtogiasZendLib\Db\Table\Exception\DbTableNoResultException $ex){
            throw new Exception\RoleByLdapTitleNotFoundException('Role for title '.$data['title'][0].' not found!');
        }
        $this->getTable()->getTableGateway()->getAdapter()->getDriver()->getConnection()->beginTransaction();

        try {
            try {
                $user->loadByEmail($data['mail'][0]);
            } catch (\KtogiasZendLib\Db\Table\Exception\DbTableNoResultException $ex) {
                $user->create($data['mail'][0], $data['mail'][0], $data['givenname'][0], $data['sn'][0]);
            }
            if (!$user->hasRole($role)){
                $user->addRole($role);
            }
            if (!$user->isActive()){
                $user->activate();
            }
            $this->set([
                'user_id' => $user->getId(),
                'cn' => $data['cn'][0],
                'dn' => $data['dn'],
                'employeeid' => $data['employeeid'][0],
                'mail' => $data['mail'][0],
                'program' => !empty($data['program'])?$data['program'][0]:NULL,
                'uid' => $data['uid'][0],
                'title' => $data['title'][0],
                'created_at' => (new \DateTime())->format('Y-m-d H:i:s'),
                'updated_at' => NULL,
            ])->save();
            $this->getTable()->getTableGateway()->getAdapter()->getDriver()->getConnection()->commit();
            return $this->setUser($user);
        }
        catch (\Exception $e){
            $this->getTable()->getTableGateway()->getAdapter()->getDriver()->getConnection()->rollback();
            throw $e;
        }
    }

    /**
     *
     * @param array $data
     * @return $this
     */
    public function loadUpdateCreateFromLdapData(array $data){
        if (!empty($_SERVER['APPLICATION_ENV'])
                && $_SERVER['APPLICATION_ENV'] == 'development'
                && $data['mail'][0] == 'ktogias@math.upatras.gr'){
           $data['title'][0] = 'S';
        }
        try {
            return $this->loadByUid($data['uid'][0])->updateFromData($data);

        } catch (\KtogiasZendLib\Db\Table\Exception\DbTableNoResultException $ex) {
            return $this->createFromData($data);
        }
    }

}


text:
%% Copyright 2018 Alliance for Sustainable Energy, LLC
%
% Permission is hereby granted, free of charge, to any person obtaining a copy of this software
% and associated documentation files (the "Software"), to deal in the Software without restriction,
% including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
% and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
% subject to the following conditions:
%
% The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
%
% THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
% BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
% NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, THE COPYRIGHT HOLDERS, THE UNITED STATES,
% THE UNITED STATES DEPARTMENT OF ENERGY, OR ANY OF THEIR EMPLOYEES BE LIABLE FOR ANY CLAIM,
% DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
% OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
%
% Author: Przemyslaw Koralewicz / NREL
% Date: 2017

function save_figs(fh, filename, savefig, savepng)
    for i=1:length(fh)
        plotsizeinch = [12 15];
        saveDPI = 300;
        set(fh(i),'PaperUnits','inches');
        set(fh(i),'PaperSize', plotsizeinch);
        set(fh(i),'PaperUnits','normalized');
        %set(gcf,'PaperPosition',[0.1,0.1,0.9,0.9]);
        set(fh(i),'PaperPositionMode','auto')
        set(fh(i),'PaperPosition',[0,0,1,1]);
        set(fh(i),'Position',[0 0 plotsizeinch]*saveDPI);
        print(fh(i), '-dpng' ,['-r' num2str(saveDPI)], [filename num2str(i)]); % ,['-r' num2str(saveDPI)]
    end;
end


text:
(function (global, factory) {
    if (typeof define === "function" && define.amd) {
        define([], factory);
    } else if (typeof exports !== "undefined") {
        factory();
    } else {
        var mod = {
            exports: {}
        };
        factory();
        global.bootstrapTableHuHU = mod.exports;
    }
})(this, function () {
    'use strict';

    /**
     * Bootstrap Table Hungarian translation
     * Author: Nagy Gergely <info@nagygergely.eu>
     */
    (function ($) {
        'use strict';

        $.fn.bootstrapTable.locales['hu-HU'] = {
            formatLoadingMessage: function formatLoadingMessage() {
                return 'Betöltés, kérem várjon...';
            },
            formatRecordsPerPage: function formatRecordsPerPage(pageNumber) {
                return pageNumber + ' rekord per oldal';
            },
            formatShowingRows: function formatShowingRows(pageFrom, pageTo, totalRows) {
                return 'Megjelenítve ' + pageFrom + ' - ' + pageTo + ' / ' + totalRows + ' összesen';
            },
            formatSearch: function formatSearch() {
                return 'Keresés';
            },
            formatNoMatches: function formatNoMatches() {
                return 'Nincs találat';
            },
            formatPaginationSwitch: function formatPaginationSwitch() {
                return 'Lapozó elrejtése/megjelenítése';
            },
            formatRefresh: function formatRefresh() {
                return 'Frissítés';
            },
            formatToggle: function formatToggle() {
                return 'Összecsuk/Kinyit';
            },
            formatColumns: function formatColumns() {
                return 'Oszlopok';
            },
            formatAllRows: function formatAllRows() {
                return 'Összes';
            }
        };

        $.extend($.fn.bootstrapTable.defaults, $.fn.bootstrapTable.locales['hu-HU']);
    })(jQuery);
});


text:
\section{Implementation}

Our current prototype is implemented as a javascript client library and a Python server because this is common.  Performance-critical parts of the client are written in asm.js and AOT compiled.
In this section, we describe our implementation of the major components.

\subsection{Prediction Model}

Describe the challenges: prediction in general.  Note that the needed accuracy is low.  Note that KTM and mouse prediction is pretty good -- particularly if the "active" region of the interface is well established.

\ewu{Are mouse movements using interactive visualizations different from normal web browsing behavior?   Does training on one do well on the other?  vice versa? }

\stitle{Representing Distributions}
Distributions can represent thousands of possible queries.  Simply representing it efficiently is an issue.

\subsection{Storage Engines}

Data cube.

Query Template.

Sampling???  This would require client side execution engine...

\subsection{Scheduler}

The key challenge for the scheduler is to determine the number of bytes to allocate to each query in the predictied distribution, and the order to send them back.  We decompose this into two policy decisions: how to transform the distribution to account for previously sent data, and how to allocate bandwidth given a single distribution.

\stitle{Transformation:}  One approach is to schedule query results for each distribution independently and ignore past sent data.  A more advanced policy is to adjust the distributions to dampen the probability for queries that have been recently retrieved.  We call these \texttt{Indep} and \texttt{Dampen}, respectively.

\stitle{Allocation:} The second consideration is the number of bytes to allocate each We experiment with three policies: topk, proportional, Microsoft.
Top K sends all bytes for each query from highest to lowest probability.
Proportional allocates the bandwidth proportionally to all queries with a probability above a threshold $thresh$.  We use $thresh=0$ in the experiments.
Finally, Microsoft is an adaptation of a resource allocation algorithm from~\cite{} that \ewu{XXX}.

\ewu{Note that the ring buffer does not mean data will be constantly overwritten---the scheduler can decide not to send any data if it doesn't want to overwrite something.  }

\subsection{Progressive Encoding}

We experiment with two progressive encoding schemes.  The first is haar wavelet encoding~\cite{}, and the second is running fast fourier transform~\cite{nussbaumer2012fast} (FFT) on the query results and progressively sending each component.


text:
package org.apache.shardingsphere.traffic.executor;

import org.apache.shardingsphere.infra.executor.sql.context.SQLUnit;
import org.apache.shardingsphere.infra.executor.sql.execute.engine.driver.jdbc.JDBCExecutionUnit;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;

/**
 * Traffic executor.
 */
public final class TrafficExecutor implements AutoCloseable {

    private Statement statement;

    /**
     * Execute.
     *
     * @param executionUnit execution unit
     * @param callback traffic executor callback
     * @param <T> return type
     * @return execute result
     * @throws SQLException SQL exception
     */
    public <T> T execute(final JDBCExecutionUnit executionUnit, final TrafficExecutorCallback<T> callback) throws SQLException {
        SQLUnit sqlUnit = executionUnit.getExecutionUnit().getSqlUnit();
        cacheStatement(sqlUnit.getParameters(), executionUnit.getStorageResource());
        return callback.execute(statement, sqlUnit.getSql());
    }

    private void cacheStatement(final List<Object> parameters, final Statement statement) throws SQLException {
        this.statement = statement;
        setParameters(statement, parameters);
    }

    private void setParameters(final Statement statement, final List<Object> parameters) throws SQLException {
        if (!(statement instanceof PreparedStatement)) {
            return;
        }
        int index = 1;
        for (Object each : parameters) {
            ((PreparedStatement) statement).setObject(index++, each);
        }
    }

    /**
     * Get result set.
     *
     * @return result set
     * @throws SQLException SQL exception
     */
    public ResultSet getResultSet() throws SQLException {
        return statement.getResultSet();
    }

    @Override
    public void close() throws SQLException {
        if (null != statement) {
            Connection connection = statement.getConnection();
            statement.close();
            connection.close();
        }
    }
}


text:
namespace context {
class BrowserContext;
}

namespace extensions {
class PasswordsPrivateDelegate;

// Factory for creating PasswordPrivateDelegates.
class PasswordsPrivateDelegateFactory
    : public BrowserContextKeyedServiceFactory {
 public:
  static PasswordsPrivateDelegate* GetForBrowserContext(
      content::BrowserContext* browser_context,
      bool create);

  static PasswordsPrivateDelegateFactory* GetInstance();

 private:
  friend struct base::DefaultSingletonTraits<PasswordsPrivateDelegateFactory>;

  PasswordsPrivateDelegateFactory();
  ~PasswordsPrivateDelegateFactory() override;

  // BrowserContextKeyedBaseFactory implementation.
  KeyedService* BuildServiceInstanceFor(
      content::BrowserContext* profile) const override;
  bool ServiceIsCreatedWithBrowserContext() const override;
  bool ServiceIsNULLWhileTesting() const override;

  DISALLOW_COPY_AND_ASSIGN(PasswordsPrivateDelegateFactory);
};

}  // namespace extensions

#endif  // CHROME_BROWSER_EXTENSIONS_API_PASSWORDS_PRIVATE_PASSWORDS_PRIVATE_DELEGATE_FACTORY_H_


text:
#ifndef TENSORFLOW_LITE_TOOLS_LOGGING_H_
#define TENSORFLOW_LITE_TOOLS_LOGGING_H_

// LOG and CHECK macros for tflite tooling.

#include <cstdlib>
#include <iostream>
#include <sstream>

#ifdef _WIN32
#undef ERROR
#endif

#ifdef __ANDROID__
#include <android/log.h>
#endif

namespace tflite {
namespace logging {
// A wrapper that logs to stderr.
//
// Used for TFLITE_LOG and TFLITE_BENCHMARK_CHECK macros.
class LoggingWrapper {
 public:
  enum class LogSeverity : int {
    INFO = 0,
    WARN = 1,
    ERROR = 2,
    FATAL = 3,
  };
  explicit LoggingWrapper(LogSeverity severity)
      : severity_(severity), should_log_(true) {}
  LoggingWrapper(LogSeverity severity, bool log)
      : severity_(severity), should_log_(log) {}
  std::stringstream& Stream() { return stream_; }
  ~LoggingWrapper() {
    if (should_log_) {
      // Also print log to logcat for android, as stderr will be hidden
      // in the app use case.
#ifdef __ANDROID__
      switch (severity_) {
        case LogSeverity::INFO:
          __android_log_print(ANDROID_LOG_INFO, "tflite", "%s",
                              stream_.str().c_str());
          break;
        case LogSeverity::WARN:
          __android_log_print(ANDROID_LOG_WARN, "tflite", "%s",
                              stream_.str().c_str());
          break;
        case LogSeverity::ERROR:
          __android_log_print(ANDROID_LOG_ERROR, "tflite", "%s",
                              stream_.str().c_str());
          break;
        case LogSeverity::FATAL:
          __android_log_print(ANDROID_LOG_ERROR, "tflite", "%s",
                              stream_.str().c_str());
      }
#endif
      switch (severity_) {
        case LogSeverity::INFO:
        case LogSeverity::WARN:
          std::cout << stream_.str() << std::endl;
          break;
        case LogSeverity::ERROR:
          std::cerr << stream_.str() << std::endl;
          break;
        case LogSeverity::FATAL:
          std::cerr << stream_.str() << std::endl;
          std::flush(std::cerr);
          std::abort();
          break;
      }
    }
  }

 private:
  std::stringstream stream_;
  LogSeverity severity_;
  bool should_log_;
};
}  // namespace logging
}  // namespace tflite

#define TFLITE_LOG(severity)                                  \
  tflite::logging::LoggingWrapper(                            \
      tflite::logging::LoggingWrapper::LogSeverity::severity) \
      .Stream()

#define TFLITE_MAY_LOG(severity, should_log)                                \
  tflite::logging::LoggingWrapper(                                          \
      tflite::logging::LoggingWrapper::LogSeverity::severity, (should_log)) \
      .Stream()

#define TFLITE_TOOLS_CHECK(condition) TFLITE_MAY_LOG(FATAL, !(condition))

#define TFLITE_TOOLS_CHECK_EQ(a, b) TFLITE_TOOLS_CHECK((a) == (b))

#endif  // TENSORFLOW_LITE_TOOLS_LOGGING_H_


text:
"use strict";
//# sourceMappingURL=tree.js.map


text:
package jp.co.minori.findbugs.detect.slf4j;

import java.io.IOException;
import java.util.TreeMap;

import jp.co.minori.findbugs.utils.BaseFindBugsTest;
import jp.co.minori.findbugs.utils.EasyBugReporter;

import org.junit.Test;

import testcase.slf4j.OnePlaceHolder_Sample;

/**
 * @author Zenichi Amano (crow.misia@gmail.com)
 */
@SuppressWarnings({ "serial", })
public class OnePlaceHolderTest extends BaseFindBugsTest {

    @Test
    public void test() throws IOException, InterruptedException {
        final EasyBugReporter reporter = new EasyBugReporter("SLF4J_");
        analyze(reporter, OnePlaceHolder_Sample.class);

        expect(reporter, new TreeMap<String, Integer>() {{
        }});
    }

}


text:
package org.jivesoftware.smackx.mam;

import static org.junit.Assert.assertEquals;

import java.util.List;

import org.jivesoftware.smack.SmackException.NoResponseException;
import org.jivesoftware.smack.SmackException.NotConnectedException;
import org.jivesoftware.smack.SmackException.NotLoggedInException;
import org.jivesoftware.smack.XMPPException.XMPPErrorException;
import org.jivesoftware.smack.packet.Message;

import org.jivesoftware.smackx.forward.packet.Forwarded;
import org.jivesoftware.smackx.mam.MamManager.MamQueryResult;
import org.jivesoftware.smackx.mam.element.MamPrefsIQ;

import org.igniterealtime.smack.inttest.AbstractSmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTest;
import org.igniterealtime.smack.inttest.SmackIntegrationTestEnvironment;
import org.igniterealtime.smack.inttest.TestNotPossibleException;
import org.jxmpp.jid.EntityBareJid;

public class MamIntegrationTest extends AbstractSmackIntegrationTest {

    private final MamManager mamManagerConTwo;

    public MamIntegrationTest(SmackIntegrationTestEnvironment environment) throws NoResponseException,
            XMPPErrorException, NotConnectedException, InterruptedException, TestNotPossibleException {
        super(environment);

        mamManagerConTwo = MamManager.getInstanceFor(conTwo);

        if (!mamManagerConTwo.isSupported()) {
            throw new TestNotPossibleException("Message Archive Management (XEP-0313) is not supported by the server.");
        }

    }

    @SmackIntegrationTest
    public void mamTest() throws NotConnectedException, InterruptedException, NoResponseException, XMPPErrorException,
                    NotLoggedInException {
        EntityBareJid userOne = conOne.getUser().asEntityBareJid();
        EntityBareJid userTwo = conTwo.getUser().asEntityBareJid();

        // Make sure MAM is archiving messages.
        mamManagerConTwo.updateArchivingPreferences(null, null, MamPrefsIQ.DefaultBehavior.always);

        Message message = new Message(userTwo);
        String messageId = message.setStanzaId();
        String messageBody = "test message";
        message.setBody(messageBody);

        conOne.sendStanza(message);

        int pageSize = 20;
        MamQueryResult mamQueryResult = mamManagerConTwo.queryArchive(pageSize, null, null, userOne, null);

        while (!mamQueryResult.mamFin.isComplete()) {
            mamQueryResult = mamManagerConTwo.pageNext(mamQueryResult, pageSize);
        }

        List<Forwarded> forwardedMessages = mamQueryResult.forwardedMessages;
        Message mamMessage = (Message) forwardedMessages.get(forwardedMessages.size() - 1).getForwardedStanza();

        assertEquals(messageId, mamMessage.getStanzaId());
        assertEquals(messageBody, mamMessage.getBody());
        assertEquals(conOne.getUser(), mamMessage.getFrom());
        assertEquals(userTwo, mamMessage.getTo());
    }

}


text:
package com.asakusafw.yaess.tools.log;

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

import com.asakusafw.utils.io.Source;

/**
 * Provides {@link YaessLogRecord}s.
 * @since 0.6.2
 */
public interface YaessLogInput {

    /**
     * Returns the option names and their descriptions.
     * @return option name and description pair
     */
    Map<String, String> getOptionsInformation();

    /**
     * Creates a source which provides {@link YaessLogRecord}s.
     * @param options the source options
     * @return the source which provides log records
     * @throws IllegalArgumentException if the specified options are invalid
     * @throws IOException if failed to create source by I/O error
     * @throws InterruptedException if interrupted while creating source
     */
    Source<? extends YaessLogRecord> createSource(
            Map<String, String> options) throws IOException, InterruptedException;
}


text:
'use strict';

exports.__esModule = true;

var _interleave = require('../utils/interleave');

var _interleave2 = _interopRequireDefault(_interleave);

var _flatten = require('../utils/flatten');

var _flatten2 = _interopRequireDefault(_flatten);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var babelPluginFlowReactPropTypes_proptype_RuleSet = require('../types').babelPluginFlowReactPropTypes_proptype_RuleSet || require('prop-types').any;

var babelPluginFlowReactPropTypes_proptype_Interpolation = require('../types').babelPluginFlowReactPropTypes_proptype_Interpolation || require('prop-types').any;

exports.default = function (strings) {
  for (var _len = arguments.length, interpolations = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    interpolations[_key - 1] = arguments[_key];
  }

  return (0, _flatten2.default)((0, _interleave2.default)(strings, interpolations));
};

module.exports = exports['default'];


text:
from django.conf import settings
from django.test import TestCase
from django.test.utils import override_settings
from ..bower import bower_adapter
import os
import shutil

try:
    TEST_COMPONENTS_ROOT = os.path.join(
        settings.TEST_PROJECT_ROOT, 'bower_components',
    )
except AttributeError:
    TEST_COMPONENTS_ROOT = '/tmp/bower_components/'

@override_settings(BOWER_COMPONENTS_ROOT=TEST_COMPONENTS_ROOT)
class BaseBowerCase(TestCase):
    """Base bower test case"""

    def setUp(self):
        bower_adapter.create_components_root()

    def tearDown(self):
        self._remove_components_root()

    def _remove_components_root(self):
        """Remove components root if exists"""
        if os.path.exists(TEST_COMPONENTS_ROOT):
            shutil.rmtree(TEST_COMPONENTS_ROOT)

    def assertCountEqual(self, *args, **kwargs):
        """Add python 2 support"""
        if hasattr(self, 'assertItemsEqual'):
            return self.assertItemsEqual(*args, **kwargs)
        else:
            return super(BaseBowerCase, self).assertCountEqual(*args, **kwargs)


text:
package it.jaschke.alexandria.data.model;

/**
 * Created by kevinmenager on 14/12/15.
 */
public class Category {

    private String mEan;
    private String mCategory;

    public String getEan() {
        return mEan;
    }

    public void setEan(String ean) {
        mEan = ean;
    }

    public String getCategory() {
        return mCategory;
    }

    public void setCategory(String category) {
        mCategory = category;
    }
}


text:
var document = global.document = require("jsdom").jsdom("");
var window = global.window = document.createWindow();

// https://github.com/chad3814/CSSStyleDeclaration/issues/3
var CSSStyleDeclaration_prototype = window.CSSStyleDeclaration.prototype,
    CSSStyleDeclaration_setProperty = CSSStyleDeclaration_prototype.setProperty;
    CSSStyleDeclaration_prototype.setProperty = function(name, value, priority) {
      return CSSStyleDeclaration_setProperty.call(this, name + "", value == null ? null : value + "", priority == null ? null : priority + "");
      };


text:
// .NAME vtkVPICReader - class for reading VPIC data files
// .SECTION Description
// vtkDataReader is a helper superclass that reads the vtk data file header,
// dataset type, and attribute data (point and cell attributes such as
// scalars, vectors, normals, etc.) from a vtk data file.  See text for
// the format of the various vtk file types.
//
// .SECTION See Also
// vtkPolyDataReader vtkStructuredPointsReader vtkStructuredGridReader
// vtkUnstructuredGridReader vtkRectilinearGridReader

#ifndef vtkVPICReader_h
#define vtkVPICReader_h

#include "vtkIOVPICModule.h" // For export macro
#include "vtkImageAlgorithm.h"

class vtkCallbackCommand;
class vtkDataArraySelection;
class vtkFloatArray;
class vtkStdString;
class vtkMultiProcessController;
class vtkInformation;

class VPICDataSet;
class GridExchange;

class VTKIOVPIC_EXPORT vtkVPICReader : public vtkImageAlgorithm
{
public:
  static vtkVPICReader *New();
  vtkTypeMacro(vtkVPICReader,vtkImageAlgorithm);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Specify file name of VPIC data file to read.
  vtkSetStringMacro(FileName);
  vtkGetStringMacro(FileName);

  // Description:
  // Set the stride in each dimension
  vtkSetVector3Macro(Stride, int);
  vtkGetVector3Macro(Stride, int);

  // Description:
  // Set the simulation file decomposition in each dimension
  vtkSetVector2Macro(XExtent, int);
  vtkSetVector2Macro(YExtent, int);
  vtkSetVector2Macro(ZExtent, int);

  // Get the full layout size in files for setting the range in GUI
  vtkGetVector2Macro(XLayout, int);
  vtkGetVector2Macro(YLayout, int);
  vtkGetVector2Macro(ZLayout, int);

  // Description:
  // Get the reader's output
  vtkImageData *GetOutput();
  vtkImageData *GetOutput(int index);

  // Description:
  // The following methods allow selective reading of solutions fields.
  // By default, ALL data fields on the nodes are read, but this can
  // be modified.
  int GetNumberOfPointArrays();
  const char* GetPointArrayName(int index);
  int GetPointArrayStatus(const char* name);
  void SetPointArrayStatus(const char* name, int status);
  void DisableAllPointArrays();
  void EnableAllPointArrays();

protected:
  vtkVPICReader();
  ~vtkVPICReader();

  char *FileName;                       // First field part file giving path

  int Rank;                             // Number of this processor
  int TotalRank;                        // Number of processors
  int UsedRank;                         // Number of processors used in display

  VPICDataSet* vpicData;                // Data structure controlling access
  GridExchange* exchanger;		// Exchange ghost cells between procs

  vtkIdType NumberOfNodes;              // Number of points in grid
  vtkIdType NumberOfCells;              // Number of cells in grid
  vtkIdType NumberOfTuples;             // Number of tuples in sub extent

  int WholeExtent[6];                   // Problem image extent
  int SubExtent[6];                     // Processor problem extent
  int Dimension[3];                     // Size of image
  int SubDimension[3];                  // Size of subextent of image
  int XLayout[2];                       // Extent in complete files
  int YLayout[2];                       // Extent in complete files
  int ZLayout[2];                       // Extent in complete files

  int NumberOfVariables;                // Number of variables to display
  vtkStdString* VariableName;           // Names of each variable
  int* VariableStruct;                  // Scalar, vector or tensor

  int NumberOfTimeSteps;                // Temporal domain
  double* TimeSteps;                    // Times available for request
  int CurrentTimeStep;                  // Time currently displayed

  int Stride[3];                        // Stride over actual data
  int XExtent[2];                       // Subview extent in files
  int YExtent[2];                       // Subview extent in files
  int ZExtent[2];                       // Subview extent in files

  vtkFloatArray** data;                 // Actual data arrays
  int* dataLoaded;                      // Data is loaded for current time

  int Start[3];                         // Start offset for processor w ghosts
  int GhostDimension[3];                // Dimension including ghosts on proc
  int NumberOfGhostTuples;              // Total ghost cells per component
  int ghostLevel0;                      // Left plane number of ghosts
  int ghostLevel1;                      // Right plane number of ghosts

  // Controls initializing and querrying MPI
  vtkMultiProcessController * MPIController;

  // Selected field of interest
  vtkDataArraySelection* PointDataArraySelection;

  // Observer to modify this object when array selections are modified
  vtkCallbackCommand* SelectionObserver;

  int RequestData(vtkInformation *, vtkInformationVector **,
                  vtkInformationVector *);
  int RequestInformation(vtkInformation *, vtkInformationVector **inVector,
                         vtkInformationVector *);

  void LoadVariableData(int var, int timeStep);
  void LoadComponent(
        float* varData,
        float* block,
        int comp,
        int numberOfComponents);

  static void SelectionCallback(vtkObject* caller, unsigned long eid,
                                void* clientdata, void* calldata);
  static void EventCallback(vtkObject* caller, unsigned long eid,
                                void* clientdata, void* calldata);

private:
  vtkVPICReader(const vtkVPICReader&) VTK_DELETE_FUNCTION;
  void operator=(const vtkVPICReader&) VTK_DELETE_FUNCTION;
};

#endif


text:
static pthread_once_t GSThreadLocalContextOnce = PTHREAD_ONCE_INIT;
static pthread_key_t GSThreadLocalContextKey;

static void GSFreeContextStack(void *queue) {
	GSPurpleQueueRef queueref = (GSPurpleQueueRef)queue;
	while (!GSEventQueueIsEmpty(queueref)) {
		GSEventQueuePopEvent();
	}
	free(queueref);
}

static void GSCreateContextOnceKey() {
	pthread_key_create(&GSThreadLocalContextKey, GSFreeContextStack);
}

GSPurpleQueueRef GSEventQueueGetThreadLocalQueue() {
	pthread_once(&GSThreadLocalContextOnce, GSCreateContextOnceKey);
	GSPurpleQueueRef contexts = pthread_getspecific(GSThreadLocalContextKey);
	if (contexts == NULL) {
		GSPurpleQueueRef queue;

		queue = malloc(sizeof(*queue));
		queue->front = queue->back = NULL;
		pthread_setspecific(GSThreadLocalContextKey, queue);

		return queue;
	}
	return contexts;
}

bool GSEventQueueIsEmpty(GSPurpleQueueRef queue) {
	return (queue == NULL) || (queue->front == NULL);
}

GSEventRef GSEventQueueGetCurrentEvent() {
	GSPurpleQueueRef queue = GSEventQueueGetThreadLocalQueue();
	if (queue->front == NULL) {
		return NULL;
	}
	return queue->front->event;
}

void GSEventQueuePopEvent() {
	GSPurpleQueueRef queue = GSEventQueueGetThreadLocalQueue();
	GSPurpleEventPairRef deadNode = queue->front;

	if (queue->front == NULL) {
		return;
	}

	if (queue->front == queue->back) {
		queue->front = queue->back = NULL;
	} else {
		queue->front = queue->front->next;
	}

	if (deadNode->event != NULL) {
		CFRelease(deadNode->event);
	}
	free(deadNode);
}

void GSEventQueuePushEvent(GSEventRef event) {
	GSPurpleQueueRef queue = GSEventQueueGetThreadLocalQueue();
	GSPurpleEventPairRef pair;

	pair = malloc(sizeof(*pair));
	pair->event = (GSEventRef)CFRetain(event);
	pair->next = NULL;

	if (queue->front == NULL) {
		queue->front = queue->back = pair;
	} else {
		queue->back->next = pair;
		queue->back = pair;
	}
}


text:
import tempfile

import nose
from nose.tools import eq_, assert_true, assert_is_none

import PyQt5
from PyQt5.QtCore import QT_TRANSLATE_NOOP, qVersion, QFile
# import PySide as PyQt5
# from PySide.QtCore import QT_TRANSLATE_NOOP, qVersion, QFile

from qtpythonic import pythonize

def setup():
    pythonize(PyQt5)

def test_qt_module():
    from qtpythonic import core
    # This is not a module, but actually a proxy object. It's not pratical to
    # create proxy classes for all Qt classes at import time (performance
    # issues), so we just proxy them to the real thing the first time they are
    # actually accessed.
    eq_(core.translate_noop, QT_TRANSLATE_NOOP)
    eq_(core.version, qVersion)
    eq_(core.get_version, qVersion)

def test_property():
    from qtpythonic.core import Object
    obj = Object()
    eq_(obj.object_name, '')
    obj.object_name = 'foo'
    eq_(obj.get_object_name(), 'foo')
    obj.set_object_name('bar')
    eq_(obj.object_name, 'bar')

def test_accessors():
    from qtpythonic.core import Object
    parent = Object()
    obj = Object(parent=parent)
    assert_is_none(parent.get_parent())
    eq_(obj.get_parent(), parent)
    obj.set_parent(None)
    assert_is_none(obj.get_parent())

def test_constant_and_method():
    from qtpythonic.core import File
    _, filename = tempfile.mkstemp()
    f = File(filename)
    f.open(f.WRITE_ONLY)
    f.write('foo bar baz')
    f.close()
    with open(filename) as pf:
        eq_(pf.read(), 'foo bar baz')
    f.remove()
    assert_true(type(f), QFile)

def test_returned_object():
    # Objects returned by Qt methods should also be proxied.
    from qtpythonic.core import Object
    level_1 = Object()
    level_1.object_name = '1'
    level_2 = Object(parent=level_1)
    level_2.object_name = '2'
    level_2.get_parent().object_name = '1'
    level_3 = Object(parent=level_2)
    level_3.object_name = '3'
    level_3.get_parent().get_parent().object_name = '1'

if __name__ == '__main__':
    nose.run()


text:
////////////////////////////////////////////////
/*   Provided Code - Please Don't Edit   */
////////////////////////////////////////////////
'use strict';

function getInput() {
    console.log("Please choose either 'rock', 'paper', or 'scissors'.")
    return prompt();
}
function randomPlay() {
    var randomNumber = Math.random();
    if (randomNumber < 0.33) {
        return "rock";
    } else if (randomNumber < 0.66) {
        return "paper";
    } else {
        return "scissors";
    }
}
////////////////////////////////////////////////
/*           Write Your Code Below            */
////////////////////////////////////////////////

function getPlayerMove(move) {
    var move;

    if (move) {
        return move;}
    else {
    return getInput()/* Your Expression */;
    }

}

function getComputerMove(move) {
    var move;

    if (move) {
        return move;}
    else {
    return randomPlay();
    }
}

function getWinner(playerMove,computerMove) {
    var winner;

     if (playerMove == 'rock')
    {
        if (computerMove == 'rock') winner = 'tie';
        else
        {
            if (computerMove == 'paper') winner = 'computer';
            else winner = 'player';
        }
    }
    else
    {
        if (playerMove == 'paper')
        {
            if (computerMove == 'rock') winner = 'player';
            else
            {
                if (computerMove == 'paper') winner = 'tie';
                else winner = 'computer';
            }
        }
        else
        {
            if (computerMove == 'rock') winner = 'computer';
            else
            {
                if (computerMove == 'paper') winner = 'player';
                else winner = 'tie';
            }
        }
    }

    return winner;
}

    switch(playerMove)
    {

        case 'scissors':
            switch(computerMove)
            {
                case 'rock':
                    winner = 'computer';
                    break;
                case 'paper':
                    winner = 'player';
                    break;
                case 'scissors':
                    winner = 'tie';
                    break;
            }
            break;

            case 'paper':
            switch(computerMove)
            {
                case 'rock':
                    winner = 'player';
                    break;
                case 'paper':
                    winner = 'tie';
                    break;
                case 'scissors':
                    winner = 'computer';
                    break;
            }
            break;

            case 'rock':
            switch(computerMove)
            {
                case 'rock':
                    winner = 'tie';
                    break;
                case 'paper':
                    winner = 'computer';
                    break;
                case 'scissors':
                    winner = 'player';
                    break;
            }
            break;
    }

    return winner;
}
}

function playToFive() {
    console.log("Let's play Rock, Paper, Scissors");
    var playerWins = 0;
    var computerWins = 0;
    // Write code that plays 'Rock, Paper, Scissors' until either the player or the computer has won five times.
    /* YOUR CODE HERE */
    return [playerWins, computerWins];
}


text:
001    /* Generated By:JavaCC: Do not edit this line. JJTParserState.java Version 5.0 */
002    package org.apache.commons.jexl2.parser;
003
004    public class JJTParserState {
005      private java.util.List<Node> nodes;
006      private java.util.List<Integer> marks;
007
008      private int sp;        // number of nodes on stack
009      private int mk;        // current mark
010      private boolean node_created;
011
012      public JJTParserState() {
013        nodes = new java.util.ArrayList<Node>();
014        marks = new java.util.ArrayList<Integer>();
015        sp = 0;
016        mk = 0;
017      }
018
019      /* Determines whether the current node was actually closed and
020         pushed.  This should only be called in the final user action of a
021         node scope.  */
022      public boolean nodeCreated() {
023        return node_created;
024      }
025
026      /* Call this to reinitialize the node stack.  It is called
027         automatically by the parser's ReInit() method. */
028      public void reset() {
029        nodes.clear();
030        marks.clear();
031        sp = 0;
032        mk = 0;
033      }
034
035      /* Returns the root node of the AST.  It only makes sense to call
036         this after a successful parse. */
037      public Node rootNode() {
038        return nodes.get(0);
039      }
040
041      /* Pushes a node on to the stack. */
042      public void pushNode(Node n) {
043        nodes.add(n);
044        ++sp;
045      }
046
047      /* Returns the node on the top of the stack, and remove it from the
048         stack.  */
049      public Node popNode() {
050        if (--sp < mk) {
051          mk = marks.remove(marks.size()-1);
052        }
053        return nodes.remove(nodes.size()-1);
054      }
055
056      /* Returns the node currently on the top of the stack. */
057      public Node peekNode() {
058        return nodes.get(nodes.size()-1);
059      }
060
061      /* Returns the number of children on the stack in the current node
062         scope. */
063      public int nodeArity() {
064        return sp - mk;
065      }
066
067
068      public void clearNodeScope(Node n) {
069        while (sp > mk) {
070          popNode();
071        }
072        mk = marks.remove(marks.size()-1);
073      }
074
075
076      public void openNodeScope(Node n) {
077        marks.add(mk);
078        mk = sp;
079        n.jjtOpen();
080      }
081
082
083      /* A definite node is constructed from a specified number of
084         children.  That number of nodes are popped from the stack and
085         made the children of the definite node.  Then the definite node
086         is pushed on to the stack. */
087      public void closeNodeScope(Node n, int num) {
088        mk = marks.remove(marks.size()-1);
089        while (num-- > 0) {
090          Node c = popNode();
091          c.jjtSetParent(n);
092          n.jjtAddChild(c, num);
093        }
094        n.jjtClose();
095        pushNode(n);
096        node_created = true;
097      }
098
099
100      /* A conditional node is constructed if its condition is true.  All
101         the nodes that have been pushed since the node was opened are
102         made children of the conditional node, which is then pushed
103         on to the stack.  If the condition is false the node is not
104         constructed and they are left on the stack. */
105      public void closeNodeScope(Node n, boolean condition) {
106        if (condition) {
107          int a = nodeArity();
108          mk = marks.remove(marks.size()-1);
109          while (a-- > 0) {
110            Node c = popNode();
111            c.jjtSetParent(n);
112            n.jjtAddChild(c, a);
113          }
114          n.jjtClose();
115          pushNode(n);
116          node_created = true;
117        } else {
118          mk = marks.remove(marks.size()-1);
119          node_created = false;
120        }
121      }
122    }
123    /* JavaCC - OriginalChecksum=d179296ec38a912a798a960c2037353b (do not edit this line) */


text:
import sqlalchemy

def upgrade(migrate_engine):
    meta = sqlalchemy.MetaData()
    meta.bind = migrate_engine

    stack_lock = sqlalchemy.Table(
        'stack_lock', meta,
        sqlalchemy.Column('stack_id', sqlalchemy.String(length=36),
                          sqlalchemy.ForeignKey('stack.id'),
                          primary_key=True,
                          nullable=False),
        sqlalchemy.Column('created_at', sqlalchemy.DateTime),
        sqlalchemy.Column('updated_at', sqlalchemy.DateTime),
        sqlalchemy.Column('engine_id', sqlalchemy.String(length=36)),
        mysql_engine='InnoDB',
        mysql_charset='utf8'
    )
    sqlalchemy.Table('stack', meta, autoload=True)
    stack_lock.create()

def downgrade(migrate_engine):
    meta = sqlalchemy.MetaData()
    meta.bind = migrate_engine

    stack_lock = sqlalchemy.Table('stack_lock', meta, autoload=True)
    stack_lock.drop()


text:
/* Slider */
.slick-slider
{
    position: relative;

    display: block;

    -moz-box-sizing: border-box;
         box-sizing: border-box;

    -webkit-user-select: none;
       -moz-user-select: none;
        -ms-user-select: none;
            user-select: none;

    -webkit-touch-callout: none;
    -khtml-user-select: none;
    -ms-touch-action: pan-y;
        touch-action: pan-y;
    -webkit-tap-highlight-color: transparent;
}

.slick-list
{
    position: relative;

    display: block;
    overflow: hidden;

    margin: 0;
    padding: 0;
}
.slick-list:focus
{
    outline: none;
}
.slick-list.dragging
{
    cursor: pointer;
    cursor: hand;
}

.slick-slider .slick-track,
.slick-slider .slick-list
{
    -webkit-transform: translate3d(0, 0, 0);
       -moz-transform: translate3d(0, 0, 0);
        -ms-transform: translate3d(0, 0, 0);
         -o-transform: translate3d(0, 0, 0);
            transform: translate3d(0, 0, 0);
}

.slick-track
{
    position: relative;
    top: 0;
    left: 0;

    display: block;
}
.slick-track:before,
.slick-track:after
{
    display: table;

    content: '';
}
.slick-track:after
{
    clear: both;
}
.slick-loading .slick-track
{
    visibility: hidden;
}

.slick-slide
{
    display: none;
    float: left;

    height: 100%;
    min-height: 1px;
}
[dir='rtl'] .slick-slide
{
    float: right;
}
.slick-slide img
{
    display: block;
}
.slick-slide.slick-loading img
{
    display: none;
}
.slick-slide.dragging img
{
    pointer-events: none;
}
.slick-initialized .slick-slide
{
    display: block;
}
.slick-loading .slick-slide
{
    visibility: hidden;
}
.slick-vertical .slick-slide
{
    display: block;

    height: auto;

    border: 1px solid transparent;
}
.slick-arrow.slick-hidden {
    display: none;
}
.slick-arrow{
    display: none !important;
}


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

<title>org.gradle.play (Gradle API 2.3)</title>
<meta name="keywords" content="org.gradle.play package">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" title="Style">
<link href="../../../groovy.ico" type="image/x-icon" rel="shortcut icon">
<link href="../../../groovy.ico" type="image/x-icon" rel="icon">

Overview

Package

Class

Deprecated

Index

Help

Frames

No Frames

Package org.gradle.play

 Classes that model aspects of the Play Framework support in Gradle.

Interface Summary

                        Interface
                        Description

                                    JvmClasses

                            A set of classes and resources that operate together.

                                    PlayApplicationBinarySpec

                            Represents a binary artifact that is the result of building a play component.

                                    PlayApplicationSpec

                            Definition of a play framework software component that is built by Gradle.

                                    PublicAssets

                            A set of public assets added to a binary.

Overview

Package

Class

Deprecated

Index

Help

Frames

No Frames

Gradle API 2.3


text:
static NSString * const FORMButtonTitleLabelFontKey = @"font";
static NSString * const FORMButtonTitleLabelFontSizeKey = @"font_size";
static NSString * const FORMButtonBorderWidthKey = @"border_width";
static NSString * const FORMButtonCornerRadiusKey = @"corner_radius";
static NSString * const FORMButtonHighlightedTitleColorKey = @"highlighted_title_color";
static NSString * const FORMButtonBorderColorKey = @"border_color";
static NSString * const FORMButtonHighlightedBackgroundColorKey = @"highlighted_background_color";
static NSString * const FORMButtonTitleColorKey = @"title_color";
static NSString * const FORMButtonBackgroundColorKey = @"background_color";

@interface FORMButtonFieldCell ()

@property (nonatomic) UIButton *button;

@end

@implementation FORMButtonFieldCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (!self) return nil;

    [self.contentView addSubview:self.button];
    self.headingLabel.hidden = YES;

    return self;
}

#pragma mark - Getters

- (UIButton *)button {
    if (_button) return _button;

    _button = [UIButton buttonWithType:UIButtonTypeCustom];

    [_button addTarget:self action:@selector(buttonAction) forControlEvents:UIControlEventTouchUpInside];

    return _button;
}

#pragma mark - FORMBaseFormFieldCell

- (void)updateFieldWithDisabled:(BOOL)disabled {
    self.button.alpha = disabled ? 0.5f : 1.0f;
    self.button.enabled = disabled ? NO : YES;
}

- (void)updateWithField:(FORMFields *)field {
    [super updateWithField:field];

    self.button.enabled = !field.disabled;
    self.disabled = field.disabled;
    self.headingLabel.hidden = YES;

    [self.button setTitle:field.title forState:UIControlStateNormal];
}

#pragma mark - Layout

- (void)layoutSubviews {
    [super layoutSubviews];

    self.button.frame = [self buttonFrame];
}

- (CGRect)buttonFrame {
    CGFloat marginX = FORMTextFieldCellMarginX;
    CGFloat marginTop = FORMFieldCellMarginTop;
    CGFloat marginBotton = FORMFieldCellMarginBottom;

    CGFloat width  = CGRectGetWidth(self.frame) - (marginX * 2);
    CGFloat height = CGRectGetHeight(self.frame) - marginTop - marginBotton;
    CGRect  frame  = CGRectMake(marginX, marginTop, width, height);

    return frame;
}

#pragma mark - Actions

- (void)buttonAction {
    if ([self.delegate respondsToSelector:@selector(fieldCell:updatedWithField:)]) {
        [self.delegate fieldCell:self updatedWithField:self.field];
    }
}

#pragma mark - Styling

- (void)setTitleLabelFont:(UIFont *)titleLabelFont {
    NSString *styleFont = [self.field.styles valueForKey:FORMButtonTitleLabelFontKey];
    NSString *styleFontSize = [self.field.styles valueForKey:FORMButtonTitleLabelFontSizeKey];
    if ([styleFont length] > 0) {
        if ([styleFontSize length] > 0) {
            titleLabelFont = [UIFont fontWithName:styleFont size:[styleFontSize floatValue]];
        } else {
            titleLabelFont = [UIFont fontWithName:styleFont size:titleLabelFont.pointSize];
        }
    }
    self.button.titleLabel.font = titleLabelFont;
}

- (void)setBorderWidth:(CGFloat)borderWidth {
    NSString *style = [self.field.styles valueForKey:FORMButtonBorderWidthKey];
    if ([style length] > 0) {
        borderWidth = [style floatValue];
    }
    self.button.layer.borderWidth = borderWidth;
}

- (void)setCornerRadius:(CGFloat)cornerRadius {
    NSString *style = [self.field.styles valueForKey:FORMButtonCornerRadiusKey];
    if ([style length] > 0) {
        cornerRadius = [style floatValue];
    }
    self.button.layer.cornerRadius = cornerRadius;
}

- (void)setHighlightedTitleColor:(UIColor *)highlightedTitleColor {
    NSString *style = [self.field.styles valueForKey:FORMButtonHighlightedTitleColorKey];
    if ([style length] > 0) {
        highlightedTitleColor = [UIColor colorFromHex:style];
    }
    self.button.highlightedTitleColor = highlightedTitleColor;
}

- (void)setBorderColor:(UIColor *)borderColor {
    NSString *style = [self.field.styles valueForKey:FORMButtonBorderColorKey];
    if ([style length] > 0) {
        borderColor = [UIColor colorFromHex:style];
    }
    self.button.layer.borderColor = borderColor.CGColor;
}

- (void)setHighlightedBackgroundColor:(UIColor *)highlightedBackgroundColor {
    NSString *style = [self.field.styles valueForKey:FORMButtonHighlightedBackgroundColorKey];
    if ([style length] > 0) {
        highlightedBackgroundColor = [UIColor colorFromHex:style];
    }
    self.button.highlightedBackgroundColor = highlightedBackgroundColor;
}

- (void)setTitleColor:(UIColor *)titleColor {
    NSString *style = [self.field.styles valueForKey:FORMButtonTitleColorKey];
    if ([style length] > 0) {
        titleColor = [UIColor colorFromHex:style];
    }
    self.button.titleColor = titleColor;
}

- (void)setBackgroundColor:(UIColor *)backgroundColor {
    NSString *style = [self.field.styles valueForKey:FORMButtonBackgroundColorKey];
    if ([style length] > 0) {
        backgroundColor = [UIColor colorFromHex:style];
    }
    self.button.backgroundColor = backgroundColor;
}

@end


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.run.v2.model;

/**
 * Defines a status condition for a resource.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Cloud Run Admin API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class GoogleCloudRunV2Condition extends com.google.api.client.json.GenericJson {

  /**
   * A reason for the execution condition.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String executionReason;

  /**
   * Last time the condition transitioned from one status to another.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private String lastTransitionTime;

  /**
   * Human readable message indicating details about the current status.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String message;

  /**
   * A common (service-level) reason for this condition.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String reason;

  /**
   * A reason for the revision condition.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String revisionReason;

  /**
   * How to interpret failures of this condition, one of Error, Warning, Info
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String severity;

  /**
   * State of the condition.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String state;

  /**
   * type is used to communicate the status of the reconciliation process. See also:
   * https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting
   * Types common to all resources include: * "Ready": True when the Resource is ready.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String type;

  /**
   * A reason for the execution condition.
   * @return value or {@code null} for none
   */
  public java.lang.String getExecutionReason() {
    return executionReason;
  }

  /**
   * A reason for the execution condition.
   * @param executionReason executionReason or {@code null} for none
   */
  public GoogleCloudRunV2Condition setExecutionReason(java.lang.String executionReason) {
    this.executionReason = executionReason;
    return this;
  }

  /**
   * Last time the condition transitioned from one status to another.
   * @return value or {@code null} for none
   */
  public String getLastTransitionTime() {
    return lastTransitionTime;
  }

  /**
   * Last time the condition transitioned from one status to another.
   * @param lastTransitionTime lastTransitionTime or {@code null} for none
   */
  public GoogleCloudRunV2Condition setLastTransitionTime(String lastTransitionTime) {
    this.lastTransitionTime = lastTransitionTime;
    return this;
  }

  /**
   * Human readable message indicating details about the current status.
   * @return value or {@code null} for none
   */
  public java.lang.String getMessage() {
    return message;
  }

  /**
   * Human readable message indicating details about the current status.
   * @param message message or {@code null} for none
   */
  public GoogleCloudRunV2Condition setMessage(java.lang.String message) {
    this.message = message;
    return this;
  }

  /**
   * A common (service-level) reason for this condition.
   * @return value or {@code null} for none
   */
  public java.lang.String getReason() {
    return reason;
  }

  /**
   * A common (service-level) reason for this condition.
   * @param reason reason or {@code null} for none
   */
  public GoogleCloudRunV2Condition setReason(java.lang.String reason) {
    this.reason = reason;
    return this;
  }

  /**
   * A reason for the revision condition.
   * @return value or {@code null} for none
   */
  public java.lang.String getRevisionReason() {
    return revisionReason;
  }

  /**
   * A reason for the revision condition.
   * @param revisionReason revisionReason or {@code null} for none
   */
  public GoogleCloudRunV2Condition setRevisionReason(java.lang.String revisionReason) {
    this.revisionReason = revisionReason;
    return this;
  }

  /**
   * How to interpret failures of this condition, one of Error, Warning, Info
   * @return value or {@code null} for none
   */
  public java.lang.String getSeverity() {
    return severity;
  }

  /**
   * How to interpret failures of this condition, one of Error, Warning, Info
   * @param severity severity or {@code null} for none
   */
  public GoogleCloudRunV2Condition setSeverity(java.lang.String severity) {
    this.severity = severity;
    return this;
  }

  /**
   * State of the condition.
   * @return value or {@code null} for none
   */
  public java.lang.String getState() {
    return state;
  }

  /**
   * State of the condition.
   * @param state state or {@code null} for none
   */
  public GoogleCloudRunV2Condition setState(java.lang.String state) {
    this.state = state;
    return this;
  }

  /**
   * type is used to communicate the status of the reconciliation process. See also:
   * https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting
   * Types common to all resources include: * "Ready": True when the Resource is ready.
   * @return value or {@code null} for none
   */
  public java.lang.String getType() {
    return type;
  }

  /**
   * type is used to communicate the status of the reconciliation process. See also:
   * https://github.com/knative/serving/blob/main/docs/spec/errors.md#error-conditions-and-reporting
   * Types common to all resources include: * "Ready": True when the Resource is ready.
   * @param type type or {@code null} for none
   */
  public GoogleCloudRunV2Condition setType(java.lang.String type) {
    this.type = type;
    return this;
  }

  @Override
  public GoogleCloudRunV2Condition set(String fieldName, Object value) {
    return (GoogleCloudRunV2Condition) super.set(fieldName, value);
  }

  @Override
  public GoogleCloudRunV2Condition clone() {
    return (GoogleCloudRunV2Condition) super.clone();
  }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
  <groupId>com.boundary</groupId>
  <artifactId>java-plugin-sdk</artifactId>
  <version>0.6.2</version>
  <versioning>
    <versions>
      <version>0.6.2</version>
    </versions>
    <lastUpdated>20151001202448</lastUpdated>
  </versioning>
</metadata>