text:
'use strict';

var __ = require('underscore'),
    loadTemplate = require('../utils/loadTemplate'),
    app = require('../App.js').getApp(),
    remote = require('electron').remote,
    ServerConfigMd = require('../models/serverConfigMd'),
    BaseModal = require('./baseModal'),
    ServerConnectHeaderVw = require('./serverConnectHeaderVw'),
    ServerConfigFormVw = require('./serverConfigFormVw'),
    ServerConfigsVw = require('./serverConfigsVw');

module.exports = BaseModal.extend({
  className: 'server-connect-modal',

  events: {
    'click .js-close': 'closeConfigForm',
    'click .js-new': 'newConfigForm',
    'click .js-msg-bar-close': 'hideMessageBar'
  },

  initialize: function(options) {
    this.options = options || {};

    if (!options.userModel) {
      throw new Error('Please provide a user model.');
    }

    this._headerState = {};

    this.headerVw = new ServerConnectHeaderVw();
    this.setHeaderState({
      msg: { translate: 'serverConnectModal.serverConfigsHeaderMsg' },
      title: { translate: 'serverConnectModal.serverConfigsTitle' },
      showNew: true
    });
    setTimeout(() => this.registerChild(this.headerVw));

    this.serverConfigs = app.serverConfigs;
    this.serverConfigsVw = new ServerConfigsVw({
      collection: this.serverConfigs
    });
    setTimeout(() => this.registerChild(this.serverConfigsVw));

    this.listenTo(this.serverConfigsVw, 'edit-config', this.onEditConfig);
    this.listenTo(this.serverConfigsVw, 'connect', this.onConnectClick);
    this.listenTo(this.serverConfigsVw, 'cancel', this.onCancelClick);

    options.userModel.on('change:language', () => {
      this.setHeaderState(this._headerState);
      this.serverConfigFormVw && this.serverConfigFormVw.render();
      this.serverConfigsVw.render();
    });
  },

  setHeaderState: function(state) {
    // In order to properly translate the msg and title and update the
    // translations upon a language change, rather than providing a literal
    // string, please provide an object with the Polyglot key in a 'translation'
    // property, e.g:
    // {
    //   title: { translate: 'polyglotKey' },
    //   msg: 'my literal string' // if you dont want to translate
    // }
    var translatedState;

    this._headerState = __.extend(this._headerState, state || {});
    translatedState = __.extend({}, this._headerState);

    Object.keys(this._headerState).forEach((key) => {
      if (['msg', 'title'].indexOf(key) !== -1) {
        if (this._headerState[key]['translate']) {
          translatedState[key] = window.polyglot.t(this._headerState[key]['translate']);
        }
      }
    });

    this.headerVw.setState(translatedState);
  },

  hideMessageBar: function() {
    this.$jsMsgBar.addClass('slide-out');
  },

  showMessageBar: function(msg) {
    this.$jsMsgBar
      .find('.js-message-bar-content')
      .html(msg)
      .end()
      .removeClass('slide-out');
  },

  closeConfigForm: function() {
    if (!this.$jsConfigFormWrap) return;

    this.$jsConfigFormWrap.addClass('slide-out');

    this.setHeaderState({
      msg: { translate: 'serverConnectModal.serverConfigsHeaderMsg' },
      title: { translate: 'serverConnectModal.serverConfigsTitle' },
      showNew: true
    });

    return this;
  },

  showConfigForm: function(configMd) {
    var model = configMd;

    if (!model) {
      model = new ServerConfigMd();
      model.__collection = this.serverConfigs;
    }

    this.setHeaderState({
      title: model.get('name') || { translate: 'serverConnectModal.newConfigTitle' },
      msg:  configMd ?
        { translate: 'serverConnectModal.editConfigHeaderMsg' } :
        { translate: 'serverConnectModal.newConfigHeaderMsg' },
      showNew: false
    });

    this.renderServerConfigForm(model);

    this.listenTo(model, 'change:name', (md) => {
      this.setHeaderState({
        title: md.get('name')
      });
    });

    this.listenTo(model, 'sync', (md) => {
      this.serverConfigs.add(md);
      this.closeConfigForm();
      this.connect(md);
    });

    if (this.isOpen()) {
      this.$jsConfigFormWrap.one('transitionend', () => {
        this.serverConfigFormVw.$('input[name="name"]').focus();
      }).removeClass('slide-out');
    } else {
      this.$jsConfigFormWrap.addClass('no-transition')
        .removeClass('slide-out');

      setTimeout(() => {
        this.serverConfigFormVw.$('input[name="name"]').focus();
        this.$jsConfigFormWrap.removeClass('no-transition');
      }, 0);
    }

    return this;
  },

  newConfigForm: function() {
    this.showConfigForm();
  },

  onEditConfig: function(e) {
    this.showConfigForm(e.model);
  },

  onCancelClick: function() {
    this._connectAttempt && this._connectAttempt.cancel();
  },

  onConnectClick: function(e) {
    this.connect(e.model);
  },

  succeedConnection: function(configMd) {
    // Sets the state of the modal to reflect a successful connection
    // for the given config.

    // todo: validate args

    this._connectedServer = configMd;

    if (this._connectAttempt && this._connectAttempt.state() === 'pending') return this;

    this.serverConfigsVw.setConnectionState({
      id: configMd.id,
      status: 'connected'
    });

    this.hideMessageBar();
    this.setModalOptions({
      dismissOnOverlayClick: true,
      dismissOnEscPress: true,
      showCloseButton: true
    });

    return this;
  },

  failConnection: function(reason, configMd) {
    // Sets the state of the modal to reflect a failed connection
    // for the given config.

    // todo: validate args

    var msg;

    if (this._connectedServer && this._connectedServer.id === configMd.id) this._connectedServer = null;
    if (this._connectAttempt && this._connectAttempt.state() === 'pending') return this;

    this.serverConfigsVw.setConnectionState({
      id: configMd.id,
      status: reason === 'canceled' ? 'not-connected' : 'failed'
    });

    msg = window.polyglot.t('serverConnectModal.connectionFailed', {
      serverName: configMd.get('name')
    });

    if (reason === 'failed-auth-too-many') {
      msg += `— ${window.polyglot.t('serverConnectModal.authFailedTooManyAttempts')}`;
    } else if (reason === 'failed-auth') {
      msg += `— ${window.polyglot.t('serverConnectModal.authFailed')}`;
    }

    reason !== 'canceled' && this.showMessageBar(msg);
    this.setModalOptions({
      dismissOnOverlayClick: false,
      dismissOnEscPress: false,
      showCloseButton: false
    });

    return this;
  },

  connect: function(configMd) {
    var deferred = $.Deferred(),
        promise = deferred.promise(),
        attempt = 1,
        maxAttempts = 5,
        maxAttemptsTime = 20 * 1000,
        startTime = Date.now(),
        attemptConnection,
        connectAttempt;

    configMd = configMd || this.serverConfigs.getActive();

    if (!configMd) {
      throw new Error(`Unable to connect because no config was provided, nor is there a stored
        active configuration in the ServerConfigs collection.`);
    }

    this._connectAttempt && this._connectAttempt.cancel();
    this.hideMessageBar();

    if (this._connectedServer) {
      this.serverConfigsVw.setConnectionState({
        id: this._connectedServer.id,
        status: 'not-connected'
      });

      this._connectedServer = null;
    }

    this.serverConfigsVw.setConnectionState({
      id: configMd.id,
      status: 'connecting'
    });

    this.setModalOptions({
      dismissOnOverlayClick: false,
      dismissOnEscPress: false,
      showCloseButton: false
    });
    this.serverConfigs.setActive(configMd.id);

    (attemptConnection = () => {
      connectAttempt = this.attemptConnection().done(() => {
        deferred.resolve();
        this.succeedConnection(configMd);
      }).fail((reason) => {
        // If we're using the client launched from the installer
        // and we're trying to connect to the default server, it will
        // take some time for the server to launch, so we'll retry a few
        // times.
        if (
          remote.getGlobal('launched_from_installer') && configMd.get('default') &&
          attempt < maxAttempts && Date.now() < (startTime + maxAttemptsTime) &&
          reason !== 'canceled'
        ) {
          attempt += 1;
          attemptConnection();
        } else {
          deferred.reject(reason);
          this.failConnection(reason, configMd);
        }
      });
    })();

    deferred.always(() => {
      this._connectAttempt = null;
    });

    promise.serverId = configMd.id;
    promise.cancel = function() {
      connectAttempt && connectAttempt.cancel();
    };

    this._connectAttempt = promise;

    return promise;
  },

  attemptConnection: function() {
    var self = this,
        deferred = $.Deferred(),
        promise = deferred.promise(),
        startTime = Date.now(),
        minAttemptTime = 1000,
        loginRequest,
        timesup,
        conclude,
        login,
        onClose;

    conclude = function(reject) {
      // Sometimes the connection attempt concludes so fast that the UI doesn't
      // even have a chance to show that we've tried to connect. So, we'll do a
      // bit of slight of hand to ensure the attempt takes at least 'minAttemptTime'.
      var _conclude = () =>
            deferred[reject ? 'reject' : 'resolve'].apply(promise, Array.prototype.slice.call(arguments, 1));

      if (
        startTime + minAttemptTime < Date.now() ||
        reject && arguments[1] === 'canceled'
      ) {
        _conclude();
      } else {
        setTimeout(_conclude, startTime + minAttemptTime - Date.now());
      }
    };

    login = function() {
      // check authentication
      loginRequest = app.login().done(function(data) {
        if (data.success) {
          conclude(false, data);
          self.trigger('connected');
        } else {
          if (data.reason === 'too many attempts') {
            conclude(true, 'failed-auth-too-many');
          } else {
            conclude(true, 'failed-auth');
          }
        }
      }).fail(function(jqxhr) {
        if (jqxhr.statusText === 'abort') return;

        // assuming rest server is down or
        // wrong port set
        conclude(true);
      });
    };

    app.connectHeartbeatSocket();

    promise.cleanup = function() {
      clearTimeout(timesup);
      clearTimeout(conclude);
      loginRequest && loginRequest.abort();
      app.getHeartbeatSocket().off(null, login);
      app.getHeartbeatSocket().off(null, onClose);
    };

    promise.cancel = function() {
      conclude(true, 'canceled');
    };

    promise.always(function() {
      promise.cleanup();
    });

    app.getHeartbeatSocket().on('open', login);

    app.getHeartbeatSocket().on('close', onClose = function() {
      // On local servers the close event on a down server is
      // almost instantaneous and the UI can't even show the
      // user we're attempting to connect. So we'll put up a bit
      // of a facade.
      conclude(true);
    });

    timesup = setTimeout(function() {
      // not timeing out our connections for now, due to
      // server issue where valid connections may take
      // 1 min. +
      // conclude(true, 'timedout');
      console.log('connection timeout');
    }, 10000);

    return promise;
  },

  getConnectedServer: function() {
    return this._connectedServer;
  },

  getConnectAttempt: function() {
    return this._connectAttempt;
  },

  close: function() {
    this.closeConfigForm();
    BaseModal.prototype.close.apply(this, arguments);
  },

  renderServerConfigForm: function(md) {
    this.serverConfigFormVw && this.serverConfigFormVw.remove();
    this.serverConfigFormVw = new ServerConfigFormVw({
      model: md
    });
    this.registerChild(this.serverConfigFormVw);

    this.$jsConfigFormWrap = this.$jsConfigFormWrap || this.$('.js-config-form-wrap');
    this.$jsConfigFormWrap.html(this.serverConfigFormVw.render().el);
  },

  render: function() {
    loadTemplate('./js/templates/serverConnectModal.html', (t) => {
      this.$el.html(t());
      BaseModal.prototype.render.apply(this, arguments);

      this.$('.js-header-wrap').html(this.headerVw.render().el);

      this.$('.js-config-list-wrap').html(
        this.serverConfigsVw.render().el
      );

      this.$jsMsgBar = this.$jsMsgBar || this.$('.js-msg-bar');
    });

    return this;
  }
});


