text:
<?php

namespace NatureQuizzer\Presenters;

use NatureQuizzer\Database\Model\Answer;
use NatureQuizzer\Database\Model\Model;
use NatureQuizzer\Database\Model\Organism;
use NatureQuizzer\Database\Model\Round;
use NatureQuizzer\Database\Utils\LanguageLookup;
use NatureQuizzer\Utils\Helpers;
use Nette\Application\UI\Form;
use Nette\Forms\Form as BasicForm;
use Nette\Utils\DateTime;
use Nette\Utils\Validators;

class DiagnosticPresenter extends BasePresenter
{
	protected $resource = 'content';

	/** @persistent */
	public $selectedModel = NULL;

	/** @var Round */
	private $round;
	/** @var Answer */
	private $answer;
	/** @var LanguageLookup */
	private $languageLookup;
	/** @var Model */
	private $model;
	/** @var Organism */
	private $organism;

	public function injectBase(Round $round, Answer $answer, LanguageLookup $languageLookup, Model $model, Organism $organism)
	{
		$this->round = $round;
		$this->answer = $answer;
		$this->languageLookup = $languageLookup;
		$this->model = $model;
		$this->organism = $organism;
	}

	public function startup()
	{
		$this->perm();
		parent::startup();
	}

	public function actionDefault()
	{
		$range = Helpers::getDatePeriod(DateTime::from('-14 days'), DateTime::from('tomorrow'));
		$this->template->range = $range;

		$this->template->globalStats = $this->organism->getGlobalStats();
		$this->template->roundStats = $this->round->getStats();
		$this->template->organismDistribution = $this->answer->getOrganismDistribution($this->languageLookup->getId(AdminPresenter::LANG), $this->selectedModel);
		$this->template->userStats = $this->round->getUserStats();
		$this->template->answerStats = $this->answer->getStats();
	}

	public function createComponentModelSelection()
	{
		$form = new Form();
		$form->addSelect('model', 'Model', $this->model->getPairs())->setPrompt('Select model')->setDefaultValue($this->selectedModel);
		$form->addSubmit('submitted', 'Select');
		$form->onSubmit[] = function(BasicForm $form) {
			$values = $form->getValues();
			$this->selectedModel = $values['model'];
			$this->redirect('this');
		};
		return $form;
	}

	public function createComponentRepresentationSearch()
	{
		$form = new Form();
		$form->addText('query', 'To search');
		$form->addSubmit('submitted', 'Search');
		$form->onSubmit[] = function(BasicForm $form) {
			$values = $form->getValues();
			$temp = trim(str_replace('[', '', str_replace(']', '', $values['query'])));
			$temp = explode(' ', $temp);
			$temp = array_filter($temp, function ($value) { return Validators::isNumericInt($value); });
			if (is_array($temp) && count($temp) > 0 && reset($temp) != '') {
				$this->template->queryResult = $this->organism->getRepresentationsByIds($temp);
			}
		};
		return $form;
	}

	public function createComponentOrganismSearch()
	{
		$form = new Form();
		$form->addText('query', 'To search');
		$form->addSubmit('submitted', 'Search');
		$form->onSubmit[] = function(BasicForm $form) {
			$values = $form->getValues();
			$temp = trim(str_replace('[', '', str_replace(']', '', $values['query'])));
			$temp = explode(' ', $temp);
			$temp = array_filter($temp, function ($value) { return Validators::isNumericInt($value); });
			if (is_array($temp) && count($temp) > 0 && reset($temp) != '') {
				$this->template->queryResult = $this->organism->getRepresentationsWithInfoByOrganisms($this->languageLookup->getId(AdminPresenter::LANG), $temp);
			}
		};
		return $form;
	}

}


text:
package ac.at.tuwien.infosys.visp.runtime.restAPI;

import java.util.List;

import ac.at.tuwien.infosys.visp.common.operators.Operator;
import ac.at.tuwien.infosys.visp.runtime.configuration.Configurationprovider;
import ac.at.tuwien.infosys.visp.runtime.reasoner.ReasonerUtility;
import ac.at.tuwien.infosys.visp.runtime.resourceManagement.ProcessingNodeManagement;
import ac.at.tuwien.infosys.visp.runtime.topology.TopologyManagement;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.DependsOn;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/control")
@RestController
@DependsOn("configurationprovider")
public class ScalingAPI {

    @Autowired
    private TopologyManagement topologyMgmt;

    @Autowired
    private Configurationprovider config;

    @Autowired
    private ProcessingNodeManagement pcm;

    @Autowired
    private ReasonerUtility reasonerUtility;

    @RequestMapping(value = {"/scaleup/{operatorName}"}, method = RequestMethod.GET)
    public String scaleup(@PathVariable String operatorName) {

        List<Operator> operators = topologyMgmt.getOperatorsForAConcreteLocation(config.getRuntimeIP());

        Operator selectedOperator = null;

        for (Operator op : operators) {
            if (operatorName.equals(op.getName())) {
                selectedOperator = op;
                break;
            }
        }

        if (selectedOperator == null) {
            return "no operator with that name exists.";
        }

        pcm.scaleup(reasonerUtility.selectSuitableDockerHost(selectedOperator), selectedOperator);

        return "ok";
    }

}

redpajama_set_name: RedPajamaGithub


text:
ember-responsive-demo
=====================

A demo of the Ember CLI addon `ember-responsive`.

You can visit the demo app directly here: https://www.justinbull.ca/ember-responsive-demo/

This README outlines the details of running on this Ember application locally.

Files of Interest
-----------------

* `app/views/application.js` - How to bind breakpoint to class names
* `app/controllers/index.js` - How to use `ember-responsive` in controllers
* `app/templates/index.hbs` - How to use `ember-responsive` in templates

Prerequisites
-------------

You will need the following things properly installed on your computer.

