text:
'use strict';

Object.defineProperty(exports, "__esModule", {
	value: true
});
exports.transformContent = exports.updateFilename = exports.processedVariableValueRegExp = exports.rawVariableValueRegExp = exports.rawVariableKeyRegExp = exports.updateGlobalVariables = exports.rawVariableRegExp = exports.initialPluginPromise = exports.initialStatePromise = undefined;
exports.run = run;
exports.checkLast = checkLast;
exports.addContentAndCode = addContentAndCode;
exports.runActionsOnState = runActionsOnState;
exports.generatePluginFunctions = generatePluginFunctions;
exports.pluginStream = pluginStream;
exports.splitCode = splitCode;
exports.splitContent = splitContent;
exports.getRawVariables = getRawVariables;
exports.convertRawVariableToObject = convertRawVariableToObject;
exports.getRawVariableKey = getRawVariableKey;
exports.getRawVariableValue = getRawVariableValue;
exports.getFilename = getFilename;
exports.trimContent = trimContent;
exports.transform = transform;
exports.transformRegExp = transformRegExp;
exports.transformMatchRegExp = transformMatchRegExp;
exports.transformEvaluate = transformEvaluate;

var _bluebird = require('bluebird');

var _bluebird2 = _interopRequireDefault(_bluebird);

var _immutable = require('immutable');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var writeFile = (0, _bluebird.promisify)(require('fs').writeFile);
var readFile = (0, _bluebird.promisify)(require('fs').readFile);
function run() {
	var file = arguments.length <= 0 || arguments[0] === undefined ? 'pagitter.js' : arguments[0];
	var pluginsList = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1];

	var plugins = generatePluginFunctions(pluginsList);
	var initialState = (0, _immutable.Map)({
		globalVariables: (0, _immutable.Map)(),
		pagitterFilepath: file
	});
	return readFile(file, 'utf8').then(function (file) {
		var actions = (0, _immutable.List)([updateGlobalVariables, updateFilename, transformContent, plugins]);
		var codes = splitCode(file);
		var contents = splitContent(file);
		return codes.reduce(function (promiseReturningState, code, index) {
			return promiseReturningState.then(function (state) {
				return runActionsOnState(actions, addContentAndCode(checkLast(state, index, codes), contents.get(index), code));
			});
		}, initialStatePromise(initialState));
	}).catch(function (error) {
		console.log('error', error);
	});
}
var initialStatePromise = exports.initialStatePromise = _bluebird2.default.method(function (state) {
	return state;
});

function checkLast(state, index, codes) {
	if (index + 1 == codes.size) {
		return state.set('last', true);
	}
	return state;
}

function addContentAndCode(state, content, code) {
	return state.merge({
		code: code,
		content: content
	});
}

function runActionsOnState(actions, state) {
	return actions.reduce(function (promiseReturningState, action) {
		return promiseReturningState.then(function (currentState) {
			return action(currentState);
		});
	}, initialStatePromise(state));
}

function generatePluginFunctions(plugins) {
	return pluginStream(plugins);
}

function pluginStream(plugins) {
	var pluginFunctions = plugins.reduce(function (oldFunction, plugin) {
		return function (state) {
			return oldFunction(state).then(function (oldFunctionState) {
				return plugin(oldFunctionState);
			});
		};
	}, initialPluginPromise);
	return pluginFunctions;
}

var initialPluginPromise = exports.initialPluginPromise = _bluebird2.default.method(function initialPluginPromise(state) {
	return state;
});

