text:
package com.taobao.dexposed;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.TextView;

import com.taobao.android.dexposed.XC_MethodHook;
import com.taobao.android.dexposed.DexposedBridge;
import com.taobao.patch.PatchMain;
import com.taobao.patch.PatchResult;

import java.io.File;

public class MainActivity extends Activity {

	private boolean isSupport = false;

    private boolean isLDevice= false;

	private TextView mLogContent;

	private boolean isPathed=false;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		mLogContent = (TextView) (this.findViewById(R.id.log_content));
		// check device if support and auto load libs
        isSupport = DexposedBridge.canDexposed(this);
        //isLDevice = android.os.Build.VERSION.SDK_INT == 21;

	}

	//Hook system log click
	public void hookSystemLog(View view) {
		if (isSupport) {
			DexposedBridge.findAndHookMethod(isLDevice ? this.getClass(): Log.class, isLDevice ? "showLog" : "d", String.class, String.class, new XC_MethodHook() {
				@Override
				protected void afterHookedMethod(MethodHookParam arg0) throws Throwable {
					String tag = (String) arg0.args[0];
					String msg = (String) arg0.args[1];
					mLogContent.setText(tag + "," + msg);
				}
			});
            if (isLDevice) {
                showLog("dexposed", "It doesn't support AOP to system method on ART devices");
            } else {
                Log.d("dexposed", "Logs are redirected to display here");
            }
		} else {
			mLogContent.setText("This device doesn't support dexposed!");
		}
	}

    private void showLog(String tag, String msg) {
        Log.d(tag, msg);
    }

	// Hook choreographer click
	public void hookChoreographer(View view) {
		Log.d("dexposed", "hookChoreographer button clicked.");
		if (isSupport && !isLDevice) {
			ChoreographerHook.instance().start();
		} else {
			showLog("dexposed", "This device doesn't support this!");
		}
	}

	// Run patch apk
	public void runPatchApk(View view) {
		Log.d("dexposed", "runPatchApk button clicked.");
        if (isLDevice) {
            showLog("dexposed", "It doesn't support this function on L device.");
            return;
        }
        if (!isSupport) {
			Log.d("dexposed", "This device doesn't support dexposed!");
			return;
		}
		patch();
    	showDialog();
	}

	private void patch(){
		File cacheDir = getExternalCacheDir();
		if(cacheDir != null){
			String fullpath = "/sdcard/app-debug.apk";
			File file=new File(fullpath);

			PatchResult result = PatchMain.load(this, fullpath, null);
			isPathed=result.isSuccess();
			if (result.isSuccess()) {
				Log.e("Hotpatch", "patch success!");
			} else {
				Log.e("Hotpatch", "patch error is " + result.getErrorInfo());
			}
		}
	}

	private void showDialog() {
		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder.setTitle("Dexposed sample")
				.setMessage(
						"Hotpatch failure,please check the os version and service info.\"")
				.setPositiveButton("ok", new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int whichButton) {
					}
				}).create().show();
	}

	public void checkFragment(View view){
		if(!isPathed){
			patch();
		}
		Intent intent=new Intent(this,FragmentActivity.class);
		startActivity(intent);
	}
}


