text:
/********************************************************************************
** Form generated from reading UI file 'sendcoinsentry.ui'
**
** Created: Tue Apr 1 19:06:36 2014
**      by: Qt User Interface Compiler version 4.8.4
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/

#ifndef UI_SENDCOINSENTRY_H
#define UI_SENDCOINSENTRY_H

#include <QtCore/QVariant>
#include <QtGui/QAction>
#include <QtGui/QApplication>
#include <QtGui/QButtonGroup>
#include <QtGui/QFrame>
#include <QtGui/QGridLayout>
#include <QtGui/QHBoxLayout>
#include <QtGui/QHeaderView>
#include <QtGui/QLabel>
#include <QtGui/QToolButton>
#include "bitcoinamountfield.h"
#include "qvalidatedlineedit.h"

QT_BEGIN_NAMESPACE

class Ui_SendCoinsEntry
{
public:
    QGridLayout *gridLayout;
    QLabel *label;
    QLabel *label_2;
    BitcoinAmountField *payAmount;
    QHBoxLayout *horizontalLayout_2;
    QValidatedLineEdit *addAsLabel;
    QLabel *label_4;
    QHBoxLayout *payToLayout;
    QValidatedLineEdit *payTo;
    QToolButton *addressBookButton;
    QToolButton *pasteButton;
    QToolButton *deleteButton;

    void setupUi(QFrame *SendCoinsEntry)
    {
        if (SendCoinsEntry->objectName().isEmpty())
            SendCoinsEntry->setObjectName(QString::fromUtf8("SendCoinsEntry"));
        SendCoinsEntry->resize(729, 136);
        SendCoinsEntry->setStyleSheet(QString::fromUtf8("background-color:#04648A;\n"
"color:white;"));
        SendCoinsEntry->setFrameShape(QFrame::StyledPanel);
        SendCoinsEntry->setFrameShadow(QFrame::Sunken);
        gridLayout = new QGridLayout(SendCoinsEntry);
        gridLayout->setSpacing(12);
        gridLayout->setObjectName(QString::fromUtf8("gridLayout"));
        label = new QLabel(SendCoinsEntry);
        label->setObjectName(QString::fromUtf8("label"));
        QFont font;
        font.setFamily(QString::fromUtf8("Segoe UI"));
        label->setFont(font);
        label->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

        gridLayout->addWidget(label, 5, 0, 1, 1);

        label_2 = new QLabel(SendCoinsEntry);
        label_2->setObjectName(QString::fromUtf8("label_2"));
        label_2->setFont(font);
        label_2->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

        gridLayout->addWidget(label_2, 3, 0, 1, 1);

        payAmount = new BitcoinAmountField(SendCoinsEntry);
        payAmount->setObjectName(QString::fromUtf8("payAmount"));
        payAmount->setFont(font);
        payAmount->setStyleSheet(QString::fromUtf8("border: 1px solid #022840;"));

        gridLayout->addWidget(payAmount, 5, 1, 1, 1);

        horizontalLayout_2 = new QHBoxLayout();
        horizontalLayout_2->setSpacing(0);
        horizontalLayout_2->setObjectName(QString::fromUtf8("horizontalLayout_2"));
        addAsLabel = new QValidatedLineEdit(SendCoinsEntry);
        addAsLabel->setObjectName(QString::fromUtf8("addAsLabel"));
        addAsLabel->setEnabled(true);
        addAsLabel->setFont(font);
        addAsLabel->setStyleSheet(QString::fromUtf8("border: 1px solid #022840;"));

        horizontalLayout_2->addWidget(addAsLabel);

        gridLayout->addLayout(horizontalLayout_2, 4, 1, 1, 1);

        label_4 = new QLabel(SendCoinsEntry);
        label_4->setObjectName(QString::fromUtf8("label_4"));
        label_4->setFont(font);
        label_4->setAlignment(Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter);

        gridLayout->addWidget(label_4, 4, 0, 1, 1);

        payToLayout = new QHBoxLayout();
        payToLayout->setSpacing(0);
        payToLayout->setObjectName(QString::fromUtf8("payToLayout"));
        payTo = new QValidatedLineEdit(SendCoinsEntry);
        payTo->setObjectName(QString::fromUtf8("payTo"));
        payTo->setFont(font);
        payTo->setStyleSheet(QString::fromUtf8("border: 1px solid #022840;"));
        payTo->setMaxLength(34);

        payToLayout->addWidget(payTo);

        addressBookButton = new QToolButton(SendCoinsEntry);
        addressBookButton->setObjectName(QString::fromUtf8("addressBookButton"));
        addressBookButton->setFont(font);
        QIcon icon;
        icon.addFile(QString::fromUtf8(":/icons/address-book"), QSize(), QIcon::Normal, QIcon::Off);
        addressBookButton->setIcon(icon);

        payToLayout->addWidget(addressBookButton);

        pasteButton = new QToolButton(SendCoinsEntry);
        pasteButton->setObjectName(QString::fromUtf8("pasteButton"));
        pasteButton->setFont(font);
        QIcon icon1;
        icon1.addFile(QString::fromUtf8(":/icons/editpaste"), QSize(), QIcon::Normal, QIcon::Off);
        pasteButton->setIcon(icon1);

        payToLayout->addWidget(pasteButton);

        deleteButton = new QToolButton(SendCoinsEntry);
        deleteButton->setObjectName(QString::fromUtf8("deleteButton"));
        deleteButton->setFont(font);
        QIcon icon2;
        icon2.addFile(QString::fromUtf8(":/icons/remove"), QSize(), QIcon::Normal, QIcon::Off);
        deleteButton->setIcon(icon2);

        payToLayout->addWidget(deleteButton);

        gridLayout->addLayout(payToLayout, 3, 1, 1, 1);

#ifndef QT_NO_SHORTCUT
        label->setBuddy(payAmount);
        label_2->setBuddy(payTo);
        label_4->setBuddy(addAsLabel);
#endif // QT_NO_SHORTCUT

        retranslateUi(SendCoinsEntry);

        QMetaObject::connectSlotsByName(SendCoinsEntry);
    } // setupUi

    void retranslateUi(QFrame *SendCoinsEntry)
    {
        SendCoinsEntry->setWindowTitle(QApplication::translate("SendCoinsEntry", "Form", 0, QApplication::UnicodeUTF8));
        label->setText(QApplication::translate("SendCoinsEntry", "A&mount:", 0, QApplication::UnicodeUTF8));
        label_2->setText(QApplication::translate("SendCoinsEntry", "Pay &To:", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
        addAsLabel->setToolTip(QApplication::translate("SendCoinsEntry", "Enter a label for this address to add it to your address book", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
        label_4->setText(QApplication::translate("SendCoinsEntry", "&Label:", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
        payTo->setToolTip(QApplication::translate("SendCoinsEntry", "The address to send the payment to  (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
#ifndef QT_NO_TOOLTIP
        addressBookButton->setToolTip(QApplication::translate("SendCoinsEntry", "Choose address from address book", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
        addressBookButton->setText(QString());
        addressBookButton->setShortcut(QApplication::translate("SendCoinsEntry", "Alt+A", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
        pasteButton->setToolTip(QApplication::translate("SendCoinsEntry", "Paste address from clipboard", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
        pasteButton->setText(QString());
        pasteButton->setShortcut(QApplication::translate("SendCoinsEntry", "Alt+P", 0, QApplication::UnicodeUTF8));
#ifndef QT_NO_TOOLTIP
        deleteButton->setToolTip(QApplication::translate("SendCoinsEntry", "Remove this recipient", 0, QApplication::UnicodeUTF8));
#endif // QT_NO_TOOLTIP
        deleteButton->setText(QString());
    } // retranslateUi

};

namespace Ui {
    class SendCoinsEntry: public Ui_SendCoinsEntry {};
} // namespace Ui

QT_END_NAMESPACE

#endif // UI_SENDCOINSENTRY_H


text:
var serviceUrl = "http://localhost:59851/api/chat"

angular.module("chatRoom", [])
	.controller("chatRoomController", ["$scope", "$http", "$timeout", function($scope, $http, $timeout){
		$scope.messages = [{text: "Welcome to the chat room", time: new Date()}]
		$scope.messageText = "";

		var poll = function(){
			$timeout(function () {
				$http.get(serviceUrl)
				.success(function(data, status, headers, config){
					$scope.messages = []
					var length = data.length;

					for(var i = 0; i < length; i++)
					{
						$scope.messages.push({text: data[i].Text, time: data[i].Time});
					}
					poll();
				});
			}, 1000);
		}

		$scope.sendMessage = function() {
			if($scope.messageText != ""){
				var time = new Date();
				$scope.messages.push({text: $scope.messageText, time: time})
				$http.put(serviceUrl, { Text: $scope.messageText, Time: time});
				$scope.messageText = "";
			}
		}

		$scope.clear = function(){
			$scope.messages = [];
		}

		poll();
	}]);

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.ComponentModel;

namespace Azure.Communication.ShortCodes.Models
{
    /// <summary> The cloud that the identifier belongs to. </summary>
    internal readonly partial struct CommunicationCloudEnvironmentModel : IEquatable<CommunicationCloudEnvironmentModel>
    {
        private readonly string _value;

        /// <summary> Initializes a new instance of <see cref="CommunicationCloudEnvironmentModel"/>. </summary>
        /// <exception cref="ArgumentNullException"> <paramref name="value"/> is null. </exception>
        public CommunicationCloudEnvironmentModel(string value)
        {
            _value = value ?? throw new ArgumentNullException(nameof(value));
        }

        private const string PublicValue = "public";
        private const string DodValue = "dod";
        private const string GcchValue = "gcch";

        /// <summary> public. </summary>
        public static CommunicationCloudEnvironmentModel Public { get; } = new CommunicationCloudEnvironmentModel(PublicValue);
        /// <summary> dod. </summary>
        public static CommunicationCloudEnvironmentModel Dod { get; } = new CommunicationCloudEnvironmentModel(DodValue);
        /// <summary> gcch. </summary>
        public static CommunicationCloudEnvironmentModel Gcch { get; } = new CommunicationCloudEnvironmentModel(GcchValue);
        /// <summary> Determines if two <see cref="CommunicationCloudEnvironmentModel"/> values are the same. </summary>
        public static bool operator ==(CommunicationCloudEnvironmentModel left, CommunicationCloudEnvironmentModel right) => left.Equals(right);
        /// <summary> Determines if two <see cref="CommunicationCloudEnvironmentModel"/> values are not the same. </summary>
        public static bool operator !=(CommunicationCloudEnvironmentModel left, CommunicationCloudEnvironmentModel right) => !left.Equals(right);
        /// <summary> Converts a string to a <see cref="CommunicationCloudEnvironmentModel"/>. </summary>
        public static implicit operator CommunicationCloudEnvironmentModel(string value) => new CommunicationCloudEnvironmentModel(value);

        /// <inheritdoc />
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override bool Equals(object obj) => obj is CommunicationCloudEnvironmentModel other && Equals(other);
        /// <inheritdoc />
        public bool Equals(CommunicationCloudEnvironmentModel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);

        /// <inheritdoc />
        [EditorBrowsable(EditorBrowsableState.Never)]
        public override int GetHashCode() => _value?.GetHashCode() ?? 0;
        /// <inheritdoc />
        public override string ToString() => _value;
    }
}


text:
description: Automatically lock Swarm managers to protect encryption keys
keywords: swarm, manager, lock, unlock, autolock, encryption
title: Lock your swarm to protect its encryption key
---

The Raft logs used by swarm managers are encrypted on disk by default. This at-rest
encryption protects your service's configuration and data from attackers who gain
access to the encrypted Raft logs. One of the reasons this feature was introduced
was in support of the [Docker secrets](secrets.md) feature.

When Docker restarts, both the TLS key used to encrypt communication among swarm
nodes, and the key used to encrypt and decrypt Raft logs on disk, are loaded
into each manager node's memory. Docker has the ability to protect the mutual TLS
encryption key and the key used to encrypt and decrypt Raft logs at rest, by
allowing you to take ownership of these keys and to require manual unlocking of
your managers. This feature is called _autolock_.

When Docker restarts, you must
[unlock the swarm](#unlock-a-swarm) first, using a
_key encryption key_ generated by Docker when the swarm was locked. You can
rotate this key encryption key at any time.

> **Note**: You don't need to unlock the swarm when a new node joins the swarm,
> because the key is propagated to it over mutual TLS.

## Initialize a swarm with autolocking enabled

When you initialize a new swarm, you can use the `--autolock` flag to
enable autolocking of swarm manager nodes when Docker restarts.

```console
$ docker swarm init --autolock

Swarm initialized: current node (k1q27tfyx9rncpixhk69sa61v) is now a manager.

To add a worker to this swarm, run the following command:

    docker swarm join \
    --token SWMTKN-1-0j52ln6hxjpxk2wgk917abcnxywj3xed0y8vi1e5m9t3uttrtu-7bnxvvlz2mrcpfonjuztmtts9 \
    172.31.46.109:2377

To add a manager to this swarm, run 'docker swarm join-token manager' and follow the instructions.

To unlock a swarm manager after it restarts, run the `docker swarm unlock`
command and provide the following key:

    SWMKEY-1-WuYH/IX284+lRcXuoVf38viIDK3HJEKY13MIHX+tTt8
```

Store the key in a safe place, such as in a password manager.

When Docker restarts, you need to [unlock the swarm](#unlock-a-swarm). A locked
swarm causes an error like the following when you try to start or restart a
service:

```console
$ sudo service docker restart

$ docker service ls

Error response from daemon: Swarm is encrypted and needs to be unlocked before it can be used. Use "docker swarm unlock" to unlock it.
```

## Enable or disable autolock on an existing swarm

To enable autolock on an existing swarm, set the `autolock` flag to `true`.

```console
$ docker swarm update --autolock=true

Swarm updated.
To unlock a swarm manager after it restarts, run the `docker swarm unlock`
command and provide the following key:

    SWMKEY-1-+MrE8NgAyKj5r3NcR4FiQMdgu+7W72urH0EZeSmP/0Y

Please remember to store this key in a password manager, since without it you
will not be able to restart the manager.
```

To disable autolock, set `--autolock` to `false`. The mutual TLS key and the
encryption key used to read and write Raft logs are stored unencrypted on
disk. There is a trade-off between the risk of storing the encryption key
unencrypted at rest and the convenience of restarting a swarm without
needing to unlock each manager.

```console
$ docker swarm update --autolock=false
```

Keep the unlock key around for a short time after disabling autolocking, in case
a manager goes down while it is still configured to lock using the old key.

## Unlock a swarm

To unlock a locked swarm, use `docker swarm unlock`.

```console
$ docker swarm unlock

Please enter unlock key:
```

Enter the encryption key that was generated and shown in the command output when
you locked the swarm or rotated the key, and the swarm unlocks.

## View the current unlock key for a running swarm

Consider a situation where your swarm is running as expected, then a manager
node becomes unavailable. You troubleshoot the problem and bring the physical
node back online, but you need to unlock the manager by providing the unlock
key to read the encrypted credentials and Raft logs.

If the key has not been rotated since the node left the swarm, and you have a
quorum of functional manager nodes in the swarm, you can view the current unlock
key using `docker swarm unlock-key` without any arguments.

```console
$ docker swarm unlock-key

To unlock a swarm manager after it restarts, run the `docker swarm unlock`
command and provide the following key:

    SWMKEY-1-8jDgbUNlJtUe5P/lcr9IXGVxqZpZUXPzd+qzcGp4ZYA

Please remember to store this key in a password manager, since without it you
will not be able to restart the manager.
```

If the key was rotated after the swarm node became unavailable and you do not
have a record of the previous key, you may need to force the manager to leave
the swarm and join it back to the swarm as a new manager.

## Rotate the unlock key

You should rotate the locked swarm's unlock key on a regular schedule.

```console
$ docker swarm unlock-key --rotate

Successfully rotated manager unlock key.

To unlock a swarm manager after it restarts, run the `docker swarm unlock`
command and provide the following key:

    SWMKEY-1-8jDgbUNlJtUe5P/lcr9IXGVxqZpZUXPzd+qzcGp4ZYA

Please remember to store this key in a password manager, since without it you
will not be able to restart the manager.
```

> **Warning**:
> When you rotate the unlock key, keep a record of the old key
> around for a few minutes, so that if a manager goes down before it gets the new
> key, it may still be unlocked with the old one.
{:.warning}


text:
'use strict';

/**
 * Specifies a metric to load balance a service during runtime.
 *
 */
