text:
package org.openehealth.ipf.commons.ihe.xds.core.validate.responses;

import org.openehealth.ipf.commons.core.modules.api.Validator;
import org.openehealth.ipf.commons.ihe.xds.XdsIntegrationProfile;
import org.openehealth.ipf.commons.ihe.xds.core.ebxml.EbXMLRetrieveDocumentSetResponse;
import org.openehealth.ipf.commons.ihe.xds.core.validate.HomeCommunityIdValidator;
import org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationProfile;

import static org.apache.commons.lang3.Validate.notNull;
import static org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationMessage.DOC_ID_MUST_BE_SPECIFIED;
import static org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationMessage.MIME_TYPE_MUST_BE_SPECIFIED;
import static org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationMessage.MISSING_DOCUMENT_FOR_DOC_ENTRY;
import static org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationMessage.ON_DEMAND_DOC_ID_MUST_DIFFER;
import static org.openehealth.ipf.commons.ihe.xds.core.validate.ValidationMessage.REPO_ID_MUST_BE_SPECIFIED;
import static org.openehealth.ipf.commons.ihe.xds.core.validate.ValidatorAssertions.metaDataAssert;

/**
 * Validates {@link EbXMLRetrieveDocumentSetResponse}.
 *
 * @author Jens Riemschneider
 */
public class RetrieveDocumentSetResponseValidator implements Validator<EbXMLRetrieveDocumentSetResponse, ValidationProfile> {
    private final RegistryResponseValidator regResponseValidator = new RegistryResponseValidator();
    private final HomeCommunityIdValidator hcValidator = new HomeCommunityIdValidator(true);

    @Override
    public void validate(EbXMLRetrieveDocumentSetResponse response, ValidationProfile profile) {
        notNull(response, "response cannot be null");

        regResponseValidator.validate(response, profile);

        for (var doc : response.getDocuments()) {
            var requestData = doc.getRequestData();

            var repoId = requestData.getRepositoryUniqueId();
            metaDataAssert(repoId != null && !repoId.isEmpty(), REPO_ID_MUST_BE_SPECIFIED);

            var docId = requestData.getDocumentUniqueId();
            metaDataAssert(docId != null && !docId.isEmpty(), DOC_ID_MUST_BE_SPECIFIED);

            var newDocId = doc.getNewDocumentUniqueId();
            metaDataAssert(!docId.equals(newDocId), ON_DEMAND_DOC_ID_MUST_DIFFER);

            var mimeType = doc.getMimeType();
            metaDataAssert(mimeType != null && !mimeType.isEmpty(), MIME_TYPE_MUST_BE_SPECIFIED);

            if (profile.getInteractionProfile().getHomeCommunityIdOptionality() != XdsIntegrationProfile.HomeCommunityIdOptionality.NEVER) {
                hcValidator.validate(requestData.getHomeCommunityId());
            }

            metaDataAssert(doc.getDataHandler() != null, MISSING_DOCUMENT_FOR_DOC_ENTRY, docId);
        }
    }
}


text:
/**
 *
 */
package uk.ac.manchester.cs.pronto.alg;

import java.util.Set;

/**
 * @author Pavel Klinov
 *
 * pklinov@cs.man.ac.uk, pklinov@clarkparsia.com
 */
public interface HittingSetObject<T> {

	public Set<Set<T>> leftSubset(T element);
	public Set<Set<T>> rightSubset(T element);
	public T getElement();
	public Set<Set<T>> getConflictSets();
	public void setConflictSets(Set<Set<T>> conflictSets);
	public Set<Set<T>> getMinimalHittingSets();
	public void setMinimalHittingSets(Set<Set<T>> hittingSets);
	public void setChanged(boolean changed);
	public boolean isChanged();
}

redpajama_set_name: RedPajamaGithub


text:
/*
 * Data.h
 *
 *  Created on: 15-may-2009
 *      Author: jorge
 */

#ifndef DATA_H_
#define DATA_H_

#include <string>
#include <vector>

class Data {

public:

	Data();

	Data(double** dataInput, double** dataOutput, int numberOfData, int inputSize, int outputSize);

	virtual ~Data();

	bool loadData(std::string file);

	bool saveData(std::string file);

	inline int getNumberOfData(){
		return this->numberOfData;
	}

	inline int getInputSize(){
		return this->inputSize;
	}

	inline int getOutputSize(){
		return this->outputSize;
	}

	inline double** getDataInput(){
		return this->dataInput;
	}

	inline double** getDataOutput(){
		return this->dataOutput;
	}

	void addData(double* inputs, double* outputs);

private:

	double** dataInput;

	double** dataOutput;

	int numberOfData;

	int inputSize;

	int outputSize;
};

#endif /* DATA_H_ */


text:
"""Contains all the Django widgets for select2-chained."""

import logging

from django.utils.safestring import mark_safe
from django_select2.util import JSFunctionInContext
from django_select2.widgets import AutoHeavySelect2Widget

__all__ = (
    'PrepopulatedSelect2Widget', 'ChainedAutoSelect2Widget'
)

logger = logging.getLogger(__name__)

class PrepopulatedSelect2Widget(AutoHeavySelect2Widget):
    """
    A prepopulated :py:class:`django_select2.widgets.AutoHeavySelect2Widget`.

    It allows sending empty search queries to the server.
    """

    def __init__(self, **kwargs):
        """
        Init method.

        :keyword select2_options: A dictionary containing select2 options.
        """
        if not isinstance(kwargs.get('select2_options'), dict):
            kwargs['select2_options'] = {}

        kwargs['select2_options'].update({
            # This will allow select2 to send empty search to server.
            'minimumInputLength': 0,
            # This is needed, otherwise search field will be hidden by select2.
            'minimumResultsForSearch': 0,
        })
        super(PrepopulatedSelect2Widget, self).__init__(**kwargs)

class ChainedAutoSelect2Widget(PrepopulatedSelect2Widget):
    """A :py:class:`PrepopulatedSelect2Widget` to be used with chained fields."""

    def __init__(self, *args, **kwargs):
        """
        Init method.

        :keyword chain_field: Name of the field in the form.
        :keyword model_field: Name of the field in the model.
        """
        self.chain_field = kwargs.pop('chain_field', None)
        self.model_field = kwargs.pop('model_field', None)
        super(ChainedAutoSelect2Widget, self).__init__(*args, **kwargs)

    def render(self, name, value, attrs=None, choices=()):
        """Render the widget."""
        if not self.chain_field or not self.model_field:
            raise NotImplementedError(u"Chain field and model field must be specified.")
        if len(name.split('-')) > 1:  # formset
            chain_field = '-'.join(name.split('-')[:-1] + [self.chain_field])
        else:
            chain_field = self.chain_field

        data_div = '

' \
                   % (chain_field, value, attrs['id'])
        output = super(ChainedAutoSelect2Widget, self).render(name, value, attrs, choices)
        output += data_div
        return mark_safe(output)

    class Media:
        js = ['/static/js/select2_chained.js']

    def init_options(self):
        """Initialize widget options."""
        self.options['ajax']['data'] = JSFunctionInContext('django_select2_chained.extra_url_params')
        self.options['chain_field'] = self.chain_field


text:
package com.vlabs.medicinetracker.blood_pressure;

import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ViewHolder;
import android.support.v7.widget.helper.ItemTouchHelper;

import com.vlabs.medicinetracker.blood_pressure.show.BloodPressureAdapter;

/**
 * Created by vlad on 3/24/16.
 */
public class ItemTouchHelperCallback extends ItemTouchHelper.Callback {

    private final BloodPressureAdapter mAdapter;

    public ItemTouchHelperCallback(final BloodPressureAdapter adapter) {
        mAdapter = adapter;
    }

    @Override
    public boolean isItemViewSwipeEnabled() {
        return true;
    }

    @Override
    public int getMovementFlags(final RecyclerView recyclerView, final ViewHolder viewHolder) {
        int swipeFlags = ItemTouchHelper.START | ItemTouchHelper.END;
        return makeMovementFlags(0, swipeFlags);
    }

    @Override
    public boolean onMove(final RecyclerView recyclerView, final ViewHolder viewHolder, final ViewHolder target) {
        return false;
    }

    @Override
    public void onSwiped(final ViewHolder viewHolder, final int direction) {
        mAdapter.onItemDismiss(viewHolder.getAdapterPosition());
    }
}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Ferramenta_Scrumt.MODEL
{
    public class Funcao
    {
        public int ID_Funcao { get; set; }
        public String Nome_Funcao { get; set; }
    }
}


text:
require 'test_helper'

class Blog::CommentsControllerTest < ActionController::TestCase
  # test "the truth" do
  #   assert true
  # end
end


text:
Check for UVPipe
--FILE--
<?php
$socketName = 'uvpipe.test.sock';
if(file_exists($socketName)){
    unlink($socketName);
}
$loop = UVLoop::defaultLoop();
$pipe = new UVPipe(null);
$pipe->listen($socketName, function($pipe, $status){
    echo "on connect $status\n";
    $client = $pipe->accept();
    $client->setCallback(function($clientTest, $data) use($client){
        echo "server recv: $data\n";
        $client->write($data);
    }, function($clientTest, $status, $len) use($pipe, $client){
        echo "server write:$len\n";
        $client->shutdown(function($clientTest) use($pipe, $client){
            echo "client shutdown end\n";
            $client->close();
            $pipe->close();
        });
    }, function($clientTest, $status) use($client){
        echo "server recv error\n";
        $client->close();
    });
});
echo "server: {$pipe->getSockname()}\n";

$pipe2 = new UVPipe($loop);
$pipe2->connect($socketName, function($pipe2, $status){
    $pipe2->setCallback(function($pipe2Test, $data) use($pipe2){
        echo "Server response: $data\n";
    }, function($pipe2Test, $status, $len) use($pipe2){
        echo "client send $len\n";
    }, function($pipe2Test, $status) use($pipe2){
        echo "client recv error\n";
        $pipe2->close();
    });
    $pipe2->write("client send some data");
});
$loop->run();
?>
--EXPECT--
server: uvpipe.test.sock
on connect 0
client send 21
server recv: client send some data
server write:21
client shutdown end
Server response: client send some data
client recv error


text:
<?php namespace Responses\Inverters\StecaGrid;

use App\Contracts\HTTP as HTTPContract;

class FeedingResponse implements HTTPContract {

    /*
	|--------------------------------------------------------------------------
    | Mock Feeding StecaGrid HTTP Response
    |--------------------------------------------------------------------------
    |
    | This mock returns a real-world response that a StecaGrid inverter may
    | send when feeding.
    |
    */

	/**
	 * Return the sample response.
	 *
	 * @param  string  $host
	 * @param  string  $uri
	 * @param  array   $headers
	 * @return string
	 */
    public static function get($host, $uri, $headers = [])
    {
		if (strpos($uri, 'gen.yield.day.chart.js') === false) {
			return file_get_contents(__DIR__.'/JavaScript/feeding.js');

		} else {
			return file_get_contents(__DIR__.'/JavaScript/3900.js');

		}
    }

	public static function post($host, $uri, $data, $headers = [])
	{
		//
	}

}

?>


text:
import { createAction } from 'redux-act'

import router from 'template-ui/lib/plugins2/router/actions'
import value from 'template-ui/lib/plugins2/value/actions'
import form from 'template-ui/lib/plugins2/form/actions'
import system from 'template-ui/lib/plugins2/system/actions'
import Crud from 'template-ui/lib/plugins2/crud/actions'
import Digger from 'template-ui/lib/plugins2/digger/actions'

import forms from './forms'

const events = {
  menuClick: createAction('menu click')
}

const user = Crud({
  name: 'user'
})

const installation = Crud({
  name: 'installation'
})

const resource = Digger({
  name: 'resource'
})

const actions = {
  system,
  router,
  value,
  form,
  events,
  user,
  installation,
  resource,
  formutils: {
    // utility to touch all by name
    touchAll: (name) => form.touchAll(name, forms[name])
  }
}

export default actions


text:
//
//  NSJSONSerialization+TechD.m
//  Foundation+TechD
//
//  Created by Robin Hsu on 2015/3/20.
//  Copyright (c) 2015年 TechD. All rights reserved.
//
//  ------------------------------------------------------------------------------------------------
//  ------------------------------------------------------------------------------------------------

