text:
package io.datalayer.data.map;

import io.datalayer.data.iterable.Iterable;

/**
 * A generic interface for maps.
 *
 */
public interface Map extends Iterable {
    /**
     * Obtains the value for a given key.
     *
     * @param key The key for which the value should be obtained.
     * @return The value; or null if none.
     */
    public Object get(Object key);

    /**
     * Adds/replaces a key/value pair in the map.
     *
     * @param key The key to set.
     * @param value The value to set.
     * @return The old value; or null if none.
     */
    public Object set(Object key, Object value);

    /**
     * Removes a key/value pair from the map.
     *
     * @param key The key to delete.
     * @return The associated value; or null if the key didn't exist.
     */
    public Object delete(Object key);

    /**
     * Determines if a key exists in the map.
     *
     * @param key The key for which to search.
     * @return true if found; otherwise false.
     */
    public boolean contains(Object key);

    /**
     * Deletes all entries from the map. The size of the map will be reset to zero (0).
     */
    public void clear();

    /**
     * Obtains the size of the map.
     *
     * @return The number of values in the map.
     */
    public int size();

    /**
     * Determines if the map is empty or not.
     *
     * @return true if the map is empty (size() == 0); otherwise returns false.
     */
    public boolean isEmpty();

    /**
     * A key/value pair.
     */
    public static interface Entry {
        /**
         * Obtains the key.
         *
         * @return The key.
         */
        public Object getKey();

        /**
         * Obtains the value.
         *
         * @return The value.
         */
        public Object getValue();
    }
}


text:
angular.module('shortly.auth.services', [])

.factory('Auth', function ($http, $location, $window) {
  // Don't touch this Auth service!!!
  // it is responsible for authenticating our user
  // by exchanging the user's username and password
  // for a JWT from the server
  // that JWT is then stored in localStorage as 'com.shortly'
  // after you signin/signup open devtools, click resources,
  // then localStorage and you'll see your token from the server
  var signin = function (user) {
    return $http({
      method: 'POST',
      url: '/api/users/signin',
      data: user
    })
    .then(function (resp) {
      return resp.data.token;
    });
  };

  var signup = function (user) {
    return $http({
      method: 'POST',
      url: '/api/users/signup',
      data: user
    })
    .then(function (resp) {
      return resp.data.token;
    });
  };

  var isAuth = function () {
    return !!$window.localStorage.getItem('com.shortly');
  };

  var signout = function () {
    $window.localStorage.removeItem('com.shortly');
    $location.path('/signin');
  };

  return {
    signin: signin,
    signup: signup,
    isAuth: isAuth,
    signout: signout
  };
});

redpajama_set_name: RedPajamaGithub


text:
package client

import (
	"github.com/keybase/cli"
	"github.com/keybase/client/go/libcmdline"
	"github.com/keybase/client/go/libkb"
)

func NewCmdCtlStart(cl *libcmdline.CommandLine, g *libkb.GlobalContext) cli.Command {
	return cli.Command{
		Name:  "start",
		Usage: "Start the background keybase service",
		Action: func(c *cli.Context) {
			cl.ChooseCommand(&CmdCtlStart{libkb.NewContextified(g)}, "start", c)
			cl.SetForkCmd(libcmdline.ForceFork)
			cl.SetNoStandalone()
		},
	}
}

type CmdCtlStart struct {
	libkb.Contextified
}

func (s *CmdCtlStart) ParseArgv(ctx *cli.Context) error {
	return nil
}

func (s *CmdCtlStart) Run() (err error) {
	// The ForceFork side effect above is all this command does. The
	// autoforking logic handles launchd and systemd also.
	return nil
}

func (s *CmdCtlStart) GetUsage() libkb.Usage {
	return libkb.Usage{}
}


text:
var sanity = require(__dirname),
	colors = require('cli-color'),
	util = require('util'),
	Buffer = require('buffer').Buffer;

var Logger = function() {
	var self = this;

	var inspect = function(args) {
		for (var index in args) {
			var arg = args[index];

			if (arg instanceof Buffer) {
				args[index] = arg.toString();
			}

			else if (typeof arg === 'object') {
				args[index] = util.inspect(arg, {
					depth: 4
				});
			}
		}

		return args;
	};

	var send = function(args, timestampFormat, messageFormat) {
		var lines = Array.prototype.join.apply(inspect(args), [' ']).split("\n");

		var timestamp = function() {
			var time = process.hrtime(self.startTime),
				seconds = '    ' + time[0],
				nanoseconds = '00' + time[1];

			return seconds.slice(-5) + '.' + nanoseconds.slice(0, 4).slice(-2);
		};

		for (var index in lines) {
			self.printLine(timestampFormat(timestamp()) + ' ' + messageFormat(lines[index]));
		}
	};

	self.printLine = console.log;
	self.startTime = process.hrtime();
	self.verbose = true;

	self.error = function() {
		send(arguments, colors.blackBright, colors.black.bgRedBright);
	};

	self.warn = function() {
		send(arguments, colors.blackBright, colors.black.bgYellowBright);
	};

	self.log = function() {
		send(arguments, colors.blackBright, colors.whiteBright);
	};

	self.info = function() {
		if (!self.verbose) return;

		send(arguments, colors.blackBright, colors.white);
	};
}

module.exports.Logger = Logger;
module.exports.createLogger = function() {
	return new Logger();
};


text:
<?php

class Braintree_Payments_Block_Paypal_ReviewDetails extends Mage_Checkout_Block_Cart_Totals
{
    protected $_address;

    /**
     * Return review shipping address
     *
     * @return Mage_Sales_Model_Order_Address
     */
    public function getAddress()
    {
        if (empty($this->_address)) {
            $this->_address = $this->getQuote()->getShippingAddress();
        }
        return $this->_address;
    }

    /**
     * Return review quote totals
     *
     * @return array
     */
    public function getTotals()
    {
        return $this->getQuote()->getTotals();
    }
}


text:
import * as Data from './Data';

const wrapCharWithSpan = (value: string): string =>
  '' + value + '';

export {
  wrapCharWithSpan
};


text:
var Backbone = require("backbone"),
    $ = require("jquery"),
    resource = require("../../controller/resource.js"),
    AdModel;

require("backbone-relational");
require("backbone-relational-hal");

AdModel = Backbone.RelationalHalResource.extend({
    initialize: function () {
        resource.getRootHal(function (halUrl) {
            this.halUrl = halUrl;
            $.extend(this.defaults, {
                _links: {
                    self: {
                        href: halUrl
                    }
                }
            });
        }.bind(this));
        resource.getCurrentUser(function (user) {
            this.set("user", user);
        }.bind(this));
    },
    defaults: {
        location: {
            city: null,
            area: null
        },
        amount: null,
        type: "SELL",
        publishedAt: null,
        rate: null,
        currency: "USD",
        comment: null,
        phoneNumber: null
    }
});

module.exports = AdModel;


text:
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
/* "display: none" prevents loading of <object> resources, so use */
/* "visibility: hidden" instead. */
.invisible { visibility: hidden; }
</style>
<script>
const urls = {
    '/resources/square20.jpg': ['img', 529],
    '/resources/square20.gif': ['img', 50],
    '/resources/square20.png': ['img', 150],
    '/resources/test.ogv': ['video', 103746],
    '/resources/test.oga': ['audio', 20787],
    '/resources/dummy.html': ['iframe', 34],
    '/resources/dummy.js': ['script', 7],
    '/resources/dummy.css': ['link', 8],
    '/svg/resources/greenSquare.svg': ['object', 244],
};

const srcFieldExceptions = {
    'object': 'data',
    'link': 'href',
};

const totalResourceCount = Object.keys(urls).length;
const cacheBuster = '?cb=' + Math.random().toString().substr(2);
var seenResourceCount = 0;
var t = async_test('PerformanceResourceTiming sizes tags test');

function isMediaTag(tag) {
    return tag === 'video' || tag === 'audio';
}

function addTag(url, tag) {
    var element = document.createElement(tag);
    var srcfield = srcFieldExceptions[tag];
    if (!srcfield) {
        srcfield = 'src';
    }
    element.setAttribute(srcfield, url + cacheBuster);
    element.setAttribute('class', 'invisible');
    if (tag === 'link') {
        element.setAttribute('rel', 'stylesheet');
    }
    var onloadevent = isMediaTag(tag) ? 'oncanplaythrough' : 'onload';
    element[onloadevent] = t.step_func(() => {
        // The entry is not guaranteed to be added synchronously by the spec,
        // although the current implementation does.
        setTimeout(t.step_func(loaded), 0);
    });
    document.body.appendChild(element);
}

// Postpone checking until everything is loaded so that the checks will be done
// in a deterministic order.
function loaded() {
    ++seenResourceCount;
    if (seenResourceCount === totalResourceCount)
        checkAllResources();
}

function checkAllResources() {
    for (relativeUrl of Object.keys(urls).sort()) {
        checkResourceSizes(relativeUrl + cacheBuster, urls[relativeUrl][1]);
    }
    t.done();
}

function checkResourceSizes(relativeUrl, expectedSize) {
    var absoluteUrl = new URL(relativeUrl, location.href).href;
    var entry = performance.getEntriesByName(absoluteUrl, 'resource')[0];
    decodedBodySize = entry.decodedBodySize;
    assert_equals(entry.decodedBodySize, expectedSize,
                  relativeUrl + ' decodedBodySize');
    assert_equals(entry.encodedBodySize, expectedSize,
                  relativeUrl + ' encodedBodySize');
    transferSize = entry.transferSize;
    assert_greater_than(entry.transferSize, expectedSize,
                       relativeUrl + ' transferSize');
}

function runTest() {
    for (var url in urls) {
        addTag(url, urls[url][0]);
    }
}

window.onload = t.step_func(runTest);
</script>


text:
import {
  Component,
  ChangeDetectionStrategy,
  EventEmitter,
  AfterViewInit,
  Input,
  Output,
  ViewChild,
} from '@angular/core';
import {
  IGenericConfig,
  ISelectItem,
  IGenericListConfig,
  GenericListValueType,
} from 'cd-interfaces';
import { OverlayInitService } from '../../../overlay/overlay.init.service';
import { InputComponent } from '../../../input/input.component';

const enum LabelConfig {
  NameLabel = 'Name',
  ValueLabel = 'Value',
  Placeholder = 'Custom',
  IconLabel = 'Icon',
  DisabledLabel = 'Disabled',
}