class ServiceLoadMetricDescription {
  /**
   * Create a ServiceLoadMetricDescription.
   * @member {string} name The name of the metric. If the service chooses to
   * report load during runtime, the load metric name should match the name
   * that is specified in Name exactly. Note that metric names are case
   * sensitive.
   * @member {string} [weight] Possible values include: 'Zero', 'Low',
   * 'Medium', 'High'
   * @member {number} [primaryDefaultLoad] Used only for Stateful services. The
   * default amount of load, as a number, that this service creates for this
   * metric when it is a Primary replica.
   * @member {number} [secondaryDefaultLoad] Used only for Stateful services.
   * The default amount of load, as a number, that this service creates for
   * this metric when it is a Secondary replica.
   * @member {number} [defaultLoad] Used only for Stateless services. The
   * default amount of load, as a number, that this service creates for this
   * metric.
   */
  constructor() {
  }

  /**
   * Defines the metadata of ServiceLoadMetricDescription
   *
   * @returns {object} metadata of ServiceLoadMetricDescription
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ServiceLoadMetricDescription',
      type: {
        name: 'Composite',
        className: 'ServiceLoadMetricDescription',
        modelProperties: {
          name: {
            required: true,
            serializedName: 'Name',
            type: {
              name: 'String'
            }
          },
          weight: {
            required: false,
            serializedName: 'Weight',
            type: {
              name: 'String'
            }
          },
          primaryDefaultLoad: {
            required: false,
            serializedName: 'PrimaryDefaultLoad',
            type: {
              name: 'Number'
            }
          },
          secondaryDefaultLoad: {
            required: false,
            serializedName: 'SecondaryDefaultLoad',
            type: {
              name: 'Number'
            }
          },
          defaultLoad: {
            required: false,
            serializedName: 'DefaultLoad',
            type: {
              name: 'Number'
            }
          }
        }
      }
    };
  }
}

module.exports = ServiceLoadMetricDescription;


text:
const path = require('path');

const _ = require('lodash');
const semver = require('semver');

const deps = require('./util/deps');
const git = require('./util/git');
const pfs = require('./util/pfs');
const promise = require('./util/promise');

module.exports = function(opts) {
  var dir = opts.dir;
  var versionBump = opts.version;

  var absConfigFile = path.join(dir, this.configurationFile);
  var bumped;

  return pfs.readFile(absConfigFile, 'utf8')
    .bind(this)
    .then(JSON.parse)
    .then(function(packageJson) {
      var version = packageJson.version || '0.0.0';

      if (semver.valid(versionBump)) {
        bumped = versionBump;
      } else {
        bumped = semver.inc(version, versionBump);
      }

      this.emit('ok', 'Bumping ' + packageJson.name + ' to ' + bumped + ' ...');

      return [this.configurationFile, 'welder-shrinkwrap.json'];
    })
    .map(function(fileName) {
      return promise.props({
        fileName: fileName,
        exists: pfs.exists(path.join(dir, fileName)),
      });
    })
    .filter(function(fileObj) {
      return fileObj.exists;
    })
    .parallel(function(fileObj) {
      return bumpFile.call(this, dir, fileObj.fileName, bumped)
        .return(fileObj);
    }, {concurrency: 1})
    .map(function(fileObj) {
      return fileObj.fileName;
    })
    .then(function(files) {
      return git.commit(dir, files, bumped);
    })
    .tap(function() { this.emit('ok', 'Committed ' + bumped + '.'); })
    .then(function() {
      return git.tag(dir, bumped, bumped);
    })
    .tap(function() { this.emit('ok', 'Tagged ' + bumped + '.'); });
};

var bumpFile = function bumpFile(dir, fileName, bumped) {
  var log = this.emit.bind(this);
  var absFile = path.join(dir, fileName);

  return pfs.readFile(absFile, 'utf8')
    .bind(this)
    .then(JSON.parse)
    .then(function(json) {
      log('ok', 'Bumping ' + json.name + ' to ' + bumped + ' ...');

      var outObj = {
        name: json.name,
        version: bumped,
      };
      _.each(json, function(v, k) {
        if (!outObj.hasOwnProperty(k)) {
          outObj[k] = v;
        }
      });

      return outObj;
    })
    .then(_.partialRight(JSON.stringify, false, '  '))
    .then(_.partialRight(pfs.writeFile.bind(pfs, absFile), 'utf8'))
    .then(function() { log('ok', 'Updated ' + fileName + '.'); });
};


text:
<?php namespace RainLab\Forum\Components;

use Auth;
use Request;
use Redirect;
use Cms\Classes\Page;
use Cms\Classes\ComponentBase;
use RainLab\Forum\Models\Topic as TopicModel;
use RainLab\Forum\Models\Member as MemberModel;
use RainLab\Forum\Classes\TopicTracker;

/**
 * Topic list component
 *
 * Displays a list of all topics.
 */
class Topics extends ComponentBase
{
    /**
     * @var RainLab\Forum\Models\Member Member cache
     */
    protected $member = null;

    /**
     * @var string Reference to the page name for linking to members.
     */
    public $memberPage;

    /**
     * @var string Reference to the page name for linking to topics.
     */
    public $topicPage;

    /**
     * @var int Number of topics to display per page.
     */
    public $topicsPerPage;