#import "NSJSONSerialization+TechD.h"

//  ------------------------------------------------------------------------------------------------
#pragma mark define constant string.
//  ------------------------------------------------------------------------------------------------
static NSString   * const NSJSONSerialization_TechD                 = @"NSJSONSerialization+TechD";
static NSString   * const NSJSONSerialization_TechDErrorDomain      = @"com.techd.ns.json.serialization.error";

//  ------------------------------------------------------------------------------------------------
#pragma mark declare enumeration.
//  ------------------------------------------------------------------------------------------------

typedef NS_ENUM( NSInteger, NSJSONSerialization_TechDErrorCode )
{
    /**
     *  maybe unknow how to define the error.
     */
    NSJSONSerialization_TechDErrorCodeUndefined             = -1,

    /**
     *  when has error, file not exist.
     */
    NSJSONSerialization_TechDErrorCodeFileNotExist          = -2,

    /**
     *  when has error, the file name is directory.
     */
    NSJSONSerialization_TechDErrorCodeFileIsDir,

};

//  ------------------------------------------------------------------------------------------------
//  ------------------------------------------------------------------------------------------------

//  ------------------------------------------------------------------------------------------------
//  ------------------------------------------------------------------------------------------------
#pragma mark -
#pragma mark declare private category (_Techd)
//  ------------------------------------------------------------------------------------------------
@interface NSJSONSerialization (_Techd)

//  ------------------------------------------------------------------------------------------------
#pragma mark declare for error output
//  ------------------------------------------------------------------------------------------------
/**
 *  @brief create a error object by error code.
 *  create a error object by error code.
 *
 *  @param relationObject           a relation object for error message.
 *  @param errorCode                a error code.
 *
 *  @return object|nil              a error object or nil.
 */
+ ( NSError * ) _ErrorMessage:(id)relationObject with:(NSJSONSerialization_TechDErrorCode)errorCode;

//  ------------------------------------------------------------------------------------------------

@end

//  ------------------------------------------------------------------------------------------------
//  ------------------------------------------------------------------------------------------------

//  ------------------------------------------------------------------------------------------------
//  ------------------------------------------------------------------------------------------------
#pragma mark -
#pragma mark implementation private category (_Techd)
//  ------------------------------------------------------------------------------------------------
@implementation NSJSONSerialization (_Techd)

//  ------------------------------------------------------------------------------------------------
#pragma mark method for error output
//  ------------------------------------------------------------------------------------------------
+ ( NSError * ) _ErrorMessage:(id)relationObject with:(NSJSONSerialization_TechDErrorCode)errorCode
{
    NSString                      * errorMessage;
    NSMutableDictionary           * errorInfos;

    errorMessage                    = nil;
    switch ( errorCode )
    {
        case NSJSONSerialization_TechDErrorCodeFileNotExist:
        {
            //  is equal NSCocoaErrorDomain Code=260.
            errorMessage            = [NSString stringWithFormat: @"file(%@) is not exist.", relationObject];
            break;
        }
        case NSJSONSerialization_TechDErrorCodeFileIsDir:
        {
            errorMessage            = [NSString stringWithFormat: @"file name(%@) is directory.", relationObject];
            break;
        }

        default:
        {
            errorMessage            = @"error code undefined.";
            break;
        }
    }

    errorInfos                      = [@{
                                         NSLocalizedDescriptionKey: NSLocalizedStringFromTable( errorMessage, NSJSONSerialization_TechD, nil ),
                                         } mutableCopy];

    return [NSError errorWithDomain: NSJSONSerialization_TechDErrorDomain code: errorCode userInfo: errorInfos];
}

//  ------------------------------------------------------------------------------------------------

@end

//  ------------------------------------------------------------------------------------------------
//  ------------------------------------------------------------------------------------------------
#pragma mark -
#pragma mark implementation public category (Techd)
//  ------------------------------------------------------------------------------------------------
@implementation NSJSONSerialization (TechD)

//  ------------------------------------------------------------------------------------------------
//  ------------------------------------------------------------------------------------------------
+ ( BOOL ) saveJSONContainer:(NSDictionary *)container toFileAtPath:(NSString *)filepath error:(NSError * __autoreleasing *)error
{
    NSParameterAssert( nil != container );
    NSParameterAssert( nil != filepath );

    NSError                       * saveError;
    NSFileManager                 * manager;
    NSOutputStream                * outputStream;

    saveError                       = nil;
    outputStream                    = nil;
    manager                         = [NSFileManager defaultManager];
    NSParameterAssert( nil != manager );

    //  pre-create subpath on here, because NSJSONSerialization's writeJSONObject: toStream: ..., save the JSON file without create subpath of the file path.
    if ( [manager fileExistsAtPath: [filepath stringByDeletingLastPathComponent]] == NO )
    {
        saveError                   = nil;
        if ( [manager createDirectoryAtPath: [filepath stringByDeletingLastPathComponent] withIntermediateDirectories: YES attributes: nil error: &saveError] == NO )
        {
            if ( nil != error )
            {
                *error              = saveError;
            }
            return NO;
        }
    }

    //  first, remove the exist file.
    saveError                       = nil;
    if ( [manager fileExistsAtPath: filepath] == YES )
    {
        if ( [manager removeItemAtPath: filepath error: &saveError] == NO )
        {
            NSLog( @"delete file error : %@", saveError );
        }
    }

    //  second, save container to file.
    outputStream                    = [NSOutputStream outputStreamToFileAtPath: filepath append: NO];
    NSParameterAssert( nil != outputStream );

    saveError                       = nil;
    [outputStream                   open];
    [NSJSONSerialization            writeJSONObject: container toStream: outputStream options: 0 error: &saveError];
    if ( nil != saveError )
    {
        if ( nil != error )
        {
            *error                  = saveError;
        }
        [outputStream               close];
        return NO;
    }

    //  finish.
    [outputStream                   close];
    if ( nil != error )
    {
        *error                      = NULL;
    }
    return YES;
}

//  ------------------------------------------------------------------------------------------------
+ ( id ) loadJSON:(NSString *)filepath encoding:(NSStringEncoding)encode error:(NSError * __autoreleasing *)error
{
    NSParameterAssert( nil != filepath );

    BOOL                            isDir;
    NSString                      * json;
    NSError                       * loadError;
    NSFileManager                 * manager;
    id                              dataContainer;

    loadError                       = nil;
    dataContainer                   = nil;
    manager                         = [NSFileManager defaultManager];
    NSParameterAssert( nil != manager );

    // when file not exist.
    isDir                           = NO;
    if ( [manager fileExistsAtPath: filepath isDirectory: &isDir] == NO )
    {
        if ( NULL != error )
        {
            *error                  = [[self class] _ErrorMessage: filepath with: NSJSONSerialization_TechDErrorCodeFileNotExist];
        }
        return nil;
    }

    if ( YES == isDir )
    {
        if ( NULL != error )
        {
            *error                  = [[self class] _ErrorMessage: filepath with: NSJSONSerialization_TechDErrorCodeFileIsDir];
        }
        return nil;
    }

    json                            = [NSString stringWithContentsOfFile: filepath encoding: encode error: &loadError];
    if ( nil != loadError )
    {
        if ( ( nil != loadError ) && ( NULL != error ) )
        {
            *error                  = loadError;
        }
        return nil;
    }

    loadError                       = nil;
    dataContainer                   = [NSJSONSerialization JSONObjectWithData: [json dataUsingEncoding: encode] options: NSJSONReadingMutableContainers error: &loadError];
    if ( nil != loadError )
    {
        if ( ( nil != loadError ) && ( NULL != error ) )
        {
            *error                  = loadError;
        }
        return nil;
    }

    if ( nil != error )
    {
        *error                      = NULL;
    }
    return dataContainer;
}

//  ------------------------------------------------------------------------------------------------
//  ------------------------------------------------------------------------------------------------

@end

//  ------------------------------------------------------------------------------------------------
//  ------------------------------------------------------------------------------------------------


text:
TransformationsWindow::TransformationsWindow(QWidget *parent,QWidget *glview) :
    QDialog(parent),
    ui(new Ui::TransformationsWindow)
{
    ui->setupUi(this);
    connect(this,SIGNAL(on_doubleSpinBoxRotate(double,double,double)),glview,SLOT(setRotation(double,double,double)));
    connect(this,SIGNAL(on_doubleSpinBoxTranslate(float,float,float)),glview,SLOT(setTranslation(float,float,float)));
    connect(this,SIGNAL(on_doubleSpinBoxScale(double)),glview,SLOT(setScale(double)));
}

TransformationsWindow::~TransformationsWindow()
{
    emit on_doubleSpinBoxRotate(oldrx,oldry,oldrz);
    emit on_doubleSpinBoxTranslate(oldtx,oldty,oldtz);
    emit on_doubleSpinBoxScale(oldscale);
    delete ui;
}

void TransformationsWindow::setRotationValues(double x,double y,double z)
{
    oldrx=rx=x;
    oldry=ry=y;
    oldrz=rz=z;
    ui->doubleSpinBoxRotateX->setValue(rx);
    ui->doubleSpinBoxRotateY->setValue(ry);
    ui->doubleSpinBoxRotateZ->setValue(rz);
}

void TransformationsWindow::setTranslationValues(float x,float y,float z)
{
    oldtx=tx=x;
    oldty=ty=y;
    oldtz=tz=z;
    ui->doubleSpinBoxTranslateX->setValue(rx);
    ui->doubleSpinBoxTranslateY->setValue(ry);
    ui->doubleSpinBoxTranslateZ->setValue(rz);
}

void TransformationsWindow::setScaleValue(double s)
{
    oldscale=scale=s;
    ui->doubleSpinBoxScale->setValue(scale);
}

void TransformationsWindow::on_doubleSpinBoxTranslateX_valueChanged(double arg1)
{
    tx=arg1;
    emit on_doubleSpinBoxTranslate(tx,ty,tz);
}

void TransformationsWindow::on_doubleSpinBoxTranslateY_valueChanged(double arg1)
{
    ty=arg1;
    emit on_doubleSpinBoxTranslate(tx,ty,tz);
}

void TransformationsWindow::on_doubleSpinBoxTranslateZ_valueChanged(double arg1)
{
    tz=arg1;
    emit on_doubleSpinBoxTranslate(tx,ty,tz);
}

void TransformationsWindow::on_doubleSpinBoxRotateX_valueChanged(double arg1)
{
    rx=arg1;
    emit on_doubleSpinBoxRotate(rx,ry,rz);
}

void TransformationsWindow::on_doubleSpinBoxRotateY_valueChanged(double arg1)
{
    ry=arg1;
    emit on_doubleSpinBoxRotate(rx,ry,rz);
}

void TransformationsWindow::on_doubleSpinBoxRotateZ_valueChanged(double arg1)
{
    rz=arg1;
    emit on_doubleSpinBoxRotate(rx,ry,rz);
}

void TransformationsWindow::on_doubleSpinBoxScale_valueChanged(double arg1)
{
    scale=arg1;
    emit on_doubleSpinBoxScale(scale);
}

void TransformationsWindow::on_buttonBox_accepted()
{
    emit on_doubleSpinBoxRotate(rx,ry,rz);
    emit on_doubleSpinBoxTranslate(tx,ty,tz);
    emit on_doubleSpinBoxScale(scale);
}

void TransformationsWindow::on_buttonBox_rejected()
{
    emit on_doubleSpinBoxRotate(oldrx,oldry,oldrz);
    emit on_doubleSpinBoxTranslate(oldtx,oldty,oldtz);
    emit on_doubleSpinBoxScale(oldscale);
}


text:
<meta charset="utf-8">
<title>{% if page.title %}{{ page.title }} – {% endif %}{{ site.title }}</title>
<meta name="description" content="{% if page.description %}{{ page.description }}{% else %}{{ site.description }}{% endif %}">
{% if page.tags %}<meta name="keywords" content="{{ page.tags | join: ', ' }}">{% endif %}