text:
# include "SoVtkDataSetSurfaceFilter.h"
# include "SoVtkUtils.h"

# include "vtkAlgorithmOutput.h"
# include "vtkPolyData.h"

SO_ENGINE_SOURCE( SoVtkDataSetSurfaceFilter )

SoVtkDataSetSurfaceFilter::SoVtkDataSetSurfaceFilter()
{
	SO_ENGINE_CONSTRUCTOR(SoVtkDataSetSurfaceFilter);

	mObject = vtkDataSetSurfaceFilter::New();
	mObject->Register(0);
	mObject->SetGlobalWarningDisplay(0);

	vtkDataSetSurfaceFilter *aDataSetSurfaceFilter = vtkDataSetSurfaceFilter::New();
	double *x = 0;
	int *y = 0;
	float *z = 0;

	SO_ENGINE_ADD_INPUT(PieceInvariant, (0));
	PieceInvariant.setValue(aDataSetSurfaceFilter->GetPieceInvariant());

	SO_ENGINE_ADD_INPUT(UseStrips, (0));
	UseStrips.setValue(aDataSetSurfaceFilter->GetUseStrips());

	SO_ENGINE_ADD_INPUT(InputConnection, (0));

	aDataSetSurfaceFilter->Delete();

	SO_ENGINE_ADD_OUTPUT( Output, SoSFVtkObject );
	mOutput = 0;
	SO_ENGINE_ADD_OUTPUT( OutputPort, SoSFVtkAlgorithmOutput );
	mOutputPort = 0;

	addCalled = 0;
}

SoVtkDataSetSurfaceFilter::~SoVtkDataSetSurfaceFilter()
{
	// Deletion of the objects if they exist
	if ( mOutput )
	{

		mOutput->unref();
		mOutput = 0;
	}

	if ( mOutputPort )
	{

		mOutputPort->unref();
		mOutputPort = 0;
	}

	if ( mObject )
	{
		mObject->UnRegister(0);
		mObject->Delete();
		mObject = 0;
	}

}

void SoVtkDataSetSurfaceFilter::initClass()
{
	SO_ENGINE_INIT_CLASS( SoVtkDataSetSurfaceFilter, SoEngine, "Engine" );
}

void SoVtkDataSetSurfaceFilter::evaluate()
{
	try
	{
		// Get the input type(s)
		SoVtkAlgorithmOutput *inputPortPtr = InputConnection.getValue();

		if (inputPortPtr)
			mObject->SetInputConnection(inputPortPtr->getPointer());

		// Deletion of the objects if they exist
		if ( mOutput )
		{

			mOutput->unref();
			mOutput = 0;
		}

		if ( mOutputPort )
		{

			mOutputPort->unref();
			mOutputPort = 0;
		}

		if ( addCalled )
		{
			reset();
			addCalled = 0;
		}

		mObject->GetOutput()->Register(0);
		mOutput = new SoVtkObject();
		mOutput->ref();
		mOutput->setPointer( mObject->GetOutput() );

		if ( mObject->GetNumberOfOutputPorts() > 0 )
		{
			mObject->GetOutputPort()->Register(0);
			mOutputPort = new SoVtkAlgorithmOutput();
			mOutputPort->ref();
			mOutputPort->setPointer( mObject->GetOutputPort() );
		}

	}
	catch(...)
	{
		SoDebugError::post( __FILE__, "Unknown Exception" );
		return;
	}
	SO_ENGINE_OUTPUT( Output, SoSFVtkObject, setValue( mOutput ) );
	SO_ENGINE_OUTPUT( OutputPort, SoSFVtkAlgorithmOutput, setValue( mOutputPort ) );
}

void SoVtkDataSetSurfaceFilter::inputChanged(SoField * f)
{
	// Get the PieceInvariant value
	if ( f == &PieceInvariant )
		SO_VTK_SET_FIELD_VALUE( mObject, PieceInvariant);

	// Get the UseStrips value
	if ( f == &UseStrips )
		SO_VTK_SET_FIELD_VALUE( mObject, UseStrips);

	mObject->Update();
}

void SoVtkDataSetSurfaceFilter::reset()
{
	mObject->UnRegister(0);
	mObject->Delete();
	mObject = 0;
	mObject = vtkDataSetSurfaceFilter::New();
	mObject->Register(0);
	mObject->SetGlobalWarningDisplay(0);
	// Get the input type(s)
	SoVtkAlgorithmOutput *inputPortPtr = InputConnection.getValue();

	if (inputPortPtr)
		mObject->SetInputConnection(inputPortPtr->getPointer());

	// Get the PieceInvariant value

		SO_VTK_SET_FIELD_VALUE( mObject, PieceInvariant);

	// Get the UseStrips value

		SO_VTK_SET_FIELD_VALUE( mObject, UseStrips);

	mObject->Update();
}

redpajama_set_name: RedPajamaGithub


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
using _404.ProcessStore;

namespace _404.Tests.Integration
{
    [TestFixture]
    class ProcessLookupTests
    {

        [Test]
        public void Retrieves_Correct_Process_Name_Before_Trace_Was_Started()
        {
            var process = Process.Start("cmd", "/c waitfor /T 10 kkkkkkk");
            var eventTime = DateTime.Now;

            var processStore = new ProcessNameStore();
            var name = processStore.ProcessName(process.Id, eventTime);

            process.Kill();

            Assert.AreEqual("cmd", name);
        }

        [Test]
        public void Retrieves_Correct_Process_Name_During_Trace()
        {
            var processStore = new ProcessNameStore();
            Thread.Sleep(5000);

            var process = Process.Start("waitfor", "/T 10 tttttt");
            var eventTime = DateTime.Now;

            Thread.Sleep(5000);

            var name = processStore.ProcessName(process.Id, eventTime);

            Assert.AreEqual("conhost", Path.GetFileNameWithoutExtension(name));
        }

    }
}


text:
package ti.modules.titanium.xml;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.StringWriter;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;

import org.appcelerator.kroll.KrollModule;
import org.appcelerator.kroll.annotations.Kroll;
import org.appcelerator.kroll.common.Log;
import org.xml.sax.SAXException;

@Kroll.module
public class XMLModule extends KrollModule
{

	private static DocumentBuilder builder;
	private static final String TAG = "XMLModule";
	private static TransformerFactory transformerFactory;

	static
	{
		try {
			DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
			factory.setNamespaceAware(true);
			builder = factory.newDocumentBuilder();
		} catch (ParserConfigurationException e) {
			Log.e(TAG, "Error finding DOM implementation", e);
		}

		transformerFactory = TransformerFactory.newInstance();
	}

	public XMLModule()
	{
		super();
	}

	@Kroll.method
	public DocumentProxy parseString(String xml) throws SAXException, IOException
	{
		return parse(xml);
	}

	public static DocumentProxy parse(String xml) throws SAXException, IOException
	{
		return parse(xml, System.getProperty("file.encoding", "UTF-8"));
	}

	public static DocumentProxy parse(String xml, String encoding) throws SAXException, IOException
	{
		if (builder != null) {
			try {
				return new DocumentProxy(builder.parse(new ByteArrayInputStream(xml.getBytes(encoding))));
			} catch (SAXException e) {
				Log.e(TAG, "Error parsing XML", e);
				throw e;
			} catch (IOException e) {
				Log.e(TAG, "Error reading XML", e);
				throw e;
			}
		}
		return null;
	}

	@Kroll.method
	public String serializeToString(NodeProxy node) throws TransformerConfigurationException, TransformerException
	{
		Transformer transformer = transformerFactory.newTransformer();
		StringWriter writer = new StringWriter();
		transformer.transform(new DOMSource(node.getNode()), new StreamResult(writer));
		return writer.toString();
	}

	@Override
	public String getApiName()
	{
		return "Ti.XML";
	}
}


text:
package org.calrissian.mango.criteria.domain.criteria;

import org.calrissian.mango.domain.entity.EntityBuilder;
import org.junit.Test;

import static java.util.Comparator.naturalOrder;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;

public class LessThanCriteriaTest {

    @Test
    public void test() {

        LessThanCriteria criteria = new LessThanCriteria<>("key1", 5, naturalOrder(), null);

        EntityBuilder entity = EntityBuilder.create("type", "id");

        // first test without attribute existing
        assertFalse(criteria.test(entity.build()));

        entity = entity.attr("key1", 10);

        assertFalse(criteria.test(entity.build()));

        entity = entity.attr("key1", 4);

        assertTrue(criteria.test(entity.build()));
    }
}


text:
package de.szut.internalorganizer;

import java.io.FileWriter;
import java.io.IOException;

/**
 * Class for saving sudokufields
 *
 * @author dqi12huisinga
 *
 */
public class InternalSaver extends InternalOrganizer {
	private boolean restrictAccessToFile;

	public InternalSaver() {
		setRestrictAccessToFile(false);
	}

	public boolean isFileAccessRestricted() {
		return restrictAccessToFile;
	}

	public void setRestrictAccessToFile(boolean restrictFile) {
		this.restrictAccessToFile = restrictFile;
	}

	/**
	 * Method for saving the data
	 *
	 * @param fileName
	 * @param identifier
	 * @param field1
	 * @param field2
	 * @param field3
	 * @throws IOException
	 */
	public void saveData(String fileName, String identifier, String[][] field1,
			String[][] field2, String[][] field3) throws IOException {
		String lineSeparator = System.getProperty("line.separator");

		// Unlocks the file if necessary
		getFile().setReadable(true);
		getFile().setWritable(true);
		// Creates a new file if the respective file doesn't exist yet
		getFile().createNewFile();
		FileWriter fileWriter = new FileWriter(getFile());
		// Writes an identifier
		fileWriter.write(identifier + lineSeparator);
		// Writes data
		for (String[] currentLine : field1) {
			for (String currentDate : currentLine) {
				fileWriter.write(currentDate);
				fileWriter.write(getDataSeparator());
			}
			fileWriter.write(lineSeparator);
		}
		fileWriter.write(lineSeparator);
		// Writes data
		for (String[] currentLine : field2) {
			for (String currentDate : currentLine) {
				fileWriter.write(currentDate);
				fileWriter.write(getDataSeparator());
			}
			fileWriter.write(lineSeparator);
		}
		fileWriter.write(lineSeparator);
		// Writes data
		for (String[] currentLine : field3) {
			for (String currentDate : currentLine) {
				fileWriter.write(currentDate);
				fileWriter.write(getDataSeparator());
			}
			fileWriter.write(lineSeparator);
		}
		// Closes the FileWriter
		fileWriter.close();

		// Sets restricted access if necessary
		if (restrictAccessToFile) {
			getFile().setReadable(false);
			getFile().setWritable(false);
		}
	}
}