    public function componentDetails()
    {
        return [
            'name'        => 'rainlab.forum::lang.topics.component_name',
            'description' => 'rainlab.forum::lang.topics.component_description',
        ];
    }

    public function defineProperties()
    {
        return [
            'memberPage' => [
                'title'       => 'rainlab.forum::lang.member.page_name',
                'description' => 'rainlab.forum::lang.member.page_help',
                'type'        => 'dropdown'
            ],
            'topicPage' => [
                'title'       => 'rainlab.forum::lang.topic.page_name',
                'description' => 'rainlab.forum::lang.topic.page_help',
                'type'        => 'dropdown',
            ],
            'topicsPerPage' =>  [
                'title'             => 'rainlab.forum::lang.topics.per_page',
                'type'              => 'string',
                'validationPattern' => '^[0-9]+$',
                'validationMessage' => 'rainlab.forum::lang.topics.per_page_validation',
                'default'           => '20',
            ]
        ];
    }

    public function getPropertyOptions($property)
    {
        return Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName');
    }

    public function onRun()
    {
        $this->addCss('assets/css/forum.css');

        $this->prepareVars();

        return $this->prepareTopicList();
    }

    protected function prepareVars()
    {
        /*
         * Page links
         */
        $this->topicPage = $this->page['topicPage'] = $this->property('topicPage');
        $this->memberPage = $this->page['memberPage'] = $this->property('memberPage');
        $this->topicsPerPage = $this->page['topicsPerPage'] = $this->property('topicsPerPage');
    }

    protected function prepareTopicList()
    {
        $currentPage = input('page');
        $searchString = trim(input('search'));
        $topics = TopicModel::with('last_post_member')->listFrontEnd([
            'page'    => $currentPage,
            'perPage' => $this->topicsPerPage,
            'sort'    => 'updated_at',
            'search'  => $searchString,
        ]);

        /*
         * Add a "url" helper attribute for linking to each topic
         */
        $topics->each(function($topic) {
            $topic->setUrl($this->topicPage, $this->controller);

            if ($topic->last_post_member) {
                $topic->last_post_member->setUrl($this->memberPage, $this->controller);
            }

            if ($topic->start_member) {
                $topic->start_member->setUrl($this->memberPage, $this->controller);
            }
        });

        /*
         * Signed in member
         */
        $this->page['member'] = $this->member = MemberModel::getFromUser();

        if ($this->member) {
            $this->member->setUrl($this->memberPage, $this->controller);
            $topics = TopicTracker::instance()->setFlagsOnTopics($topics, $this->member);
        }

        $this->page['topics'] = $this->topics = $topics;

        /*
         * Pagination
         */
        if ($topics) {
            $queryArr = [];
            if ($searchString) {
                $queryArr['search'] = $searchString;
            }
            $queryArr['page'] = '';
            $paginationUrl = Request::url() . '?' . http_build_query($queryArr);

            if ($currentPage > ($lastPage = $topics->lastPage()) && $currentPage > 1) {
                return Redirect::to($paginationUrl . $lastPage);
            }

            $this->page['paginationUrl'] = $paginationUrl;
        }
    }
}


text:
@protocol pjsuaCallDelegate <NSObject>

- (void)pjsuaCallEnded;

- (void)pjsuaCallBegan;
- (void)pjsuaCallFailed;
- (void)pjsuaCallRejected;

@end


text:
# QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from clr import AddReference
AddReference("System")
AddReference("QuantConnect.Algorithm")
AddReference("QuantConnect.Common")

from System import *
from QuantConnect import *
from QuantConnect.Algorithm import *

class LimitFillRegressionAlgorithm(QCAlgorithm):
    '''Basic template algorithm simply initializes the date range and cash'''

    def Initialize(self):
        '''Initialise the data and resolution required, as well as the cash and start-end dates for your algorithm. All algorithms must initialized.'''

        self.SetStartDate(2013,10,07)  #Set Start Date
        self.SetEndDate(2013,10,11)    #Set End Date
        self.SetCash(100000)           #Set Strategy Cash
        # Find more symbols here: http://quantconnect.com/data
        equity = self.AddEquity("SPY", Resolution.Second)
        self.spy = equity.Symbol

        self.mid_datetime = self.StartDate + (self.EndDate - self.StartDate)/2

    def OnData(self, data):
        '''OnData event is the primary entry point for your algorithm. Each new data point will be pumped in here.'''
        if data.ContainsKey(self.spy):
            if self.IsRoundHour(self.Time):
                negative = 1 if self.Time < self.mid_datetime else -1
                self.LimitOrder(self.spy, negative*10, data[self.spy].Price)

    def IsRoundHour(self, dateTime):
        '''Verify whether datetime is round hour'''
        return dateTime.minute == 0 and dateTime.second == 0


text:
/* ###
 * IP: GHIDRA
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package agent.frida.gadp;

import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;

import agent.frida.gadp.impl.FridaGadpServerImpl;
import ghidra.async.AsyncUtils;
import ghidra.dbg.agent.AgentWindow;
import ghidra.util.Msg;

public interface FridaGadpServer extends AutoCloseable {

	/**
	 * The entry point for the Frida server in stand-alone mode
	 *
	 * Run it to see help.
	 *
	 * @param args the command-line arguments
	 * @throws IOException if an I/O error occurs
	 * @throws ExecutionException
	 * @throws InterruptedException
	 */
	public static void main(String[] args) throws Exception {
		new FridaRunner().run(args);
	}

	/**
	 * Create a new instance of the server
	 *
	 * @param addr the address to bind the SCTL server to
	 * @param busId the client ID the server should use on the bus for synthesized commands
	 * @return the server instance
	 * @throws IOException
	 */
	public static FridaGadpServer newInstance(SocketAddress addr) throws IOException {
		return new FridaGadpServerImpl(addr);
	}

	/**
	 * Runs the server from the command line
	 */
	public class FridaRunner {
		protected InetSocketAddress bindTo;
		protected List<String> fridaArgs = new ArrayList<>();
		protected byte busId = 1;
		protected String remote = null;

		public FridaRunner() {
		}

		public void run(String args[])
				throws IOException, InterruptedException, ExecutionException {
			parseArguments(args);

			try (FridaGadpServer server = newInstance(bindTo)) {
				//TODO: fix/test the debugConnect case when args are passed
				server.startFrida(fridaArgs.toArray(new String[] {})).exceptionally(e -> {
					e = AsyncUtils.unwrapThrowable(e);
					Msg.error(this, "Error starting Frida/GADP: " + e);
					System.exit(-1);
					return null;
				});
				new AgentWindow("Frida Agent for Ghidra", server.getLocalAddress());
				while (server.isRunning()) {
					Thread.sleep(1000);
				}
				System.exit(0);
			}
		}

		protected void parseArguments(String[] args) {
			String iface = "localhost";
			int port = 12345;
			// NOTE: Maybe commons-cli or Argparse4j?
			Iterator<String> ait = Arrays.asList(args).iterator();
			while (ait.hasNext()) {
				String a = ait.next();
				if ("-h".equals(a) || "--help".equals(a)) {
					printUsage();
					System.exit(0);
				}
				else if ("-p".equals(a) || "--port".equals(a)) {
					if (!ait.hasNext()) {
						System.err.println("Expected PORT");
						printUsage();
						System.exit(-1);
					}
					String portStr = ait.next();
					try {
						port = Integer.parseInt(portStr);
					}
					catch (NumberFormatException e) {
						System.err.println("Integer required. Got " + portStr);
						printUsage();
						System.exit(-1);
					}
				}
				else if ("-H".equals(a) || "--host".equals(a)) {
					if (!ait.hasNext()) {
						System.err.println("Expected HOST/ADDR");
						printUsage();
						System.exit(-1);
					}
					iface = ait.next();
				}
				else {
					System.err.println("Unknown option: " + a);
					printUsage();
					System.exit(-1);
				}
			}

			bindTo = new InetSocketAddress(iface, port);
		}

		protected void printUsage() {
			System.out.println("This is the GADP server for Frida.  Usage:");
			System.out.println();
			System.out.println("     [-H HOST/ADDR] [-p PORT] [-i ID] [-t TRANSPORT] [-r REMOTE]");
			System.out.println();
			System.out.println("Options:");
			System.out.println(
				"  --host/-H          The address of the interface on which to listen.");
			System.out.println("                     Default is localhost");
			System.out.println(
				"  --port/-p          The TCP port on which to listen for GADP. Default is 12345");
		}
	}

	/**
	 * Start the debugging server
	 *
	 * @return a future that completes when the server is ready
	 */
	CompletableFuture<Void> startFrida(String[] args);

	/**
	 * Get the local address to which the SCTL server is bound.
	 *
	 * @return the local socket address
	 */
	SocketAddress getLocalAddress();

	/**
	 * Close all connections and ports, GADP and Process Server, and terminate the server
	 *
	 * @throws IOException if an I/O error occurs
	 */
	public void terminate() throws IOException;

	/**
	 * Check if the server is running
	 *
	 * This will return false: 1) Before the server has been started, 2) After a call to
	 * {@link #terminate()}, or 3) When an error occurs causing the server to terminate
	 * unexpectedly. Otherwise, it returns true.
	 *
	 * @returns true if the server is currently running.
	 */
	public boolean isRunning();

	/**
	 * Calls {@link #terminate()}
	 *
	 * @throws IOException if an I/O error occurs
	 */
	@Override
	default void close() throws IOException {
		terminate();
	}
}


text:
Parse.initialize("mO5SuziTjoOwT28NdwfTaBkEvGaS1aMIZF0s6GPW", "6uTteekIXC1kbX3RYUgYjTqtgjJlWe4AjeNhG5Ps");

var Album = Parse.Object.extend("Album");
var query = new Parse.Query(Album);
query.notEqualTo("isPlayed",true);
query.ascending("createdAt");

var t=setInterval(printPlaylist,1000);

function printPlaylist(){

    query.find({
        success: function(results){
            var albumsString = "
";
            for(var i = 0; i < results.length; i++){
                var album = results[i];
                albumsString += '
';
                if(i == 0){
                    albumsString += "";
                    $("div#footer").html('<button class="button button-block button-dark" onclick="nextAlbum();">Neste album</button>');
                }
                albumsString += album.get("albumName") + " - " + album.get("artistName") + "
";

                if(i == 0){
                    albumsString += '';
                }
            }
            if(results.length == 0){
                    albumsString += '

Ingen album i køen!';
                    $("div#footer").html('OBS! Legg til album!');
                }

            $("div#nowplaying").html(albumsString);
        }
    ,
       error: function(results, error){
        localStorage.setItem('albumAndArtist', 'redwine');
        localStorage.setItem('album', 'redwine');
         if(localStorage.getItem('albumAndArtist' != 'redwine')){
                    location.reload();
                }
    }
    }

              );

}

function nextAlbum(){
     query.find({
        success: function(results){
           var album = results[0];
            album.save(null, {
              success: function(album) {
                album.set("isPlayed", true);
                album.save();
              }});
    }
    });

}