function splitCode(file) {
	return (0, _immutable.List)(file.match(/\/\*_(?:.|\s)+?\*\//g));
}

function splitContent(file) {

	var contents = (0, _immutable.List)(file.split(/\/\*_(?:.|\s)+?\*\//));
	return contents.shift();
}

function getRawVariables(code) {
	return (0, _immutable.List)(code.match(rawVariableRegExp));
}
var rawVariableRegExp = exports.rawVariableRegExp = /\<\!(.|\s)+?\!\>/ig;

var updateGlobalVariables = exports.updateGlobalVariables = _bluebird2.default.method(function (state) {
	var rawVariables = getRawVariables(state.get('code'));
	return state.set('globalVariables', rawVariables.reduce(function (updatingGlobalVariables, rawVariable) {
		return updatingGlobalVariables.merge(convertRawVariableToObject(rawVariable, updatingGlobalVariables));
	}, state.get('globalVariables')));
});

function convertRawVariableToObject(rawVariable, globalVariables) {
	var cleanRawVariable = rawVariable.slice(2, -2);
	var rawVariableKey = getRawVariableKey(cleanRawVariable);
	var rawVariableValue = getRawVariableValue(cleanRawVariable);
	var processedVariableValue = transform(rawVariableValue, globalVariables);
	var evaluateVariableValue = transformEvaluate(processedVariableValue);
	return (0, _immutable.Map)().set(rawVariableKey, evaluateVariableValue);
}

function getRawVariableKey(rawVariable) {
	return rawVariable.match(rawVariableKeyRegExp)[0];
}
var rawVariableKeyRegExp = exports.rawVariableKeyRegExp = /^(.|\s)+?(?=\=)/;
function getRawVariableValue(rawVariable) {
	return rawVariable.replace(rawVariableValueRegExp, '');
}
var rawVariableValueRegExp = exports.rawVariableValueRegExp = /^(.|\s)+?\=/;

var processedVariableValueRegExp = exports.processedVariableValueRegExp = /\!\w+?\!/;

var updateFilename = exports.updateFilename = _bluebird2.default.method(function (state) {
	var filename = getFilename(state.get('code'), state.get('globalVariables'));
	return state.set('filename', filename);
});

function getFilename(code, globalVariables) {
	var rawFilename = code.replace(allButFilenameRegExp, '');
	return transform(rawFilename, globalVariables);
}

var _StartRegExp = /\/\*_/;
var _EndRegExp = /\*\//;
var allButFilenameRegExp = new RegExp(_StartRegExp.source + '|' + _EndRegExp.source + '|' + rawVariableRegExp.source + '|' + '\\s', 'g');

var transformContent = exports.transformContent = _bluebird2.default.method(function (state) {
	if (state.get('globalVariables').toList().size > 0) {
		return state.set('content', trimContent(transform(state.get('content'), state.get('globalVariables'))));
	}
	return state.update('content', function (content) {
		return trimContent(content);
	});
});
var removeTagsRegExp = /^\<\!|\!\>|^\@|\@$/g;

function trimContent(content) {
	return content.replace(/(\n)*$|^(\n)*/g, '');
}

function transform(content, globalVariables) {
	return content.replace(transformRegExp(globalVariables), function (matched) {
		var globalVariable = matched.replace(removeTagsRegExp, '');
		return globalVariables.get(globalVariable);
	});
}

function transformRegExp(globalVariables) {
	if (globalVariables.toSeq().size > 0) {
		var pattern = (0, _immutable.List)(globalVariables.keySeq().toArray()).reduce(function (prev, current) {
			return prev + transformMatchRegExp(current) + '|';
		}, '');
		return new RegExp(pattern.slice(0, -1), 'g');
	} else {
		return (/^aAc5D8g3B1bCvSD$/
		);
	}
}

function transformMatchRegExp(global) {
	return '(\\@' + global + '\\@)';
}

function transformEvaluate(value) {
	if (value.slice(0, 2) == '^^') {
		return eval(value.slice(2));
	}
	return value;
}


text:
/*-------------------------------------------------------------------------
  Copyright 2009 Sandia Corporation.
  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
  the U.S. Government retains certain rights in this software.
-------------------------------------------------------------------------*/
// .NAME vtkPBivariateLinearTableThreshold - performs line-based thresholding
// for vtkTable data in parallel.
//
// .SECTION Description
// Perform the table filtering operations provided by
// vtkBivariateLinearTableThreshold in parallel.

#ifndef vtkPBivariateLinearTableThreshold_h
#define vtkPBivariateLinearTableThreshold_h

#include "vtkFiltersParallelStatisticsModule.h" // For export macro
#include "vtkBivariateLinearTableThreshold.h"

class vtkIdTypeArray;
class vtkMultiProcessController;

class VTKFILTERSPARALLELSTATISTICS_EXPORT vtkPBivariateLinearTableThreshold : public vtkBivariateLinearTableThreshold
{
public:
  static vtkPBivariateLinearTableThreshold* New();
  vtkTypeMacro(vtkPBivariateLinearTableThreshold, vtkBivariateLinearTableThreshold);
  void PrintSelf(ostream& os, vtkIndent indent);

  // Description:
  // Set the vtkMultiProcessController to be used for combining filter
  // results from the individual nodes.
  virtual void SetController(vtkMultiProcessController*);
  vtkGetObjectMacro(Controller,vtkMultiProcessController);
protected:
  vtkPBivariateLinearTableThreshold();
  virtual ~vtkPBivariateLinearTableThreshold();

  virtual int RequestData(
    vtkInformation*,
    vtkInformationVector**,
    vtkInformationVector*);

  vtkMultiProcessController* Controller;
private:
  vtkPBivariateLinearTableThreshold(const vtkPBivariateLinearTableThreshold&); // Not implemented
  void operator=(const vtkPBivariateLinearTableThreshold&); // Not implemented
};

#endif

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * @namespace
 */
namespace Zend\View;

/**
 * Abstract master class for extension.
 */
require_once 'Zend/View/Abstract.php';

/**
 * Concrete class for handling view scripts.
 *
 * @category   Zend
 * @package    Zend_View
 * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class View extends AbstractView
{
    /**
     * Whether or not to use streams to mimic short tags
     * @var bool
     */
    private $_useViewStream = false;

    /**
     * Whether or not to use stream wrapper if short_open_tag is false
     * @var bool
     */
    private $_useStreamWrapper = false;

    /**
     * Constructor
     *
     * Register Zend_View_Stream stream wrapper if short tags are disabled.
     *
     * @param  array $config
     * @return void
     */
    public function __construct($config = array())
    {
        $this->_useViewStream = (bool) ini_get('short_open_tag') ? false : true;
        if ($this->_useViewStream) {
            if (!in_array('zend.view', stream_get_wrappers())) {
                require_once 'Zend/View/Stream.php';
                stream_wrapper_register('zend.view', 'Zend_View_Stream');
            }
        }

        if (array_key_exists('useStreamWrapper', $config)) {
            $this->setUseStreamWrapper($config['useStreamWrapper']);
        }

        parent::__construct($config);
    }

    /**
     * Set flag indicating if stream wrapper should be used if short_open_tag is off
     *
     * @param  bool $flag
     * @return Zend_View
     */
    public function setUseStreamWrapper($flag)
    {
        $this->_useStreamWrapper = (bool) $flag;
        return $this;
    }

    /**
     * Should the stream wrapper be used if short_open_tag is off?
     *
     * @return bool
     */
    public function useStreamWrapper()
    {
        return $this->_useStreamWrapper;
    }

    /**
     * Includes the view script in a scope with only public $this variables.
     *
     * @param string The view script to execute.
     */
    protected function _run()
    {
        if ($this->_useViewStream && $this->useStreamWrapper()) {
            include 'zend.view://' . func_get_arg(0);
        } else {
            include func_get_arg(0);
        }
    }
}


text:
/**
 */
package effects.provider;

import de.uka.ipd.sdq.identifier.provider.IdentifierItemProvider;

import effects.Effect;
import effects.EffectsPackage;

import java.util.Collection;
import java.util.List;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.common.util.ResourceLocator;

import org.eclipse.emf.edit.provider.ComposeableAdapterFactory;
import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ItemPropertyDescriptor;
import org.eclipse.emf.edit.provider.ViewerNotification;

/**
 * This is the item provider adapter for a {@link effects.Effect} object.
 * <!-- begin-user-doc -->
 * <!-- end-user-doc -->
 * @generated
 */
public class EffectItemProvider extends IdentifierItemProvider {
	/**
	 * This constructs an instance from a factory and a notifier.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EffectItemProvider(AdapterFactory adapterFactory) {
		super(adapterFactory);
	}

	/**
	 * This returns the property descriptors for the adapted class.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public List<IItemPropertyDescriptor> getPropertyDescriptors(Object object) {
		if (itemPropertyDescriptors == null) {
			super.getPropertyDescriptors(object);

			addEffectTypePropertyDescriptor(object);
			addDescriptionPropertyDescriptor(object);
		}
		return itemPropertyDescriptors;
	}

	/**
	 * This adds a property descriptor for the Effect Type feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addEffectTypePropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_Effect_EffectType_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_Effect_EffectType_feature", "_UI_Effect_type"),
				 EffectsPackage.Literals.EFFECT__EFFECT_TYPE,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This adds a property descriptor for the Description feature.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected void addDescriptionPropertyDescriptor(Object object) {
		itemPropertyDescriptors.add
			(createItemPropertyDescriptor
				(((ComposeableAdapterFactory)adapterFactory).getRootAdapterFactory(),
				 getResourceLocator(),
				 getString("_UI_Effect_description_feature"),
				 getString("_UI_PropertyDescriptor_description", "_UI_Effect_description_feature", "_UI_Effect_type"),
				 EffectsPackage.Literals.EFFECT__DESCRIPTION,
				 true,
				 false,
				 false,
				 ItemPropertyDescriptor.GENERIC_VALUE_IMAGE,
				 null,
				 null));
	}

	/**
	 * This returns the label text for the adapted class.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String getText(Object object) {
		String label = ((Effect)object).getDescription();
		return label == null || label.length() == 0 ?
			getString("_UI_Effect_type") :
			getString("_UI_Effect_type") + " " + label;
	}

	/**
	 * This handles model notifications by calling {@link #updateChildren} to update any cached
	 * children and by creating a viewer notification, which it passes to {@link #fireNotifyChanged}.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void notifyChanged(Notification notification) {
		updateChildren(notification);

		switch (notification.getFeatureID(Effect.class)) {
			case EffectsPackage.EFFECT__EFFECT_TYPE:
			case EffectsPackage.EFFECT__DESCRIPTION:
				fireNotifyChanged(new ViewerNotification(notification, notification.getNotifier(), false, true));
				return;
		}
		super.notifyChanged(notification);
	}

	/**
	 * This adds {@link org.eclipse.emf.edit.command.CommandParameter}s describing the children
	 * that can be created under this object.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) {
		super.collectNewChildDescriptors(newChildDescriptors, object);
	}

	/**
	 * Return the resource locator for this item provider's resources.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public ResourceLocator getResourceLocator() {
		return EffectsEditPlugin.INSTANCE;
	}

}


text:
subdir=src/backend/libpq
top_builddir=../../../..

TARGETS=pqcomm
# Objects from backend, which don't need to be mocked but need to be linked.
$(TARGETS)_REAL_OBJS=\
    $(top_srcdir)/src/backend/access/hash/hashfunc.o \
    $(top_srcdir)/src/backend/bootstrap/bootparse.o \
    $(top_srcdir)/src/backend/lib/stringinfo.o \
    $(top_srcdir)/src/backend/nodes/bitmapset.o \
    $(top_srcdir)/src/backend/nodes/equalfuncs.o \
    $(top_srcdir)/src/backend/nodes/list.o \
    $(top_srcdir)/src/backend/parser/gram.o \
    $(top_srcdir)/src/backend/regex/regcomp.o \
    $(top_srcdir)/src/backend/regex/regerror.o \
    $(top_srcdir)/src/backend/regex/regexec.o \
    $(top_srcdir)/src/backend/regex/regfree.o \
    $(top_srcdir)/src/backend/storage/page/itemptr.o \
    $(top_srcdir)/src/backend/utils/adt/datum.o \
    $(top_srcdir)/src/backend/utils/adt/like.o \
    $(top_srcdir)/src/backend/utils/hash/dynahash.o \
    $(top_srcdir)/src/backend/utils/hash/hashfn.o \
    $(top_srcdir)/src/backend/utils/init/globals.o \
    $(top_srcdir)/src/backend/utils/misc/guc.o \
    $(top_srcdir)/src/port/exec.o \
    $(top_srcdir)/src/port/path.o \
    $(top_srcdir)/src/port/pgsleep.o \
    $(top_srcdir)/src/port/pgstrcasecmp.o \
    $(top_srcdir)/src/port/qsort.o \
    $(top_srcdir)/src/port/strlcpy.o \
    $(top_srcdir)/src/port/thread.o \
    $(top_srcdir)/src/timezone/localtime.o \
    $(top_srcdir)/src/timezone/pgtz.o

include ../../../Makefile.mock


text:
<?php
/**
 * Created by PhpStorm.
 * User: HungChelsea
 * Date: 29-Feb-16
 * Time: 3:20 PM
 */

namespace frontend\models;

use yii\base\Model;

class Glispas extends Model
{
    public $glispaID = 0;
    public $name = 0;
    public $category = 0;
    public $countries = 0;
    public $summary = 0;
    public $acquisition = 0;
    public $target = 0;
    public $rules = 0;
    public $payout = 0;
    public $tracking = 0;
    public $creativeURL = 0;
    public $created_at = 0;
    public $updated_at = 0;
}


text:
from __future__ import unicode_literals

from django.conf import settings
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('multipolls', '0002_multipoll_pos'),
    ]

    operations = [
        migrations.AlterField(
            model_name='multipoll',
            name='voters',
            field=models.ManyToManyField(related_name='multipoll_participated', to=settings.AUTH_USER_MODEL),
        ),
    ]


text:
"""
Install Acronym
"""

import os
from setuptools import setup, find_packages
from glob import glob

import acronym

def _get_file(i_file, as_list=False):
    with open(i_file) as f:
        if as_list:
            return f.readlines()
        else:
            return f.read()

setup(
    name=acronym.__module_name__,
    version=acronym.__version__,
    author=acronym.__author__,
    author_email=acronym.__source__,
    description=acronym.__doc__,
    long_description=_get_file('README.md'),
    url=acronym.__source__,
    license=acronym.__license__,
    packages=find_packages(),
    scripts=glob(os.path.join('bin', '*.py')),
    include_package_data=True,
    classifiers=[
        'Intended Audience :: Developers',
        'Intended Audience :: GIS Developers',
        'Intended Audience :: Remote Sensing Specialists',
        'Intended Audience :: Spatial data managers',
        'License :: OSI Approved :: New BSD',
        'Programming Language :: Python 2.7'
        'Programming Language :: Python 3.4'
    ]
)


text:
namespace ios {
class ChromeBrowserState;
}

// Error domain for authentication error.
extern NSString* kAuthenticationErrorDomain;

// The key in the user info dictionary containing the GoogleServiceAuthError
// code.
extern NSString* kGoogleServiceAuthErrorState;

typedef enum {
  // The error is wrapping a GoogleServiceAuthError.
  GOOGLE_SERVICE_AUTH_ERROR = -200,
  NO_AUTHENTICATED_USER = -201,
  CLIENT_ID_MISMATCH = -203,
  CLIENT_SECRET_MISMATCH = -204,
  AUTHENTICATION_FLOW_ERROR = -206,
  TIMED_OUT_FETCH_POLICY = -210,
} AuthenticationErrorCode;

// Enum is used to count the various sign in sources in the histogram
// |Signin.IOSSignInSource|.
typedef enum {
  // Unspecified sign-in source. This includes sign in operations started from
  // "Other Devices" and from the sync error infobar displayed for pre-SSO
  // signed in users.
  SIGN_IN_SOURCE_OTHER,
  // Sign in operation was started from first run.
  SIGN_IN_SOURCE_FIRST_RUN,
  // Sign in operation was started from the SSO recall promo.
  SIGN_IN_SOURCE_SSO_PROMO,
  // Sign in operation was started from settings.
  SIGN_IN_SOURCE_SETTINGS,
  // Sign in operation was started from as a pre-requisite of share operation.
  SIGN_IN_SOURCE_SHARE,
  // Sign in operation was started from as a pre-requisite of a print operation.
  SIGN_IN_SOURCE_PRINT,
  // Sign in operation was started from the re-sign in infobar.
  SIGN_IN_SOURCE_RESIGN_IN_INFOBAR,
  // Sign in operation was started from the Chrome to Device infobar.
  SIGN_IN_SOURCE_CHROME_TO_DEVICE_INFOBAR,
  // Sign in operation was started from the recent tabs panel.
  SIGN_IN_SOURCE_RECENT_TABS,
  // Sign in operation was started from the bookmarks promo panel.
  SIGN_IN_SOURCE_BOOKMARKS_PROMO,
  // Sign in operation was started from the Tab Switcher.
  SIGN_IN_SOURCE_TAB_SWITCHER,
  // NOTE: Add new sign in sources only immediately above this line. Also, make
  // sure the enum list for histogram |Signin.IOSSignInSource| in
  // uma/configs/chrome/histograms.xml is updated with any change in here.
  SIGN_IN_SOURCE_COUNT
} SignInSource;

typedef enum {
  SHOULD_CLEAR_DATA_USER_CHOICE,
  SHOULD_CLEAR_DATA_CLEAR_DATA,
  SHOULD_CLEAR_DATA_MERGE_DATA,
} ShouldClearData;

// Enum is used to represent the action to be taken by the authentication once
// the user is successfully signed in.
typedef enum {
  POST_SIGNIN_ACTION_NONE,
  POST_SIGNIN_ACTION_START_SYNC,
} PostSignInAction;

namespace signin_ui {

// Completion callback for a sign-in operation.
// |signedIn| is true if the operation was successful and the user is now
// signed in.
// |signedInBrowserState| is the browser state that was signed in.
typedef void (^CompletionCallback)(
    BOOL signedIn,
    ios::ChromeBrowserState* signedInBrowserState);

}  // namespace signin_ui

#endif  // IOS_CHROME_BROWSER_SIGNIN_CONSTANTS_H_


text:
import unittest

from chartmogul import Plan, Config, APIError
import requests_mock
from collections import namedtuple

class PlanTestCase(unittest.TestCase):
    """
    Tests cursor query parameters & modify (patch a plan).
    """
    maxDiff = None

    @requests_mock.mock()
    def test_cursor_list_plans(self, mock_requests):
        expected_plan_dict = {"uuid": u"whatever_uuid",
                              "data_source_uuid": u"some_uuid",
                              "name": u"some plan",
                              "interval_count": 2,
                              "interval_unit": u"moonshines",
                              "external_id": u"custom_filter"}
        mock_requests.register_uri(
            'GET',
            ("https://api.chartmogul.com/v1/plans?page=5"
             "&per_page=12&data_source_uuid=some_uuid&external_id=custom_filter"),
            request_headers={'Authorization': 'Basic dG9rZW46'},
            status_code=200,
            json={"plans": [expected_plan_dict],
                  "current_page": 5,
                  "total_pages": 18}
        )
        config = Config("token")  # is actually checked in mock
        plan = Plan.all(config, page=5, per_page=12,
                        data_source_uuid="some_uuid",
                        external_id="custom_filter").get()
        expected = Plan._many([Plan(**expected_plan_dict)],
                              current_page=5, total_pages=18)
        self.assertEqual(mock_requests.call_count, 1, "expected call")
        self.assertEqual(mock_requests.last_request.qs, {
            'data_source_uuid': ['some_uuid'],
            'external_id': ['custom_filter'],
            'page': ['5'],
            'per_page': ['12']
        })
        self.assertEqual(mock_requests.last_request.text, None)
        self.assertEqual(str(plan), str(expected))

    @requests_mock.mock()
    def test_modify_plan(self, mock_requests):
        expected_plan_dict = {
            "uuid": u"whatever_uuid",
            "data_source_uuid": u"some_uuid",
            "name": u"new_name",
            "interval_count": 2,
            "interval_unit": u"moonshines",
            "external_id": u"custom_filter"
        }
        mock_requests.register_uri(
            'PATCH',
            "https://api.chartmogul.com/v1/plans/whatever_uuid",
            request_headers={'Authorization': 'Basic dG9rZW46'},
            status_code=200,
            json=expected_plan_dict
        )
        config = Config("token")  # is actually checked in mock
        plan = Plan.modify(config,
                           uuid="whatever_uuid",
                           data={"name": "new_name"}).get()
        expected = Plan(**expected_plan_dict)
        self.assertEqual(mock_requests.call_count, 1, "expected call")
        self.assertEqual(mock_requests.last_request.qs, {})
        self.assertEqual(mock_requests.last_request.json(),
                         {"name": u"new_name"})
        self.assertEqual(str(plan), str(expected))

    @requests_mock.mock()
    def test_create_plan(self, mock_requests):
        expected_plan_dict = {
            "uuid": u"whatever_uuid",
            "data_source_uuid": u"some_uuid",
            "name": u"new_name",
            "interval_count": 2,
            "interval_unit": u"moonshines",
            "external_id": u"custom_filter"
        }
        sent = {
            "data_source_uuid": "ds_9bb53a1e-edfd-11e6-bf83-af49e978cb11",
            "name": "Gold Plan",
            "interval_count": 1,
            "interval_unit": "month",
            "external_id": "plan_0002"
        }
        mock_requests.register_uri(
            'POST',
            "https://api.chartmogul.com/v1/plans",
            request_headers={'Authorization': 'Basic dG9rZW46'},
            status_code=200,
            json=expected_plan_dict
        )
        config = Config("token")  # is actually checked in mock
        plan = Plan.create(
            config,
            data=sent).get()
        expected = Plan(**expected_plan_dict)
        self.assertEqual(mock_requests.call_count, 1, "expected call")
        self.assertEqual(mock_requests.last_request.qs, {})
        self.assertEqual(mock_requests.last_request.json(), sent)
        self.assertEqual(str(plan), str(expected))


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 org.micromanager.acquiremultipleregions;

/**
 *
 * @author kthorn
 */
public class ShepardInterpolator {
    private double[] x_, y_, z_;
    public double exponent_;

    /**
     *
     * @param xin x position list
     * @param yin y position list
     * @param zin z position list
     * @param exp radial weighting exponent
     */
    public ShepardInterpolator(double[] xin, double[] yin, double[] zin, double exp) {
        this.exponent_ = exp;
        if (xin.length != yin.length || xin.length != zin.length ) {
            throw new IllegalArgumentException();
        }
        this.x_ = xin;
        this.y_ = yin;
        this.z_ = zin;
    }

    public double interpolate(double xi, double yi){
        double weight, numerator, denominator;
        double epsilon = 0.001;
        double d;
        int i;
        numerator = 0;
        denominator = 0;
        for (i=0; i<x_.length; i++) {
            //calculate weight
            d = distance(x_[i], xi, y_[i], yi);
            if (d < epsilon) {
                //if we're on top of a point, return it's z coordinate,
                //otherwise d = 0, weight = infinity, and we return a NaN
                return z_[i];
            }
            weight = Math.pow(d, -exponent_);
            numerator += z_[i] * weight;
            denominator += weight;
        }
        return numerator / denominator;
    }

    private double distance(double X1, double X2, double Y1, double Y2) {
        return Math.pow((Math.pow(X1 - X2, 2) + Math.pow(Y1 - Y2, 2)), 0.5);
    }

}


text:
import { combineReducers } from 'redux';
import filters from './filters';

const reducer = combineReducers({filters});

export default reducer;


text:
xTable
======
xTable is an Excel-like table data editor. Supports multiple, complex and nested tables; data copy-paste from Excel/Calc to xTable and vice versa. Requires jQuery library v1.6 or higher.

Demo is available [here](https://onsu.github.io/xtable/).

Usage
------
Include required libraries and stylesheets on your page and create a new instance of `xtable` object. `xtable` expects existing table DOM element as the first argument.
```html
<link rel="stylesheet" href="css/xtable.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="js/xtable.js"></script>
<script>
$(function() {
	var my_xtable = new xtable($('#my_table'));
});
</script>
```

Options
------
### Read-only cells
Add `readonly` class to a table cell element to forbit editing it's contents. Readonly mode can be also toggled on a live xTable with JavaScript.
```html
<td class="readonly">Uneditable content</td>
```
```javascript
$('#mytable td.custom').addClass('readonly');
```

### Custom parent element
xTable will not correctly position selector in case table or its ancestor element is relatively positioned. This can be fixed by setting custom parent element. Should be set before creating any xTables, defaults to `document.body`
```javascript
xtable.body_elem = $('div.relative');
```

xTable events
------
xTable cells fire some additional events you can attach handler to.
```javascript
$('#mytable td.custom').on('cellchange', function() {
  console.log('Changed');
});
```

Currently supported events are:

**celledit**
Fires when cell contents become editable (e.g. when user double-clicks the cell, presses `F2` key or starts typing).

**beforecelledit**
Fires right before cell contents become editable. Returning `false` from a handler attached to this event will prevent the default behavior and will not make the cell contents editable.

**cellsave**
Fires when cell content modifications are being applied (e.g. when user presses `Enter` or `Tab` key after editing cell contents).

**beforecellsave**
Fires right before cell content modifications are applied. Returning `false` from a handler attached to this event will not apply any modifications and will restore original cell value.

**cellchange**
Fires when cell contents are modified. Unlike "cellsave" this will also fire when contents are deleted or owerwritten by pasting.

Helper methods
------
### xtable.get_active()
Get instance of currently active xTable.
```javascript
// Get selected cell DOM element of currently active xTable instance
var cell = xtable.get_active().get_cell();
```

### instance.get_table()
Get table DOM element of an xTable instance.
```javascript
var my_xtable = new xtable($('#my_table'));
var table = my_xtable.get_table();
```
```javascript
// Get element of currently active xTable instance
var cell = xtable.get_active().get_table();
```

### instance.get_cell()
Get selected cell DOM element of an xTable instance.
```javascript
var my_xtable = new xtable($('#my_table'));
var cell = my_xtable.get_cell();
```
```javascript
// Get selected cell DOM element of currently active xTable instance
var cell = xtable.get_active().get_cell();
```

### xtable.calculate()
Recalculate indexes of currently active xTable. This should be done after each dynamic table structure modification (i.e. adding/removing rows).
```javascript
$(xtable.get_active().get_table()).find('tr:last').remove();
xtable.calculate();
```

Autocomplete
------
Enables users to quickly find and select from a pre-populated list of values as they type, leveraging searching and filtering. Requires jQuery UI Autocomplete Widget.
```html
<link rel="stylesheet" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
```

**Usage example**
```javascript
var options = {
	source: [
		{'id': 1, 'value': 'USD', 'label': 'US Dollar'},
		{'id': 2, 'value': 'EUR', 'label': 'Euro'},
		{'id': 3, 'value': 'JPY', 'label': 'Japanese Yen'}
	],
	strict: true,
	minLength: 0,
	delay: 0
};
$('#mytable td.custom').xautocomplete(options);
```

**Options**

Option      | Default | Description
----------- | ------- | -----------
`source`    |         | Defines the data to use, must be specified. Array of objects type additionally supports `id` property which will be used as form value. http://api.jqueryui.com/autocomplete/#option-source
`strict`    | `false` | `false` - any value is allowed, `true` - limit to source list.
`minLength` | `0`     | Required number of symbols until search is performed. http://api.jqueryui.com/autocomplete/#option-minLength
`delay`     | `0`     | Delay in milliseconds until search is performed. http://api.jqueryui.com/autocomplete/#option-delay

Formulas (experimental)
------
Set formula as a `data-formula` attribute value of the cell. Value will be executed as JavaScript expression and cell will take the value returned by the expression.
```html
<td data-formula="fc(0,1)+fc(1,1)"></td>
```
Note that formula is being evaluated, so it's probably not a good idea to allow users modify formula values. Expression is executed in scope of `xformula` object, which has some predeifned methods available, they are described below.

### c()
Syntax:
`c(rowIndex, columnIndex)`
Get cell value by coordinates.

### fc()
Syntax:
`fc(rowIndex, columnIndex)`
Same as above, except value always will be converted to float (NaN will become zero).

### ic()
Syntax:
`ic(rowIndex, columnIndex)`
Get cell value index by coordinates (i.e. id of selected autocomplete value).

### fic()
Syntax:
`fic(rowIndex, columnIndex)`
Same as above, except value always will be converted to float (NaN will become zero).

### sum()
Syntax:
`sum([rowIndex, columnIndex], ...)`
or
`sum([[rowIndexFrom, columnIndexFrom], [rowIndexTo, columnIndexTo]], ...)`
Adds all numbers in specified cells or cell ranges and returns the result. Accepts any number of arguments.

### Custom methods
Formulas are executed in scope of `xformula` object, you can extend it with custom methods. For example:
```javascript
xformula.pow = function(base, exponent) {
	return Math.pow(base, exponent);
}
xformula.pi = function() {
	return Math.PI;
}
```
```html
<td data-formula="pi() * pow(fc(0,1), 2)"></td>
```

Getting/submitting data
------
xTable is designed to work correctly as part of an HTML form. Each cell that should have it's contents passed when submitting a form must be named with `data-name` attribute. Array names (i.e. `data-name="value[]"`) are also supported.
```html
<script>
$(function() {
	var my_xtable = new xtable($('#my_table'));
});
</script>
<form name="my_form" method="post">
	<table id="my_table">
		<tr>
			<td class="readonly">Foo</td>
			<td data-name="foo">150</td>
		</tr>
		<tr>
			<td class="readonly">Bar</td>
			<td data-name="bar">225</td>
		</tr>
	</table>
	<p><input type="submit" name="submit" value="Submit"></p>
</form>
```
Submitting the above form will pass the following POST data:
`foo=150&bar=225&submit=Submit`

Same results can be achieved by serializing the form with jQuery, this might be useful for submitting the data with Ajax.
```javascript
var form_data = $(document.forms.my_form).serialize();
```

License
------
Released under the [MIT license](../master/LICENSE).


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <parent>
    <groupId>org.vaadin.osgi</groupId>
    <artifactId>osgi-dependencies</artifactId>
    <version>0.0.1</version>
  </parent>
  <artifactId>osgi-jts</artifactId>
  <version>1.13.0</version>
  <packaging>bundle</packaging>
  <name>jts osgi bundle</name>
  <description>Wraps jts as osgi bundle</description>

  <dependencies>
     <dependency>
            <groupId>com.vividsolutions</groupId>
            <artifactId>jts</artifactId>
            <version>1.13</version>
        </dependency>
  </dependencies>

  <build>
  	<plugins>
  		<plugin>
		   <groupId>org.apache.felix</groupId>
   		   <artifactId>maven-bundle-plugin</artifactId>
   		   <extensions>true</extensions>
		   <configuration>
	      		<instructions>
					<Embed-Dependency>jts;scope=compile|runtime;inline=true</Embed-Dependency>
					<Export-Package>*</Export-Package>
				</instructions>
		   </configuration>
 		</plugin>
  	</plugins>
  </build>
</project>


text:
'use strict';

/**
 * Dependencies
 */
var utils = require('../utils');
var clamp = utils.clamp;
var randomInt = utils.randomInt;

// Constructor

/**
 * Create an Grayscale color
 */
function Grayscale(y) {
  this.setY(y);
}

// Public static constants

/**
 * Minimum valid value for an Grayscale component
 */
Grayscale.MIN_VALUE = 0;

/**
 * Maximum valid value for an Grayscale component
 */
Grayscale.MAX_VALUE = 255;

/**
 * Median value for an Grayscale component (used for bounding)
 */
Grayscale.MID_VALUE = (Grayscale.MAX_VALUE + Grayscale.MIN_VALUE) / 2;

// Public static methods

/**
 * Coerce the value of a component into the valid value range
 */
Grayscale.normalizeComponent = function(component) {
  return clamp(Math.round(component), Grayscale.MIN_VALUE, Grayscale.MAX_VALUE);
};

/**
 * Check the validity of a component value
 */
Grayscale.validateComponent = function(component) {
  return component >= Grayscale.MIN_VALUE && component <= Grayscale.MAX_VALUE;
};

/**
 * Check the validity of a color
 */
Grayscale.validate = function(y) {
  return Grayscale.validateComponent(y);
};

/**
 * Return a random Grayscale component value
 * @returns {Number} random integer
 */
Grayscale.randomValue = function() {
  return randomInt(Grayscale.MIN_VALUE, Grayscale.MAX_VALUE);
};

// Private static methods

/**
 * components are presumed normalized
 */
function _componentToHex(component) {
  var hex = component.toString(16);
  return component < 10 ? '0' + hex : hex;
}

// Public instance methods

/**
 * Set the value of the luminance component.
 * The original value is preserved for out-of-gamut checking.
 * The public value is normalized.
 */
Grayscale.prototype.setY = function(y) {
  this._y = y;
  this.y = Grayscale.normalizeComponent(y);
};

/**
 * Get the normalized (default) or actual value of the red component.
 */
Grayscale.prototype.getY = function(actual) {
  return actual ? this._y : this.y;
};

/**
 * Check the validity of the color
 */
Grayscale.prototype.isOutOfGamut = function() {
  return !Grayscale.validate(this._y);
};

/**
 * Return a string representation of the color's normalized values
 */
Grayscale.prototype.toString = function() {
  return 'grayscale(' + this.y + ')';
};

/**
 * Return a hexadecimal representation of the color's normalized values
 */
Grayscale.prototype.toHex = function() {
  return _componentToHex(this.y);
};

/**
 * TODO - move to palette
 * Return two random RGB colors that are equidistant from the original
 */
Grayscale.prototype.getRandomNeighbors = function() {

  // Determine shorter distance to a bounds
  var yRange = Math.min(Grayscale.MAX_VALUE - this.y, this.y - Grayscale.MIN_VALUE);

  // Get a random integer on either side of the color
  var yRandom = randomInt(-yRange, yRange);

  // Move from current position
  var y1 = this.y + yRandom;

  var random = new this.constructor(y1);

  var y2 = this.y - yRandom;

  var opposite = new this.constructor(y1);

  return [random, opposite];
};

module.exports = Grayscale;


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/cloud/notebooks/v1beta1/instance.proto

package com.google.cloud.notebooks.v1beta1;

public interface InstanceOrBuilder
    extends
    // @@protoc_insertion_point(interface_extends:google.cloud.notebooks.v1beta1.Instance)
    com.google.protobuf.MessageOrBuilder {

  /**
   *
   *
   *

   * Output only. The name of this notebook instance. Format:
   * `projects/{project_id}/locations/{location}/instances/{instance_id}`
   *

   *
   * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   * @return The name.
   */
  java.lang.String getName();
  /**
   *
   *
   *

   * Output only. The name of this notebook instance. Format:
   * `projects/{project_id}/locations/{location}/instances/{instance_id}`
   *

   *
   * string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   * @return The bytes for name.
   */
  com.google.protobuf.ByteString getNameBytes();

  /**
   *
   *
   *

   * Use a Compute Engine VM image to start the notebook instance.
   *

   *
   * .google.cloud.notebooks.v1beta1.VmImage vm_image = 2;
   *
   * @return Whether the vmImage field is set.
   */
  boolean hasVmImage();
  /**
   *
   *
   *

   * Use a Compute Engine VM image to start the notebook instance.
   *

   *
   * .google.cloud.notebooks.v1beta1.VmImage vm_image = 2;
   *
   * @return The vmImage.
   */
  com.google.cloud.notebooks.v1beta1.VmImage getVmImage();
  /**
   *
   *
   *

   * Use a Compute Engine VM image to start the notebook instance.
   *

   *
   * .google.cloud.notebooks.v1beta1.VmImage vm_image = 2;
   */
  com.google.cloud.notebooks.v1beta1.VmImageOrBuilder getVmImageOrBuilder();

  /**
   *
   *
   *

   * Use a container image to start the notebook instance.
   *

   *
   * .google.cloud.notebooks.v1beta1.ContainerImage container_image = 3;
   *
   * @return Whether the containerImage field is set.
   */
  boolean hasContainerImage();
  /**
   *
   *
   *

   * Use a container image to start the notebook instance.
   *

   *
   * .google.cloud.notebooks.v1beta1.ContainerImage container_image = 3;
   *
   * @return The containerImage.
   */
  com.google.cloud.notebooks.v1beta1.ContainerImage getContainerImage();
  /**
   *
   *
   *

   * Use a container image to start the notebook instance.
   *

   *
   * .google.cloud.notebooks.v1beta1.ContainerImage container_image = 3;
   */
  com.google.cloud.notebooks.v1beta1.ContainerImageOrBuilder getContainerImageOrBuilder();

  /**
   *
   *
   *

   * Path to a Bash script that automatically runs after a notebook instance
   * fully boots up. The path must be a URL or
   * Cloud Storage path (gs://path-to-file/file-name).
   *

   *
   * string post_startup_script = 4;
   *
   * @return The postStartupScript.
   */
  java.lang.String getPostStartupScript();
  /**
   *
   *
   *

   * Path to a Bash script that automatically runs after a notebook instance
   * fully boots up. The path must be a URL or
   * Cloud Storage path (gs://path-to-file/file-name).
   *

   *
   * string post_startup_script = 4;
   *
   * @return The bytes for postStartupScript.
   */
  com.google.protobuf.ByteString getPostStartupScriptBytes();

  /**
   *
   *
   *

   * Output only. The proxy endpoint that is used to access the Jupyter notebook.
   *

   *
   * string proxy_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   * @return The proxyUri.
   */
  java.lang.String getProxyUri();
  /**
   *
   *
   *

   * Output only. The proxy endpoint that is used to access the Jupyter notebook.
   *

   *
   * string proxy_uri = 5 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   * @return The bytes for proxyUri.
   */
  com.google.protobuf.ByteString getProxyUriBytes();

  /**
   *
   *
   *

   * Input only. The owner of this instance after creation. Format: `alias@example.com`
   * Currently supports one owner only. If not specified, all of the service
   * account users of your VM instance's service account can use
   * the instance.
   *

   *
   * repeated string instance_owners = 6 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @return A list containing the instanceOwners.
   */
  java.util.List<java.lang.String> getInstanceOwnersList();
  /**
   *
   *
   *

   * Input only. The owner of this instance after creation. Format: `alias@example.com`
   * Currently supports one owner only. If not specified, all of the service
   * account users of your VM instance's service account can use
   * the instance.
   *

   *
   * repeated string instance_owners = 6 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @return The count of instanceOwners.
   */
  int getInstanceOwnersCount();
  /**
   *
   *
   *

   * Input only. The owner of this instance after creation. Format: `alias@example.com`
   * Currently supports one owner only. If not specified, all of the service
   * account users of your VM instance's service account can use
   * the instance.
   *

   *
   * repeated string instance_owners = 6 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @param index The index of the element to return.
   * @return The instanceOwners at the given index.
   */
  java.lang.String getInstanceOwners(int index);
  /**
   *
   *
   *

   * Input only. The owner of this instance after creation. Format: `alias@example.com`
   * Currently supports one owner only. If not specified, all of the service
   * account users of your VM instance's service account can use
   * the instance.
   *

   *
   * repeated string instance_owners = 6 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @param index The index of the value to return.
   * @return The bytes of the instanceOwners at the given index.
   */
  com.google.protobuf.ByteString getInstanceOwnersBytes(int index);

  /**
   *
   *
   *

   * The service account on this instance, giving access to other Google
   * Cloud services.
   * You can use any service account within the same project, but you
   * must have the service account user permission to use the instance.
   * If not specified, the [Compute Engine default service
   * account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account)
   * is used.
   *

   *
   * string service_account = 7;
   *
   * @return The serviceAccount.
   */
  java.lang.String getServiceAccount();
  /**
   *
   *
   *

   * The service account on this instance, giving access to other Google
   * Cloud services.
   * You can use any service account within the same project, but you
   * must have the service account user permission to use the instance.
   * If not specified, the [Compute Engine default service
   * account](https://cloud.google.com/compute/docs/access/service-accounts#default_service_account)
   * is used.
   *

   *
   * string service_account = 7;
   *
   * @return The bytes for serviceAccount.
   */
  com.google.protobuf.ByteString getServiceAccountBytes();

  /**
   *
   *
   *

   * Required. The [Compute Engine machine type](/compute/docs/machine-types) of this
   * instance.
   *

   *
   * string machine_type = 8 [(.google.api.field_behavior) = REQUIRED];
   *
   * @return The machineType.
   */
  java.lang.String getMachineType();
  /**
   *
   *
   *

   * Required. The [Compute Engine machine type](/compute/docs/machine-types) of this
   * instance.
   *

   *
   * string machine_type = 8 [(.google.api.field_behavior) = REQUIRED];
   *
   * @return The bytes for machineType.
   */
  com.google.protobuf.ByteString getMachineTypeBytes();

  /**
   *
   *
   *

   * The hardware accelerator used on this instance. If you use
   * accelerators, make sure that your configuration has
   * [enough vCPUs and memory to support the `machine_type` you
   * have selected](/compute/docs/gpus/#gpus-list).
   *

   *
   * .google.cloud.notebooks.v1beta1.Instance.AcceleratorConfig accelerator_config = 9;
   *
   * @return Whether the acceleratorConfig field is set.
   */
  boolean hasAcceleratorConfig();
  /**
   *
   *
   *

   * The hardware accelerator used on this instance. If you use
   * accelerators, make sure that your configuration has
   * [enough vCPUs and memory to support the `machine_type` you
   * have selected](/compute/docs/gpus/#gpus-list).
   *

   *
   * .google.cloud.notebooks.v1beta1.Instance.AcceleratorConfig accelerator_config = 9;
   *
   * @return The acceleratorConfig.
   */
  com.google.cloud.notebooks.v1beta1.Instance.AcceleratorConfig getAcceleratorConfig();
  /**
   *
   *
   *

   * The hardware accelerator used on this instance. If you use
   * accelerators, make sure that your configuration has
   * [enough vCPUs and memory to support the `machine_type` you
   * have selected](/compute/docs/gpus/#gpus-list).
   *

   *
   * .google.cloud.notebooks.v1beta1.Instance.AcceleratorConfig accelerator_config = 9;
   */
  com.google.cloud.notebooks.v1beta1.Instance.AcceleratorConfigOrBuilder
      getAcceleratorConfigOrBuilder();

  /**
   *
   *
   *

   * Output only. The state of this instance.
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.Instance.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   *
   * @return The enum numeric value on the wire for state.
   */
  int getStateValue();
  /**
   *
   *
   *

   * Output only. The state of this instance.
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.Instance.State state = 10 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   *
   * @return The state.
   */
  com.google.cloud.notebooks.v1beta1.Instance.State getState();

  /**
   *
   *
   *

   * Whether the end user authorizes Google Cloud to install GPU driver
   * on this instance.
   * If this field is empty or set to false, the GPU driver won't be installed.
   * Only applicable to instances with GPUs.
   *

   *
   * bool install_gpu_driver = 11;
   *
   * @return The installGpuDriver.
   */
  boolean getInstallGpuDriver();

  /**
   *
   *
   *

   * Specify a custom Cloud Storage path where the GPU driver is stored.
   * If not specified, we'll automatically choose from official GPU drivers.
   *

   *
   * string custom_gpu_driver_path = 12;
   *
   * @return The customGpuDriverPath.
   */
  java.lang.String getCustomGpuDriverPath();
  /**
   *
   *
   *

   * Specify a custom Cloud Storage path where the GPU driver is stored.
   * If not specified, we'll automatically choose from official GPU drivers.
   *

   *
   * string custom_gpu_driver_path = 12;
   *
   * @return The bytes for customGpuDriverPath.
   */
  com.google.protobuf.ByteString getCustomGpuDriverPathBytes();

  /**
   *
   *
   *

   * Input only. The type of the boot disk attached to this instance, defaults to
   * standard persistent disk (`PD_STANDARD`).
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.Instance.DiskType boot_disk_type = 13 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   *
   * @return The enum numeric value on the wire for bootDiskType.
   */
  int getBootDiskTypeValue();
  /**
   *
   *
   *

   * Input only. The type of the boot disk attached to this instance, defaults to
   * standard persistent disk (`PD_STANDARD`).
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.Instance.DiskType boot_disk_type = 13 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   *
   * @return The bootDiskType.
   */
  com.google.cloud.notebooks.v1beta1.Instance.DiskType getBootDiskType();

  /**
   *
   *
   *

   * Input only. The size of the boot disk in GB attached to this instance, up to a maximum
   * of 64000&nbsp;GB (64&nbsp;TB). The minimum recommended value is
   * 100&nbsp;GB. If not specified, this defaults to 100.
   *

   *
   * int64 boot_disk_size_gb = 14 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @return The bootDiskSizeGb.
   */
  long getBootDiskSizeGb();

  /**
   *
   *
   *

   * Input only. The type of the data disk attached to this instance, defaults to
   * standard persistent disk (`PD_STANDARD`).
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.Instance.DiskType data_disk_type = 25 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   *
   * @return The enum numeric value on the wire for dataDiskType.
   */
  int getDataDiskTypeValue();
  /**
   *
   *
   *

   * Input only. The type of the data disk attached to this instance, defaults to
   * standard persistent disk (`PD_STANDARD`).
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.Instance.DiskType data_disk_type = 25 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   *
   * @return The dataDiskType.
   */
  com.google.cloud.notebooks.v1beta1.Instance.DiskType getDataDiskType();

  /**
   *
   *
   *

   * Input only. The size of the data disk in GB attached to this instance, up to a maximum
   * of 64000&nbsp;GB (64&nbsp;TB). You can choose the size of the data disk
   * based on how big your notebooks and data are. If not specified, this
   * defaults to 100.
   *

   *
   * int64 data_disk_size_gb = 26 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @return The dataDiskSizeGb.
   */
  long getDataDiskSizeGb();

  /**
   *
   *
   *

   * Input only. If true, the data disk will not be auto deleted when deleting the instance.
   *

   *
   * bool no_remove_data_disk = 27 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @return The noRemoveDataDisk.
   */
  boolean getNoRemoveDataDisk();

  /**
   *
   *
   *

   * Input only. Disk encryption method used on the boot and data disks, defaults to GMEK.
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.Instance.DiskEncryption disk_encryption = 15 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   *
   * @return The enum numeric value on the wire for diskEncryption.
   */
  int getDiskEncryptionValue();
  /**
   *
   *
   *

   * Input only. Disk encryption method used on the boot and data disks, defaults to GMEK.
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.Instance.DiskEncryption disk_encryption = 15 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   *
   * @return The diskEncryption.
   */
  com.google.cloud.notebooks.v1beta1.Instance.DiskEncryption getDiskEncryption();

  /**
   *
   *
   *

   * Input only. The KMS key used to encrypt the disks, only applicable if disk_encryption
   * is CMEK.
   * Format:
   * `projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}`
   * Learn more about [using your own encryption keys](/kms/docs/quickstart).
   *

   *
   * string kms_key = 16 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @return The kmsKey.
   */
  java.lang.String getKmsKey();
  /**
   *
   *
   *

   * Input only. The KMS key used to encrypt the disks, only applicable if disk_encryption
   * is CMEK.
   * Format:
   * `projects/{project_id}/locations/{location}/keyRings/{key_ring_id}/cryptoKeys/{key_id}`
   * Learn more about [using your own encryption keys](/kms/docs/quickstart).
   *

   *
   * string kms_key = 16 [(.google.api.field_behavior) = INPUT_ONLY];
   *
   * @return The bytes for kmsKey.
   */
  com.google.protobuf.ByteString getKmsKeyBytes();

  /**
   *
   *
   *

   * If true, no public IP will be assigned to this instance.
   *

   *
   * bool no_public_ip = 17;
   *
   * @return The noPublicIp.
   */
  boolean getNoPublicIp();

  /**
   *
   *
   *

   * If true, the notebook instance will not register with the proxy.
   *

   *
   * bool no_proxy_access = 18;
   *
   * @return The noProxyAccess.
   */
  boolean getNoProxyAccess();

  /**
   *
   *
   *

   * The name of the VPC that this instance is in.
   * Format:
   * `projects/{project_id}/global/networks/{network_id}`
   *

   *
   * string network = 19;
   *
   * @return The network.
   */
  java.lang.String getNetwork();
  /**
   *
   *
   *

   * The name of the VPC that this instance is in.
   * Format:
   * `projects/{project_id}/global/networks/{network_id}`
   *

   *
   * string network = 19;
   *
   * @return The bytes for network.
   */
  com.google.protobuf.ByteString getNetworkBytes();

  /**
   *
   *
   *

   * The name of the subnet that this instance is in.
   * Format:
   * `projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}`
   *

   *
   * string subnet = 20;
   *
   * @return The subnet.
   */
  java.lang.String getSubnet();
  /**
   *
   *
   *

   * The name of the subnet that this instance is in.
   * Format:
   * `projects/{project_id}/regions/{region}/subnetworks/{subnetwork_id}`
   *

   *
   * string subnet = 20;
   *
   * @return The bytes for subnet.
   */
  com.google.protobuf.ByteString getSubnetBytes();

  /**
   *
   *
   *

   * Labels to apply to this instance.
   * These can be later modified by the setLabels method.
   *

   *
   * map<string, string> labels = 21;
   */
  int getLabelsCount();
  /**
   *
   *
   *

   * Labels to apply to this instance.
   * These can be later modified by the setLabels method.
   *

   *
   * map<string, string> labels = 21;
   */
  boolean containsLabels(java.lang.String key);
  /** Use {@link #getLabelsMap()} instead. */
  @java.lang.Deprecated
  java.util.Map<java.lang.String, java.lang.String> getLabels();
  /**
   *
   *
   *

   * Labels to apply to this instance.
   * These can be later modified by the setLabels method.
   *

   *
   * map<string, string> labels = 21;
   */
  java.util.Map<java.lang.String, java.lang.String> getLabelsMap();
  /**
   *
   *
   *

   * Labels to apply to this instance.
   * These can be later modified by the setLabels method.
   *

   *
   * map<string, string> labels = 21;
   */

  /* nullable */
  java.lang.String getLabelsOrDefault(
      java.lang.String key,
      /* nullable */
      java.lang.String defaultValue);
  /**
   *
   *
   *

   * Labels to apply to this instance.
   * These can be later modified by the setLabels method.
   *

   *
   * map<string, string> labels = 21;
   */
  java.lang.String getLabelsOrThrow(java.lang.String key);

  /**
   *
   *
   *

   * Custom metadata to apply to this instance.
   *

   *
   * map<string, string> metadata = 22;
   */
  int getMetadataCount();
  /**
   *
   *
   *

   * Custom metadata to apply to this instance.
   *

   *
   * map<string, string> metadata = 22;
   */
  boolean containsMetadata(java.lang.String key);
  /** Use {@link #getMetadataMap()} instead. */
  @java.lang.Deprecated
  java.util.Map<java.lang.String, java.lang.String> getMetadata();
  /**
   *
   *
   *

   * Custom metadata to apply to this instance.
   *

   *
   * map<string, string> metadata = 22;
   */
  java.util.Map<java.lang.String, java.lang.String> getMetadataMap();
  /**
   *
   *
   *

   * Custom metadata to apply to this instance.
   *

   *
   * map<string, string> metadata = 22;
   */

  /* nullable */
  java.lang.String getMetadataOrDefault(
      java.lang.String key,
      /* nullable */
      java.lang.String defaultValue);
  /**
   *
   *
   *

   * Custom metadata to apply to this instance.
   *

   *
   * map<string, string> metadata = 22;
   */
  java.lang.String getMetadataOrThrow(java.lang.String key);

  /**
   *
   *
   *

   * Optional. The type of vNIC to be used on this interface. This may be gVNIC or
   * VirtioNet.
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.Instance.NicType nic_type = 28 [(.google.api.field_behavior) = OPTIONAL];
   *
   *
   * @return The enum numeric value on the wire for nicType.
   */
  int getNicTypeValue();
  /**
   *
   *
   *

   * Optional. The type of vNIC to be used on this interface. This may be gVNIC or
   * VirtioNet.
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.Instance.NicType nic_type = 28 [(.google.api.field_behavior) = OPTIONAL];
   *
   *
   * @return The nicType.
   */
  com.google.cloud.notebooks.v1beta1.Instance.NicType getNicType();

  /**
   *
   *
   *

   * Optional. The optional reservation affinity. Setting this field will apply
   * the specified [Zonal Compute
   * Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources)
   * to this notebook instance.
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.ReservationAffinity reservation_affinity = 29 [(.google.api.field_behavior) = OPTIONAL];
   *
   *
   * @return Whether the reservationAffinity field is set.
   */
  boolean hasReservationAffinity();
  /**
   *
   *
   *

   * Optional. The optional reservation affinity. Setting this field will apply
   * the specified [Zonal Compute
   * Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources)
   * to this notebook instance.
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.ReservationAffinity reservation_affinity = 29 [(.google.api.field_behavior) = OPTIONAL];
   *
   *
   * @return The reservationAffinity.
   */
  com.google.cloud.notebooks.v1beta1.ReservationAffinity getReservationAffinity();
  /**
   *
   *
   *

   * Optional. The optional reservation affinity. Setting this field will apply
   * the specified [Zonal Compute
   * Reservation](https://cloud.google.com/compute/docs/instances/reserving-zonal-resources)
   * to this notebook instance.
   *

   *
   *
   * .google.cloud.notebooks.v1beta1.ReservationAffinity reservation_affinity = 29 [(.google.api.field_behavior) = OPTIONAL];
   *
   */
  com.google.cloud.notebooks.v1beta1.ReservationAffinityOrBuilder getReservationAffinityOrBuilder();

  /**
   *
   *
   *

   * Optional. Flag to enable ip forwarding or not, default false/off.
   * https://cloud.google.com/vpc/docs/using-routes#canipforward
   *

   *
   * bool can_ip_forward = 31 [(.google.api.field_behavior) = OPTIONAL];
   *
   * @return The canIpForward.
   */
  boolean getCanIpForward();

  /**
   *
   *
   *

   * Output only. Instance creation time.
   *

   *
   * .google.protobuf.Timestamp create_time = 23 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   *
   * @return Whether the createTime field is set.
   */
  boolean hasCreateTime();
  /**
   *
   *
   *

   * Output only. Instance creation time.
   *

   *
   * .google.protobuf.Timestamp create_time = 23 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   *
   * @return The createTime.
   */
  com.google.protobuf.Timestamp getCreateTime();
  /**
   *
   *
   *

   * Output only. Instance creation time.
   *

   *
   * .google.protobuf.Timestamp create_time = 23 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   */
  com.google.protobuf.TimestampOrBuilder getCreateTimeOrBuilder();

  /**
   *
   *
   *

   * Output only. Instance update time.
   *

   *
   * .google.protobuf.Timestamp update_time = 24 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   *
   * @return Whether the updateTime field is set.
   */
  boolean hasUpdateTime();
  /**
   *
   *
   *

   * Output only. Instance update time.
   *

   *
   * .google.protobuf.Timestamp update_time = 24 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   *
   * @return The updateTime.
   */
  com.google.protobuf.Timestamp getUpdateTime();
  /**
   *
   *
   *

   * Output only. Instance update time.
   *

   *
   * .google.protobuf.Timestamp update_time = 24 [(.google.api.field_behavior) = OUTPUT_ONLY];
   *
   */
  com.google.protobuf.TimestampOrBuilder getUpdateTimeOrBuilder();

  public com.google.cloud.notebooks.v1beta1.Instance.EnvironmentCase getEnvironmentCase();
}


text:
package logx

import (
	"encoding/json"
	"io/ioutil"
)

const (
	_DEBUG    level = iota + 1
	_INFO
	_WARN
	_ERR
	_DISASTER
)

var (
	coreDead    coreStatus = 2 //logger is dead
	coreBlock   coreStatus = 0 //logger is block
	coreRunning coreStatus = 1 //logger is running
)
var out = "stdout"
var maxSize int = 256 * 1024*1024
var bucketLen int = 1024
var bufSize int = 2 * 1024 * 1024
var fileName string = "logx"
var filePath string = getCurrentDirectory()
var levelFlag level = _DEBUG
var pollerinterval = 500

type level = uint8
type coreStatus = uint32

func loadConfig() {

	b, err := ioutil.ReadFile("logx.json")
	if err != nil {
		b, err = ioutil.ReadFile("config.json")
		if err != nil {
			return
		}
	}
	var config config
	if err = json.Unmarshal(b, &config); err != nil {
		return
	}
	if x := config.Lbucketlen; x != 0 {
		bucketLen = x
	}
	if x := config.Lfilename; x != "" {
		fileName = x
	}
	if x := config.Lfilepath; x != "" {
		filePath = x
	}
	if x := config.Llevel; x != 0 {
		levelFlag = level(x)
	}
	if x := config.Lmaxsize; x != 0 {
		maxSize = x * 1024 * 1024
	}
	if x := config.Lout; x != "" {
		out = x
	}
	if x := config.Lpollerinterval; x != 0 {
		pollerinterval = x
	}
}


text:
package pipe

import (
	"context"
	"fmt"

	"github.com/ccremer/clustercode/pkg/api/v1alpha1"
	pipeline "github.com/ccremer/go-command-pipeline"
	batchv1 "k8s.io/api/batch/v1"
	"k8s.io/apimachinery/pkg/runtime"
	kubernetesscheme "k8s.io/client-go/kubernetes/scheme"
	"k8s.io/client-go/rest"
	controllerruntime "sigs.k8s.io/controller-runtime"
	"sigs.k8s.io/controller-runtime/pkg/client"
)

type kubeContext struct {
	context.Context

	kubeconfig *rest.Config
	kube       client.Client
	scheme     *runtime.Scheme
}

// NewKubeClient creates a new client.Client using in-cluster config.
func NewKubeClient(ctx context.Context) (client.Client, error) {
	pctx := &kubeContext{Context: ctx}
	p := pipeline.NewPipeline[*kubeContext]().WithBeforeHooks(DebugLogger[*kubeContext](controllerruntime.LoggerFrom(ctx)))
	p.WithSteps(
		p.NewStep("register schemes", registerSchemesFn),
		p.NewStep("load kube config", loadKubeConfigFn),
		p.NewStep("create client", createClientFn),
	)
	err := p.RunWithContext(pctx)
	if err != nil {
		return nil, fmt.Errorf("cannot instantiate new kubernetes client: %w", err)
	}
	return pctx.kube, nil
}

var createClientFn = func(ctx *kubeContext) error {
	kube, err := client.New(ctx.kubeconfig, client.Options{Scheme: ctx.scheme})
	ctx.kube = kube
	return err
}

var registerSchemesFn = func(ctx *kubeContext) error {
	ctx.scheme = runtime.NewScheme()
	b := &runtime.SchemeBuilder{}
	b.Register(
		kubernetesscheme.AddToScheme,
		batchv1.AddToScheme,
		v1alpha1.AddToScheme,
	)
	return b.AddToScheme(ctx.scheme)
}

var loadKubeConfigFn = func(ctx *kubeContext) error {
	clientConfig, err := controllerruntime.GetConfig()
	ctx.kubeconfig = clientConfig
	return err
}


text:
\documentclass[11pt]{article}

\pagestyle{empty}                         %%%% No page Numbering

% Mathews packages....
\usepackage{amsbsy,amsmath,amssymb,psfig}
\usepackage{times,mathpi,mathptm}
\usepackage{graphicx,psfrag,rotating,subfigure}

\begin{document}
\section{Calculation of the sparsity pattern for Mixed formulation}

In the mesh migration problem, it is useful to use a first order
element-element adjancy matrix when a mixed formulation is being used
by the solver. To see why, consider
Figure~\ref{fig:mixedgraph}. Normally the yellow elements define the
mesh overlap, or halo, between two domains. In the case of a mixed
formulation, some field values are stored and solved on a more sparce
matrix pattern. For the mixed formulation considered here, all
elements adjacent to yellow elements, are also required on the
neighbouring domain. The elements of interest are coloured blue in
Figure~\ref{mixedgrapg}.

Define $\pmb{E}$ as the element-element adjancy matrix over all the
domains where
\begin{displaymath}
E_{ij} = \left\{ \begin{array}{ll}
1 & \textrm{if element $i$ shares nodes with element $j$ and $i \ne j$,}\\
0 & \textrm{otherwise}
\end{array} \right.
\end{displaymath}

\begin{figure}[h]\label{fig:mixedgraph}
\centering
\includegraphics[width=80mm]{images/mixed}
\caption{Yellow indicates elements in the halo between two domains
divided by the dashed line. The blue elements indicates the additional
elements that need to be communicated to the neighbouring domains in
the mixed formulation}
\end{figure}

Next we define $\pmb{D}_s$ is the element distribution across the domains
\begin{displaymath}
D_{s_i} = \left\{ \begin{array}{ll}
1 & \textrm{if element $i$ has nodes assigned to domain $s$,}\\
0 & \textrm{otherwise}
\end{array} \right.
\end{displaymath}
Thus, the yellow halo elements between domains $s$ and $r$ can be
defined by $pmb{H}_{sr} = \pmb{D}_s \otimes \pmb{D}_r$.

Finally, let us define $\pmb{B}_{sr}$ as the non-halo elements in
domain $s$, which have to be sent with some specific field values to
domain $r$;
\begin{equation}
B_{sr_i} = S( (H_{sr_i}\pmb{E}_i ).D_s )
\end{equation}

where the function $S$ is defined by
\begin{displaymath}
S(x) = \left\{ \begin{array}{ll}
1 & \textrm{for $x \ne 0$,}\\
0 & \textrm{otherwise}
\end{array} \right.
\end{displaymath}

\end{document}


text:
(**Fork** of https://bitbucket.org/takeflight/wagtailsettings)

(Has some minor modifications)

===============
wagtailsettings
===============

A plugin for Wagtail that provides add developer-defined settings to the admin.

Installing
==========

Install using pip::

    pip install wagtailsettings

It works with Wagtail 0.5 and upwards.

Add it to your ``INSTALLED_APPS``:

.. code:: python

    INSTALLED_APPS += [
        'wagtailsettings',
    ]

Using
=====

Create a model that inherits from ``BaseSetting``,
and register it using the ``register_setting`` decorator:

.. code:: python

    from wagtailsettings.models import BaseSetting, register_setting

    @register_setting
    class SocialMediaSettings(BaseSetting):
        facebook = models.URLField(
            help_text='Your Facebook page URL'
        )
        instagram = models.CharField(
            max_length=255,
            help_text='Your Instagram username, without the @'
        )
        trip_advisor = models.URLField(
            help_text='Your Trip Advisor page URL'
        )
        youtube = models.URLField(
            help_text='Your YouTube channel or user account URL'
        )

A 'Settings' link will appear in the Wagtail admin,
with links to each of the settings models defined.

If access to a setting is required in the code,
the ``BaseSetting.for_site`` method will retrieve the setting for the supplied site:

.. code:: python

    def view(request):
        social_media_settings = SocialMediaSettings.for_site(request.site)
        ...


text:
package org.jnode.nntp.processor;

import org.jnode.nntp.model.Auth;

public class BaseProcessor {

    public boolean isAuthorized(Auth auth) {
        return auth.getFtnAddress() != null;
    }
}


text:
var selectBlock = (function() {

  function _store(element) {
    var selectBlock = helper.getClosest(element, ".js-select-block");
    var selectBlockOptions = helper.makeObject(selectBlock.dataset.selectBlockOptions);
    var selectBlockDropdown = selectBlock.querySelector(".js-select-block-dropdown");
    var newValue = selectBlockDropdown.options[selectBlockDropdown.selectedIndex].value;
    if (selectBlockOptions.path) {
      helper.setObject({
        path: selectBlockOptions.path,
        object: sheet.get(),
        newValue: newValue
      });
    };
  };

  var storeDropdownTimer = null;

  function delayUpdate(element) {
    _store(element);
    sheet.store();
    totalBlock.render();
    textBlock.render();
    display.clear();
    display.render();
  };

  function _focus(element) {
    var selectBlock = helper.getClosest(element, ".js-select-block");
    if (element == document.activeElement) {
      helper.addClass(selectBlock, "is-focus");
    } else {
      helper.removeClass(selectBlock, "is-focus");
    };
  };

  function clear() {
    var all_selectBlock = helper.eA(".js-select-block");
    for (var i = 0; i < all_selectBlock.length; i++) {
      all_selectBlock[i].querySelector(".js-select-block-dropdown").selectedIndex = 0;
    };
  };

  function bind(selectBlock) {
    if (selectBlock) {
      _bind_selectBlock(selectBlock);
    } else {
      var all_selectBlock = helper.eA(".js-select-block");
      for (var i = 0; i < all_selectBlock.length; i++) {
        if (all_selectBlock[i].dataset.clone != "true") {
          _bind_selectBlock(all_selectBlock[i]);
        };
      };
    };
  };

  function _bind_selectBlock(selectBlock) {
    var selectBlockDropdown = selectBlock.querySelector(".js-select-block-dropdown");
    if (selectBlockDropdown) {
      selectBlockDropdown.addEventListener("change", function() {
        clearTimeout(storeDropdownTimer);
        storeDropdownTimer = setTimeout(delayUpdate, 300, this);
      }, false);
      selectBlockDropdown.addEventListener("focus", function() {
        _focus(this);
      }, false);
      selectBlockDropdown.addEventListener("blur", function() {
        _focus(this);
      }, false);
    };
  };

  function _render_selectBlock(selectBlock) {
    var options = helper.makeObject(selectBlock.dataset.selectBlockOptions);
    var selectBlockDropdown = selectBlock.querySelector(".js-select-block-dropdown");
    // var selected = selectBlockDropdown.options.selectedIndex;
    if (options.path) {
      var selection =
        helper.getObject({
          object: sheet.get(),
          path: options.path
        });
      helper.setDropdown(selectBlockDropdown, selection);
    };
  };

  function render(selectBlock) {
    if (all_selectBlock) {
      _render_selectBlock(selectBlock);
    } else {
      var all_selectBlock = helper.eA(".js-select-block");
      for (var i = 0; i < all_selectBlock.length; i++) {
        _render_selectBlock(all_selectBlock[i]);
      };
    };
  };

  // exposed methods
  return {
    render: render,
    bind: bind,
    clear: clear
  };

})();


text:
#pragma once

#include "audio_mixer.hpp"
#include "dsp/sinc_resampler.hpp"
#include <memory>

namespace Granite
{
namespace Audio
{
class ResampledStream : public MixerStream
{
public:
	ResampledStream(MixerStream *source);
	~ResampledStream();

	void setup(float output_rate, unsigned channels, size_t frames) override;
	size_t accumulate_samples(float * const *channels, const float *gain, size_t num_frames) noexcept override;

	float get_sample_rate() const override
	{
		return sample_rate;
	}

	unsigned get_num_channels() const override
	{
		return num_channels;
	}

private:
	MixerStream *source;
	float sample_rate = 0.0f;
	unsigned num_channels = 0;
	size_t max_num_frames = 0;

	std::vector<float> input_buffer[Backend::MaxAudioChannels];
	std::unique_ptr<DSP::SincResampler> resamplers[Backend::MaxAudioChannels];
};
}
}


text:
#include <linux/sched.h>
#include <linux/mm.h>
#include <linux/smp.h>
#include <linux/kernel.h>
#include <linux/signal.h>
#include <linux/errno.h>
#include <linux/wait.h>
#include <linux/ptrace.h>
#include <linux/unistd.h>
#include <linux/stddef.h>
#include <linux/personality.h>
#include <linux/percpu.h>
#include <linux/linkage.h>
#include <linux/tracehook.h>
#include <asm/entry.h>
#include <asm/ucontext.h>
#include <linux/uaccess.h>
#include <asm/pgtable.h>
#include <asm/pgalloc.h>
#include <linux/syscalls.h>
#include <asm/cacheflush.h>
#include <asm/syscalls.h>

asmlinkage long
sys_sigaltstack(const stack_t __user *uss, stack_t __user *uoss,
		struct pt_regs *regs)
{
	return do_sigaltstack(uss, uoss, regs->r1);
}

/*
 * Do a signal return; undo the signal stack.
 */
struct sigframe {
	struct sigcontext sc;
	unsigned long extramask[_NSIG_WORDS-1];
	unsigned long tramp[2];	/* signal trampoline */
};

struct rt_sigframe {
	struct siginfo info;
	struct ucontext uc;
	unsigned long tramp[2];	/* signal trampoline */
};

static int restore_sigcontext(struct pt_regs *regs,
				struct sigcontext __user *sc, int *rval_p)
{
	unsigned int err = 0;

#define COPY(x)		{err |= __get_user(regs->x, &sc->regs.x); }
	COPY(r0);
	COPY(r1);
	COPY(r2);	COPY(r3);	COPY(r4);	COPY(r5);
	COPY(r6);	COPY(r7);	COPY(r8);	COPY(r9);
	COPY(r10);	COPY(r11);	COPY(r12);	COPY(r13);
	COPY(r14);	COPY(r15);	COPY(r16);	COPY(r17);
	COPY(r18);	COPY(r19);	COPY(r20);	COPY(r21);
	COPY(r22);	COPY(r23);	COPY(r24);	COPY(r25);
	COPY(r26);	COPY(r27);	COPY(r28);	COPY(r29);
	COPY(r30);	COPY(r31);
	COPY(pc);	COPY(ear);	COPY(esr);	COPY(fsr);
#undef COPY

	*rval_p = regs->r3;

	return err;
}

asmlinkage long sys_rt_sigreturn(struct pt_regs *regs)
{
	struct rt_sigframe __user *frame =
		(struct rt_sigframe __user *)(regs->r1);

	sigset_t set;
	int rval;

	/* Always make any pending restarted system calls return -EINTR */
	current_thread_info()->restart_block.fn = do_no_restart_syscall;

	if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
		goto badframe;

	if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
		goto badframe;

	set_current_blocked(&set);

	if (restore_sigcontext(regs, &frame->uc.uc_mcontext, &rval))
		goto badframe;

	/* It is more difficult to avoid calling this function than to
	 call it and ignore errors. */
	if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->r1))
		goto badframe;

	return rval;

badframe:
	force_sig(SIGSEGV, current);
	return 0;
}

/*
 * Set up a signal frame.
 */

static int
setup_sigcontext(struct sigcontext __user *sc, struct pt_regs *regs,
		unsigned long mask)
{
	int err = 0;

#define COPY(x)		{err |= __put_user(regs->x, &sc->regs.x); }
	COPY(r0);
	COPY(r1);
	COPY(r2);	COPY(r3);	COPY(r4);	COPY(r5);
	COPY(r6);	COPY(r7);	COPY(r8);	COPY(r9);
	COPY(r10);	COPY(r11);	COPY(r12);	COPY(r13);
	COPY(r14);	COPY(r15);	COPY(r16);	COPY(r17);
	COPY(r18);	COPY(r19);	COPY(r20);	COPY(r21);
	COPY(r22);	COPY(r23);	COPY(r24);	COPY(r25);
	COPY(r26);	COPY(r27);	COPY(r28);	COPY(r29);
	COPY(r30);	COPY(r31);
	COPY(pc);	COPY(ear);	COPY(esr);	COPY(fsr);
#undef COPY

	err |= __put_user(mask, &sc->oldmask);

	return err;
}

/*
 * Determine which stack to use..
 */
static inline void __user *
get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, size_t frame_size)
{
	/* Default to using normal stack */
	unsigned long sp = regs->r1;

	if ((ka->sa.sa_flags & SA_ONSTACK) != 0 && !on_sig_stack(sp))
		sp = current->sas_ss_sp + current->sas_ss_size;

	return (void __user *)((sp - frame_size) & -8UL);
}

static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
			sigset_t *set, struct pt_regs *regs)
{
	struct rt_sigframe __user *frame;
	int err = 0;
	int signal;
	unsigned long address = 0;
#ifdef CONFIG_MMU
	pmd_t *pmdp;
	pte_t *ptep;
#endif

	frame = get_sigframe(ka, regs, sizeof(*frame));

	if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
		goto give_sigsegv;

	signal = current_thread_info()->exec_domain
		&& current_thread_info()->exec_domain->signal_invmap
		&& sig < 32
		? current_thread_info()->exec_domain->signal_invmap[sig]
		: sig;

	if (info)
		err |= copy_siginfo_to_user(&frame->info, info);

	/* Create the ucontext. */
	err |= __put_user(0, &frame->uc.uc_flags);
	err |= __put_user(NULL, &frame->uc.uc_link);
	err |= __put_user((void __user *)current->sas_ss_sp,
			&frame->uc.uc_stack.ss_sp);
	err |= __put_user(sas_ss_flags(regs->r1),
			&frame->uc.uc_stack.ss_flags);
	err |= __put_user(current->sas_ss_size, &frame->uc.uc_stack.ss_size);
	err |= setup_sigcontext(&frame->uc.uc_mcontext,
			regs, set->sig[0]);
	err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));

	/* Set up to return from userspace. If provided, use a stub
	 already in userspace. */
	/* minus 8 is offset to cater for "rtsd r15,8" */
	/* addi r12, r0, __NR_sigreturn */
	err |= __put_user(0x31800000 | __NR_rt_sigreturn ,
			frame->tramp + 0);
	/* brki r14, 0x8 */
	err |= __put_user(0xb9cc0008, frame->tramp + 1);

	/* Return from sighandler will jump to the tramp.
	 Negative 8 offset because return is rtsd r15, 8 */
	regs->r15 = ((unsigned long)frame->tramp)-8;

	address = ((unsigned long)frame->tramp);
#ifdef CONFIG_MMU
	pmdp = pmd_offset(pud_offset(
			pgd_offset(current->mm, address),
					address), address);

	preempt_disable();
	ptep = pte_offset_map(pmdp, address);
	if (pte_present(*ptep)) {
		address = (unsigned long) page_address(pte_page(*ptep));
		/* MS: I need add offset in page */
		address += ((unsigned long)frame->tramp) & ~PAGE_MASK;
		/* MS address is virtual */
		address = virt_to_phys(address);
		invalidate_icache_range(address, address + 8);
		flush_dcache_range(address, address + 8);
	}
	pte_unmap(ptep);
	preempt_enable();
#else
	flush_icache_range(address, address + 8);
	flush_dcache_range(address, address + 8);
#endif
	if (err)
		goto give_sigsegv;

	/* Set up registers for signal handler */
	regs->r1 = (unsigned long) frame;

	/* Signal handler args: */
	regs->r5 = signal; /* arg 0: signum */
	regs->r6 = (unsigned long) &frame->info; /* arg 1: siginfo */
	regs->r7 = (unsigned long) &frame->uc; /* arg2: ucontext */
	/* Offset to handle microblaze rtid r14, 0 */
	regs->pc = (unsigned long)ka->sa.sa_handler;

	set_fs(USER_DS);

	/* the tracer may want to single-step inside the handler */
	if (test_thread_flag(TIF_SINGLESTEP))
		ptrace_notify(SIGTRAP);

#ifdef DEBUG_SIG
	printk(KERN_INFO "SIG deliver (%s:%d): sp=%p pc=%08lx\n",
		current->comm, current->pid, frame, regs->pc);
#endif

	return 0;

give_sigsegv:
	force_sigsegv(sig, current);
	return -EFAULT;
}

/* Handle restarting system calls */
static inline void
handle_restart(struct pt_regs *regs, struct k_sigaction *ka, int has_handler)
{
	switch (regs->r3) {
	case -ERESTART_RESTARTBLOCK:
	case -ERESTARTNOHAND:
		if (!has_handler)
			goto do_restart;
		regs->r3 = -EINTR;
		break;
	case -ERESTARTSYS:
		if (has_handler && !(ka->sa.sa_flags & SA_RESTART)) {
			regs->r3 = -EINTR;
			break;
	}
	/* fallthrough */
	case -ERESTARTNOINTR:
do_restart:
		/* offset of 4 bytes to re-execute trap (brki) instruction */
#ifndef CONFIG_MMU
		regs->pc -= 4;
#else
		/* offset of 8 bytes required = 4 for rtbd
		   offset, plus 4 for size of
			"brki r14,8"
		   instruction. */
		regs->pc -= 8;
#endif
		break;
	}
}

/*
 * OK, we're invoking a handler
 */

static void
handle_signal(unsigned long sig, struct k_sigaction *ka,
		siginfo_t *info, struct pt_regs *regs)
{
	sigset_t *oldset = sigmask_to_save();
	int ret;

	/* Set up the stack frame */
	if (ka->sa.sa_flags & SA_SIGINFO)
		ret = setup_rt_frame(sig, ka, info, oldset, regs);
	else
		ret = setup_rt_frame(sig, ka, NULL, oldset, regs);

	if (ret)
		return;

	signal_delivered(sig, info, ka, regs, 0);
}

/*
 * Note that 'init' is a special process: it doesn't get signals it doesn't
 * want to handle. Thus you cannot kill init even with a SIGKILL even by
 * mistake.
 *
 * Note that we go through the signals twice: once to check the signals that
 * the kernel can handle, and then we build all the user-level signal handling
 * stack-frames in one go after that.
 */
static void do_signal(struct pt_regs *regs, int in_syscall)
{
	siginfo_t info;
	int signr;
	struct k_sigaction ka;
#ifdef DEBUG_SIG
	printk(KERN_INFO "do signal: %p %d\n", regs, in_syscall);
	printk(KERN_INFO "do signal2: %lx %lx %ld [%lx]\n", regs->pc, regs->r1,
			regs->r12, current_thread_info()->flags);
#endif

	signr = get_signal_to_deliver(&info, &ka, regs, NULL);
	if (signr > 0) {
		/* Whee! Actually deliver the signal. */
		if (in_syscall)
			handle_restart(regs, &ka, 1);
		handle_signal(signr, &ka, &info, regs);
		return;
	}

	if (in_syscall)
		handle_restart(regs, NULL, 0);

	/*
	 * If there's no signal to deliver, we just put the saved sigmask
	 * back.
	 */
	restore_saved_sigmask();
}

void do_notify_resume(struct pt_regs *regs, int in_syscall)
{
	/*
	 * We want the common case to go fast, which
	 * is why we may in certain cases get here from
	 * kernel mode. Just return without doing anything
	 * if so.
	 */
	if (kernel_mode(regs))
		return;

	if (test_thread_flag(TIF_SIGPENDING))
		do_signal(regs, in_syscall);

	if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME))
		tracehook_notify_resume(regs);
}


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;