* [Git](http://git-scm.com/)
* [Node.js](http://nodejs.org/) (with NPM) and [Bower](http://bower.io/)

Installation
------------

* `git clone <repository-url>` this repository
* change into the new directory
* `npm install`
* `bower install`

Running / Development
---------------------

* `ember server`
* Visit your app at http://localhost:4200.

Further Reading / Useful Links
---------------------------------

* ember: http://emberjs.com/
* ember-cli: http://www.ember-cli.com/
* Development Browser Extensions
  * [ember inspector for chrome](https://chrome.google.com/webstore/detail/ember-inspector/bmdblncegkenkacieihfhpjfppoconhi)
  * [ember inspector for firefox](https://addons.mozilla.org/en-US/firefox/addon/ember-inspector/)


text:
layout: post
title: Getting GraphQL to play nicely with Parse Server and React Native
author: philip
share: true
comments: true
modified:
categories:
excerpt:
tags:
- graphql
- parse
- parse server
- react native
image:
  feature:
date: 2016-07-20T17:21:37+01:00
---
This is a long overdue writeup on our experience setting up GraphQL and Parse Server together for the [React Native TodoMVC project](http://blog.thebakery.io/todomvc-with-react-native-and-redux/).

## TL;DR

We've released two packages to make using authenticated GraphQL queries with Parse easier: [Parse GraphQL Client](https://github.com/thebakeryio/parse-graphql-client) and [Parse GraphQL Server](https://github.com/thebakeryio/parse-graphql-server). You can see both of them in action in [TodoMVC for React Native](https://github.com/thebakeryio/todomvc-react-native).

## Setting it up

If you have been using Parse, you probably know that it uses [object level security](https://parse.com/docs/js/guide#security-object-level-access-control) based on ACL (Access Control Lists). Enforcing these constraints in queries is done by passing user's session token along. For example:

<script src="https://gist.github.com/callmephilip/7f1b6225d2f0705951f8ad15cf4e35ed.js"></script>

In order to make your GraphQL resolvers aware of these constraints, a few things need to happen.

### Getting authorization information from the client

Regardless of what GraphQL client you are using, you will have to pass authorization information (session token in our case) along with your GraphQL query/mutation. Assuming you put Parse session token inside 'Authorization' header of the request, your server code will look as follows (using [Express GraphQL](https://github.com/graphql/express-graphql)):

<script src="https://gist.github.com/callmephilip/4c73fb95543ad88ea25ca6d329fd5bf9.js"></script>

### Setting up resolvers

Once this is in place, resolvers in your schema will have access to a context variable (which in our case points to a session token):

<script src="https://gist.github.com/callmephilip/5eaece7d7183cda5d4b39fc3825c4176.js"></script>

### Rinse and repeat

Any new resolver you will be writing, will have to systematically refer to the **sessionToken** and pass it along to various methods in Parse.Query and Parse.Object (and child classes). Needless to say, this is error prone and somewhat excessive.

## Suggested solution

[Parse GraphQL Client](https://github.com/thebakeryio/parse-graphql-client) and [Parse GraphQL Server](https://github.com/thebakeryio/parse-graphql-server) take care of passing session tokens all the way from your client to the server and configuring Parse to use them in all the queries and updates/deletes.

### Client side

Here is how you issue a GraphQL query with Parse session information attached to it in your React Native app:

<script src="https://gist.github.com/callmephilip/f74459f404fa7cb1c46a2ade67dcc279.js"></script>

### Server side

First of all, you will need to register Parse GraphQL server with your Express app instance.

<script src="https://gist.github.com/callmephilip/e84b8203e06af1da269b25634fb355bb.js"></script>

And now your resolvers will look as follows:

<script src="https://gist.github.com/callmephilip/466df8278f6082fb4af9759acefd56a0.js"></script>

Notice how resolver context already contains current user and a configured Query class based on Parse.Query. For a complete example of Todo resolver refer to [TodoMVC for React Native](https://github.com/thebakeryio/todomvc-react-native/blob/master/server/models/todo.js).

### Done!

All your queries and mutations arrive to the server with corresponding session information attached to them and all your resolvers automatically propagate it to Parse using Query class from the context.

## Credits

Parse GraphQL client is based on [Lokka GraphQL client](https://github.com/kadirahq/lokka) from folks at [Kadira](https://kadira.io/). Parse GraphQL server sits on top Lee Byron's [Express GraphQL](https://github.com/graphql/express-graphql).


text:
(function(mod) {
  if (typeof exports == 'object' && typeof module == 'object') // CommonJS
    mod(require('../../lib/codemirror'));
  else if (typeof define == 'function' && define.amd) // AMD
    define(['../../lib/codemirror'], mod);
  else // Plain browser env
    mod(CodeMirror);
})(function(CodeMirror) {
  'use strict';
  var GUTTER_ID = 'CodeMirror-lint-markers';
  var SEVERITIES = /^(?:error|warning)$/;

  function showTooltip(e, content) {
    var tt = document.createElement('div');
    tt.className = 'CodeMirror-lint-tooltip';
    tt.appendChild(content.cloneNode(true));
    document.body.appendChild(tt);

    function position(e) {
      if (!tt.parentNode) return CodeMirror.off(document, 'mousemove', position);
      tt.style.top = Math.max(0, e.clientY - tt.offsetHeight - 5) + 'px';
      tt.style.left = (e.clientX + 5) + 'px';
    }
    CodeMirror.on(document, 'mousemove', position);
    position(e);
    if (tt.style.opacity != null) tt.style.opacity = 1;
    return tt;
  }
  function rm(elt) {
    if (elt.parentNode) elt.parentNode.removeChild(elt);
  }
  function hideTooltip(tt) {
    if (!tt.parentNode) return;
    if (tt.style.opacity == null) rm(tt);
    tt.style.opacity = 0;
    setTimeout(function() { rm(tt); }, 600);
  }

  function showTooltipFor(e, content, node) {
    var tooltip = showTooltip(e, content);
    function hide() {
      CodeMirror.off(node, 'mouseout', hide);
      if (tooltip) { hideTooltip(tooltip); tooltip = null; }
    }
    var poll = setInterval(function() {
      if (tooltip) for (var n = node;; n = n.parentNode) {
        if (n == document.body) return;
        if (!n) { hide(); break; }
      }
      if (!tooltip) return clearInterval(poll);
    }, 400);
    CodeMirror.on(node, 'mouseout', hide);
  }

  function LintState(cm, options, hasGutter) {
    this.lineWidgets = [];
    this.marked = [];
    this.options = options;
    this.timeout = null;
    this.hasGutter = hasGutter;
    this.onMouseOver = function(e) { onMouseOver(cm, e); };
  }

  function parseOptions(cm, options) {
    if (options instanceof Function) return {getAnnotations: options};
    if (!options || options === true) options = {};
    if (!options.getAnnotations) options.getAnnotations = cm.getHelper(CodeMirror.Pos(0, 0), 'lint');
    if (!options.getAnnotations && cm.getOption('mode') === 'htmlmixed') {
      options.getAnnotations = CodeMirror.helpers.lint.htmlmixed;
    }
    if (!options.getAnnotations && cm.getOption('mode') === 'coffeescript') {
      options.getAnnotations = CodeMirror.helpers.lint.coffeescript;
    }
    // if (!options.getAnnotations) throw new Error('Required option "getAnnotations" missing (lint addon)');
    if (!options.getAnnotations) {
      options.getAnnotations = function() { return []; };
    }
    return options;
  }

  function underClear(cm) {
    var state = cm.state.lint;
    for (var i = 0; i < state.marked.length; ++i)
      state.marked[i].clear();
    state.marked.length = 0;
  }

  function gutterMarkerDraw(labels, severity, multiple, tooltip) {
    var marker = document.createElement('div'), inner = marker;
    marker.className = 'CodeMirror-lint-marker-' + severity;
    if (multiple) {
      inner = marker.appendChild(document.createElement('div'));
      inner.className = 'CodeMirror-lint-marker-multiple';
    }

    if (tooltip) {
      CodeMirror.on(inner, 'mouseover', function(e) {
        showTooltipFor(e, labels, inner);
      });
    }

    return marker;
  }

  function getMaxSeverity(a, b) {
    if (a == 'error') return a;
    else return b;
  }

  function groupByLine(annotations) {
    var lines = [];
    for (var i = 0; i < annotations.length; ++i) {
      var ann = annotations[i], line = ann.from.line;
      (lines[line] || (lines[line] = [])).push(ann);
    }
    return lines;
  }

  function annotationTooltip(ann, severity) {
    var tip = document.createElement('div');
    tip.className = 'CodeMirror-lint-message-' + severity;
    tip.appendChild(document.createTextNode(ann.message));
    return tip;
  }

  function gutterDraw(line, tipLabel, maxSeverity, anns, state, cm) {
    cm.setGutterMarker(line, GUTTER_ID, gutterMarkerDraw(tipLabel, maxSeverity, anns.length > 1, cm.options.lintOpt.tooltip));
  }

  function gutterReset(cm) {
    cm.clearGutter(GUTTER_ID);
  }

  function underDraw(ann, severity, state, cm) {
    state.marked.push(cm.markText(ann.from, ann.to, {
      className: 'CodeMirror-lint-mark-' + severity,
      __annotation: ann
    }));
  }

  function consoleInit(cm) {
    var wrapper = document.createElement('details');
    var head = document.createElement('summary');
    var logs = document.createElement('div');
    wrapper.className = 'console-wrapper';
    head.className = 'console-log-head';
    logs.className = 'console-log';
    wrapper.appendChild(head);
    wrapper.appendChild(logs);
    cm.consolelint = {
      wrapper: wrapper,
      logs: logs,
      head: head,
      error: 0,
      warning: 0
    };
    cm.options.lintOpt.consoleParent.appendChild(wrapper);
    CodeMirror.on(logs, 'click', function(event) {
      consoleClick(event, cm);
    });
  }

  function consoleLine(ann, severity, cm) {
    cm.consolelint[severity]++;
    var line = document.createElement('div');
    line.className = 'console-log-line lint-icon-' + severity;
    line.setAttribute('data-ch', ann.from.ch);
    line.setAttribute('data-line', ann.from.line);
    line.setAttribute('data-reason', ann.message);
    line.appendChild(document.createTextNode('Line ' + (ann.from.line + 1) + ': ' + ann.message));
    return line;
  }

  function consoleReset(cm) {
    cm.consolelint.error = 0;
    cm.consolelint.warning = 0;
    cm.consolelint.logs.innerHTML = '';
  }

  function consoleHeadUpdate(cm) {
    var counterEclass = '';
    var counterWclass = '';
    var es = 's';
    var ws = 's';
    if (cm.consolelint.error === 0) counterEclass = ' dis';
    if (cm.consolelint.warning === 0) counterWclass = ' dis';
    if (cm.consolelint.error === 1) es = '';
    if (cm.consolelint.warning === 1) ws = '';
    cm.consolelint.head.innerHTML = '';
    if (counterEclass && counterWclass) {
      cm.consolelint.head.style.display = 'none';
      cm.consolelint.logs.style.display = 'none';
      $document.trigger('sizeeditors');
      return;
    }
    cm.consolelint.head.style.display = '';
    cm.consolelint.logs.style.display = '';
    if (!counterEclass) {
      cm.consolelint.head.innerHTML += ' ' +
        cm.consolelint.error + ' error' + es + ' ';
    }
    if (!counterWclass) {
      cm.consolelint.head.innerHTML += ' ' +
      cm.consolelint.warning + ' warning' + ws;
    }
    $document.trigger('sizeeditors');
  }

  function consoleClick(event, cm) {
    var target = event.target;
    if (target.className.indexOf('console-log-line') !== -1) {
      var ch = target.getAttribute('data-ch') * 1;
      var line = target.getAttribute('data-line') * 1;
      var reason = target.getAttribute('data-reason');
      var lineHeight = cm.defaultTextHeight();
      cm.setCursor({ line: line, ch: ch });
      cm.scrollIntoView(null, lineHeight * 3);
      cm.focus();

      var old = document.getElementById('console-log-line-selected');
      if (old) {
        old.id = '';
      }
      target.id = 'console-log-line-selected';

      if (cm.options.lintOpt.line) {
        lineUpdate({ reason: reason, line: line }, cm);
      }
    }
  }

  function lineUpdate(ann, cm) {
    lineReset(cm);
    var msg = document.createElement('div');
    msg.appendChild(document.createTextNode(ann.reason));
    msg.className = 'lint-error';
    cm.state.lint.lineWidgets.push(cm.addLineWidget(ann.line * 1, msg, { coverGutter: false, noHScroll: true }));
  }

  function lineReset(cm) {
    var lineWidgets = cm.state.lint.lineWidgets;
    for (var i = 0; i < lineWidgets.length; ++i) {
      cm.removeLineWidget(lineWidgets[i]);
    }
    lineWidgets.length = 0;
  }

  function startLinting(cm) {
    var state = cm.state.lint, options = state.options;
    if (options.async)
      options.getAnnotations(cm, updateLinting, cm.options.lintRules);
    else
      updateLinting(cm, options.getAnnotations(cm.getValue(), cm.options.lintRules));
  }

  function updateLinting(cm, annotationsNotSorted) {
    var state = cm.state.lint, options = state.options;

    cm.state.lint.annotations = annotationsNotSorted;

    if (cm.options.lintOpt.under) {
      underClear(cm);
    }

    if (state.hasGutter) {
      gutterReset(cm);
    }

    var annotations = groupByLine(annotationsNotSorted);

    if (cm.options.lintOpt.console) {
      consoleReset(cm);
      if (cm.options.lintOpt.line) {
        lineReset(cm);
      }
    }

    for (var line = 0; line < annotations.length; ++line) {
      var anns = annotations[line];
      if (!anns) continue;

      var maxSeverity = null;
      var tipLabel = state.hasGutter && document.createDocumentFragment();

      for (var i = 0; i < anns.length; ++i) {
        var ann = anns[i];
        var severity = ann.severity;
        if (!SEVERITIES.test(severity)) severity = 'error';
        maxSeverity = getMaxSeverity(maxSeverity, severity);

        if (options.formatAnnotation) ann = options.formatAnnotation(ann);

        if (state.hasGutter) {
          tipLabel.appendChild(annotationTooltip(ann, severity));
        }

        if (cm.options.lintOpt.console) {
          cm.consolelint.logs.appendChild(consoleLine(ann, severity, cm));
        }

        if (cm.options.lintOpt.under) {
          if (ann.to) {
            underDraw(ann, severity, state, cm);
          }
        }
      }

      if (state.hasGutter) {
        gutterDraw(line, tipLabel, maxSeverity, anns, state, cm);
      }
    }
    if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm);

    if (cm.options.lintOpt.console) {
      consoleHeadUpdate(cm);
    }
  }

  function onChange(cm) {
    var state = cm.state.lint;
    clearTimeout(state.timeout);
    state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay || 500);
  }

  function popupSpanTooltip(ann, e) {
    var target = e.target || e.srcElement;
    showTooltipFor(e, annotationTooltip(ann), target);
  }

  // When the mouseover fires, the cursor might not actually be over
  // the character itself yet. These pairs of x,y offsets are used to
  // probe a few nearby points when no suitable marked range is found.
  var nearby = [0, 0, 0, 5, 0, -5, 5, 0, -5, 0];

  function onMouseOver(cm, e) {
    if (!/\bCodeMirror-lint-mark-/.test((e.target || e.srcElement).className)) return;
    for (var i = 0; i < nearby.length; i += 2) {
      var spans = cm.findMarksAt(cm.coordsChar({left: e.clientX + nearby[i],
                                                top: e.clientY + nearby[i + 1]}, 'client'));
      for (var j = 0; j < spans.length; ++j) {
        var span = spans[j], ann = span.__annotation;
        if (ann) return popupSpanTooltip(ann, e);
      }
    }
  }

  function lintStop(cm) {
    lineReset(cm);
    cm.setOption('lint', false);
    var opt = cm.getOption('lintOpt');
    if (opt.gutter) {
      var gutters = cm.getOption('gutters');
      var pos = gutters.indexOf('CodeMirror-lint-markers');
      if (pos !== -1) {
        gutters.splice(pos, 1);
        cm.setOption('gutters', gutters);
        var ln = cm.getOption('lineNumbers');
        cm.setOption('lineNumbers', !ln);
        cm.setOption('lineNumbers', ln);
      }
    }
    if (opt.console) {
      opt.consoleParent.removeChild(cm.consolelint.wrapper);
      $document.trigger('sizeeditors');
    }
    cm.refresh();
  }

  CodeMirror.defineOption('lint', false, function(cm, val, old) {
    var defaults = {
      console: true,
      consoleParent: cm.getWrapperElement().parentNode,
      line: true,
      under: true,
      tooltip: true
    };
    if (!cm.options.lintOpt) {
      cm.options.lintOpt = {};
    }
    for (var key in defaults) {
      if (defaults.hasOwnProperty(key)) {
        cm.options.lintOpt[key] = (cm.options.lintOpt[key] !== undefined) ? cm.options.lintOpt[key] : defaults[key];
      }
    }

    if (!cm.options.lintRules) {
      cm.options.lintRules = {};
    }

    if (old && old != CodeMirror.Init) {
      if (cm.options.lintOpt.under) {
        underClear(cm);
      }

      if (cm.state.lint.hasGutter) {
        gutterReset(cm);
      }

      cm.off('change', onChange);
      CodeMirror.off(cm.getWrapperElement(), 'mouseover', cm.state.lint.onMouseOver);
      delete cm.state.lint;
    }

    if (val) {
      var gutters = cm.getOption('gutters'), hasLintGutter = false;
      for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true;
      var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter);
      cm.on('change', onChange);

      if (cm.options.lintOpt.console) {
        consoleInit(cm);
      }

      if (cm.options.lintOpt.tooltip)
        CodeMirror.on(cm.getWrapperElement(), 'mouseover', state.onMouseOver);

      startLinting(cm);

      cm.lintStop = function() {
        return lintStop(this);
      };
    }

    // probably to improve according to real case scenarios
    cm.updateLinting = function(annotationsNotSorted) {
      updateLinting(cm, annotationsNotSorted);
    };
  });
});


text:
package monasca.statsd;

import java.util.Map;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingDeque;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;

/**
 *
 * A simple StatsD client implementation facilitating event reporting.
 *
 *
Upon instantiation, this client will establish a socket connection to a StatsD instance
 * running on the specified host and port. Events are then sent over this connection as they are
 * received by the client.
 *

 *
 *
Six key methods are provided for the submission of events for the application under
 * scrutiny:
 *

 *
{@link #event(String, String)} - inherited from base class {@link BlockingStatsDEventClient}

 *
{@link #event(String, String, AlertType)} - inherited from base class {@link BlockingStatsDEventClient}

 *
{@link #event(String, String, long)} - inherited from base class {@link BlockingStatsDEventClient}

 *
{@link #event(String, String, Priority)} - inherited from base class {@link BlockingStatsDEventClient}

 *
{@link #event(String, String, String...)} - inherited from base class {@link BlockingStatsDEventClient}

 *
{@link #event(String, String, long, String, Priority, String, AlertType, String...)} - overriding from base class {@link BlockingStatsDEventClient} and converting it to non-blocking

 *

 * From the perspective of the application, these methods are non-blocking, with the resulting
 * IO operations being carried out in a separate thread. Furthermore, these methods are guaranteed
 * not to throw an exception which may disrupt application execution.
 *

 *
 *
As part of a clean system shutdown, the {@link #stop()} method should be invoked
 * on any StatsD clients.

 *
 */
public final class NonBlockingStatsDEventClient extends BlockingStatsDEventClient {

    private static final StatsDClientErrorHandler NO_OP_HANDLER = new StatsDClientErrorHandler() {
        @Override public void handle(Exception e) { /* No-op */ }
    };

    private final ExecutorService executor = Executors.newSingleThreadExecutor(new ThreadFactory() {
        final ThreadFactory delegate = Executors.defaultThreadFactory();
        @Override public Thread newThread(Runnable r) {
            Thread result = delegate.newThread(r);
            result.setName("StatsD-" + result.getName());
            return result;
        }
    });

    private final BlockingQueue<EventMessage> blockingQueue = new LinkedBlockingDeque<EventMessage>();

    /**
     * Create a new StatsD client communicating with a StatsD instance on the
     * specified host and port. All messages send via this client will have
     * their keys prefixed with the specified string. The new client will
     * attempt to open a connection to the StatsD server immediately upon
     * instantiation, and may throw an exception if that a connection cannot
     * be established. Once a client has been instantiated in this way, all
     * exceptions thrown during subsequent usage are consumed, guaranteeing
     * that failures in metrics will not affect normal code execution.
     *
     * @param prefix
     *     the prefix to apply to keys sent via this client
     * @param hostname
     *     the host name of the targeted StatsD server
     * @param port
     *     the port of the targeted StatsD server
     * @throws StatsDClientException
     *     if the client could not be started
     */
    public NonBlockingStatsDEventClient(String prefix, String hostname, int port) throws StatsDClientException {
        this(prefix, hostname, port, null, NO_OP_HANDLER);
    }

    /**
     * Create a new StatsD client communicating with a StatsD instance on the
     * specified host and port. All messages send via this client will have
     * their keys prefixed with the specified string. The new client will
     * attempt to open a connection to the StatsD server immediately upon
     * instantiation, and may throw an exception if that a connection cannot
     * be established. Once a client has been instantiated in this way, all
     * exceptions thrown during subsequent usage are consumed, guaranteeing
     * that failures in metrics will not affect normal code execution.
     *
     * @param prefix
     *     the prefix to apply to keys sent via this client
     * @param hostname
     *     the host name of the targeted StatsD server
     * @param port
     *     the port of the targeted StatsD server
     * @param defaultDimensions
     *     dimensions to be added to all content sent
     * @throws StatsDClientException
     *     if the client could not be started
     */
    public NonBlockingStatsDEventClient(String prefix, String hostname, int port, Map<String, String> defaultDimensions) throws StatsDClientException {
        this(prefix, hostname, port, defaultDimensions, NO_OP_HANDLER);
    }

    /**
     * Create a new StatsD client communicating with a StatsD instance on the
     * specified host and port. All messages send via this client will have
     * their keys prefixed with the specified string. The new client will
     * attempt to open a connection to the StatsD server immediately upon
     * instantiation, and may throw an exception if that a connection cannot
     * be established. Once a client has been instantiated in this way, all
     * exceptions thrown during subsequent usage are passed to the specified
     * handler and then consumed, guaranteeing that failures in metrics will
     * not affect normal code execution.
     *
     * @param prefix
     *     the prefix to apply to keys sent via this client
     * @param hostname
     *     the host name of the targeted StatsD server
     * @param port
     *     the port of the targeted StatsD server
     * @param defaultDimensions
     *     a map of dimensions to be added to all metrics sent
     * @param errorHandler
     *     handler to use when an exception occurs during usage
     * @throws StatsDClientException
     *     if the client could not be started
     */
    public NonBlockingStatsDEventClient(String prefix, String hostname, int port, Map<String, String> defaultDimensions, StatsDClientErrorHandler errorHandler) throws StatsDClientException {
        super(prefix, hostname, port, defaultDimensions, errorHandler);
        executor.execute(new Runnable() {

			@Override
			public void run() {
				while (!executor.isShutdown()) {
					try {
						EventMessage eMsg = blockingQueue.poll(1, TimeUnit.SECONDS);
						if (eMsg != null) {
							blockingSend(
								prepareMessage(
										eMsg.getTitle(), eMsg.getMessage(),
										eMsg.getDateHappened(), eMsg.getAggregationKey(),
										eMsg.getPriority(), eMsg.getSourceTypeName(),
										eMsg.getAlterType(), eMsg.getDimensions()));
						}
					} catch (Exception e) {
						handler.handle(e);
					}
				}
			}
		});
    }

    /**
     * Cleanly shut down this StatsD client. This method may throw an exception if
     * the socket cannot be closed.
     */
    @Override
    public void stop() {
         try {
             executor.shutdown();
             executor.awaitTermination(30, TimeUnit.SECONDS);
         }
         catch (Exception e) {
             handler.handle(e);
         }
         finally {
             super.stop();
         }
    }

    /**
     *
     * Reports an event to the monasca agent (non-blocking)
     *
     * @param title
     * @param message
     * @param dateHappened
     * @param aggregationKey
     * @param priority
     * @param sourceTypeName
     * @param alterType
     * @param tags -> Each item in this array should in the format key:value
     */
    @Override
    public boolean event(final String title, final String message, final long dateHappened, final String aggregationKey,
    		final Priority priority, final String sourceTypeName, final AlertType alterType, Map<String, String> dimensions) {
        	if (title != null && message != null) {
        		final EventMessage eMsg = new EventMessage(title, message);
        		eMsg.setDateHappened(dateHappened);
        		eMsg.setAggregationKey(aggregationKey);
        		eMsg.setAlterType(alterType);
        		eMsg.setPriority(priority);
        		eMsg.setSourceTypeName(sourceTypeName);
        		eMsg.setDimensions(dimensions);
        		blockingQueue.offer(eMsg);
        	}

        	return true;
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--

 -->

<resources xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
    <string name="application_name" msgid="5181331383435256801">"Nii Launcher"</string>
    <string name="home" msgid="7658288663002113681">"Ekran główny"</string>
    <string name="uid_name" msgid="7820867637514617527">"Główne aplikacje Androida"</string>
    <string name="folder_name" msgid="7371454440695724752"></string>
    <string name="wallpaper_instructions" msgid="563973358787555519">"Ustaw tapetę"</string>
  <plurals name="number_of_items_selected">
    <item quantity="zero" msgid="7464587177007785408">"Wybrane: %1$d"</item>
    <item quantity="one" msgid="142482526010824029">"Wybrane: %1$d"</item>
    <item quantity="other" msgid="1418352074806573570">"Wybrane: %1$d"</item>
  </plurals>
    <string name="wallpaper_accessibility_name" msgid="1655953108132967972">"Tapeta %1$d z %2$d"</string>
    <string name="announce_selection" msgid="8338254712932127413">"Wybrano <xliff:g id="LABEL">%1$s</xliff:g>"</string>
    <string name="wallpaper_delete" msgid="8095005658756613921">"Usuń"</string>
    <string name="pick_image" msgid="1272073934062909527">"Wybierz obraz"</string>
    <string name="pick_wallpaper" msgid="8179698221502010609">"Tapety"</string>
    <string name="crop_wallpaper" msgid="8334345984491368009">"Przytnij tapetę"</string>
    <string name="activity_not_found" msgid="8071924732094499514">"Aplikacja nie jest zainstalowana."</string>
    <string name="widgets_tab_label" msgid="2921133187116603919">"Widżety"</string>
    <string name="widget_adder" msgid="3201040140710381657">"Widżety"</string>
    <string name="toggle_weight_watcher" msgid="5645299835184636119">"Pokaż pamięć"</string>
    <string name="long_press_widget_to_add" msgid="7699152356777458215">"Aby dodać widżet, kliknij go i przytrzymaj."</string>
    <string name="market" msgid="2619650989819296998">"Sklep"</string>
    <string name="widget_dims_format" msgid="2370757736025621599">"%1$d × %2$d"</string>
    <string name="external_drop_widget_error" msgid="3165821058322217155">"Nie można upuścić elementu na tym ekranie głównym."</string>
    <string name="external_drop_widget_pick_title" msgid="3486317258037690630">"Wybierz widżet, który chcesz dodać"</string>
    <string name="rename_folder_label" msgid="3727762225964550653">"Nazwa folderu"</string>
    <string name="rename_folder_title" msgid="3771389277707820891">"Zmień nazwę folderu"</string>
    <string name="rename_action" msgid="5559600076028658757">"OK"</string>
    <string name="cancel_action" msgid="7009134900002915310">"Anuluj"</string>
    <string name="menu_item_add_item" msgid="1264911265836810421">"Dodaj do ekranu głównego"</string>
    <string name="group_applications" msgid="3797214114206693605">"Aplikacje"</string>
    <string name="group_shortcuts" msgid="6012256992764410535">"Skróty"</string>
    <string name="group_widgets" msgid="1569030723286851002">"Widżety"</string>
    <string name="completely_out_of_space" msgid="6106288382070760318">"Brak miejsca na ekranach głównych."</string>
    <string name="out_of_space" msgid="4691004494942118364">"Brak miejsca na tym ekranie głównym."</string>
    <string name="hotseat_out_of_space" msgid="9139760413395605841">"Brak miejsca w kieszonce."</string>
    <string name="invalid_hotseat_item" msgid="1211534262129849507">"Ten widżet jest za duży, by umieścić go w kieszonce."</string>
    <string name="shortcut_installed" msgid="1701742129426969556">"Skrót "<xliff:g id="NAME">%s</xliff:g>" został utworzony."</string>
    <string name="shortcut_uninstalled" msgid="8176767991305701821">"Skrót "<xliff:g id="NAME">%s</xliff:g>" został usunięty."</string>
    <string name="shortcut_duplicate" msgid="9167217446062498127">"Skrót "<xliff:g id="NAME">%s</xliff:g>" już istnieje."</string>
    <string name="title_select_shortcut" msgid="6680642571148153868">"Wybierz skrót"</string>
    <string name="title_select_application" msgid="3280812711670683644">"Wybierz aplikację"</string>
    <string name="all_apps_button_label" msgid="9110807029020582876">"Aplikacje"</string>
    <string name="all_apps_home_button_label" msgid="252062713717058851">"Ekran główny"</string>
    <string name="delete_zone_label_workspace" msgid="4009607676751398685">"Usuń"</string>
    <string name="delete_zone_label_all_apps" msgid="8083826390278958980">"Odinstaluj"</string>
    <string name="delete_target_label" msgid="1822697352535677073">"Usuń"</string>
    <string name="delete_target_uninstall_label" msgid="5100785476250872595">"Odinstaluj"</string>
    <string name="info_target_label" msgid="8053346143994679532">"Informacje o aplikacji"</string>
    <string name="accessibility_search_button" msgid="1628520399424565142">"Szukaj"</string>
    <string name="accessibility_voice_search_button" msgid="4637324840434406584">"Wyszukiwanie głosowe"</string>
    <string name="accessibility_all_apps_button" msgid="2603132375383800483">"Aplikacje"</string>
    <string name="accessibility_delete_button" msgid="6466114477993744621">"Usuń"</string>
    <string name="delete_zone_label_all_apps_system_app" msgid="449755632749610895">"Odinstaluj aktualizację"</string>
    <string name="cab_menu_delete_app" msgid="7435191475867183689">"Odinstaluj aplikację"</string>
    <string name="cab_menu_app_info" msgid="8593722221450362342">"Szczegóły aplikacji"</string>
    <string name="cab_app_selection_text" msgid="374688303047985416">"Wybrano 1 aplikację"</string>
    <string name="cab_widget_selection_text" msgid="1833458597831541241">"Wybrano 1 widżet"</string>
    <string name="cab_folder_selection_text" msgid="7999992513806132118">"Wybrano 1 folder"</string>
    <string name="cab_shortcut_selection_text" msgid="2103811025667946450">"Wybrano 1 skrót"</string>
    <string name="permlab_install_shortcut" msgid="5632423390354674437">"instalowanie skrótów"</string>
    <string name="permdesc_install_shortcut" msgid="923466509822011139">"Pozwala aplikacji dodawać skróty bez interwencji użytkownika."</string>
    <string name="permlab_uninstall_shortcut" msgid="864595034498083837">"odinstalowywanie skrótów"</string>
    <string name="permdesc_uninstall_shortcut" msgid="5134129545001836849">"Pozwala aplikacji usuwać skróty bez interwencji użytkownika."</string>
    <string name="permlab_read_settings" msgid="1941457408239617576">"odczytywanie ustawień i skrótów na ekranie głównym"</string>
    <string name="permdesc_read_settings" msgid="5833423719057558387">"Pozwala aplikacji na odczytywanie ustawień i skrótów na ekranie głównym."</string>
    <string name="permlab_write_settings" msgid="3574213698004620587">"zapisywanie ustawień i skrótów na ekranie głównym"</string>
    <string name="permdesc_write_settings" msgid="5440712911516509985">"Umożliwia aplikacji zmianę ustawień i skrótów na ekranie głównym."</string>
    <string name="gadget_error_text" msgid="6081085226050792095">"Problem podczas ładowania widżetu"</string>
    <string name="uninstall_system_app_text" msgid="4172046090762920660">"To aplikacja systemowa i nie można jej odinstalować."</string>
    <string name="dream_name" msgid="1530253749244328964">"Wyrzutnia rakiet"</string>
    <string name="folder_hint_text" msgid="6617836969016293992">"Folder bez nazwy"</string>
    <string name="workspace_description_format" msgid="2950174241104043327">"Ekran główny %1$d"</string>
    <string name="default_scroll_format" msgid="7475544710230993317">"Strona %1$d z %2$d"</string>
    <string name="workspace_scroll_format" msgid="8458889198184077399">"Ekran główny %1$d z %2$d"</string>
    <string name="apps_customize_apps_scroll_format" msgid="370005296147130238">"Strona aplikacji: %1$d z %2$d"</string>
    <string name="apps_customize_widgets_scroll_format" msgid="3106209519974971521">"Strona widżetów: %1$d z %2$d"</string>
    <string name="first_run_cling_title" msgid="7257389003637362144">"Witamy"</string>
    <string name="first_run_cling_description" msgid="6447072552696253358">"Poczuj się jak u siebie."</string>
    <string name="first_run_cling_custom_content_hint" msgid="6090628589029352439"></string>
    <string name="first_run_cling_search_bar_hint" msgid="5909062802402452582"></string>
    <string name="first_run_cling_create_screens_hint" msgid="6950729526680114157">"Dodaj więcej ekranów na aplikacje i foldery"</string>
    <string name="workspace_cling_title" msgid="5626202359865825661">"Uporządkuj obszar roboczy"</string>
    <string name="workspace_cling_move_item" msgid="528201129978005352">"Kliknij i przytrzymaj tło, by zmienić tapetę, widżety lub ustawienia."</string>
    <string name="all_apps_cling_title" msgid="34929250753095858">"Wybierz kilka aplikacji"</string>
    <string name="all_apps_cling_add_item" msgid="400866858451850784">"Aby dodać aplikację na ekran główny, dotknij i przytrzymaj jej ikonę."</string>
    <string name="folder_cling_title" msgid="3894908818693254164">"Tu jest folder"</string>
    <string name="folder_cling_create_folder" msgid="6158215559475836131">"Aby utworzyć taki sam, kliknij i przytrzymaj aplikację, a następnie przenieś ją na następną."</string>
    <string name="cling_dismiss" msgid="8962359497601507581">"OK"</string>
    <string name="folder_opened" msgid="94695026776264709">"Folder otwarty, <xliff:g id="WIDTH">%1$d</xliff:g> na <xliff:g id="HEIGHT">%2$d</xliff:g>"</string>
    <string name="folder_tap_to_close" msgid="1884479294466410023">"Kliknij, by zamknąć folder"</string>
    <string name="folder_tap_to_rename" msgid="9191075570492871147">"Kliknij, by zapisać zmianę nazwy"</string>
    <string name="folder_closed" msgid="4100806530910930934">"Folder zamknięty"</string>
    <string name="folder_renamed" msgid="1794088362165669656">"Nazwa folderu zmieniona na <xliff:g id="NAME">%1$s</xliff:g>"</string>
    <string name="folder_name_format" msgid="6629239338071103179">"Folder: <xliff:g id="NAME">%1$s</xliff:g>"</string>
    <string name="custom_workspace_cling_title_1" msgid="3750880082935033085"></string>
    <string name="custom_workspace_cling_description_1" msgid="939966842147696724"></string>
    <string name="custom_workspace_cling_title_2" msgid="662588444436552198"></string>
    <string name="custom_workspace_cling_description_2" msgid="8097921091798539310"></string>
    <string name="widget_button_text" msgid="2880537293434387943">"Widżety"</string>
    <string name="wallpaper_button_text" msgid="8404103075899945851">"Tapety"</string>
    <string name="settings_button_text" msgid="8119458837558863227">"Ustawienia"</string>
</resources>


text:
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Diagnostics.Contracts;
using System;

// Disable the "this variable is not used" warning as every field would imply it.
#pragma warning disable 0414
// Disable the "this variable is never assigned to".
#pragma warning disable 0067
// Disable the "this event is never assigned to".
#pragma warning disable 0649
// Disable the "this variable is never used".
#pragma warning disable 0169
// Disable the "new keyword not required" warning.
#pragma warning disable 0109
// Disable the "extern without DllImport" warning.
#pragma warning disable 0626
// Disable the "could hide other member" warning, can happen on certain properties.
#pragma warning disable 0108

namespace System.Web.Security
{
  static public partial class Membership
  {
    #region Methods and constructors
    public static MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, Object providerUserKey, out MembershipCreateStatus status)
    {
      status = default(MembershipCreateStatus);

      return default(MembershipUser);
    }

    public static MembershipUser CreateUser(string username, string password, string email, string passwordQuestion, string passwordAnswer, bool isApproved, out MembershipCreateStatus status)
    {
      status = default(MembershipCreateStatus);

      return default(MembershipUser);
    }

    public static MembershipUser CreateUser(string username, string password)
    {
      return default(MembershipUser);
    }

    public static MembershipUser CreateUser(string username, string password, string email)
    {
      return default(MembershipUser);
    }

    public static bool DeleteUser(string username)
    {
      return default(bool);
    }

    public static bool DeleteUser(string username, bool deleteAllRelatedData)
    {
      return default(bool);
    }

    public static MembershipUserCollection FindUsersByEmail(string emailToMatch)
    {
      return default(MembershipUserCollection);
    }

    public static MembershipUserCollection FindUsersByEmail(string emailToMatch, int pageIndex, int pageSize, out int totalRecords)
    {
      totalRecords = default(int);

      return default(MembershipUserCollection);
    }

    public static MembershipUserCollection FindUsersByName(string usernameToMatch, int pageIndex, int pageSize, out int totalRecords)
    {
      totalRecords = default(int);

      return default(MembershipUserCollection);
    }

    public static MembershipUserCollection FindUsersByName(string usernameToMatch)
    {
      return default(MembershipUserCollection);
    }

    public static string GeneratePassword(int length, int numberOfNonAlphanumericCharacters)
    {
      return default(string);
    }

    public static MembershipUserCollection GetAllUsers()
    {
      return default(MembershipUserCollection);
    }

    public static MembershipUserCollection GetAllUsers(int pageIndex, int pageSize, out int totalRecords)
    {
      totalRecords = default(int);

      return default(MembershipUserCollection);
    }

    public static int GetNumberOfUsersOnline()
    {
      return default(int);
    }

    public static MembershipUser GetUser(string username, bool userIsOnline)
    {
      return default(MembershipUser);
    }

    public static MembershipUser GetUser(string username)
    {
      return default(MembershipUser);
    }

    public static MembershipUser GetUser()
    {
      return default(MembershipUser);
    }

    public static MembershipUser GetUser(Object providerUserKey)
    {
      return default(MembershipUser);
    }

    public static MembershipUser GetUser(bool userIsOnline)
    {
      return default(MembershipUser);
    }

    public static MembershipUser GetUser(Object providerUserKey, bool userIsOnline)
    {
      return default(MembershipUser);
    }

    public static string GetUserNameByEmail(string emailToMatch)
    {
      return default(string);
    }

    public static void UpdateUser(MembershipUser user)
    {
    }

    public static bool ValidateUser(string username, string password)
    {
      return default(bool);
    }
    #endregion

    #region Properties and indexers
    public static string ApplicationName
    {
      get
      {
        return default(string);
      }
      set
      {
      }
    }

    public static bool EnablePasswordReset
    {
      get
      {
        return default(bool);
      }
    }

    public static bool EnablePasswordRetrieval
    {
      get
      {
        return default(bool);
      }
    }

    public static string HashAlgorithmType
    {
      get
      {
        return default(string);
      }
    }

    public static int MaxInvalidPasswordAttempts
    {
      get
      {
        return default(int);
      }
    }

    public static int MinRequiredNonAlphanumericCharacters
    {
      get
      {
        return default(int);
      }
    }

    public static int MinRequiredPasswordLength
    {
      get
      {
        return default(int);
      }
    }

    public static int PasswordAttemptWindow
    {
      get
      {
        return default(int);
      }
    }

    public static string PasswordStrengthRegularExpression
    {
      get
      {
        return default(string);
      }
    }

    public static MembershipProvider Provider
    {
      get
      {
        return default(MembershipProvider);
      }
    }

    public static MembershipProviderCollection Providers
    {
      get
      {
        return default(MembershipProviderCollection);
      }
    }

    public static bool RequiresQuestionAndAnswer
    {
      get
      {
        return default(bool);
      }
    }

    public static int UserIsOnlineTimeWindow
    {
      get
      {
        return default(int);
      }
    }
    #endregion

    #region Events
    public static event MembershipValidatePasswordEventHandler ValidatingPassword
    {
      add
      {
      }
      remove
      {
      }
    }
    #endregion
  }
}


text:
from __future__ import unicode_literals

from datetime import datetime

from sqlalchemy import and_, or_, desc

from ..utils import GuidFactory
from . import tables
from .base import BaseTableModel
from .base import NOT_SET

class ChannelModel(BaseTableModel):
    """chat data model

    """
    TABLE = tables.Channel

    guid_factory = GuidFactory('C')

    def get_channel(self, user_id1, user_id2):
        return self.session\
            .query(self.TABLE)\
            .filter(or_(
            and_(self.TABLE.user_id1==user_id1, self.TABLE.user_id2==user_id2),
            and_(self.TABLE.user_id1==user_id2, self.TABLE.user_id2==user_id1))
            ).first()

    def get_channels_by_user_id(self, user_id):
        return self.session\
            .query(self.TABLE)\
            .filter(or_(self.TABLE.user_id1==user_id,
                        self.TABLE.user_id2==user_id))\
            .order_by(desc(self.TABLE.created_at))

    def create_channel(self, user_id1, user_id2):
        channel = tables.Channel(
            guid=self.guid_factory(),
            user_id1=user_id1,
            user_id2=user_id2,
        )
        self.session.add(channel)
        self.session.flush()
        return channel


text:
"use strict";
const AbstractInEvent_1 = require("./AbstractInEvent");
const Logger_1 = require("../../logger/Logger");
class YoutubeVideoPauseEvent extends AbstractInEvent_1.default {
    static get EventName() { return "pause_video_youtube"; }
    static HandleEvent(user) {
        if (user.room) {
            Logger_1.default.logInfo("Youtube video paused.", user, user.room);
            user.room.emitToOthers(user, YoutubeVideoPauseEvent.EventName);
        }
    }
}
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = YoutubeVideoPauseEvent;
//# sourceMappingURL=YoutubeVideoPauseEvent.js.map


text:
package org.kie.eclipse.server;

import java.io.File;

/**
 *
 */
public interface IKieProjectHandler extends IKieResourceHandler {

	File getDirectory();
}


text:
import React, { PropTypes } from 'react';
import { Field, reduxForm } from 'redux-form/es';
import { Button, Form, Grid, Message } from 'semantic-ui-react';
import { InputField } from '../../../commons';
import { signupValidation } from './validate';

const Signup = ({ handleSubmit, signupUser, translate, valid }) => (

    <Grid centered columns={3} style={{ height: '90vh' }} verticalAlign='middle'>
      <Grid.Row>
        <Grid.Column>
          <Message
            attached
            header={translate('welcome')}
            content={translate('pass-prompt')}
          />
          <Form className='attached fluid segment' onSubmit={handleSubmit(signupUser)}>
            <Form.Field>
              {translate('email')}
              <Field
                icon='mail'
                component={InputField}
                placeholder='putinHeartsdonald@yandex.ru'
                name='email'
                type='email'
              />
            </Form.Field>
            <Form.Field>
              {translate('password')}
              <Field
                icon='lock'
                component={InputField}
                placeholder='secretKGBpasswordHERE'
                name='password'
                type='password'
              />
            </Form.Field>
            <Form.Field>
              {translate('confirm')}
              <Field
                icon='lock'
                component={InputField}
                placeholder='secretKGBpasswordHERE'
                name='confirmPassword'
                type='password'
              />
            </Form.Field>
            <Button primary disabled={!valid} type='submit'>{translate('signup')}</Button>
          </Form>
        </Grid.Column>
      </Grid.Row>
    </Grid>

);

Signup.propTypes = {
  handleSubmit: PropTypes.func.isRequired,
  signupUser: PropTypes.func.isRequired,
  translate: PropTypes.func,
  valid: PropTypes.bool.isRequired
};

export default reduxForm({
  form: 'signup',
  validate: signupValidation
})(Signup);


text:
var DESCRIPTORS = require('../internals/descriptors');
var propertyIsEnumerableModule = require('../internals/object-property-is-enumerable');
var createPropertyDescriptor = require('../internals/create-property-descriptor');
var toIndexedObject = require('../internals/to-indexed-object');
var toPrimitive = require('../internals/to-primitive');
var has = require('../internals/has');
var IE8_DOM_DEFINE = require('../internals/ie8-dom-define');

var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;

// `Object.getOwnPropertyDescriptor` method
// https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  O = toIndexedObject(O);
  P = toPrimitive(P, true);
  if (IE8_DOM_DEFINE) try {
    return nativeGetOwnPropertyDescriptor(O, P);
  } catch (error) { /* empty */ }
  if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
};


text: require("./index")(false);


text:
 console.log("=[LSC]= CHAT STARTING UP");
/**
 * Require config file
 *
 * @type {[json]}
 */
var config = require('./config.json');

/**
 * Requiere Express-Framework
 *
 * @type {[express]}
 */
var express = require('express');

/**
 * Create a new app
 *
 * @type {[express]}
 */
var app = express();

/**
 * Create a server
 *
 * @type {[http]}
 */
var server = require('http').Server(app);

/**
 * Set up socket.io
 *
 * @type {[socket]}
 */
var io = require('socket.io')(server);

/**
 * Require mysql
 *
 * @type {mysql}
 */
var mysql = require('mysql');

/**
 * The sleep is back
 *
 * @type {object}
 */
var sleep = require('sleep');
/**
 * If you use openshift we configure that
 * else we use the config port
 *
 * @type {[int]}
 */
var port = process.env.OPENSHIFT_NODEJS_PORT || config.Port;

/**
 * If you use openshift we configure that
 * else we use the config ip
 *
 * @type {[string]}
 */
var ipaddr = process.env.OPENSHIFT_NODEJS_IP || config.IP;

/**
 * Include messages module
 *
 * @type {[lsc_messages]}
 */
var lsc_messages = require('./modules/messages.js');

/**
 * Include messages module
 *s
 * @type {[lsc_command]}
 */
var lsc_command = require('./modules/commands.js');

/**
 * Includes database module
 *
 * @type {object}
 */
var lsc_database = require('./modules/db/database.js');

/**
 * Includes database adapter
 *
 * @type {object}
 */
var lsc_database_adapter = require('./modules/db/adapter/'+config.database.adapter+'.js');

/**
 * Object of clients
 *
 * @type {Object}
 */
var clients = {};

/**
 * A object of socket.id's with username
 * So we need nothing to store them
 *
 * @type {Object}
 */
var ClientsPerSocket = {};

/**
 * Wich port and ip we listen ?
 */
server.listen(port, ipaddr);

/**
 * Disable cache
 */
app.set('view cache', false);

/**
 * Set a static path for template
 */
app.use(express.static(__dirname+config.templatePath+config.activeTemplate+'/'));

/**
 * Set static path for api modules
 */
app.use('/lsc_api', express.static(__dirname+'/api'));
console.log("=[LSC]= CONFIG DONE! DB DO YOUR WORK, GO!!");
/**
 * What we do a requets ?
 *
 * @param  {[Request]} req
 * @param  {[Ressource]} res
 * @return {[Ressource]}
 */

//DO SOME DB STUFF
lsc_database.setHost(config.database.host).setDatabase(config.database.database).setUser(config.database.user).setPassword(config.database.password).setAdapter(lsc_database_adapter);
lsc_database.connect();

app.get('/', function (req, res ) {
	res.sendFile(__dirname+config.templatePath+config.activeTemplate+'/index.html');
});

/**
 * Connect module
 *
 * @param  {[socket Client]} socket
 * @return {[void]}
 */
io.on('connect' , function(socket) {
	/**
	 * Daly msg or news
	 *
	 * @return {[json]}
	 */
	socket.emit('news', {hello:'word'});

	/**
	 * Is the user baned blocked or have
	 * we the username allready ?
	 *
	 * @param  {[object]} user
	 * @return {[boolean]}
	 */
	socket.on('checkUsername', function(user) {
		if(clients[user.username] == undefined) {
			clients[user.username] = socket.id;
			ClientsPerSocket[socket.id] = user.username;
			io.emit('renderChat', {message:lsc_messages.joined(user.username)});
		} else {
			if(clients[user.username] == socket.id) {
				console.log("same socket");
			} else {
				console.log("in use");
			}
		}
	});

	/**
	 * Function fo a normal message to all in the room
	 *
	 * @param  {[string]} data
	 * @return object
	 */
	socket.on('message', function(message) {
		var username = ClientsPerSocket[socket.id];
		var newmessage = lsc_command.parse(message);
        console.log(newmessage);
        var object = {
			message:newmessage,
			username:username
		}
		io.emit('message', object);
	});
});

/**
 * Module for disconnect
 *
 * @param  {socket} socket
 * @return {void}
 */
io.on('disconnect', function(socket) {});
console.log("=[LSC]= IS READY");


text:
package com.google.cloud.dataflow.sdk.util;

import com.google.cloud.dataflow.sdk.coders.Coder;
import com.google.cloud.dataflow.sdk.transforms.Combine.KeyedCombineFn;
import com.google.cloud.dataflow.sdk.transforms.DoFn;
import com.google.cloud.dataflow.sdk.transforms.DoFn.RequiresKeyedState;
import com.google.cloud.dataflow.sdk.transforms.windowing.BoundedWindow;
import com.google.cloud.dataflow.sdk.transforms.windowing.DefaultTrigger;
import com.google.cloud.dataflow.sdk.transforms.windowing.NonMergingWindowFn;
import com.google.cloud.dataflow.sdk.transforms.windowing.Trigger;
import com.google.cloud.dataflow.sdk.transforms.windowing.WindowFn;
import com.google.cloud.dataflow.sdk.values.KV;
import com.google.common.base.Preconditions;

import org.joda.time.Instant;

/**
 * DoFn that merges windows and groups elements in those windows, optionally
 * combining values.
 *
 * @param <K> key type
 * @param <VI> input value element type
 * @param <VO> output value element type
 * @param <W> window type
 */
@SuppressWarnings("serial")
public abstract class GroupAlsoByWindowsDoFn<K, VI, VO, W extends BoundedWindow>
    extends DoFn<KV<K, Iterable<WindowedValue<VI>>>, KV<K, VO>>
    implements RequiresKeyedState {

  /**
   * Create a {@link GroupAlsoByWindowsDoFn} without a combine function. Depending on the
   * {@code windowFn} this will either use iterators or window sets to implement the grouping.
   *
   * @param windowingStrategy The window function and trigger to use for grouping
   * @param inputCoder the input coder to use
   */
  public static <K, V, W extends BoundedWindow> GroupAlsoByWindowsDoFn<K, V, Iterable<V>, W>
  createForIterable(WindowingStrategy<?, W> windowingStrategy, Coder<V> inputCoder) {
    if (windowingStrategy.getWindowFn() instanceof NonMergingWindowFn
        && windowingStrategy.getTrigger() instanceof DefaultTrigger) {
      return new GroupAlsoByWindowsViaIteratorsDoFn<K, V, W>();
    } else {
      return new GABWViaWindowSetDoFn<>(
          windowingStrategy, BufferingWindowSet.<K, V, W>factory(inputCoder));
    }
  }

  /**
   * Construct a {@link GroupAlsoByWindowsDoFn} using the {@code combineFn} if available.
   */
  public static <K, VI, VA, VO, W extends BoundedWindow> GroupAlsoByWindowsDoFn<K, VI, VO, W>
  create(
      final WindowingStrategy<?, W> windowingStrategy,
      final KeyedCombineFn<K, VI, VA, VO> combineFn,
      final Coder<K> keyCoder,
      final Coder<VI> inputCoder) {
    Preconditions.checkNotNull(combineFn);
    return new GABWViaWindowSetDoFn<>(
        windowingStrategy, CombiningWindowSet.<K, VI, VA, VO, W>factory(
            combineFn, keyCoder, inputCoder));
  }

  private static class GABWViaWindowSetDoFn<K, VI, VO, W extends BoundedWindow>
     extends GroupAlsoByWindowsDoFn<K, VI, VO, W> {

    private WindowFn<Object, W> windowFn;
    private AbstractWindowSet.Factory<K, VI, VO, W> windowSetFactory;
    private Trigger<W> trigger;

    public GABWViaWindowSetDoFn(WindowingStrategy<?, W> windowingStrategy,
        AbstractWindowSet.Factory<K, VI, VO, W> factory) {
      @SuppressWarnings("unchecked")
      WindowingStrategy<Object, W> noWildcard = (WindowingStrategy<Object, W>) windowingStrategy;
      this.windowFn = noWildcard.getWindowFn();
      this.trigger = noWildcard.getTrigger();
      this.windowSetFactory = factory;
    }

    @Override
    public void processElement(
        DoFn<KV<K, Iterable<WindowedValue<VI>>>, KV<K, VO>>.ProcessContext c) throws Exception {
      K key = c.element().getKey();
      AbstractWindowSet<K, VI, VO, W> windowSet = windowSetFactory.create(
          key, windowFn.windowCoder(), c.keyedState(), c.windowingInternals());

      BatchTimerManager timerManager = new BatchTimerManager(Instant.now());
      TriggerExecutor<K, VI, VO, W> triggerExecutor = new TriggerExecutor<>(
          windowFn, timerManager, trigger,
          c.keyedState(), c.windowingInternals(), windowSet);

      for (WindowedValue<VI> e : c.element().getValue()) {
        // First, handle anything that needs to happen for this element
        triggerExecutor.onElement(e);

        // Then, since elements are sorted by their timestamp, advance the watermark and fire any
        // timers that need to be fired.
        timerManager.advanceWatermark(triggerExecutor, e.getTimestamp());

        // Also, fire any processing timers that need to fire
        timerManager.advanceProcessingTime(triggerExecutor, Instant.now());
      }

      // Finish any pending windows by advancing the watermark to infinity.
      timerManager.advanceWatermark(triggerExecutor, new Instant(Long.MAX_VALUE));

      // Finally, advance the processing time
      timerManager.advanceProcessingTime(triggerExecutor, Instant.now());

      windowSet.persist();
    }
  }
}


text:
from django.db import models

class Platform(models.Model):
    name = models.CharField(max_length=200)

    class Meta:
        ordering = ['name']

    def __str__(self):
        return '{}'.format(self.name)

    @staticmethod
    def autocomplete_search_fields():
        return ('name__exact', 'name__icontains')

class Game(models.Model):
    # Metadata.
    name = models.CharField(max_length=200)
    platform = models.ForeignKey(Platform, null=True, related_name='games')

    # Imagery.
    image_art = models.ImageField('art', blank=True, upload_to='games',
        help_text='16:9 art. Used for backgrounds, etc. Minimum size should be 1280x720.')
    image_boxart = models.ImageField('boxart', blank=True, upload_to='games',
        help_text='8:11 art akin to Twitch. Used for supplimentary display, lists, etc.')

    # Statuses.
    is_abandoned = models.BooleanField('is abandoned?', default=False,
        help_text='Has this game been abandoned for good?')
    is_completed = models.BooleanField('is completed?', default=False,
        help_text='Has this game been completed (if applicable).' )

    def __str__(self):
        return '{}'.format(self.name)

    @staticmethod
    def autocomplete_search_fields():
        return ('name__exact', 'name__icontains')


text:
using System;
using System.Text;

namespace MindTouch.Deki.Script {
    public class DekiScriptCaseBlock {

        //--- Fields ---
        public readonly DekiScriptExpression[] Conditions;
        public readonly DekiScriptExpression Body;
        public readonly bool IsBlock;

        //--- Constructors ---
        public DekiScriptCaseBlock(DekiScriptExpression[] conditions, DekiScriptExpression body, bool isBlock) {
            if(conditions == null) {
                throw new ArgumentNullException("conditions");
            }
            if(body == null) {
                throw new ArgumentNullException("body");
            }
            this.Conditions = conditions;
            this.Body = body;
            IsBlock = isBlock;
        }

        public void ToExprString(StringBuilder code) {
            foreach(DekiScriptExpression condition in Conditions) {
                if(condition != null) {
                    code.Append("case ").Append(condition.ToExprString()).Append(": ");
                } else {
                    code.Append("default: ");
                }
            }
            if(Body == null) {
                return;
            }
            if(IsBlock) {
                code.Append("{ ");
                code.Append(Body.ToExprString());
                code.Append("; } ");
            } else {
                code.Append(Body.ToExprString());
                code.Append("; ");
            }
        }
    }
}


text:
package com.hortonworks.streamline.streams.metrics.storm.graphite;

import com.github.tomakehurst.wiremock.junit.WireMockRule;
import com.hortonworks.streamline.streams.metrics.TimeSeriesQuerier;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.verify;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class GraphiteWithStormQuerierTest {
    private final String TEST_RENDER_API_PATH = "/render";

    @Rule
    public WireMockRule wireMockRule = new WireMockRule(18089);
    private GraphiteWithStormQuerier querier;

    @Before
    public void setUp() throws Exception {
        querier = new GraphiteWithStormQuerier();

        Map<String, String> conf = new HashMap<>();
        conf.put(GraphiteWithStormQuerier.RENDER_API_URL, "http://localhost:18089" + TEST_RENDER_API_PATH);
        conf.put(GraphiteWithStormQuerier.METRIC_NAME_PREFIX, "storm");
        conf.put(GraphiteWithStormQuerier.USE_FQDN, "false");

        querier.init(conf);
    }

    @After
    public void tearDown() throws Exception {

    }

    @Test
    public void getMetrics() throws Exception {
        stubMetricUrl();

        String topologyName = "testTopology";
        String componentId = "testComponent";
        String metricName = "__test.metric.name";
        TimeSeriesQuerier.AggregateFunction aggrFunction = TimeSeriesQuerier.AggregateFunction.SUM;
        long from = 1234000L;
        long to = 5678000L;

        Map<Long, Double> metrics = querier.getMetrics(topologyName, componentId, metricName, aggrFunction, from, to);
        assertResult(metrics);

        verify(getRequestedFor(urlPathEqualTo(TEST_RENDER_API_PATH))
                .withQueryParam("target", equalTo("sumSeries(storm.testTopology.testComponent.*.*.*.*.*.*.__test.metric.name)"))
                .withQueryParam("format", equalTo("json"))
                .withQueryParam("from", equalTo("1234"))
                .withQueryParam("until", equalTo("5678")));
    }

    @Test
    public void getMetricsWithStreamAggregation() throws Exception {
        stubMetricUrl();

        String topologyName = "testTopology";
        String componentId = "testComponent";
        // this is one of metric which needs stream aggregation
        String metricName = "__complete-latency";
        TimeSeriesQuerier.AggregateFunction aggrFunction = TimeSeriesQuerier.AggregateFunction.AVG;
        long from = 1234000L;
        long to = 5678000L;

        Map<Long, Double> metrics = querier.getMetrics(topologyName, componentId, metricName, aggrFunction, from, to);
        assertResult(metrics);

        verify(getRequestedFor(urlPathEqualTo(TEST_RENDER_API_PATH))
                .withQueryParam("target", equalTo("averageSeries(storm.testTopology.testComponent.*.*.*.*.*.*.__complete-latency.*)"))
                .withQueryParam("format", equalTo("json"))
                .withQueryParam("from", equalTo("1234"))
                .withQueryParam("until", equalTo("5678")));
    }

    @Test
    public void getRawMetrics() throws Exception {
        stubMetricUrl();

        String metricName = "metric";
        String parameters = "";
        long from = 1234000L;
        long to = 5678000L;

        Map<String, Map<Long, Double>> metrics = querier.getRawMetrics(metricName, parameters, from, to);
        assertResult(metrics.get("metric"));

        verify(getRequestedFor(urlPathEqualTo(TEST_RENDER_API_PATH))
                .withQueryParam("target", equalTo("metric"))
                .withQueryParam("format", equalTo("json"))
                .withQueryParam("from", equalTo("1234"))
                .withQueryParam("until", equalTo("5678")));
    }

    private void stubMetricUrl() {
        stubFor(get(urlPathEqualTo(TEST_RENDER_API_PATH))
                .withHeader("Accept", equalTo("application/json"))
                .willReturn(aResponse()
                        .withStatus(200)
                        .withHeader("Content-Type", "application/json")
                        .withBody("[{\"target\": \"metric\", \"datapoints\": [[456.789, 2345], [890.123, 3456]]}]")));
    }

    private void assertResult(Map<Long, Double> metrics) {
        assertTrue(metrics.containsKey(2345000L));
        assertEquals(456.789, metrics.get(2345000L), 0.00001);
        assertEquals(890.123, metrics.get(3456000L), 0.00001);
    }

}


text:
@interface SMLErrorPopOver : NSObject

// Pass an array of strings to this function to open up the popover window. Window will be centered in the view that is passed to this function.
+ (void) showErrorDescriptions:(NSArray*)errors relativeToView:(NSView*) view;

@end


text:
<?php

// SonataAdminBundle:Pager:base_results.html.twig
return array (
);


text:
#ifndef HK_VEHICLE_JOB_QUEUE_UTILS
#define HK_VEHICLE_JOB_QUEUE_UTILS

#include <Common/Base/Thread/JobQueue/hkJobQueue.h>

/// Utils to allow vehicle jobs to be executed from a job queue
struct hkpVehicleJobQueueUtils
{
	static hkJobQueue::JobPopFuncResult  HK_CALL popVehicleJob   ( hkJobQueue& queue,
									hkJobQueue::DynamicData* data,
									hkJobQueue::JobQueueEntry& jobIn,
									hkJobQueue::JobQueueEntry& jobOut  );

	static hkJobQueue::JobCreationStatus HK_CALL finishVehicleJob( hkJobQueue& queue,
									hkJobQueue::DynamicData* data,
									const hkJobQueue::JobQueueEntry& jobIn,
									hkJobQueue::JobQueueEntryInput& newJobCreated );

	static void HK_CALL registerWithJobQueue( hkJobQueue* jobQueue );
};

#endif // HK_VEHICLE_JOB_QUEUE_UTILS

/*
 * Havok SDK - NO SOURCE PC DOWNLOAD, BUILD(#20140907)
 *
 * Confidential Information of Havok.  (C) Copyright 1999-2014
 * Telekinesys Research Limited t/a Havok. All Rights Reserved. The Havok
 * Logo, and the Havok buzzsaw logo are trademarks of Havok.  Title, ownership
 * rights, and intellectual property rights in the Havok software remain in
 * Havok and/or its suppliers.
 *
 * Use of this software for evaluation purposes is subject to and indicates
 * acceptance of the End User licence Agreement for this product. A copy of
 * the license is included with this software and is also available at www.havok.com/tryhavok.
 *
 */


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#eee"
    android:orientation="vertical" >

    <android.support.v4.view.ViewPager
        android:id="@+id/id_viewpager"
        android:layout_width="fill_parent"
        android:layout_height="0dp"
        android:layout_weight="1" >
    </android.support.v4.view.ViewPager>

    <include layout="@layout/bottom_bar" />

</LinearLayout>


text:
Akka examples in Java
==============

A few examples using Akka with Java. These examples have basic structures in common:

* Coded in Java.
* Clustered Akka setup.
* Logback / SL4J Logger. Log file is under the root path: ``/logs``
* Akka configuration has most logging options turned on. (chatty)

All examples are runnable from within your IDE, by executing the ``Main`` method in the corresponding ``org.royrusso.app.System`` class.

Simple Akka Example
------------------

``/simple`` :: The simplest of Akka examples. Creates an Actor that processes a command.

Akka Parent-Child Actors
------------------

``/parent-child`` :: This example illustrates how you can configure an Akka cluster for hierarchical Actor relationships.
This cluster contains Parent Actors that, given a Command, send an Event to a Child Actor for processing.

Akka Persistence with EventSourcing
------------------

``/eventsourcing-persistence`` :: Usage of the new Akka Persistence module with Event Sourcing. An Akka Processor is responsible for processing non-persistent Commands
that generate Events. The Events are persisted, and then allowed to modify the state of the processor. Additionally, the events are broadcast over the eventstream.

During recovery, the system then loads the persisted Events and replays them to the processor.

On restart, the system will load its last known state from the latest Snapshot (``snapshot`` dir), and replay all Journaled (``journal`` dir) Events after that point.

Notes:

* LevelDB is used for persistence in this example.
* ``/snapshots`` contains the snapshot of the processor states.
* ``/journal`` contains the running journal of events.

Akka Persistent Channels
-----------------------

``persistent-channel`` :: Illustrates how to send/receive payloads between actors listening on a channel. Messages are persisted until there is a valid confirmation
of it being received by the destination Actor, and then deleted. This example also illustrates how the destination Actor may respond with an ack.

Akka Event-Bus
------------------

``/event-bus`` :: Here we show how the Akka EventStream can be used by Actors that are subscribed to listen for certain event types that are emitted by another actor.


text:
package org.apache.flink.api.java.record.functions;

import org.apache.flink.api.common.functions.AbstractRichFunction;
import org.apache.flink.types.Record;
import org.apache.flink.util.Collector;

/**
 *
 * NOTE: The Record API is marked as deprecated. It is not being developed anymore and will be removed from
 * the code at some point.
 * See FLINK-1106 for more details.
 *
 *
 * The MapPartitionFunction must be extended to provide a map partition implementation
 * By definition, the map partition is called for a full input set.
 */

@Deprecated
public abstract class MapPartitionFunction extends AbstractRichFunction implements org.apache.flink.api.common.functions.MapPartitionFunction<Record, Record> {

	private static final long serialVersionUID = 1L;

	/**
	 * This method must be implemented to provide a user implementation of a MapPartitionFunction.
	 * It is called for a full input set.
	 *
	 * @param values all input records
	 * @param out A collector that collects all output records.
	 *
	 * @throws Exception Implementations may forward exceptions, which are caught by the runtime. When the
	 *                   runtime catches an exception, it aborts the map task and lets the fail-over logic
	 *                   decide whether to retry the mapper execution.
	 */
	@Override
	public abstract void mapPartition(Iterable<Record> values, Collector<Record> out) throws Exception;
}


text:
<?xml version="1.0" encoding="utf-8"?>
<ProjectInfo xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.sonarsource.com/msbuild/integration/2015/1">
  <ProjectName>CSProj2</ProjectName>
  <ProjectLanguage>C#</ProjectLanguage>
  <ProjectType>Product</ProjectType>
  <ProjectGuid>8c269b30-29bc-4bcd-9ab0-7acfb763db2e</ProjectGuid>
  <FullPath>C:\agent\_work\3\s\CSProj2\CSProj2.csproj</FullPath>
  <IsExcluded>false</IsExcluded>
  <AnalysisResults>
    <AnalysisResult Id="FxCop" Location="C:\agent\_work\3\s\CSProj2\bin\Debug\Proj2.dll.CodeAnalysisLog.xml" />
    <AnalysisResult Id="FilesToAnalyze" Location="C:\agent\_work\3\.sonarqube\out\\CSProj2_AnyCPU_Debug_6533\FilesToAnalyze.txt" />
  </AnalysisResults>
  <AnalysisSettings>
    <Property Name="sonar.cs.roslyn.reportFilePath">C:\agent\_work\3\s\CSProj2\bin\Debug\Proj2.dll.RoslynCA.json</Property>
    <Property Name="sonar.stylecop.projectFilePath">C:\agent\_work\3\s\CSProj2\CSProj2.csproj</Property>
  </AnalysisSettings>
</ProjectInfo>


text:
[![Code Climate](https://codeclimate.com/github/bsboris/git_reporting/badges/gpa.svg)](https://codeclimate.com/github/bsboris/git_reporting)

    reporter = GitReporting::Reporter.new(source: :github, login: "...", password: "...", repo: "my/repo")

    reporter.build_report #=> simple report for all time
    reporter.build_report(type: :timesheet) #=> report per user for all time
    reporter.build_report(type: :timesheet, from: "2015-01-01", to: "2015-01-31") #=> report per user for given period
    reporter.build_report(type: :timesheet, group: :week, from: "2015-01-01", to: "2015-01-31") #=> report per user for given period groupped by week

More docs are coming.


text:
//
//  BXMessagesInputCustomizedStickerView.m
//  Pods
//
//  Created by Xiang Li on 10/29/15.
//
//

#import "BXMessagesInputCustomizedStickerView.h"
#import "BXMessagesInputStickerCell.h"
#import "BXCollectionViewPageableFlowLayout.h"

#define PREVIEW_IMAGE_WIDTH 130
#define PREVIEW_IMAGE_HEIGHT 130

@interface BXMessagesInputCustomizedStickerView() <UICollectionViewDelegate, UICollectionViewDataSource>

@property (strong, nonatomic) NSArray *stickerArray;

@property (strong, nonatomic) UICollectionView *collectionView;
@property (strong, nonatomic) UIPageControl *pageControl;

/**
 *  this is a helper property to get long press gesture on collection view done
 */
@property (strong, nonatomic) NSIndexPath *previousIndexPath;

@property (strong, nonatomic) UIView *previewView;

@end

@implementation BXMessagesInputCustomizedStickerView

- (instancetype)initWithDelegate:(id)delegate index:(NSUInteger)indexValue
{
    self = [super init];
    if (self) {
        self.delegate = delegate;
        self.index = indexValue;
        [self initialize];
    }
    return self;
}

- (void)initialize
{
    self.backgroundColor = [UIColor colorWithWhite:0.980 alpha:1.000];

    [self initCollectionView];
    [self initPageControl];
}

#pragma mark - collection view
- (void)initCollectionView
{
    [self addSubview:self.collectionView];

    self.collectionView.translatesAutoresizingMaskIntoConstraints = NO;
    [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[_collectionView]-0-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_collectionView)]];
    [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[_collectionView]-0-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_collectionView)]];

    [self.collectionView registerClass:[BXMessagesInputStickerCell class]
            forCellWithReuseIdentifier:NSStringFromClass([BXMessagesInputStickerCell class])];
}

- (UICollectionView *)collectionView
{
    if (!_collectionView) {
        BXCollectionViewPageableFlowLayout *layout = [[BXCollectionViewPageableFlowLayout alloc] init];
        layout.itemSize = CGSizeMake(50, 65);
        layout.itemMinimalVerticalPadding = 0;
        layout.itemMinimalHorizontalPadding = 0;
        layout.pageContentInsets = UIEdgeInsetsMake(15, 20, 30, 20);

        _collectionView = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
        _collectionView.backgroundColor = [UIColor clearColor];
        _collectionView.pagingEnabled = YES;
        _collectionView.scrollsToTop = NO;
        _collectionView.showsHorizontalScrollIndicator = NO;
        _collectionView.dataSource = self;
        _collectionView.delegate = self;

        // attach long press gesture to collectionView
        UILongPressGestureRecognizer* lpgr =
        [[UILongPressGestureRecognizer alloc]
         initWithTarget:self
         action:@selector(handleLongPress:)];
        lpgr.minimumPressDuration = .5;  // seconds
        lpgr.delaysTouchesBegan = YES;
        [self.collectionView addGestureRecognizer:lpgr];
    }

    return _collectionView;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    if (self.delegate && [self.delegate respondsToSelector:@selector(numberOfStickersOfPackAtIndex:)]) {
        return [self.delegate numberOfStickersOfPackAtIndex:self.index];
    }
    return 0;
}

- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView
{
    return 1;
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    BXMessagesInputStickerCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:NSStringFromClass([BXMessagesInputStickerCell class])
                                                                                forIndexPath:indexPath];
    if (self.delegate && [self.delegate respondsToSelector:@selector(imageOfStickersWithPackIndex:stickerIndex:)]) {
        cell.stickerImageView.image = [self.delegate imageOfStickersWithPackIndex:self.index stickerIndex:indexPath.row];
    }
    if (self.delegate && [self.delegate respondsToSelector:@selector(nameOfStickersWithPackIndex:stickerIndex:)]) {
        cell.nameLabel.text = [self.delegate nameOfStickersWithPackIndex:self.index stickerIndex:indexPath.row];
    }
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    if (self.delegate && [self.delegate respondsToSelector:@selector(bxMessagesInputCustomizedStickerView:packIndex:stickerIndex:)]) {
        [self.delegate bxMessagesInputCustomizedStickerView:self packIndex:self.index stickerIndex:indexPath.row];
    }
}

#pragma mark - collection view gesture
- (void)handleLongPress:(UILongPressGestureRecognizer *)gestureRecognizer
{
    UICollectionViewCell* cell;
    CGPoint p = [gestureRecognizer locationInView:self.collectionView];
    NSIndexPath *indexPath = [self.collectionView indexPathForItemAtPoint:p];

    if (indexPath == nil){
        // if moving out of collection view , unhighlight previous cell
        UICollectionViewCell *previousCell = [self.collectionView cellForItemAtIndexPath:self.previousIndexPath];
        [self unhighlightCell:previousCell atIndex:self.previousIndexPath.row];
        return;
    } else {
        cell = [self.collectionView cellForItemAtIndexPath:indexPath];
    }

    switch (gestureRecognizer.state) {
        case UIGestureRecognizerStateBegan: {
            [self highlightCell:cell atIndex:indexPath.row];
            self.previousIndexPath = indexPath;
            break;
        }
        case UIGestureRecognizerStateChanged: {
            if (![indexPath isEqual:self.previousIndexPath]) {
                // unhighlight previous cell
                UICollectionViewCell *previousCell = [self.collectionView cellForItemAtIndexPath:self.previousIndexPath];
                if (previousCell) {
                    [self unhighlightCell:previousCell atIndex:self.previousIndexPath.row];
                }
                self.previousIndexPath = indexPath;

                // highlight this cell
                [self highlightCell:cell atIndex:indexPath.row];
            }
            break;
        }
        case UIGestureRecognizerStateEnded: {
            [self unhighlightCell:cell atIndex:indexPath.row];
            break;
        }
        default: {
            return;
        }
    }
}

- (void)highlightCell:(UICollectionViewCell *)cell atIndex:(NSInteger)index
{
    if (!cell) {
        return;
    }

    if ([cell isKindOfClass:[BXMessagesInputStickerCell class]]) {
        BXMessagesInputStickerCell *stickerCell = (BXMessagesInputStickerCell *)cell;
        [stickerCell highlight];

        // add preview view
        [self.previewView removeFromSuperview];
        for (UIView *subView in self.previewView.subviews) {
            [subView removeFromSuperview];
        }

        if (self.delegate && [self.delegate respondsToSelector:@selector(bxMessagesInputCustomizedStickerView:previewImageViewForPackIndex:stickerIndex:)]) {
            CGFloat originX = fmod(stickerCell.center.x, self.frame.size.width) - PREVIEW_IMAGE_WIDTH / 2;
            originX = originX > 0 ? originX : 0;
            originX = originX + PREVIEW_IMAGE_WIDTH > self.frame.size.width ? self.frame.size.width - PREVIEW_IMAGE_WIDTH : originX;
            CGFloat originY = stickerCell.frame.origin.y - PREVIEW_IMAGE_HEIGHT;
            self.previewView.frame = CGRectMake(originX, originY, PREVIEW_IMAGE_WIDTH, PREVIEW_IMAGE_HEIGHT);
            UIView *previewContentView = [self.delegate bxMessagesInputCustomizedStickerView:self previewImageViewForPackIndex:self.index stickerIndex:index];
            previewContentView.frame = CGRectMake(0, 0, PREVIEW_IMAGE_WIDTH, PREVIEW_IMAGE_HEIGHT);
            [self.previewView addSubview:previewContentView];
            [self addSubview:self.previewView];
        }
    }
}

- (void)unhighlightCell:(UICollectionViewCell *)cell atIndex:(NSInteger)index
{
    if (!cell) {
        return;
    }

    if ([cell isKindOfClass:[BXMessagesInputStickerCell class]]) {
        BXMessagesInputStickerCell *stickerCell = (BXMessagesInputStickerCell *)cell;
        [stickerCell unhighlight];

        // remove preview view
        [self.previewView removeFromSuperview];
        for (UIView *subView in self.previewView.subviews) {
            [subView removeFromSuperview];
        }
    }
}

#pragma mark - init page control
- (UIPageControl *)pageControl
{
    if (!_pageControl) {
        _pageControl = [[UIPageControl alloc] init];
        _pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
        _pageControl.currentPageIndicatorTintColor = [UIColor darkGrayColor];
    }

    return _pageControl;
}

- (void)initPageControl
{
    [self addSubview:self.pageControl];

    self.pageControl.translatesAutoresizingMaskIntoConstraints = NO;

    [self addConstraint:[NSLayoutConstraint constraintWithItem:self.pageControl attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.collectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]];
    [self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[_pageControl]-0-|" options:0 metrics:nil views:NSDictionaryOfVariableBindings(_pageControl)]];
    [self addConstraint:[NSLayoutConstraint constraintWithItem:self.pageControl attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:30]];

    [self addPageControlKVOObservers];

    // add tap gesture
    [self.pageControl addTarget:self action:@selector(changePage:) forControlEvents:UIControlEventValueChanged];
}

- (void)changePage:(id)sender {
    UIPageControl *pager = sender;
    CGRect frame = self.collectionView.frame;
    frame.origin.x = frame.size.width * pager.currentPage;
    frame.origin.y = 0;
    [self.collectionView scrollRectToVisible:frame animated:YES];
}

- (void)addPageControlKVOObservers
{
    [self.collectionView addObserver:self forKeyPath:NSStringFromSelector(@selector(contentSize)) options:NSKeyValueObservingOptionNew context:nil];
    [self.collectionView addObserver:self forKeyPath:NSStringFromSelector(@selector(contentOffset)) options:NSKeyValueObservingOptionNew context:nil];
}

- (void)removePageControlKVOObservers
{
    @try {
        [self.collectionView removeObserver:self forKeyPath:NSStringFromSelector(@selector(contentSize))];
        [self.collectionView removeObserver:self forKeyPath:NSStringFromSelector(@selector(contentOffset))];
    }
    @catch (NSException *exception) {
        NSLog(@"BXMessagesKit: remove page control kvo error!");
    }
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
    if ([keyPath isEqualToString:NSStringFromSelector(@selector(contentSize))]) {
        self.pageControl.numberOfPages = self.collectionView.contentSize.width / self.collectionView.bounds.size.width;
        self.pageControl.currentPage = self.collectionView.contentOffset.x / self.collectionView.bounds.size.width;

        self.pageControl.hidden = self.pageControl.numberOfPages<= 1;

    }else if([keyPath isEqualToString:NSStringFromSelector(@selector(contentOffset))]) {
        self.pageControl.currentPage = self.collectionView.contentOffset.x / self.collectionView.bounds.size.width;
    }
}

#pragma mark - load stickers
- (void)loadStickers
{
}

#pragma mark -
- (void)dealloc
{
    [self removePageControlKVOObservers];
}

#pragma mark - getter & setter -
- (UIView *)previewView
{
    if (!_previewView) {
        _previewView = [[UIView alloc] init];
        _previewView.frame = CGRectMake(0, 0, PREVIEW_IMAGE_WIDTH, PREVIEW_IMAGE_HEIGHT);
        _previewView.backgroundColor = [UIColor whiteColor];
        _previewView.alpha = 0.9;
        _previewView.layer.cornerRadius = 4;
        _previewView.clipsToBounds = YES;
    }
    return _previewView;
}

@end


text:
/*
 *	jSync
 *
 * @author Thomas Leber
 * @version 0.1
 *
 *
 *                                  Apache License
 *                          Version 2.0, January 2004
 *                      http://www.apache.org/licenses/
 */
package at.tl_photography.jsync.common;

import java.io.Serializable;

/**
 * The Class FileInfo.
 */
public class FileInfo implements Serializable {

	/** The Constant serialVersionUID. */
	private static final long serialVersionUID = -2025504367114342220L;

	/** The path. */
	private String path;

	/** The md5. */
	private String md5;

	/**
	 * Instantiates a new file info.
	 *
	 * @param relative
	 *            the relative
	 * @param md5
	 *            the md5
	 */
	public FileInfo(String relative, String md5) {
		this.path = relative;
		this.md5 = md5;
	}

	/**
	 * Gets the path.
	 *
	 * @return the path
	 */
	public String getPath() {
		return path;
	}

	/*
	 * (non-Javadoc)
	 *
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "File: " + path;
	}

	/**
	 * Gets the m d5.
	 *
	 * @return the m d5
	 */
	public String getMD5() {
		return md5;
	}

}


text:
namespace REMulti
{
    partial class REJoin
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.lpOutput = new RE.RELinkPoint();
            this.btnPlus = new System.Windows.Forms.Button();
            this.btnMinus = new System.Windows.Forms.Button();
            this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.passAsItComesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
            this.panItemClient.SuspendLayout();
            this.contextMenuStrip1.SuspendLayout();
            this.SuspendLayout();
            //
            // panItemClient
            //
            this.panItemClient.Controls.Add(this.btnMinus);
            this.panItemClient.Controls.Add(this.btnPlus);
            this.panItemClient.Controls.Add(this.lpOutput);
            this.panItemClient.Size = new System.Drawing.Size(123, 49);
            //
            // lpOutput
            //
            this.lpOutput.AllowDrop = true;
            this.lpOutput.Caption = "output";
            this.lpOutput.ConnectedTo = null;
            this.lpOutput.ConnectionColor = System.Drawing.Color.Empty;
            this.lpOutput.Direction = RE.RELinkPointDirection.Output;
            this.lpOutput.Key = "output";
            this.lpOutput.Location = new System.Drawing.Point(63, 26);
            this.lpOutput.Name = "lpOutput";
            this.lpOutput.Size = new System.Drawing.Size(57, 16);
            this.lpOutput.TabIndex = 0;
            this.lpOutput.Signal += new RE.RELinkPointSignal(this.lpOutput_Signal);
            //
            // btnPlus
            //
            this.btnPlus.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
            this.btnPlus.Image = global::REMulti.Properties.Resources.Plus;
            this.btnPlus.Location = new System.Drawing.Point(3, 3);
            this.btnPlus.Name = "btnPlus";
            this.btnPlus.Size = new System.Drawing.Size(17, 17);
            this.btnPlus.TabIndex = 1;
            this.btnPlus.UseVisualStyleBackColor = true;
            this.btnPlus.Click += new System.EventHandler(this.btnPlus_Click);
            //
            // btnMinus
            //
            this.btnMinus.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
            this.btnMinus.Image = global::REMulti.Properties.Resources.Minus;
            this.btnMinus.Location = new System.Drawing.Point(26, 3);
            this.btnMinus.Name = "btnMinus";
            this.btnMinus.Size = new System.Drawing.Size(17, 17);
            this.btnMinus.TabIndex = 2;
            this.btnMinus.UseVisualStyleBackColor = true;
            this.btnMinus.Click += new System.EventHandler(this.btnMinus_Click);
            //
            // contextMenuStrip1
            //
            this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.passAsItComesToolStripMenuItem});
            this.contextMenuStrip1.Name = "contextMenuStrip1";
            this.contextMenuStrip1.Size = new System.Drawing.Size(163, 26);
            //
            // passAsItComesToolStripMenuItem
            //
            this.passAsItComesToolStripMenuItem.Name = "passAsItComesToolStripMenuItem";
            this.passAsItComesToolStripMenuItem.Size = new System.Drawing.Size(162, 22);
            this.passAsItComesToolStripMenuItem.Text = "Pass as it comes";
            this.passAsItComesToolStripMenuItem.Click += new System.EventHandler(this.passAsItComesToolStripMenuItem_Click);
            //
            // REJoin
            //
            this.Caption = "Join";
            this.MergeContextMenuStrip = this.contextMenuStrip1;
            this.Name = "REJoin";
            this.Resizable = false;
            this.Size = new System.Drawing.Size(130, 74);
            this.Controls.SetChildIndex(this.panItemClient, 0);
            this.panItemClient.ResumeLayout(false);
            this.contextMenuStrip1.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private RE.RELinkPoint lpOutput;
        private System.Windows.Forms.Button btnMinus;
        private System.Windows.Forms.Button btnPlus;
        private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
        private System.Windows.Forms.ToolStripMenuItem passAsItComesToolStripMenuItem;
    }
}


text:
Defining the routing
====================

Each entity requires 6 routes :

- list
- create
- batch
- update
- edit
- delete

The route information is automatically generated for you, so you can jump
straight into the next chapter.


text:
<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?>

<?php
if (isset($args['before_widget']))
{
    echo $args['before_widget'];
}
?>

    <?php
    if (!empty($instance['title']))
    {
        if (isset($args['before_title']))
        {
            echo $args['before_title'];
            echo $instance['title'];
            echo $args['after_title'];
        } else
        {
            ?>

<?php echo $instance['title'] ?>

            <?php
        }
    }
    ?>
    <?php echo do_shortcode('[woocs_converter exclude="' . $instance['exclude'] . '" precision="' . $instance['precision'] . '"]'); ?>

<?php
if (isset($args['after_widget']))
{
    echo $args['after_widget'];
}


text:
FactoryGirl.define do
  factory :surname do
    name "MyString"
  end
end


text:
public class Board {
	public static String COM = "COM0";
	public static int PinCount = 0;
	public static int[] AnalogPinNums = new int[16];
	public static byte[] AnalogPinState = new byte[16];
	public static byte[] DigitalPinState = new byte[16];
	public static byte[] DigitalReportMask = new byte[16];

	public static byte[][] Mode_Masks = new byte[7][16];
	public static int[] CurrentModes = new int[127];

	public static Mainwindow Window;
}