text:
$(document).ready(function () {
	$("#secondPageButton").click(function () {
		var dialogDivTwo = window.parent.$("

")
			.data("modalDataProperty", $("#secondPageInput").val())
			.dialog({
				closeOnEscape: false,
				title: "second modal dialog",
				modal: true,
				close: function (event, ui) {
					dialogDivTwo.dialog('destroy').remove();
				},
				width: 400
			});
	});

	$("#content").text(window.parent.$(window.frameElement.parentElement).data("modalDataProperty"));
});

redpajama_set_name: RedPajamaGithub


text:
/* eslint-disable no-unused-expressions */
process.env.NODE_ENV = 'test'; // eslint-disable-line
const Competition = require('../../lib/models/competition');
const User = require('../../lib/models/user');
const expect = require('chai').expect;
const chai = require('chai');
const chaiHttp = require('chai-http');
chai.use(chaiHttp);
const fetch = require('isomorphic-fetch');
const server = require('../../lib/server.js');
const competitionFixtures = require('../fixtures/competitions.json');
const userFixtures = require('../fixtures/users.json');
const userService = require('../../lib/services/user-services');

// We need these in our tests aswell
require('babel-core/register')({
    plugins: ['transform-object-rest-spread', 'transform-async-to-generator', 'transform-class-properties', 'transform-regenerator'],
    presets: ['es2015', 'es2017', 'react']
});
require('babel-polyfill');

describe('Competition Routes', () => {

    // Need token in the route. This should probably be handled in a better way...
    let token, user;

    before(async () => {
        await server.start();
        await Competition.remove({});
        await User.remove({});
        await User.create(userFixtures);
        await Competition.create(competitionFixtures);
        user = await userService.findOneById('59201c9042a6483b7e72a309');
        token = user.generateJWT();
        Promise.resolve();
    });

    after(async () => {
        await Competition.remove({});
        await User.remove({});
        await server.stop();
        Promise.resolve();
    });

    beforeEach(async () => {
        // Make sure DB is clean. Then populate it with our predefined users. All passwords are set to 'test'
        await Competition.remove({});
        await User.remove({});
        await User.create(userFixtures);
        await Competition.create(competitionFixtures);
    });

    it('Should be able to close a competition', async () => {
        let options = {
            method: 'POST',
            headers: {
                'Accept': 'application/json',
                'Content-Type': 'application/json',
                'authorization': token
            },
            body: JSON.stringify({'competitionId': '59201c9042a6483b7e72a320'})
        };

        const fetchRes = await fetch('http://localhost:8080/api/competitions/close', options);
        expect(fetchRes).to.have.status(200);
        const res = await fetchRes.json();
        expect(res).to.have.property('success');
        expect(res.success).to.equal(true);
    });

    /*
    // Todo in this: Need bets in the comp.
    // Need a real league id? So we can calc errors. Should we make api call to everysport??
    it('Should be able to finalize a competition', async () => {
        let options = {
            method: 'POST',
            headers: {
                'Accept': 'application/json',
                'Content-Type': 'application/json',
                'authorization': token
            },
            body: JSON.stringify({'competitionId': '59201c9042a6483b7e72a321'})
        };

        const fetchRes = await fetch('http://localhost:8080/api/competitions/finalize', options);
        expect(fetchRes).to.have.status(200);
        const res = await fetchRes.json();
        expect(res).to.have.property('success');
        expect(res.success).to.equal(true);
    });
    */

    it('Should not be able to finalize a competition if its still open', async () => {
        let options = {
            method: 'POST',
            headers: {
                'Accept': 'application/json',
                'Content-Type': 'application/json',
                'authorization': token
            },
            body: JSON.stringify({'competitionId': '59201c9042a6483b7e72a320'})
        };

        const fetchRes = await fetch('http://localhost:8080/api/competitions/finalize', options);
        expect(fetchRes).to.have.status(400);
        const res = await fetchRes.json();
        expect(res).to.have.property('errorMessage');
        expect(res.errorMessage).to.equal('not-closed');
    });
});


text:
<?php declare(strict_types=1);

namespace Composer\Package;

/**
 * Defines package metadata that is not necessarily needed for solving and installing packages
 *
 * PackageInterface & derivatives are considered internal, you may use them in type hints but extending/implementing them is not recommended and not supported. Things may change without notice.
 *
 * @author Nils Adermann <naderman@naderman.de>
 */
interface CompletePackageInterface extends PackageInterface
{
    /**
     * Returns the scripts of this package
     *
     * @return array<string, string[]> Map of script name to array of handlers
     */
    public function getScripts(): array;

    /**
     * @param  array<string, string[]> $scripts
     */
    public function setScripts(array $scripts): void;

    /**
     * Returns an array of repositories
     *
     * @return mixed[] Repositories
     */
    public function getRepositories(): array;

    /**
     * Set the repositories
     *
     * @param  mixed[] $repositories
     */
    public function setRepositories(array $repositories): void;

    /**
     * Returns the package license, e.g. MIT, BSD, GPL
     *
     * @return string[] The package licenses
     */
    public function getLicense(): array;

    /**
     * Set the license
     *
     * @param  string[] $license
     */
    public function setLicense(array $license): void;

    /**
     * Returns an array of keywords relating to the package
     *
     * @return string[]
     */
    public function getKeywords(): array;

    /**
     * Set the keywords
     *
     * @param  string[] $keywords
     */
    public function setKeywords(array $keywords): void;

    /**
     * Returns the package description
     *
     * @return ?string
     */
    public function getDescription(): ?string;

    /**
     * Set the description
     */
    public function setDescription(string $description): void;

    /**
     * Returns the package homepage
     *
     * @return ?string
     */
    public function getHomepage(): ?string;

    /**
     * Set the homepage
     */
    public function setHomepage(string $homepage): void;

    /**
     * Returns an array of authors of the package
     *
     * Each item can contain name/homepage/email keys
     *
     * @return array<array{name?: string, homepage?: string, email?: string, role?: string}>
     */
    public function getAuthors(): array;

    /**
     * Set the authors
     *
     * @param  array<array{name?: string, homepage?: string, email?: string, role?: string}> $authors
     */
    public function setAuthors(array $authors): void;

    /**
     * Returns the support information
     *
     * @return array{issues?: string, forum?: string, wiki?: string, source?: string, email?: string, irc?: string, docs?: string, rss?: string, chat?: string}
     */
    public function getSupport(): array;

    /**
     * Set the support information
     *
     * @param  array{issues?: string, forum?: string, wiki?: string, source?: string, email?: string, irc?: string, docs?: string, rss?: string, chat?: string} $support
     */
    public function setSupport(array $support): void;

    /**
     * Returns an array of funding options for the package
     *
     * Each item will contain type and url keys
     *
     * @return array<array{type?: string, url?: string}>
     */
    public function getFunding(): array;

    /**
     * Set the funding
     *
     * @param  array<array{type?: string, url?: string}> $funding
     */
    public function setFunding(array $funding): void;

    /**
     * Returns if the package is abandoned or not
     */
    public function isAbandoned(): bool;

    /**
     * If the package is abandoned and has a suggested replacement, this method returns it
     */
    public function getReplacementPackage(): ?string;

    /**
     * @param  bool|string $abandoned
     */
    public function setAbandoned($abandoned): void;

    /**
     * Returns default base filename for archive
     *
     * @return ?string
     */
    public function getArchiveName(): ?string;

    /**
     * Sets default base filename for archive
     */
    public function setArchiveName(string $name): void;

    /**
     * Returns a list of patterns to exclude from package archives
     *
     * @return string[]
     */
    public function getArchiveExcludes(): array;

    /**
     * Sets a list of patterns to be excluded from archives
     *
     * @param  string[] $excludes
     */
    public function setArchiveExcludes(array $excludes): void;
}


text:
vagrant_ip='192.168.33.10'
host="root@$vagrant_ip"

#set -x
function daemon_mode {
    while true; do
        sleep 1000
        #check wether dir exists
        if (! ssh $host '[ -d /vagrant/laravel ]'); then
            ssh $host \
                'mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant; systemctl reload nginx; systemctl reload php-fpm; systemctl restart supervisord.service'
        fi;
    done
}

if [ ! -f ~/.ssh/id_rsa.pub ]; then
   ssh-keygen -t rsa
fi

if (! ssh $host -qo PasswordAuthentication=no -o ConnectTimeout=2 'exit'); then
    cat ~/.ssh/id_rsa.pub | ssh $host "mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys; chmod 600 ~/.ssh/authorized_keys"
fi;

pkill -f $(basename $0)

daemon_mode </dev/null >/dev/null 2>&1 &
disown


text:
package com.eagle.programmar.Python.Symbols;

public class Python_Class_Definition extends Python_Identifier_Definition
{
	@Override
	public String typeName()
	{
		return "Class";
	}
}


text:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

internal class UIListUnlockable : UIList
{
    [SerializeField] private GameObject _screenContainer;

    [SerializeField] private UIUnlocker _uIUnlockScreen;
    [SerializeField] private UnlockableType _unlockableType;

    [SerializeField] private UIListItemUnlockable _uIListItemUnlockablePrefab;
    [SerializeField] private UIBipedDesigner _uIBipedDesigner;

    protected override void Awake ()
    {
        base.Awake();
        foreach (Unlockable unlockable in GetUnlockables())
        {
            GameObject newGameObject = Instantiate(_uIListItemUnlockablePrefab.gameObject);
            UIListItemUnlockable newUIListItem = newGameObject.GetComponent<UIListItemUnlockable>();
            newUIListItem.Populate(unlockable, this, ClickCallback);
            Add(newUIListItem);
        }
    }

    private Unlockable[] GetUnlockables()
    {
        switch (_unlockableType)
        {
            case UnlockableType.Costume:
                return InvestmentManager.singleton.UnlockableCostumes;
            case UnlockableType.Effect:
                return InvestmentManager.singleton.UnlockableEffects;
        }
        return null;
    }

    private void ClickCallback(Unlockable unlockable, UIListItemUnlockable uIListItemUnlockable)
    {
        if (unlockable.Unlocked)
        {
            if (_unlockableType == UnlockableType.Costume)
                _uIBipedDesigner.SetCostume(unlockable);
            else if (_unlockableType == UnlockableType.Effect)
                _uIBipedDesigner.SetEffect(unlockable);
            Close();
        }
        else
        {
            _uIUnlockScreen.Show(unlockable, uIListItemUnlockable);
        }
    }

    internal void Close()
    {
        _screenContainer.SetActive(false);
    }
}


text:
package com.datastax.driver.core.exceptions;

import com.datastax.driver.core.CCMConfig;
import com.datastax.driver.core.CCMTestsSupport;
import com.datastax.driver.core.utils.CassandraVersion;
import org.testng.annotations.Test;

@CassandraVersion("2.2.0")
@CCMConfig(config = "enable_user_defined_functions:true")
public class FunctionExecutionExceptionTest extends CCMTestsSupport {

    @Override
    public void onTestContextInitialized() {
        execute(
                "CREATE TABLE foo (k int primary key, i int, l list<int>)",
                "INSERT INTO foo (k, i, l) VALUES (1, 1, [1])",
                "CREATE FUNCTION element_at(l list<int>, i int) RETURNS NULL ON NULL INPUT RETURNS int LANGUAGE java AS 'return (Integer) l.get(i);'"
        );
    }

    @Test(groups = "short", expectedExceptions = FunctionExecutionException.class)
    public void should_throw_when_function_execution_fails() {
        session().execute("SELECT element_at(l, i) FROM foo WHERE k = 1");
    }
}


text:
class Animal < ActiveRecord::Base

  belongs_to :species

  validates_presence_of :name
  validates_presence_of :date_of_birth

  validate :validate_born_in_the_past

  def born_in_the_future?
    date_of_birth > Time.now
  end

  def validate_born_in_the_past
    if born_in_the_future?
      errors.add(:date_of_birth, "can not be in the future.")
    end
  end

  def feed
    update_attribute(:last_fed, Time.now)
  end

end


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

package org.activiti.engine.impl.cmd;

import java.io.Serializable;
import java.util.List;

import org.activiti.engine.impl.interceptor.Command;
import org.activiti.engine.impl.interceptor.CommandContext;
import org.activiti.engine.task.Comment;
import org.apache.commons.lang3.StringUtils;

/**
 * @author Tom Baeyens
 */
public class GetProcessInstanceCommentsCmd implements Command<List<Comment>>, Serializable {

  private static final long serialVersionUID = 1L;
  protected String processInstanceId;
  protected String type;

  public GetProcessInstanceCommentsCmd(String processInstanceId) {
    this.processInstanceId = processInstanceId;
  }

  public GetProcessInstanceCommentsCmd(String processInstanceId, String type) {
    this.processInstanceId = processInstanceId;
    this.type = type;
  }

  @SuppressWarnings("unchecked")
  public List<Comment> execute(CommandContext commandContext) {
    if (StringUtils.isNotBlank(type)) {
      List<Comment> commentsByProcessInstanceId = commandContext
          .getCommentEntityManager()
          .findCommentsByProcessInstanceId(processInstanceId, type);
      return commentsByProcessInstanceId;
    } else {
      return commandContext
        .getCommentEntityManager()
        .findCommentsByProcessInstanceId(processInstanceId);
    }
  }
}


text:
"""Tests for the Metadata gRPC Interceptor."""

from unittest import TestCase

import mock

from google.ads.googleads.interceptors import MetadataInterceptor

class MetadataInterceptorTest(TestCase):
    def setUp(self):
        self.mock_developer_token = "1234567890"
        self.mock_login_customer_id = "0987654321"
        self.mock_linked_customer_id = "5555555555"
        super(MetadataInterceptorTest, self).setUp()

    def test_init(self):
        interceptor = MetadataInterceptor(
            self.mock_developer_token, self.mock_login_customer_id
        )

        self.assertEqual(
            interceptor.developer_token_meta,
            ("developer-token", self.mock_developer_token),
        )

        self.assertEqual(
            interceptor.login_customer_id_meta,
            ("login-customer-id", self.mock_login_customer_id),
        )

    def test_init_no_login_customer_id(self):
        interceptor = MetadataInterceptor(self.mock_developer_token, None)

        self.assertEqual(
            interceptor.developer_token_meta,
            ("developer-token", self.mock_developer_token),
        )

        self.assertEqual(interceptor.login_customer_id_meta, None)

    def test_init_no_linked_customer_id(self):
        interceptor = MetadataInterceptor(self.mock_developer_token, None, None)

        self.assertEqual(
            interceptor.developer_token_meta,
            ("developer-token", self.mock_developer_token),
        )

        self.assertEqual(interceptor.linked_customer_id_meta, None)

    def test_update_client_call_details_metadata(self):
        interceptor = MetadataInterceptor(
            self.mock_developer_token, self.mock_login_customer_id
        )

        mock_metadata = list([("test-key", "test-value")])
        mock_client_call_details = mock.Mock()

        client_call_details = interceptor._update_client_call_details_metadata(
            mock_client_call_details, mock_metadata
        )

        self.assertEqual(client_call_details.metadata, mock_metadata)

    def test_intercept_unary_unary(self):
        interceptor = MetadataInterceptor(
            self.mock_developer_token,
            self.mock_login_customer_id,
            self.mock_linked_customer_id,
        )

        mock_continuation = mock.Mock(return_value=None)
        mock_client_call_details = mock.Mock()
        mock_client_call_details.method = "test/method"
        mock_client_call_details.timeout = 5
        mock_client_call_details.metadata = [("apples", "oranges")]
        mock_request = mock.Mock()

        with mock.patch.object(
            interceptor,
            "_update_client_call_details_metadata",
            wraps=interceptor._update_client_call_details_metadata,
        ) as mock_updater:
            interceptor.intercept_unary_unary(
                mock_continuation, mock_client_call_details, mock_request
            )

            mock_updater.assert_called_once_with(
                mock_client_call_details,
                [
                    mock_client_call_details.metadata[0],
                    interceptor.developer_token_meta,
                    interceptor.login_customer_id_meta,
                    interceptor.linked_customer_id_meta,
                ],
            )

            mock_continuation.assert_called_once()

    def test_intercept_unary_stream(self):
        interceptor = MetadataInterceptor(
            self.mock_developer_token,
            self.mock_login_customer_id,
            self.mock_linked_customer_id,
        )

        mock_continuation = mock.Mock(return_value=None)
        mock_client_call_details = mock.Mock()
        mock_client_call_details.method = "test/method"
        mock_client_call_details.timeout = 5
        mock_client_call_details.metadata = [("apples", "oranges")]
        mock_request = mock.Mock()

        with mock.patch.object(
            interceptor,
            "_update_client_call_details_metadata",
            wraps=interceptor._update_client_call_details_metadata,
        ) as mock_updater:
            interceptor.intercept_unary_stream(
                mock_continuation, mock_client_call_details, mock_request
            )

            mock_updater.assert_called_once_with(
                mock_client_call_details,
                [
                    mock_client_call_details.metadata[0],
                    interceptor.developer_token_meta,
                    interceptor.login_customer_id_meta,
                    interceptor.linked_customer_id_meta,
                ],
            )

            mock_continuation.assert_called_once()

    def test_intercept_updates_user_agent_add_pb(self):
        """Asserts that the protobuf version is included in the user agent.

        This test should be removed or updated once this functionality is
        incorporated into python-api-core per this feature request:
        https://github.com/googleapis/python-api-core/issues/416
        """
        interceptor = MetadataInterceptor(
            self.mock_developer_token,
            self.mock_login_customer_id,
            self.mock_linked_customer_id,
        )

        mock_request = mock.Mock()
        mock_client_call_details = mock.Mock()
        mock_client_call_details.method = "test/method"
        mock_client_call_details.timeout = 5
        mock_client_call_details.metadata = [
            ("apples", "oranges"),
            ("x-goog-api-client", "gl-python/3.7.0 grpc/1.45.0 gax/2.2.2"),
        ]
        # Create a simple function that just returns the client_call_details
        # so we can make assertions about what was modified in the _intercept
        # method.
        def mock_continuation(client_call_details, request):
            return client_call_details

        with mock.patch.object(
            interceptor,
            "_update_client_call_details_metadata",
            wraps=interceptor._update_client_call_details_metadata,
        ) as mock_updater:
            modified_client_call_details = interceptor._intercept(
                mock_continuation, mock_client_call_details, mock_request
            )

            user_agent = modified_client_call_details.metadata[1][1]
            self.assertEqual(user_agent.count("pb"), 1)

    def test_intercept_updates_user_agent_existing_pb(self):
        """Asserts that the protobuf version is not added if already present.

        This test should be removed or updated once this functionality is
        incorporated into python-api-core per this feature request:
        https://github.com/googleapis/python-api-core/issues/416
        """
        interceptor = MetadataInterceptor(
            self.mock_developer_token,
            self.mock_login_customer_id,
            self.mock_linked_customer_id,
        )

        mock_request = mock.Mock()
        mock_client_call_details = mock.Mock()
        mock_client_call_details.method = "test/method"
        mock_client_call_details.timeout = 5
        mock_client_call_details.metadata = [
            ("apples", "oranges"),
            (
                "x-goog-api-client",
                "gl-python/3.7.0 grpc/1.45.0 pb/3.21.0",
            ),
        ]
        # Create a simple function that just returns the client_call_details
        # so we can make assertions about what was modified in the _intercept
        # method.
        def mock_continuation(client_call_details, request):
            return client_call_details

        with mock.patch.object(
            interceptor,
            "_update_client_call_details_metadata",
            wraps=interceptor._update_client_call_details_metadata,
        ) as mock_updater:
            modified_client_call_details = interceptor._intercept(
                mock_continuation, mock_client_call_details, mock_request
            )

            user_agent = modified_client_call_details.metadata[1][1]
            # We assert that the _intercept method did not add the "pb" key
            # value pair because it was already present when passed in.
            self.assertEqual(user_agent.count("pb"), 1)


text:
'use strict';

describe('Controller: BuildimageCtrl', function () {

  // load the controller's module
  beforeEach(module('dockerUiApp'));

  var BuildimageCtrl,
    scope;

  // Initialize the controller and a mock scope
  beforeEach(inject(function ($controller, $rootScope) {
    scope = $rootScope.$new();
    BuildimageCtrl = $controller('BuildimageCtrl', {
      $scope: scope
    });
  }));

  it('should attach a list of awesomeThings to the scope', function () {
    expect(scope.awesomeThings.length).toBe(3);
  });
});


text:
package hu.sch.services.exceptions;

/**
 * Exception used in register.
 * Indicates whether the user gives different newbie state than
 * we have in our database
 *
 * @author balo
 */
public class InvalidNewbieStateException extends Exception {

    /**
     * Constructs an instance of
     * InvalidNewbieStateException with the specified detail
     * message.
     *
     * @param msg the detail message key
     */
    public InvalidNewbieStateException(String msg) {
        super(msg);
    }
}


text:
===============================
Legend" text must not contain just whitespace
===============================

*Severity code:* Severe error

.. php:class:: legendTextNotEmpty

If a legend element is used in a fieldset, the legend should not contain empty text.

Example
-------
Wrong
-----

.. code-block:: html

    <fieldset>    <legend> </legend>    Name: <input type="text" size="30" id="name"/>
    Email: <input type="text" size="30" id="email"/>
</fieldset>

Right
-----

.. code-block:: html

    <fieldset>    <legend>Personal Information:</legend>    Name: <input type="text" size="30" id="name"/>
    Email: <input type="text" size="30" id="email"/>
</fieldset>


text:
module ETL #:nodoc:
  module Processor #:nodoc:
    # A row level processor that provides surrogate keys
    class SurrogateKeyProcessor < ETL::Processor::RowProcessor
      attr_accessor :destination
      attr_accessor :table
      attr_accessor :column
      attr_accessor :target

      # Initialize the surrogate key generator
      #
      # Configuration options
      # * <tt>:query</tt>: If specified it contains a query to be used to
      #   locate the last surrogate key. If this is specified then :target
      #   must also be specified.
      # * <tt>:target</tt>: The target connection
      # * <tt>:destination</tt>: The destination column name (defaults to :id)
      def initialize(control, configuration)
        super
        @table = configuration[:table]
        @column = configuration[:column] || 'id'
        @target = configuration[:target]
        if configuration[:query]
          raise ControlError, "Query option is no longer value, use :column and :table instead"
        end
        if table
          @surrogate_key = ETL::Engine.connection(target).select_value("SELECT max(#{column}) FROM #{table_name}")
        end
        #puts "initial surrogate key: #{@surrogate_key}"
        @surrogate_key = 0 if @surrogate_key.blank?
        @surrogate_key = @surrogate_key.to_i
        #puts "surrogate key: #{@surrogate_key}"
        @destination = configuration[:destination] || :id
      end

      # Add a surrogate key to the row
      def process(row)
        if row
          #puts "processing row #{row.inspect}"
          @surrogate_key += 1
          #puts "adding surrogate key to row: #{@surrogate_key}"
          row[destination] = @surrogate_key
          row
        end
      end

      private
      def table_name
        ETL::Engine.table(table, ETL::Engine.connection(target))
      end
    end
  end
end


text:
module Squib
  module Graphics
    # Helper class to generate templated sheet.
    class SaveSprue
      def initialize(deck, tmpl, sheet_args)
        @deck = deck
        @tmpl = tmpl
        @page_number = 0
        @sheet_args = sheet_args # might be Args::Sheet or Args::SaveBatch
        @overlay_lines = @tmpl.crop_lines.select do |line|
          line['overlay_on_cards']
        end
      end

      def render_sheet(range)
        cc = init_cc
        cc.set_source_color(:white) # white backdrop TODO make option
        cc.paint
        slots = @tmpl.cards
        per_sheet = slots.size
        check_oversized_card

        draw_overlay_below_cards cc if range.size

        track_progress(range) do |bar|
          range.each do |i|
            cc = next_page_if_needed(cc, i, per_sheet)

            card = @deck.cards[i]
            slot = slots[i % per_sheet]

            draw_card cc, card,
                      slot['x'] - @sheet_args.trim,
                      slot['y']  - @sheet_args.trim,
                      slot['rotate'],
                      slot['flip_vertical'], slot['flip_horizontal'],
                      @sheet_args.trim, @sheet_args.trim_radius
            bar.increment
          end

          draw_overlay_above_cards cc
          draw_final_page cc # See bug #320
        end
      end

      protected

      # Initialize the Cairo Context
      def init_cc
        raise NotImplementedError
      end

      def draw_page(cc)
        raise NotImplementedError
      end

      def full_filename
        raise NotImplementedError
      end

      private

      def next_page_if_needed(cc, i, per_sheet)
        return cc unless (i != 0) && (i % per_sheet) == 0

        draw_overlay_above_cards cc
        cc = draw_page cc
        draw_overlay_below_cards cc
        @page_number += 1
        cc
      end

      def track_progress(range)
        msg = "Saving templated sheet to #{full_filename}"
        @deck.progress_bar.start(msg, range.size) { |bar| yield(bar) }
      end

      def draw_overlay_below_cards(cc)
        if @tmpl.crop_line_overlay == :on_margin
          add_margin_overlay_clip_mask cc
          cc.clip
          draw_crop_line cc, @tmpl.crop_lines
          cc.reset_clip
        elsif @tmpl.crop_line_overlay == :beneath_cards
          draw_crop_line cc, @tmpl.crop_lines
        end
      end

      def draw_overlay_above_cards(cc)
        if @tmpl.crop_line_overlay == :overlay_on_cards
          draw_crop_line cc, @tmpl.crop_lines
        else
          draw_crop_line cc, @overlay_lines
        end
      end

      def add_margin_overlay_clip_mask(cc)
        margin = @tmpl.margin
        cc.new_path
        cc.rectangle(
          margin[:left], margin[:top],
          margin[:right] - margin[:left],
          margin[:bottom] - margin[:top]
        )
        cc.new_sub_path
        cc.move_to @tmpl.sheet_width, 0
        cc.line_to 0, 0
        cc.line_to 0, @tmpl.sheet_height
        cc.line_to @tmpl.sheet_width, @tmpl.sheet_height
        cc.close_path
      end

      def draw_crop_line(cc, crop_lines)
        crop_lines.each do |line|
          cc.move_to line['line'].x1, line['line'].y1
          cc.line_to line['line'].x2, line['line'].y2
          cc.set_source_color line['color']
          cc.set_line_width line['width']
          cc.set_dash(line['style'].pattern) if line['style'].pattern
          cc.stroke
        end
      end

      def check_oversized_card
        Squib.logger.warn {
          "Card size is larger than sprue's expected card size "\
          "of #{@tmpl.card_width}x#{@tmpl.card_height}. Cards may overlap."
        } if (@deck.width - 2.0 * @sheet_args.trim)  > @tmpl.card_width ||
             (@deck.height - 2.0 * @sheet_args.trim) > @tmpl.card_height
      end

      def draw_card(cc, card, x, y, angle, flip_v, flip_h, trim, trim_radius)
        # Compute the true size of the card after trimming
        w = @deck.width - 2.0 * trim
        h = @deck.height - 2.0 * trim

        # Normalize the angles first
        # TODO do this in the args class
        angle = angle % (2 * Math::PI)
        angle = 2 * Math::PI - angle if angle < 0

        # Perform the actual rotation and drawing
        mat = cc.matrix # Save the transformation matrix to revert later
        cc.translate x, y
        cc.translate @deck.width / 2.0, @deck.height / 2.0
        cc.flip(flip_v, flip_h, 0, 0)
        cc.rotate angle
        cc.translate -@deck.width / 2.0, -@deck.height / 2.0
        cc.rounded_rectangle(trim, trim, w, h, trim_radius, trim_radius) # clip
        cc.clip
        cc.set_source card.cairo_surface, 0, 0
        cc.matrix = mat
        cc.paint
        cc.reset_clip
      end
    end

    # Templated sheet renderer in PDF format.
    class SaveSpruePDF < SaveSprue
      def init_cc
        ratio = 72.0 / @deck.dpi

        slots = @tmpl.cards
        per_sheet = slots.size

        surface = if per_sheet == 1
            Cairo::PDFSurface.new(
                full_filename,
                (@tmpl.sheet_width - 2 * @sheet_args.trim) * ratio,
                (@tmpl.sheet_height - 2 *@sheet_args.trim) * ratio
            )
        else
            Cairo::PDFSurface.new(
                full_filename,
                @tmpl.sheet_width * ratio,
                @tmpl.sheet_height * ratio
            )
        end

        cc = CairoContextWrapper.new(Cairo::Context.new(surface))
        # cc = Cairo::Context.new(surface)
        cc.scale(72.0 / @deck.dpi, 72.0 / @deck.dpi) # make it like pixels
        cc
      end

      def draw_page(cc)
        cc.show_page
        cc.set_source_color(:white) # white backdrop TODO make option
        cc.paint
        cc
      end

      def draw_final_page(cc)
        # PDF doesn't need to create a last page. See bug #320
        cc.target.finish
      end

      def full_filename
        @sheet_args.full_filename
      end
    end

    # Templated sheet renderer in PNG format.
    class SaveSpruePNG < SaveSprue
      def init_cc
        surface = Cairo::ImageSurface.new @tmpl.sheet_width, @tmpl.sheet_height
        CairoContextWrapper.new(Cairo::Context.new(surface))
        # Cairo::Context.new(surface)
      end

      def draw_page(cc)
        cc.target.write_to_png(full_filename)
        init_cc
        cc.set_source_color(:white) # white backdrop TODO make option
        cc.paint
        cc
      end

      # The last page always gets written out for PNGs because they are separate
      # files and don't get "flushed" automatically. See bug #320.
      def draw_final_page(cc)
        draw_page cc
        cc.target.finish
      end

      def full_filename
        @sheet_args.full_filename @page_number
      end
    end
  end
end


text:
static const uint32_t colors[] = { 0x0000ff00, 0x000000ff, 0x00ffff00, 0x00ff00ff, 0x0000ffff, 0x00ff0000, 0x00ffffff };
static const int num_colors = sizeof(colors)/sizeof(uint32_t);

#define PUSH_NVTX_RANGE(name,cid) { \
	int color_id = cid; \
	color_id = color_id%num_colors;\
	nvtxEventAttributes_t eventAttrib = {0}; \
	eventAttrib.version = NVTX_VERSION; \
	eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE; \
	eventAttrib.colorType = NVTX_COLOR_ARGB; \
	eventAttrib.color = colors[color_id]; \
	eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII; \
	eventAttrib.message.ascii = name; \
	nvtxRangePushEx(&eventAttrib); \
}
#define POP_NVTX_RANGE nvtxRangePop();
#else
#define PUSH_NVTX_RANGE(name,cid)
#define POP_NVTX_RANGE
#endif


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