{% if site.owner.twitter %}
{% if page.image.feature %}<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="{{site.baseurl}}/images/{{ page.image.feature }}">
{% else %}<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="{% if page.image.thumb %}{{site.baseurl}}/images/{{ page.image.thumb }}{% else %}{{site.baseurl}}/images/{{ site.logo }}{% endif %}">{% endif %}
<meta name="twitter:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}">
<meta name="twitter:description" content="{% if page.description %}{{ page.description }}{% else %}{{ site.description }}{% endif %}">
<meta name="twitter:creator" content="@{{ site.owner.twitter }}">{% endif %}

<meta property="og:locale" content="en_US">
<meta property="og:type" content="article">
<meta property="og:title" content="{% if page.title %}{{ page.title }}{% else %}{{ site.title }}{% endif %}">
<meta property="og:description" content="{% if page.description %}{{ page.description }}{% else %}{{ site.description }}{% endif %}">
<meta property="og:url" content="{{site.baseurl}}{{ page.url }}">
<meta property="og:site_name" content="{{ site.title }}">
{% if page.image.feature %}<meta property="og:image" content="{{site.baseurl}}/images/{{ page.image.feature }}">{% else %}<meta property="og:image" content="{{site.baseurl}}/images/{{ site.default_bg }}">{% endif %}

{% if site.google_verify %}<meta name="google-site-verification" content="{{ site.google_verify }}">{% endif %}
{% if site.bing_verify %}<meta name="msvalidate.01" content="{{ site.bing_verify }}">{% endif %}

{% capture canonical %}{{site.baseurl}}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %}
<link rel="canonical" href="{{ canonical }}">
<link href="{{site.baseurl}}/feed.xml" type="application/atom+xml" rel="alternate" title="{{ site.title }} Feed">
{% if site.owner.google_plus %}<link rel="author" href="{{ site.owner.google_plus }}?rel=author">{% endif %}

<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

{% if page.royalslider %}
    <link rel='stylesheet' href="{{site.baseurl}}/assets/css/royalslider.css">
    <link rel='stylesheet' href="{{site.baseurl}}/assets/css/rs-default.css">
{% endif %}
{% if page.royalslideralt %}
    <link rel='stylesheet' href="{{site.baseurl}}/assets/css/royalslider.css">
    <link rel='stylesheet' href="{{site.baseurl}}/assets/css/rs-minimal-white.css">
{% endif %}
<link rel="stylesheet" type="text/css" href="{{site.baseurl}}/assets/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="{{site.baseurl}}/assets/css/blog.css" />
<link rel="stylesheet" type="text/css" href="{{site.baseurl}}/assets/css/styles.css" />
{% if page.magnific %}
    <link rel="stylesheet" type="text/css" href="{{site.baseurl}}/assets/css/magnific.css" />
{% endif %}
{% if site.search %}

        <input type="text" class="search-field" placeholder="Search...">

{% endif %}

{% if page.mathjax %}

{% endif %}

{% if page.sticky-footer %}

{% endif %}

<link rel="shortcut icon" href="{{site.baseurl}}/favicon.ico">

<link rel="shortcut icon" href="{{site.baseurl}}/favicon.png">

<link rel="apple-touch-icon-precomposed" href="{{site.baseurl}}/images/apple-touch-icon-precomposed.png">

<link rel="apple-touch-icon-precomposed" sizes="72x72" href="{{site.baseurl}}/images/apple-touch-icon-72x72-precomposed.png">

<link rel="apple-touch-icon-precomposed" sizes="114x114" href="{{site.baseurl}}/images/apple-touch-icon-114x114-precomposed.png">

<link rel="apple-touch-icon-precomposed" sizes="144x144" href="{{site.baseurl}}/images/apple-touch-icon-144x144-precomposed.png">


text:
#ifndef GLOBAL_SCHEDULER_H
#define GLOBAL_SCHEDULER_H

#include "task.h"

#include <unordered_map>

#include "state/db.h"
#include "state/local_scheduler_table.h"

/* The frequency with which the global scheduler checks if there are any tasks
 * that haven't been scheduled yet. */
#define GLOBAL_SCHEDULER_TASK_CLEANUP_MILLISECONDS 100

/** Contains all information that is associated with a local scheduler. */
typedef struct {
  /** The ID of the local scheduler in Redis. */
  DBClientID id;
  /** The number of heartbeat intervals that have passed since we last heard
   *  from this local scheduler. */
  int64_t num_heartbeats_missed;
  /** The number of tasks sent from the global scheduler to this local
   *  scheduler. */
  int64_t num_tasks_sent;
  /** The number of tasks sent from the global scheduler to this local scheduler
   *  since the last heartbeat arrived. */
  int64_t num_recent_tasks_sent;
  /** The latest information about the local scheduler capacity. This is updated
   *  every time a new local scheduler heartbeat arrives. */
  LocalSchedulerInfo info;
} LocalScheduler;

typedef struct GlobalSchedulerPolicyState GlobalSchedulerPolicyState;

/**
 * This defines a hash table used to cache information about different objects.
 */
typedef struct {
  /** The size in bytes of the object. */
  int64_t data_size;
  /** A vector of object locations for this object. */
  std::vector<std::string> object_locations;
} SchedulerObjectInfo;

/**
 * Global scheduler state structure.
 */
typedef struct {
  /** The global scheduler event loop. */
  event_loop *loop;
  /** The global state store database. */
  DBHandle *db;
  /** A hash table mapping local scheduler ID to the local schedulers that are
   *  connected to Redis. */
  std::unordered_map<DBClientID, LocalScheduler, UniqueIDHasher>
      local_schedulers;
  /** The state managed by the scheduling policy. */
  GlobalSchedulerPolicyState *policy_state;
  /** The plasma_manager ip:port -> local_scheduler_db_client_id association. */
  std::unordered_map<std::string, DBClientID> plasma_local_scheduler_map;
  /** The local_scheduler_db_client_id -> plasma_manager ip:port association. */
  std::unordered_map<DBClientID, std::string, UniqueIDHasher>
      local_scheduler_plasma_map;
  /** Objects cached by this global scheduler instance. */
  std::unordered_map<ObjectID, SchedulerObjectInfo, UniqueIDHasher>
      scheduler_object_info_table;
  /** An array of tasks that haven't been scheduled yet. */
  std::vector<Task *> pending_tasks;
} GlobalSchedulerState;

/**
 * This is a helper method to look up the local scheduler struct that
 * corresponds to a particular local_scheduler_id.
 *
 * @param state The state of the global scheduler.
 * @param The local_scheduler_id of the local scheduler.
 * @return The corresponding local scheduler struct. If the global scheduler is
 *         not aware of the local scheduler, then this will be NULL.
 */
LocalScheduler *get_local_scheduler(GlobalSchedulerState *state,
                                    DBClientID local_scheduler_id);

/**
 * Assign the given task to the local scheduler, update Redis and scheduler data
 * structures.
 *
 * @param state Global scheduler state.
 * @param task Task to be assigned to the local scheduler.
 * @param local_scheduler_id DB client ID for the local scheduler.
 * @return Void.
 */
void assign_task_to_local_scheduler(GlobalSchedulerState *state,
                                    Task *task,
                                    DBClientID local_scheduler_id);

#endif /* GLOBAL_SCHEDULER_H */


text:
package com.google.jplurk.validator;

import junit.framework.TestCase;

import com.google.jplurk.exception.PlurkException;

public class QualifierValidatorTest extends TestCase {

	private boolean validate(String json) throws PlurkException {
		return IValidator.ValidatorUtils.validate(QualifierValidator.class, json);
	}

	public void testValidate() throws Exception, PlurkException {
		assertTrue(validate(":"));
		assertFalse(validate("___"));
		assertTrue(validate("has"));
		assertTrue(validate("says"));
	}

}


text:
"""Fix missing nested domain DB migration

Revision ID: 27583c259fa7
Revises: 799f0516bc08
Create Date: 2020-05-27 14:18:11.909757

"""

# revision identifiers, used by Alembic.
revision = '27583c259fa7'
down_revision = '799f0516bc08'

import os
import sys

from neutron.db import migration

from oslo_utils import importutils

from gbpservice.neutron.db.migration import alembic_migrations as am

# This is a hack to get around the fact that the versions
# directory has no __init__.py
filepath = os.path.abspath(am.__file__)
basepath = filepath[:filepath.rfind("/")] + "/versions"
sys.path.append(basepath)

DB_4967af35820f = '4967af35820f_cisco_apic_nested_domain'

def ensure_4967af35820f_migration():
    if not migration.schema_has_table(
            'apic_aim_network_nested_domain_allowed_vlans'):
        db_4967af35820f = importutils.import_module(DB_4967af35820f)
        db_4967af35820f.upgrade()

def upgrade():
    ensure_4967af35820f_migration()
    # remove the appended path
    del sys.path[sys.path.index(basepath)]

def downgrade():
    pass


text:
package com.hazelcast.internal.crdt.pncounter;

import com.hazelcast.config.Config;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.crdt.pncounter.PNCounter;
import com.hazelcast.test.AssertTask;
import com.hazelcast.test.HazelcastParallelParametersRunnerFactory;
import com.hazelcast.test.SplitBrainTestSupport;
import com.hazelcast.test.annotation.ParallelJVMTest;
import com.hazelcast.test.annotation.QuickTest;
import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
import org.junit.runners.Parameterized.UseParametersRunnerFactory;

import java.util.Collection;
import java.util.concurrent.atomic.AtomicLong;

import static java.util.Arrays.asList;
import static org.junit.Assert.assertEquals;

/**
 * Tests different split-brain scenarios for {@link PNCounter}.
 */
@RunWith(Parameterized.class)
@UseParametersRunnerFactory(HazelcastParallelParametersRunnerFactory.class)
@Category({QuickTest.class, ParallelJVMTest.class})
public class PNCounterSplitBrainTest extends SplitBrainTestSupport {

    @Parameters(name = "replicaCount:{0}")
    public static Collection<Object[]> parameters() {
        return asList(new Object[][]{
                {1},
                {2},
                {Integer.MAX_VALUE},
        });
    }

    @Parameter
    public int replicaCount;

    private String counterName = randomMapName("counter-");
    private PNCounter counter1;
    private PNCounter counter2;
    private MergeLifecycleListener mergeLifecycleListener;
    private AtomicLong assertCounter = new AtomicLong();

    @Override
    protected Config config() {
        Config config = super.config();
        config.getPNCounterConfig(counterName)
                .setReplicaCount(replicaCount);
        return config;
    }

    @Override
    protected void onBeforeSplitBrainCreated(HazelcastInstance[] instances) {
        waitAllForSafeState(instances);

        for (HazelcastInstance instance : instances) {
            final int delta = 100;
            getCounter(instance).addAndGet(delta);
            assertCounter.addAndGet(delta);
        }
    }

    @Override
    protected void onAfterSplitBrainCreated(HazelcastInstance[] firstBrain, HazelcastInstance[] secondBrain) {
        mergeLifecycleListener = new MergeLifecycleListener(secondBrain.length);
        for (HazelcastInstance instance : secondBrain) {
            instance.getLifecycleService().addLifecycleListener(mergeLifecycleListener);
        }

        counter1 = getCounter(firstBrain[0]);
        counter2 = getCounter(secondBrain[0]);

        counter1.addAndGet(100);
        assertCounter.addAndGet(100);
        counter2.addAndGet(100);
        assertCounter.addAndGet(100);
    }

    @Override
    protected void onAfterSplitBrainHealed(HazelcastInstance[] instances) {
        // wait until merge completes
        mergeLifecycleListener.await();

        assertCounterValueEventually(assertCounter.get(), counter1);
        assertCounterValueEventually(assertCounter.get(), counter2);
    }

    private PNCounter getCounter(HazelcastInstance instance) {
        final PNCounter pnCounter = instance.getPNCounter(counterName);
        ((PNCounterProxy) pnCounter).setOperationTryCount(1);
        pnCounter.reset();
        return pnCounter;
    }

    private void assertCounterValueEventually(final long expectedValue, final PNCounter counter) {
        assertTrueEventually(new AssertTask() {
            @Override
            public void run() throws Exception {
                assertEquals(expectedValue, counter.get());
            }
        });
    }
}


text:
package com.gooddata.sdk.model.gdc;

import org.testng.annotations.Test;

import java.util.Collection;

import static com.gooddata.sdk.common.util.ResourceUtils.readObjectFromResource;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasSize;

public class AboutLinksTest {