function bohemian(){
    var BohemianAlbum = Parse.Object.extend("Album");
    var bohemianQuery = new Parse.Query(BohemianAlbum);
    bohemianQuery.equalTo("albumName","bohemian");

    bohemianQuery.find({
        success: function(results){
             var album = results[0];
            album.save(null, {
              success: function(album) {
                album.set("isPlayed", false);
                album.save();
              }});

        }
    });
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/LinearLayout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/TextView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:gravity="left"
        android:text="@string/hello_mentiontlwidget"
        android:textColor="#000000"
        android:textSize="12sp" />

</LinearLayout><!-- Copyright (c) 2013-2015 YA <ya.androidapp@gmail.com> All rights reserved. -->


text:
/* $XConsortium: MultiSinkP.h,v 1.2 94/04/17 20:12:24 kaleb Exp $ */
/* MODIFIED FOR N*XTSTEP LOOK	 				*/
/* Modifications Copyright (c) 1996 by Alfredo Kojima		*/
/* Modifications Copyright (c) 1999 by Carlos A M dos Santos	*/

/*
 * Copyright 1991 by OMRON Corporation
 *
 * Permission to use, copy, modify, distribute, and sell this software and its
 * documentation for any purpose is hereby granted without fee, provided that
 * the above copyright notice appear in all copies and that both that
 * copyright notice and this permission notice appear in supporting
 * documentation, and that the name OMRON not be used in
 * advertising or publicity pertaining to distribution of the software without
 * specific, written prior permission.  OMRON make no representations
 * about the suitability of this software for any purpose.  It is provided
 * "as is" without express or implied warranty.
 *
 * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
 * EVENT SHALL OMRON BE LIABLE FOR ANY SPECIAL, INDIRECT OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
 * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 * PERFORMANCE OF THIS SOFTWARE.
 *
 *      Author: Li Yuhong	 OMRON Corporation
 */

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

Copyright (c) 1987, 1988, 1994  X Consortium

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of the X Consortium shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from the X Consortium.

Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.

                        All Rights Reserved

Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of Digital not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.

DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

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

/*
 * multiSinkP.h - Private definitions for multiSink object
 *
 */

#ifndef _XawMultiSinkP_h
#define _XawMultiSinkP_h

/***********************************************************************
 *
 * MultiSink Object Private Data
 *
 ***********************************************************************/

#include <X11/neXtaw/TextSinkP.h>
#include <X11/neXtaw/MultiSink.h>

/************************************************************
 *
 * New fields for the MultiSink object class record.
 *
 ************************************************************/

typedef struct _MultiSinkClassPart {
  int foo;
} MultiSinkClassPart;

/* Full class record declaration */

typedef struct _MultiSinkClassRec {
    ObjectClassPart     object_class;
    TextSinkClassPart	text_sink_class;
    MultiSinkClassPart	multi_sink_class;
} MultiSinkClassRec;

extern MultiSinkClassRec multiSinkClassRec;

/* New fields for the MultiSink object record */
typedef struct {
    /* public resources */
    Boolean echo;
    Boolean display_nonprinting;
    unsigned long blink_interval;

    /* private state */
    XtIntervalId  timer_id;	/* for cursor blinker */
    GC normgc, invgc, xorgc;
    Pixmap insertCursorOn;
    XawTextInsertState laststate, lastlaststate;
    Boolean	blinking;
    short cursor_x, cursor_y;	/* Cursor Location. */
    XFontSet fontset; /* font set to draw */
} MultiSinkPart;

/****************************************************************
 *
 * Full instance record declaration
 *
 ****************************************************************/

typedef struct _MultiSinkRec {
    ObjectPart          object;
    TextSinkPart	text_sink;
    MultiSinkPart	multi_sink;
} MultiSinkRec;

/********************************************
 *
 * Semi-private functions
 * for use by other Xaw modules only
 *
 *******************************************/

extern void _XawMultiSinkPosToXY(
#if NeedFunctionPrototypes
    Widget			/* w */,
    XawTextPosition		/* pos */,
    Position *			/* x */,
    Position *			/* y */
#endif
);

extern void _Xaw_BlinkCursor(	/* Casantos, Jun 27 1999 */
#if NeedFunctionPrototypes
    XtPointer			/* client_data */,
    XtIntervalId *		/* idp */
#endif
);

#endif /* _XawMultiSinkP_h */


text:
package org.apache.jena.shacl.engine.constraint;

import static org.apache.jena.shacl.compact.writer.CompactOut.compact;
import static org.apache.jena.shacl.lib.ShLib.displayStr;

import java.util.Objects;

import org.apache.jena.atlas.io.IndentedWriter;
import org.apache.jena.graph.Node;
import org.apache.jena.riot.out.NodeFormatter;
import org.apache.jena.shacl.engine.ValidationContext;
import org.apache.jena.shacl.parser.ConstraintVisitor;
import org.apache.jena.shacl.validation.ReportItem;
import org.apache.jena.shacl.vocabulary.SHACL;

/** sh:nodeKind */

public class NodeKindConstraint extends ConstraintTerm {

    //sh:NodeKind: sh:BlankNode, sh:IRI, sh:Literal sh:BlankNodeOrIRI, sh:BlankNodeOrLiteral and sh:IRIOrLiteral.

    private final Node kind;
    private final boolean canBeIRI;
    private final boolean canBeBlankNode;
    private final boolean canBeLiteral;

    public NodeKindConstraint(Node kind) {
        Objects.requireNonNull(kind);
        if ( ! kind.isURI() )
            throw new IllegalArgumentException("NodeKindConstraint; not an IRI for the kind kind");
        this.kind = kind;
        this.canBeIRI       = kind.equals(SHACL.IRI)       || kind.equals(SHACL.BlankNodeOrIRI)     || kind.equals(SHACL.IRIOrLiteral);
        this.canBeBlankNode = kind.equals(SHACL.BlankNode) || kind.equals(SHACL.BlankNodeOrIRI)     || kind.equals(SHACL.BlankNodeOrLiteral);
        this.canBeLiteral   = kind.equals(SHACL.Literal)   || kind.equals(SHACL.BlankNodeOrLiteral) || kind.equals(SHACL.IRIOrLiteral);

        if ( ! canBeIRI && ! canBeBlankNode && ! canBeLiteral )
            throw new IllegalArgumentException(
                "NodeKind["+kind.getLocalName()+"] : "+
                "not one of sh:BlankNode, sh:IRI, sh:Literal sh:BlankNodeOrIRI, sh:BlankNodeOrLiteral and sh:IRIOrLiteral");
    }

    public  Node getKind() { return kind; }

    public boolean isCanBeIRI() {
        return canBeIRI;
    }

    public boolean isCanBeBlankNode() {
        return canBeBlankNode;
    }

    public boolean isCanBeLiteral() {
        return canBeLiteral;
    }

    @Override
    public void visit(ConstraintVisitor visitor){
        visitor.visit(this);
    }

    @Override
    public void printCompact(IndentedWriter out, NodeFormatter nodeFmt) {
        compact(out, nodeFmt, "nodeKind", getKind());
        // Property context only.
//        String s = getKind().getLocalName();
//        out.print(s);
    }

    @Override
    public ReportItem validate(ValidationContext vCxt, Node n) {
        if ( canBeIRI && n.isURI() )          return null;
        if ( canBeBlankNode && n.isBlank() )  return null;
        if ( canBeLiteral && n.isLiteral() )  return null;
        String msg = toString()+" : Expected "+kind.getLocalName()+" for "+displayStr(n);
        return new ReportItem(msg, n);
    }

    @Override
    public Node getComponent() {
        return SHACL.NodeKindConstraintComponent;
    }

    @Override
    public void print(IndentedWriter out, NodeFormatter nodeFmt) {
        out.print(toString());
    }

    @Override
    public String toString() {
        return "NodeKind["+kind.getLocalName()+"]";
    }

    @Override
    public int hashCode() {
        return Objects.hash(canBeBlankNode, canBeIRI, canBeLiteral, kind);
    }

    @Override
    public boolean equals(Object obj) {
        if ( this == obj )
            return true;
        if ( obj == null )
            return false;
        if ( !(obj instanceof NodeKindConstraint) )
            return false;
        NodeKindConstraint other = (NodeKindConstraint)obj;
        return canBeBlankNode == other.canBeBlankNode && canBeIRI == other.canBeIRI && canBeLiteral == other.canBeLiteral
               && Objects.equals(kind, other.kind);
    }

}


text:
var gulp = require('gulp');

gulp.task('build', ['webpack', 'compass', 'images', 'copy']);


text:
@interface TabBtn : UIButton
-(void)setImage:(UIImage *)image title:(NSString *)title titleColor:(UIColor *)titleColor;
@end


text:
<?php echo $title ?>

		<?php echo $content; ?>
		<?php if ( $show_notification_toggle && EE_Registry::instance()->CAP->current_user_can( 'ee_send_message', 'registration_message_type' ) ) : ?>

				<?php _e( 'Send Related Messages?', 'event_espresso' );?>
				<input type="checkbox" value="1" name="txn_reg_status_change[send_notifications]" checked=checked>

<?php _e( 'Send a notification to registrants after processing?', 'event_espresso' );?>

		<?php endif; ?>
		<input id="ee-new-registration-step-button" class="right button button-primary button-large" type="submit" value="<?php echo $step_button_text; ?>" />


text:
namespace nw {

// common
// ref in chrome/browser/renderer_preferences_util.cc
// content/renderer/render_frame_impl.cc
// extensions/browser/app_window/app_window_contents.cc
CONTENT_EXPORT bool GetUserAgentFromManifest(std::string* agent);
// ref in extensions/renderer/dispatcher.cc
CONTENT_EXPORT void SetUserAgentOverride(const std::string& agent,
                         const std::string& name,
                         const std::string& version);

} // nw

#endif // NW_CONTENT_COMMON_HOOKS_H_


text:
package io.vertx.serviceproxy.testmodel;

/**
 * @author Tim Fox
 */
public enum SomeEnum {
  FOO, BAR, WIBBLE
}


text:
package com.epam.ta.reportportal.ws.resolver;

import com.epam.ta.reportportal.commons.Preconditions;
import com.epam.ta.reportportal.commons.querygen.CriteriaHolder;
import com.epam.ta.reportportal.commons.querygen.FilterTarget;
import com.epam.ta.reportportal.commons.validation.BusinessRule;
import com.epam.ta.reportportal.ws.model.ErrorType;
import org.springframework.core.MethodParameter;
import org.springframework.data.domain.Sort;
import org.springframework.data.web.SortHandlerMethodArgumentResolver;
import org.springframework.web.bind.support.WebDataBinderFactory;
import org.springframework.web.context.request.NativeWebRequest;
import org.springframework.web.method.support.ModelAndViewContainer;

import java.util.Optional;
import java.util.stream.StreamSupport;

import static com.epam.ta.reportportal.commons.querygen.constant.GeneralCriteriaConstant.CRITERIA_ID;
import static java.util.stream.Collectors.toList;

/**
 * @author Pavel Bortnik
 */
public class SortArgumentResolver extends SortHandlerMethodArgumentResolver {

	@Override
	public Sort resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest,
			WebDataBinderFactory binderFactory) {

		/*
		 * Resolve sort argument in default way
		 */
		Sort defaultSort = super.resolveArgument(parameter, mavContainer, webRequest, binderFactory);

		/*
		 * Try to find parameter to be sorted in internal-external mapping
		 */
		if (null != parameter.getParameterAnnotation(SortFor.class)) {

			Class<?> domainModelType = parameter.getParameterAnnotation(SortFor.class).value();
			FilterTarget filterTarget = FilterTarget.findByClass(domainModelType);

			/*
			 * Hack. Adds sort by id to each query to avoid problems with
			 * lost data while paging
			 */
			defaultSort = defaultSort.and(Sort.by(CRITERIA_ID));

			/*
			 * Build Sort with search criteria from internal domain model
			 */
			return Sort.by(StreamSupport.stream(defaultSort.spliterator(), false).map(order -> {
				Optional<CriteriaHolder> criteriaHolder = filterTarget.getCriteriaByFilter(order.getProperty());
				BusinessRule.expect(criteriaHolder, Preconditions.IS_PRESENT)
						.verify(ErrorType.INCORRECT_SORTING_PARAMETERS, order.getProperty());
				return new Sort.Order(order.getDirection(), order.getProperty());
			}).collect(toList()));
		} else {
			/*
			 * Return default sort in case there are no SortFor annotation
			 */
			return defaultSort;
		}

	}

}