<plugin xmlns="http://apache.org/cordova/ns/plugins/1.0"
    xmlns:rim="http://www.blackberry.com/ns/widgets"
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:m3="http://schemas.microsoft.com/appx/2014/manifest"
    xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
    id="cordova-plugin-adnaga-base"
    version="0.2.0">

    <name>adnaga-base</name>
    <description>adnaga base plugin</description>
    <license>MIT</license>
    <keywords>cordova,adnaga,ads,ad</keywords>
    <repo>https://github.com/adnaga/adnaga-base</repo>
    <issue>https://github.com/adnaga/adnaga-base/issues</issue>

    <js-module src="www/adnaga.js" name="adnaga">
        <clobbers target="adnaga" />
    </js-module>

    <js-module src="www/intenthelper.js" name="intenthelper">
        <clobbers target="intenthelper" />
    </js-module>

    <platform name="android">
        <config-file target="res/xml/config.xml" parent="/*">
            <feature name="Adnaga">
                <param name="android-package" value="com.adnaga.Adnaga"/>
            </feature>
            <feature name="Intenthelper">
                <param name="android-package" value="com.adnaga.Intenthelper"/>
            </feature>
        </config-file>

        <config-file target="AndroidManifest.xml" parent="/*">
            <uses-permission android:name="android.permission.INTERNET" />
            <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
            <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
            <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES" />
        </config-file>

        <source-file src="src/android/Adnaga.java" target-dir="src/com/adnaga/"/>
        <source-file src="src/android/Intenthelper.java" target-dir="src/com/adnaga/"/>
        <source-file src="src/android/IPlugin.java" target-dir="src/com/adnaga/"/>
        <source-file src="build-extras.gradle" target-dir="."/>
    </platform>