text:
'use strict';

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

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

 var SingleCtrl,
   scope;

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

 it('should have the correct initializations', function () {
   expect(scope.data).toEqual({});
   expect(scope.details).toEqual({details: null});
   expect(scope.modal).toEqual({isLanding: false});
   expect(scope.single).toEqual(true);
   expect(scope.details.details).toEqual(null);
   expect(scope.modal.isLanding).toEqual(false);
   expect(scope.showDetails).toEqual(false);
   expect(scope.showBreadCrumbs).toEqual(true);
 });

  it('should validate properly using spies', function() {
    spyOn(scope, 'updateDetails').and.callThrough();
    scope.updateDetails(-1);
    expect(scope.updateDetails).toHaveBeenCalledWith(-1);
  });

});


text:
/* this file has been autogenerated by vtkNodeJsWrap */
/* editing this might proof futile */

#ifndef NATIVE_EXTENSION_VTK_VTKSPLINEWIDGETWRAP_H
#define NATIVE_EXTENSION_VTK_VTKSPLINEWIDGETWRAP_H

#include <nan.h>

#include <vtkSmartPointer.h>
#include <vtkSplineWidget.h>

#include "vtk3DWidgetWrap.h"
#include "../../plus/plus.h"

class VtkSplineWidgetWrap : public Vtk3DWidgetWrap
{
	public:
		using Nan::ObjectWrap::Wrap;
		static void Init(v8::Local<v8::Object> exports);
		static void InitPtpl();
		static void ConstructorGetter(
			v8::Local<v8::String> property,
			const Nan::PropertyCallbackInfo<v8::Value>& info);

		VtkSplineWidgetWrap(vtkSmartPointer<vtkSplineWidget>);
		VtkSplineWidgetWrap();
		~VtkSplineWidgetWrap( );
		static Nan::Persistent<v8::FunctionTemplate> ptpl;

	private:
		static void New(const Nan::FunctionCallbackInfo<v8::Value>& info);