text:
import argparse
import logging

from ground_surveyor import uf_creator

def main():
    aparser = argparse.ArgumentParser(
        description='Split metatile stack into unit fields.')

    aparser.add_argument('-o', '--output-dir', default='.',
                         help='Directory to put unit fields in.')
    aparser.add_argument('metatiles', nargs='*',
                         help='Input metatiles')

    args = aparser.parse_args()

    logging.basicConfig(level=logging.INFO)
    #logging.basicConfig(level=logging.DEBUG)

    uf_creator.split_metatiles(args.output_dir, args.metatiles)

if __name__ == '__main__':
    main()


text:
@interface RCHSearchProduct : NSObject

@property (copy, nonatomic, nullable) NSString *productID;
@property (copy, nonatomic, nullable) NSString *name;
@property (copy, nonatomic, nullable) NSString *linkID;
@property (copy, nonatomic, nullable) NSString *brand;

@property (copy, nonatomic, nullable) NSNumber *salePriceCents;
@property (copy, nonatomic, nullable) NSNumber *priceCents;

@property (copy, nonatomic, nullable) NSString *clickURL;
@property (copy, nonatomic, nullable) NSString *imageURL;

@end


text:
package bssopenapi

//Licensed under the Apache License, Version 2.0 (the "License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing, software
//distributed under the License is distributed on an "AS IS" BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
//
// Code generated by Alibaba Cloud SDK Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is regenerated.

// DataInQueryOrders is a nested struct in bssopenapi response
type DataInQueryOrders struct {
	HostName   string                 `json:"HostName" xml:"HostName"`
	PageNum    int                    `json:"PageNum" xml:"PageNum"`
	PageSize   int                    `json:"PageSize" xml:"PageSize"`
	TotalCount int                    `json:"TotalCount" xml:"TotalCount"`
	OrderList  OrderListInQueryOrders `json:"OrderList" xml:"OrderList"`
}


text:
package com.sleepycat.je.rep.node.replica;

import java.util.concurrent.TimeUnit;

import com.sleepycat.je.CommitToken;
import com.sleepycat.je.Database;
import com.sleepycat.je.DatabaseConfig;
import com.sleepycat.je.DatabaseNotFoundException;
import com.sleepycat.je.Environment;
import com.sleepycat.je.Transaction;
import com.sleepycat.je.TransactionConfig;
import com.sleepycat.je.rep.CommitPointConsistencyPolicy;
import com.sleepycat.je.rep.DatabasePreemptedException;
import com.sleepycat.je.rep.ReplicatedEnvironment;
import com.sleepycat.je.rep.impl.RepTestBase;
import com.sleepycat.je.rep.utilint.RepTestUtils;
import com.sleepycat.je.rep.utilint.RepTestUtils.RepEnvInfo;
import com.sleepycat.je.utilint.VLSN;

public class ReplayTest extends RepTestBase {

    static final String dbName = "ReplayTestDB";

    @Override
    protected void setUp() throws Exception {
        super.setUp();
    }

    @Override
    protected void tearDown()
        throws Exception {

        super.tearDown();
    }

    /*
     * Tests that a Replica correctly replays a transaction that was resumed
     * after a syncup operation.
     */
    public void testResumedTransaction() {
        ReplicatedEnvironment master = RepTestUtils.joinGroup(repEnvInfo);
        assertTrue(repEnvInfo[1].getEnv().getState().isReplica());
        ReplicatedEnvironment replica = repEnvInfo[1].getEnv();
        Transaction mt1 = master.beginTransaction(null, null);
        String dbName1 = "DB1";
        Database db1m = master.openDatabase(mt1, dbName1, dbconfig);

        /* Leave the transaction open. */

        /* Start a new transaction and get its commit token. */
        Transaction mt2 = master.beginTransaction(null, null);
        String dbName2 = "DB2";
        Database db2 = master.openDatabase(mt1, dbName2, dbconfig);
        db2.put(mt2, key, data);
        db2.close();
        mt2.commit();
        CommitToken ct2 = mt2.getCommitToken();
        db1m.put(mt1, key, data);

        /* Sync replica to mt2, it contains the put of mt1 as well. */
        TransactionConfig rconfig = new TransactionConfig();
        rconfig.setConsistencyPolicy
            (new CommitPointConsistencyPolicy(ct2, 60, TimeUnit.SECONDS));
        Transaction rt1 = replica.beginTransaction(null, rconfig);
        rt1.commit();

        /* Now shut down the replica, with mt1 still open. */
        repEnvInfo[1].closeEnv();

        /* Reopen forcing a sync, rt1 must be resurrected */
        replica = repEnvInfo[1].openEnv();
        db1m.close();
        mt1.commit();
        CommitToken ct1 = mt1.getCommitToken();
        rconfig.setConsistencyPolicy
            (new CommitPointConsistencyPolicy(ct1, 60, TimeUnit.SECONDS));

        Transaction rt2 = null;

        rt2 = replica.beginTransaction(null, rconfig);

        DatabaseConfig dbrconfig = new DatabaseConfig();
        dbrconfig.setAllowCreate(false);
        dbrconfig.setTransactional(true);
        dbrconfig.setSortedDuplicates(false);
        /* Check that rt1 came through and created the DB1 on the replica. */
        Database db1r = replica.openDatabase(rt2, dbName1, dbrconfig);
        db1r.close();
        rt2.commit();
    }

    public void testBasicDatabaseOperations()
        throws Exception {

        ReplicatedEnvironment master = RepTestUtils.joinGroup(repEnvInfo);
        Environment menv = master;

        String truncDbName = "ReplayTestDBTrunc";
        String origDbName = "ReplayTestDBOrig";
        String newDbName = "ReplayTestDBNew";
        String removeDbName = "ReplayTestDBRemove";

        // Create database

        menv.openDatabase(null, truncDbName, dbconfig).close();
        menv.openDatabase(null, origDbName, dbconfig).close();
        menv.openDatabase(null, removeDbName, dbconfig).close();

        RepTestUtils.syncGroupToLastCommit(repEnvInfo, repEnvInfo.length);

        /* make sure they have all showed up. */
        dbconfig.setAllowCreate(false);
        for (RepEnvInfo repi : repEnvInfo) {
            ReplicatedEnvironment rep = repi.getEnv();
            Environment renv = rep;
            renv.openDatabase(null, truncDbName, dbconfig).close();
            renv.openDatabase(null, origDbName, dbconfig).close();
            renv.openDatabase(null, removeDbName, dbconfig).close();
        }
        // Perform the operations on the master.
        menv.truncateDatabase(null, truncDbName, false);
        menv.renameDatabase(null, origDbName, newDbName);
        menv.removeDatabase(null, removeDbName);

        VLSN commitVLSN =
            RepTestUtils.syncGroupToLastCommit(repEnvInfo, repEnvInfo.length);

        /* Verify the changes on the replicators. */
        for (RepEnvInfo repi : repEnvInfo) {
            Environment renv = repi.getEnv();
            // the database should be found
            renv.openDatabase(null, truncDbName, dbconfig).close();
            try {
                renv.openDatabase(null, origDbName, dbconfig).close();
                fail("Expected DatabaseNotFoundException");
            } catch (DatabaseNotFoundException e) {
                // expected
            }
            // renamed db should be found
            renv.openDatabase(null, newDbName, dbconfig).close();
            try {
                renv.openDatabase(null, removeDbName, dbconfig);
                fail("Expected DatabaseNotFoundException");
            } catch (DatabaseNotFoundException e) {
                // expected
            }
        }
        RepTestUtils.checkNodeEquality(commitVLSN, false, repEnvInfo);
    }

    public void testDatabaseOpContention()
        throws Exception {

        ReplicatedEnvironment master = RepTestUtils.joinGroup(repEnvInfo);
        Environment menv = master;
        Environment renv = repEnvInfo[1].getEnv();

        Database mdb = menv.openDatabase(null, dbName, dbconfig);
        mdb.close();
        RepTestUtils.syncGroupToLastCommit(repEnvInfo, repEnvInfo.length);
        Database rdb = renv.openDatabase(null, dbName, dbconfig);
        menv.removeDatabase(null, dbName);
        RepTestUtils.syncGroupToLastCommit(repEnvInfo, repEnvInfo.length);
        try {
            rdb.count();
            fail("Expected exception. Handle should have been invalidated");
        } catch (DatabasePreemptedException e) {
            // expected
        }
    }
}


text:
package org.wso2.maven.bpel.artifact;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.xml.stream.FactoryConfigurationError;

import org.apache.maven.artifact.factory.ArtifactFactory;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.artifact.resolver.ArtifactResolver;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.project.MavenProject;
import org.apache.maven.project.MavenProjectHelper;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.wso2.maven.capp.bundleartifact.AbstractBundlePOMGenMojo;
import org.wso2.maven.capp.model.Artifact;
import org.wso2.maven.capp.model.BundlesDataInfo;
import org.wso2.maven.capp.mojo.AbstractPOMGenMojo;
import org.wso2.maven.capp.utils.CAppMavenUtils;
import org.wso2.maven.capp.utils.WSO2MavenPluginConstantants;

/**
 * This is the Maven Mojo used for generating a pom for a BPEL artifact from the
 * old CApp project structure
 *
 * @goal pom-gen
 *
 */
public class BPELPOMGenMojo extends AbstractBundlePOMGenMojo {
	/**
	 * @parameter default-value="${project}"
	 */
	public MavenProject project;