</plugin>


text:
Partial Class LogOut
    Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

    'This call is required by the Web Form Designer.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

    End Sub

    'NOTE: The following placeholder declaration is required by the Web Form Designer.
    'Do not delete or move it.
    Private designerPlaceholderDeclaration As System.Object

    Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
        'CODEGEN: This method call is required by the Web Form Designer
        'Do not modify it using the code editor.
        InitializeComponent()
    End Sub

#End Region

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        If Session.Item("LoggedIn") = True Then
            lblLoggedOut.Text = "You have been logged out."
            Session.Abandon()
        Else
            lblLoggedOut.Text = "You are already logged out."
        End If
    End Sub

End Class


text:
#define LOG_LEVEL CONFIG_USB_DEVICE_NETWORK_LOG_LEVEL
#include <logging/log.h>
LOG_MODULE_REGISTER(usb_net);

#include <init.h>

#include <net/ethernet.h>
#include <net_private.h>

#include <usb_device.h>
#include <usb_common.h>
#include <usb_descriptor.h>

#include "netusb.h"

static struct __netusb {
	struct net_if *iface;
	const struct netusb_function *func;
} netusb;

#if !defined(CONFIG_USB_COMPOSITE_DEVICE)
/* TODO: FIXME: correct buffer size */
static u8_t interface_data[300];
#endif

static int netusb_send(struct device *dev, struct net_pkt *pkt)
{
	int ret;

	ARG_UNUSED(dev);

	LOG_DBG("Send pkt, len %u", net_pkt_get_len(pkt));

	if (!netusb_enabled()) {
		LOG_ERR("interface disabled");
		return -ENODEV;
	}

	ret = netusb.func->send_pkt(pkt);
	if (ret) {
		return ret;
	}

	return 0;
}

struct net_if *netusb_net_iface(void)
{
	return netusb.iface;
}

void netusb_recv(struct net_pkt *pkt)
{
	LOG_DBG("Recv pkt, len %u", net_pkt_get_len(pkt));

	if (net_recv_data(netusb.iface, pkt) < 0) {
		LOG_ERR("Packet %p dropped by NET stack", pkt);
		net_pkt_unref(pkt);
	}
}

static int netusb_connect_media(void)
{
	LOG_DBG("");

	if (!netusb_enabled()) {
		LOG_ERR("interface disabled");
		return -ENODEV;
	}

	if (!netusb.func->connect_media) {
		return -ENOTSUP;
	}

	return netusb.func->connect_media(true);
}

static int netusb_disconnect_media(void)
{
	LOG_DBG("");

	if (!netusb_enabled()) {
		LOG_ERR("interface disabled");
		return -ENODEV;
	}

	if (!netusb.func->connect_media) {
		return -ENOTSUP;
	}

	return netusb.func->connect_media(false);
}

void netusb_enable(const struct netusb_function *func)
{
	LOG_DBG("");

	netusb.func = func;

	net_if_up(netusb.iface);
	netusb_connect_media();
}

void netusb_disable(void)
{
	LOG_DBG("");

	if (!netusb_enabled()) {
		return;
	}

	netusb.func = NULL;

	netusb_disconnect_media();
	net_if_down(netusb.iface);
}

bool netusb_enabled(void)
{
	return !!netusb.func;
}

static void netusb_init(struct net_if *iface)
{
	static u8_t mac[6] = { 0x00, 0x00, 0x5E, 0x00, 0x53, 0x00 };

	LOG_DBG("netusb device initialization");

	netusb.iface = iface;

	ethernet_init(iface);

	net_if_set_link_addr(iface, mac, sizeof(mac), NET_LINK_ETHERNET);

	net_if_down(iface);

#ifndef CONFIG_USB_COMPOSITE_DEVICE
	/* Linker-defined symbols bound the USB descriptor structs */
	extern struct usb_cfg_data __usb_data_start[];
	extern struct usb_cfg_data __usb_data_end[];
	size_t size = (__usb_data_end - __usb_data_start);

	for (size_t i = 0; i < size; i++) {
		struct usb_cfg_data *cfg = &(__usb_data_start[i]);
		int ret;

		LOG_DBG("Registering function %u", i);

		cfg->interface.payload_data = interface_data;
		cfg->usb_device_description = usb_get_device_descriptor();

		ret = usb_set_config(cfg);
		if (ret < 0) {
			LOG_ERR("Failed to configure USB device");
			return;
		}

		ret = usb_enable(cfg);
		if (ret < 0) {
			LOG_ERR("Failed to enable USB");
			return;
		}
	}
#endif /* CONFIG_USB_COMPOSITE_DEVICE */

	LOG_INF("netusb initialized");
}

static const struct ethernet_api netusb_api_funcs = {
	.iface_api.init = netusb_init,

	.get_capabilities = NULL,
	.send = netusb_send,
};

static int netusb_init_dev(struct device *dev)
{
	ARG_UNUSED(dev);
	return 0;
}

NET_DEVICE_INIT(eth_netusb, "eth_netusb", netusb_init_dev, NULL, NULL,
		CONFIG_ETH_INIT_PRIORITY, &netusb_api_funcs, ETHERNET_L2,
		NET_L2_GET_CTX_TYPE(ETHERNET_L2), NET_ETH_MTU);


text:
/* -*- Mode: js2; tab-width: 4; indent-tabs-mode: nil; -*-
 * vim: set ts=4 sw=4 et tw=99 ft=js:
 */

import * as types from './types';
import * as llvm from '@llvm';

export function string(ir, c) {
    let constant = ir.createGlobalStringPtr(c, "strconst");
    constant.is_constant = true;
    constant.constant_val = c;
    return constant;
}

function intConstant(type, ...constant_val) {
    let constant = llvm.Constant.getIntegerValue(type, ...constant_val);
    constant.is_constant = true;
    constant.constant_val = constant_val;
    return constant;
}

export function jschar(c)           { return intConstant(types.JSChar, c); }
export function int32(c)            { return intConstant(types.Int32,  c); }
export function int1(c)             { return intConstant(types.Int1,   c); }
export function int64(c)            { return intConstant(types.Int64,  c); }
export function int64_lowhi(ch, cl) { return intConstant(types.Int64,  ch, cl); }
export function bool(c) {
    let constant = llvm.Constant.getIntegerValue(types.Bool, c === false ? 0 : 1);
    constant.is_constant = true;
    constant.constant_val = c;
    return constant;
}

export function Null(t) { return llvm.Constant.getNull(t); }

export function True()  { return bool(true);  }
export function False() { return bool(false); }

export function ejsval_true()  { return int64_lowhi(0xfff98000, 0x00000001); }
export function ejsval_false() { return int64_lowhi(0xfff98000, 0x00000000); }


text:
package org.languagetool.rules.ru;

import org.languagetool.Language;
import org.languagetool.languagemodel.LanguageModel;
import org.languagetool.rules.ngrams.ConfusionProbabilityRule;

import java.util.ResourceBundle;

/**
 * @since 3.1
 */
public class RussianConfusionProbabilityRule extends ConfusionProbabilityRule {

  public RussianConfusionProbabilityRule(ResourceBundle messages, LanguageModel languageModel, Language language) {
    super(messages, languageModel, language);
    // TODO: add example:
    //addExamplePair(Example.wrong("<marker>wrong</marker> word in sentence"),
    //               Example.fixed("<marker>correct</marker> word in sentence"));
  }

}


text:
import com.dynrdf.webapp.Config;
import com.dynrdf.webapp.model.Template;
import com.dynrdf.webapp.util.Log;
import org.junit.*;

import java.util.Arrays;

/**
 * Tests for Template
 */
public class TemplateTest {

    @BeforeClass
    public static void initApi() throws Exception{
        // 1) Init logger
        Log.init();
        // 2) Load config
        Config.init();
    }

    @Test
    public void testTemplatePlaceholdersFound(){
        String plainTemplate = "[@0]_[@1]_[@2]";
        Template template = new Template(plainTemplate);
        template.preprocess();
        Assert.assertEquals(3, template.getPlaceholders().size());
    }

    @Test
    public void testFillTemplate(){
        String plainTemplate = "[@0]_[@1]_[@2]_[@3]_[@4]_[@5]_[@6]";
        Template template = new Template(plainTemplate);
        template.preprocess();
        Assert.assertEquals(7, template.getPlaceholders().size());
        String testUrl = "http://test.com/a/b/c";
        String filledTemplate = template.fillTemplate(testUrl, Arrays.asList(testUrl.split("/")));

        String expected = testUrl + "_" + testUrl.replaceAll("/", "_");
        Assert.assertEquals(expected, filledTemplate);
    }