namespace Microsoft.ProjectOxford.Video.Contract
{
    /// <summary>
    /// Generic class for representing fragments.
    /// A fragment represents a span of time in the video.  Fragments will not overlap in time.
    /// </summary>
    /// <typeparam name="T">Type representing the event type specific to the action.</typeparam>
    public class Fragment<T>
    {
        /// <summary>
        /// Gets or sets timestamp of the first event, in ticks.
        /// </summary>
        public Int64 Start { get; set; }

        /// <summary>
        /// Gets or sets overall duration of the fragment, in ticks.
        /// </summary>
        public Int64 Duration { get; set; }

        /// <summary>
        /// Gets or sets the duration of each event, in ticks.  Optional if no events are present.
        /// Note: Duration = Interval * Events.length.
        /// </summary>
        public Int64? Interval { get; set; }

        /// <summary>
        /// Gets or sets array of list of events.  Each array entry is Interval units long in ticks.
        /// </summary>
        public T[][] Events { get; set; }
    }
}


text:
    #include "chrono_pardisomkl/ChSolverPardisoMKL.h"
#endif

#ifdef CHRONO_MUMPS
    #include "chrono_mumps/ChSolverMumps.h"
#endif

#include "chrono_vehicle/cosim/ChVehicleCosimTrackedMBSNode.h"