@Component({
  selector: 'cd-generic-prop-editor',
  templateUrl: './generic-prop-editor.component.html',
  styleUrls: ['./generic-prop-editor.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class GenericPropEditorComponent implements AfterViewInit {
  private _data!: IGenericConfig;
  private _usedValues: string[] = [];
  public selectMenu: ISelectItem[] = [];
  public GenericListValueType = GenericListValueType;

  @Input() add = false;
  @Input() iconClass?: string;
  @Input() config!: IGenericListConfig;
  @Input() options: ISelectItem[] = [];

  @Input()
  public get data(): IGenericConfig {
    return this._data;
  }
  public set data(value: IGenericConfig) {
    this._data = value;
    this.buildSelectMenu();
  }
  @Input()
  // Maintain a list of currently selected menus
  public set usedValues(value: string[]) {
    this._usedValues = value;
  }

  @Output() dataChange = new EventEmitter<IGenericConfig>();
  @Output() addData = new EventEmitter<IGenericConfig>();

  @ViewChild('nameRef', { read: InputComponent }) nameRef!: InputComponent;

  constructor(private _overlayInit: OverlayInitService) {}

  get labelName(): string {
    return this.config?.nameLabel || LabelConfig.NameLabel;
  }

  get labelValue(): string {
    return this.config?.valueLabel || LabelConfig.ValueLabel;
  }

  get selectInputPlaceholder(): string {
    return this.config?.placeholder || LabelConfig.Placeholder;
  }

  get iconLabel(): string {
    return this.config?.iconLabel || LabelConfig.IconLabel;
  }

  get disabledLabel(): string {
    return this.config?.disabledLabel || LabelConfig.DisabledLabel;
  }

  buildSelectMenu() {
    if (this.config.valueType !== GenericListValueType.Select) return;
    const { options, _usedValues, data } = this;
    if (options.length === 0) return;
    const uniqueSelection = this.config.supportsUniqueSelection;
    this.selectMenu = options.reduce<ISelectItem[]>((acc, curr) => {
      const { title, value } = curr;
      const selected = value === data.value;
      const disabled = uniqueSelection && _usedValues.includes(value);
      acc.push({ title, value, selected, disabled });
      return acc;
    }, []);
  }

  onSelectMenu(item: ISelectItem) {
    const value = item.value;
    this.updateData({ value });
  }

  onNameChange(name: string) {
    this.updateData({ name });
  }

  onValueChange(value: string) {
    this.updateData({ value });
  }

  updateData(value: Partial<IGenericConfig>) {
    const update = { ...this.data, ...value };
    this.dataChange.emit(update);
    this.data = update;
  }

  onIconInputChange(icon: string) {
    this.updateData({ icon });
  }

  onDisabledChange(disabled: boolean) {
    this.updateData({ disabled });
  }

  selectAndFocusNameInput() {
    setTimeout(() => {
      const input = this.nameRef.inputRef.nativeElement;
      if (!input) return;
      input.focus();
      input.select();
    }, 100);
  }

  ngAfterViewInit() {
    this._overlayInit.componentLoaded();
    this.selectAndFocusNameInput();
  }

  onAdd() {
    this.addData.emit(this.data);
  }
}


text:
package net.nemerosa.ontrack.service.job;

import io.micrometer.core.instrument.MeterRegistry;
import net.nemerosa.ontrack.job.JobListener;
import net.nemerosa.ontrack.job.JobScheduler;
import net.nemerosa.ontrack.job.support.DefaultJobScheduler;
import net.nemerosa.ontrack.model.support.ApplicationLogService;
import net.nemerosa.ontrack.model.support.JobConfigProperties;
import net.nemerosa.ontrack.model.support.OntrackConfigProperties;
import net.nemerosa.ontrack.model.support.SettingsRepository;
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

@Configuration
public class JobConfig {

    private final OntrackConfigProperties ontrackConfigProperties;

    private final DefaultJobDecorator jobDecorator;

    private final ApplicationLogService logService;

    private final MeterRegistry meterRegistry;

    private final SettingsRepository settingsRepository;

    @Autowired
    public JobConfig(OntrackConfigProperties ontrackConfigProperties, DefaultJobDecorator jobDecorator, ApplicationLogService logService, MeterRegistry meterRegistry, SettingsRepository settingsRepository) {
        this.ontrackConfigProperties = ontrackConfigProperties;
        this.jobDecorator = jobDecorator;
        this.logService = logService;
        this.meterRegistry = meterRegistry;
        this.settingsRepository = settingsRepository;
    }

    @Bean
    public JobListener jobListener() {
        return new DefaultJobListener(
                logService,
                meterRegistry,
                settingsRepository
        );
    }

    @Bean
    public ScheduledExecutorService jobExecutorService() {
        return Executors.newScheduledThreadPool(
                ontrackConfigProperties.getJobs().getPoolSize(),
                new BasicThreadFactory.Builder()
                        .daemon(true)
                        .namingPattern("job-%s")
                        .build()
        );
    }

    @Bean
    public JobScheduler jobScheduler() {
        JobConfigProperties jobConfigProperties = ontrackConfigProperties.getJobs();
        return new DefaultJobScheduler(
                jobDecorator,
                jobExecutorService(),
                jobListener(),
                jobConfigProperties.isPausedAtStartup(),
                jobConfigProperties.isScattering(),
                jobConfigProperties.getScatteringRatio(),
                meterRegistry
        );
    }

}


text:
package com.flying.email.daoimpl;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import com.flying.email.bean.FuncInfo;
import com.flying.email.dao.IFuncInfo;

/**
 * auth:flying date:2017年7月25日
 **/
public class FuncInfoImpl implements IFuncInfo {

	@Override
	public FuncInfo getFuncInfo(Connection connection, String condtion) {
		String sql = "select * from funcinfo where isdelete=0 ";
		if (condtion.isEmpty() || condtion == null) {

		} else {
			sql = sql + " and " + condtion;
		}

		PreparedStatement prep = null;
		ResultSet resultSet = null;
		try {
			prep = connection.prepareStatement(sql);
			resultSet = prep.executeQuery();
			List<FuncInfo> lisetresult = FuncInfo.TransFormModelList(resultSet);
			if (lisetresult != null && lisetresult.size() > 0) {
				return lisetresult.get(0);
			} else {
				return null;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		} finally {
			try {
				if (!resultSet.isClosed()) {
					resultSet.close();
				}

				if (!prep.isClosed()) {
					prep.close();
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	@Override
	public List<FuncInfo> getFuncInfoList(Connection connection, String condtion) {
		String sql = "select * from funcinfo where isdelete=0 ";
		if (condtion.isEmpty() || condtion == null) {

		} else {
			sql = sql + " and " + condtion;
		}

		PreparedStatement prep = null;
		ResultSet resultSet = null;
		try {
			prep = connection.prepareStatement(sql);
			resultSet = prep.executeQuery();
			List<FuncInfo> lisetresult = FuncInfo.TransFormModelList(resultSet);
			if (lisetresult != null && lisetresult.size() > 0) {
				return lisetresult;
			} else {
				return null;
			}
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return null;
		} finally {
			try {
				if (!resultSet.isClosed()) {
					resultSet.close();
				}

				if (!prep.isClosed()) {
					prep.close();
				}

				if (!connection.isClosed()) {
					connection.close();
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}

	@Override
	public int insertIntoTable(Connection connection, FuncInfo funcInfo) {
		String sql = " insert into funcinfo(functionname,functioninfo,isforbidden,isdelete,createTime) values(?,?,?,?,?)";
		PreparedStatement preparedStatement = null;
		try {
			preparedStatement = connection.prepareStatement(sql);
			preparedStatement.setString(1, funcInfo.getFunctionname());
			preparedStatement.setString(2, funcInfo.getFunctioninfo());
			preparedStatement.setInt(3, funcInfo.getIsforbidden());
			preparedStatement.setInt(4, funcInfo.getIsdelete());
			preparedStatement.setTimestamp(5, new java.sql.Timestamp(funcInfo.getCreateTime().getTime()));
			return preparedStatement.executeUpdate();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				if (!preparedStatement.isClosed()) {
					preparedStatement.close();
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		return 0;
	}

	@Override
	public int insetIntoTbableList(Connection connection, List<FuncInfo> listfuncinfo) {
		String sql = " insert into funcinfo(functionname,functioninfo,isforbidden,isdelete,createTime) values(?,?,?,?,?)";
		PreparedStatement preparedStatement = null;
		try {
			for (FuncInfo funcInfo : listfuncinfo) {
				preparedStatement = connection.prepareStatement(sql);
				preparedStatement.setString(1, funcInfo.getFunctionname());
				preparedStatement.setString(2, funcInfo.getFunctioninfo());
				preparedStatement.setInt(3, funcInfo.getIsforbidden());
				preparedStatement.setInt(4, funcInfo.getIsdelete());
				preparedStatement.setTimestamp(5, new java.sql.Timestamp(funcInfo.getCreateTime().getTime()));
				preparedStatement.addBatch();
			}
			return preparedStatement.executeBatch().length;
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				if (!preparedStatement.isClosed()) {
					preparedStatement.close();
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		return 0;
	}

	@Override
	public int updateMainSubject(Connection connection, FuncInfo funcInfo) {
		String sql = " update funcinfo set functionname=?,functioninfo=?,isforbidden=?,isdelete=?,createTime=?,modifytime=? where keyid=?";
		PreparedStatement preparedStatement = null;
		try {
			preparedStatement = connection.prepareStatement(sql);
			preparedStatement.setString(1, funcInfo.getFunctionname());
			preparedStatement.setString(2, funcInfo.getFunctioninfo());
			preparedStatement.setInt(3, funcInfo.getIsforbidden());
			preparedStatement.setInt(4, funcInfo.getIsdelete());
			preparedStatement.setTimestamp(5, new java.sql.Timestamp(funcInfo.getCreateTime().getTime()));
			preparedStatement.setString(6, funcInfo.getModifyUser());
			return preparedStatement.executeUpdate();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				if (!preparedStatement.isClosed()) {
					preparedStatement.close();
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		return 0;
	}

	@Override
	public boolean executeSql(Connection connection, String sql) {
		if (sql == null || sql.isEmpty()) {
			return false;
		}

		PreparedStatement preparedStatement = null;

		try {
			preparedStatement = connection.prepareStatement(sql);
			return preparedStatement.execute();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} finally {
			try {
				if (!preparedStatement.isClosed()) {
					preparedStatement.close();
				}
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}

		return false;
	}
}


text:
package ptypes

import (
	"math"
	"testing"
	"time"

	durpb "github.com/docker/swarmkit/api/duration"
	"github.com/golang/protobuf/proto"
)

const (
	minGoSeconds = math.MinInt64 / int64(1e9)
	maxGoSeconds = math.MaxInt64 / int64(1e9)
)

var durationTests = []struct {
	proto   *durpb.Duration
	isValid bool
	inRange bool
	dur     time.Duration
}{
	// The zero duration.
	{&durpb.Duration{0, 0}, true, true, 0},
	// Some ordinary non-zero durations.
	{&durpb.Duration{100, 0}, true, true, 100 * time.Second},
	{&durpb.Duration{-100, 0}, true, true, -100 * time.Second},
	{&durpb.Duration{100, 987}, true, true, 100*time.Second + 987},
	{&durpb.Duration{-100, -987}, true, true, -(100*time.Second + 987)},
	// The largest duration representable in Go.
	{&durpb.Duration{maxGoSeconds, int32(math.MaxInt64 - 1e9*maxGoSeconds)}, true, true, math.MaxInt64},
	// The smallest duration representable in Go.
	{&durpb.Duration{minGoSeconds, int32(math.MinInt64 - 1e9*minGoSeconds)}, true, true, math.MinInt64},
	{nil, false, false, 0},
	{&durpb.Duration{-100, 987}, false, false, 0},
	{&durpb.Duration{100, -987}, false, false, 0},
	{&durpb.Duration{math.MinInt64, 0}, false, false, 0},
	{&durpb.Duration{math.MaxInt64, 0}, false, false, 0},
	// The largest valid duration.
	{&durpb.Duration{maxSeconds, 1e9 - 1}, true, false, 0},
	// The smallest valid duration.
	{&durpb.Duration{minSeconds, -(1e9 - 1)}, true, false, 0},
	// The smallest invalid duration above the valid range.
	{&durpb.Duration{maxSeconds + 1, 0}, false, false, 0},
	// The largest invalid duration below the valid range.
	{&durpb.Duration{minSeconds - 1, -(1e9 - 1)}, false, false, 0},
	// One nanosecond past the largest duration representable in Go.
	{&durpb.Duration{maxGoSeconds, int32(math.MaxInt64-1e9*maxGoSeconds) + 1}, true, false, 0},
	// One nanosecond past the smallest duration representable in Go.
	{&durpb.Duration{minGoSeconds, int32(math.MinInt64-1e9*minGoSeconds) - 1}, true, false, 0},
	// One second past the largest duration representable in Go.
	{&durpb.Duration{maxGoSeconds + 1, int32(math.MaxInt64 - 1e9*maxGoSeconds)}, true, false, 0},
	// One second past the smallest duration representable in Go.
	{&durpb.Duration{minGoSeconds - 1, int32(math.MinInt64 - 1e9*minGoSeconds)}, true, false, 0},
}

func TestValidateDuration(t *testing.T) {
	for _, test := range durationTests {
		err := validateDuration(test.proto)
		gotValid := (err == nil)
		if gotValid != test.isValid {
			t.Errorf("validateDuration(%v) = %t, want %t", test.proto, gotValid, test.isValid)
		}
	}
}

func TestDuration(t *testing.T) {
	for _, test := range durationTests {
		got, err := Duration(test.proto)
		gotOK := (err == nil)
		wantOK := test.isValid && test.inRange
		if gotOK != wantOK {
			t.Errorf("Duration(%v) ok = %t, want %t", test.proto, gotOK, wantOK)
		}
		if err == nil && got != test.dur {
			t.Errorf("Duration(%v) = %v, want %v", test.proto, got, test.dur)
		}
	}
}

func TestDurationProto(t *testing.T) {
	for _, test := range durationTests {
		if test.isValid && test.inRange {
			got := DurationProto(test.dur)
			if !proto.Equal(got, test.proto) {
				t.Errorf("DurationProto(%v) = %v, want %v", test.dur, got, test.proto)
			}
		}
	}
}


text:
{{info.name}} students

    {{student.surname}} {{student.name}} {{student.patronymic}}


text:
namespace FIX44
{

  class MultilegOrderCancelReplace : public Message
  {
  public:
    MultilegOrderCancelReplace() : Message(MsgType()) {}
    MultilegOrderCancelReplace(const FIX::Message& m) : Message(m) {}
    MultilegOrderCancelReplace(const Message& m) : Message(m) {}
    MultilegOrderCancelReplace(const MultilegOrderCancelReplace& m) : Message(m) {}
    static FIX::MsgType MsgType() { return FIX::MsgType("AC"); }

    MultilegOrderCancelReplace(
      const FIX::OrigClOrdID& aOrigClOrdID,
      const FIX::ClOrdID& aClOrdID,
      const FIX::Side& aSide,
      const FIX::TransactTime& aTransactTime,
      const FIX::OrdType& aOrdType )
    : Message(MsgType())
    {
      set(aOrigClOrdID);
      set(aClOrdID);
      set(aSide);
      set(aTransactTime);
      set(aOrdType);
    }

    FIELD_SET(*this, FIX::OrderID);
    FIELD_SET_EX(std::string, OrderID);
    FIELD_SET(*this, FIX::OrigClOrdID);
    FIELD_SET_EX(std::string, OrigClOrdID);
    FIELD_SET(*this, FIX::ClOrdID);
    FIELD_SET_EX(std::string, ClOrdID);
    FIELD_SET(*this, FIX::SecondaryClOrdID);
    FIELD_SET_EX(std::string, SecondaryClOrdID);
    FIELD_SET(*this, FIX::ClOrdLinkID);
    FIELD_SET_EX(std::string, ClOrdLinkID);
    FIELD_SET(*this, FIX::OrigOrdModTime);
    FIELD_SET_EX(FIX::UtcTimeStamp, OrigOrdModTime);
    FIELD_SET(*this, FIX::NoPartyIDs);
    FIELD_SET_EX(int, NoPartyIDs);
    class NoPartyIDs: public FIX::Group
    {
    public:
    NoPartyIDs() : FIX::Group(453,448,FIX::message_order(448,447,452,802,0)) {}
      FIELD_SET(*this, FIX::PartyID);
      FIELD_SET_EX(std::string, PartyID);
      FIELD_SET(*this, FIX::PartyIDSource);
      FIELD_SET_EX(char, PartyIDSource);
      FIELD_SET(*this, FIX::PartyRole);
      FIELD_SET_EX(int, PartyRole);
      FIELD_SET(*this, FIX::NoPartySubIDs);
      FIELD_SET_EX(int, NoPartySubIDs);
      class NoPartySubIDs: public FIX::Group
      {
      public:
      NoPartySubIDs() : FIX::Group(802,523,FIX::message_order(523,803,0)) {}
        FIELD_SET(*this, FIX::PartySubID);
        FIELD_SET_EX(std::string, PartySubID);
        FIELD_SET(*this, FIX::PartySubIDType);
        FIELD_SET_EX(int, PartySubIDType);
      };
    };
    FIELD_SET(*this, FIX::TradeOriginationDate);
    FIELD_SET_EX(std::string, TradeOriginationDate);
    FIELD_SET(*this, FIX::TradeDate);
    FIELD_SET_EX(std::string, TradeDate);
    FIELD_SET(*this, FIX::Account);
    FIELD_SET_EX(std::string, Account);
    FIELD_SET(*this, FIX::AcctIDSource);
    FIELD_SET_EX(int, AcctIDSource);
    FIELD_SET(*this, FIX::AccountType);
    FIELD_SET_EX(int, AccountType);
    FIELD_SET(*this, FIX::DayBookingInst);
    FIELD_SET_EX(char, DayBookingInst);
    FIELD_SET(*this, FIX::BookingUnit);
    FIELD_SET_EX(char, BookingUnit);
    FIELD_SET(*this, FIX::PreallocMethod);
    FIELD_SET_EX(char, PreallocMethod);
    FIELD_SET(*this, FIX::AllocID);
    FIELD_SET_EX(std::string, AllocID);
    FIELD_SET(*this, FIX::SettlType);
    FIELD_SET_EX(std::string, SettlType);
    FIELD_SET(*this, FIX::SettlDate);
    FIELD_SET_EX(std::string, SettlDate);
    FIELD_SET(*this, FIX::CashMargin);
    FIELD_SET_EX(char, CashMargin);
    FIELD_SET(*this, FIX::ClearingFeeIndicator);
    FIELD_SET_EX(std::string, ClearingFeeIndicator);
    FIELD_SET(*this, FIX::HandlInst);
    FIELD_SET_EX(char, HandlInst);
    FIELD_SET(*this, FIX::ExecInst);
    FIELD_SET(*this, FIX::MinQty);
    FIELD_SET_EX(double, MinQty);
    FIELD_SET(*this, FIX::MaxFloor);
    FIELD_SET_EX(double, MaxFloor);
    FIELD_SET(*this, FIX::ExDestination);
    FIELD_SET(*this, FIX::ProcessCode);
    FIELD_SET_EX(char, ProcessCode);
    FIELD_SET(*this, FIX::Side);
    FIELD_SET_EX(char, Side);
    FIELD_SET(*this, FIX::Symbol);
    FIELD_SET_EX(std::string, Symbol);
    FIELD_SET(*this, FIX::SymbolSfx);
    FIELD_SET_EX(std::string, SymbolSfx);
    FIELD_SET(*this, FIX::SecurityID);
    FIELD_SET_EX(std::string, SecurityID);
    FIELD_SET(*this, FIX::SecurityIDSource);
    FIELD_SET_EX(std::string, SecurityIDSource);
    FIELD_SET(*this, FIX::Product);
    FIELD_SET_EX(int, Product);
    FIELD_SET(*this, FIX::CFICode);
    FIELD_SET_EX(std::string, CFICode);
    FIELD_SET(*this, FIX::SecurityType);
    FIELD_SET_EX(std::string, SecurityType);
    FIELD_SET(*this, FIX::SecuritySubType);
    FIELD_SET_EX(std::string, SecuritySubType);
    FIELD_SET(*this, FIX::MaturityMonthYear);
    FIELD_SET(*this, FIX::MaturityDate);
    FIELD_SET_EX(std::string, MaturityDate);
    FIELD_SET(*this, FIX::CouponPaymentDate);
    FIELD_SET_EX(std::string, CouponPaymentDate);
    FIELD_SET(*this, FIX::IssueDate);
    FIELD_SET_EX(std::string, IssueDate);
    FIELD_SET(*this, FIX::RepoCollateralSecurityType);
    FIELD_SET_EX(int, RepoCollateralSecurityType);
    FIELD_SET(*this, FIX::RepurchaseTerm);
    FIELD_SET_EX(int, RepurchaseTerm);
    FIELD_SET(*this, FIX::RepurchaseRate);
    FIELD_SET_EX(double, RepurchaseRate);
    FIELD_SET(*this, FIX::Factor);
    FIELD_SET_EX(double, Factor);
    FIELD_SET(*this, FIX::CreditRating);
    FIELD_SET_EX(std::string, CreditRating);
    FIELD_SET(*this, FIX::InstrRegistry);
    FIELD_SET_EX(std::string, InstrRegistry);
    FIELD_SET(*this, FIX::CountryOfIssue);
    FIELD_SET(*this, FIX::StateOrProvinceOfIssue);
    FIELD_SET_EX(std::string, StateOrProvinceOfIssue);
    FIELD_SET(*this, FIX::LocaleOfIssue);
    FIELD_SET_EX(std::string, LocaleOfIssue);
    FIELD_SET(*this, FIX::RedemptionDate);
    FIELD_SET_EX(std::string, RedemptionDate);
    FIELD_SET(*this, FIX::StrikePrice);
    FIELD_SET_EX(double, StrikePrice);
    FIELD_SET(*this, FIX::StrikeCurrency);
    FIELD_SET_EX(std::string, StrikeCurrency);
    FIELD_SET(*this, FIX::OptAttribute);
    FIELD_SET_EX(char, OptAttribute);
    FIELD_SET(*this, FIX::ContractMultiplier);
    FIELD_SET_EX(double, ContractMultiplier);
    FIELD_SET(*this, FIX::CouponRate);
    FIELD_SET_EX(double, CouponRate);
    FIELD_SET(*this, FIX::SecurityExchange);
    FIELD_SET(*this, FIX::Issuer);
    FIELD_SET_EX(std::string, Issuer);
    FIELD_SET(*this, FIX::EncodedIssuerLen);
    FIELD_SET_EX(int, EncodedIssuerLen);
    FIELD_SET(*this, FIX::EncodedIssuer);
    FIELD_SET_EX(std::string, EncodedIssuer);
    FIELD_SET(*this, FIX::SecurityDesc);
    FIELD_SET_EX(std::string, SecurityDesc);
    FIELD_SET(*this, FIX::EncodedSecurityDescLen);
    FIELD_SET_EX(int, EncodedSecurityDescLen);
    FIELD_SET(*this, FIX::EncodedSecurityDesc);
    FIELD_SET_EX(std::string, EncodedSecurityDesc);
    FIELD_SET(*this, FIX::Pool);
    FIELD_SET_EX(std::string, Pool);
    FIELD_SET(*this, FIX::ContractSettlMonth);
    FIELD_SET(*this, FIX::CPProgram);
    FIELD_SET_EX(int, CPProgram);
    FIELD_SET(*this, FIX::CPRegType);
    FIELD_SET_EX(std::string, CPRegType);
    FIELD_SET(*this, FIX::DatedDate);
    FIELD_SET_EX(std::string, DatedDate);
    FIELD_SET(*this, FIX::InterestAccrualDate);
    FIELD_SET_EX(std::string, InterestAccrualDate);
    FIELD_SET(*this, FIX::NoSecurityAltID);
    FIELD_SET_EX(int, NoSecurityAltID);
    class NoSecurityAltID: public FIX::Group
    {
    public:
    NoSecurityAltID() : FIX::Group(454,455,FIX::message_order(455,456,0)) {}
      FIELD_SET(*this, FIX::SecurityAltID);
      FIELD_SET_EX(std::string, SecurityAltID);
      FIELD_SET(*this, FIX::SecurityAltIDSource);
      FIELD_SET_EX(std::string, SecurityAltIDSource);
    };
    FIELD_SET(*this, FIX::NoEvents);
    FIELD_SET_EX(int, NoEvents);
    class NoEvents: public FIX::Group
    {
    public:
    NoEvents() : FIX::Group(864,865,FIX::message_order(865,866,867,868,0)) {}
      FIELD_SET(*this, FIX::EventType);
      FIELD_SET_EX(int, EventType);
      FIELD_SET(*this, FIX::EventDate);
      FIELD_SET_EX(std::string, EventDate);
      FIELD_SET(*this, FIX::EventPx);
      FIELD_SET_EX(double, EventPx);
      FIELD_SET(*this, FIX::EventText);
      FIELD_SET_EX(std::string, EventText);
    };
    FIELD_SET(*this, FIX::PrevClosePx);
    FIELD_SET_EX(double, PrevClosePx);
    FIELD_SET(*this, FIX::LocateReqd);
    FIELD_SET_EX(bool, LocateReqd);
    FIELD_SET(*this, FIX::TransactTime);
    FIELD_SET_EX(FIX::UtcTimeStamp, TransactTime);
    FIELD_SET(*this, FIX::QtyType);
    FIELD_SET_EX(int, QtyType);
    FIELD_SET(*this, FIX::OrderQty);
    FIELD_SET_EX(double, OrderQty);
    FIELD_SET(*this, FIX::CashOrderQty);
    FIELD_SET_EX(double, CashOrderQty);
    FIELD_SET(*this, FIX::OrderPercent);
    FIELD_SET_EX(double, OrderPercent);
    FIELD_SET(*this, FIX::RoundingDirection);
    FIELD_SET_EX(char, RoundingDirection);
    FIELD_SET(*this, FIX::RoundingModulus);
    FIELD_SET_EX(double, RoundingModulus);
    FIELD_SET(*this, FIX::OrdType);
    FIELD_SET_EX(char, OrdType);
    FIELD_SET(*this, FIX::PriceType);
    FIELD_SET_EX(int, PriceType);
    FIELD_SET(*this, FIX::Price);
    FIELD_SET_EX(double, Price);
    FIELD_SET(*this, FIX::StopPx);
    FIELD_SET_EX(double, StopPx);
    FIELD_SET(*this, FIX::Currency);
    FIELD_SET_EX(std::string, Currency);
    FIELD_SET(*this, FIX::ComplianceID);
    FIELD_SET_EX(std::string, ComplianceID);
    FIELD_SET(*this, FIX::SolicitedFlag);
    FIELD_SET_EX(bool, SolicitedFlag);
    FIELD_SET(*this, FIX::IOIID);
    FIELD_SET_EX(std::string, IOIID);
    FIELD_SET(*this, FIX::QuoteID);
    FIELD_SET_EX(std::string, QuoteID);
    FIELD_SET(*this, FIX::TimeInForce);
    FIELD_SET_EX(char, TimeInForce);
    FIELD_SET(*this, FIX::EffectiveTime);
    FIELD_SET_EX(FIX::UtcTimeStamp, EffectiveTime);
    FIELD_SET(*this, FIX::ExpireDate);
    FIELD_SET_EX(std::string, ExpireDate);
    FIELD_SET(*this, FIX::ExpireTime);
    FIELD_SET_EX(FIX::UtcTimeStamp, ExpireTime);
    FIELD_SET(*this, FIX::GTBookingInst);
    FIELD_SET_EX(int, GTBookingInst);
    FIELD_SET(*this, FIX::Commission);
    FIELD_SET_EX(double, Commission);
    FIELD_SET(*this, FIX::CommType);
    FIELD_SET_EX(char, CommType);
    FIELD_SET(*this, FIX::CommCurrency);
    FIELD_SET_EX(std::string, CommCurrency);
    FIELD_SET(*this, FIX::FundRenewWaiv);
    FIELD_SET_EX(char, FundRenewWaiv);
    FIELD_SET(*this, FIX::OrderCapacity);
    FIELD_SET_EX(char, OrderCapacity);
    FIELD_SET(*this, FIX::OrderRestrictions);
    FIELD_SET(*this, FIX::CustOrderCapacity);
    FIELD_SET_EX(int, CustOrderCapacity);
    FIELD_SET(*this, FIX::ForexReq);
    FIELD_SET_EX(bool, ForexReq);
    FIELD_SET(*this, FIX::SettlCurrency);
    FIELD_SET_EX(std::string, SettlCurrency);
    FIELD_SET(*this, FIX::BookingType);
    FIELD_SET_EX(int, BookingType);
    FIELD_SET(*this, FIX::Text);
    FIELD_SET_EX(std::string, Text);
    FIELD_SET(*this, FIX::EncodedTextLen);
    FIELD_SET_EX(int, EncodedTextLen);
    FIELD_SET(*this, FIX::EncodedText);
    FIELD_SET_EX(std::string, EncodedText);
    FIELD_SET(*this, FIX::PositionEffect);
    FIELD_SET_EX(char, PositionEffect);
    FIELD_SET(*this, FIX::CoveredOrUncovered);
    FIELD_SET_EX(int, CoveredOrUncovered);
    FIELD_SET(*this, FIX::MaxShow);
    FIELD_SET_EX(double, MaxShow);
    FIELD_SET(*this, FIX::PegOffsetValue);
    FIELD_SET_EX(double, PegOffsetValue);
    FIELD_SET(*this, FIX::PegMoveType);
    FIELD_SET_EX(int, PegMoveType);
    FIELD_SET(*this, FIX::PegOffsetType);
    FIELD_SET_EX(int, PegOffsetType);
    FIELD_SET(*this, FIX::PegLimitType);
    FIELD_SET_EX(int, PegLimitType);
    FIELD_SET(*this, FIX::PegRoundDirection);
    FIELD_SET_EX(int, PegRoundDirection);
    FIELD_SET(*this, FIX::PegScope);
    FIELD_SET_EX(int, PegScope);
    FIELD_SET(*this, FIX::DiscretionInst);
    FIELD_SET_EX(char, DiscretionInst);
    FIELD_SET(*this, FIX::DiscretionOffsetValue);
    FIELD_SET_EX(double, DiscretionOffsetValue);
    FIELD_SET(*this, FIX::DiscretionMoveType);
    FIELD_SET_EX(int, DiscretionMoveType);
    FIELD_SET(*this, FIX::DiscretionOffsetType);
    FIELD_SET_EX(int, DiscretionOffsetType);
    FIELD_SET(*this, FIX::DiscretionLimitType);
    FIELD_SET_EX(int, DiscretionLimitType);
    FIELD_SET(*this, FIX::DiscretionRoundDirection);
    FIELD_SET_EX(int, DiscretionRoundDirection);
    FIELD_SET(*this, FIX::DiscretionScope);
    FIELD_SET_EX(int, DiscretionScope);
    FIELD_SET(*this, FIX::TargetStrategy);
    FIELD_SET_EX(int, TargetStrategy);
    FIELD_SET(*this, FIX::TargetStrategyParameters);
    FIELD_SET_EX(std::string, TargetStrategyParameters);
    FIELD_SET(*this, FIX::ParticipationRate);
    FIELD_SET_EX(double, ParticipationRate);
    FIELD_SET(*this, FIX::CancellationRights);
    FIELD_SET_EX(char, CancellationRights);
    FIELD_SET(*this, FIX::MoneyLaunderingStatus);
    FIELD_SET_EX(char, MoneyLaunderingStatus);
    FIELD_SET(*this, FIX::RegistID);
    FIELD_SET_EX(std::string, RegistID);
    FIELD_SET(*this, FIX::Designation);
    FIELD_SET_EX(std::string, Designation);
    FIELD_SET(*this, FIX::MultiLegRptTypeReq);
    FIELD_SET_EX(int, MultiLegRptTypeReq);
    FIELD_SET(*this, FIX::NoAllocs);
    FIELD_SET_EX(int, NoAllocs);
    class NoAllocs: public FIX::Group
    {
    public:
    NoAllocs() : FIX::Group(78,79,FIX::message_order(79,661,736,467,948,80,0)) {}
      FIELD_SET(*this, FIX::AllocAccount);
      FIELD_SET_EX(std::string, AllocAccount);
      FIELD_SET(*this, FIX::AllocAcctIDSource);
      FIELD_SET_EX(int, AllocAcctIDSource);
      FIELD_SET(*this, FIX::AllocSettlCurrency);
      FIELD_SET_EX(std::string, AllocSettlCurrency);
      FIELD_SET(*this, FIX::IndividualAllocID);
      FIELD_SET_EX(std::string, IndividualAllocID);
      FIELD_SET(*this, FIX::NoNested3PartyIDs);
      FIELD_SET_EX(int, NoNested3PartyIDs);
      class NoNested3PartyIDs: public FIX::Group
      {
      public:
      NoNested3PartyIDs() : FIX::Group(948,949,FIX::message_order(949,950,951,952,0)) {}
        FIELD_SET(*this, FIX::Nested3PartyID);
        FIELD_SET_EX(std::string, Nested3PartyID);
        FIELD_SET(*this, FIX::Nested3PartyIDSource);
        FIELD_SET_EX(char, Nested3PartyIDSource);
        FIELD_SET(*this, FIX::Nested3PartyRole);
        FIELD_SET_EX(int, Nested3PartyRole);
        FIELD_SET(*this, FIX::NoNested3PartySubIDs);
        FIELD_SET_EX(int, NoNested3PartySubIDs);
        class NoNested3PartySubIDs: public FIX::Group
        {
        public:
        NoNested3PartySubIDs() : FIX::Group(952,953,FIX::message_order(953,954,0)) {}
          FIELD_SET(*this, FIX::Nested3PartySubID);
          FIELD_SET_EX(std::string, Nested3PartySubID);
          FIELD_SET(*this, FIX::Nested3PartySubIDType);
          FIELD_SET_EX(int, Nested3PartySubIDType);
        };
      };
      FIELD_SET(*this, FIX::AllocQty);
      FIELD_SET_EX(double, AllocQty);
    };
    FIELD_SET(*this, FIX::NoTradingSessions);
    FIELD_SET_EX(int, NoTradingSessions);
    class NoTradingSessions: public FIX::Group
    {
    public:
    NoTradingSessions() : FIX::Group(386,336,FIX::message_order(336,625,0)) {}
      FIELD_SET(*this, FIX::TradingSessionID);
      FIELD_SET_EX(std::string, TradingSessionID);
      FIELD_SET(*this, FIX::TradingSessionSubID);
      FIELD_SET_EX(std::string, TradingSessionSubID);
    };
    FIELD_SET(*this, FIX::NoUnderlyings);
    FIELD_SET_EX(int, NoUnderlyings);
    class NoUnderlyings: public FIX::Group
    {
    public:
    NoUnderlyings() : FIX::Group(711,311,FIX::message_order(311,312,309,305,457,462,463,310,763,313,542,241,242,243,244,245,246,256,595,592,593,594,247,316,941,317,436,435,308,306,362,363,307,364,365,877,878,318,879,810,882,883,884,885,886,0)) {}
      FIELD_SET(*this, FIX::UnderlyingSymbol);
      FIELD_SET_EX(std::string, UnderlyingSymbol);
      FIELD_SET(*this, FIX::UnderlyingSymbolSfx);
      FIELD_SET_EX(std::string, UnderlyingSymbolSfx);
      FIELD_SET(*this, FIX::UnderlyingSecurityID);
      FIELD_SET_EX(std::string, UnderlyingSecurityID);
      FIELD_SET(*this, FIX::UnderlyingSecurityIDSource);
      FIELD_SET_EX(std::string, UnderlyingSecurityIDSource);
      FIELD_SET(*this, FIX::UnderlyingProduct);
      FIELD_SET_EX(int, UnderlyingProduct);
      FIELD_SET(*this, FIX::UnderlyingCFICode);
      FIELD_SET_EX(std::string, UnderlyingCFICode);
      FIELD_SET(*this, FIX::UnderlyingSecurityType);
      FIELD_SET_EX(std::string, UnderlyingSecurityType);
      FIELD_SET(*this, FIX::UnderlyingSecuritySubType);
      FIELD_SET_EX(std::string, UnderlyingSecuritySubType);
      FIELD_SET(*this, FIX::UnderlyingMaturityMonthYear);
      FIELD_SET(*this, FIX::UnderlyingMaturityDate);
      FIELD_SET_EX(std::string, UnderlyingMaturityDate);
      FIELD_SET(*this, FIX::UnderlyingCouponPaymentDate);
      FIELD_SET_EX(std::string, UnderlyingCouponPaymentDate);
      FIELD_SET(*this, FIX::UnderlyingIssueDate);
      FIELD_SET_EX(std::string, UnderlyingIssueDate);
      FIELD_SET(*this, FIX::UnderlyingRepoCollateralSecurityType);
      FIELD_SET_EX(int, UnderlyingRepoCollateralSecurityType);
      FIELD_SET(*this, FIX::UnderlyingRepurchaseTerm);
      FIELD_SET_EX(int, UnderlyingRepurchaseTerm);
      FIELD_SET(*this, FIX::UnderlyingRepurchaseRate);
      FIELD_SET_EX(double, UnderlyingRepurchaseRate);
      FIELD_SET(*this, FIX::UnderlyingFactor);
      FIELD_SET_EX(double, UnderlyingFactor);
      FIELD_SET(*this, FIX::UnderlyingCreditRating);
      FIELD_SET_EX(std::string, UnderlyingCreditRating);
      FIELD_SET(*this, FIX::UnderlyingInstrRegistry);
      FIELD_SET_EX(std::string, UnderlyingInstrRegistry);
      FIELD_SET(*this, FIX::UnderlyingCountryOfIssue);
      FIELD_SET(*this, FIX::UnderlyingStateOrProvinceOfIssue);
      FIELD_SET_EX(std::string, UnderlyingStateOrProvinceOfIssue);
      FIELD_SET(*this, FIX::UnderlyingLocaleOfIssue);
      FIELD_SET_EX(std::string, UnderlyingLocaleOfIssue);
      FIELD_SET(*this, FIX::UnderlyingRedemptionDate);
      FIELD_SET_EX(std::string, UnderlyingRedemptionDate);
      FIELD_SET(*this, FIX::UnderlyingStrikePrice);
      FIELD_SET_EX(double, UnderlyingStrikePrice);
      FIELD_SET(*this, FIX::UnderlyingStrikeCurrency);
      FIELD_SET_EX(std::string, UnderlyingStrikeCurrency);
      FIELD_SET(*this, FIX::UnderlyingOptAttribute);
      FIELD_SET_EX(char, UnderlyingOptAttribute);
      FIELD_SET(*this, FIX::UnderlyingContractMultiplier);
      FIELD_SET_EX(double, UnderlyingContractMultiplier);
      FIELD_SET(*this, FIX::UnderlyingCouponRate);
      FIELD_SET_EX(double, UnderlyingCouponRate);
      FIELD_SET(*this, FIX::UnderlyingSecurityExchange);
      FIELD_SET(*this, FIX::UnderlyingIssuer);
      FIELD_SET_EX(std::string, UnderlyingIssuer);
      FIELD_SET(*this, FIX::EncodedUnderlyingIssuerLen);
      FIELD_SET_EX(int, EncodedUnderlyingIssuerLen);
      FIELD_SET(*this, FIX::EncodedUnderlyingIssuer);
      FIELD_SET_EX(std::string, EncodedUnderlyingIssuer);
      FIELD_SET(*this, FIX::UnderlyingSecurityDesc);
      FIELD_SET_EX(std::string, UnderlyingSecurityDesc);
      FIELD_SET(*this, FIX::EncodedUnderlyingSecurityDescLen);
      FIELD_SET_EX(int, EncodedUnderlyingSecurityDescLen);
      FIELD_SET(*this, FIX::EncodedUnderlyingSecurityDesc);
      FIELD_SET_EX(std::string, EncodedUnderlyingSecurityDesc);
      FIELD_SET(*this, FIX::UnderlyingCPProgram);
      FIELD_SET_EX(std::string, UnderlyingCPProgram);
      FIELD_SET(*this, FIX::UnderlyingCPRegType);
      FIELD_SET_EX(std::string, UnderlyingCPRegType);
      FIELD_SET(*this, FIX::UnderlyingCurrency);
      FIELD_SET_EX(std::string, UnderlyingCurrency);
      FIELD_SET(*this, FIX::UnderlyingQty);
      FIELD_SET_EX(double, UnderlyingQty);
      FIELD_SET(*this, FIX::UnderlyingPx);
      FIELD_SET_EX(double, UnderlyingPx);
      FIELD_SET(*this, FIX::UnderlyingDirtyPrice);
      FIELD_SET_EX(double, UnderlyingDirtyPrice);
      FIELD_SET(*this, FIX::UnderlyingEndPrice);
      FIELD_SET_EX(double, UnderlyingEndPrice);
      FIELD_SET(*this, FIX::UnderlyingStartValue);
      FIELD_SET_EX(double, UnderlyingStartValue);
      FIELD_SET(*this, FIX::UnderlyingCurrentValue);
      FIELD_SET_EX(double, UnderlyingCurrentValue);
      FIELD_SET(*this, FIX::UnderlyingEndValue);
      FIELD_SET_EX(double, UnderlyingEndValue);
      FIELD_SET(*this, FIX::NoUnderlyingSecurityAltID);
      FIELD_SET_EX(int, NoUnderlyingSecurityAltID);
      class NoUnderlyingSecurityAltID: public FIX::Group
      {
      public:
      NoUnderlyingSecurityAltID() : FIX::Group(457,458,FIX::message_order(458,459,0)) {}
        FIELD_SET(*this, FIX::UnderlyingSecurityAltID);
        FIELD_SET_EX(std::string, UnderlyingSecurityAltID);
        FIELD_SET(*this, FIX::UnderlyingSecurityAltIDSource);
        FIELD_SET_EX(std::string, UnderlyingSecurityAltIDSource);
      };
    };
    FIELD_SET(*this, FIX::NoLegs);
    FIELD_SET_EX(int, NoLegs);
    class NoLegs: public FIX::Group
    {
    public:
    NoLegs() : FIX::Group(555,600,FIX::message_order(600,601,602,603,604,607,608,609,764,610,611,248,249,250,251,252,253,257,599,596,597,598,254,612,942,613,614,615,616,617,618,619,620,621,622,623,624,556,740,739,955,956,687,690,683,670,564,565,539,654,566,587,588,0)) {}
      FIELD_SET(*this, FIX::LegSymbol);
      FIELD_SET_EX(std::string, LegSymbol);
      FIELD_SET(*this, FIX::LegSymbolSfx);
      FIELD_SET_EX(std::string, LegSymbolSfx);
      FIELD_SET(*this, FIX::LegSecurityID);
      FIELD_SET_EX(std::string, LegSecurityID);
      FIELD_SET(*this, FIX::LegSecurityIDSource);
      FIELD_SET_EX(std::string, LegSecurityIDSource);
      FIELD_SET(*this, FIX::LegProduct);
      FIELD_SET_EX(int, LegProduct);
      FIELD_SET(*this, FIX::LegCFICode);
      FIELD_SET_EX(std::string, LegCFICode);
      FIELD_SET(*this, FIX::LegSecurityType);
      FIELD_SET_EX(std::string, LegSecurityType);
      FIELD_SET(*this, FIX::LegSecuritySubType);
      FIELD_SET_EX(std::string, LegSecuritySubType);
      FIELD_SET(*this, FIX::LegMaturityMonthYear);
      FIELD_SET(*this, FIX::LegMaturityDate);
      FIELD_SET_EX(std::string, LegMaturityDate);
      FIELD_SET(*this, FIX::LegCouponPaymentDate);
      FIELD_SET_EX(std::string, LegCouponPaymentDate);
      FIELD_SET(*this, FIX::LegIssueDate);
      FIELD_SET_EX(std::string, LegIssueDate);
      FIELD_SET(*this, FIX::LegRepoCollateralSecurityType);
      FIELD_SET_EX(int, LegRepoCollateralSecurityType);
      FIELD_SET(*this, FIX::LegRepurchaseTerm);
      FIELD_SET_EX(int, LegRepurchaseTerm);
      FIELD_SET(*this, FIX::LegRepurchaseRate);
      FIELD_SET_EX(double, LegRepurchaseRate);
      FIELD_SET(*this, FIX::LegFactor);
      FIELD_SET_EX(double, LegFactor);
      FIELD_SET(*this, FIX::LegCreditRating);
      FIELD_SET_EX(std::string, LegCreditRating);
      FIELD_SET(*this, FIX::LegInstrRegistry);
      FIELD_SET_EX(std::string, LegInstrRegistry);
      FIELD_SET(*this, FIX::LegCountryOfIssue);
      FIELD_SET(*this, FIX::LegStateOrProvinceOfIssue);
      FIELD_SET_EX(std::string, LegStateOrProvinceOfIssue);
      FIELD_SET(*this, FIX::LegLocaleOfIssue);
      FIELD_SET_EX(std::string, LegLocaleOfIssue);
      FIELD_SET(*this, FIX::LegRedemptionDate);
      FIELD_SET_EX(std::string, LegRedemptionDate);
      FIELD_SET(*this, FIX::LegStrikePrice);
      FIELD_SET_EX(double, LegStrikePrice);
      FIELD_SET(*this, FIX::LegStrikeCurrency);
      FIELD_SET_EX(std::string, LegStrikeCurrency);
      FIELD_SET(*this, FIX::LegOptAttribute);
      FIELD_SET_EX(char, LegOptAttribute);
      FIELD_SET(*this, FIX::LegContractMultiplier);
      FIELD_SET_EX(double, LegContractMultiplier);
      FIELD_SET(*this, FIX::LegCouponRate);
      FIELD_SET_EX(double, LegCouponRate);
      FIELD_SET(*this, FIX::LegSecurityExchange);
      FIELD_SET(*this, FIX::LegIssuer);
      FIELD_SET_EX(std::string, LegIssuer);
      FIELD_SET(*this, FIX::EncodedLegIssuerLen);
      FIELD_SET_EX(int, EncodedLegIssuerLen);
      FIELD_SET(*this, FIX::EncodedLegIssuer);
      FIELD_SET_EX(std::string, EncodedLegIssuer);
      FIELD_SET(*this, FIX::LegSecurityDesc);
      FIELD_SET_EX(std::string, LegSecurityDesc);
      FIELD_SET(*this, FIX::EncodedLegSecurityDescLen);
      FIELD_SET_EX(int, EncodedLegSecurityDescLen);
      FIELD_SET(*this, FIX::EncodedLegSecurityDesc);
      FIELD_SET_EX(std::string, EncodedLegSecurityDesc);
      FIELD_SET(*this, FIX::LegRatioQty);
      FIELD_SET_EX(double, LegRatioQty);
      FIELD_SET(*this, FIX::LegSide);
      FIELD_SET_EX(char, LegSide);
      FIELD_SET(*this, FIX::LegCurrency);
      FIELD_SET_EX(std::string, LegCurrency);
      FIELD_SET(*this, FIX::LegPool);
      FIELD_SET_EX(std::string, LegPool);
      FIELD_SET(*this, FIX::LegDatedDate);
      FIELD_SET_EX(std::string, LegDatedDate);
      FIELD_SET(*this, FIX::LegContractSettlMonth);
      FIELD_SET(*this, FIX::LegInterestAccrualDate);
      FIELD_SET_EX(std::string, LegInterestAccrualDate);
      FIELD_SET(*this, FIX::NoLegSecurityAltID);
      FIELD_SET_EX(std::string, NoLegSecurityAltID);
      class NoLegSecurityAltID: public FIX::Group
      {
      public:
      NoLegSecurityAltID() : FIX::Group(604,605,FIX::message_order(605,606,0)) {}
        FIELD_SET(*this, FIX::LegSecurityAltID);
        FIELD_SET_EX(std::string, LegSecurityAltID);
        FIELD_SET(*this, FIX::LegSecurityAltIDSource);
        FIELD_SET_EX(std::string, LegSecurityAltIDSource);
      };
      FIELD_SET(*this, FIX::LegQty);
      FIELD_SET_EX(double, LegQty);
      FIELD_SET(*this, FIX::LegSwapType);
      FIELD_SET_EX(int, LegSwapType);
      FIELD_SET(*this, FIX::NoLegStipulations);
      FIELD_SET_EX(int, NoLegStipulations);
      class NoLegStipulations: public FIX::Group
      {
      public:
      NoLegStipulations() : FIX::Group(683,688,FIX::message_order(688,689,0)) {}
        FIELD_SET(*this, FIX::LegStipulationType);
        FIELD_SET_EX(std::string, LegStipulationType);
        FIELD_SET(*this, FIX::LegStipulationValue);
        FIELD_SET_EX(std::string, LegStipulationValue);
      };
      FIELD_SET(*this, FIX::LegPositionEffect);
      FIELD_SET_EX(char, LegPositionEffect);
      FIELD_SET(*this, FIX::LegCoveredOrUncovered);
      FIELD_SET_EX(int, LegCoveredOrUncovered);
      FIELD_SET(*this, FIX::NoNestedPartyIDs);
      FIELD_SET_EX(int, NoNestedPartyIDs);
      class NoNestedPartyIDs: public FIX::Group
      {
      public:
      NoNestedPartyIDs() : FIX::Group(539,524,FIX::message_order(524,525,538,804,0)) {}
        FIELD_SET(*this, FIX::NestedPartyID);
        FIELD_SET_EX(std::string, NestedPartyID);
        FIELD_SET(*this, FIX::NestedPartyIDSource);
        FIELD_SET_EX(char, NestedPartyIDSource);
        FIELD_SET(*this, FIX::NestedPartyRole);
        FIELD_SET_EX(int, NestedPartyRole);
        FIELD_SET(*this, FIX::NoNestedPartySubIDs);
        FIELD_SET_EX(int, NoNestedPartySubIDs);
        class NoNestedPartySubIDs: public FIX::Group
        {
        public:
        NoNestedPartySubIDs() : FIX::Group(804,545,FIX::message_order(545,805,0)) {}
          FIELD_SET(*this, FIX::NestedPartySubID);
          FIELD_SET_EX(std::string, NestedPartySubID);
          FIELD_SET(*this, FIX::NestedPartySubIDType);
          FIELD_SET_EX(int, NestedPartySubIDType);
        };
      };
      FIELD_SET(*this, FIX::LegRefID);
      FIELD_SET_EX(std::string, LegRefID);
      FIELD_SET(*this, FIX::LegPrice);
      FIELD_SET_EX(double, LegPrice);
      FIELD_SET(*this, FIX::LegSettlType);
      FIELD_SET_EX(char, LegSettlType);
      FIELD_SET(*this, FIX::LegSettlDate);
      FIELD_SET_EX(std::string, LegSettlDate);
      FIELD_SET(*this, FIX::NoLegAllocs);
      FIELD_SET_EX(int, NoLegAllocs);
      class NoLegAllocs: public FIX::Group
      {
      public:
      NoLegAllocs() : FIX::Group(670,671,FIX::message_order(671,672,756,673,674,675,0)) {}
        FIELD_SET(*this, FIX::LegAllocAccount);
        FIELD_SET_EX(std::string, LegAllocAccount);
        FIELD_SET(*this, FIX::LegIndividualAllocID);
        FIELD_SET_EX(std::string, LegIndividualAllocID);
        FIELD_SET(*this, FIX::NoNested2PartyIDs);
        FIELD_SET_EX(int, NoNested2PartyIDs);
        class NoNested2PartyIDs: public FIX::Group
        {
        public:
        NoNested2PartyIDs() : FIX::Group(756,757,FIX::message_order(757,758,759,806,0)) {}
          FIELD_SET(*this, FIX::Nested2PartyID);
          FIELD_SET_EX(std::string, Nested2PartyID);
          FIELD_SET(*this, FIX::Nested2PartyIDSource);
          FIELD_SET_EX(char, Nested2PartyIDSource);
          FIELD_SET(*this, FIX::Nested2PartyRole);
          FIELD_SET_EX(int, Nested2PartyRole);
          FIELD_SET(*this, FIX::NoNested2PartySubIDs);
          FIELD_SET_EX(int, NoNested2PartySubIDs);
          class NoNested2PartySubIDs: public FIX::Group
          {
          public:
          NoNested2PartySubIDs() : FIX::Group(806,760,FIX::message_order(760,807,0)) {}
            FIELD_SET(*this, FIX::Nested2PartySubID);
            FIELD_SET_EX(std::string, Nested2PartySubID);
            FIELD_SET(*this, FIX::Nested2PartySubIDType);
            FIELD_SET_EX(int, Nested2PartySubIDType);
          };
        };
        FIELD_SET(*this, FIX::LegAllocQty);
        FIELD_SET_EX(double, LegAllocQty);
        FIELD_SET(*this, FIX::LegAllocAcctIDSource);
        FIELD_SET_EX(std::string, LegAllocAcctIDSource);
        FIELD_SET(*this, FIX::LegSettlCurrency);
        FIELD_SET_EX(std::string, LegSettlCurrency);
      };
    };
  };

}

#endif


text:
import { css, SerializedStyles } from '@emotion/react';
import { colors } from '~client/styled/variables';

export const breakpointBase = (size: number): string => `only screen and (min-width: ${size}px)`;
export const breakpoint = (size: number): string => `@media ${breakpointBase(size)}`;

export const diagonalBg = (size = 16): SerializedStyles => css`
  background-image: linear-gradient(
    45deg,
    ${colors.translucent.dark.light} 25%,
    transparent 25%,
    transparent 50%,
    ${colors.translucent.dark.light} 50%,
    ${colors.translucent.dark.light} 75%,
    transparent 75%,
    transparent 0
  );
  background-size: ${size}px ${size}px;
`;

export const unimportant = css`
  color: ${colors.dark.light};
  font-style: italic;
`;


text:
package org.apache.ofbiz.base.start;

import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;

import java.util.List;

import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;

public class OfbizStartupUnitTests {

    @Rule
    public ExpectedException expectedException = ExpectedException.none();

    @Test
    public void commandParserDoesNotAcceptMoreThanOneCommand() throws StartupException {
        expectedException.expectMessage("an option from this group has already been selected");

        StartupCommandUtil.parseOfbizCommands(new String[]{"--help", "--status"});
    }

    @Test
    public void commandParserDoesNotAcceptPortoffsetWithoutArgument() throws StartupException {
        expectedException.expectMessage("Missing argument for option");

        StartupCommandUtil.parseOfbizCommands(new String[]{"--portoffset"});
    }

    @Test
    public void commandParserDoesNotAcceptPortoffsetWithoutPositiveInteger() throws StartupException {
        expectedException.expectMessage("you can only pass positive integers");

        StartupCommandUtil.parseOfbizCommands(new String[]{"--portoffset", "ThisMustBeInteger54321"});
    }

    @Test
    public void commandParserDoesNotAcceptArgumentForStatus() throws StartupException {
        expectedException.expectMessage("unrecognized options / properties");

        StartupCommandUtil.parseOfbizCommands(new String[]{"--status", "thisArgNotAllowed"});
    }

    @Test
    public void commandParserDoesNotAcceptArgumentForStart() throws StartupException {
        expectedException.expectMessage("unrecognized options / properties");

        StartupCommandUtil.parseOfbizCommands(new String[]{"--start", "thisArgNotAllowed"});
    }

    @Test
    public void commandParserDoesNotAcceptArgumentForShutdown() throws StartupException {
        expectedException.expectMessage("unrecognized options / properties");

        StartupCommandUtil.parseOfbizCommands(new String[]{"--shutdown", "thisArgNotAllowed"});
    }

    @Test
    public void commandParserCombinesMultipleArgsIntoOneCommand() throws StartupException {
        String[] multiArgCommand = new String[] {
                "--load-data", "readers=seed,seed-initial",
                "--load-data", "delegator=default",
                "-l", "timeout=7200" };

        List<StartupCommand> startupCommands = StartupCommandUtil.parseOfbizCommands(multiArgCommand);

        assertThat(startupCommands.size(), equalTo(1));
        assertThat(startupCommands.get(0).getProperties().size(), equalTo(3));
    }
}


text:
from Tkinter import *
import tkMessageBox

class MyWindow:
  def __init__(self, myParent):
    self.myContainer = Frame(myParent)
    self.myContainer.grid()
    self.makeLayout()
    self.currentPlayer = 1

  def makeLayout(self):
    self.currentPlayer = 1
    self.label = Label(self.myContainer, text="Tic-Tac-Toe")
    self.label.grid(row=0, column=1, columnspan=3)

    self.whoseTurn = Label(self.myContainer, text="It is Player 1's turn")
    self.whoseTurn.grid(row=4, column=1, columnspan=3)

    self.buttons = {}
    for i in range(9):
      self.buttons[i] = Button(self.myContainer, text="", width=1, height=1, command=lambda x=i: self.tic(x) )
      self.buttons[i].grid(row=i/3+1, column=i%3+1)

  def tic(self, x):
    button = self.buttons[x]
    if (self.currentPlayer==1) and (button["text"]==""):
      button["text"] = "X"
      self.checkWin(x)
      self.currentPlayer = 2
      self.whoseTurn["text"] = "It is Player 2's turn"
    elif (self.currentPlayer==2) and (button["text"]==""):
      button["text"] = "O"
      self.checkWin(x)
      self.currentPlayer = 1
      self.whoseTurn["text"] = "It is Player 1's turn"
    else: tkMessageBox.showinfo('For shame', "I have no idea who you are!")

  def checkWin(self, x):
    col = self.checkCol(x)
    row = self.checkRow(x)
    diag = self.checkDiag(x)
    if col or row or diag:
      if self.currentPlayer == 1:
        winner = "Player 1"
      else: winner = "Player 2"
      tkMessageBox.showinfo('Message', winner + " won!")
      self.makeLayout()
    if self.checkFull():
      tkMessageBox.showinfo('Message', "The cat won!")
      self.makeLayout()

  def checkCol(self, x):
    if 0<=x<=2: b = [x+3, x+6]
    elif 3<=x<=5: b = [x-3, x+3]
    else: b = [x-3, x-6]
    return self.buttons[x]["text"] ==self.buttons[b[0]]["text"]==self.buttons[b[1]]["text"]

  def checkRow(self, x):
    if x%3 == 0: b = [x+1, x+2]
    elif x%3 == 1: b = [x-1, x+1]
    else: b = [x-1, x-2]
    return self.buttons[x]["text"] ==self.buttons[b[0]]["text"]==self.buttons[b[1]]["text"]

  def checkDiag(self, x):
    if x%2 != 0: return False
    offDiag = (self.buttons[2]["text"] == self.buttons[4]["text"] == self.buttons[6]["text"]) and (self.buttons[4]["text"] != "")
    onDiag = (self.buttons[0]["text"] == self.buttons[4]["text"] == self.buttons[8]["text"]) and (self.buttons[4]["text"] != "")
    return onDiag or offDiag

  def checkFull(self):
    isFull = []
    for button in self.buttons:
      isFull.append( self.buttons[button]["text"] != "" )
    full = True
    for f in isFull:
      full = full and f
    return full

root = Tk()
root.geometry('400x300+150+40')
window = MyWindow(root)
root.title('Our Game')
root.mainloop()


text:
using System;
using System.Diagnostics;
using System.Globalization;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using tainicom.Aether.Animation;
using tainicom.Aether.Shaders.Components;

namespace Samples.Animation
{
    enum DrawMode : int
    {
        CPU,
        GPU,
    }

    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        SpriteFont font;
        InfiniteGridComponent grid;

        Model _model_CPU;
        Model _model_GPU;
        Animations _animations;
        DrawMode drawMode = DrawMode.CPU;

        KeyboardState prevKeyboardState;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        protected override void Initialize()
        {
            base.Initialize();
        }

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font = Content.Load<SpriteFont>("font");

            grid = new InfiniteGridComponent(GraphicsDevice, Content);
            grid.Initialize();

            _model_CPU = Content.Load<Model>("Dude/dude");
            _model_GPU = Content.Load<Model>("Dude/dude_GPU");

            _animations = _model_CPU.GetAnimations(); // Animation Data are the same between the two models
            var clip = _animations.Clips["Take 001"];
            _animations.SetClip(clip);
        }

        protected override void UnloadContent()
        {
        }

        protected override void Update(GameTime gameTime)
        {
            var keyboardState = Keyboard.GetState();
            var gamePadState = GamePad.GetState(PlayerIndex.One);

            // Allows the game to exit
            if (keyboardState.IsKeyDown(Keys.Escape) || gamePadState.Buttons.Back == ButtonState.Pressed)
                this.Exit();

            if ((keyboardState.IsKeyDown(Keys.Space) && prevKeyboardState.IsKeyUp(Keys.Space)) || gamePadState.Buttons.A == ButtonState.Pressed)
            {
                int drawModesCount = Enum.GetValues(drawMode.GetType()).Length;
                drawMode = (DrawMode)(((int)drawMode + 1) % drawModesCount);
            }

            prevKeyboardState = keyboardState;

            _animations.Update(gameTime.ElapsedGameTime, true, Matrix.Identity);

            base.Update(gameTime);
        }

        private Vector3 Position = Vector3.Zero;
        private float Zoom = 100f;
        private float RotationY = 0.0f;
        private float RotationX = 0.0f;
        private Matrix gameWorldRotation = Matrix.Identity;

        Stopwatch sw = new Stopwatch();
        double msecMin = double.MaxValue;
        double msecMax = 0;
        double avg = 0;
        double acc = 0;
        int c;

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);

            float aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
            Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 0.01f, 500.0f);
            Matrix view = Matrix.CreateLookAt(
                new Vector3(0.0f, 35.0f, -Zoom),
                new Vector3(0.0f, 35.0f, 0),
                Vector3.Up);

            // Draw Grid
            grid.Projection = projection;
            grid.View = view;
            //grid.EditMatrix = Matrix.Identity; // XY plane
            grid.EditMatrix = Matrix.CreateFromAxisAngle(Vector3.UnitX, MathHelper.ToRadians(-90)); // XZ plane
            grid.Draw(gameTime);

            GraphicsDevice.BlendState = BlendState.Opaque;
            GraphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
            GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            GraphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;

            Model m = _model_CPU;
            if (drawMode == DrawMode.CPU)
                m = _model_CPU;
            else if (drawMode == DrawMode.GPU)
                m = _model_GPU;

            Matrix[] transforms = new Matrix[m.Bones.Count];
            m.CopyAbsoluteBoneTransformsTo(transforms);

            sw.Reset();
            sw.Start();
            foreach (ModelMesh mesh in m.Meshes)
            {
                foreach (var part in mesh.MeshParts)
                {
                    if (drawMode == DrawMode.CPU)
                        ((BasicEffect)part.Effect).SpecularColor = Vector3.Zero;
                    else if (drawMode == DrawMode.GPU)
                        ((SkinnedEffect)part.Effect).SpecularColor = Vector3.Zero;
                    ConfigureEffectMatrices((IEffectMatrices)part.Effect, Matrix.Identity, view, projection);
                    ConfigureEffectLighting((IEffectLights)part.Effect);

                    if (drawMode == DrawMode.CPU)
                        part.UpdateVertices(_animations.AnimationTransforms); // animate vertices on CPU
                    else if (drawMode == DrawMode.GPU)
                        ((SkinnedEffect)part.Effect).SetBoneTransforms(_animations.AnimationTransforms);// animate vertices on GPU
                }
                mesh.Draw();
            }
            sw.Stop();

            double msec = sw.Elapsed.TotalMilliseconds;
            msecMin = Math.Min(msecMin, msec);
            if(avg != 0 )
                msecMax = Math.Max(msecMax, msec);
            acc += msec; c++;
            if(c>60*2)
            {
                avg = acc/c;
                acc = c = 0;
            }

            spriteBatch.Begin();
            spriteBatch.DrawString(font, "Draw Mode: " + drawMode, new Vector2(32, 32), Color.White);
            spriteBatch.DrawString(font, msec.ToString("#0.000",CultureInfo.InvariantCulture) + "ms", new Vector2(32, GraphicsDevice.Viewport.Height - 130), Color.White);
            spriteBatch.DrawString(font, avg.ToString("#0.000",CultureInfo.InvariantCulture) + "ms (avg)", new Vector2(32, GraphicsDevice.Viewport.Height - 100), Color.White);
            spriteBatch.DrawString(font, msecMin.ToString("#0.000",CultureInfo.InvariantCulture) + "ms (min)", new Vector2(32, GraphicsDevice.Viewport.Height - 70), Color.White);
            spriteBatch.DrawString(font, msecMax.ToString("#0.000",CultureInfo.InvariantCulture) + "ms (max)", new Vector2(32, GraphicsDevice.Viewport.Height - 40), Color.White);
            spriteBatch.End();

            base.Draw(gameTime);
        }

        private void ConfigureEffectMatrices(IEffectMatrices effect, Matrix world, Matrix view, Matrix projection)
        {
            effect.World = world;
            effect.View = view;
            effect.Projection = projection;
        }

        private void ConfigureEffectLighting(IEffectLights effect)
        {
            effect.EnableDefaultLighting();
            effect.DirectionalLight0.Direction = Vector3.Backward;
            effect.DirectionalLight0.Enabled = true;
            effect.DirectionalLight1.Enabled = false;
            effect.DirectionalLight2.Enabled = false;
        }

    }
}


text:
triangula.dynamics: High Level Dynamics
=======================================

This package contains classes used to enforce higher level dynamics such as skid control, waypoint based navigation,
route planning and similar.

Per-Wheel Acceleration Limiting
-------------------------------

The :class:`triangula.dynamics.RateLimit` class is a general rate limiter. Constructed with a limit function, it is
called repeatedly, passed a list of new values. It enforces any supplied limits on the allowable rates of change of
these values and returns a modified set with the limits applied. This can be used, for example, in the manual control
task to prevent the requested motor powers changing at too high a rate, providing a simple form of skid control at the
expense of responsiveness.

The limit function takes a previous value with associated timepoint, and a new value and new timepoint, and returns a
potentially limited version of the new value. The simple static function generator within this class will enforce fixed
rate per second limiting, but other functions could be passed in to provide smarter logic such as always allowing a
reduction in the absolute value but limiting increases in magnitude.

.. autoclass:: triangula.dynamics.RateLimit
    :members:

Motion Limiting
---------------

The :class:`triangula.dynamics.MotionLimit` class is an acceleration limiter specialised to handle rate limitation over
instances of :class:`triangula.chassis.Motion`. It is configured with maximum allowed linear and angular accelerations,
configured in millimeters per second per second, and radians per second per second respectively.

.. autoclass:: triangula.dynamics.MotionLimit
    :members:


text: {{app.name}}


text:
#ifndef WebSoupRequestManagerProxy_h
#define WebSoupRequestManagerProxy_h

#include "APIObject.h"
#include "MessageReceiver.h"
#include "WebContextSupplement.h"
#include "WebSoupRequestManagerClient.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/text/WTFString.h>

namespace WebKit {

class WebContext;
class WebData;

class WebSoupRequestManagerProxy : public TypedAPIObject<APIObject::TypeSoupRequestManager>, public WebContextSupplement, private CoreIPC::MessageReceiver {
public:
    static const char* supplementName();

    static PassRefPtr<WebSoupRequestManagerProxy> create(WebContext*);
    virtual ~WebSoupRequestManagerProxy();

    void initializeClient(const WKSoupRequestManagerClient*);

    void registerURIScheme(const String& scheme);
    void didHandleURIRequest(const WebData*, uint64_t contentLength, const String& mimeType, uint64_t requestID);
    void didReceiveURIRequestData(const WebData*, uint64_t requestID);
    void didReceiveURIRequest(const String& uriString, WebPageProxy*, uint64_t requestID);
    void didFailURIRequest(const WebCore::ResourceError&, uint64_t requestID);

    const Vector<String>& registeredURISchemes() const { return m_registeredURISchemes; }

    using APIObject::ref;
    using APIObject::deref;

private:
    WebSoupRequestManagerProxy(WebContext*);

    // WebContextSupplement
    virtual void contextDestroyed() OVERRIDE;
    virtual void processDidClose(WebProcessProxy*) OVERRIDE;
    virtual void refWebContextSupplement() OVERRIDE;
    virtual void derefWebContextSupplement() OVERRIDE;

    // CoreIPC::MessageReceiver
    virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;

    void didFailToLoadURIRequest(uint64_t requestID);

    WebSoupRequestManagerClient m_client;
    bool m_loadFailed;
    Vector<String> m_registeredURISchemes;
};

} // namespace WebKit

#endif // WebSoupRequestManagerProxy_h


text:
package kieker.monitoring.timer;

import java.util.Date;
import java.util.Locale;
import java.util.concurrent.TimeUnit;

import kieker.common.configuration.Configuration;
import kieker.common.logging.Log;
import kieker.common.logging.LogFactory;

/**
 * A timer implementation, counting in nanoseconds since a specified offset.
 *
 * @author Jan Waller
 *
 * @since 1.5
 */
public final class SystemNanoTimer extends AbstractTimeSource {
	/** This is the name of the configuration determining the used offset (in nanoseconds). */
	public static final String CONFIG_OFFSET = SystemNanoTimer.class.getName() + ".offset";
	/** This is the name of the configuration determining the used time unit (0 = nanoseconds, 1 = microseconds, 2 = milliseconds, 3 = seconds). */
	public static final String CONFIG_UNIT = SystemNanoTimer.class.getName() + ".unit";

	private static final Log LOG = LogFactory.getLog(SystemNanoTimer.class);

	private final long offset;
	private final long clockdifference;
	private final TimeUnit timeunit;

	/**
	 *
	 * Creates a new instance of this class using the given parameters.
	 *
	 * @param configuration
	 *            The configuration for this timer.
	 */
	public SystemNanoTimer(final Configuration configuration) {
		super(configuration);
		this.clockdifference = System.nanoTime() - (TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis()));
		if (configuration.getStringProperty(CONFIG_OFFSET).length() == 0) {
			this.offset = System.nanoTime();
		} else {
			this.offset = this.clockdifference + configuration.getLongProperty(CONFIG_OFFSET);
		}
		final int timeunitval = configuration.getIntProperty(CONFIG_UNIT);
		switch (timeunitval) {
		case 0:
			this.timeunit = TimeUnit.NANOSECONDS;
			break;
		case 1:
			this.timeunit = TimeUnit.MICROSECONDS;
			break;
		case 2:
			this.timeunit = TimeUnit.MILLISECONDS;
			break;
		case 3:
			this.timeunit = TimeUnit.SECONDS;
			break;
		default:
			LOG.warn("Failed to determine value of " + CONFIG_UNIT + " (0, 1, 2, or 3 expected). Setting to 0=nanoseconds");
			this.timeunit = TimeUnit.NANOSECONDS;
			break;
		}
	}

	@Override
	public final long getTime() {
		return this.timeunit.convert(System.nanoTime() - this.offset, TimeUnit.NANOSECONDS);
	}

	@Override
	public long getOffset() {
		return this.timeunit.convert(this.offset - this.clockdifference, TimeUnit.NANOSECONDS);
	}

	@Override
	public final TimeUnit getTimeUnit() {
		return this.timeunit;
	}

	@Override
	public final String toString() {
		final StringBuilder sb = new StringBuilder(64);
		sb.append("Time in " + this.timeunit.toString().toLowerCase(Locale.ENGLISH) + " (with nanoseconds precision) since ");
		sb.append(new Date(TimeUnit.NANOSECONDS.toMillis(this.offset - this.clockdifference)));
		return sb.toString();
	}

}


text:
<!DOCTYPE html >

          <title>ClockService - io.gearpump.streaming.appmaster.ClockService</title>
          <meta name="description" content="ClockService - io.gearpump.streaming.appmaster.ClockService" />
          <meta name="keywords" content="ClockService io.gearpump.streaming.appmaster.ClockService" />
          <meta http-equiv="content-type" content="text/html; charset=UTF-8" />

      <link href="../../../../lib/template.css" media="screen" type="text/css" rel="stylesheet" />
      <link href="../../../../lib/diagrams.css" media="screen" type="text/css" rel="stylesheet" id="diagrams-css" />

io.gearpump.streaming.appmaster

ClockService

            Related Docs:
            object ClockService
            | package appmaster

        class

        ClockService extends Actor with Stash

The clockService will maintain a global view of message timestamp in the application

          Linear Supertypes

Stash, RequiresMessageQueue[DequeBasedMessageQueueSemantics], UnrestrictedStash, StashSupport, Actor, AnyRef, Any

<input id="mbrsel-input" type="text" accesskey="/" />

              Ordering

Alphabetic

By inheritance

                Inherited

ClockService

Stash

RequiresMessageQueue

UnrestrictedStash

StashSupport

Actor

AnyRef

Any

Hide All

Show all

            Learn more about member selection

            Visibility

Public

All

Instance Constructors

        new

        ClockService(dag: DAG, store: AppDataStore)

Type Members

        type

        Receive = PartialFunction[Any, Unit]

Definition Classes

Actor

Value Members

        final
        def

        !=(arg0: Any): Boolean

Definition Classes

AnyRef → Any

        final
        def

        ##(): Int

Definition Classes

AnyRef → Any

        final
        def

        ==(arg0: Any): Boolean

Definition Classes

AnyRef → Any

        def

        aroundPostRestart(reason: Throwable): Unit

Attributes

protected[akka]

Definition Classes

Actor

        def

        aroundPostStop(): Unit

Attributes

protected[akka]

Definition Classes

Actor

        def

        aroundPreRestart(reason: Throwable, message: Option[Any]): Unit

Attributes

protected[akka]

Definition Classes

Actor

        def

        aroundPreStart(): Unit

Attributes

protected[akka]

Definition Classes

Actor

        def

        aroundReceive(receive: akka.actor.Actor.Receive, msg: Any): Unit

Attributes

protected[akka]

Definition Classes

Actor

        final
        def

        asInstanceOf[T0]: T0

Definition Classes

Any

        def

        clockService: Receive

        var

        clocks: Map[ProcessorId, ProcessorClock]

        def

        clone(): AnyRef

Attributes

protected[java.lang]

Definition Classes

AnyRef

Annotations

                @throws(

      ...
    )

        implicit
        val

        context: ActorContext

Definition Classes

Actor

        final
        def

        eq(arg0: AnyRef): Boolean

Definition Classes

AnyRef

        def

        equals(arg0: Any): Boolean

Definition Classes

AnyRef → Any

        def

        finalize(): Unit

Attributes

protected[java.lang]

Definition Classes

AnyRef

Annotations

                @throws(

      classOf[java.lang.Throwable]
    )

        final
        def

        getClass(): Class[_]

Definition Classes

AnyRef → Any

        def

        hashCode(): Int

Definition Classes

AnyRef → Any

        final
        def

        isInstanceOf[T0]: Boolean

Definition Classes

Any

        final
        def

        ne(arg0: AnyRef): Boolean

Definition Classes

AnyRef

        final
        def

        notify(): Unit

Definition Classes

AnyRef

        final
        def

        notifyAll(): Unit

Definition Classes

AnyRef

        def

        postRestart(reason: Throwable): Unit

Definition Classes

Actor

Annotations

                @throws(

      classOf[java.lang.Exception]
    )

        def

        postStop(): Unit

Definition Classes

ClockService → UnrestrictedStash → Actor

        def

        preRestart(reason: Throwable, message: Option[Any]): Unit

Definition Classes

UnrestrictedStash → Actor

        def

        preStart(): Unit

Definition Classes

ClockService → Actor

        def

        receive: Map[Any, Nothing]

Definition Classes

ClockService → Actor

        implicit final
        val

        self: ActorRef

Definition Classes

Actor

        def

        selfCheck(): Unit

        final
        def

        sender(): ActorRef

Definition Classes

Actor

        def

        stash(): Unit

Definition Classes

StashSupport

        def

        supervisorStrategy: SupervisorStrategy

Definition Classes

Actor

        final
        def

        synchronized[T0](arg0: ⇒ T0): T0

Definition Classes

AnyRef

        def

        toString(): String

Definition Classes

AnyRef → Any

        def

        unhandled(message: Any): Unit

Definition Classes

Actor

        def

        unstashAll(): Unit

Definition Classes

StashSupport

        final
        def

        wait(): Unit

Definition Classes

AnyRef

Annotations

                @throws(

      ...
    )

        final
        def

        wait(arg0: Long, arg1: Int): Unit

Definition Classes

AnyRef

Annotations

                @throws(

      ...
    )

        final
        def

        wait(arg0: Long): Unit

Definition Classes

AnyRef

Annotations

                @throws(

      ...
    )

        def

        waitForStartClock: Receive

Inherited from Stash

Inherited from RequiresMessageQueue[DequeBasedMessageQueueSemantics]

Inherited from UnrestrictedStash

Inherited from StashSupport

Inherited from Actor

Inherited from AnyRef

Inherited from Any

Ungrouped


text:
#include "third_party/blink/renderer/platform/bindings/v8_per_isolate_data.h"

#include <memory>
#include <utility>

#include "base/allocator/partition_allocator/oom.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/single_thread_task_runner.h"
#include "base/time/default_tick_clock.h"
#include "base/trace_event/trace_event.h"
#include "gin/public/v8_idle_task_runner.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/web/blink.h"
#include "third_party/blink/renderer/platform/bindings/active_script_wrappable_base.h"
#include "third_party/blink/renderer/platform/bindings/dom_data_store.h"
#include "third_party/blink/renderer/platform/bindings/script_forbidden_scope.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/bindings/v8_binding.h"
#include "third_party/blink/renderer/platform/bindings/v8_object_constructor.h"
#include "third_party/blink/renderer/platform/bindings/v8_private_property.h"
#include "third_party/blink/renderer/platform/bindings/v8_value_cache.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/thread_state_scopes.h"
#include "third_party/blink/renderer/platform/scheduler/public/thread.h"
#include "third_party/blink/renderer/platform/wtf/leak_annotations.h"
#include "v8/include/v8.h"

namespace blink {

// Function defined in third_party/blink/public/web/blink.h.
v8::Isolate* MainThreadIsolate() {
  return V8PerIsolateData::MainThreadIsolate();
}

static V8PerIsolateData* g_main_thread_per_isolate_data = nullptr;

static void BeforeCallEnteredCallback(v8::Isolate* isolate) {
  CHECK(!ScriptForbiddenScope::IsScriptForbidden());
}

static void MicrotasksCompletedCallback(v8::Isolate* isolate, void* data) {
  V8PerIsolateData::From(isolate)->RunEndOfScopeTasks();
}

static bool AllowAtomicWaits(
    V8PerIsolateData::V8ContextSnapshotMode v8_context_snapshot_mode) {
  return !IsMainThread() ||
         v8_context_snapshot_mode ==
             V8PerIsolateData::V8ContextSnapshotMode::kTakeSnapshot;
}

V8PerIsolateData::V8PerIsolateData(
    scoped_refptr<base::SingleThreadTaskRunner> task_runner,
    V8ContextSnapshotMode v8_context_snapshot_mode,
    v8::CreateHistogramCallback create_histogram_callback,
    v8::AddHistogramSampleCallback add_histogram_sample_callback)
    : v8_context_snapshot_mode_(v8_context_snapshot_mode),
      isolate_holder_(
          task_runner,
          gin::IsolateHolder::kSingleThread,
          AllowAtomicWaits(v8_context_snapshot_mode)
              ? gin::IsolateHolder::kAllowAtomicsWait
              : gin::IsolateHolder::kDisallowAtomicsWait,
          IsMainThread() ? gin::IsolateHolder::IsolateType::kBlinkMainThread
                         : gin::IsolateHolder::IsolateType::kBlinkWorkerThread,
          v8_context_snapshot_mode ==
                  V8PerIsolateData::V8ContextSnapshotMode::kTakeSnapshot
              ? gin::IsolateHolder::IsolateCreationMode::kCreateSnapshot
              : gin::IsolateHolder::IsolateCreationMode::kNormal,
          create_histogram_callback,
          add_histogram_sample_callback),
      string_cache_(std::make_unique<StringCache>(GetIsolate())),
      private_property_(std::make_unique<V8PrivateProperty>()),
      constructor_mode_(ConstructorMode::kCreateNewObject),
      runtime_call_stats_(base::DefaultTickClock::GetInstance()) {
  if (v8_context_snapshot_mode == V8ContextSnapshotMode::kTakeSnapshot) {
    // Snapshot should only execute on the main thread. SnapshotCreator enters
    // the isolate, so we don't call Isolate::Enter() here.
    CHECK(IsMainThread());
  } else {
    // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone.
    GetIsolate()->Enter();
    GetIsolate()->AddBeforeCallEnteredCallback(&BeforeCallEnteredCallback);
    GetIsolate()->AddMicrotasksCompletedCallback(&MicrotasksCompletedCallback);
  }
  if (IsMainThread())
    g_main_thread_per_isolate_data = this;
}

V8PerIsolateData::~V8PerIsolateData() = default;

v8::Isolate* V8PerIsolateData::MainThreadIsolate() {
  DCHECK(g_main_thread_per_isolate_data);
  return g_main_thread_per_isolate_data->GetIsolate();
}

v8::Isolate* V8PerIsolateData::Initialize(
    scoped_refptr<base::SingleThreadTaskRunner> task_runner,
    V8ContextSnapshotMode context_mode,
    v8::CreateHistogramCallback create_histogram_callback,
    v8::AddHistogramSampleCallback add_histogram_sample_callback) {
  TRACE_EVENT1("v8", "V8PerIsolateData::Initialize", "V8ContextSnapshotMode",
               context_mode);
  V8PerIsolateData* data =
      new V8PerIsolateData(task_runner, context_mode, create_histogram_callback,
                           add_histogram_sample_callback);
  DCHECK(data);

  v8::Isolate* isolate = data->GetIsolate();
  isolate->SetData(gin::kEmbedderBlink, data);
  return isolate;
}

void V8PerIsolateData::EnableIdleTasks(
    v8::Isolate* isolate,
    std::unique_ptr<gin::V8IdleTaskRunner> task_runner) {
  From(isolate)->isolate_holder_.EnableIdleTasks(std::move(task_runner));
}

// willBeDestroyed() clear things that should be cleared before
// ThreadState::detach() gets called.
void V8PerIsolateData::WillBeDestroyed(v8::Isolate* isolate) {
  V8PerIsolateData* data = From(isolate);

  data->thread_debugger_.reset();
  // Clear any data that may have handles into the heap,
  // prior to calling ThreadState::detach().
  data->ClearEndOfScopeTasks();

  if (data->profiler_group_) {
    data->profiler_group_->WillBeDestroyed();
    data->profiler_group_ = nullptr;
  }

  data->ClearScriptRegexpContext();

  ThreadState::Current()->DetachFromIsolate();

  data->active_script_wrappable_manager_.Clear();
  // Callbacks can be removed as they only cover single events (e.g. atomic
  // pause) and they cannot get out of sync.
  DCHECK_EQ(0u, data->gc_callback_depth_);
  isolate->RemoveGCPrologueCallback(data->prologue_callback_);
  isolate->RemoveGCEpilogueCallback(data->epilogue_callback_);
}

void V8PerIsolateData::SetGCCallbacks(
    v8::Isolate* isolate,
    v8::Isolate::GCCallback prologue_callback,
    v8::Isolate::GCCallback epilogue_callback) {
  prologue_callback_ = prologue_callback;
  epilogue_callback_ = epilogue_callback;
  isolate->AddGCPrologueCallback(prologue_callback_);
  isolate->AddGCEpilogueCallback(epilogue_callback_);
}

// destroy() clear things that should be cleared after ThreadState::detach()
// gets called but before the Isolate exits.
void V8PerIsolateData::Destroy(v8::Isolate* isolate) {
  isolate->RemoveBeforeCallEnteredCallback(&BeforeCallEnteredCallback);
  isolate->RemoveMicrotasksCompletedCallback(&MicrotasksCompletedCallback);
  V8PerIsolateData* data = From(isolate);

  // Clear everything before exiting the Isolate.
  if (data->script_regexp_script_state_)
    data->script_regexp_script_state_->DisposePerContextData();
  data->private_property_.reset();
  data->string_cache_->Dispose();
  data->string_cache_.reset();
  data->v8_template_map_for_main_world_.clear();
  data->v8_template_map_for_non_main_worlds_.clear();
  if (IsMainThread())
    g_main_thread_per_isolate_data = nullptr;

  // FIXME: Remove once all v8::Isolate::GetCurrent() calls are gone.
  isolate->Exit();
  delete data;
}

v8::Local<v8::Template> V8PerIsolateData::FindV8Template(
    const DOMWrapperWorld& world,
    const void* key) {
  auto& map = SelectV8TemplateMap(world);
  auto result = map.find(key);
  if (result != map.end())
    return result->value.Get(GetIsolate());
  return v8::Local<v8::Template>();
}

void V8PerIsolateData::AddV8Template(const DOMWrapperWorld& world,
                                     const void* key,
                                     v8::Local<v8::Template> value) {
  auto& map = SelectV8TemplateMap(world);
  auto result = map.insert(key, v8::Eternal<v8::Template>(GetIsolate(), value));
  DCHECK(result.is_new_entry);
}

bool V8PerIsolateData::HasInstance(const WrapperTypeInfo* wrapper_type_info,
                                   v8::Local<v8::Value> untrusted_value) {
  RUNTIME_CALL_TIMER_SCOPE(GetIsolate(),
                           RuntimeCallStats::CounterId::kHasInstance);
  return HasInstance(wrapper_type_info, untrusted_value,
                     v8_template_map_for_main_world_) ||
         HasInstance(wrapper_type_info, untrusted_value,
                     v8_template_map_for_non_main_worlds_);
}

bool V8PerIsolateData::HasInstance(const WrapperTypeInfo* wrapper_type_info,
                                   v8::Local<v8::Value> untrusted_value,
                                   const V8TemplateMap& map) {
  auto result = map.find(wrapper_type_info);
  if (result == map.end())
    return false;
  v8::Local<v8::Template> v8_template = result->value.Get(GetIsolate());
  DCHECK(v8_template->IsFunctionTemplate());
  return v8_template.As<v8::FunctionTemplate>()->HasInstance(untrusted_value);
}

bool V8PerIsolateData::HasInstanceOfUntrustedType(
    const WrapperTypeInfo* untrusted_wrapper_type_info,
    v8::Local<v8::Value> untrusted_value) {
  RUNTIME_CALL_TIMER_SCOPE(GetIsolate(),
                           RuntimeCallStats::CounterId::kHasInstance);
  return HasInstanceOfUntrustedType(untrusted_wrapper_type_info,
                                    untrusted_value,
                                    v8_template_map_for_main_world_) ||
         HasInstanceOfUntrustedType(untrusted_wrapper_type_info,
                                    untrusted_value,
                                    v8_template_map_for_non_main_worlds_);
}

bool V8PerIsolateData::HasInstanceOfUntrustedType(
    const WrapperTypeInfo* untrusted_wrapper_type_info,
    v8::Local<v8::Value> untrusted_value,
    const V8TemplateMap& map) {
  auto result = map.find(untrusted_wrapper_type_info);
  if (result == map.end())
    return false;
  v8::Local<v8::Template> v8_template = result->value.Get(GetIsolate());
  if (!v8_template->IsFunctionTemplate())
    return false;
  return v8_template.As<v8::FunctionTemplate>()->HasInstance(untrusted_value);
}

V8PerIsolateData::V8TemplateMap& V8PerIsolateData::SelectV8TemplateMap(
    const DOMWrapperWorld& world) {
  return world.IsMainWorld() ? v8_template_map_for_main_world_
                             : v8_template_map_for_non_main_worlds_;
}

void V8PerIsolateData::ClearPersistentsForV8ContextSnapshot() {
  v8_template_map_for_main_world_.clear();
  v8_template_map_for_non_main_worlds_.clear();
  eternal_name_cache_.clear();
  private_property_.reset();
}

const base::span<const v8::Eternal<v8::Name>>
V8PerIsolateData::FindOrCreateEternalNameCache(
    const void* lookup_key,
    const base::span<const char* const>& names) {
  auto it = eternal_name_cache_.find(lookup_key);
  const Vector<v8::Eternal<v8::Name>>* vector = nullptr;
  if (UNLIKELY(it == eternal_name_cache_.end())) {
    v8::Isolate* isolate = GetIsolate();
    Vector<v8::Eternal<v8::Name>> new_vector(
        base::checked_cast<wtf_size_t>(names.size()));
    std::transform(names.begin(), names.end(), new_vector.begin(),
                   [isolate](const char* name) {
                     return v8::Eternal<v8::Name>(
                         isolate, V8AtomicString(isolate, name));
                   });
    vector = &eternal_name_cache_.Set(lookup_key, std::move(new_vector))
                  .stored_value->value;
  } else {
    vector = &it->value;
  }
  DCHECK_EQ(vector->size(), names.size());
  return base::span<const v8::Eternal<v8::Name>>(vector->data(),
                                                 vector->size());
}

v8::Local<v8::Context> V8PerIsolateData::EnsureScriptRegexpContext() {
  if (!script_regexp_script_state_) {
    LEAK_SANITIZER_DISABLED_SCOPE;
    v8::Local<v8::Context> context(v8::Context::New(GetIsolate()));
    script_regexp_script_state_ = MakeGarbageCollected<ScriptState>(
        context,
        DOMWrapperWorld::Create(GetIsolate(),
                                DOMWrapperWorld::WorldType::kRegExp),
        /* execution_context = */ nullptr);
  }
  return script_regexp_script_state_->GetContext();
}

void V8PerIsolateData::ClearScriptRegexpContext() {
  if (script_regexp_script_state_) {
    script_regexp_script_state_->DisposePerContextData();
    script_regexp_script_state_->DissociateContext();
  }
  script_regexp_script_state_ = nullptr;
}

void V8PerIsolateData::AddEndOfScopeTask(base::OnceClosure task) {
  end_of_scope_tasks_.push_back(std::move(task));
}

void V8PerIsolateData::RunEndOfScopeTasks() {
  Vector<base::OnceClosure> tasks;
  tasks.swap(end_of_scope_tasks_);
  for (auto& task : tasks)
    std::move(task).Run();
  DCHECK(end_of_scope_tasks_.IsEmpty());
}

void V8PerIsolateData::ClearEndOfScopeTasks() {
  end_of_scope_tasks_.clear();
}

void V8PerIsolateData::SetThreadDebugger(
    std::unique_ptr<V8PerIsolateData::Data> thread_debugger) {
  DCHECK(!thread_debugger_);
  thread_debugger_ = std::move(thread_debugger);
}

V8PerIsolateData::Data* V8PerIsolateData::ThreadDebugger() {
  return thread_debugger_.get();
}

void V8PerIsolateData::SetProfilerGroup(
    V8PerIsolateData::GarbageCollectedData* profiler_group) {
  profiler_group_ = profiler_group;
}

V8PerIsolateData::GarbageCollectedData* V8PerIsolateData::ProfilerGroup() {
  return profiler_group_;
}

void V8PerIsolateData::SetCanvasResourceTracker(
    V8PerIsolateData::GarbageCollectedData* canvas_resource_tracker) {
  canvas_resource_tracker_ = canvas_resource_tracker;
}

V8PerIsolateData::GarbageCollectedData*
V8PerIsolateData::CanvasResourceTracker() {
  return canvas_resource_tracker_;
}

void* CreateHistogram(const char* name, int min, int max, size_t buckets) {
  // Each histogram has an implicit '0' bucket (for underflow), so we can always
  // bump the minimum to 1.
  DCHECK_LE(0, min);
  min = std::max(1, min);

  // For boolean histograms, always include an overflow bucket [2, infinity).
  if (max == 1 && buckets == 2) {
    max = 2;
    buckets = 3;
  }

  const std::string histogram_name =
      Platform::Current()->GetNameForHistogram(name);
  return base::Histogram::FactoryGet(
      histogram_name, min, max, static_cast<uint32_t>(buckets),
      base::Histogram::kUmaTargetedHistogramFlag);
}

void AddHistogramSample(void* hist, int sample) {
  auto* histogram = static_cast<base::HistogramBase*>(hist);
  histogram->Add(sample);
}

}  // namespace blink


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

namespace _9_Easy_Sorting
{
    public static class Sorter
    {
        public static string Sort(string input)
        {
            if (string.IsNullOrEmpty(input))
            {
                throw new ArgumentException("input");
            }

            string[] parts = input.Split(new[] {','});

            if (parts.Length == 1)
            {
                return parts[0];
            }

            List<int> numbers = new List<int>();

            foreach (string s in parts)
            {
                int result;
                if (!int.TryParse(s, out result))
                {
                    throw new ArgumentException("input");
                }

                numbers.Add(result);
            }

            numbers.Sort();

            return ConvertToString(numbers);
        }

        private static string ConvertToString(IReadOnlyList<int> numbers)
        {
            StringBuilder output = new StringBuilder();

            for (int i = 0; i < numbers.Count; i++)
            {
                output.Append(numbers[i]);
                if (i < numbers.Count - 1)
                {
                    output.Append(", ");
                }
            }

            return output.ToString();
        }
    }
}


text:
import nose
import angr
import subprocess
import sys

import logging
l = logging.getLogger('angr.tests.strtol')

import os
test_location = str(os.path.dirname(os.path.realpath(__file__)))

def run_strtol(threads):
    if not sys.platform.startswith('linux'):
        raise nose.SkipTest()

    test_bin = os.path.join(test_location, "../../binaries/tests/x86_64/strtol_test")
    b = angr.Project(test_bin)

    initial_state = b.factory.entry_state(remove_options={angr.options.LAZY_SOLVES})
    pg = b.factory.simgr(thing=initial_state, immutable=False, threads=threads)

    # find the end of main
    expected_outputs = {"base 8 worked\n", "base +8 worked\n", "0x worked\n", "+0x worked\n", "base +10 worked\n",
                        "base 10 worked\n", "base -8 worked\n", "-0x worked\n", "base -10 worked\n", "Nope\n"}
    pg.explore(find=0x400804, num_find=len(expected_outputs))
    nose.tools.assert_equal(len(pg.found), len(expected_outputs))

    # check the outputs
    pipe = subprocess.PIPE
    for f in pg.found:
        test_input = f.posix.dumps(0)
        test_output = f.posix.dumps(1)
        expected_outputs.remove(test_output)

        # check the output works as expected
        p = subprocess.Popen(test_bin, stdout=pipe, stderr=pipe, stdin=pipe)
        ret = p.communicate(test_input)[0]
        nose.tools.assert_equal(ret, test_output)

    # check that all of the outputs were seen
    nose.tools.assert_equal(len(expected_outputs), 0)

def test_strtol():
    yield run_strtol, None
    # yield run_strtol, 8

if __name__ == "__main__":
    run_strtol(4)