	/**
	 * Maven ProjectHelper.
	 *
	 * @component
	 */
	public MavenProjectHelper projectHelper;

	/**
	 * The path of the location to output the pom
	 *
	 * @parameter expression="${project.build.directory}/artifacts"
	 */
	public File outputLocation;

	/**
	 * The resulting extension of the file
	 *
	 * @parameter
	 */
	public File artifactLocation;

	/**
	 * POM location for the module project
	 *
	 * @parameter expression="${project.build.directory}/pom.xml"
	 */
	public File moduleProject;

	/**
	 * Group id to use for the generated pom
	 *
	 * @parameter
	 */
	public String groupId;

	/**
	 * Comma separated list of "artifact_type=extension" to be used when
	 * creating dependencies for other capp artifacts
	 *
	 * @parameter
	 */
	public String typeList;

	/**
	 * A list of projects in eclipse workspace which can be referred using maven
	 * groupid, artifactid, version
	 *
	 * @parameter
	 */
	private List<String> projects;

	/**
	 * @component
	 */
	public ArtifactFactory artifactFactory;

	/**
	 * @component
	 */
	public ArtifactResolver resolver;

	/**
	 * @parameter default-value="${localRepository}"
	 */
	public ArtifactRepository localRepository;

	/**
	 * @parameter default-value="${project.remoteArtifactRepositories}"
	 */
	public List<?> remoteRepositories;

	private static final String ARTIFACT_TYPE = "bpel/workflow";

	private BundlesDataInfo bundlesDataInfo;

	private List<String> artifactProjects;

	protected String getArtifactType() {
		return ARTIFACT_TYPE;
	}

	protected List<String> getProjectMapStrings() {
		return projects;
	}

	public ArtifactFactory getArtifactFactory() {
		return artifactFactory;
	}

	public ArtifactResolver getResolver() {
		return resolver;
	}

	public ArtifactRepository getLocalRepository() {
		return localRepository;
	}

	public List<?> getRemoteRepositories() {
		return remoteRepositories;
	}

	protected String getBundleActivatorClass(Artifact artifact) {
		return null;
	}

	protected void addPlugins(MavenProject artifactMavenProject, Artifact artifact) {
		Plugin pluginAxis2 =
		                     CAppMavenUtils.createPluginEntry(artifactMavenProject,
		                                                      "org.wso2.maven",
		                                                      "maven-bpel-plugin",
		                                                      WSO2MavenPluginConstantants.MAVEN_BPEL_PLUGIN_VERSION,
		                                                      true);
		PluginExecution executionAxis2 = new PluginExecution();
		executionAxis2.setId("package-bpel");
		executionAxis2.setPhase("package");
		List goalsAxis2 = new ArrayList<String>();
		goalsAxis2.add("package-bpel");
		executionAxis2.setGoals(goalsAxis2);
		pluginAxis2.addExecution(executionAxis2);

		Xpp3Dom config = (Xpp3Dom) pluginAxis2.getConfiguration();
		Xpp3Dom artifactItems = CAppMavenUtils.createConfigurationNode(config, "artifact");
//		String relativePath =
//		                      org.wso2.developerstudio.eclipse.utils.file.FileUtils.getRelativePath(new File(
//		                                                                              artifact.getFile()
//		                                                                              .getParentFile()
//		                                                                              .getParentFile()
//		                                                                              .getParentFile()
//		                                                                              .getParentFile()
//		                                                                              .getParentFile()
//		                                                                              .getPath() +
//		                                                                              File.separator +
//		                                                                              "target" +
//		                                                                              File.separator +
//		                                                                              "capp" +
//		                                                                              File.separator +
//		                                                                              "artifacts" +
//		                                                                              File.separator +
//		                                                                              artifactMavenProject.getArtifactId()),
//		                                                                              artifact.getFile());
		String relativePath=artifact.getFile().getName();
		artifactItems.setValue(relativePath);
	}