using std::cout;
using std::endl;

namespace chrono {
namespace vehicle {

// Construction of the base tracked MBS node
ChVehicleCosimTrackedMBSNode::ChVehicleCosimTrackedMBSNode() : ChVehicleCosimBaseNode("MBS"), m_fix_chassis(false) {
    // Default integrator and solver types
    m_int_type = ChTimestepper::Type::EULER_IMPLICIT_LINEARIZED;
    m_slv_type = ChSolver::Type::BARZILAIBORWEIN;

    // Create the (sequential) SMC system
    m_system = new ChSystemSMC;
    m_system->Set_G_acc(ChVector<>(0, 0, m_gacc));

    // Set default number of threads
    m_system->SetNumThreads(1, 1, 1);
}

ChVehicleCosimTrackedMBSNode::~ChVehicleCosimTrackedMBSNode() {
    delete m_system;
}

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

void ChVehicleCosimTrackedMBSNode::SetNumThreads(int num_threads) {
    m_system->SetNumThreads(num_threads, 1, 1);
}

void ChVehicleCosimTrackedMBSNode::SetIntegratorType(ChTimestepper::Type int_type, ChSolver::Type slv_type) {
    m_int_type = int_type;
    m_slv_type = slv_type;
#ifndef CHRONO_PARDISO_MKL
    if (m_slv_type == ChSolver::Type::PARDISO_MKL)
        m_slv_type = ChSolver::Type::BARZILAIBORWEIN;
#endif
#ifndef CHRONO_MUMPS
    if (m_slv_type == ChSolver::Type::MUMPS)
        m_slv_type = ChSolver::Type::BARZILAIBORWEIN;
#endif
}

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

void ChVehicleCosimTrackedMBSNode::AttachDrawbarPullRig(std::shared_ptr<ChVehicleCosimDBPRig> rig) {
    m_DBP_rig = rig;
}

std::shared_ptr<ChVehicleCosimDBPRig> ChVehicleCosimTrackedMBSNode::GetDrawbarPullRig() const {
    return m_DBP_rig;
}

// -----------------------------------------------------------------------------
// Initialization of the tracked MBS node:
// - receive terrain height and dimensions
// - receive track shoe mass and size
// - construct and initialize MBS
// - send load mass on each wheel
// -----------------------------------------------------------------------------
void ChVehicleCosimTrackedMBSNode::Initialize() {
    // Invoke the base class method to figure out distribution of node types
    ChVehicleCosimBaseNode::Initialize();

    // There should be no TIRE nodes.
    if (m_num_tire_nodes > 0) {
        std::cerr << "Error: a tracked vehicle co-simulation should involve no TIRE nodes." << std::endl;
        MPI_Abort(MPI_COMM_WORLD, 1);
    }

    // Complete setup of the underlying ChSystem
    InitializeSystem();

    MPI_Status status;

    // Receive from TERRAIN node the initial terrain dimensions and the terrain height
    double init_dim[3];
    MPI_Recv(init_dim, 3, MPI_DOUBLE, TERRAIN_NODE_RANK, 0, MPI_COMM_WORLD, &status);

    if (m_verbose) {
        cout << "[MBS node    ] Received initial terrain height = " << init_dim[0] << endl;
        cout << "[MBS node    ] Received terrain length =  " << init_dim[1] << endl;
        cout << "[MBS node    ] Received terrain width =  " << init_dim[2] << endl;
    }

    double terrain_height = init_dim[0];
    ChVector2<> terrain_size(init_dim[1], init_dim[2]);

    // Let derived classes construct and initialize their multibody system
    InitializeMBS(terrain_size, terrain_height);
    auto num_track_shoes = GetNumTrackShoes();

    GetChassisBody()->SetBodyFixed(m_fix_chassis);

    // Send to TERRAIN node the number of interacting objects (here, total number of track shoes)
    MPI_Send(&num_track_shoes, 1, MPI_INT, TERRAIN_NODE_RANK, 0, MPI_COMM_WORLD);

    // Send the communication interface type (rigid body) to the TERRAIN node
    char comm_type = 0;
    MPI_Send(&comm_type, 1, MPI_CHAR, TERRAIN_NODE_RANK, 0, MPI_COMM_WORLD);

    // Send geometry for one track shoe
    SendGeometry(GetTrackShoeContactGeometry(), TERRAIN_NODE_RANK);

    // Send mass of one track shoe
    double mass = GetTrackShoeMass();
    MPI_Send(&mass, 1, MPI_DOUBLE, TERRAIN_NODE_RANK, 0, MPI_COMM_WORLD);

    // Initialize the DBP rig if one is attached
    if (m_DBP_rig) {
        m_DBP_rig->m_verbose = m_verbose;
        m_DBP_rig->Initialize(GetChassisBody(), GetSprocketAddendumRadius(), m_step_size);

        m_DBP_outf.open(m_node_out_dir + "/DBP.dat", std::ios::out);
        m_DBP_outf.precision(7);
        m_DBP_outf << std::scientific;

        OnInitializeDBPRig(m_DBP_rig->GetMotorFunction());
    }
}

// -----------------------------------------------------------------------------
// Complete setup of the underlying ChSystem based on any user-provided settings
// -----------------------------------------------------------------------------
void ChVehicleCosimTrackedMBSNode::InitializeSystem() {
    // Change solver
    switch (m_slv_type) {
        case ChSolver::Type::PARDISO_MKL: {
#ifdef CHRONO_PARDISO_MKL
            auto solver = chrono_types::make_shared<ChSolverPardisoMKL>();
            solver->LockSparsityPattern(true);
            m_system->SetSolver(solver);
#endif
            break;
        }
        case ChSolver::Type::MUMPS: {
#ifdef CHRONO_MUMPS
            auto solver = chrono_types::make_shared<ChSolverMumps>();
            solver->LockSparsityPattern(true);
            m_system->SetSolver(solver);
#endif
            break;
        }
        case ChSolver::Type::SPARSE_LU: {
            auto solver = chrono_types::make_shared<ChSolverSparseLU>();
            solver->LockSparsityPattern(true);
            m_system->SetSolver(solver);
            break;
        }
        case ChSolver::Type::SPARSE_QR: {
            auto solver = chrono_types::make_shared<ChSolverSparseQR>();
            solver->LockSparsityPattern(true);
            m_system->SetSolver(solver);
            break;
        }
        case ChSolver::Type::PSOR:
        case ChSolver::Type::PSSOR:
        case ChSolver::Type::PJACOBI:
        case ChSolver::Type::PMINRES:
        case ChSolver::Type::BARZILAIBORWEIN:
        case ChSolver::Type::APGD:
        case ChSolver::Type::GMRES:
        case ChSolver::Type::MINRES:
        case ChSolver::Type::BICGSTAB: {
            m_system->SetSolverType(m_slv_type);
            auto solver = std::dynamic_pointer_cast<ChIterativeSolver>(m_system->GetSolver());
            assert(solver);
            solver->SetMaxIterations(100);
            solver->SetTolerance(1e-10);
            break;
        }
        default: {
            cout << "Solver type not supported!" << endl;
            return;
        }
    }

    // Change integrator
    switch (m_int_type) {
        case ChTimestepper::Type::HHT:
            m_system->SetTimestepperType(ChTimestepper::Type::HHT);
            m_integrator = std::static_pointer_cast<ChTimestepperHHT>(m_system->GetTimestepper());
            m_integrator->SetAlpha(-0.2);
            m_integrator->SetMaxiters(50);
            m_integrator->SetAbsTolerances(5e-05, 1.8e00);
            m_integrator->SetMode(ChTimestepperHHT::POSITION);
            m_integrator->SetScaling(true);
            m_integrator->SetVerbose(false);
            m_integrator->SetMaxItersSuccess(5);
            break;
        default:
            break;
    }
}

// -----------------------------------------------------------------------------
// Synchronization of the MBS node:
// - extract and send track shoe states
// - receive and apply vertex contact forces
// -----------------------------------------------------------------------------
void ChVehicleCosimTrackedMBSNode::Synchronize(int step_number, double time) {
    int num_shoes = GetNumTrackShoes();
    std::vector<double> all_states(13 * num_shoes);
    std::vector<double> all_forces(6 * num_shoes);
    int start_idx;

    // Pack states of all track shoe bodies
    start_idx = 0;
    for (int i = 0; i < GetNumTracks(); i++) {
        for (int j = 0; j < GetNumTrackShoes(i); j++) {
            BodyState state = GetTrackShoeState(i, j);
            all_states[start_idx + 0] = state.pos.x();
            all_states[start_idx + 1] = state.pos.y();
            all_states[start_idx + 2] = state.pos.z();
            all_states[start_idx + 3] = state.rot.e0();
            all_states[start_idx + 4] = state.rot.e1();
            all_states[start_idx + 5] = state.rot.e2();
            all_states[start_idx + 6] = state.rot.e3();
            all_states[start_idx + 7] = state.lin_vel.x();
            all_states[start_idx + 8] = state.lin_vel.y();
            all_states[start_idx + 9] = state.lin_vel.z();
            all_states[start_idx + 10] = state.ang_vel.x();
            all_states[start_idx + 11] = state.ang_vel.y();
            all_states[start_idx + 12] = state.ang_vel.z();
            start_idx += 13;
        }
    }

    // Send track shoe states to the terrain node
    MPI_Send(all_states.data(), 13 * num_shoes, MPI_DOUBLE, TERRAIN_NODE_RANK, step_number, MPI_COMM_WORLD);

    // Receive track shoe forces as applied to the center of the track shoe body.
    // Note that we assume this is the resultant wrench at the track shoe origin (expressed in absolute frame).
    MPI_Status status;
    MPI_Recv(all_forces.data(), 6 * num_shoes, MPI_DOUBLE, TERRAIN_NODE_RANK, step_number, MPI_COMM_WORLD, &status);

    // Apply track shoe forces on each individual track shoe body
    start_idx = 0;
    for (int i = 0; i < GetNumTracks(); i++) {
        for (int j = 0; j < GetNumTrackShoes(i); j++) {
            TerrainForce force;
            force.point = GetTrackShoeBody(i, j)->GetPos();
            force.force = ChVector<>(all_forces[start_idx + 0], all_forces[start_idx + 1], all_forces[start_idx + 2]);
            force.moment = ChVector<>(all_forces[start_idx + 3], all_forces[start_idx + 4], all_forces[start_idx + 5]);
            ApplyTrackShoeForce(i, j, force);
            start_idx += 6;
        }
    }
}

// -----------------------------------------------------------------------------
// Advance simulation of the MBS node by the specified duration
// -----------------------------------------------------------------------------
void ChVehicleCosimTrackedMBSNode::Advance(double step_size) {
    m_timer.reset();
    m_timer.start();
    double t = 0;
    while (t < step_size) {
        double h = std::min<>(m_step_size, step_size - t);
        PreAdvance();
        m_system->DoStepDynamics(h);
        if (m_DBP_rig) {
            m_DBP_rig->OnAdvance(step_size);
        }
        PostAdvance();
        t += h;
    }
    m_timer.stop();
    m_cum_sim_time += m_timer();
}

void ChVehicleCosimTrackedMBSNode::OutputData(int frame) {
    double time = m_system->GetChTime();

    // If a DBP rig is attached, output its results
    if (m_DBP_rig && time >= m_DBP_rig->m_delay_time) {
        std::string del("  ");

        m_DBP_outf << time << del;
        m_DBP_outf << m_DBP_rig->GetLinVel() << del << m_DBP_rig->GetAngVel() << del;
        m_DBP_outf << m_DBP_rig->GetSlip() << del << m_DBP_rig->GetFilteredSlip() << del;
        m_DBP_outf << m_DBP_rig->GetDBP() << del << m_DBP_rig->GetFilteredDBP() << del;

        m_DBP_outf << endl;
    }

    // Let derived classes perform specific output
    OnOutputData(frame);
}

void ChVehicleCosimTrackedMBSNode::OutputVisualizationData(int frame) {
    auto filename = OutputFilename(m_node_out_dir + "/visualization", "vis", "dat", frame, 5);
    utils::WriteVisualizationAssets(m_system, filename, true);
}

}  // end namespace vehicle
}  // end namespace chrono