    @Test
    public void testRegexTemplate(){
        String plainTemplate = "[@0, \"http://(.*)\"]";
        Template template = new Template(plainTemplate);
        template.preprocess();
        Assert.assertEquals(1, template.getPlaceholders().size());
        String testUrl = "http://test.com/a/b/c";
        String filledTemplate = template.fillTemplate(testUrl, Arrays.asList(testUrl.split("/")));

        String expected = "test.com/a/b/c";
        Assert.assertEquals(expected, filledTemplate);
    }
}


text:
package org.tanc.annotation.custom;

/**
 * 自定义注解使用
 * Created by tanc on 2017/4/12.
 */
@Name("class annotation")
public class AnnotationDemo {

    @Name("field annotation")
    private String name;

    private int count;

    @Name("method annotation")
    public void run() {
        System.out.println("ok");
    }
}


text:
Shader Lab
==========

The place to play around with WebGL shaders.


text:
set -e

echo "Building $PACKAGE_NAME"

mkdir -p hinterland/assets
cp assets/*.png hinterland/assets
cp assets/*.json hinterland/assets
cp -r assets/maps hinterland/assets
cp -r assets/audio hinterland/assets
cp target/release/hinterland hinterland
tar zcf $PACKAGE_NAME hinterland
rm -rf hinterland


text:
typedef NS_OPTIONS(NSUInteger, BBCodeStatus) {
    BBCodeStatusNone = 0,
    BBCodeStatusEscaped = 1 << 0,
    BBCodeStatusInTag = 1 << 1,
    BBCodeStatusInClosingTag = 1 << 2,
    BBCodeStatusInAttributeKey = 1 << 3,
    BBCodeStatusInAttributeValue = 1 << 4
};

@implementation WEBBCodeParser {
    BBCodeStatus _status;
    unichar *_buffer;
    NSUInteger _bufferPos;
    NSUInteger _bufferLength;
    NSMutableArray<WEBBCodeAttribute *> *_attributes;
    NSString *_currentTagName;
    NSString *_currentAttributeKey;
    unichar _currentQuoteChar;
}

static const unichar kDefaultEscapeChar = '\\';

#define PUSH_BUFFER(b) { NSAssert(_bufferPos < _bufferLength, @"Buffer pos should always be < bufferLength"); _buffer[_bufferPos++] = b; }

+ (NSCharacterSet *)whitespaceSet{
    static NSCharacterSet *whitespaceSet = nil;
    WE_DISPATCH_ONCE(^{
        whitespaceSet = [NSCharacterSet whitespaceAndNewlineCharacterSet];
    });
    return whitespaceSet;
}

+ (NSCharacterSet *)lineBreakSet{
    static NSCharacterSet *lineBreakSet = nil;
    WE_DISPATCH_ONCE(^{
        lineBreakSet = [NSCharacterSet characterSetWithCharactersInString:@"\n"];
    });
    return lineBreakSet;
}

+ (NSCharacterSet *)ignoreSet{
    static NSCharacterSet *ignoreSet = nil;
    WE_DISPATCH_ONCE(^{
        ignoreSet = [NSCharacterSet characterSetWithCharactersInString:@"\r\f"];
    });
    return ignoreSet;
}

- (instancetype)init {
    if ((self = [super init])) {
        self.escapeChar = kDefaultEscapeChar;
        self.encoding = NSUTF8StringEncoding;
        [self reset];
    }
    return self;
}

- (void)dealloc {
    [self freeBuffer];
}

- (WEBBCodeParserStatus)parseData:(NSData *)data error:(NSError **)error {
    return [self parseBytes:data.bytes withLength:data.length error:error];
}

- (void)allocateMemoryForBufferIfNeededForLength:(NSUInteger)maxLength {
    NSAssert(_bufferLength >= _bufferPos, @"Buffer length should always be >= _bufferPos");
    NSUInteger currentBufferSpace = _bufferLength - _bufferPos;
    if (maxLength > currentBufferSpace) {
        NSUInteger delta = (maxLength - currentBufferSpace);
        _bufferLength += MAX(_bufferLength, delta);
        _buffer = realloc(_buffer, _bufferLength * sizeof(unichar));
    }
}

- (WEBBCodeParserStatus)parseString:(NSString *)inputString error:(NSError **)error {
    NSUInteger length = inputString.length;

    const unichar escapeChar = self.escapeChar;
    const NSCharacterSet *whitespaceCharacterSet = [[self class] whitespaceSet];
    const NSCharacterSet *lineBreakSet = [[self class] lineBreakSet];

    NSUInteger allocationLength = length;
    if (WE_CONTAINS_BIT(_status, BBCodeStatusEscaped)) {
        allocationLength++;
    }
    [self allocateMemoryForBufferIfNeededForLength:allocationLength];

    for (NSUInteger i = 0; i < length; i++) {
        unichar b = [inputString characterAtIndex:i];

        BOOL ignoreChar = NO;
        BOOL escaped = WE_CONTAINS_BIT(_status, BBCodeStatusEscaped);
        BOOL tagActive = WE_CONTAINS_BIT(_status, BBCodeStatusInTag);
        BOOL inClosingTag = WE_CONTAINS_BIT(_status, BBCodeStatusInClosingTag);
        BOOL inStartTag = tagActive && !inClosingTag;
        BOOL inAttributeKey = WE_CONTAINS_BIT(_status, BBCodeStatusInAttributeKey);
        BOOL inAttributeValue = WE_CONTAINS_BIT(_status, BBCodeStatusInAttributeValue);

        if ([[[self class] ignoreSet] characterIsMember:b]) {
            ignoreChar = YES;
        } else if (escaped) {
            BOOL isEscapableChar = (b == '[' || b == ']' || b == escapeChar || b == _currentQuoteChar);
            if (!isEscapableChar) {
                //Print escape char anyway, which was ignored the previous turn
                PUSH_BUFFER(escapeChar)
            }
            WE_UNSET_BIT(_status, BBCodeStatusEscaped);
        } else if (b == escapeChar) {
            ignoreChar = YES;
            WE_SET_BIT(_status, BBCodeStatusEscaped);
        } else {
            //Check for opening/closing of tags
            if (b == '[' && !tagActive) {

                [self didFindChars];
                ignoreChar = YES;

                //Tag begins
                WE_SET_BIT(_status, BBCodeStatusInTag);
            } else if (b == ']' && tagActive) {
                if (inClosingTag) {
                    [self didCloseTag];
                } else {
                    [self didOpenTag];
                }
                ignoreChar = YES;
            } else if (b == '/' && tagActive && _bufferPos == 0) {
                WE_SET_BIT(_status, BBCodeStatusInClosingTag);
                ignoreChar = YES;
            } else if ([whitespaceCharacterSet characterIsMember:(unichar)b]) {
                if (tagActive) {
                    if (inAttributeValue) {
                        if (_currentQuoteChar == '\0') {
                            if (_bufferPos > 0) {
                                //End of attribute value by whitespace
                                [self finishCurrentAttribute];
                            }
                            ignoreChar = YES;
                        }
                    } else {
                        if (_currentTagName == nil) {
                            NSString *s = [self popStringFromBuffer];
                            _currentTagName = s.length == 0 ? nil : s;
                        }

                        //Ignore whitespaces within tags
                        ignoreChar = YES;

                        if (inStartTag && _currentTagName != nil && !inAttributeKey) {
                            //Start of an attribute
                            WE_SET_BIT(_status, BBCodeStatusInAttributeKey);
                        }
                    }
                } else if ([lineBreakSet characterIsMember:(unichar)b]) {
                    [self didFindChars];
                    [self didFindLineBreak];
                    ignoreChar = YES;
                }
            } else if (b == '=') {
                if (inAttributeKey) {
                    ignoreChar = YES;
                    if (_currentAttributeKey == nil) {
                        _currentAttributeKey = [self popStringFromBuffer];
                    }
                    WE_UNSET_BIT(_status, BBCodeStatusInAttributeKey);
                    WE_SET_BIT(_status, BBCodeStatusInAttributeValue);
                } else if (inStartTag && _currentTagName == nil) {
                    //Default attribute
                    ignoreChar = YES;
                    _currentTagName = [self popStringFromBuffer];
                    WE_SET_BIT(_status, BBCodeStatusInAttributeValue);
                }
            } else if ((b == '\'' || b == '"') && inAttributeValue) {
                if (_currentQuoteChar == '\0') {
                    ignoreChar = YES;
                    _currentQuoteChar = b;
                } else if (_currentQuoteChar == b) {
                    ignoreChar = YES;
                    [self finishCurrentAttribute];
                }
            }
        }

        if (!ignoreChar) {
            PUSH_BUFFER(b)
        }
    }

    WEBBCodeParserStatus status = WEBBCodeParserStatusNone;

    if (WE_CONTAINS_BIT(_status, BBCodeStatusEscaped) || WE_CONTAINS_BIT(_status, BBCodeStatusInTag)) {
        status = WEBBCodeParserStatusInsufficientData;
    } else {
        status = WEBBCodeParserStatusOK;
    }

    if (status == WEBBCodeParserStatusOK && _bufferPos > 0) {
        [self didFindChars];
    }

    //Add support for errors later
    if (error) {
        *error = nil;
    }

    return status;
}

- (WEBBCodeParserStatus)parseBytes:(const void*)bytes withLength:(NSUInteger)bytesLength error:(NSError **)error {
    NSString *bytesAsString = [[NSString alloc] initWithBytesNoCopy:(void *)bytes length:bytesLength encoding:self.encoding freeWhenDone:NO];
    return [self parseString:bytesAsString error:error];
}

- (void)finishCurrentAttribute {
    BOOL defaultAttribute = _currentAttributeKey == nil;
    if (defaultAttribute) {
        _currentAttributeKey = WEBBCodeDefaultAttributeName;
    }
    NSString *attributeValue = [self popStringFromBuffer];
    if (attributeValue != nil && (attributeValue.length > 0 || !defaultAttribute)) {
        WEBBCodeAttribute *attr = [WEBBCodeAttribute attributeWithName:_currentAttributeKey value:attributeValue];
        [_attributes addObject:attr];
    }
    WE_UNSET_BIT(_status, BBCodeStatusInAttributeValue);
    WE_UNSET_BIT(_status, BBCodeStatusInAttributeKey);
    _currentQuoteChar = '\0';
    _currentAttributeKey = nil;
}

- (void)didOpenTag {
    NSString *tagName = nil;
    if (_currentTagName == nil) {
        tagName = [self popStringFromBuffer];
    } else {
        tagName = _currentTagName;
    }
    [self finishCurrentAttribute];

    NSArray *attributes = _attributes;
    if ([self.delegate respondsToSelector:@selector(parser:didFindStartTag:)]) {
        WEBBCodeAttributes *theAttributes = [[WEBBCodeAttributes alloc] initWithAttributes:attributes];
        WEBBCodeTag *theTag = [WEBBCodeTag tagWithTagName:tagName attributes:theAttributes];
        [self.delegate parser:self didFindStartTag:theTag];
    }

    _currentTagName = nil;
    [_attributes removeAllObjects];
    WE_UNSET_BIT(_status, BBCodeStatusInTag);
}

- (void)didCloseTag {
    NSString *text = [self popStringFromBuffer];
    NSString *closeTag = [text stringByTrimmingCharactersInSet:[self.class whitespaceSet]];
    if ([self.delegate respondsToSelector:@selector(parser:didFindEndTag:)]) {
        [self.delegate parser:self didFindEndTag:closeTag];
    }
    WE_UNSET_BIT(_status, BBCodeStatusInTag);
    WE_UNSET_BIT(_status, BBCodeStatusInClosingTag);
}

- (void)didFindChars {
    NSString *text = [self popStringFromBuffer];
    if (text.length > 0) {
        if ([self.delegate respondsToSelector:@selector(parser:didFindText:)]) {
            [self.delegate parser:self didFindText:text];
        }
    }
}

- (void)didFindLineBreak {
    if ([self.delegate respondsToSelector:@selector(parserDidFindLineBreak:)]) {
        [self.delegate parserDidFindLineBreak:self];
    }
}

- (NSString *)popStringFromBuffer {
    NSUInteger length = _bufferPos;
    NSString *ret;
    if (length == 0) {
        ret = @"";
    } else {
        NSUInteger allocationSize = length * sizeof(unichar);
        unichar *dest = malloc(allocationSize);
        memcpy(dest, _buffer, allocationSize);
        ret = [[NSString alloc] initWithCharactersNoCopy:dest length:length freeWhenDone:YES];
        _bufferPos = 0;
    }
    return ret;
}

- (void)reset {
    _bufferPos = 0;
    _bufferLength = 0;
    _currentQuoteChar = '\0';
    _status = BBCodeStatusNone;
    _attributes = [NSMutableArray new];
    [self freeBuffer];
}

- (void)freeBuffer {
    if (_buffer != NULL) {
        free(_buffer);
        _buffer = NULL;
    }
}

@end


text:
<p id="schwartz_rachel" data-toggle="tooltip" title="">
    Rachel Schwartz
    is a research scientist at Arizona State University with a
    background in ecology and evolutionary biology. She currently
    develops methods for phylogenomics, including the software SISRS,
    which extracts phylogenetically useful data from raw
    next-generation sequencing reads.


text:
<?php
/**
 * @author Krzysztof Gzocha <krzysztof.gzocha@xsolve.pl>
 */