		static void ClosedOff(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void ClosedOn(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetClosed(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetHandlePosition(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetHandleProperty(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetLineProperty(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetNumberOfHandles(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetParametricSpline(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetPolyData(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetProcessEvents(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetProcessEventsMaxValue(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetProcessEventsMinValue(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetProjectToPlane(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetProjectionNormal(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetProjectionNormalMaxValue(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetProjectionNormalMinValue(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetProjectionPosition(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetResolution(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetSelectedHandleProperty(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetSelectedLineProperty(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void GetSummedLength(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void InitializeHandles(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void IsA(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void IsClosed(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void PlaceWidget(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void ProcessEventsOff(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void ProcessEventsOn(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void ProjectToPlaneOff(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void ProjectToPlaneOn(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetClosed(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetEnabled(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetHandlePosition(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetHandleProperty(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetLineProperty(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetNumberOfHandles(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetParametricSpline(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetPlaneSource(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetProcessEvents(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetProjectToPlane(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetProjectionNormal(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetProjectionNormalToOblique(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetProjectionNormalToXAxes(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetProjectionNormalToYAxes(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetProjectionNormalToZAxes(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetProjectionPosition(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetResolution(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetSelectedHandleProperty(const Nan::FunctionCallbackInfo<v8::Value>& info);
		static void SetSelectedLineProperty(const Nan::FunctionCallbackInfo<v8::Value>& info);

#ifdef VTK_NODE_PLUS_VTKSPLINEWIDGETWRAP_CLASSDEF
		VTK_NODE_PLUS_VTKSPLINEWIDGETWRAP_CLASSDEF
#endif
};

#endif


text:
'use strict';

// Declare app level module which depends on views, and components
angular.module('musicApp', [
    'ngRoute',
    'ngMaterial',
    'musicApp.resources',
    'musicApp.version',
    'musicApp.startPage',
    'musicApp.directives'
])
.config(['$locationProvider', '$routeProvider', function($locationProvider, $routeProvider) {
    $locationProvider.hashPrefix('');
    $routeProvider.otherwise({redirectTo: '/start'});
}])
;


text:
class PairAssignment < ActiveRecord::Base
	belongs_to :student_one, class_name: "Student"
	belongs_to :student_two, class_name: "Student"
	belongs_to :assignment

	def students
		return [self.student_one, self.student_two]
	end
end


text:
(function (window) {

    if (typeof window._goshen !== 'undefined') {
        console.warn("_goshen unable to initialize!");
        return;
    } else {
        window._goshen = {};
    }

    // We can now request the contents of window.

    window.addEventListener('keyup', function(ev) {
        // This is a bit heavy-handed, and we almost assuredly don't need to be
        // capturing every keyup event. But it's lightweight, and serves as a
        // decent proof of concept.
        if (ev.altKey && ev.keyCode == 84) {
            // They pressed Alt+T. Call _goshen's get-text function!
            window._goshen._cg.selectMode();
        }
    });

})(this);


text:
import * as webdriver from 'selenium-webdriver';

declare var browser: any;
declare var expect: any;

/**
 * @experimental This API will be moved to Protractor.
 */
export function verifyNoBrowserErrors() {
  // TODO(tbosch): Bug in ChromeDriver: Need to execute at least one command
  // so that the browser logs can be read out!
  browser.executeScript('1+1');
  browser.manage().logs().get('browser').then(function(browserLog: any) {
    var filteredLog = browserLog.filter(function(logEntry: any) {
      if (logEntry.level.value >= webdriver.logging.Level.INFO.value) {
        console.log('>> ' + logEntry.message);
      }
      return logEntry.level.value > webdriver.logging.Level.WARNING.value;
    });
    expect(filteredLog).toEqual([]);
  });
}


text:
extern bool analyzed;
extern bool analysis_just_finished;
extern BWTA::Region* home;
extern BWTA::Region* enemy_base;
DWORD WINAPI AnalyzeThread();

class IStrategizerEx;

namespace IStrategizer
{
	class RtsGame;
}

class StarCraftAIModule : public BWAPI::AIModule
{
public:
	StarCraftAIModule();
	~StarCraftAIModule();
	virtual void onStart();
	virtual void onEnd(bool isWinner);
	virtual void onFrame();
	virtual void onSendText(std::string text);
	virtual void onReceiveText(BWAPI::Player* player, std::string text);
	virtual void onPlayerLeft(BWAPI::Player* player);
	virtual void onNukeDetect(BWAPI::Position target);
	virtual void onUnitDiscover(BWAPI::Unit* unit);
	virtual void onUnitEvade(BWAPI::Unit* unit);
	virtual void onUnitShow(BWAPI::Unit* unit);
	virtual void onUnitHide(BWAPI::Unit* unit);
	virtual void onUnitCreate(BWAPI::Unit* unit);
	virtual void onUnitDestroy(BWAPI::Unit* unit);
	virtual void onUnitMorph(BWAPI::Unit* unit);
	virtual void onUnitRenegade(BWAPI::Unit* unit);
	virtual void onSaveGame(std::string gameName);
	virtual void onUnitComplete(BWAPI::Unit *unit);
	void drawStats(); //not part of BWAPI::AIModule
	void drawBullets();
	void drawVisibilityData();
	void drawTerrainData();
	void showPlayers();
	void showForces();
	bool show_bullets;
	bool show_visibility_data;

private:
	IStrategizer::RtsGame	*m_pModel;
	IStrategizerEx		*m_pAgent;
};


text:
namespace boost
{
namespace mp11
{

// mp_list_c<T, I...>
template<class T, T... I> using mp_list_c = mp_list<std::integral_constant<T, I>...>;

// mp_is_list<L>
//   in detail/mp_is_list.hpp

// mp_size<L>
namespace detail
{

template<class L> struct mp_size_impl
{
// An error "no type named 'type'" here means that the argument to mp_size is not a list
};

template<template<class...> class L, class... T> struct mp_size_impl<L<T...>>
{
    using type = mp_size_t<sizeof...(T)>;
};

} // namespace detail

template<class L> using mp_size = typename detail::mp_size_impl<L>::type;

// mp_empty<L>
template<class L> using mp_empty = mp_bool< mp_size<L>::value == 0 >;

// mp_assign<L1, L2>
namespace detail
{

template<class L1, class L2> struct mp_assign_impl;

template<template<class...> class L1, class... T, template<class...> class L2, class... U> struct mp_assign_impl<L1<T...>, L2<U...>>
{
    using type = L1<U...>;
};

} // namespace detail

template<class L1, class L2> using mp_assign = typename detail::mp_assign_impl<L1, L2>::type;

// mp_clear<L>
template<class L> using mp_clear = mp_assign<L, mp_list<>>;

// mp_front<L>
//   in detail/mp_front.hpp

// mp_pop_front<L>
namespace detail
{

template<class L> struct mp_pop_front_impl
{
// An error "no type named 'type'" here means that the argument to mp_pop_front
// is either not a list, or is an empty list
};

template<template<class...> class L, class T1, class... T> struct mp_pop_front_impl<L<T1, T...>>
{
    using type = L<T...>;
};

} // namespace detail

template<class L> using mp_pop_front = typename detail::mp_pop_front_impl<L>::type;

// mp_first<L>
template<class L> using mp_first = mp_front<L>;

// mp_rest<L>
template<class L> using mp_rest = mp_pop_front<L>;

// mp_second<L>
namespace detail
{

template<class L> struct mp_second_impl
{
// An error "no type named 'type'" here means that the argument to mp_second
// is either not a list, or has fewer than two elements
};

template<template<class...> class L, class T1, class T2, class... T> struct mp_second_impl<L<T1, T2, T...>>
{
    using type = T2;
};

} // namespace detail

template<class L> using mp_second = typename detail::mp_second_impl<L>::type;

// mp_third<L>
namespace detail
{

template<class L> struct mp_third_impl
{
// An error "no type named 'type'" here means that the argument to mp_third
// is either not a list, or has fewer than three elements
};

template<template<class...> class L, class T1, class T2, class T3, class... T> struct mp_third_impl<L<T1, T2, T3, T...>>
{
    using type = T3;
};

} // namespace detail

template<class L> using mp_third = typename detail::mp_third_impl<L>::type;

// mp_push_front<L, T...>
namespace detail
{

template<class L, class... T> struct mp_push_front_impl
{
// An error "no type named 'type'" here means that the first argument to mp_push_front is not a list
};

template<template<class...> class L, class... U, class... T> struct mp_push_front_impl<L<U...>, T...>
{
    using type = L<T..., U...>;
};

} // namespace detail

template<class L, class... T> using mp_push_front = typename detail::mp_push_front_impl<L, T...>::type;

// mp_push_back<L, T...>
namespace detail
{

template<class L, class... T> struct mp_push_back_impl
{
// An error "no type named 'type'" here means that the first argument to mp_push_back is not a list
};

template<template<class...> class L, class... U, class... T> struct mp_push_back_impl<L<U...>, T...>
{
    using type = L<U..., T...>;
};

} // namespace detail

template<class L, class... T> using mp_push_back = typename detail::mp_push_back_impl<L, T...>::type;

// mp_rename<L, B>
// mp_apply<F, L>
// mp_apply_q<Q, L>
//   in detail/mp_rename.hpp

// mp_replace_front<L, T>
namespace detail
{

template<class L, class T> struct mp_replace_front_impl
{
// An error "no type named 'type'" here means that the first argument to mp_replace_front
// is either not a list, or is an empty list
};

template<template<class...> class L, class U1, class... U, class T> struct mp_replace_front_impl<L<U1, U...>, T>
{
    using type = L<T, U...>;
};

} // namespace detail

template<class L, class T> using mp_replace_front = typename detail::mp_replace_front_impl<L, T>::type;

// mp_replace_first<L, T>
template<class L, class T> using mp_replace_first = typename detail::mp_replace_front_impl<L, T>::type;

// mp_replace_second<L, T>
namespace detail
{

template<class L, class T> struct mp_replace_second_impl
{
// An error "no type named 'type'" here means that the first argument to mp_replace_second
// is either not a list, or has fewer than two elements
};

template<template<class...> class L, class U1, class U2, class... U, class T> struct mp_replace_second_impl<L<U1, U2, U...>, T>
{
    using type = L<U1, T, U...>;
};

} // namespace detail

template<class L, class T> using mp_replace_second = typename detail::mp_replace_second_impl<L, T>::type;

// mp_replace_third<L, T>
namespace detail
{

template<class L, class T> struct mp_replace_third_impl
{
// An error "no type named 'type'" here means that the first argument to mp_replace_third
// is either not a list, or has fewer than three elements
};

template<template<class...> class L, class U1, class U2, class U3, class... U, class T> struct mp_replace_third_impl<L<U1, U2, U3, U...>, T>
{
    using type = L<U1, U2, T, U...>;
};

} // namespace detail

template<class L, class T> using mp_replace_third = typename detail::mp_replace_third_impl<L, T>::type;

// mp_transform_front<L, F>
namespace detail
{

template<class L, template<class...> class F> struct mp_transform_front_impl
{
// An error "no type named 'type'" here means that the first argument to mp_transform_front
// is either not a list, or is an empty list
};

template<template<class...> class L, class U1, class... U, template<class...> class F> struct mp_transform_front_impl<L<U1, U...>, F>
{
    using type = L<F<U1>, U...>;
};

} // namespace detail

template<class L, template<class...> class F> using mp_transform_front = typename detail::mp_transform_front_impl<L, F>::type;
template<class L, class Q> using mp_transform_front_q = mp_transform_front<L, Q::template fn>;

// mp_transform_first<L, F>
template<class L, template<class...> class F> using mp_transform_first = typename detail::mp_transform_front_impl<L, F>::type;
template<class L, class Q> using mp_transform_first_q = mp_transform_first<L, Q::template fn>;

// mp_transform_second<L, F>
namespace detail
{

template<class L, template<class...> class F> struct mp_transform_second_impl
{
// An error "no type named 'type'" here means that the first argument to mp_transform_second
// is either not a list, or has fewer than two elements
};

template<template<class...> class L, class U1, class U2, class... U, template<class...> class F> struct mp_transform_second_impl<L<U1, U2, U...>, F>
{
    using type = L<U1, F<U2>, U...>;
};

} // namespace detail

template<class L, template<class...> class F> using mp_transform_second = typename detail::mp_transform_second_impl<L, F>::type;
template<class L, class Q> using mp_transform_second_q = mp_transform_second<L, Q::template fn>;

// mp_transform_third<L, F>
namespace detail
{

template<class L, template<class...> class F> struct mp_transform_third_impl
{
// An error "no type named 'type'" here means that the first argument to mp_transform_third
// is either not a list, or has fewer than three elements
};

template<template<class...> class L, class U1, class U2, class U3, class... U, template<class...> class F> struct mp_transform_third_impl<L<U1, U2, U3, U...>, F>
{
    using type = L<U1, U2, F<U3>, U...>;
};

} // namespace detail

template<class L, template<class...> class F> using mp_transform_third = typename detail::mp_transform_third_impl<L, F>::type;
template<class L, class Q> using mp_transform_third_q = mp_transform_third<L, Q::template fn>;

} // namespace mp11
} // namespace boost

#endif // #ifndef BOOST_MP11_LIST_HPP_INCLUDED


text:
/*global tinymce:true */

tinymce.PluginManager.add('anchor', function(editor) {
	var isAnchorNode = function (node) {
		return !node.attr('href') && (node.attr('id') || node.attr('name')) && !node.firstChild;
	};

	var setContentEditable = function (state) {
		return function (nodes) {
			for (var i = 0; i < nodes.length; i++) {
				if (isAnchorNode(nodes[i])) {
					nodes[i].attr('contenteditable', state);
				}
			}
		};
	};

	var showDialog = function () {
		var selectedNode = editor.selection.getNode();
		var isAnchor = selectedNode.tagName == 'A' && editor.dom.getAttrib(selectedNode, 'href') === '';
		var value = '';

		if (isAnchor) {
			value = selectedNode.id || selectedNode.name || '';
		}

		editor.windowManager.open({
			title: 'Anchor',
			body: {type: 'textbox', name: 'id', size: 40, label: 'Id', value: value},
			onsubmit: function(e) {
				var id = e.data.id;

				if (isAnchor) {
					selectedNode.removeAttribute('name');
					selectedNode.id = id;
				} else {
					editor.selection.collapse(true);
					editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', {
						id: id
					}));
				}
			}
		});
	};

	if (tinymce.Env.ceFalse) {
		editor.on('PreInit', function () {
			editor.parser.addNodeFilter('a', setContentEditable('false'));
			editor.serializer.addNodeFilter('a', setContentEditable(null));
		});
	}

	editor.addCommand('mceAnchor', showDialog);

	editor.addButton('anchor', {
		icon: 'anchor',
		tooltip: 'Anchor',
		onclick: showDialog,
		stateSelector: 'a:not([href])'
	});

	editor.addMenuItem('anchor', {
		icon: 'anchor',
		text: 'Anchor',
		context: 'insert',
		onclick: showDialog
	});
});


text:
package com.wh.base.utils;

import org.apache.struts2.ServletActionContext;

import com.opensymphony.xwork2.ActionContext;
import com.wh.base.bean.privilege.User;

public class WebUtil {
	/**
	 * 获取登陆用户
	 * @param request
	 * @return
	 */
	public static User getUser(){
		return (User) ActionContext.getContext().getSession().get("user");
	}
	public static String getContextPath() {
		return ServletActionContext.getRequest().getContextPath();
	}
}


text:
'use strict';

require('jsdom-global')();

const chai    = require('chai');
const dom     = require('../mock/dom');
const dataset = require('../mock/dataset');
const mixitup = require('../../dist/mixitup.js');
const $       = require('jquery');

describe('mixitup()', () => {
    it('should add a .mixItUp() method to jQuery if passed to .use() ', () => {
        mixitup.use($);

        chai.assert.typeOf($.fn.mixItUp, 'function');
    });

    it('should provide instantiation via the v2 jQuery API', () => {
        let $container = $(dom.getContainer());

        $container.mixItUp();

        chai.assert.isOk($container[0].id);
    });

    it('should accept a configuration object via the v2 jQuery API', () => {
        let $container = $(dom.getContainer());
        let state;

        $container.mixItUp({
            load: {
                filter: 'none'
            }
        });

        state = $container.mixItUp('getState');

        chai.assert.instanceOf(state, mixitup.State);
    });

    it('should allow methods to be called via the v2 jQuery API', () => {
        let $container = $(dom.getContainer());

        $container.mixItUp({
            load: {
                filter: 'none'
            }
        });

        return new Promise(resolve => {
            $container.mixItUp('filter', 'all', resolve);
        })
            .then(state => {
                chai.assert.instanceOf(state, mixitup.State);
                chai.assert.equal(state.activeFilter.selector, '.mix');
            });
    });
});


text:
package org.jboss.resteasy.reactive.server.vertx.test.resource.basic.resource;

import java.util.List;
import java.util.Locale;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;

import org.junit.jupiter.api.Assertions;

@Path("/extension")
public class ExtensionResource {
    @GET
    @Produces("*/*")
    public String getDefault() {
        return "default";
    }

    @GET
    @Produces("application/xml")
    public String getXml(@Context HttpHeaders headers) {
        @SuppressWarnings("unused")
        List<Locale> languages = headers.getAcceptableLanguages();
        @SuppressWarnings("unused")
        List<MediaType> mediaTypes = headers.getAcceptableMediaTypes();
        return "xml";
    }

    @GET
    @Produces("text/html")
    public String getXmlTwo(@Context HttpHeaders headers) {
        List<Locale> languages = headers.getAcceptableLanguages();
        Assertions.assertEquals(1, languages.size(), "Wrong number of accepted languages");
        Assertions.assertEquals(new Locale("en", "us"), languages.get(0), "Wrong accepted language");
        Assertions.assertEquals(MediaType.valueOf("text/html"),
                headers.getAcceptableMediaTypes().get(0), "Wrong accepted language");
        return "html";
    }

    @GET
    @Path("/stuff.old")
    @Produces("text/plain")
    public String getJson(@Context HttpHeaders headers) {
        List<Locale> languages = headers.getAcceptableLanguages();
        Assertions.assertEquals(1, languages.size(), "Wrong number of accepted languages");
        Assertions.assertEquals(new Locale("en", "us"), languages.get(0), "Wrong accepted language");
        Assertions.assertEquals(MediaType.valueOf("text/plain"),
                headers.getAcceptableMediaTypes().get(0), "Wrong accepted language");
        return "plain";
    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="48dp"
    android:background="#FFFFFF" >

    <ImageView
        android:id="@+id/iv_back"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_centerVertical="true"
        android:src="@drawable/nav_icon_back_normal" />

    <TextView
        android:id="@+id/tv_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:text="@string/app_name"
        android:textColor="#66cc99"
        android:textSize="20sp"
        android:textStyle="bold" />

    <View
        android:layout_width="match_parent"
        android:layout_height="1.5dp"
        android:layout_alignParentBottom="true"
        android:background="#66CC99" />

</RelativeLayout>


text:
package com.sequenceiq.freeipa.service.multiaz;

import static com.sequenceiq.cloudbreak.common.network.NetworkConstants.SUBNET_IDS;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.mockito.Mockito.when;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;

import com.sequenceiq.cloudbreak.common.json.Json;
import com.sequenceiq.freeipa.api.v1.freeipa.stack.model.common.instance.InstanceStatus;
import com.sequenceiq.freeipa.entity.InstanceGroup;
import com.sequenceiq.freeipa.entity.InstanceGroupNetwork;
import com.sequenceiq.freeipa.entity.InstanceMetaData;

@ExtendWith(MockitoExtension.class)
class MultiAzCalculatorServiceTest {

    private static final String SUB_1 = "SUB1";

    private static final String SUB_2 = "SUB2";

    private static final Map<String, String> SUBNET_AZ_PAIRS = Map.of(SUB_1, "AZ1", SUB_2, "AZ2", "ONLYINAZMAP", "AZ3");

    @Mock
    private MultiAzValidator multiAzValidator;

    @InjectMocks
    private MultiAzCalculatorService underTest;

    @Test
    public void testCalculateCurrentSubnetUsage() {
        InstanceGroupNetwork instanceGroupNetwork = new InstanceGroupNetwork();
        instanceGroupNetwork.setAttributes(Json.silent(Map.of(SUBNET_IDS, List.of(SUB_1, SUB_2, "ONLYINIG"))));
        InstanceGroup instanceGroup = new InstanceGroup();
        instanceGroup.setInstanceGroupNetwork(instanceGroupNetwork);
        InstanceMetaData deletedInstance = createInstanceMetadata(SUB_1);
        deletedInstance.setInstanceStatus(InstanceStatus.TERMINATED);
        instanceGroup.setInstanceMetaData(Set.of(createInstanceMetadata(SUB_1), createInstanceMetadata(SUB_1), createInstanceMetadata(SUB_2),
                createInstanceMetadata(null), createInstanceMetadata(" "), createInstanceMetadata("IGNORED"), deletedInstance));

        Map<String, Integer> result = underTest.calculateCurrentSubnetUsage(SUBNET_AZ_PAIRS, instanceGroup);

        assertEquals(2, result.size());
        assertEquals(2, result.get(SUB_1));
        assertEquals(1, result.get(SUB_2));
    }

    @Test
    public void testUpdateSubnetIdForSingleInstanceIfEligible() {
        InstanceGroup instanceGroup = new InstanceGroup();
        when(multiAzValidator.supportedForInstanceMetadataGeneration(instanceGroup)).thenReturn(Boolean.TRUE);
        InstanceMetaData instanceMetaData = new InstanceMetaData();

        underTest.updateSubnetIdForSingleInstanceIfEligible(SUBNET_AZ_PAIRS, new HashMap<>(Map.of(SUB_1, 2, SUB_2, 1)), instanceMetaData, instanceGroup);

        assertEquals(SUB_2, instanceMetaData.getSubnetId());
    }

    @Test
    public void testUpdateSubnetIdForSingleInstanceIfEligibleValidatorReturnFalse() {
        InstanceGroup instanceGroup = new InstanceGroup();
        when(multiAzValidator.supportedForInstanceMetadataGeneration(instanceGroup)).thenReturn(Boolean.FALSE);
        InstanceMetaData instanceMetaData = new InstanceMetaData();

        underTest.updateSubnetIdForSingleInstanceIfEligible(SUBNET_AZ_PAIRS, new HashMap<>(Map.of(SUB_1, 2, SUB_2, 1)), instanceMetaData, instanceGroup);

        assertNull(instanceMetaData.getSubnetId());
    }

    @Test
    public void testUpdateSubnetIdForSingleInstanceIfEligibleSubnetUsageEmpty() {
        InstanceGroup instanceGroup = new InstanceGroup();
        InstanceMetaData instanceMetaData = new InstanceMetaData();

        underTest.updateSubnetIdForSingleInstanceIfEligible(SUBNET_AZ_PAIRS, new HashMap<>(), instanceMetaData, instanceGroup);

        assertNull(instanceMetaData.getSubnetId());
    }

    @Test
    public void testUpdateSubnetIdForSingleInstanceIfEligibleDontModifyExisting() {
        InstanceGroup instanceGroup = new InstanceGroup();
        when(multiAzValidator.supportedForInstanceMetadataGeneration(instanceGroup)).thenReturn(Boolean.TRUE);
        InstanceMetaData instanceMetaData = new InstanceMetaData();
        instanceMetaData.setSubnetId("ASDF");

        underTest.updateSubnetIdForSingleInstanceIfEligible(SUBNET_AZ_PAIRS, new HashMap<>(Map.of(SUB_1, 2, SUB_2, 1)), instanceMetaData, instanceGroup);

        assertEquals("ASDF", instanceMetaData.getSubnetId());
    }

    @Test
    public void testCalculateRoundRobin() {
        InstanceGroupNetwork instanceGroupNetwork = new InstanceGroupNetwork();
        instanceGroupNetwork.setAttributes(Json.silent(Map.of(SUBNET_IDS, List.of(SUB_1, SUB_2, "ONLYINIG"))));
        InstanceGroup instanceGroup = new InstanceGroup();
        instanceGroup.setInstanceGroupNetwork(instanceGroupNetwork);
        InstanceMetaData deletedInstance = createInstanceMetadata(SUB_1);
        deletedInstance.setInstanceStatus(InstanceStatus.TERMINATED);
        instanceGroup.setInstanceMetaData(Set.of(createInstanceMetadata(null), createInstanceMetadata(null), createInstanceMetadata(null),
                createInstanceMetadata(SUB_2), createInstanceMetadata(null), createInstanceMetadata(" "), createInstanceMetadata("IGNORED"),
                deletedInstance));
        when(multiAzValidator.supportedForInstanceMetadataGeneration(instanceGroup)).thenReturn(Boolean.TRUE);

        underTest.calculateByRoundRobin(SUBNET_AZ_PAIRS, instanceGroup);

        assertEquals(3, instanceGroup.getNotDeletedInstanceMetaDataSet().stream()
                .filter(im -> SUB_1.equals(im.getSubnetId()) && "AZ1".equals(im.getAvailabilityZone())).count());
        assertEquals(2, instanceGroup.getNotDeletedInstanceMetaDataSet().stream()
                .filter(im -> SUB_2.equals(im.getSubnetId()) && "AZ2".equals(im.getAvailabilityZone())).count());
        assertEquals(3, instanceGroup.getNotDeletedInstanceMetaDataSet().stream()
                .filter(im -> SUB_2.equals(im.getSubnetId())).count());
        assertEquals(1, instanceGroup.getNotDeletedInstanceMetaDataSet().stream().filter(im -> "IGNORED".equals(im.getSubnetId())).count());
    }

    private InstanceMetaData createInstanceMetadata(String subnetId) {
        InstanceMetaData instanceMetaData = new InstanceMetaData();
        instanceMetaData.setSubnetId(subnetId);
        instanceMetaData.setInstanceStatus(InstanceStatus.CREATED);
        return instanceMetaData;
    }
}


text:
<?php

    /**
     * Database host url
     * @var string
     */
    $host = "localhost";//"web1.vhost.hu";

    /**
     * Database access user
     * @var string
     */
    $user = "root";//"lauraangyal";

    /**
     * Database access password
     * @var string
     */
    $pass = "C77ah3co";//"a8129471";

    /**
     * Database name
     * @var string
     */
    $name = "laura";

    /**
     * Database character encoding
     * @var string
     */
    $encd = "utf8";

    # ! DO NOT EDIT BELOW ! #

    define(DB_CONFIG_HOST,$host);
    define(DB_CONFIG_USER,$user);
    define(DB_CONFIG_PASS,$pass);
    define(DB_CONFIG_NAME,$name);
    define(DB_CONFIG_ENCD,$encd);

    function Connection() {
      $dbh = new PDO("mysql:host=".DB_CONFIG_HOST.";dbname=".DB_CONFIG_NAME.";charset=".DB_CONFIG_ENCD, DB_CONFIG_USER, DB_CONFIG_PASS);
      $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      return $dbh;
    }

    function Response($status_code, $response) {
      $app = \Slim\Slim::getInstance();
      $app->status($status_code);
      $app->contentType('application/json');
      echo json_encode($response);
    }
?>


text:
  Saint-Georges-de-Luzençon est
      une ville géographiquement positionnée dans le département de l'Aveyron en Midi-Pyrénées. On dénombrait 1 635 habitants en 2008.

À coté de Saint-Georges-de-Luzençon sont positionnées géographiquement les communes de
Comprégnac localisée à 2 km, 245 habitants,
Viala-du-Tarn située à 8 km, 538 habitants,
Roquefort-sur-Soulzon à 9 km, 690 habitants,
Castelnau-Pégayrols à 8 km, 315 habitants,
Creissels localisée à 6 km, 1 487 habitants,
Montjaux localisée à 7 km, 392 habitants,
 entre autres. De plus, Saint-Georges-de-Luzençon est située à seulement huit km de Millau.

Le parc d'habitations, à Saint-Georges-de-Luzençon, se décomposait en 2011 en 100 appartements et 687 maisons soit
 un marché relativement équilibré.

La commune offre quelques  équipements sportifs, elle propose entre autres un terrain de tennis, un terrain de sport et une boucle de randonnée.

À Saint-Georges-de-Luzençon, la valeur moyenne à la vente d'un appartement s'évalue à 1 015 € du m² en vente. la valorisation moyenne d'une maison à l'achat se situe à 1 661 € du m². À la location le prix moyen se situe à 5,69 € du m² par mois.


text: include_recipe "mongodb::default"


text:
/////////////////////////////////////////////////////////////////////////
/// \file
///
/// Shader interpreter implementation of string functions
/// such as format, concat, printf, etc.
///
/////////////////////////////////////////////////////////////////////////

#include <cstdarg>

#include "oslexec_pvt.h"

#include <boost/regex.hpp>

// Heavy lifting of OSL regex operations.
OSL_SHADEOP int
osl_regex_impl2 (OSL::ShadingContext *ctx, ustring subject_,
                 int *results, int nresults, ustring pattern,
                 int fullmatch)
{
    const std::string &subject (subject_.string());
    boost::match_results<std::string::const_iterator> mresults;
    const boost::regex &regex (ctx->find_regex (pattern));
    if (nresults > 0) {
        std::string::const_iterator start = subject.begin();
        int res = fullmatch ? boost::regex_match (subject, mresults, regex)
                            : boost::regex_search (subject, mresults, regex);
        int *m = (int *)results;
        for (int r = 0;  r < nresults;  ++r) {
            if (r/2 < (int)mresults.size()) {
                if ((r & 1) == 0)
                    m[r] = mresults[r/2].first - start;
                else
                    m[r] = mresults[r/2].second - start;
            } else {
                m[r] = pattern.length();
            }
        }
        return res;
    } else {
        return fullmatch ? boost::regex_match (subject, regex)
                         : boost::regex_search (subject, regex);
    }
}

OSL_SHADEOP const char *
osl_format (const char* format_str, ...)
{
    va_list args;
    va_start (args, format_str);
    std::string s = Strutil::vformat (format_str, args);
    va_end (args);
    return ustring(s).c_str();
}

OSL_SHADEOP void
osl_printf (ShaderGlobals *sg, const char* format_str, ...)
{
    va_list args;
    va_start (args, format_str);
#if 0
    // Make super sure we know we are excuting LLVM-generated code!
    std::string newfmt = std::string("llvm: ") + format_str;
    format_str = newfmt.c_str();
#endif
    std::string s = Strutil::vformat (format_str, args);
    va_end (args);
    sg->context->shadingsys().message (s);
}

OSL_SHADEOP void
osl_error (ShaderGlobals *sg, const char* format_str, ...)
{
    va_list args;
    va_start (args, format_str);
    std::string s = Strutil::vformat (format_str, args);
    va_end (args);
    sg->context->shadingsys().error (s);
}

OSL_SHADEOP void
osl_warning (ShaderGlobals *sg, const char* format_str, ...)
{
    va_list args;
    va_start (args, format_str);
    std::string s = Strutil::vformat (format_str, args);
    va_end (args);
    sg->context->shadingsys().warning (s);
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="cn.tonlyshy.app.fmpet.GuideActivity"
    android:orientation="vertical"
    android:background="#a30000">

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardBackgroundColor="#d30000">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="激活GG PET"
            android:textColor="#FFF"
            android:textSize="20dp"
            android:textAlignment="center"
            android:layout_margin="10dp" />
    </android.support.v7.widget.CardView>
    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardBackgroundColor="#a30000">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textColor="#EEE"
            android:text="GG PET还没有启用,暂时无法为你服务。"
            android:padding="14dp"/>
    </android.support.v7.widget.CardView>
    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardBackgroundColor="#d30000">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="第一步:允许GG PET显示在其它应用上"
            android:textColor="#FFF"
            android:textSize="20dp"
            android:layout_margin="10dp" />
    </android.support.v7.widget.CardView>
    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardBackgroundColor="#d30000">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingLeft="10dp">
            <ImageView
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:src="@drawable/app_icon"/>
            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="GG PET"
                android:textColor="#FFF"
                android:textSize="20dp"
                android:layout_margin="10dp" />
        </LinearLayout>
    </android.support.v7.widget.CardView>
    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardBackgroundColor="#d30000">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:background="#a30000"
            android:paddingLeft="10dp"
            android:paddingRight="10dp">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="允许出现在其他应用上"
                android:textColor="#FFF"
                android:textSize="20dp"
                android:layout_margin="10dp"
                android:layout_weight="4"/>

            <Switch
                android:id="@+id/switch_guide_step1"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_weight="1"
                android:checked="true"
                android:src="@drawable/app_icon"
                android:clickable="false"/>
        </LinearLayout>
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        android:id="@+id/btn_guide_step1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_margin="10dp"
        app:cardBackgroundColor="#d30000"
        android:onClick="onClick">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="勾选GG PET"
            android:textSize="20dp"
            android:textColor="#FFF"
            android:background="#d30000"
            android:layout_margin="10dp"
            android:clickable="false"/>
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardBackgroundColor="#d30000">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="第二步:允许GG PET读取通知"
            android:textColor="#FFF"
            android:textSize="20dp"
            android:layout_margin="10dp" />
    </android.support.v7.widget.CardView>
    <android.support.v7.widget.CardView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:cardBackgroundColor="#d30000">
        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal"
            android:paddingLeft="10dp"
            android:paddingRight="10dp"
            android:background="#a30000">
            <ImageView
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:src="@drawable/app_icon"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="GG PET"
                android:textColor="#FFF"
                android:textSize="20dp"
                android:layout_gravity="center_vertical"
                android:layout_margin="10dp"
                android:layout_weight="40"/>
            <Switch
                android:id="@+id/switch_guide_step2"
                android:layout_width="40dp"
                android:layout_height="40dp"
                android:layout_weight="1"
                android:checked="true"
                android:src="@drawable/app_icon"
                android:clickable="false"/>
        </LinearLayout>
    </android.support.v7.widget.CardView>

    <android.support.v7.widget.CardView
        android:id="@+id/btn_guide_step2"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_margin="10dp"
        app:cardBackgroundColor="#d30000"
        android:onClick="onClick">
        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="勾选GG PET"
            android:textSize="20dp"
            android:textColor="#FFF"
            android:background="#d30000"
            android:layout_margin="10dp"
            android:clickable="false"/>
    </android.support.v7.widget.CardView>

</LinearLayout>


text:
module GoodData
  class Dashboard < GoodData::MdObject

    class << self
      def [](id)
        if id == :all
          GoodData.get(GoodData.project.md['query'] + '/projectDashboard/')['query']['entries']
        else
          super
        end
      end
    end

    def export(format, options={})
      supported_formats = [:pdf]
      fail "Wrong format provied \"#{format}\". Only supports formats #{supported_formats.join(', ')}" unless supported_formats.include?(format)
      tab = options[:tab] || ""
      x = GoodData.post("/gdc/projects/#{GoodData.project.uri}/clientexport", {"clientExport" => {"url" => "https://secure.gooddata.com/dashboard.html#project=#{GoodData.project.uri}&dashboard=#{uri}&tab=#{tab}&export=1", "name" => title}}, :process => false)
      while (x.code == 202) do
        sleep(1)
        uri = JSON.parse(x.body)["asyncTask"]["link"]["poll"]
        x = GoodData.get(uri, :process => false)
      end
      x
    end

    def tabs
       content["tabs"]
    end

    def tabs_ids
      tabs.map {|t| t["identifier"]}
    end

  end
end


text:
using System;
using System.Collections;

using Hyena;

namespace Banshee.MediaEngine
{
    public class NullPlayerEngine : MediaEngine.PlayerEngine
    {
        protected override void OpenUri (SafeUri uri, bool maybeVideo)
        {
        }

        public override void Play ()
        {
            OnStateChanged (PlayerState.Playing);
        }

        public override void Pause ()
        {
            OnStateChanged (PlayerState.Paused);
        }

        public override void Seek (uint position, bool accurate_seek)
        {
        }

        private ushort volume;
        public override ushort Volume {
            get { return volume; }
            set { volume = value; }
        }

        public override uint Position {
            get { return 0; }
            set { return; }
        }

        public override bool CanSeek {
            get { return false; }
        }

        public override uint Length {
            get { return 0; }
        }

        public override bool SupportsEqualizer {
            get { return false; }
        }

        public override VideoDisplayContextType VideoDisplayContextType {
            get { return VideoDisplayContextType.Unsupported; }
        }

        private static string [] source_capabilities = { "file", "http", "cdda" };
        public override IEnumerable SourceCapabilities {
            get { return source_capabilities; }
        }

        public override IEnumerable ExplicitDecoderCapabilities {
            get { return new string[0]; }
        }

        public override string Id {
            get { return "nullplayerengine"; }
        }

        public override string Name {
            get { return "Null Player Engine"; }
        }

        public override int SubtitleCount {
            get { return 0; }
        }

        public override int SubtitleIndex {
            set { return; }
        }

        public override SafeUri SubtitleUri {
            set { return; }
            get { return null; }
        }

        public override bool InDvdMenu {
            get { return false; }
        }

        public override string GetSubtitleDescription (int index)
        {
            return string.Empty;
        }

        public override void NotifyMouseMove (double x, double y)
        {
        }

        public override void NotifyMouseButtonPressed (int button, double x, double y)
        {
        }

        public override void NotifyMouseButtonReleased (int button, double x, double y)
        {
        }

        public override void NavigateToLeftMenu ()
        {
        }

        public override void NavigateToRightMenu ()
        {
        }

        public override void NavigateToUpMenu ()
        {
        }

        public override void NavigateToDownMenu ()
        {
        }

        public override void NavigateToMenu ()
        {
        }

        public override void ActivateCurrentMenu ()
        {
        }

        public override void GoToNextChapter ()
        {
        }

        public override void GoToPreviousChapter ()
        {
        }

    }
}


text:
    <title>HTTP Error 502 - MLDB Unavailable</title>

HTTP Error 502 - MLDB Unavailable

MLDB is unable to respond either because it has not finished booting or because it has crashed and has not finished rebooting. Recent log messages are available below to help you understand what is happening.

The MLDB.ai Team can help you debug this problem! Please feel free to reach out by emailing info@mldb.ai.

Recent Log Messages


text:
#import "MaterialTextFields.h"

@interface TextFieldCustomFontExample : UIViewController <UITextFieldDelegate, UITextViewDelegate>

@property(nonatomic) MDCTextInputControllerOutlined *systemFontController;
@property(nonatomic) MDCTextInputControllerOutlined *systemFontDynamicController;
@property(nonatomic) MDCTextInputControllerOutlined *customFontController;
@property(nonatomic) MDCTextInputControllerOutlined *customFontDynamicController;

@property(nonatomic) MDCTextInputControllerOutlinedTextArea *multilineController;
@property(nonatomic) MDCTextInputControllerOutlinedTextArea *multilineDynamicController;
@property(nonatomic) MDCTextInputControllerOutlinedTextArea *multilineCustomFontDynamicController;

@property(nonatomic) UIFont *normalTextFont;

@property(nonatomic) UIScrollView *scrollView;

@end

@implementation TextFieldCustomFontExample

- (void)dealloc {
  [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (void)viewDidLoad {
  [super viewDidLoad];
  self.view.backgroundColor = [UIColor whiteColor];

  [self registerKeyboardNotifications];

  [self setupScrollView];

  // Create a System Font TextField.
  MDCTextField *systemFontTextField = [self setupSystemFontTextField];

  // Create a System Font Dynamic TextField.
  MDCTextField *systemFontDynamicTextField = [self setupSystemFontDynamicTextField];

  // Create a Custom Font TextField.
  MDCTextField *customFontTextField = [self setupCustomFontTextField];;

  // Create a Custom Font Dynamic TextField.
  MDCTextField *customFontDynamicTextField = [self setupCustomFontDynamicTextField];;

  // Create a System Multiline TextField.
  MDCMultilineTextField *multilineTextField = [self setupSystemMultilineTextField];

  // Create a System Multiline Dynamic TextField.
  MDCMultilineTextField *multilineDynamicTextField = [self setupSystemMultilineDynamicTextField];

  // Create a Custom Multiline Dyamic TextField.
  MDCMultilineTextField *multilineCustomDynamicTextField =
      [self setupCustomMultilineDynamicTextField];

  NSDictionary *views = @{
                          @"t1" : systemFontTextField,
                          @"t2" : systemFontDynamicTextField,
                          @"t3" : customFontTextField,
                          @"t4" : customFontDynamicTextField,
                          @"t5" : multilineTextField,
                          @"t6" : multilineDynamicTextField,
                          @"t7" : multilineCustomDynamicTextField
                          };
  NSMutableArray<NSLayoutConstraint *> *constraints = [NSMutableArray
                                                       arrayWithArray:
                                                       [NSLayoutConstraint
                                                        constraintsWithVisualFormat:@"V:[t1]-[t2]-[t3]-[t4]-[t5]-[t6]-[t7]"

                                                        options:NSLayoutFormatAlignAllLeading |
                                                        NSLayoutFormatAlignAllTrailing
                                                        metrics:nil
                                                        views:views]];
  [constraints addObject:[NSLayoutConstraint constraintWithItem:systemFontTextField
                                                      attribute:NSLayoutAttributeLeading
                                                      relatedBy:NSLayoutRelationEqual
                                                         toItem:self.view
                                                      attribute:NSLayoutAttributeLeadingMargin
                                                     multiplier:1
                                                       constant:0]];
  [constraints addObject:[NSLayoutConstraint constraintWithItem:systemFontTextField
                                                      attribute:NSLayoutAttributeTrailing
                                                      relatedBy:NSLayoutRelationEqual
                                                         toItem:self.view
                                                      attribute:NSLayoutAttributeTrailingMargin
                                                     multiplier:1
                                                       constant:0]];
#if defined(__IPHONE_11_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0)
  if (@available(iOS 11.0, *)) {
    [NSLayoutConstraint activateConstraints:@[
                                              [NSLayoutConstraint constraintWithItem:systemFontTextField
                                                                           attribute:NSLayoutAttributeTop
                                                                           relatedBy:NSLayoutRelationEqual
                                                                              toItem:self.scrollView.contentLayoutGuide
                                                                           attribute:NSLayoutAttributeTop
                                                                          multiplier:1
                                                                            constant:20],
                                              [NSLayoutConstraint constraintWithItem:multilineCustomDynamicTextField
                                                                           attribute:NSLayoutAttributeBottom
                                                                           relatedBy:NSLayoutRelationEqual
                                                                              toItem:self.scrollView.contentLayoutGuide
                                                                           attribute:NSLayoutAttributeBottomMargin
                                                                          multiplier:1
                                                                            constant:-20]
                                              ]];
  } else {
    [NSLayoutConstraint activateConstraints:@[
                                              [NSLayoutConstraint constraintWithItem:systemFontTextField
                                                                           attribute:NSLayoutAttributeTop
                                                                           relatedBy:NSLayoutRelationEqual
                                                                              toItem:self.scrollView
                                                                           attribute:NSLayoutAttributeTop
                                                                          multiplier:1
                                                                            constant:20],
                                              [NSLayoutConstraint constraintWithItem:multilineCustomDynamicTextField
                                                                           attribute:NSLayoutAttributeBottom
                                                                           relatedBy:NSLayoutRelationEqual
                                                                              toItem:self.scrollView
                                                                           attribute:NSLayoutAttributeBottomMargin
                                                                          multiplier:1
                                                                            constant:-20]
                                              ]];
  }
#else
  [NSLayoutConstraint activateConstraints:@[
                                            [NSLayoutConstraint constraintWithItem:systemFontTextField
                                                                         attribute:NSLayoutAttributeTop
                                                                         relatedBy:NSLayoutRelationEqual
                                                                            toItem:self.scrollView
                                                                         attribute:NSLayoutAttributeTop
                                                                        multiplier:1
                                                                          constant:20],
                                            [NSLayoutConstraint constraintWithItem:systemFontTextField
                                                                         attribute:NSLayoutAttributeBottom
                                                                         relatedBy:NSLayoutRelationEqual
                                                                            toItem:self.scrollView
                                                                         attribute:NSLayoutAttributeBottomMargin
                                                                        multiplier:1
                                                                          constant:-20]
                                            ]];
#endif

  [NSLayoutConstraint activateConstraints:constraints];
}

- (void)setupScrollView {
  self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectZero];
  self.scrollView.translatesAutoresizingMaskIntoConstraints = NO;
  [self.view addSubview:self.scrollView];
  NSArray *constraints =
      [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[scrollView]|"
                                              options:0
                                              metrics:nil
                                                views:@{@"scrollView" : self.scrollView}];

  [NSLayoutConstraint activateConstraints:constraints];
  constraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[scrollView]|"
                                                        options:0
                                                        metrics:nil
                                                          views:@{@"scrollView" : self.scrollView}];
  [NSLayoutConstraint activateConstraints:constraints];
  UIEdgeInsets margins = UIEdgeInsetsMake(0, 16, 0, 16);
  self.scrollView.layoutMargins = margins;

  UITapGestureRecognizer *tapGestureRecognizer =
      [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDidTouch:)];
  [self.scrollView addGestureRecognizer:tapGestureRecognizer];
}

- (MDCTextField *)setupSystemFontTextField {
  MDCTextField *systemFontTextField = [[MDCTextField alloc] init];
  self.normalTextFont = systemFontTextField.font;
  systemFontTextField.translatesAutoresizingMaskIntoConstraints = NO;
  [self.scrollView addSubview:systemFontTextField];

  systemFontTextField.delegate = self;
  systemFontTextField.clearButtonMode = UITextFieldViewModeUnlessEditing;
  systemFontTextField.backgroundColor = [UIColor whiteColor];

  self.systemFontController = [[MDCTextInputControllerOutlined alloc] initWithTextInput:systemFontTextField];
  self.systemFontController.placeholderText = @"System Font";
  self.systemFontController.mdc_adjustsFontForContentSizeCategory = NO;
  return systemFontTextField;
}

- (MDCTextField *)setupSystemFontDynamicTextField {
  MDCTextField *systemFontDynamicTextField = [[MDCTextField alloc] init];
  systemFontDynamicTextField.translatesAutoresizingMaskIntoConstraints = NO;
  [self.scrollView addSubview:systemFontDynamicTextField];

  systemFontDynamicTextField.delegate = self;
  systemFontDynamicTextField.clearButtonMode = UITextFieldViewModeUnlessEditing;
  systemFontDynamicTextField.backgroundColor = [UIColor whiteColor];

  self.systemFontDynamicController =
      [[MDCTextInputControllerOutlined alloc] initWithTextInput:systemFontDynamicTextField];
  self.systemFontDynamicController.placeholderText = @"System Font - Dynamic";
  self.systemFontDynamicController.mdc_adjustsFontForContentSizeCategory = YES;
  return systemFontDynamicTextField;
}

- (MDCTextField *)setupCustomFontTextField {
  MDCTextField *customFontTextField = [[MDCTextField alloc] init];
  customFontTextField.translatesAutoresizingMaskIntoConstraints = NO;
  [self.scrollView addSubview:customFontTextField];

  customFontTextField.delegate = self;
  customFontTextField.clearButtonMode = UITextFieldViewModeUnlessEditing;
  customFontTextField.backgroundColor = [UIColor whiteColor];

  self.customFontController =
      [[MDCTextInputControllerOutlined alloc] initWithTextInput:customFontTextField];
  self.customFontController.placeholderText = @"Custom Font";
  self.customFontController.mdc_adjustsFontForContentSizeCategory = NO;
  self.customFontController.leadingUnderlineLabelFont =
      [UIFont fontWithName:@"AmericanTypewriter" size:12];
  self.customFontController.trailingUnderlineLabelFont =
      [UIFont fontWithName:@"Chalkduster" size:12];
  self.customFontController.inlinePlaceholderFont =
      [UIFont fontWithName:@"AmericanTypewriter" size:12];
  self.customFontController.textInputFont = [UIFont fontWithName:@"Chalkduster" size:16];
  return customFontTextField;
}

- (MDCTextField *)setupCustomFontDynamicTextField {
  MDCTextField *customFontDynamicTextField = [[MDCTextField alloc] init];
  customFontDynamicTextField.translatesAutoresizingMaskIntoConstraints = NO;

  customFontDynamicTextField.delegate = self;
  customFontDynamicTextField.clearButtonMode = UITextFieldViewModeUnlessEditing;
  customFontDynamicTextField.backgroundColor = [UIColor whiteColor];

  self.customFontDynamicController =
      [[MDCTextInputControllerOutlined alloc] initWithTextInput:customFontDynamicTextField];
  self.customFontDynamicController.placeholderText = @"Custom Font - Dynamic";
  self.customFontDynamicController.helperText = @"Helper";
  self.customFontDynamicController.leadingUnderlineLabelFont =
      [UIFont fontWithName:@"Zapfino" size:12];
  self.customFontDynamicController.trailingUnderlineLabelFont =
      [UIFont fontWithName:@"Chalkduster" size:12];
  self.customFontDynamicController.inlinePlaceholderFont = [UIFont fontWithName:@"Zapfino" size:12];
  self.customFontDynamicController.textInputFont = [UIFont fontWithName:@"Zapfino" size:16];
  self.customFontDynamicController.mdc_adjustsFontForContentSizeCategory = YES;

  [self.scrollView addSubview:customFontDynamicTextField];
  return customFontDynamicTextField;
}

- (MDCMultilineTextField *)setupSystemMultilineTextField {
  MDCMultilineTextField *multilineTextField = [[MDCMultilineTextField alloc] init];
  multilineTextField.translatesAutoresizingMaskIntoConstraints = NO;
  [self.scrollView addSubview:multilineTextField];

  multilineTextField.textView.delegate = self;

  self.multilineController =
      [[MDCTextInputControllerOutlinedTextArea alloc] initWithTextInput:multilineTextField];
  self.multilineController.placeholderText = @"Multiline Text";
  self.multilineController.mdc_adjustsFontForContentSizeCategory = NO;
  return multilineTextField;
}

- (MDCMultilineTextField *)setupSystemMultilineDynamicTextField {
  MDCMultilineTextField *multilineDynamicTextField = [[MDCMultilineTextField alloc] init];
  multilineDynamicTextField.translatesAutoresizingMaskIntoConstraints = NO;
  [self.scrollView addSubview:multilineDynamicTextField];

  multilineDynamicTextField.textView.delegate = self;

  self.multilineDynamicController =
      [[MDCTextInputControllerOutlinedTextArea alloc] initWithTextInput:multilineDynamicTextField];
  self.multilineDynamicController.placeholderText = @"Multiline Dynamic Text";
  self.multilineDynamicController.mdc_adjustsFontForContentSizeCategory = YES;
  return multilineDynamicTextField;
}

- (MDCMultilineTextField *)setupCustomMultilineDynamicTextField {
  MDCMultilineTextField *multilineCustomDynamicTextField = [[MDCMultilineTextField alloc] init];
  multilineCustomDynamicTextField.translatesAutoresizingMaskIntoConstraints = NO;
  [self.scrollView addSubview:multilineCustomDynamicTextField];

  multilineCustomDynamicTextField.textView.delegate = self;

  self.multilineCustomFontDynamicController =
      [[MDCTextInputControllerOutlinedTextArea alloc]
            initWithTextInput:multilineCustomDynamicTextField];
  self.multilineCustomFontDynamicController.placeholderText = @"Multiline Custom Font Dynamic Text";
  self.multilineCustomFontDynamicController.leadingUnderlineLabelFont =
      [UIFont fontWithName:@"AmericanTypewriter" size:12];
  self.customFontDynamicController.trailingUnderlineLabelFont =
      [UIFont fontWithName:@"Chalkduster" size:12];
  self.multilineCustomFontDynamicController.inlinePlaceholderFont =
      [UIFont fontWithName:@"Zapfino" size:12];
  self.multilineCustomFontDynamicController.textInputFont =
      [UIFont fontWithName:@"AmericanTypewriter" size:16];
  self.multilineCustomFontDynamicController.mdc_adjustsFontForContentSizeCategory = YES;
  return multilineCustomDynamicTextField;
}

#pragma mark - UITextFieldDelegate

- (BOOL)textFieldShouldReturn:(UITextField *)textField {
  [textField resignFirstResponder];

  return NO;
}

- (BOOL)textField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range
replacementString:(NSString *)string {
  NSString *finishedString =
  [textField.text stringByReplacingCharactersInRange:range withString:string];

  if (textField == (UITextField *)self.systemFontController.textInput) {
    if ([finishedString rangeOfCharacterFromSet:[NSCharacterSet decimalDigitCharacterSet]].length &&
        ![self.systemFontController.errorText isEqualToString:@"Error: You cannot enter numbers"]) {
      // The entered text contains numbers and we have not set an error
      [self.systemFontController setErrorText:@"You cannot enter numbers" errorAccessibilityValue:nil];

      // Since we are doing manual layout, we need to react to the expansion of the input that will
      // come from setting an error.
      [self.view setNeedsLayout];
    } else if (self.systemFontController.errorText != nil) {
      // There should be no error but error text is being shown.
      [self.systemFontController setErrorText:nil errorAccessibilityValue:nil];

      // Since we are doing manual layout, we need to react to the contraction of the input that
      // will come from setting an error.
      [self.view setNeedsLayout];
    }
  }

  if (textField == (UITextField *)self.customFontController.textInput) {
    if ([finishedString rangeOfCharacterFromSet:[[NSCharacterSet letterCharacterSet] invertedSet]]
        .length > 0) {
      [self.customFontController setErrorText:@"Error: City can only contain letters"
                errorAccessibilityValue:nil];
    } else {
      [self.customFontController setErrorText:nil errorAccessibilityValue:nil];
    }
  }
  return YES;
}

#pragma mark - UITextViewDelegate

- (void)textViewDidChange:(UITextView *)textView {
  NSLog(@"%@", textView.text);
}

#pragma mark - Gesture Handling

- (void)tapDidTouch:(UIGestureRecognizer *)sender {
  [self.view endEditing:YES];
}

#pragma mark - Keyboard Handling

- (void)registerKeyboardNotifications {
  NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];

  [defaultCenter addObserver:self
                    selector:@selector(keyboardWillShow:)
                        name:UIKeyboardWillShowNotification
                      object:nil];
  [defaultCenter addObserver:self
                    selector:@selector(keyboardWillShow:)
                        name:UIKeyboardWillChangeFrameNotification
                      object:nil];
  [defaultCenter addObserver:self
                    selector:@selector(keyboardWillHide:)
                        name:UIKeyboardWillHideNotification
                      object:nil];
}

- (void)keyboardWillShow:(NSNotification *)notif {
  CGRect keyboardFrame = [notif.userInfo[UIKeyboardFrameEndUserInfoKey] CGRectValue];
  self.scrollView.contentInset = UIEdgeInsetsMake(0, 0, CGRectGetHeight(keyboardFrame), 0);
}

- (void)keyboardWillHide:(NSNotification *)notif {
  self.scrollView.contentInset = UIEdgeInsetsZero;
}

#pragma mark - Phone Number Validation

- (BOOL)isValidPhoneNumber:(NSString *)inputString partially:(BOOL)isPartialCheck {
  // In real life there would be much more robust validation that takes locale into account, checks
  // against invalid phone numbers (like those that begin with 0), and perhaps even auto-inserts the
  // hyphens so the user doesn't have to.

  if (inputString.length == 0) {
    return YES;
  }

  NSCharacterSet *characterSet = [NSCharacterSet characterSetWithCharactersInString:@"0123456789-"];
  characterSet = [characterSet invertedSet];

  BOOL isValid = ![inputString rangeOfCharacterFromSet:characterSet].length;

  if (!isPartialCheck) {
    isValid = isValid && inputString.length == 12;
  } else {
    isValid = isValid && inputString.length <= 12;
  }
  return isValid;
}

@end

@implementation TextFieldCustomFontExample (CatalogByConvention)

+ (NSArray *)catalogBreadcrumbs {
  return @[ @"Text Field", @"Custom Fonts" ];
}

+ (BOOL)catalogIsPrimaryDemo {
  return NO;
}

+ (BOOL)catalogIsPresentable {
  return NO;
}

@end


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Fungi of New Zealand, Nga Harore o Aotearoa 5: 171 (2008)

#### Original name
Entoloma peraffine E. Horak, 2008

### Remarks
null


text:
<?php

namespace Alchemy\Zippy\Tests\Adapter\VersionProbe;

use Alchemy\Zippy\Tests\TestCase;
use Alchemy\Zippy\Adapter\VersionProbe\ZipExtensionVersionProbe;
use Alchemy\Zippy\Adapter\VersionProbe\VersionProbeInterface;

class ZipExtensionVersionProbeTest extends TestCase
{
    /**
     * @covers Alchemy\Zippy\Adapter\VersionProbe\ZipExtensionVersionProbe::getStatus
     */
    public function testGetStatus()
    {
        $expectation = VersionProbeInterface::PROBE_OK;
        if (false === class_exists('ZipArchive')) {
            $expectation = VersionProbeInterface::PROBE_NOTSUPPORTED;
        }

        $probe = new ZipExtensionVersionProbe();
        $this->assertEquals($expectation, $probe->getStatus());
    }
}


text:
package org.jsmart.zerocode.parallel.restful;

import org.jsmart.zerocode.core.domain.LoadWith;
import org.jsmart.zerocode.core.domain.TestMapping;
import org.jsmart.zerocode.core.runner.parallel.ZeroCodeLoadRunner;
import org.junit.runner.RunWith;

@LoadWith("load_config_test.properties")
@TestMapping(testClass = JunitRestTestSample.class, testMethod = "testGetCallToHome_pass")
@RunWith(ZeroCodeLoadRunner.class)
public class LoadRestEndPointSingleRunnerTest {

}


text:
package net.glowstone.net.message.login;

import com.flowpowered.network.Message;
import lombok.Data;

@Data
public class LoginPluginResponseMessage implements Message {
    private final int transactionId;
    private final boolean successful;
    private final byte[] data;
}


text: export default Object.freeze({})


text:
package org.keycloak.protocol.oidc.representations;

import org.codehaus.jackson.annotate.JsonAnyGetter;
import org.codehaus.jackson.annotate.JsonAnySetter;
import org.codehaus.jackson.annotate.JsonProperty;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @author Stian Thorgersen
 */

public class OIDCConfigurationRepresentation {

    @JsonProperty("issuer")
    private String issuer;

    @JsonProperty("authorization_endpoint")
    private String authorizationEndpoint;

    @JsonProperty("token_endpoint")
    private String tokenEndpoint;

    @JsonProperty("userinfo_endpoint")
    private String userinfoEndpoint;

    @JsonProperty("end_session_endpoint")
    private String logoutEndpoint;

    @JsonProperty("jwks_uri")
    private String jwksUri;

    @JsonProperty("grant_types_supported")
    private List<String> grantTypesSupported;

    @JsonProperty("response_types_supported")
    private List<String> responseTypesSupported;

    @JsonProperty("subject_types_supported")
    private List<String> subjectTypesSupported;

    @JsonProperty("id_token_signing_alg_values_supported")
    private List<String> idTokenSigningAlgValuesSupported;

    @JsonProperty("response_modes_supported")
    private List<String> responseModesSupported;

    protected Map<String, Object> otherClaims = new HashMap<String, Object>();

    public String getIssuer() {
        return issuer;
    }

    public void setIssuer(String issuer) {
        this.issuer = issuer;
    }

    public String getAuthorizationEndpoint() {
        return authorizationEndpoint;
    }

    public void setAuthorizationEndpoint(String authorizationEndpoint) {
        this.authorizationEndpoint = authorizationEndpoint;
    }

    public String getTokenEndpoint() {
        return tokenEndpoint;
    }

    public void setTokenEndpoint(String tokenEndpoint) {
        this.tokenEndpoint = tokenEndpoint;
    }

    public String getUserinfoEndpoint() {
        return userinfoEndpoint;
    }

    public void setUserinfoEndpoint(String userinfoEndpoint) {
        this.userinfoEndpoint = userinfoEndpoint;
    }

    public String getJwksUri() {
        return jwksUri;
    }

    public void setJwksUri(String jwksUri) {
        this.jwksUri = jwksUri;
    }

    public String getLogoutEndpoint() {
        return logoutEndpoint;
    }

    public void setLogoutEndpoint(String logoutEndpoint) {
        this.logoutEndpoint = logoutEndpoint;
    }

    public List<String> getGrantTypesSupported() {
        return grantTypesSupported;
    }

    public void setGrantTypesSupported(List<String> grantTypesSupported) {
        this.grantTypesSupported = grantTypesSupported;
    }

    public List<String> getResponseTypesSupported() {
        return responseTypesSupported;
    }

    public void setResponseTypesSupported(List<String> responseTypesSupported) {
        this.responseTypesSupported = responseTypesSupported;
    }

    public List<String> getSubjectTypesSupported() {
        return subjectTypesSupported;
    }

    public void setSubjectTypesSupported(List<String> subjectTypesSupported) {
        this.subjectTypesSupported = subjectTypesSupported;
    }

    public List<String> getIdTokenSigningAlgValuesSupported() {
        return idTokenSigningAlgValuesSupported;
    }

    public void setIdTokenSigningAlgValuesSupported(List<String> idTokenSigningAlgValuesSupported) {
        this.idTokenSigningAlgValuesSupported = idTokenSigningAlgValuesSupported;
    }

    public List<String> getResponseModesSupported() {
        return responseModesSupported;
    }

    public void setResponseModesSupported(List<String> responseModesSupported) {
        this.responseModesSupported = responseModesSupported;
    }

    @JsonAnyGetter
    public Map<String, Object> getOtherClaims() {
        return otherClaims;
    }

    @JsonAnySetter
    public void setOtherClaims(String name, Object value) {
        otherClaims.put(name, value);
    }

}


text:
Back to Catalog

Add item:

<form class="form-horizontal" role="form" id="add-form">

        Id (integer, unique):

            <input type="number" id="addIdField" class="form-control" placeholder="examples: "1", "928", "87357"">

        Price (integer):

            <input type="number" id="addPriceField" class="form-control" placeholder="examples: "0", "15", "100"">

        Description (text):

            <input type="text" id="addDescriptionField" class="form-control" placeholder="examples: "Cat. Loves treats, self. Hates everything else."">

            <button id="addButton" class="btn btn-primary">Submit</button>

</form>

Clear claim:

<form class="form-horizontal" role="form" id="clear-form">

        Id (integer, unique):

            <input type="number" id="clearClaimIdField" class="form-control" placeholder="examples: "1", "928", "87357"">

            <button id="clearButton" class="btn btn-primary">Submit</button>

</form>


text:
CREATE TABLE IF NOT EXISTS `ClientElb` (
  `id` VARCHAR(64) NOT NULL,
  `elbUrl` VARCHAR(300) NOT NULL,
  `createdAt` TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3),
  `updatedAt` TIMESTAMP(3) DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3),
  PRIMARY KEY (`id`)
)
ENGINE=InnoDB
ROW_FORMAT=DEFAULT
DEFAULT CHARSET=utf8
AUTO_INCREMENT=1;

--rollback drop table ClientElb;