text:
package spark.template.thymeleaf;

import java.util.Map;

import javax.servlet.ServletContext;

import nz.net.ultraq.thymeleaf.LayoutDialect;

import org.thymeleaf.context.AbstractContext;
import org.thymeleaf.context.Context;
import org.thymeleaf.context.WebContext;
import org.thymeleaf.templateresolver.ClassLoaderTemplateResolver;

import spark.ModelAndView;
import spark.Request;
import spark.Response;
import spark.TemplateEngine;

/**
 *
 * Thymeleaf template engine for Spark Web Application Framework
 *
 * @author markus
 * @version 0.0.1
 * @see Spark's Template Engine docs
 *
 */
public class ThymeleafTemplateEngine extends TemplateEngine {

	private final org.thymeleaf.TemplateEngine thymeleaf;

	public ThymeleafTemplateEngine() {
		ClassLoaderTemplateResolver templateResolver = new ClassLoaderTemplateResolver();
		templateResolver.setTemplateMode("HTML5");
		templateResolver.setPrefix("META-INF/templates/");
		templateResolver.setSuffix(".html");
		templateResolver.setCacheTTLMs(3600000L);
		thymeleaf = new org.thymeleaf.TemplateEngine();
		thymeleaf.setTemplateResolver(templateResolver);
		thymeleaf.addDialect(new LayoutDialect());

	}