    @Test
    public void deserialize() throws Exception {
        final AboutLinks aboutLinks = readObjectFromResource("/dataset/datasetLinks.json", AboutLinks.class);
        assertThat(aboutLinks, is(notNullValue()));
        assertThat(aboutLinks.getCategory(), is("singleloadinterface"));
        assertThat(aboutLinks.getInstance(), is("MD::LDM::SingleLoadInterface"));
        assertThat(aboutLinks.getSummary(), is("single loading interfaces"));

        final Collection<AboutLinks.Link> links = aboutLinks.getLinks();
        assertThat(links, is(notNullValue()));
        assertThat(links, hasSize(1));

        final AboutLinks.Link link = links.iterator().next();
        assertThat(link, is(notNullValue()));
        assertThat(link.getIdentifier(), is("dataset.person"));
        assertThat(link.getUri(), is("/gdc/md/PROJECT_ID/ldm/singleloadinterface/dataset.person"));
        assertThat(link.getCategory(), is("dataset-singleloadinterface"));
        assertThat(link.getTitle(), is("Person"));
        assertThat(link.getSummary(), is("dataset single data loading interface specifications"));
    }

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CaveStory
{
    /// <summary>
    /// Degrees / MS
    /// </summary>
    public struct AngularVelocityUnit
    {
        public float Value { get; set; }

        public AngularVelocityUnit(float value)
        {
            Value = value;
        }

        public static implicit operator float (AngularVelocityUnit angularVelocityUnit)
        {
            return angularVelocityUnit.Value;
        }

        public static implicit operator AngularVelocityUnit(float f)
        {
            return new AngularVelocityUnit(f);
        }
    }
}


text:
FROM centos/nodejs-6-centos7:latest

EXPOSE 8822

USER root

RUN ln -sf /usr/share/zoneinfo/UTC /etc/localtime && \
    mkdir -p config && \
    chown -R default:root ./

USER default

# Extract app to work dir and copy conf
COPY fh-*.tar.gz ./
RUN tar -xf fh-*.tar.gz --strip 1 && \
            rm fh-*.tar.gz && \
            mv conf-docker.json config/conf.json && \
            chmod -R ug+rw ./

CMD ["bash", "-c", "node ./lib/app.js ./config/conf.json --master-only"]


text:
package consulo.javaee.jsp.highlight;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import com.intellij.lang.BracePair;
import com.intellij.lang.PairedBraceMatcher;
import com.intellij.psi.PsiFile;
import com.intellij.psi.jsp.JspTokenType;
import com.intellij.psi.tree.IElementType;

/**
 * @author VISTALL
 * @since 24-May-17
 */
public class JspPairBraceMatcher implements PairedBraceMatcher
{
	private static final BracePair[] ourBraces = new BracePair[]{
			new BracePair(JspTokenType.JSP_DIRECTIVE_START, JspTokenType.JSP_DIRECTIVE_END, true),
			new BracePair(JspTokenType.JSP_SCRIPTLET_START, JspTokenType.JSP_SCRIPTLET_END, true),
			new BracePair(JspTokenType.JSP_EXPRESSION_START, JspTokenType.JSP_EXPRESSION_END, true),
			new BracePair(JspTokenType.JSP_DECLARATION_START, JspTokenType.JSP_DECLARATION_END, true),
	};

	@Override
	public BracePair[] getPairs()
	{
		return ourBraces;
	}

	@Override
	public boolean isPairedBracesAllowedBeforeType(@Nonnull IElementType iElementType, @Nullable IElementType iElementType1)
	{
		return false;
	}

	@Override
	public int getCodeConstructStart(PsiFile psiFile, int i)
	{
		return i;
	}
}


text:
require 'test_helper'

class MacrosControllerTest < ActionController::TestCase
  test "should get index" do
    get :index
    assert_response :success
    assert_not_nil assigns(:macros)
  end

  test "should get new" do
    get :new
    assert_response :success
  end

  test "should create macro" do
    assert_difference('Macro.count') do
      post :create, :macro => { }
    end

    assert_redirected_to macro_path(assigns(:macro))
  end

  test "should show macro" do
    get :show, :id => macros(:one).to_param
    assert_response :success
  end

  test "should get edit" do
    get :edit, :id => macros(:one).to_param
    assert_response :success
  end

  test "should update macro" do
    put :update, :id => macros(:one).to_param, :macro => { }
    assert_redirected_to macro_path(assigns(:macro))
  end

  test "should destroy macro" do
    assert_difference('Macro.count', -1) do
      delete :destroy, :id => macros(:one).to_param
    end

    assert_redirected_to macros_path
  end
end


text:
package project.rayedchan.exception;

/**
 *
 * @author rayedchan
 */
public class AdapterNameNotFoundException extends Exception
{
    public AdapterNameNotFoundException(String message)
    {
        super(message);
    }
}


text:
using System;
using System.Collections;
using C5;

namespace AutonomousCar.PathFinding.ReedsShepp
{
    /// <summary>
    /// The PathWords enum lists every possible Reeds-Shepp pattern. L, S, or R described the steering direction (left, straight, or right),
    /// and f or b describe the gear (forward or backward).
    /// </summary>
    public enum PathWords
    {
        LfSfLf, // Reeds-Shepp 8.1: CSC, same turn
        LbSbLb,
        RfSfRf,
        RbSbRb,

        LfSfRf, // Reeds-Shepp 8.2: CSC, different turn
        LbSbRb,
        RfSfLf,
        RbSbLb,

        LfRbLf, // Reeds-Shepp 8.3: C|C|C
        LbRfLb,
        RfLbRf,
        RbLfRb,

        LfRbLb, // Reeds-Shepp 8.4: C|CC
        LbRfLf,
        RfLbRb,
        RbLfRf,

        LfRfLb, // Reeds-Shepp 8.4: CC|C
        LbRbLf,
        RfLfRb,
        RbLbRf,

        LfRufLubRb, // Reeds-Shepp 8.7: CCu|CuC
        LbRubLufRf,
        RfLufRubLb,
        RbLubRufLf,

        LfRubLubRf, // Reeds-Shepp 8.8: C|CuCu|C
        LbRufLufRb,
        RfLubRubLf,
        RbLufRufLb,

        LfRbpi2SbLb, // Reeds-Shepp 8.9: C|C(pi/2)SC, same turn
        LbRfpi2SfLf,
        RfLbpi2SbRb,
        RbLfpi2SfRf,

        LfRbpi2SbRb, // Reeds-Shepp 8.10: C|C(pi/2)SC, different turn
        LbRfpi2SfRf,
        RfLbpi2SbLb,
        RbLfpi2SfLf,

        LfSfRfpi2Lb, // Reeds-Shepp 8.9 (reversed): CSC(pi/2)|C, same turn
        LbSbRbpi2Lf,
        RfSfLfpi2Rb,
        RbSbLbpi2Rf,

        LfSfLfpi2Rb, // Reeds-Shepp 8.10 (reversed): CSC(pi/2)|C, different turn
        LbSbLbpi2Rf,
        RfSfRfpi2Lb,
        RbSbRbpi2Lf,

        LfRbpi2SbLbpi2Rf, // Reeds-Shepp 8.11: C|C(pi/2)SC(pi/2)|C
        LbRfpi2SfLfpi2Rb,
        RfLbpi2SbRbpi2Lf,
        RbLfpi2SfRfpi2Lb
    }

    /// <summary>
    /// The ReedsSheppAction class represents a single steering and motion action over some length.
    /// </summary>
    public class ReedsSheppAction
    {
        public Steer Steer;
        public Gear Gear;
        public float Length;

        public ReedsSheppAction(Steer steer, Gear gear, float length)
        {
            Steer = steer;
            Gear = gear;
            Length = length;
        }
    }

    /// <summary>
    /// The ReedsSheppActionSet class is a set of ReedsSheppActions. As actions are added, their lengths are summed together.
    /// The total cost of the set can be calculated using a reverse gear cost and a gear switch cost.
    /// </summary>
    public class ReedsSheppActionSet
    {
        public ArrayList<ReedsSheppAction> Actions { get; set; }
        public float Length { get; set; }

        public ReedsSheppActionSet() : this(0f) { }
        public ReedsSheppActionSet(float length)
        {
            Actions = new ArrayList<ReedsSheppAction>();
            Length = length;
        }

        public void AddAction(Steer steer, Gear gear, float length)
        {
            Actions.Add(new ReedsSheppAction(steer, gear, length));
            Length += Math.Abs(length);
        }

        public float CalculateCost(float unit, float reverseCostMultiplier, float gearSwitchCost)
        {
            if (reverseCostMultiplier == 1f && gearSwitchCost == 0f)
                return Length * unit;

            if (Length == float.PositiveInfinity || Actions.IsEmpty)
                return float.PositiveInfinity;

            float cost = 0;

            Gear prevGear = Actions[0].Gear;
            foreach (ReedsSheppAction a in Actions)
            {
                float actionCost = a.Length * unit;
                if (a.Gear == Gear.Backward)
                    actionCost *= reverseCostMultiplier;
                if (a.Gear != prevGear)
                    actionCost += gearSwitchCost;

                prevGear = a.Gear;
                cost += actionCost;
            }

            return cost;
        }
    }
}


text:
@implementation ZNBTimeLineBGModel
+(NSString *)primaryKey {

    return @"uid";
}
// Specify default values for properties

//+ (NSDictionary *)defaultPropertyValues
//{
//    return @{};
//}

// Specify properties to ignore (Realm won't persist these)

//+ (NSArray *)ignoredProperties
//{
//    return @[];
//}

@end


text:
describe("<no-unused-variable>", () => {
    const Rule = Lint.Test.getRule("no-unused-variable");

    it("restricts unused imports", () => {
        const fileName = "rules/nounusedvariable-imports.test.ts";
        const failure1 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'xyz'")([3, 9], [3, 12]);
        const failure2 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'createReadStream'")([4, 9], [4, 25]);
        const failure3 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'template'")([14, 7], [14, 15]);
        const failure4 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'foo'")([17, 13], [17, 16]);
        const failure5 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'defaultExport'")([20, 8], [20, 21]);
        const actualFailures = Lint.Test.applyRuleOnFile(fileName, Rule);

        assert.lengthOf(actualFailures, 5);
        Lint.Test.assertContainsFailure(actualFailures, failure1);
        Lint.Test.assertContainsFailure(actualFailures, failure2);
        Lint.Test.assertContainsFailure(actualFailures, failure3);
        Lint.Test.assertContainsFailure(actualFailures, failure4);
        Lint.Test.assertContainsFailure(actualFailures, failure5);
    });

    it("restricts unused variables", () => {
        const fileName = "rules/nounusedvariable-var.test.ts";
        const failure1 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'y'")([3, 5], [3, 6]);
        const failure2 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'a'")([23, 10], [23, 11]);
        const failure3 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'b'")([23, 13], [23, 14]);
        const failure4 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'d'")([26, 10], [26, 11]);
        const failure5 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'e'")([26, 13], [26, 14]);
        const failure6 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'a'")([35, 7] , [35, 8 ]);
        const failure7 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'e'")([43, 9], [43, 10]);
        const failure8 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'b'")([49, 11] , [49, 12]);

        const actualFailures = Lint.Test.applyRuleOnFile(fileName, Rule);

        assert.lengthOf(actualFailures, 8);
        Lint.Test.assertContainsFailure(actualFailures, failure1);
        Lint.Test.assertContainsFailure(actualFailures, failure2);
        Lint.Test.assertContainsFailure(actualFailures, failure3);
        Lint.Test.assertContainsFailure(actualFailures, failure4);
        Lint.Test.assertContainsFailure(actualFailures, failure5);
        Lint.Test.assertContainsFailure(actualFailures, failure6);
        Lint.Test.assertContainsFailure(actualFailures, failure7);
        Lint.Test.assertContainsFailure(actualFailures, failure8);
    });

    it("restricts unused functions", () => {
        const fileName = "rules/nounusedvariable-function.test.ts";
        const failure1 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'func2'")([5, 5], [5, 10]);
        const failure2 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'func3'")([9, 10], [9, 15]);

        const actualFailures = Lint.Test.applyRuleOnFile(fileName, Rule);

        assert.lengthOf(actualFailures, 2);
        Lint.Test.assertContainsFailure(actualFailures, failure1);
        Lint.Test.assertContainsFailure(actualFailures, failure2);
    });

    it("restricts unused class members", () => {
        const fileName = "rules/nounusedvariable-class.test.ts";
        const failure1 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'z2'")([2, 13], [2, 15]);
        const failure2 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'mfunc4'")([18, 13], [18, 19]);

        const actualFailures = Lint.Test.applyRuleOnFile(fileName, Rule);

        assert.lengthOf(actualFailures, 2);
        Lint.Test.assertContainsFailure(actualFailures, failure1);
        Lint.Test.assertContainsFailure(actualFailures, failure2);
    });

    it("restricts unused parameters", () => {
        const fileName = "rules/nounusedvariable-parameter.test.ts";
        const failure1 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'args'")([1, 48], [1, 52]);
        const failure2 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'y'")([5, 34], [5, 35]);
        const failure3 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'y'")([9, 35], [9, 36]);
        const failure4 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'x'")([18, 25], [18, 26]);
        const failure5 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'y'")([38, 27], [38, 28]);
        const failure6 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'b'")([46, 22], [46, 23]);
        const failure7 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'b'")([50, 23], [50, 24]);
        const failure8 = Lint.Test.createFailuresOnFile(fileName, Rule.FAILURE_STRING + "'x'")([55, 20], [55, 21]);

        const actualFailures = Lint.Test.applyRuleOnFile(fileName, Rule, [true, "check-parameters"]);

        assert.lengthOf(actualFailures, 8);
        Lint.Test.assertContainsFailure(actualFailures, failure1);
        Lint.Test.assertContainsFailure(actualFailures, failure2);
        Lint.Test.assertContainsFailure(actualFailures, failure3);
        Lint.Test.assertContainsFailure(actualFailures, failure4);
        Lint.Test.assertContainsFailure(actualFailures, failure5);
        Lint.Test.assertContainsFailure(actualFailures, failure6);
        Lint.Test.assertContainsFailure(actualFailures, failure7);
        Lint.Test.assertContainsFailure(actualFailures, failure8);
    });
});


text:
package ru.mipt.acsl.geotarget;

import ru.mipt.acsl.geotarget.ui.controls.WorldWindNode;

/**
 * @author Artem Shein
 */
public interface DeviceController {