namespace Team3\PayU\Communication\Request\Model;

use Team3\PayU\Order\Model\Money\MoneyInterface;
use Team3\PayU\Order\Model\OrderInterface;
use JMS\Serializer\Annotation as JMS;
use Team3\PayU\Serializer\SerializableInterface;

/**
 * Class RefundRequestModel
 * @package Team3\PayU\Communication\Request\Model
 * @JMS\AccessorOrder("alphabetical")
 */
class RefundRequestModel implements SerializableInterface
{
    /**
     * @var RefundModelInterface
     * @JMS\Type("Team3\PayU\Communication\Request\Model\RefundModel")
     */
    private $refund;

    /**
     * @var string
     * @JMS\Type("string")
     */
    private $orderId;

    /**
     * @param OrderInterface      $order
     * @param string              $description
     * @param string|null         $bankDescription
     * @param MoneyInterface|null $amount
     */
    public function __construct(
        OrderInterface $order,
        $description,
        $bankDescription = null,
        MoneyInterface $amount = null
    ) {
        $this->orderId = $order->getOrderId();
        $this->refund = new RefundModel($description, $bankDescription, $amount);
    }

    /**
     * @return RefundModelInterface
     */
    public function getRefund()
    {
        return $this->refund;
    }

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


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.appservice.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

/** Sample utterance. */
@Fluent
public final class SampleUtterance {
    /*
     * Text attribute of sample utterance.
     */
    @JsonProperty(value = "text")
    private String text;

    /*
     * Links attribute of sample utterance.
     */
    @JsonProperty(value = "links")
    private List<String> links;

    /*
     * Question id of sample utterance (for stackoverflow questions titles).
     */
    @JsonProperty(value = "qid")
    private String qid;

    /**
     * Get the text property: Text attribute of sample utterance.
     *
     * @return the text value.
     */
    public String text() {
        return this.text;
    }

    /**
     * Set the text property: Text attribute of sample utterance.
     *
     * @param text the text value to set.
     * @return the SampleUtterance object itself.
     */
    public SampleUtterance withText(String text) {
        this.text = text;
        return this;
    }

    /**
     * Get the links property: Links attribute of sample utterance.
     *
     * @return the links value.
     */
    public List<String> links() {
        return this.links;
    }

    /**
     * Set the links property: Links attribute of sample utterance.
     *
     * @param links the links value to set.
     * @return the SampleUtterance object itself.
     */
    public SampleUtterance withLinks(List<String> links) {
        this.links = links;
        return this;
    }

    /**
     * Get the qid property: Question id of sample utterance (for stackoverflow questions titles).
     *
     * @return the qid value.
     */
    public String qid() {
        return this.qid;
    }

    /**
     * Set the qid property: Question id of sample utterance (for stackoverflow questions titles).
     *
     * @param qid the qid value to set.
     * @return the SampleUtterance object itself.
     */
    public SampleUtterance withQid(String qid) {
        this.qid = qid;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }
}


text:
<?php
include("config.php");
include("parser.php");
$channel = "#" . $_GET[chan];
$chan    = $_GET[chan];

$target_log = $_GET['log'];

if (strtolower($target_log) == "today")
    $target_log = date("Y-m-d");
elseif (strtolower($target_log) == "yesterday")
    $target_log = date("Y-m-d", (time() - (60 * 60 * 24)));
elseif (strtolower($target_log) == "tomorrow")
    $target_log = date("Y-m-d", (time() + (60 * 60 * 24)));

//$escaped = preg_replace('/[^A-Za-z0-9_\-]\./', '_', $target_log);
$escaped = basename($target_log);

$buffer = ob_get_clean();
$tidy   = new tidy();
if (!isset($_GET['plain'])) {
    $buffer = "
<title>OCLogs: $escaped</title>

";
}
$mcp         = new MircColorParser();
$line_number = 1;
if ($escaped != "") {

    if (file_exists("logs/#" . $chan . "/" . $escaped) && ($handle = fopen("logs/#" . $chan . "/" . $escaped, "r")) !== false) {

        //$handle = @fopen($escaped, "r");
        if (!isset($_GET['plain'])) {
            date_default_timezone_set(timezone_name_from_abbr("CST"));
            $yesterday = date('Y-m-d', strtotime(str_replace(".log", "", $escaped) . ' -1 day'));
            $tomorrow  = date('Y-m-d', strtotime(str_replace(".log", "", $escaped) . ' +1 day'));
            if (file_exists("logs/#" . $chan . "/" . $yesterday . ".log")) {
                $buffer .= "<<Prev ";
            }
            if (file_exists("logs/#" . $chan . "/" . $tomorrow . ".log")) {
                $buffer .= "Next>> ";
            } else {
                $buffer .= "Auto Refresh ";
            }
            $buffer .= "Scroll to Bottom
";
            $buffer .= "
Stuff goes here
";
        }
        if ($handle) {
            while (($line = fgets($handle)) !== false) {
                $type = "unknown";
                $line = htmlspecialchars($line);
                if (!isset($_GET['plain'])) {
                    $line = $mcp->colorize($line);
                    list($line, $type) = parseLine($line, $line_number);
                }
                if (isset($_GET['linenum'])) {
                    $line = "$line_number: " . $line;
                }
                if (!isset($_GET['nolinks'])) {
                    $line = makeClickableLinks($line);
                }
                //if (isset($_GET['nocorded'])) {
                $line = str_replace("<Corded> <", "<img height=\"16\" width=\"16\" src=\"/resources/discord.png\" title=\"<Corded> \"><", $line);
                $line = str_replace("<Discord> <", "<img height=\"16\" width=\"16\" src=\"/resources/discord.png\" title=\"<Discord> \"><", $line);
                $line = str_replace("<MrConductor> <", "<img height=\"16\" width=\"16\" src=\"/resources/discord.png\" title=\"<MrConductor> \"><", $line);
                $line = str_replace("<MrConductor1> <", "<img height=\"16\" width=\"16\" src=\"/resources/discord.png\" title=\"<MrConductor> \"><", $line);
                //}
                $buffer .= "
" . $line . "
";
                $line_number++;
                $buffer .= "";
            }
            fclose($handle);
        } else {
            // error opening the file.
        }
		$buffer .= "
";
        if (!isset($_GET['plain'])) {
            if (isset($yesterday) && file_exists("logs/#" . $chan . "/" . $yesterday . ".log")) {
                $buffer .= "<<Prev ";
            }
            if (isset($tomorrow) && file_exists("logs/#" . $chan . "/" . $tomorrow . ".log")) {
                $buffer .= "Next>> ";
            } else {
                if (!isset($_GET['refresh'])) {
                    $buffer .= "Auto Refresh ";
                } else {
                    $buffer .= "Stop Auto Refresh ";
                    $buffer .= "";
                }
            }
            $buffer .= "Scroll to Top ";
            $buffer .= "
 ";
            $buffer = $tidy->repairString($buffer, array(
                'preserve-entities' => true
            ), "utf8");
        }
        echo $buffer;
    } else {
        echo "Specified file '$escaped' doesn't exist";
    }
}
?>


text:
package org.wso2.carbon.user.mgt;

import org.apache.axis2.AxisFault;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.CarbonConstants;
import org.wso2.carbon.context.CarbonContext;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.context.RegistryType;
import org.wso2.carbon.identity.core.util.IdentityUtil;
import org.wso2.carbon.user.api.AuthorizationManager;
import org.wso2.carbon.user.api.UserRealmService;
import org.wso2.carbon.user.core.UserCoreConstants;
import org.wso2.carbon.user.core.UserRealm;
import org.wso2.carbon.user.core.UserStoreException;
import org.wso2.carbon.user.core.util.UserCoreUtil;
import org.wso2.carbon.user.mgt.common.ClaimValue;
import org.wso2.carbon.user.mgt.common.FlaggedName;
import org.wso2.carbon.user.mgt.common.UIPermissionNode;
import org.wso2.carbon.user.mgt.common.UserAdminException;
import org.wso2.carbon.user.mgt.common.UserRealmInfo;
import org.wso2.carbon.user.mgt.internal.UserMgtDSComponent;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;

import javax.activation.DataHandler;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;

public class UserAdmin {

    private static final Log log = LogFactory.getLog(UserAdmin.class);

    public UserAdmin() {

    }

    /*
     * (non-Javadoc)
     *
     * @see
     * org.wso2.carbon.user.mgt.UserAdmin#listInternalUsers(java.lang.String)
     */
    /*
     * (non-Javadoc)
     *
     * @see org.wso2.carbon.user.mgt.TestClass#listUsers(java.lang.String)
     */
    public String[] listUsers(String filter, int limit) throws UserAdminException {
        String[] users;
        users = getUserAdminProxy().listUsers(filter, limit);
        return users;
    }

    /**
     * @param filter
     * @param limit
     * @return
     * @throws UserAdminException
     */
    public FlaggedName[] listAllUsers(String filter, int limit) throws UserAdminException {

        FlaggedName[] names;
        names = getUserAdminProxy().listAllUsers(filter, limit);
        return names;
    }