	public ThymeleafTemplateEngine(org.thymeleaf.TemplateEngine thymeleaf) {

		if (thymeleaf == null) {
			throw new IllegalArgumentException("Thymeleaf must not be null");
		}
		this.thymeleaf = thymeleaf;
	}

	@SuppressWarnings("unchecked")
	@Override
	public String render(ModelAndView modelAndView) {

		if (modelAndView.getModel() instanceof Map<?, ?>) {

			for (Object key : ((Map<?, ?>) modelAndView.getModel()).keySet()) {

				/*
				 * Sadly, this is necessary as
				 * org.thymeleaf.context.Context.setVariables expects the map to
				 * be in the form Map<String,?> and an according instanceof is
				 * not possible. So although we are sure that we have a Map, we
				 * need to make sure that all keys are Strings before casting.
				 */
				if (!(key instanceof String)) {
					throw new IllegalArgumentException(
							"All keys of the model must be Strings");
				}

			}

			Map<String, ?> modelMap = (Map<String, ?>) modelAndView.getModel();

			AbstractContext ctx;

			if (modelMap.containsKey("request")
					&& modelMap.containsKey("response")
					&& modelMap.containsKey("servletContext")
					&& modelMap.get("request") instanceof Request
					&& modelMap.get("response") instanceof Response
					&& modelMap.get("servletContext") instanceof ServletContext
					) {

				 ctx = new WebContext(((Request) modelMap.get("request")).raw(),
						((Response) modelMap.get("response")).raw(),
						((ServletContext) modelMap.get("servletContext")));

			} else {
				ctx = new Context();
			}

			ctx.setVariables(modelMap);

			return thymeleaf.process(modelAndView.getViewName(), ctx);

		} else {
			throw new IllegalArgumentException(
					"modelAndView must be of type java.util.Map");
		}

	}

}