    DeviceRegistry getDeviceRegistry();

    WorldWindNode getWorldWind();

    void navigateToActiveDevice();

    void requestRepaint();

    static DeviceController newInstance(DeviceRegistry deviceRegistry, WorldWindNode worldWind)
    {
        return new DeviceControllerImpl(deviceRegistry, worldWind);
    }

}


text:
/***************************************************************************//**
 * @file
 * @brief EFM32GG_USB_DOEP register and bit field definitions
 *******************************************************************************
 * # License
 * <b>Copyright 2019 Silicon Laboratories Inc. www.silabs.com</b>
 *******************************************************************************
 *
 * SPDX-License-Identifier: Zlib
 *
 * The licensor of this software is Silicon Laboratories Inc.
 *
 * This software is provided 'as-is', without any express or implied
 * warranty. In no event will the authors be held liable for any damages
 * arising from the use of this software.
 *
 * Permission is granted to anyone to use this software for any purpose,
 * including commercial applications, and to alter it and redistribute it
 * freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you must not
 *    claim that you wrote the original software. If you use this software
 *    in a product, an acknowledgment in the product documentation would be
 *    appreciated but is not required.
 * 2. Altered source versions must be plainly marked as such, and must not be
 *    misrepresented as being the original software.
 * 3. This notice may not be removed or altered from any source distribution.
 *
 ******************************************************************************/

#if defined(__ICCARM__)
#pragma system_include       /* Treat file as system include file. */
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
#pragma clang system_header  /* Treat file as system include file. */
#endif

/***************************************************************************//**
 * @addtogroup Parts
 * @{
 ******************************************************************************/
/***************************************************************************//**
 * @brief USB_DOEP EFM32GG USB DOEP
 ******************************************************************************/
typedef struct {
  __IOM uint32_t CTL;           /**< Device OUT Endpoint x+1 Control Register  */
  uint32_t       RESERVED0[1U]; /**< Reserved for future use **/
  __IOM uint32_t INT;           /**< Device OUT Endpoint x+1 Interrupt Register  */
  uint32_t       RESERVED1[1U]; /**< Reserved for future use **/
  __IOM uint32_t TSIZ;          /**< Device OUT Endpoint x+1 Transfer Size Register  */
  __IOM uint32_t DMAADDR;       /**< Device OUT Endpoint x+1 DMA Address Register  */
  uint32_t       RESERVED2[2U]; /**< Reserved future */
} USB_DOEP_TypeDef;

/** @} End of group Parts */


text:
package com.dubture.ide.listener;

/**
 *
 * @author Robert Gruendler <r.gruendler@gmail.com>
 *
 */
public interface OpenDocumentListener {

	/**
	 * @param path  The absolute on the file path the user requests to open with eclipse
	 * @return true if the extension handled the open operation, falsea otherwise
	 */
	public boolean onDocumentOpen(String path);
}


text:
cls
ECHO please be aware of absolute path here %cd%
docker build --no-cache -t stankins_test_image -f DeveloperTestStankins.txt .
docker-compose -f solution/StankinsV2/StankinsTestXUnit/Docker/docker-sqlserver-instance-linux.yaml up -d
echo start powershell
Start powershell ./all.ps1
timeout 30 /NOBREAK
docker  exec  docker_jenkins_1 bash -c "cat /var/jenkins_home/jenkinsjob.xml | java -jar /var/jenkins_home/war/WEB-INF/jenkins-cli.jar -s http://localhost:8080 create-job newmyjob"
timeout 60 /NOBREAK
REM -v n
REM docker run --network docker_default -m 3G --memory-reservation 2G -it --name stankins_test_container --rm stankins_test_image  dotnet watch   -p StankinsTestXUnit/StankinsTestXUnit.csproj test -c release
docker run --network docker_default -it --name stankins_test_container --rm stankins_test_image
docker-compose -f solution/StankinsV2/StankinsTestXUnit/Docker/docker-sqlserver-instance-linux.yaml down


text:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package bt.storage.joystick;

import bt.storage.joystick.modules.BTConAxis;
import bt.storage.joystick.modules.BTConButton;
import bt.storage.joystick.modules.BTJoystickButton;
import bt.storage.joystick.modules.BTJoystickAxis;
import edu.wpi.first.wpilibj.Joystick;

/**
 *
 * @author Dlock
 */
public class BTXboxController implements BTController {

    private final Joystick joy;
    public final BTJoystickButton A_BUTTON;
    public final BTJoystickButton B_BUTTON;
    public final BTJoystickButton X_BUTTON;
    public final BTJoystickButton Y_BUTTON;
    public final BTJoystickButton LEFT_BUMPER_BUTTON;
    public final BTJoystickButton RIGHT_BUMPER_BUTTON;
    public final BTJoystickButton BACK_BUTTON;
    public final BTJoystickButton START_BUTTON;
    public final BTJoystickButton LEFT_STICK_BUTTON;
    public final BTJoystickButton RIGHT_STICK_BUTTON;

    public final BTJoystickAxis LEFT_STICK_LEFT_RIGHT;
    public final BTJoystickAxis LEFT_STICK_UP_DOWN;
    public final BTJoystickAxis TRIGGER;
    public final BTJoystickAxis RIGHT_STICK_LEFT_RIGHT;
    public final BTJoystickAxis RIGHT_STICK_UP_DOWN;
    public final BTJoystickAxis DPAD_LEFT_RIGHT;
    public static final double XBOX_LEFT_TRIGGER = 1.0;
    public static final double XBOX_RIGHT_TRIGGER = -1.0;
    public static final double XBOX_LEFT_DPAD = -1.0;
    public static final double XBOX_RIGHT_DPAD = 1.0;
    private BTJoystickButton[] buttons;
    private BTJoystickAxis[] axes;

    /**
     *
     * @param joyport
     */
    public BTXboxController(int joyport) {
        joy = new Joystick(joyport);
        A_BUTTON = new BTJoystickButton(joy, 1);
        B_BUTTON = new BTJoystickButton(joy, 2);
        X_BUTTON = new BTJoystickButton(joy, 3);
        Y_BUTTON = new BTJoystickButton(joy, 4);
        LEFT_BUMPER_BUTTON = new BTJoystickButton(joy, 5);
        RIGHT_BUMPER_BUTTON = new BTJoystickButton(joy, 6);
        BACK_BUTTON = new BTJoystickButton(joy, 7);
        START_BUTTON = new BTJoystickButton(joy, 8);
        LEFT_STICK_BUTTON = new BTJoystickButton(joy, 9);
        RIGHT_STICK_BUTTON = new BTJoystickButton(joy, 10);

        LEFT_STICK_LEFT_RIGHT = new BTJoystickAxis(joy, 1);
        LEFT_STICK_UP_DOWN = new BTJoystickAxis(joy, 2);
        TRIGGER = new BTJoystickAxis(joy, 3);
        RIGHT_STICK_LEFT_RIGHT = new BTJoystickAxis(joy, 4);
        RIGHT_STICK_UP_DOWN = new BTJoystickAxis(joy, 5);
        DPAD_LEFT_RIGHT = new BTJoystickAxis(joy, 6);

        buttons = new BTJoystickButton[BTJoystickButton.BUTTON_AMOUNT_MAX];
        for (int i = 0; i < buttons.length; i++) {
            buttons[i] = new BTJoystickButton(joy, i);
        }
        axes = new BTJoystickAxis[BTJoystickAxis.AXIS_AMOUNT_MAX];
        for (int i = 0; i < axes.length; i++) {
            axes[i] = new BTJoystickAxis(joy, i);
        }
    }

    public BTConAxis getAxis(int port) {
        if (port > BTJoystickAxis.AXIS_AMOUNT_MAX || port < 1)
            return null;
        return new BTJoystickAxis(joy, port);
    }

    public BTConButton getButton(int port) {
        if (port > BTJoystickButton.BUTTON_AMOUNT_MAX || port < 1)
            return null;
        return new BTJoystickButton(joy, port);
    }

    public Joystick getJoystick() {
        return joy;
    }

    public BTConButton[] getAllButtons() {
        return buttons;
    }