    /**
     * Get list of users which have given permission
     *
     * @param filter     filter to check
     * @param permission permission to check
     * @param limit
     * @return
     * @throws UserAdminException
     */
    public FlaggedName[] listAllUsersWithPermission(String filter, String permission, int limit) throws
            UserAdminException {

        List<FlaggedName> permittedUsers = new ArrayList<>();
        try {
            org.wso2.carbon.user.api.UserRealm realm = UserMgtDSComponent.getRealmService().getTenantUserRealm
                    (PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
            AuthorizationManager authorizationManager = realm.getAuthorizationManager();

            FlaggedName[] users = getUserAdminProxy().listAllUsers(filter, limit);

            for (int i = 0; i < users.length - 1; i++) {
                if (authorizationManager.isUserAuthorized(users[i].getItemName(),
                        permission, UserMgtConstants.EXECUTE_ACTION)) {
                    permittedUsers.add(users[i]);
                }
            }
            permittedUsers.add(users[users.length - 1]);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserAdminException("Error while filtering authorized users.", e);
        }
        FlaggedName[] permittedUsersArray = new FlaggedName[permittedUsers.size()];
        return permittedUsers.toArray(permittedUsersArray);

    }

    /*
     * (non-Javadoc)
     *
     * @see org.wso2.carbon.user.mgt.UserAdmin#getInternalRoles()
     */
    /*
     * (non-Javadoc)
     *
     * @see org.wso2.carbon.user.mgt.TestClass#getAllRolesNames()
     */
    public FlaggedName[] getAllRolesNames(String filter, int limit) throws UserAdminException {
        return getUserAdminProxy().getAllRolesNames(filter, limit);
    }

    /**
     * Get list of roles which have given permission
     *
     * @param filter     filter to check
     * @param permission permission to check
     * @param limit
     * @return
     * @throws UserAdminException
     */
    public FlaggedName[] getAllPermittedRoleNames(String filter, String permission, int limit) throws
            UserAdminException {

        FlaggedName[] roles = getUserAdminProxy().getAllRolesNames(filter, limit);
        List<FlaggedName> permittedRoles = new ArrayList<>();
        try {
            org.wso2.carbon.user.api.UserRealm realm = UserMgtDSComponent.getRealmService().getTenantUserRealm
                    (PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
            AuthorizationManager authorizationManager = realm.getAuthorizationManager();
            for (int i = 0; i < roles.length - 1; i++) {
                if (authorizationManager.isRoleAuthorized(roles[i].getItemName(), permission, UserMgtConstants
                        .EXECUTE_ACTION)) {
                    permittedRoles.add(roles[i]);
                }
            }
            permittedRoles.add(roles[roles.length - 1]);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserAdminException("Error while filtering authorized roles.", e);
        }
        FlaggedName[] permittedRolesArray = new FlaggedName[permittedRoles.size()];
        return permittedRoles.toArray(permittedRolesArray);
    }

    public FlaggedName[] getAllSharedRoleNames(String filter, int limit) throws UserAdminException {
        return getUserAdminProxy().getAllRolesNames(filter, limit);
    }

    /*
     * (non-Javadoc)
     *
     * @see org.wso2.carbon.user.mgt.TestClass#isWritable()
     */
    public UserRealmInfo getUserRealmInfo() throws UserAdminException {
        return getUserAdminProxy().getUserRealmInfo();
    }    ///

    /*
     * (non-Javadoc)
     *
     * @see
     * org.wso2.carbon.user.mgt.UserAdmin#addUserToInternalStore(java.lang.String
     * , java.lang.String, java.lang.String[])
     */
    /*
     * (non-Javadoc)
     *
     * @see org.wso2.carbon.user.mgt.TestClass#addUser(java.lang.String,
     * java.lang.String, java.lang.String[], java.util.Map, java.lang.String)
     */
    public void addUser(String userName, String password, String[] roles, ClaimValue[] claims,
                        String profileName) throws UserAdminException {
        try {
            getUserAdminProxy().addUser(userName, password, roles, claims, profileName);
        } catch (UserAdminException e) {
            throw e;
        }
    }

    /*
     * (non-Javadoc)
     *
     * @see org.wso2.carbon.user.mgt.UserAdmin#changePassword(java.lang.String,
     * java.lang.String)
     */
    /*
     * (non-Javadoc)
     *
     * @see org.wso2.carbon.user.mgt.TestClass#changePassword(java.lang.String,
     * java.lang.String)
     */
    public void changePassword(String userName, String newPassword) throws UserAdminException {

        try {
            getUserAdminProxy().changePassword(userName, newPassword);
        } catch (UserAdminException e) {
            throw e;
        }

    }

    /*
     * (non-Javadoc)
     *
     * @see
     * org.wso2.carbon.user.mgt.UserAdmin#deleteUserFromInternalStore(java.lang
     * .String)
     */
    /*
     * (non-Javadoc)
     *
     * @see org.wso2.carbon.user.mgt.TestClass#deleteUser(java.lang.String)
     */
    public void deleteUser(String userName) throws UserAdminException {

        try {
            getUserAdminProxy().deleteUser(userName,
                    CarbonContext.getThreadLocalCarbonContext().getRegistry(RegistryType.USER_CONFIGURATION));
        } catch (UserAdminException e) {
            throw e;
        }

    }

    /*
     * (non-Javadoc)
     *
     * @see
     * org.wso2.carbon.user.mgt.UserAdmin#addRoleToInternalStore(java.lang.String
     * , java.lang.String[], java.lang.String[])
     */
    /*
     * (non-Javadoc)
     *
     * @see org.wso2.carbon.user.mgt.TestClass#addRole(java.lang.String,
     * java.lang.String[], java.util.Map)
     */
    public void addRole(String roleName, String[] userList, String[] permissions, boolean isSharedRole)
            throws UserAdminException {
        addUserRole(roleName, userList, permissions, isSharedRole, false);
    }

    private void addUserRole(String roleName, String[] userList, String[] permissions, boolean isSharedRole, boolean
            isInternalRole) throws UserAdminException {

        if (permissions == null) {
            permissions = new String[0];
        }

        UserRealm realm = (UserRealm) CarbonContext.getThreadLocalCarbonContext().getUserRealm();
        if (!isAllowedRoleName(roleName, realm)) {
            throw new UserAdminException("Role name is reserved by the system.");
        }
        if (isInternalRole) {
            getUserAdminProxy().addInternalRole(roleName, userList, permissions);
        } else if (!(getUserAdminProxy().isRoleAndGroupSeparationEnabled()) || ArrayUtils.isEmpty(permissions)) {
            getUserAdminProxy().addRole(roleName, userList, permissions, isSharedRole);
        } else {
            String internalSystemRoleName = getInternalSystemRoleName(roleName);
            getUserAdminProxy().addInternalRole(internalSystemRoleName, new String[0], permissions);
            permissions = new String[0];
            getUserAdminProxy().addRole(roleName, userList, permissions, isSharedRole);
            getUserAdminProxy().updateGroupListOfHybridRole(internalSystemRoleName, null,
                    new String[]{roleName});
        }
    }

    private String getInternalSystemRoleName(String roleName) {

        return UserCoreConstants.INTERNAL_SYSTEM_ROLE_PREFIX + UserCoreUtil.extractDomainFromName(roleName)
                .toLowerCase() + "_" + UserCoreUtil.removeDomainFromName(roleName);
    }

    /**
     * @param roleName
     * @param userList
     * @param permissions
     * @throws UserAdminException
     */
    public void addInternalRole(String roleName, String[] userList, String[] permissions)
            throws UserAdminException {

        /* Block the role names with the prefix 'system_' as it is used for the special roles created by the system in
        order to maintain the backward compatibility. */
        if (getUserAdminProxy().isRoleAndGroupSeparationEnabled() && StringUtils
                .startsWithIgnoreCase(roleName, UserCoreConstants.INTERNAL_SYSTEM_ROLE_PREFIX)) {
            String errorMessage = String.format("Invalid role name: %s. Role names with the prefix: %s, is not allowed"
                            + " to be created from externally in the system.", roleName,
                    UserCoreConstants.INTERNAL_SYSTEM_ROLE_PREFIX);
            throw new UserAdminException(errorMessage);
        }
        addUserRole(roleName, userList, permissions, false, true);
    }

    /**
     * @param roleName
     * @param realm
     * @return
     * @throws UserAdminException
     */
    private boolean isAllowedRoleName(String roleName, UserRealm realm) throws UserAdminException {

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

        int index;
        index = roleName.indexOf(CarbonConstants.DOMAIN_SEPARATOR);

        if (index > 0) {
            roleName = roleName.substring(index + 1);
        }

        try {
            return !realm.getRealmConfiguration().isReservedRoleName(roleName);
        } catch (UserStoreException e) {
            throw new UserAdminException(e.getMessage(), e);
        }
    }

    /*
     * (non-Javadoc)
     *
     * @see
     * org.wso2.carbon.user.mgt.UserAdmin#deleteRoleFromInternalStore(java.lang
     * .String)
     */
    /*
     * (non-Javadoc)
     *
     * @see org.wso2.carbon.user.mgt.TestClass#deleteRole(java.lang.String)
     */
    public void deleteRole(String roleName) throws UserAdminException {

        getUserAdminProxy().deleteRole(roleName);
        if (getUserAdminProxy().isRoleAndGroupSeparationEnabled()) {
            String internalSystemRoleName = getInternalSystemRoleName(roleName);
            if (getUserAdminProxy().isExistingHybridRole(internalSystemRoleName)) {
                getUserAdminProxy().deleteRole(appendInternalDomain(internalSystemRoleName));
            }
        }
    }

    /**
     * @param roleName
     * @param newRoleName
     * @throws UserAdminException
     */
    public void updateRoleName(String roleName, String newRoleName) throws UserAdminException {

        try {
            boolean isInternalRole = false;
            if (isInternalRole(roleName)) {
                isInternalRole = true;
            }
            String internalSystemRoleName;
            String newInternalSystemRoleName;
            if (!isInternalRole) {
                internalSystemRoleName = getInternalSystemRoleName(roleName);
                newInternalSystemRoleName = getInternalSystemRoleName(newRoleName);
                if (getUserAdminProxy().isRoleAndGroupSeparationEnabled() &&
                        getUserAdminProxy().isExistingHybridRole(internalSystemRoleName)) {
                    getUserAdminProxy().updateRoleName(appendInternalDomain(internalSystemRoleName),
                            appendInternalDomain(newInternalSystemRoleName));
                    getUserAdminProxy().updateRoleName(roleName, newRoleName);
                    getUserAdminProxy().updateGroupListOfHybridRole(newInternalSystemRoleName, new String[]{roleName},
                            new String[]{newRoleName});
                } else {
                    getUserAdminProxy().updateRoleName(roleName, newRoleName);
                }
            } else {
                getUserAdminProxy().updateRoleName(roleName, newRoleName);
            }
        } catch (UserAdminException e) {
            throw e;
        }
    }

    /**
     * @return
     * @throws UserAdminException
     */
    public boolean hasMultipleUserStores() throws UserAdminException {
        return getUserAdminProxy().hasMultipleUserStores();
    }

    /*
     * (non-Javadoc)
     *
     * @see org.wso2.carbon.user.mgt.UserAdmin#getUsersInRole(java.lang.String)
     */
    /*
     * (non-Javadoc)
     *
     * @see
     * org.wso2.carbon.user.mgt.TestClass#getUsersInfoOfRole(java.lang.String,
     * java.lang.String)
     */
    public FlaggedName[] getUsersOfRole(String roleName, String filter, int limit) throws UserAdminException {
        return getUserAdminProxy().getUsersOfRole(roleName, filter, limit);
    }

    /*
     * (non-Javadoc)
     *
     * @see
     * org.wso2.carbon.user.mgt.UserAdmin#updateUsersOfRole(java.lang.String,
     * java.lang.String[], java.lang.String[])
     */
    /*
     * (non-Javadoc)
     *
     * @see
     * org.wso2.carbon.user.mgt.TestClass#updateUsersOfRole(java.lang.String,
     * java.lang.String[], java.lang.String[])
     */
    public void updateUsersOfRole(String roleName, FlaggedName[] userList)
            throws UserAdminException {

        try {
            getUserAdminProxy().updateUsersOfRole(roleName, userList);
        } catch (UserAdminException e) {
            throw e;
        }
    }

    /*
     * (non-Javadoc)
     *
     * @see org.wso2.carbon.user.mgt.UserAdmin#getUsersInRole(java.lang.String)
     */
    /*
     * (non-Javadoc)
     *
     * @see
     * org.wso2.carbon.user.mgt.TestClass#getRoleInfoOfUser(java.lang.String)
     */
    public FlaggedName[] getRolesOfUser(String userName, String filter, int limit) throws UserAdminException {
        return getUserAdminProxy().getRolesOfUser(userName, filter, limit);
    }

    // FIXME: Fix the documentation of this class including this.
    public FlaggedName[] getRolesOfCurrentUser() throws UserAdminException {
        return getRolesOfUser(CarbonContext.getThreadLocalCarbonContext().getUsername(), "*", -1);
    }   ///

    /*
     * (non-Javadoc)
     *
     * @see
     * org.wso2.carbon.user.mgt.TestClass#updateRolesOfUser(java.lang.String,
     * java.lang.String)
     */
    public void updateRolesOfUser(String userName, String[] newRoleList) throws UserAdminException {

        try {
            getUserAdminProxy().updateRolesOfUser(userName, newRoleList);
        } catch (UserAdminException e) {
            throw e;
        }
    }

    /**
     * @return
     * @throws UserAdminException
     */
    public UIPermissionNode getAllUIPermissions() throws UserAdminException {
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        return getUserAdminProxy().getAllUIPermissions(tenantId);
    }

    /**
     * @param roleName
     * @return
     * @throws UserAdminException
     */
    public UIPermissionNode getRolePermissions(String roleName) throws UserAdminException {

        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();

        if (!getUserAdminProxy().isRoleAndGroupSeparationEnabled() || isInternalRole(roleName)) {
            return getUserAdminProxy().getRolePermissions(roleName, tenantId);
        } else {
            List<String> roles = getUserAdminProxy()
                    .getHybridRoleListOfGroup(UserCoreUtil.removeDomainFromName(roleName),
                            UserCoreUtil.extractDomainFromName(roleName));
            return getUserAdminProxy().getRolePermissions(roles, tenantId);
        }
    }

    /**
     * @param roleName
     * @param rawResources
     * @throws UserAdminException
     */
    public void setRoleUIPermission(String roleName, String[] rawResources) throws UserAdminException {

        if (!getUserAdminProxy().isRoleAndGroupSeparationEnabled() || isInternalRole(roleName)) {
            getUserAdminProxy().setRoleUIPermission(roleName, rawResources);
        } else {
            String internalSystemRoleName = getInternalSystemRoleName(roleName);
            if (getUserAdminProxy().isExistingHybridRole(internalSystemRoleName)) {
                getUserAdminProxy().setRoleUIPermission(appendInternalDomain(internalSystemRoleName), rawResources);
            } else {
                getUserAdminProxy().addInternalRole(internalSystemRoleName, new String[0], rawResources);
                getUserAdminProxy().updateGroupListOfHybridRole(internalSystemRoleName, new String[]{roleName},
                        new String[]{roleName});
            }
        }
    }

    private String appendInternalDomain(String roleName) {

        if (!roleName.contains(UserCoreConstants.DOMAIN_SEPARATOR)) {
            return UserCoreConstants.INTERNAL_DOMAIN + UserCoreConstants.DOMAIN_SEPARATOR + roleName;
        }
        return roleName;
    }

    private boolean isInternalRole(String roleName) {

        String domain = UserCoreUtil.extractDomainFromName(roleName);
        if (UserCoreConstants.INTERNAL_DOMAIN.equalsIgnoreCase(domain) || UserCoreConstants.WORKFLOW_DOMAIN
                .equalsIgnoreCase(domain) || UserCoreConstants.APPLICATION_DOMAIN.equalsIgnoreCase(domain)
                || UserCoreConstants.SYSTEM_DOMAIN_NAME.equalsIgnoreCase(domain)) {
            return true;
        }
        return false;
    }

    /**
     * @param userStoreDomain
     * @param fileName
     * @param handler
     * @param defaultPassword
     * @throws UserAdminException
     */
    public void bulkImportUsers(String userStoreDomain, String fileName, DataHandler handler, String defaultPassword)
            throws UserAdminException {
        //password will no longer be used, instead the password will be taken from the file
        if (fileName == null || handler == null) {
            throw new UserAdminException("Required data not provided");
        }
        if (StringUtils.isEmpty(userStoreDomain)) {
            userStoreDomain = IdentityUtil.getPrimaryDomainName();
        }
        try {
            InputStream inStream = handler.getInputStream();
            getUserAdminProxy().bulkImportUsers(userStoreDomain, fileName, inStream, defaultPassword);
        } catch (IOException e) {
            log.error(e.getMessage(), e);
            throw new UserAdminException(e.getMessage(), e);
        }

    }

    /**
     * @param oldPassword
     * @param newPassword
     * @throws UserAdminException
     * @throws AxisFault
     */
    public void changePasswordByUser(String userName, String oldPassword, String newPassword)
            throws UserAdminException {

        String result = null;
        try {
            String tenantDomain = MultitenantUtils.getTenantDomain(userName);
            UserRealmService realmService = UserMgtDSComponent.getRealmService();
            int tenantId = realmService.getTenantManager().getTenantId(tenantDomain);
            org.wso2.carbon.user.api.UserRealm userRealm = realmService.getTenantUserRealm(tenantId);
            String tenantAwareUsername = MultitenantUtils.getTenantAwareUsername(userName);
            boolean isAuthenticated = userRealm.getUserStoreManager().authenticate(tenantAwareUsername, oldPassword);
            if (isAuthenticated) {
                getUserAdminProxy().changePasswordByUser(userName, oldPassword, newPassword);
            } else {
                throw new UserAdminException("The current password you entered is incorrect. ");
            }
        } catch (UserAdminException e) {
            throw e;
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserAdminException("Error while updating password. Please enter tenant unaware username",
                    e);
        }

    }

    /**
     * @param roleName
     * @param newUsers
     * @param deletedUsers
     * @throws UserAdminException
     */
    public void addRemoveUsersOfRole(String roleName, String[] newUsers, String[] deletedUsers)
            throws UserAdminException {

        try {
            getUserAdminProxy().updateUsersOfRole(roleName, newUsers, deletedUsers);
        } catch (UserAdminException e) {
            throw e;
        }
    }

    /**
     * @param userName
     * @param newRoles
     * @param deletedRoles
     * @throws UserAdminException
     */
    public void addRemoveRolesOfUser(String userName, String[] newRoles, String[] deletedRoles)
            throws UserAdminException {

        try {
            getUserAdminProxy().updateRolesOfUser(userName, newRoles, deletedRoles);
        } catch (UserAdminException e) {
            throw e;
        }
    }

    /**
     * @param claimValue
     * @param filter
     * @param maxLimit
     * @return
     * @throws UserAdminException
     */
    public FlaggedName[] listUserByClaim(ClaimValue claimValue, String filter, int maxLimit)
            throws UserAdminException {
        return getUserAdminProxy().listUsers(claimValue, filter, maxLimit);
    }

    /**
     * List users with given claim value and permission
     *
     * @param claimValue claim to check
     * @param filter     filter to check
     * @param permission permission to check
     * @param maxLimit
     * @return
     * @throws UserAdminException
     */
    public FlaggedName[] listUserByClaimWithPermission(ClaimValue claimValue, String filter, String permission, int
            maxLimit)
            throws UserAdminException {

        List<FlaggedName> permittedUsers = new ArrayList<>();
        try {
            org.wso2.carbon.user.api.UserRealm realm = UserMgtDSComponent.getRealmService().getTenantUserRealm
                    (PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId());
            AuthorizationManager authorizationManager = realm.getAuthorizationManager();
            FlaggedName[] users = getUserAdminProxy().listUsers(claimValue, filter, maxLimit);
            for (int i = 0; i < users.length - 1; i++) {
                if (authorizationManager.isUserAuthorized(users[i].getItemName(),
                        permission, UserMgtConstants.EXECUTE_ACTION)) {
                    permittedUsers.add(users[i]);
                }
            }
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            throw new UserAdminException("Error while filtering authorized users.", e);
        }
        FlaggedName[] permittedUsersArray = new FlaggedName[permittedUsers.size()];
        return permittedUsers.toArray(permittedUsersArray);
    }

    /**
     * @return
     */
    private UserRealmProxy getUserAdminProxy() {
        UserRealm realm = (UserRealm) CarbonContext.getThreadLocalCarbonContext().getUserRealm();
        return new UserRealmProxy(realm);
    }

    public boolean isSharedRolesEnabled() throws UserAdminException {
        return getUserAdminProxy().isSharedRolesEnabled();
    }
}


text:
package org.optaplanner.core.impl.heuristic.selector.value.chained;

import org.optaplanner.core.impl.domain.variable.descriptor.GenuineVariableDescriptor;
import org.optaplanner.core.impl.heuristic.selector.ListIterableSelector;

public interface SubChainSelector extends ListIterableSelector<SubChain> {

    /**
     * @return never null
     */
    GenuineVariableDescriptor getVariableDescriptor();

}


text:
/**
 * \file PCI device functions
 */

/*
 * Copyright (c) 2009, ETH Zurich.
 * All rights reserved.
 *
 * This file is distributed under the terms in the attached LICENSE file.
 * If you do not find this file, copies can be found by writing to:
 * ETH Zurich D-INFK, Universitaetstrasse 6, CH-8092 Zurich. Attn: Systems Group.
 */

#ifndef PCI_DEVICES_H
#define PCI_DEVICES_H

#include "lpc.h"
#include "guest.h"

struct pci_device *pci_hostbridge_new(void);
struct pci_device *pci_ethernet_new(struct lpc *lpc, struct guest *g);
struct pci_device *pci_vmkitmon_eth_new(struct lpc *lpc, struct guest *g);

#endif