	protected BundlesDataInfo getBundlesDataInfo(File targetProjectLocation, Artifact artifact)
			throws FactoryConfigurationError {
		if (bundlesDataInfo == null) {
			try {
				bundlesDataInfo = new BundlesDataInfo();
				bundlesDataInfo.setProjects(getProjectMappings());
				List<String> artifactProjects = getArtifactProjects();
				for (String artifactProject : artifactProjects) {
					String[] artifactProjectData = artifactProject.split(":");
					if (artifactProjectData.length == 2 && artifactProjectData[0].equals(artifact.getName())) {
						String[] projectNames = artifactProjectData[1].split(",");
						for (String projectName : projectNames) {
							bundlesDataInfo.addProjectToList(projectName, null);
						}
					}
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return bundlesDataInfo;
	}

	public List<String> getArtifactProjects() {
		if (artifactProjects == null) {
			artifactProjects = new ArrayList<String>();
		}
		return artifactProjects;
	}
//
//	public void execute() throws MojoExecutionException, MojoFailureException {
//		// Nothing to do. No need to generate a pom.
//	}

	protected MavenProject createMavenProjectForCappArtifact(Artifact artifact,
	                                                         List<Artifact> artifacts,
	                                                         File projectLocation)
	                                                                              throws MojoExecutionException {
		if (artifact.getFile().getPath().endsWith(".zip")) {
	        MavenProject artifactMavenProject =
	                                            CAppMavenUtils.createMavenProject(artifact,
	                                                                              getGroupId(),
	                                                                              getArtifactType());
	        addDependencies(artifactMavenProject, artifact, projectLocation);
	        // Adding & configuring the plugin section
	        addPlugins(artifactMavenProject, artifact);
	        addMavenDependencies(artifactMavenProject, artifact, artifacts);
	        return artifactMavenProject;
        }else{
        	return null;
        }
	}

	protected void copyResources(MavenProject project, File projectLocation,
	                 			Artifact artifact) throws IOException {
		super.copyResources(project, projectLocation, artifact);
    	File bpelFileOriginal=artifact.getFile();
    	File bpelFileDest=new File(projectLocation+File.separator+bpelFileOriginal.getName());

    	FileUtils.copyFile(bpelFileOriginal, bpelFileDest);
	}

}


text:
import React, { Component } from 'react';

class ItemWithImage extends Component {
  render() {
    const { data }  = this.props;
    return (

        {data.system.name}

    );
  }
}

export default ItemWithImage;


text:
package <%= packageName %>.<%= nounLowercase %>;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.http.MediaType;
import org.springframework.restdocs.RestDocumentation;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.hasSize;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.*;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.document;
import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.get;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.post;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.put;
import static org.springframework.restdocs.mockmvc.RestDocumentationRequestBuilders.delete;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.preprocessResponse;
import static org.springframework.restdocs.operation.preprocess.Preprocessors.prettyPrint;
import static org.springframework.restdocs.payload.PayloadDocumentation.*;
import static org.springframework.restdocs.request.RequestDocumentation.parameterWithName;
import static org.springframework.restdocs.request.RequestDocumentation.pathParameters;
import static org.springframework.restdocs.request.RequestDocumentation.requestParameters;
import static org.springframework.restdocs.snippet.Attributes.key;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;

@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = <%= noun %>Controller.class)
@WebAppConfiguration
@ContextConfiguration(locations = "classpath:/testContext.xml")
public class <%= noun %>ControllerTestDocumentation {

    public static final String PATH = "/<%= nounLowercasePlural %>";

    @Rule
    public final RestDocumentation restDocumentation = new RestDocumentation("target/generated-snippets");

    private ObjectMapper objectMapper = new ObjectMapper();

    @Mock
    private <%= noun %>Service <%= nounLowercase %>Service;

    @InjectMocks
    private <%= noun %>Controller controller;

    private MockMvc mockMvc;

    @Before
    public void setUp() {
        MockitoAnnotations.initMocks(this);
        this.mockMvc = MockMvcBuilders.standaloneSetup(controller)
                .apply(documentationConfiguration(this.restDocumentation)).build();
    }

    @After
    public void tearDown() {
        Mockito.reset();
    }

    @Test
    public void create<%= noun %>() throws Exception {
        final <%= noun %> <%= nounLowercase %> = new <%= noun %>();
        /* TODO - Configure the <%= noun %>'s object state. eg;
         * <%= nounLowercase %>.setId("id");
         * <%= nounLowercase %>.setSomeProperty(9);
         */
        <%= nounLowercase %>.setName("person name");
        <%= nounLowercase %>.setAge(19);
        <%= nounLowercase %>.setEmail("person@email.com");
        this.mockMvc
                .perform(post(PATH)
                        .contentType(MediaType.APPLICATION_JSON)
                        .content(prettyPrintRequest(this.objectMapper.writeValueAsString(<%= nounLowercase %>))))
                .andExpect(status().isCreated())
                .andDo(document(
                        "{class-name}/{method-name}",
                        preprocessResponse(prettyPrint()),
                        requestFields(
                            /* TODO - Describe all mandatory and optional Person JSON request fields. eg;
                             * requestFields(fieldWithPath("mandatoryProperty").description("The Person mandatory mandatoryProperty value.")
                             *  .attributes(key("constraints").value("Must not be null. Must not be empty"))
                             * requestFields((fieldWithPath("optionalProperty").description("The Person optional optionalProperty value.").optional()
                             */
                            fieldWithPath("name").description("The <%= noun %>'s name")
                                .attributes(key("constraints").value("Must not be null. Must not be empty")),
                            fieldWithPath("age").description("The <%= noun %>'s age"),
                            fieldWithPath("email").description("The <%= noun %> email address")
                        )));
        verify(<%= nounLowercase %>Service, atLeastOnce()).create(any(<%= noun %>.class));
    }

    @Test
    public void findOne<%= noun %>() throws Exception {
        final <%= noun %> expected = new <%= noun %>();
        when(<%= nounLowercase %>Service.findOne(any(<%= type %>.class))).thenReturn(expected);
        this.mockMvc
            .perform(get(PATH + "/{id}", "99"))
            .andExpect(status().isOk())
            .andDo(document(
                "{class-name}/{method-name}",
                preprocessResponse(prettyPrint()),
                /* TODO - Replace response fields for the <%= noun %> object. eg;
                 * responseFields((fieldWithPath("someProperty").description("The <%= noun %> someProperty value."))
                 * responseFields((fieldWithPath("optionalProperty").description("The <%= noun %> optional optionalProperty value.").optional()
                 */
                responseFields(
                    fieldWithPath("name").description("The <%= noun %>'s name"),
                    fieldWithPath("age").description("The <%= noun %>'s age"),
                    fieldWithPath("email").description("The <%= noun %>'s email address")
                )));
        verify(<%= nounLowercase %>Service, atLeastOnce()).findOne(any(<%= type %>.class));
    }

    @Test
    public void findOne<%= noun %>NotFound() throws Exception {
        when(<%= nounLowercase %>Service.findOne(any(<%= type %>.class))).thenReturn(null);
        this.mockMvc
            .perform(get(PATH + "/{id}", "invalid"))
            .andExpect(status().isNotFound());
        verify(<%= nounLowercase %>Service, atLeastOnce()).findOne(any(<%= type %>.class));
    }

    @Test
    public void findAll<%= nounPlural %>() throws Exception {
        final <%= noun %> <%= nounLowercase %> = new <%= noun %>();
        /* TODO - Configure and add at least one <%= noun %> to the expected List.
         * <%= nounLowercase %>.setId("id");
         */
        final List<<%= noun %>> expected = new ArrayList<>();
        expected.add(<%= nounLowercase %>);

        when(<%= nounLowercase %>Service.findAll()).thenReturn(expected);
        this.mockMvc
            .perform(get(PATH))
            .andExpect(status().isOk())
            .andDo(document(
                    "{class-name}/{method-name}",
                    preprocessResponse(prettyPrint()),
                    /* TODO - If necessary, describe the findAll response fields (typically wrapped in an array) eg;
                     * responseFields((fieldWithPath("[]").description("An array of <%= noun %>s"))
                     * responseFields((fieldWithPath("[].property").description("The <%= noun %> property value."))
                     */
                    responseFields(
                        fieldWithPath("[]").description("An array of <%= noun %>s"))
                ));
        verify(<%= nounLowercase %>Service, atLeastOnce()).findAll();
    }

    @Test
    public void findAll<%= nounPlural %>Paginated() throws Exception {
        final int TOTAL = 10;
        final int PER_PAGE = TOTAL / 2;
        final List<<%= noun %>> expected = new ArrayList<>(TOTAL);

        /* TODO - Configure an expected list of <%= nounPlural %> with some identifiable attribute to verify
         * Needs to be greater than the requested page size in order for pagination.
         */
        for (int i = 0; i < TOTAL; i++) {
            final <%= noun %> <%= nounLowercase %> = new <%= noun %>();
            <%= nounLowercase %>.setName("name" + i);
            expected.add(<%= nounLowercase %>);
        }
        when(<%= nounLowercase %>Service.findAll()).thenReturn(expected);

        this.mockMvc
                .perform(get(PATH)
                        /* TODO - Configure the page index to get and the total number per page. eg;
                         * Get the 2nd page, where each page contains half the total collection
                         */
                        .param("page", "1")
                        .param("size", String.valueOf(PER_PAGE)))
                .andExpect(status().isOk())
                .andExpect(jsonPath("$", hasSize(PER_PAGE)))
                // TODO - Verify the 1st object in the response is the expected object (after pagination)
                .andExpect(jsonPath("$[0].name", is("name" + PER_PAGE)))
                .andDo(document(
                        "{class-name}/{method-name}",
                        preprocessResponse(prettyPrint()),
                        /* TODO - Describe the parameters for the paginated request.
                         * parameterWithName("page").description("The requested page index")
                         * parameterWithName("size").description("The requested number of people per page")
                         */
                        requestParameters(
                                parameterWithName("page").description("The requested page index"),
                                parameterWithName("size").description("The requested number of people per page")
                        )));

        verify(<%= nounLowercase %>Service, atLeastOnce()).findAll();
    }

    @Test
    public void update<%= noun %>() throws Exception {
        // TODO - Configure the <%= noun %>'s state and an expected updated state. eg;
        final String unchangedValue = "person name";
        final <%= noun %> original = new <%= noun %>();
        original.setName(unchangedValue);
        original.setAge(1);
        final <%= noun %> updated = new <%= noun %>();
        updated.setName(unchangedValue);
        updated.setAge(2);

        when(<%= nounLowercase %>Service.update(original)).thenReturn(updated);
        this.mockMvc
                .perform(put(PATH)
                        .contentType(MediaType.APPLICATION_JSON)
                        .content(prettyPrintRequest(this.objectMapper.writeValueAsString(original))))
                .andExpect(status().isOk())
                // TODO - Verify the updated object was returned eg;
                .andExpect(jsonPath("$.name", is(unchangedValue)))
                .andExpect(jsonPath("$.age", is(2)))
                .andDo(document(
                        "{class-name}/{method-name}",
                        preprocessResponse(prettyPrint()),
                        /* TODO - If necessary, describe JSON request fields. eg;
                         * requestFields(fieldWithPath("mandatoryProperty").description("The Person mandatory mandatoryProperty value.")
                         *  .attributes(key("constraints").value("Must not be null. Must not be empty"))
                         * requestFields((fieldWithPath("optionalProperty").description("The Person optional optionalProperty value.").optional()
                         */
                        requestFields(
                                fieldWithPath("name").description("The <%= noun %>'s name")
                                        .attributes(key("constraints").value("Must not be null. Must not be empty")),
                                fieldWithPath("age").description("The <%= noun %>'s age"),
                                fieldWithPath("email").description("The <%= noun %> email address")
                        )));

        verify(<%= nounLowercase %>Service, atLeastOnce()).update(original);
    }

    @Test
    public void delete<%= noun %>() throws Exception {
        this.mockMvc
                .perform(delete(PATH + "/{id}", "99"))
                .andExpect(status().isOk())
                .andDo(document(
                        "{class-name}/{method-name}",
                        preprocessResponse(prettyPrint()),
                        pathParameters(
                             /* TODO - Describe the path parameter. eg;
                             * parameterWithName("id").description("The name of the <%= noun %> to delete")),
                             */
                                parameterWithName("id").description("The name of the <%= noun %> to delete")
                        )));
        verify(<%= nounLowercase %>Service, atLeastOnce()).delete("99");
    }

    @Test
    public void deleteAll<%= nounPlural %>() throws Exception {
        this.mockMvc
                .perform(delete(PATH))
                .andExpect(status().isOk())
                .andDo(document(
                        "{class-name}/{method-name}",
                        preprocessResponse(prettyPrint())
                ));
        verify(<%= nounLowercase %>Service, atLeastOnce()).deleteAll();
    }

    <%- include snippets/NounControllerDocumentation-with-filter.ejs -%>

    private String prettyPrintRequest(String original) throws IOException {
        ObjectMapper mapper = new ObjectMapper().configure(SerializationFeature.INDENT_OUTPUT, true);
        return mapper.writeValueAsString(mapper.readTree(original));
    }

}


text:
require 'simplecov'
SimpleCov.start do
  add_filter "/vendor/"
end

require 'chef/zero/datastores/fallback_datastore'
require 'chef/zero/datastores/filesystem_datastore'


text:
package se.sics.mspsim.core;

import java.util.Arrays;

public class ADC12 extends IOUnit {

  public static final int ADC12CTL0 = 0x01A0;// Reset with POR
  public static final int ADC12CTL1 = 0x01A2;// Reset with POR
  public static final int ADC12IFG = 0x01A4; //Reset with POR
  public static final int ADC12IE = 0x01A6; //Reset with POR
  public static final int ADC12IV = 0x01A8; //Reset with POR
  public static final int ADC12MEM0 = 0x0140; //Unchanged
  public static final int ADC12MEM1 = 0x0142; //Unchanged
  public static final int ADC12MEM2 = 0x0144; //Unchanged
  public static final int ADC12MEM3 = 0x0146; //Unchanged
  public static final int ADC12MEM4 = 0x0148; //Unchanged
  public static final int ADC12MEM5 = 0x014A; //Unchanged
  public static final int ADC12MEM6 = 0x014C; //Unchanged
  public static final int ADC12MEM7 = 0x014E; //Unchanged
  public static final int ADC12MEM8 = 0x0150; //Unchanged
  public static final int ADC12MEM9 = 0x0152; //Unchanged
  public static final int ADC12MEM10 = 0x0154; //Unchanged
  public static final int ADC12MEM11 = 0x0156; //Unchanged
  public static final int ADC12MEM12 = 0x0158; //Unchanged
  public static final int ADC12MEM13 = 0x015A; //Unchanged
  public static final int ADC12MEM14 = 0x015C; //Unchanged
  public static final int ADC12MEM15 = 0x015E; //Unchanged
  public static final int ADC12MCTL0 = 0x080; //Reset with POR
  public static final int ADC12MCTL1 = 0x081; //Reset with POR
  public static final int ADC12MCTL2 = 0x082; //Reset with POR
  public static final int ADC12MCTL3 = 0x083; //Reset with POR
  public static final int ADC12MCTL4 = 0x084; //Reset with POR
  public static final int ADC12MCTL5 = 0x085; //Reset with POR
  public static final int ADC12MCTL6 = 0x086; //Reset with POR
  public static final int ADC12MCTL7 = 0x087; //Reset with POR
  public static final int ADC12MCTL8 = 0x088; //Reset with POR
  public static final int ADC12MCTL9 = 0x089; //Reset with POR
  public static final int ADC12MCTL10 = 0x08A; //Reset with POR
  public static final int ADC12MCTL11 = 0x08B; //Reset with POR
  public static final int ADC12MCTL12 = 0x08C; //Reset with POR
  public static final int ADC12MCTL13 = 0x08D; //Reset with POR
  public static final int ADC12MCTL14 = 0x08E; //Reset with POR
  public static final int ADC12MCTL15 = 0x08F; //Reset with POR

  public static final int[] SHTBITS = new int[] {
    4, 8, 16, 32, 64, 96, 128, 192,
    256, 384, 512, 768, 1024, 1024, 1024, 1024
  };

  public static final int BUSY_MASK = 0x01;
  public static final int EOS_MASK = 0x80;

  public static final int CONSEQ_SINGLE = 0x00;
  public static final int CONSEQ_SEQUENCE = 0x01;
  public static final int CONSEQ_REPEAT_SINGLE = 0x02;
  public static final int CONSEQ_REPEAT_SEQUENCE = 0x03;
  public static final int CONSEQ_SEQUENCE_MASK = 0x01;

  private int adc12ctl0 = 0;
  private int adc12ctl1 = 0;
  private int[] adc12mctl = new int[16];
  private int[] adc12mem = new int[16];
  private int adc12Pos = 0;

  private int shTime0 = 4;
  private int shTime1 = 4;
  private boolean adc12On = false;
  private boolean enableConversion;
  private boolean startConversion;
  private boolean isConverting;

  private int shSource = 0;
  private int startMem = 0;
  private int adcDiv = 1;

  private ADCInput adcInput[] = new ADCInput[16];

  private int conSeq;
  private int adc12ie;
  private int adc12ifg;
  private int adc12iv;

  private int adcSSel;
  private int adc12Vector = 7;

  private TimeEvent adcTrigger = new TimeEvent(0) {
    public void execute(long t) {
//      System.out.println(getName() + " **** executing update timers at " + t + " cycles=" + cpu.cycles);
      convert();
    }
  };

  public ADC12(MSP430Core cpu) {
    super("ADC12", cpu, cpu.memory, 0);
  }

  public void reset(int type) {
    enableConversion = false;
    startConversion = false;
    isConverting = false;
    adc12ctl0 = 0;
    adc12ctl1 = 0;
    shTime0 = shTime1 = 4;
    adc12On = false;
    shSource = 0;
    startMem = adc12Pos = 0;
    adcDiv = 1;

    conSeq = 0;
    adc12ie = 0;
    adc12ifg = 0;
    adc12iv = 0;
    adcSSel = 0;

    Arrays.fill(adc12mctl, 0);
  }

  public void setADCInput(int adindex, ADCInput input) {
    adcInput[adindex] = input;
  }

  // write a value to the IO unit
  public void write(int address, int value, boolean word, long cycles) {
    switch (address) {
    case ADC12CTL0:
      if (enableConversion) {
        // Ongoing conversion: only some parts may be changed
        adc12ctl0 = (adc12ctl0 & 0xfff0) + (value & 0xf);
      } else {
        adc12ctl0 = value;
        shTime0 = SHTBITS[(value >> 8) & 0x0f];
        shTime1 = SHTBITS[(value >> 12) & 0x0f];
        adc12On = (value & 0x10) > 0;
      }
      enableConversion = (value & 0x02) > 0;
      startConversion = (value & 0x01) > 0;

      if (DEBUG) log("Set SHTime0: " + shTime0 + " SHTime1: " + shTime1 + " ENC:" +
          enableConversion + " Start: " + startConversion + " ADC12ON: " + adc12On);
      if (adc12On && enableConversion && startConversion && !isConverting) {
        // Set the start time to be now!
        isConverting = true;
        adc12Pos = startMem;
        int delay = adcDiv * ((adc12Pos < 8 ? shTime0 : shTime1) + 13);
        cpu.scheduleTimeEvent(adcTrigger, cpu.getTime() + delay);
      }
      break;
    case ADC12CTL1:
      if (enableConversion) {
        // Ongoing conversion: only some parts may be changed
        adc12ctl1 = (adc12ctl1 & 0xfff8) + (value & 0x6);
      } else {
        adc12ctl1 = value & 0xfffe;
        startMem = (value >> 12) & 0xf;
        shSource = (value >> 10) & 0x3;
        adcDiv = ((value >> 5) & 0x7) + 1;
        adcSSel = (value >> 3) & 0x03;
      }
      conSeq = (value >> 1) & 0x03;
      if (DEBUG) log("Set startMem: " + startMem + " SHSource: " + shSource +
          " ConSeq-mode:" + conSeq + " Div: " + adcDiv + " ADCSSEL: " + adcSSel);
      break;
    case ADC12IE:
      adc12ie = value;
      break;
    case ADC12IFG:
      adc12ifg = value;
      break;
    default:
      if (address >= ADC12MCTL0 && address <= ADC12MCTL15)  {
        if (enableConversion) {
          /* Ongoing conversion: not possible to modify */
        } else {
          adc12mctl[address - ADC12MCTL0] = value & 0xff;
          if (DEBUG) log("ADC12MCTL" + (address - ADC12MCTL0)
              + " source = " + (value & 0xf)
              + (((value & EOS_MASK) != 0) ? " EOS bit set" : ""));
        }
      }
    }
  }

  // read a value from the IO unit
  public int read(int address, boolean word, long cycles) {
    switch(address) {
    case ADC12CTL0:
      return adc12ctl0;
    case ADC12CTL1:
      return isConverting ? (adc12ctl1 | BUSY_MASK) : adc12ctl1;
    case ADC12IE:
      return adc12ie;
    case ADC12IFG:
      return adc12ifg;
    default:
      if (address >= ADC12MCTL0 && address <= ADC12MCTL15)  {
        return adc12mctl[address - ADC12MCTL0];
      } else if (address >= ADC12MEM0 && address <= ADC12MEM15) {
        int reg = (address - ADC12MEM0) / 2;
        // Clear ifg!
        adc12ifg &= ~(1 << reg);
//        System.out.println("Read ADCMEM" + (reg / 2));
        if (adc12iv == reg * 2 + 6) {
          cpu.flagInterrupt(adc12Vector, this, false);
          adc12iv = 0;
//          System.out.println("** de-Trigger ADC12 IRQ for ADCMEM" + adc12Pos);
        }
        return adc12mem[reg];
      }
    }
    return 0;
  }

  int smp = 0;
  private void convert() {
    // If off then just return...
    if (!adc12On) {
      isConverting = false;
      return;
    }
    boolean runAgain = enableConversion && conSeq != CONSEQ_SINGLE;
    // Some noise...
    ADCInput input = adcInput[adc12mctl[adc12Pos] & 0xf];
    adc12mem[adc12Pos] = input != null ? input.nextData() : 2048 + 100 - smp & 255;
    smp += 7;
    adc12ifg |= (1 << adc12Pos);
    if ((adc12ie & (1 << adc12Pos)) > 0) {
      // This should check if there already is an higher iv!
      adc12iv = adc12Pos * 2 + 6;
      //System.out.println("** Trigger ADC12 IRQ for ADCMEM" + adc12Pos);
      cpu.flagInterrupt(adc12Vector, this, true);
    }
    if ((conSeq & CONSEQ_SEQUENCE_MASK) != 0) {
      // Increase
      if ((adc12mctl[adc12Pos] & EOS_MASK) == EOS_MASK) {
        adc12Pos = startMem;
        if (conSeq == CONSEQ_SEQUENCE) {
          // Single sequence only
          runAgain = false;
        }
      } else {
        adc12Pos = (adc12Pos + 1) & 0x0f;
      }
    }
    if (!runAgain) {
      isConverting = false;
    } else {
      int delay = adcDiv * ((adc12Pos < 8 ? shTime0 : shTime1) + 13);
      cpu.scheduleTimeEvent(adcTrigger, adcTrigger.time + delay);
    }
  }

  public void interruptServiced(int vector) {
  }
}


text:
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
. $SCRIPT_DIR/environment.sh

echo "Running from directory $GIT_DIR as user "`whoami`
echo "Doing initial installation"
echo "Installing npm packages"
$GIT_DIR/web/scripts/install-npm.sh
echo "Installing npm packages"
$GIT_DIR/web/scripts/install-python.sh
echo "Installing misc"
$GIT_DIR/git/setup-misc.sh
$GIT_DIR/git/rebuild-misc.sh
echo "Installing R packages"
$GIT_DIR/web/scripts/install-r-pkgs.sh

#set wiki conf
echo "Set up wiki"
sudo /usr/share/bitquant/conf.sh /wiki-unlock
sudo /usr/share/bitquant/conf.sh /wiki-init

echo "Set up ipython"
mkdir -p $MY_HOME/ipython
ln -s -f ../git/bitquant/web/home/ipython/examples $MY_HOME/ipython/examples

echo "Set up R"
mkdir -p $MY_HOME/R
cp -r $GIT_DIR/web/home/R/* $MY_HOME/R

# Refresh configurations
sudo /usr/share/bitquant/conf.sh /default-init


text:
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using Saltarelle.Compiler.JSModel.Expressions;

namespace Saltarelle.Compiler.JSModel.TypeSystem {
	public class JsNamedConstructor {
		public string Name { get; private set; }
		public JsFunctionDefinitionExpression Definition { get; private set; }

		public JsNamedConstructor(string name, JsFunctionDefinitionExpression definition) {
			Name       = name;
			Definition = definition;
		}
	}
}


text:
<?php

namespace TestBundle\testBundle\Tests\Controller;

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

class postControllerTest extends WebTestCase
{
    public function testComment()
    {
        $client = static::createClient();

        $crawler = $client->request('GET', '/comment');
    }

}


text:
package org.adaptlab.chpir.android.participanttracker.models;

import android.util.Log;

import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;
import com.activeandroid.query.Select;

import org.adaptlab.chpir.android.activerecordcloudsync.ReceiveModel;
import org.adaptlab.chpir.android.participanttracker.AppUtil;
import org.json.JSONException;
import org.json.JSONObject;

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

@Table(name = "ParticipantType")
public class ParticipantType extends ReceiveModel {
    private static final String TAG = "ParticipantType";

    @Column(name = "Label")
    private String mLabel;
    @Column(name = "RemoteId", unique = true, onUniqueConflict = Column.ConflictAction.REPLACE)
    private Long mRemoteId;

    public ParticipantType() {
        super();
    }

    @Override
    public void createObjectFromJSON(JSONObject jsonObject) {
        try {
            Long remoteId = jsonObject.getLong("id");
            ParticipantType participantType = ParticipantType.findByRemoteId(remoteId);
            if (participantType == null) {
                participantType = this;
            }

            Log.i(TAG, "Creating object from JSON Object: " + jsonObject);
            participantType.setLabel(jsonObject.getString("label"));
            participantType.setRemoteId(remoteId);
            if (jsonObject.isNull("deleted_at")) {
            	participantType.save();
            } else {
            	ParticipantType pt = ParticipantType.findByRemoteId(remoteId);
            	if (pt != null) {
            		pt.delete();
            	}
            }
        } catch (JSONException je) {
            Log.e(TAG, "Error parsing object json", je);
        }
    }

    /*
     * Finders
     */
    public static List<ParticipantType> getAll() {
        return new Select().from(ParticipantType.class).orderBy("Id ASC").execute();
    }

    public static ParticipantType findByRemoteId(Long id) {
        return new Select().from(ParticipantType.class).where("RemoteId = ?", id).executeSingle();
    }

    public List<RelationshipType> getRelationshipTypes() {
        return new Select().from(RelationshipType.class).where("OwnerParticipantType = ?", getId()).execute();
    }

    public static int getCount() {
       return getAll().size();
    }

    public static ParticipantType findById(Long id) {
        return new Select().from(ParticipantType.class).where("Id = ?", id).executeSingle();
    }

    public List<Property> getProperties() {
        return Property.getAllByParticipantType(this);
    }

    /*
     * Getters / Setters
     */

    public String getLabel() {
        if (mLabel == null) return "";
        int labelId = AppUtil.getContext().getResources().getIdentifier(mLabel.toLowerCase(), "string", AppUtil.getContext().getPackageName());
        if (labelId == 0)
            return mLabel;
        else
            return AppUtil.getContext().getResources().getString(labelId);
    }

    public Long getRemoteId() {
        return mRemoteId;
    }

    @Override
    public String toString() {
        return getLabel();
    }

    public void setLabel(String label) {
        mLabel = label;
    }

    public static List<String> getTypeLabels() {
        List<String> types = new ArrayList<String>();

        for (ParticipantType participantType : ParticipantType.getAll()) {
            types.add(participantType.getLabel());
        }

        return types;
    }

    private void setRemoteId(Long remoteId) {
        mRemoteId = remoteId;
    }
}


text:
package org.gradle.internal.resolve.resolver;

import org.gradle.api.internal.artifacts.ResolveContext;
import org.gradle.internal.resolve.result.BuildableComponentResolveResult;

/**
 * Resolves a context to the meta-data for the provided {@link ResolveContext}.
 */
public interface ResolveContextToComponentResolver {
    void resolve(ResolveContext resolveContext, BuildableComponentResolveResult result);
}