    public BTConAxis[] getAllAxes() {
        return axes;
    }
}


text:
var expect = require('chai').expect;
var fs = require('fs');
var mockDataCitilink = fs.readFileSync('./ct.html', 'utf8');
describe('Price Generator for Citilink', function () {
	this.timeout(30000)
	it('should get cache from db and merge with html flight', function (next) {
		var priceGenerator = require('../index')('citilink');
		// console.log(mockDataCitilink);
		priceGenerator({ori:'SUB', dst:'CGK'}, mockDataCitilink, function (res) {
			// console.log(JSON.stringify(res, null, 2));
			fs.writeFileSync('./ct2.html', res);
			next();
		});
	});
});


text:
<?php

return array(

    /*
    |--------------------------------------------------------------------------
    | Validation Language Lines
    |--------------------------------------------------------------------------
    |
    | The following language lines contain the default error messages used by
    | the validator class. Some of these rules have multiple versions such
    | such as the size rules. Feel free to tweak each of these messages.
    |
    */

    "accepted"         => "Το πεδίο :attribute πρέπει να γίνει αποδεκτό.",
    "active_url"       => "Το πεδίο :attribute δεν είναι αποδεκτή δ/νση URL.",
    "after"            => "Το πεδίο :attribute μπορεί να είναι μία ημ/νία μετά από :date.",
    "alpha"            => "Το πεδίο :attribute μπορεί να περιέχει μόνο γράμματα.",
    "alpha_dash"       => "Το πεδίο :attribute μπορεί να περιέχει μόνο γράμματα, αριθμούς, και παύλες.",
    "alpha_num"        => "Το πεδίο :attribute μπορεί να περιέχει μόνο γράμματα και αριθμούς.",
    "array"            => "Το πεδίο :attribute πρέπει να είναι ένας πίνακας.",
    "before"           => "Το πεδίο :attribute πρέπει να είναι μία ημ/νία πριν από :date.",
    "between"          => array(
        "numeric" => "Το πεδίο :attribute πρέπει να είναι μεταξύ :min - :max.",
        "file"    => "Το πεδίο :attribute πρέπει να είναι μεταξύ :min - :max kilobytes.",
        "string"  => "Το πεδίο :attribute πρέπει να είναι μεταξύ :min - :max χαρακτήρες.",
        "array"   => "Το πεδίο :attribute πρέπει να έχει μεταξύ :min - :max αντικείμενα."
    ),
    "boolean"          => "The :attribute field must be true or false",
    "confirmed"        => "Η επιβεβαίωση του :attribute δεν ταιριάζει.",
    "date"             => "Το πεδίο :attribute δεν αποτελεί αποδεκτή ημερομηνία.",
    "date_format"      => "Το πεδίο :attribute δεν είναι της μορφής :format.",
    "different"        => "Το πεδίο :attribute και :other πρέπει να είναι διαφορετικά.",
    "digits"           => "Το πεδίο :attribute πρέπει να είναι :digits ψηφία.",
    "digits_between"   => "Το πεδίο :attribute πρέπει να είναι between :min and :max ψηφία.",
    "email"            => "Το πεδίο :attribute δεν είναι αποδεκτή δ/νση email.",
    "exists"           => "Το επιλεγμένο :attribute δεν είναι έγκυρο.",
    "image"            => "Το πεδίο :attribute πρέπει να είναι εικόνα.",
    "in"               => "Το επιλεγμένο :attribute δεν είναι έγκυρο.",
    "integer"          => "Το πεδίο :attribute πρέπει να είναι ακέραιος.",
    "ip"               => "Το πεδίο :attribute πρέπει να είναι αποδεκτή δ/νση IP.",
    "max"              => array(
        "numeric" => "Το πεδίο :attribute δεν μπορεί να είναι μεγαλύτερο από :max.",
        "file"    => "Το πεδίο :attribute δεν μπορεί να είναι μεγαλύτερό :max kilobytes.",
        "string"  => "Το πεδίο :attribute δεν μπορεί να είναι μεγαλύτερό :max χαρακτήρες.",
        "array"   => "Το πεδίο :attribute δεν μπορεί να έχει περισσότερα από :max αντικείμενα."
    ),
    "mimes"            => "Το πεδίο :attribute πρέπει να είναι αρχείο με τύπο: :values.",
    "min"              => array(
        "numeric" => "Το πεδίο :attribute πρέπει να είναι τουλάχιστον :min.",
        "file"    => "Το πεδίο :attribute πρέπει να είναι τουλάχιστον :min kilobytes.",
        "string"  => "Το πεδίο :attribute πρέπει να έχει τουλάχιστον :min χαρακτήρες.",
        "array"   => "Το πεδίο :attribute πρέπει να έχει τουλάχιστον :min αντικείμενα."
    ),
    "not_in"           => "Το επιλεγμένο :attribute δεν είναι αποδεκτό.",
    "numeric"          => "Το πεδίο :attribute πρέπει να είναι αριθμός.",
    "regex"            => "Η μορφή του :attribute δεν είναι αποδεκτή.",
    "required"         => "Το πεδίο :attribute είναι απαραίτητο.",
    "required_if"      => "Το πεδίο :attribute είναι απαραίτητο όταν το πεδίο :other είναι :value.",
    "required_with"    => "Το πεδίο :attribute είναι απαραίτητο όταν υπάρχει :values.",
    "required_with_all" => "The :attribute field is required when :values is present.",
    "required_without" => "Το πεδίο :attribute είναι απαραίτητο όταν δεν υπάρχει :values.",
    "required_without_all" => "The :attribute field is required when none of :values are present.",
    "same"             => "Τα πεδία :attribute και :other πρέπει να είναι ίδια.",
    "size"             => array(
        "numeric" => "Το πεδίο :attribute πρέπει να είναι :size.",
        "file"    => "Το πεδίο :attribute πρέπει να είναι :size kilobytes.",
        "string"  => "Το πεδίο :attribute πρέπει να είναι :size χαρακτήρες.",
        "array"   => "Το πεδίο :attribute πρέπει να περιέχει :size αντικείμενα."
    ),
    "timezone"         => "The :attribute must be a valid zone.",
    "unique"           => "Το πεδίο :attribute έχει ήδη εκχωρηθεί.",
    "url"              => "Το πεδίο :attribute δεν είναι μία αποδεκτή δ/νση URL.",

    /*
    |--------------------------------------------------------------------------
    | Custom Validation Language Lines
    |--------------------------------------------------------------------------
    |
    | Here you may specify custom validation messages for attributes using the
    | convention "attribute.rule" to name the lines. This makes it quick to
    | specify a specific custom language line for a given attribute rule.
    |
    */

    'custom' => array(
        'attribute-name' => array(
            'rule-name' => 'custom-message',
        ),
    ),

    /*
    |--------------------------------------------------------------------------
    | Custom Validation Attributes
    |--------------------------------------------------------------------------
    |
    | The following language lines are used to swap attribute place-holders
    | with something more reader friendly such as E-Mail Address instead
    | of "email". This simply helps us make messages a little cleaner.
    |
    */

    'attributes' => array(),

);


text:
..  Copyright (C)  Brad Miller, David Ranum, Jeffrey Elkner, Peter Wentworth, Allen B. Downey, Chris
    Meyers, and Dario Mitchell.  Permission is granted to copy, distribute
    and/or modify this document under the terms of the GNU Free Documentation
    License, Version 1.3 or any later version published by the Free Software
    Foundation; with Invariant Sections being Forward, Prefaces, and
    Contributor List, no Front-Cover Texts, and no Back-Cover Texts.  A copy of
    the license is included in the section entitled "GNU Free Documentation
    License".

Operations on Strings
---------------------

In general, you cannot perform mathematical operations on strings, even if the
strings look like numbers. The following are illegal (assuming that ``message``
has type string):

.. sourcecode:: python

    message - 1
    "Hello" / 123
    message * "Hello"
    "15" + 2

Interestingly, the ``+`` operator does work with strings, but for strings, the
``+`` operator represents **concatenation**, not addition.  Concatenation means
joining the two operands by linking them end-to-end. For example:

.. activecode:: ch08_add
    :nocanvas:

    fruit = "banana"
    bakedGood = " nut bread"
    print(fruit + bakedGood)

The output of this program is ``banana nut bread``. The space before the word
``nut`` is part of the string and is necessary to produce the space between
the concatenated strings.  Take out the space and run it again.

The ``*`` operator also works on strings.  It performs repetition. For example,
``'Fun'*3`` is ``'FunFunFun'``. One of the operands has to be a string and the
other has to be an integer.

.. activecode:: ch08_mult
    :nocanvas:

    print("Go" * 6)

    name = "Packers"
    print(name * 3)

    print(name + "Go" * 3)

    print((name + "Go") * 3)

This interpretation of ``+`` and ``*`` makes sense by analogy with
addition and multiplication. Just as ``4*3`` is equivalent to ``4+4+4``, we
expect ``"Go"*3`` to be the same as ``"Go"+"Go"+"Go"``, and it is.  Note also in the last
example that the order of operations for ``*`` and ``+`` is the same as it was for arithmetic.
The repetition is done before the concatenation.  If you want to cause the concatenation to be
done first, you will need to use parenthesis.

**Check your understanding**

.. mchoicemf:: test_question8_1_1
   :answer_a: python rocks
   :answer_b: python
   :answer_c: pythonrocks
   :answer_d: Error, you cannot add two strings together.
   :correct: c
   :feedback_a: Concatenation does not automatically add a space.
   :feedback_b: The expression s+t is evaluated first, then the resulting string is printed.
   :feedback_c: Yes, the two strings are glued end to end.
   :feedback_d: The + operator has different meanings depending on the operands, in this case, two strings.

   What is printed by the following statements?

   .. code-block:: python

      s = "python"
      t = "rocks"
      print(s + t)

.. mchoicemf:: test_question8_1_2
   :answer_a: python!!!
   :answer_b: python!python!python!
   :answer_c: pythonpythonpython!
   :answer_d: Error, you cannot perform concatenation and repetition at the same time.
   :correct: a
   :feedback_a: Yes, repetition has precedence over concatenation
   :feedback_b: Repetition is done first.
   :feedback_c: The repetition operator is working on the excl variable.
   :feedback_d: The + and * operator are defined for strings as well as numbers.

   What is printed by the following statements?

   .. code-block:: python

      s = "python"
      excl = "!"
      print(s+excl*3)


text:
from __future__ import unicode_literals

import django.utils.timezone
from django.db import migrations, models

class Migration(migrations.Migration):
    dependencies = [
        ('mainapp', '0004_auto_20180112_1159'),
    ]

    operations = [
        migrations.AddField(
            model_name='file',
            name='sort_date',
            field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
            preserve_default=False,
        ),
        migrations.AddField(
            model_name='paper',
            name='sort_date',
            field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
            preserve_default=False,
        ),
    ]


text:
angular.module( 'ccApp' ).controller( 'detailController',
	['$scope', 'ccData', '$q', '$route',
		function ($scope, ccData, $q, $route) {
			$route.current.params.city

			var detailCountry = $route.current.params.countryCode.toUpperCase();
			//Get the countries data if not already available:
			//This enables entering the app directly into a detail view.
			$q.when( ccData.countries ).then( function (result) {
				//If ccData.countries is still a promise...
				if (toString.call( ccData.countries ) == '[object Object]') {
					//...replace it with the returned array.
					ccData.countries = result.geonames;
					ccData.index = result.index;
				}
				$scope.country = ccData.countries[ccData.index[detailCountry]];
			} );
			$scope.flag = detailCountry.toLowerCase();
			$scope.map = detailCountry;
			ccData.getCapital( detailCountry ).then( function (result) {
				$scope.capital = result;
			} );
			ccData.getNeighbors( detailCountry ).then( function (result) {
				$scope.numNeighbors = result.totalResultsCount;
				$scope.neighborList = result.geonames;
			} );
		}] );


text:
SET(MODULE_TESTS
  mitkDescriptivePharmacokineticBrixModelTest.cpp
  mitkStandardToftsModelTest.cpp
  #ConvertToConcentrationTest.cpp
  mitkTwoCompartmentExchangeModelTest.cpp
  mitkExtendedToftsModelTest.cpp
)


text:
module SmartAnswer
  module Question
    class MultipleChoice < Base
      attr_reader :permitted_options

      def initialize(flow, name, &block)
        @permitted_options = []
        super
      end

      def option(option_key)
        @permitted_options << option_key.to_s
      end

      def options
        @permitted_options
      end

      def valid_option?(option)
        options.include?(option.to_s)
      end

      def remove_options
        @permitted_options.clear
      end

      def parse_input(raw_input)
        raise SmartAnswer::InvalidResponse, "Illegal option #{raw_input} for #{name}", caller unless valid_option?(raw_input)
        super
      end
    end
  end
end


text:
package nom.bdezonia.zorbage.algorithm;

import static org.junit.Assert.assertEquals;

import org.junit.Test; import nom.bdezonia.zorbage.algebra.G;

import nom.bdezonia.zorbage.datasource.IndexedDataSource;
import nom.bdezonia.zorbage.storage.Storage;
import nom.bdezonia.zorbage.type.integer.int32.SignedInt32Member;
import nom.bdezonia.zorbage.type.real.float64.Float64Member;

/**
 *
 * @author Barry DeZonia
 *
 */
public class TestMedian {

	@Test
	public void test1() {
		IndexedDataSource<Float64Member> storage =
				Storage.allocate(G.DBL.construct(), new double[]{0,1,2,3,4,5,6,7,8,9});
		Float64Member result = new Float64Member();
		Median.compute(G.DBL, storage, result);
		assertEquals(4.5, result.v(), 0);
	}

	@Test
	public void test2() {
		IndexedDataSource<SignedInt32Member> list1 =
				Storage.allocate(G.INT32.construct(), new int[]{4,2,1,3});

		IndexedDataSource<SignedInt32Member> list2 =
				Storage.allocate(G.INT32.construct(), new int[]{4,2,1,3,5});

		SignedInt32Member result = new SignedInt32Member();

		Median.compute(G.INT32, list1, result);
		assertEquals(2, result.v());

		Median.compute(G.INT32, list2, result);
		assertEquals(3, result.v());
	}
}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Sydowia 10(1-6): 49 (1957)

#### Original name
Meliola parathesiana Cif.

### Remarks
null


text:
Version 1.1.0 (2021-02-05)

- Add support for `ConnectionPool`

Version 1.0.0 (2013-10-17)

- Initial release using Redis

### History of ledermann-rails-settings

Version 1.1.0 (2012-06-01)

- Added caching (thanks to Matthew McEachen)

Version 1.0.1 (2011-11-05)

- Gemspec: Fixed missing dependency

Version 1.0.0 (2011-11-05)

- Conversion from Plugin to Gem
- Destroying false values (thanks to @Pavling)
- Testing with Travis


text:
import requests, json
import requests.packages.urllib3.contrib.pyopenssl
requests.packages.urllib3.contrib.pyopenssl.inject_into_urllib3()

headers = {'content-type': 'application/vnd.api+json', 'accept': 'application/*, text/*', 'x-api-key': 'feWf7yUc5vec3oD7A'}
r = requests.get('https://api.tnyu.org/v2-test/events', headers=headers)
data = json.loads(r.text)

# All events
# print data['data']

# Title of the first event that's returned from the API
# print data['data'][0]['title']

# Printing out all the titles
for i in data['data']:
	print i['title']


text:
require('url-search-params-polyfill');

const Fetch = require('isomorphic-fetch');

class User_ {
  constructor() {
    this.fetch = Fetch;
    this.searchParams = new URLSearchParams(window.location.search);
    this.userEmail = this.searchParams.get('email');
    this.changeEmail = this.searchParams.get('changeemail');
    this.formType = '';
    this.formType += this.searchParams.get('form');
    this.userToken = localStorage.getItem('aurelia_id_token');
    this.verifyEmail();
    // this.myForm = {};
  }

  createVerifyCodeForm() {
    let formTitle = '';
    const passInput = '
New Password
'
    + '
<input class="loginpass" pattern=".{8,}" title="8 characters minimum" type="password"'
      + ' name="password" style="width:250px;min-width:0" value="" required>
';
    const emailVarifyForm = document.createElement('div');
    if (this.formType === 'reset') {
      formTitle = 'Reset Your Password';
    } else if (this.changeEmail !== '' && this.changeEmail !== null && this.changeEmail !== undefined) {
      formTitle = 'Verify Your New Email Address';
    } else {
      formTitle = 'Verify Your Email Address';
    }
    emailVarifyForm.className = 'RegistrationForm elevation2';
    emailVarifyForm.style.maxWidth = '3in';
    emailVarifyForm.innerHTML = `
${formTitle}

    <form style="min-height:3.25in">`
    + '

Email

'
    + '<input class="email" type="email" name="email" style="width:250px;min-width:0" value="" required>'
    + `
${passInput}

    Check your email for a verification code.

`
    + '
5-digit Code

'
    + '<input type="number" title="5 digit code" name="code" class="code" style="width:150px;min-width:0" required" value="">
'
    + '

'
    + '

'
    + '
<button style="display:none; margin-bottom:-30px;margin-left:12px" type="button" class="regbutton">Submit</button>

</form>';
    const home = document.getElementsByClassName('home');
    home[0].insertBefore(emailVarifyForm, home[0].childNodes[0]);
    this.fillInEmail(this.userEmail, this.changeEmail);
    return formTitle;
  }

  fillInEmail(userEmail, changeEmail) {
    if (userEmail !== '' && userEmail !== null && userEmail !== undefined) {
      document.getElementsByClassName('email')[0].value = userEmail;
    } else if (changeEmail !== '' && changeEmail !== null && changeEmail !== undefined) {
      document.getElementsByClassName('email')[0].value = changeEmail;
    }
  }

  verifyEmail() {
    const formTitle = this.createVerifyCodeForm();
    const pWInput = document.getElementsByClassName('loginpass')[0];
    this.setEvents(pWInput);
    const emailInput = document.getElementsByClassName('email')[0];
    this.setEvents(emailInput);
    const verifyCode = document.getElementsByClassName('code')[0];
    this.setEvents(verifyCode);
    verifyCode.formType = this.formType;
    const submitButton = document.getElementsByClassName('regbutton')[0];
    submitButton.fetchClient = this.fetch;
    submitButton.runFetch = this.runFetch;
    if (formTitle === 'Verify Your Email Address') {
      submitButton.addEventListener('click', this.updateUser);
    }
    if (formTitle === 'Reset Your Password') {
      submitButton.addEventListener('click', this.resetPasswd);
    }
    if (formTitle === 'Verify Your New Email Address') {
      submitButton.addEventListener('click', this.verifyChangeEmail);
    }
    if (this.formType !== 'reset') {
      document.getElementsByClassName('pwheader')[0].style.display = 'none';
      document.getElementsByClassName('pwinput')[0].style.display = 'none';
    }
  }

  setEvents(element) {
    element.addEventListener('change', this.validateForm);
    element.addEventListener('focus', this.validateForm);
    element.addEventListener('keydown', this.validateForm);
    element.addEventListener('keyup', this.validateForm);
    element.formType = this.formType;
  }

  // setupValidationForm(evt) {
  //   this.formType = evt.target.formType;
  //   this.myForm.newpasswd = document.getElementsByClassName('loginpass')[0];
  //   this.myForm.isemailvalid = document.getElementsByClassName('email')[0].checkValidity();
  //   this.myForm.emValue = document.getElementsByClassName('email')[0].value;
  //   this.myForm.edot = this.myForm.emValue.split('.');
  //   this.myForm.isvalidcode = document.getElementsByClassName('code')[0].value;
  //   this.myForm.submitbutton = document.getElementsByClassName('regbutton')[0];
  //   this.myForm.submitbutton.style.display = 'none';
  //   document.getElementsByClassName('loginerror')[0].innerHTML = '';
  // }

  validateForm(evt) {
    const formType = evt.target.formType;
    const myForm = {};
    myForm.newpasswd = document.getElementsByClassName('loginpass')[0];
    myForm.isemailvalid = document.getElementsByClassName('email')[0].checkValidity();
    myForm.emValue = document.getElementsByClassName('email')[0].value;
    myForm.edot = myForm.emValue.split('.');
    myForm.isvalidcode = document.getElementsByClassName('code')[0].value;
    myForm.submitbutton = document.getElementsByClassName('regbutton')[0];
    myForm.submitbutton.style.display = 'none';
    document.getElementsByClassName('loginerror')[0].innerHTML = '';
    // this.setupValidationForm(evt);
    let errorMessage = '
';
    if (formType === 'reset') {
      const validPassword = myForm.newpasswd.checkValidity();
      if (validPassword && myForm.isemailvalid && myForm.edot.length > 1
        && myForm.isvalidcode > 9999 && myForm.isvalidcode < 100000) {
        myForm.submitbutton.style.display = 'block';
        return true;
      }
      if (!validPassword) {
        errorMessage += '
Password is not >= 8 characters
';
      }
    }
    if (!(myForm.isvalidcode > 9999 && myForm.isvalidcode < 100000)) {
      errorMessage += '
Invalid passcode
';
    }
    if (!myForm.isemailvalid || !(myForm.edot.length > 1)) {
      errorMessage += '
Invalid email address
';
    }
    if (errorMessage !== '
') {
      errorMessage += '

';
      document.getElementsByClassName('loginerror')[0].innerHTML = errorMessage;
      return false;
    }
    myForm.submitbutton.style.display = 'block';
    return null;
  }

  updateUser(evt) {
    const fetchClient = evt.target.fetchClient;
    const runFetch = evt.target.runFetch;
    const bodyData = { email: document.getElementsByClassName('email')[0].value, resetCode: document.getElementsByClassName('code')[0].value };
    const fetchData = {
      method: 'PUT',
      body: JSON.stringify(bodyData),
      headers: {
        Accept: 'application/json',
        'Content-Type': 'application/json'
      }
    };
    let backend = '';
    /* istanbul ignore else */
    if (process.env.NODE_ENV !== 'production') {
      backend = process.env.BackendUrl;
    }
    return runFetch(fetchClient, backend, '/user/auth/validateemail', fetchData);
  }

  resetPasswd(evt) {
    const fetchClient = evt.target.fetchClient;
    const runFetch = evt.target.runFetch;
    const bodyData = {
      email: document.getElementsByClassName('email')[0].value,
      resetCode: document.getElementsByClassName('code')[0].value,
      password: document.getElementsByClassName('loginpass')[0].value
    };
    const fetchData = { method: 'PUT', body: JSON.stringify(bodyData), headers: { Accept: 'application/json', 'Content-Type': 'application/json' } };
    let backend = '';
    /* istanbul ignore else */
    if (process.env.NODE_ENV !== 'production') {
      backend = process.env.BackendUrl;
    }
    return runFetch(fetchClient, backend, '/user/auth/pswdreset', fetchData);
  }

  runFetch(fetchClient, url, route, fetchData) {
    return fetchClient(url + route, fetchData)
      .then(response => response.json())
      .then((data) => {
        if (data.message) {
          const messagediv = document.getElementsByClassName('loginerror')[0];
          messagediv.innerHTML = `<p style="text-align:left; padding-left:12px">${data.message}</p>`;
        } else {
          localStorage.setItem('userEmail', document.getElementsByClassName('email')[0].value);
          const regform1 = document.getElementsByClassName('RegistrationForm');
          regform1[0].style.display = 'none';
          let feurl = 'http://localhost:9000';
          /* istanbul ignore if */
          if (process.env.frontURL !== undefined) {
            feurl = process.env.frontURL;
          }
          /* istanbul ignore if */
          if (process.env.NODE_ENV !== 'test') {
            window.location.href = `${feurl}/login?email=${document.getElementsByClassName('email')[0].value}`;
          }
        }
      })
      .catch(() => {
        // console.log(error);
      });
  }

  nevermind(className) {
    let regform1 = [],
      feurl = 'http://localhost:9000';
    regform1 = document.getElementsByClassName(className);
    regform1[0].style.display = 'none';
    /* istanbul ignore if */
    if (process.env.frontURL !== undefined) {
      feurl = process.env.frontURL;
    }
    /* istanbul ignore if */
    if (process.env.NODE_ENV !== 'test') {
      window.location.href = `${feurl}/`;
    }
  }

  verifyChangeEmail(evt) {
    const fetchClient = evt.target.fetchClient;
    const runFetch = evt.target.runFetch;
    const bodyData = {
      changeemail: document.getElementsByClassName('email')[0].value,
      resetCode: document.getElementsByClassName('code')[0].value,
      email: localStorage.getItem('userEmail')
    };
    const fetchData = {
      method: 'PUT',
      body: JSON.stringify(bodyData),
      headers: {
        Accept: 'application/json',
        'Content-Type': 'application/json'
      }
    };
    let backend = '';
    /* istanbul ignore else */
    if (process.env.NODE_ENV !== 'production') {
      backend = process.env.BackendUrl;
    }
    return runFetch(fetchClient, backend, '/user/auth/updateemail', fetchData);
  }
}

module.exports = User_;


text:
#include "Contact.h"
#include "RigidBody.h"
#include <iostream>

namespace novus
{

void Contact::setBodyData(RigidBody* one, RigidBody* two, float friction, float restitution)
{
	body[0] = one;
	body[1] = two;
	this->restitution = restitution;
	this->friction = friction;
}

void Contact::CalculateDesiredDeltaVelocity(float dt)
{
	const static float velocityLimit = 0.25f;

	float velocityFromAcc = 0.0f;

	velocityFromAcc += Dot(body[0]->getLastFrameAcceleration() * dt, contactNormal);

	if (body[1] != NULL)
	{
		velocityFromAcc -= Dot(body[1]->getLastFrameAcceleration() * dt, contactNormal);
	}

	float thisRestitution = restitution;
	if (fabsf(mContactVelocity.x) < velocityLimit)
		thisRestitution = 0.0f;

	mDesiredDeltaVelocity = -mContactVelocity.x - thisRestitution * (mContactVelocity.x - velocityFromAcc);
}

Vector3 Contact::CalculateLocalVelocity(unsigned int bodyIndex, float dt)
{
	RigidBody* thisBody = body[bodyIndex];

	//Get velocity of the contact point
	Vector3 velocity = Cross(thisBody->getAngularVelocity(), mRelativeContactPosition[bodyIndex]);
	velocity += thisBody->getVelocity();

	//Transform the velocity into the contact coordinate space
	Vector3 contactVelocity = mWorldToContact * velocity;

	//Calculate velocity due to passive forces
	Vector3 accVelocity = thisBody->getLastFrameAcceleration() * dt;

	accVelocity = mWorldToContact * accVelocity;

	//Ignore acceleration in the direction of the contact normal
	accVelocity.x = 0.0f;

	contactVelocity += accVelocity;

	return contactVelocity;
}

void Contact::CalculateContactBasis()
{
	Vector3 contactTangent[2];

	//Check if the Z axis is closer to the X or Y axis
	if (fabsf(contactNormal.x) > fabsf(contactNormal.y))
	{
		const float scale = 1.0f / sqrtf(contactNormal.z * contactNormal.z + contactNormal.x * contactNormal.x);

		contactTangent[0].x = contactNormal.z * scale;
		contactTangent[0].y = 0.0f;
		contactTangent[0].z = -contactNormal.x * scale;

		contactTangent[1].x = contactNormal.y * contactTangent[0].x;
		contactTangent[1].y = contactNormal.z * contactTangent[0].x - contactNormal.x * contactTangent[0].z;
		contactTangent[1].z = -contactNormal.y * contactTangent[0].x;
	}
	else
	{
		const float scale = 1.0f / sqrtf(contactNormal.z * contactNormal.z + contactNormal.y * contactNormal.y);

		contactTangent[0].x = 0.0f;
		contactTangent[0].y = -contactNormal.z * scale;
		contactTangent[0].z = contactNormal.y * scale;

		contactTangent[1].x = contactNormal.y * contactTangent[0].z - contactNormal.z * contactTangent[0].y;
		contactTangent[1].y = -contactNormal.x * contactTangent[0].z;
		contactTangent[1].z = contactNormal.x * contactTangent[0].y;
	}

	/*contactTangent[0] = Normalize(Cross(contactNormal, (contactNormal.y < 0.98f) ? Vector3(0.0f, 1.0f, 0.0f) : Vector3(1.0f, 0.0f, 0.0f)));
	contactTangent[1] = Cross(contactNormal, contactTangent[0]);*/

	mContactToWorld = Matrix3(contactNormal.x, contactTangent[0].x, contactTangent[1].x,
							  contactNormal.y, contactTangent[0].y, contactTangent[1].y,
							  contactNormal.z, contactTangent[0].z, contactTangent[1].z);

	//mContactToWorld = Matrix3(contactNormal, contactTangent[0], contactTangent[1]);

	mWorldToContact = Matrix3::Transpose(mContactToWorld);
}

void Contact::CalculateInternals(float dt)
{
	if (!body[0])
		SwapBodies();

	CalculateContactBasis();

	mRelativeContactPosition[0] = contactPoint - body[0]->getTransform()->GetPosition();
	if (body[1] != NULL)
	{
		mRelativeContactPosition[1] = contactPoint - body[1]->getTransform()->GetPosition();
	}

	mContactVelocity = CalculateLocalVelocity(0, dt);

	if (body[1] != NULL)
	{
		mContactVelocity -= CalculateLocalVelocity(1, dt);
	}

	CalculateDesiredDeltaVelocity(dt);
}

void Contact::SwapBodies()
{
	contactNormal *= -1.0f;

	RigidBody* temp = body[0];
	body[0] = body[1];
	body[1] = temp;
}

void Contact::ApplyVelocityChange(Vector3 velocityChange[2], Vector3 rotationChange[2])
{
	Matrix3 inverseInertiaTensor[2];
	inverseInertiaTensor[0] = body[0]->getInverseInertiaTensorWorld();

	if (body[1] != NULL)
	{
		inverseInertiaTensor[1] = body[1]->getInverseInertiaTensorWorld();
	}

	Vector3 impulseContact;

	impulseContact = CalculateFrictionlessImpulse(inverseInertiaTensor);

	//Transform impulse to world coordinates
	Vector3 impulse = mContactToWorld * impulseContact;

	//Split the impulse into linear and rotational components
	Vector3 impulsiveTorque = Cross(mRelativeContactPosition[0], impulse);
	rotationChange[0] = inverseInertiaTensor[0] * impulsiveTorque;
	velocityChange[0] = Vector3();
	velocityChange[0] += impulse * body[0]->getInverseMass();

	//std::cout << "Impulse: " << velocityChange[0].x << ", " << velocityChange[0].y << ", " << velocityChange[0].z << std::endl;
	//std::cout << "Rotation Impulse: " << rotationChange[0].x << ", " << rotationChange[0].y << ", " << rotationChange[0].z << std::endl;

	body[0]->AddVelocity(velocityChange[0]);
	body[0]->AddAngularVelocity(rotationChange[0]);

	if (body[1] != NULL)
	{
		Vector3 impulsiveTorque = Cross(mRelativeContactPosition[1], impulse);
		rotationChange[1] = inverseInertiaTensor[1] * impulsiveTorque;
		velocityChange[1] = Vector3();
		velocityChange[1] += impulse * -body[1]->getInverseMass();

		body[1]->AddVelocity(velocityChange[1]);
		body[1]->AddAngularVelocity(rotationChange[1]);
	}
}

void Contact::ApplyPositionChange(Vector3 linearChange[2], Vector3 angularChange[2], float penetration)
{
	const float angularLimit = 0.2f;

	float angularMove[2];
	float linearMove[2];

	float totalInertia = 0.0f;
	float linearInertia[2];
	float angularInertia[2];

	for (unsigned int i = 0; i < 2; i++) if (body[i] != NULL)
	{
		Matrix3 inverseInertiaTensor = body[i]->getInverseInertiaTensorWorld();

		Vector3 angularInertiaWorld = Cross(mRelativeContactPosition[i], contactNormal);
		angularInertiaWorld = inverseInertiaTensor * angularInertiaWorld;
		angularInertiaWorld = Cross(angularInertiaWorld, mRelativeContactPosition[i]);
		angularInertia[i] = Dot(angularInertiaWorld, contactNormal);

		linearInertia[i] = body[i]->getInverseMass();

		//totalInertia += linearInertia[i] + angularInertia[i];
		totalInertia += linearInertia[i];
	}

	for (unsigned int i = 0; i < 2; i++) if (body[i] != NULL)
	{
		angularMove[i] = 0.0f;
		float sign = (i == 0) ? 1.0f : -1.0f;

		//angularMove[i] = sign * penetration * (angularInertia[i] / totalInertia);
		linearMove[i] = sign * penetration * (linearInertia[i] / totalInertia);

		//Avoid overrotation on massive objects by limiting the angular move
		Vector3 projection = mRelativeContactPosition[i];
		projection += contactNormal * -Dot(mRelativeContactPosition[i], contactNormal);

		float maxMagnitude = angularLimit * Length(projection);

		if (angularMove[i] < maxMagnitude)
		{
			float totalMove = angularMove[i] + linearMove[i];
			angularMove[i] = -maxMagnitude;
			linearMove[i] = totalMove - angularMove[i];
		}
		else if (angularMove[i] > maxMagnitude)
		{
			float totalMove = angularMove[i] + linearMove[i];
			angularMove[i] = maxMagnitude;
			linearMove[i] = totalMove - angularMove[i];
		}

		angularMove[i] = 0.0f;

		//Calculating the required rotation to apply to the rigidbody to match with the adjusted linear movement
		if (angularMove[i] == 0.0f)
		{
			angularChange[i] = Vector3();//No angular movement so no rotation
		}
		else
		{
			//Get the direction the body needs to rotate in
			Vector3 targetAngularDirection = mRelativeContactPosition[i] * contactNormal;

			Matrix3 inverseIntertiaTensor = body[i]->getInverseInertiaTensorWorld();

			//Get the direction it needs to rotate
			angularChange[i] = (inverseIntertiaTensor * targetAngularDirection) * (angularMove[i] / angularInertia[i]);
		}

		linearChange[i] = contactNormal * linearMove[i];

		//Apply the linear movement
		Vector3 position = body[i]->getTransform()->GetPosition();
		position += contactNormal * linearMove[i];
		body[i]->getTransform()->SetPosition(position);

		Quaternion q = body[i]->getTransform()->GetRotation();
		q += angularChange[i];
		body[i]->getTransform()->SetRotation(q);

		//Resolve derived data on sleeping bodies here
	}
}

void Contact::ApplyLinearPositionChange(Vector3 linearChange[2], Vector3 angularChange[2], float penetration)
{
	angularChange[0] = Vector3();
	angularChange[1] = Vector3();

	if (penetration <= 0) return;

	float totalInverseMass = body[0]->getInverseMass();

	if (body[1])
		totalInverseMass += body[1]->getInverseMass();

	if (totalInverseMass <= 0)
		return;

	Vector3 movePerIMass = contactNormal * (penetration / totalInverseMass);

	//Move bodies proportional to their mass
	linearChange[0] = movePerIMass * body[0]->getInverseMass();

	if (body[1])
	{
		linearChange[1] = movePerIMass * -body[1]->getInverseMass();
	}
	else
	{
		linearChange[1] = Vector3();
	}

	body[0]->getTransform()->SetPosition(body[0]->getTransform()->GetPosition() + linearChange[0]);

	if (body[1])
	{
		body[1]->getTransform()->SetPosition(body[1]->getTransform()->GetPosition() + linearChange[1]);
	}
}

Vector3 Contact::CalculateFrictionlessImpulse(Matrix3* inverseIntertiaTensor)
{
	Vector3 impulseContact;

	//Build a vector that shows the change in velocity for a unit impulse in the direcion of the contact normal
	Vector3 deltaVelWorld = Cross(mRelativeContactPosition[0], contactNormal);
	deltaVelWorld = inverseIntertiaTensor[0] * deltaVelWorld;
	deltaVelWorld = Cross(deltaVelWorld, mRelativeContactPosition[0]);

	//Calculate the change in velocity in contact coordinates
	float deltaVelocity = Dot(deltaVelWorld, contactNormal);

	/*std::cout << "X component: " << mContactToWorld.getAxisVector(0).x << ", " << mContactToWorld.getAxisVector(0).y << ", " << mContactToWorld.getAxisVector(0).z << std::endl;
	std::cout << "Y component: " << mContactToWorld.getAxisVector(1).x << ", " << mContactToWorld.getAxisVector(1).y << ", " << mContactToWorld.getAxisVector(1).z << std::endl;
	std::cout << "Z component: " << mContactToWorld.getAxisVector(2).x << ", " << mContactToWorld.getAxisVector(2).y << ", " << mContactToWorld.getAxisVector(2).z << std::endl;*/

	/*std::cout << "X component: " << mWorldToContact.getAxisVector(0).x << ", " << mWorldToContact.getAxisVector(0).y << ", " << mWorldToContact.getAxisVector(0).z << std::endl;
	std::cout << "Y component: " << mWorldToContact.getAxisVector(1).x << ", " << mWorldToContact.getAxisVector(1).y << ", " << mWorldToContact.getAxisVector(1).z << std::endl;
	std::cout << "Z component: " << mWorldToContact.getAxisVector(2).x << ", " << mWorldToContact.getAxisVector(2).y << ", " << mWorldToContact.getAxisVector(2).z << std::endl;*/

	deltaVelocity += body[0]->getInverseMass();

	if (body[1] != NULL)
	{
		deltaVelWorld = Cross(mRelativeContactPosition[1], contactNormal);
		deltaVelWorld = inverseIntertiaTensor[1] * deltaVelWorld;
		deltaVelWorld = Cross(deltaVelWorld, mRelativeContactPosition[1]);

		deltaVelocity += Dot(deltaVelWorld, contactNormal);

		deltaVelocity += body[1]->getInverseMass();
	}

	impulseContact.x = mDesiredDeltaVelocity / deltaVelocity;
	impulseContact.y = 0.0f;
	impulseContact.z = 0.0f;

	//std::cout << "Impulse: " << impulseContact.x << ", " << impulseContact.y << ", " << impulseContact.z << std::endl;

	return impulseContact;
}

}