text:
import Address from '../../../utils/Address';
import helpers from '../../../utils/helpers';
import CryptoHelpers from '../../../utils/CryptoHelpers';

class EditMultisigCtrl {
    constructor(Wallet, NetworkRequests, Alert, Transactions, DataBridge, $location, $localStorage) {
        'ngInject';

        // Wallet service
        this._Wallet = Wallet;
        // Network requests service
        this._NetworkRequests = NetworkRequests;
        // Alert service
        this._Alert = Alert;
        // Transactions service
        this._Transactions = Transactions;
        // DataBridge service
        this._DataBridge = DataBridge;
        // $location to redirect
        this._location = $location;
        //Local storage
        this._storage = $localStorage;

        // If no wallet show alert and redirect to home
        if (!this._Wallet.current) {
            this._Alert.noWalletLoaded();
            this._location.path('/');
            return;
        }

        /**
         * Default edit multisig properties
         */
        this.cosignatoryArray = [];
        this.formData = {};
        // Default cosignatory to add is the current account address
        this.formData.cosignatoryToAdd = this._Wallet.currentAccount.address;
        // Default multisig account to edit is empty
        this.formData.accountToEdit = '';
        this.cosignatoryPubKey = '';
        this.formData.multisigPubKey = '';
        this.formData.fee = 0;
        this.formData.innerFee = 0;
        // Alias address empty by default
        this.aliasAddress = '';
        // Not showing alias address input by default
        this.showAlias = false;
        // No address stored by default, we will store the cleaned one after input or after getting alias from network
        this.formData.cosignatoryAddress = '';
        // No min cosignatory modification by default
        this.formData.minCosigs = null;

        this.contacts = [];

        this.multisigInfosData = undefined;

        if(undefined !== this._storage.contacts && undefined !== this._storage.contacts[this._Wallet.currentAccount.address] && this._storage.contacts[this._Wallet.currentAccount.address].length) {
            this.contacts = this._storage.contacts[this._Wallet.currentAccount.address]
        }

        // Needed to prevent user to click twice on send when already processing
        this.okPressed = false;

        // Modifications list pagination properties
        this.currentPage = 0;
        this.pageSize = 5;
        this.numberOfPages = function() {
            return Math.ceil(this.cosignatoryArray.length / this.pageSize);
        }

        // Get data of default cosignatory account
        this.processCosignatoryToAdd();

        // Init fees
        this.updateFee();

    }

    /**
     * processCosignatoryToAdd() Set right address and get data of cosignatory to add
     */
    processCosignatoryToAdd() {
        // Check if value is an alias
        let isAlias = (this.formData.cosignatoryToAdd.lastIndexOf("@", 0) === 0);
        // Reset cosignatory data
        this.resetCosignatoryData();

        // return if no value or length < to min address length AND not an alias
        if (!this.formData.cosignatoryToAdd || this.formData.cosignatoryToAdd.length < 40 && !isAlias) {
            return;
        }

        // Get recipient data depending of address or alias used
        if (isAlias) {
            // Clean namespace name
            let nsForLookup = this.formData.cosignatoryToAdd.substring(1);
            // Get cosignatory account data from network using @alias
            this.getCosignatoryDataFromAlias(nsForLookup);
        } else { // Normal address used
            // Clean provided address
            let cosignatoryAddress = this.formData.cosignatoryToAdd.toUpperCase().replace(/-/g, '');
            // Check if address is from network
            if (Address.isFromNetwork(cosignatoryAddress, this._Wallet.network)) {
                // Get account data from network
                this.getCosignatoryData(cosignatoryAddress);
            } else {
                // Unexpected error, this alert will not dismiss on timeout
                this._Alert.invalidAddressForNetwork(cosignatoryAddress, this._Wallet.network);
                // Reset cosignatory data
                this.resetCosignatoryData();
                return;
            }
        }
    }

    /**
     * processAccountToEdit() Set right address and get data of multisig account to edit
     */
    processAccountToEdit() {
        if (!this.formData.accountToEdit) {
        // Reset multisig data and properties
            this.resetMultisigData();
            return;
        }
        // Clean the array of modifications
        this.cosignatoryArray = [];
        // Reset min signature change
        this.formData.minCosigs = null;

        this.updateFee();

        // Set address
        let address = this.formData.accountToEdit.address
        // Get data of account to convert from network
        this.getMultisigData(address);
    }

    /**
     * calculateMinSignaturesChange() Calculate the minimum signature change needed
     */
    calculateMinSignaturesChange() {
            if (!this.cosignatoryArray.length || !this.formData.multisigPubKey) {
                this.formData.minCosigs = null;
                return;
            }
            // Default number of account deleted
            let numberDeleted = 0;
            // Default number of account added
            let numberAdded = 0;
            // Increment above properties depending of type
            for (let i = 0; i < this.cosignatoryArray.length; i++) {
                if (this.cosignatoryArray[i].type === 2) {
                    numberDeleted++;
                } else {
                    numberAdded++;
                }
            }
            // Update min cosigs if total cosignatories - deleted accounts + added accounts is < min cosig number
            if (this.multisigInfosData.cosignatories.length - numberDeleted + numberAdded < this.multisigInfosData.minCosigs) {
                // Calculate the number to add or remove of min signatures
                let sigs = this.multisigInfosData.cosignatories.length - numberDeleted - this.multisigInfosData.minCosigs + numberAdded;
                this.formData.minCosigs = sigs;
            } else if(this.isMinSignaturesValid(false)) {
                this.formData.minCosigs = null;
            } else {
                this._Alert.errorMultisigMinSignatureInvalid();
            }
    }

    /**
     * getMultisigData() Get data of multisig account to edit from network
     *
     * @param address: The account address
     */
    getMultisigData(address) {
        return this._NetworkRequests.getAccountData(helpers.getHostname(this._Wallet.node), address).then((data) => {
                    // Get selected multisig account's data to show in view
                    this.multisigInfosData = {
                        'minCosigs': data.account.multisigInfo.minCosignatories,
                        'cosignatories': data.meta.cosignatories
                    }

                    // Store multisig public key
                    this.formData.multisigPubKey = data.account.publicKey;
                    // It is needed to get the account public key
                    // If empty we prevent user to send and show an alert
                    if (!this.formData.multisigPubKey) {
                        // Alert
                        this._Alert.multisighasNoPubKey();
                        // Reset multisig data and properties
                        this.resetMultisigData();
                    }
                },
                (err) => {
                    this._Alert.getAccountDataError(err.data.message);
                    // Reset recipient data
                    this.resetMultisigData();
                    return;
                });
    }

    /**
     * getCosignatoryData() Get cosignatory data from network
     *
     * @param address: The account address
     */
    getCosignatoryData(address) {
        return this._NetworkRequests.getAccountData(helpers.getHostname(this._Wallet.node), address).then((data) => {
                    if (data.meta.cosignatories.length > 0) {
                        // Alert
                        this._Alert.multisigCannotBeCosignatory();
                        // Reset cosignatory data
                        this.resetCosignatoryData();
                        return;
                    }
                    // Store cosignatory public key
                    this.formData.cosignatoryPubKey = data.account.publicKey;
                    // Store cosignatory address
                    this.formData.cosignatoryAddress = address;
                    // It is needed to get the account public key
                    // If empty we prevent user from adding to the array and show an alert
                    if (!this.formData.cosignatoryPubKey) {
                        // Alert
                        this._Alert.cosignatoryhasNoPubKey();
                        // Reset cosignatory data
                        this.resetCosignatoryData();
                    }
                },
                (err) => {
                    this._Alert.getAccountDataError(err.data.message);
                    // Reset recipient data
                    this.resetCosignatoryData();
                    return;
                });
    }

    /**
     * getCosignatoryDataFromAlias() Get cosignatory account data from network using @alias
     *
     * @param alias: The recipient alias (namespace)
     */
    getCosignatoryDataFromAlias(alias) {
        return this._NetworkRequests.getNamespacesById(helpers.getHostname(this._Wallet.node), alias).then((data) => {
                        // Set the alias address
                        this.aliasAddress = data.owner;
                        // Show the read-only input containing alias address
                        this.showAlias = true;
                        // Check if address is from network
                        if (Address.isFromNetwork(this.aliasAddress, this._Wallet.network)) {
                            // Get recipient account data from network
                            this.getCosignatoryData(this.aliasAddress);
                        } else {
                            // Unexpected error, this alert will not dismiss on timeout
                            this._Alert.invalidAddressForNetwork(this.aliasAddress, this._Wallet.network);
                            // Reset recipient data
                            this.resetCosignatoryData();
                            return;
                        }
                    },
                    (err) => {
                        this._Alert.getNamespacesByIdError(err.data.message);
                        // Reset recipient data
                        this.resetCosignatoryData();
                        return;
                    });
    }

    /**
     * updateFee() Update transaction fee
     */
    updateFee() {
        let entity = this._Transactions._constructAggregateModifications(this._DataBridge.accountData.account.publicKey, this.formData, this.cosignatoryArray);
        this.formData.fee = entity.fee;
        this.formData.innerFee = entity.otherTrans.fee;
        this.isMinSignaturesValid(false);
    }

    /**
     * Check if multisig account has at least one minimum signature remaining after change
     *
     * @param {boolean} isSend - True if the check is in send button, false otherwise
     * Without the boolean the check in send button will trigger infinite digest cycles for the alert
     */
    isMinSignaturesValid(isSend) {
        if (undefined !== this.multisigInfosData && null !== this.formData.minCosigs) {
            if(isNaN(this.formData.minCosigs)) {
                return false;
            }
            let sigs = this.formData.minCosigs + this.multisigInfosData.minCosigs;
            // If resulting number of sigs after change is below one and if there is more than one cosignatory
            if (sigs < 1 && this.multisigInfosData.cosignatories.length > 1) {
                if(!isSend) {
                    this._Alert.errorMultisigMinSignature();
                }
                return false;
            } else {
                return true;
            }
        } else {
            return true;
        }
    }

    /**
     * resetCosignatoryData() Reset data stored and properties for cosignatory
     */
    resetCosignatoryData() {
        // Reset public key data
        this.cosignatoryPubKey = '';
        // Hide alias address input field
        this.showAlias = false;
        // Reset the address stored
        this.formData.cosignatoryAddress = '';
    }

    /**
     * resetMultisigData() Reset data stored and properties for multisig account
     */
    resetMultisigData() {
        // Reset public key data
        this.formData.multisigPubKey = '';
    }

    /**
     * removeCosignFromList() Remove a cosignatory from the modifications list
     */
    removeCosignFromList(array, elem) {
        // If the deleted element is the elem 0 and length of array mod 5 gives 0 (means it is the last object of the page),
        // we return a page behind unless it is page 1.
        if (array.indexOf(elem) === 0 && this.currentPage + 1 > 1 && (array.length - 1) % 5 === 0) {
            this.currentPage = this.currentPage - 1;
        }
        array.splice(array.indexOf(elem), 1);
        // Calculate min signatures change
        this.calculateMinSignaturesChange();
        // Update the fee
        this.updateFee();
    }

    /**
     * addCosig() Push cosignatory to array with add or delete type
     *
     * @param type: modification type (1 to add or 2 to remove)
     */
    addCosig(type) {
        // If removal, check if one already present in modification
        if(type === 2 && this.hasRemoval()) {
            this._Alert.cosignatoryRemovalLimit();
            return;
        }

        if (helpers.haveCosig(this.formData.cosignatoryAddress, this.formData.cosignatoryPubKey, this.cosignatoryArray)) {
            // Alert
            this._Alert.cosignatoryAlreadyPresentInList();
        } else {
            this.cosignatoryArray.push({
                address: this.formData.cosignatoryAddress,
                pubKey: this.formData.cosignatoryPubKey,
                type: type
            });
            // Calculate min signatures change
            this.calculateMinSignaturesChange();
            // Update the fee
            this.updateFee();
        }
    }

    /**
     * Check if modifications array already has a removal type
     */
    hasRemoval() {
        for (let i = 0; i < this.cosignatoryArray.length; i++) {
            if (this.cosignatoryArray[i].type === 2) {
                return true;
            }
        }
        return false;
    }

    /**
     * send() Build and broadcast the transaction to the network
     */
    send() {
        // Disable send button;
        this.okPressed = true;

        // Decrypt/generate private key and check it. Returned private key is contained into this.common
        if (!CryptoHelpers.passwordToPrivatekeyClear(this.common, this._Wallet.currentAccount, this._Wallet.algo, true)) {
            this._Alert.invalidPassword();
            // Enable send button
            this.okPressed = false;
            return;
        } else if (!CryptoHelpers.checkAddress(this.common.privateKey, this._Wallet.network, this._Wallet.currentAccount.address)) {
            this._Alert.invalidPassword();
            // Enable send button
            this.okPressed = false;
            return;
        }

        // Build the entity to serialize
        let entity = this._Transactions._constructAggregateModifications(this._DataBridge.accountData.account.publicKey, this.formData, this.cosignatoryArray);
        // Construct the transaction byte array, sign and broadcast it to the network
        return this._Transactions.serializeAndAnnounceTransaction(entity, this.common).then((res) => {
                // Check status
                if (res.status === 200) {
                    // If code >= 2, it's an error
                    if (res.data.code >= 2) {
                        this._Alert.transactionError(res.data.message);
                    } else {
                        this._Alert.transactionSuccess();
                    }
                }
                // Enable send button
                this.okPressed = false;
                // Delete private key in common
                this.common.privateKey = '';
            },
            (err) => {
                // Delete private key in common
                this.common.privateKey = '';
                // Enable send button
                this.okPressed = false;
                this._Alert.transactionError('Failed ' + err.data.error + " " + err.data.message);
            });
    }

}

export default EditMultisigCtrl;


text:
using System;

namespace _05.KingGambitExtended.Entities
{
    public delegate void KingUnderAttackHandler(object sourse, EventArgs e);

    public class King
    {
        public event KingUnderAttackHandler KingAttacked;

        public King(string name)
        {
            this.Name = name;
        }

        public string Name { get; set; }

        public void Attack()
        {
            this.OnKingAttack(this.Name);
        }

        protected virtual void OnKingAttack(string name)
        {
            Console.WriteLine($"King {this.Name} is under attack!");

            if (KingAttacked != null)
            {
                KingAttacked(this, EventArgs.Empty);
            }
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
import {
  skillPing,
  skillEcho,
  skillCurrentTime,
  skills,
} from './saihubot-skill-diagnostics.js';

export {
  skillPing,
  skillEcho,
  skillCurrentTime,
  skills,
};


text:
import nconf from 'nconf';
import R from 'ramda';
import T from '../../translate';

const permissions = [
  '0x0000002', // Kick Members
  '0x0000004', // Ban Members
  '0x0000010', // Manage Channels
  '0x0000400', // Read Messages
  '0x0000800', // Send Messages
  '0x0002000', // Manage messages
  '0x0004000', // Embed Links,
  '0x0008000', // Attach files
  '0x0010000', // Read message history
  '0x10000000' // Manage Roles
];

const permission_value = R.sum(R.map(parseInt, permissions));
const join_link = `https://discordapp.com/oauth2/authorize?&client_id=${nconf.get('CLIENT_ID')}&scope=bot&permissions=${permission_value}`;

function joinServer(client, evt, suffix, lang) {
  evt.message.reply(`${T('join_link', lang)}\n${join_link}`);
}

export default {
  invite: joinServer,
  join: joinServer,
  joinserver: joinServer,
  'join-server': joinServer
};

export const help = {
  join: {}
};


text:
//
//  ZZTHaloWeaponTag.h
//  Apocalyptic
//
//  Created by Paul Whitcomb on 2/4/14.
//  Copyright (c) 2014 Zero2. All rights reserved.
//

#include "ZZTHaloObjectTag.h"

#ifndef _ZZTHaloWeaponTag_h
#define _ZZTHaloWeaponTag_h

enum itemBitmaskTypes {
    ITEM_BITMASK_ALWAYS_MAINTAINS_Z_UP = 15,
    ITEM_BITMASK_DESTROYED_BY_EXPLOSIONS = 14,
    ITEM_BITMASK_UNAFFECTED_BY_GRAVITY = 13
};

enum weaponSecondaryTriggerModes : uint16_t {
    WEAPON_SECONDARY_TRIGGER_NORMAL = 0,
    WEAPON_SECONDARY_TRIGGER_SLAVED_TO_PRIMARY = 1,
    WEAPON_SECONDARY_TRIGGER_INHIBITS_PRIMARY = 2,
    WEAPON_SECONDARY_TRIGGER_LOADS_ALTERNATE_AMMUNITION = 3,
    WEAPON_SECONDARY_TRIGGER_LOADS_MULTIPLE_PRIMARY_AMMUNITION = 4
};

enum weaponBitmaskTypes {
    WEAPON_BITMASK_VERTICAL_HEAT_DISPLAY = 31,
    WEAPON_BITMASK_MUTUALLY_EXCLUSIVE_TRIGGERS = 30,
    WEAPON_BITMASK_ATTACKS_AUTOMATICALLY_ON_BUMP = 29,
    WEAPON_BITMASK_MUST_BE_READIED = 28,
    WEAPON_BITMASK_DOESNT_COUNT_TOWARDS_MAXIMUM = 27,
    WEAPON_BITMASK_AIM_ASSISTS_ONLY_WHEN_ZOOMED = 26,
    WEAPON_BITMASK_PREVENTS_GRENADE_THROWING = 25,
    WEAPON_BITMASK_MUST_BE_PICKED_UP = 24,
    WEAPON_BITMASK_HOLDS_TRIGGER_WHEN_DROPPED = 23,
    WEAPON_BITMASK_PREVENTS_MELEE_ATTACK = 22,
    WEAPON_BITMASK_DETONATES_WHEN_DROPPED = 21,
    WEAPON_BITMASK_CANNOT_FIRE_AT_MAXIMUM_AGE = 20,
    WEAPON_BITMASK_SECONDARY_TRIGGER_OVERRIDES_GRENADES = 19,
    WEAPON_BITMASK_DOES_NOT_DEPOWER_ACTIVE_CAMO_IN_MULTIPLAYER = 18,
    WEAPON_BITMASK_ENABLES_INTEGRATED_NIGHT_VISION = 17,
    WEAPON_BITMASK_AIS_USE_WEAPON_MELEE_DAMAGE = 16
};

enum weaponFunctions : uint16_t {
    WEAPON_FUNCTION_NONE = 0,
    WEAPON_FUNCTION_HEAT = 1,
    WEAPON_FUNCTION_PRIMARY_AMMUNITION = 2,
    WEAPON_FUNCTION_SECONDARY_AMMUNITION = 3,
    WEAPON_FUNCTION_PRIMARY_RATE_OF_FIRE = 4,
    WEAPON_FUNCTION_SECONDARY_RATE_OF_FIRE = 5,
    WEAPON_FUNCTION_READY = 6,
    WEAPON_FUNCTION_PRIMARY_EJECTION_PORT = 7,
    WEAPON_FUNCTION_SECONDARY_EJECTION_PORT = 8,
    WEAPON_FUNCTION_OVERHEATED = 9,
    WEAPON_FUNCTION_PRIMARY_CHARGED = 10,
    WEAPON_FUNCTION_SECONDARY_CHARGED = 11,
    WEAPON_FUNCTION_ILLUMINATION = 12,
    WEAPON_FUNCTION_AGE = 13,
    WEAPON_FUNCTION_INTEGRATED_LIGHT = 14,
    WEAPON_FUNCTION_PRIMARY_FIRING = 15,
    WEAPON_FUNCTION_SECONDARY_FIRING = 16,
    WEAPON_FUNCTION_PRIMARY_FIRING_ON = 17,
    WEAPON_FUNCTION_SECONDARY_FIRING_ON = 18
};

enum weaponMovementPenalized : uint16_t {
    WEAPON_MOVEMENT_PENALIZED_ALWAYS = 0,
    WEAPON_MOVEMENT_PENALIZED_WHEN_ZOOMED = 1,
    WEAPON_MOVEMENT_PENALIZED_WHEN_ZOOMED_OR_RELOADING = 2
};

enum weaponType : uint16_t {
    WEAPON_TYPE_UNDEFINED = 0,
    WEAPON_TYPE_SHOTGUN = 1,
    WEAPON_TYPE_NEEDLER = 2,
    WEAPON_TYPE_PLASMA_PISTOL = 3,
    WEAPON_TYPE_PLASMA_RIFLE = 4
};

enum magazineBitmaskTypes {
    WEAPON_MAGAZINE_WASTES_ROUND_WHEN_RELOADED = 31,
    WEAPON_MAGAZINE_EVERY_ROUND_MUST_BE_CHAMBERED = 30
};

typedef struct {
    uint16_t rounds; //0x0
    char padding[0xA]; //0x2
    HaloTagDependency equipment; //0xC
} __attribute__((packed)) HaloWeaponMagazineMagazine; //0x1C

typedef struct {
    bitmask32 flags; //0x0
    uint16_t roundsRecharged; //0x4
    uint16_t roundsTotalInitial; //0x6
    uint16_t roundsTotalMaximum; //0x8
    uint16_t roundsLoadedMaximum; //0xA
    char padding[0x8]; //0xC
    float reloadTime; //0x14
    uint16_t roundsReloaded; //0x18
    char padding1[0x2]; //0x1A
    float chamberTime; //0x1C
    char padding2[0x18]; //0x20
    HaloTagDependency reloadingEffect; //0x38
    HaloTagDependency chamberingEffect; //0x48
    char padding3[0xC]; //0x58
    HaloTagReflexive magazines; //0x64
} __attribute__((packed)) HaloWeaponMagazine; //0x70

enum weaponTriggerBitmaskTypes {
    WEAPON_TRIGGER_TRACKS_FIRED_PROJECTILE = 31,
    WEAPON_TRIGGER_RANDOM_FIRING_EFFECTS = 30,
    WEAPON_TRIGGER_CAN_FIRE_WITH_PARTIAL_AMMO = 29,
    WEAPON_TRIGGER_DOES_NOT_REPEAT_AUTOMATICALLY = 28,
    WEAPON_TRIGGER_LOCKS_IN_ON_OFF_STATE = 27,
    WEAPON_TRIGGER_PROJECTILE_USE_WEAPON_ORIGIN = 26,
    WEAPON_TRIGGER_STICKS_WHEN_DROPPED = 25,
    WEAPON_TRIGGER_EJECTS_DURING_CHAMBER = 24,
    WEAPON_TRIGGER_DISCHARGING_SPEWS = 23,
    WEAPON_TRIGGER_ANALOG_RATE_OF_FIRE = 22,
    WEAPON_TRIGGER_USE_ERROR_WHEN_UNZOOMED = 21,
    WEAPON_TRIGGER_PROJECTILE_VECTOR_CANNOT_BE_ADJUSTED = 20,
    WEAPON_TRIGGER_PROJECTILE_HAVE_IDENTICAL_ERROR = 19,
    WEAPON_TRIGGER_PROJECTILE_IS_CLIENT_SIDE_ONLY = 18
};

enum weaponFiringNoise : uint16_t {
    WEAPON_FIRING_SILENT = 0,
    WEAPON_FIRING_MEDUM = 1,
    WEAPON_FIRING_LOUD = 2,
    WEAPON_FIRING_SHOUT = 3,
    WEAPON_FIRING_QUIET = 4
};

enum weaponFiringOverchargeAction : uint16_t {
    WEAPON_FIRING_OVERCHARGE_ACTION_NONE = 0,
    WEAPON_FIRING_OVERCHARGE_ACTION_EXPLODE = 1,
    WEAPON_FIRING_OVERCHARGE_ACTION_DISCHARGE = 2
};

enum weaponFiringDistributionFunction : uint16_t {
    WEAPON_FIRING_DISTRIBUTION_FUNCTION_POINT = 0,
    WEAPON_FIRING_DISTRIBUTION_FUNCTION_HORIZONTAL_FAN = 1
};

typedef struct {
    uint16_t shotCountLowerBound; //0x0
    uint16_t shotCountUpperBound; //0x2
    char padding[0x20]; //0x4
    HaloTagDependency firingEffect; //0x24
    HaloTagDependency misfireEffect; //0x34
    HaloTagDependency emptyEffect; //0x44
    HaloTagDependency firingdamage; //0x54
    HaloTagDependency misfireDamage; //0x64
    HaloTagDependency emptyDamage; //0x74
} __attribute__((packed)) HaloWeaponFiringEffects;

typedef struct {
    bitmask32 flags; //0x0
    float rateOfFireFrom; //0x4
    float rateOfFireTo; //0x8
    float firingAccelerationTime; //0xC
    float firingDecelerationTime; //0x10
    float firingBlurredRateOfFire; //0x14
    char padding[0x8]; //0x18
    refIndex magazine; //0x20
    uint16_t roundsPerShot; //0x22
    uint16_t minimumRounds; //0x24
    uint16_t roundsBetweenTracers; //0x26
    char padding1[0x6]; //0x28
    enum weaponFiringNoise noise; //0x2E
    float errorFrom; //0x30
    float errorTo; //0x34
    float errorAccelerationTime; //0x38
    float errorDecelerationTime; //0x3C
    char padding2[0x8];
    float chargingTime; //0x48
    float chargedTime; //0x4C
    enum weaponFiringOverchargeAction overchargeAction; //0x50
    char padding3[0x2]; //0x52
    float chargedIllumination; //0x54
    float overchargeSpewTime; //0x58
    HaloTagDependency chargingEffect; //0x5C
    enum weaponFiringDistributionFunction projectileDistributionFunction; //0x6C
    uint16_t projectilesPerShot; //0x6E
    float projectileDistributionAngle; //0x70
    char padding4[0x4]; //0x74
    float projectileMinimumError; //0x78
    float projectileErrorAngleFrom; //0x7C
    float projectileErrorAngleTo; //0x80
    Vector firstPersonOffset; //0x84;
    char padding5[0x4]; //0x90
    HaloTagDependency projectile; //0x94
    float ejectionPortRecoveryTime; //0xA4
    float illuminationRecoveryTime; //0xA8
    char padding6[0xC]; //0xAC
    float heatGeneratedPerRound; //0xB8
    float ageGeneratedPerRound; //0xBC
    char padding7[0x4]; //0xC0
    float overloadTime; //0xC4
    char padding8[0x40]; //0xC8
    HaloTagReflexive firingEffects; //0x108
} __attribute__((packed)) HaloWeaponTrigger;

typedef struct {
    HaloObjectTagData objectData; //0x0
    bitmask16 flags; //0x17C
    char padding5[0x2]; //0x17E
    uint16_t messageIndex; //0x180
    uint16_t messageSortOrder; //0x182
    float messageScale; //0x184
    uint16_t messageHudValueScale; //0x188
    enum objectFunction messageAin; //0x18A
    char padding[0x2D]; //0x18C
    enum objectFunction messageBin; //0x1B9
    char padding1[0x2D]; //0x1BB
    enum objectFunction messageCin; //0x1E8
    char padding2[0x2D]; //0x1EA
    enum objectFunction messageDin; //0x217
    char padding3[0x2F]; //0x219
    HaloTagDependency materialEffects; //0x248
    HaloTagDependency collisionSound; //0x258
    char padding4[0x78]; //0x268
    float detonationDelayFrom; //0x2E0
    float detonationDelayTo; //0x2E4
    HaloTagDependency detonatingEffect; //0x2E8
    HaloTagDependency detonationEffect; //0x2F8
} __attribute__((packed)) HaloItemTagData;  //0x308

typedef struct {
    HaloItemTagData itemData; //0x0
    bitmask32 weaponFlags; //0x308
    char weaponLabel[32]; //0x30C
    enum weaponSecondaryTriggerModes secondaryTriggerMode; //0x32C
    char padding[0x2]; //0x32E
    enum weaponFunctions exportAin; //0x330
    enum weaponFunctions exportBin; //0x332
    enum weaponFunctions exportCin; //0x334
    enum weaponFunctions exportDin; //0x336
    float exportReadyTime; //0x338
    HaloTagDependency readyEffect; //0x33C
    float heatRecoveryThreshold; //0x34C
    float heatOverheatedThreshold; //0x350
    float heatDetonationThreshold; //0x354
    float heatDetonationFraction; //0x358
    float heatLossPerSecond; //0x35C
    float heatIllumination; //0x360
    char padding1[0x10]; //0x364
    HaloTagDependency heatOverheatedEffect; //0x374
    HaloTagDependency heatDetonation; //0x384
    HaloTagDependency meleeDamage; //0x394
    HaloTagDependency meleeResponse; //0x3A4
    char padding2[0x8]; //0x3B4
    HaloTagDependency actorFiringParameters; //0x3BC
    float reticleNearReticleRange; //0x3CC
    float reticleFarReticleRange; //0x3D0
    float reticleIntersectionReticleRange; //0x3D4
    char padding3[0x2]; //0x3D8
    uint16_t zoomLevels; //0x3DA
    float zoomFrom; //0x3DC
    float zoomTo; //0x3E0
    float aimAssistAutoaimAngle; //0x3E4
    float aimAssistAutoaimRange; //0x3E8
    float aimAssistMagnetismAngle; //0x3EC
    float aimAssistMagnetismRange; //0x3F0
    float aimAssistMagnetismDeviationAngle; //0x3F4
    char padding4[0x4]; //0x3F8
    enum weaponMovementPenalized movementMovementPenalized; //0x3FC
    char padding5[0x2]; //0x3FE
    float weaponMovementForwardPenalty; //0x400
    float weaponMovementSidewaysPenalty; //0x404
    char padding6[0x4]; //0x408
    float aiTargetingParametersMinimumTargetRange; //0x40C
    float aiTargetingParametersLookingTimeModifier; //0x410
    char padding7[0x4]; //0x414
    float lightPowerOnTime; //0x418
    float lightPowerOffTime; //0x41C
    HaloTagDependency lightPowerOnEffect; //0x420
    HaloTagDependency lightPowerOffEffect; //0x430
    float ageHeatRecoveryPenalty; //0x440
    float ageRateOfFirePenalty; //0x444
    float ageMisfireStart; //0x448
    float ageMisfireChance; //0x44C
    char padding8[0xC]; //0x450
    HaloTagDependency firstPersonModel; //0x45C
    HaloTagDependency firstPersonAnimation; //0x46C
    char padding9[0x4];
    HaloTagDependency hudInterface; //0x480
    HaloTagDependency pickupSound; //0x490
    HaloTagDependency zoomInSound; //0x4A0
    HaloTagDependency zoomOutSound; //0x4B0
    char padding10[0xC]; //0x4C0
    float activeCamoDing; //0x4CC
    float activeCamoRegrowthRate; //0x4D0
    char padding11[0xE]; //0x4D4
    enum weaponType type; //0x4E2
    char padding12[0xC]; //0x4E4
    HaloTagReflexive magazines; //0x4F0
    HaloTagReflexive triggers; //0x4FC
} __attribute__((packed)) HaloWeaponData; //0x508 complete

typedef struct {
    uint32_t junk[0xB9];
    HaloTagReflexive seats; //0x4FC
} __attribute__((packed)) HaloVehicleData; //0x508 complete

#endif


text:
'use strict'

const cacache = require('cacache')
const log = require('npmlog')

module.exports = verifyCachedFiles
function verifyCachedFiles (cache, cb) {
  log.info('verifyCachedFiles', `Verifying cache at ${cache}`)
  cacache.verify(cache).then((stats) => {
    log.info('verifyCachedFiles', `Verification complete. Stats: ${JSON.stringify(stats, 2)}`)
    if (stats.reclaimedCount || stats.badContentCount || stats.missingContent) {
      stats.badContentCount && log.warn('verifyCachedFiles', `Corrupted content removed: ${stats.badContentCount}`)
      stats.reclaimedCount && log.warn('verifyCachedFiles', `Content garbage-collected: ${stats.reclaimedCount} (${stats.reclaimedSize} bytes)`)
      stats.missingContent && log.warn('verifyCachedFiles', `Missing content: ${stats.missingContent}`)
      log.warn('verifyCachedFiles', 'Cache issues have been fixed')
    }
    return stats
  }).then((s) => cb(null, s), cb)
}


text:
function rem_args = set_class_properties(obj, varargin)
% SET_CLASS_PROPERTIES  Parse list of parameter-value pairs
%   REM_ARGS = SET_CLASS_PROPERTIES(OBJ, ARGS) updates the object OBJ based on
%   the specified parameter-value pairs ARGS={PAR1, VAL1, ... PARN,
%   VALN}. The function produces an error if an unknown parameter name
%   is passed in.
%
%   Example::
%     The function can be used to parse a list of arguments
%     passed to a MATLAB functions:
%
%       function myFunction(x,y,z,varargin)
%       conf.parameterName = defaultValue;
%       set_class_properties(conf, varargin);

if ~isobject(obj), error('OBJ must be an object') ; end

remainingArgs = {} ;

args = varargin{:};

if mod(length(args),2) == 1
    error('Parameter-value pair expected (missing value?).') ;
end

for ai = 1:2:length(args)
    paramName = args{ai} ;
    value = args{ai+1} ;
    if isprop(obj,paramName)
        set(obj,paramName,value);
    else
        if nargout < 1
            error('Unknown parameter ''%s''.', paramName);
        else
            remainingArgs(end+1:end+2) = args(ai:ai+1);
        end
    end
end

rem_args = remainingArgs;


text:
package org.apache.ajp.tomcat4;

import java.io.IOException;
import java.net.InetAddress;
import java.net.ServerSocket;
import java.net.Socket;
import java.security.AccessControlException;
import java.util.Stack;
import java.util.Vector;

import org.apache.catalina.Connector;
import org.apache.catalina.Container;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleListener;
import org.apache.catalina.Request;
import org.apache.catalina.Response;
import org.apache.catalina.Service;
import org.apache.catalina.net.DefaultServerSocketFactory;
import org.apache.catalina.net.ServerSocketFactory;
import org.apache.catalina.util.LifecycleSupport;
import org.apache.catalina.util.StringManager;

/**
 * Implementation of an Ajp13 connector.
 *
 * @author Kevin Seguin
 * @version $Revision: 1.19 $ $Date: 2003/10/09 10:08:43 $
 */

public final class Ajp13Connector
    implements Connector, Lifecycle, Runnable {

    // ----------------------------------------------------- Instance Variables

    /**
     * The accept count for this Connector.
     */
    private int acceptCount = 10;

    /**
     * The IP address on which to bind, if any.  If null, all
     * addresses on the server will be bound.
     */
    private String address = null;

    /**
     * The input buffer size we should create on input streams.
     */
    private int bufferSize = 2048;

    /**
     * The Container used for processing requests received by this Connector.
     */
    protected Container container = null;

    /**
     * The set of processors that have ever been created.
     */
    private Vector created = new Vector();

    /**
     * The current number of processors that have been created.
     */
    private int curProcessors = 0;

    /**
     * The debugging detail level for this component.
     */
    private int debug = 0;

    /**
     * The server socket factory for this component.
     */
    private ServerSocketFactory factory = null;

    /**
     * Descriptive information about this Connector implementation.
     */
    private static final String info =
        "org.apache.catalina.connector.ajp.Ajp13Connector/1.0";

    /**
     * redirect port.
     */
    private int redirectPort = -1;

    /**
     * enable DNS lookups.
     */
    private boolean enableLookups = false;

    /**
     * The lifecycle event support for this component.
     */
    protected LifecycleSupport lifecycle = new LifecycleSupport(this);

    /**
     * The minimum number of processors to start at initialization time.
     */
    protected int minProcessors = 5;

    /**
     * The maximum number of processors allowed, or <0 for unlimited.
     */
    private int maxProcessors = 20;

    /**
     * Timeout value on the incoming connection.
     * Note : a value of 0 means no timeout.
     */
    private int connectionTimeout = -1;

    /**
     * Linger value to be used on socket close.
     * Note : a value of -1 means no linger used on close.
     */
    private int connectionLinger = -1;

    /**
     * The port number on which we listen for ajp13 requests.
     */
    private int port = 8009;

    /**
     * The set of processors that have been created but are not currently
     * being used to process a request.
     */
    private Stack processors = new Stack();

    /**
     * The request scheme that will be set on all requests received
     * through this connector.
     */
    private String scheme = "http";

    /**
     * The secure connection flag that will be set on all requests received
     * through this connector.
     */
    private boolean secure = false;

    /**
     * The server socket through which we listen for incoming TCP connections.
     */
    private ServerSocket serverSocket = null;

    /**
     * The string manager for this package.
     */
    private StringManager sm =
	StringManager.getManager(Constants.PACKAGE);

    /**
     * Has this component been started yet?
     */
    private boolean started = false;

    /**
     * The shutdown signal to our background thread
     */
    private boolean stopped = false;

    /**
     * The background thread.
     */
    private Thread thread = null;

    /**
     * This connector's thread group.
     */
    private ThreadGroup threadGroup = null;

    /**
     * The name to register for the background thread.
     */
    private String threadName = null;

    /**
     * A thread that periodically logs debug info if debug > 0.
     */
    private DebugThread debugThread = null;

    /**
     * The thread synchronization object.
     */
    private Object threadSync = new Object();

    private Ajp13Logger logger = new Ajp13Logger();

    /**
     * The service which which the connector is associated
     */
    private Service service = null;

    private String secret = null;

    /**
     * Tomcat authentication flag. If true, the authnetication is done by
     * Tomcat, otherwise, it is done by the native webserver.
     */
    private boolean tomcatAuthentication = true;

    // ------------------------------------------------------------- Properties

    /**
     * Return the connection timeout for this Connector.
     */
    public int getConnectionTimeout() {

	return (connectionTimeout);

    }

    /**
     * Set the connection timeout for this Connector.
     *
     * @param connectionTimeout The new connection timeout
     */
    public void setConnectionTimeout(int connectionTimeout) {

	this.connectionTimeout = connectionTimeout;

    }

    /**
     * Return the connection linger settings for this Connector.
     */
    public int getConnectionLinger() {

	return (connectionLinger);

    }

    /**
     * Set the connection linger for this Connector.
     *
     * @param connectionLinger The new connection linger
     */
    public void setConnectionLinger(int connectionLinger) {

	this.connectionLinger = connectionLinger;

    }

    public void setSecret( String s ) {
        secret=s;
    }

    public String getSecret() {
        return secret;
    }

    /**
     * Return the accept count for this Connector.
     */
    public int getAcceptCount() {

	return (acceptCount);

    }

    /**
     * Set the accept count for this Connector.
     *
     * @param count The new accept count
     */
    public void setAcceptCount(int count) {

	this.acceptCount = count;

    }

    /**
     * Return the bind IP address for this Connector.
     */
    public String getAddress() {

	return (this.address);

    }

    /**
     * Set the bind IP address for this Connector.
     *
     * @param address The bind IP address
     */
    public void setAddress(String address) {

	this.address = address;

    }

    /**
     * Is this connector available for processing requests?
     */
    public boolean isAvailable() {

	return (started);

    }

    /**
     * Return the input buffer size for this Connector.
     */
    public int getBufferSize() {

	return (this.bufferSize);

    }

    /**
     * Set the input buffer size for this Connector.
     *
     * @param bufferSize The new input buffer size.
     */
    public void setBufferSize(int bufferSize) {

	this.bufferSize = bufferSize;

    }

    /**
     * Return the Container used for processing requests received by this
     * Connector.
     */
    public Container getContainer() {

	return (container);

    }

    /**
     * Set the Container used for processing requests received by this
     * Connector.
     *
     * @param container The new Container to use
     */
    public void setContainer(Container container) {

	this.container = container;

    }

    /**
     * Return the current number of processors that have been created.
     */
    public int getCurProcessors() {

	return (curProcessors);

    }

    /**
     * Return the debugging detail level for this component.
     */
    public int getDebug() {

        return (debug);

    }

    /**
     * Set the debugging detail level for this component.
     *
     * @param debug The new debugging detail level
     */
    public void setDebug(int debug) {

        this.debug = debug;

    }

    /**
     * Return the "enable DNS lookups" flag.
     */
    public boolean getEnableLookups() {
        return this.enableLookups;
    }

    /**
     * Set the "enable DNS lookups" flag.
     *
     * @param enableLookups The new "enable DNS lookups" flag value
     */
    public void setEnableLookups(boolean enableLookups) {
        this.enableLookups = enableLookups;
    }

    /**
     * Return the port number to which a request should be redirected if
     * it comes in on a non-SSL port and is subject to a security constraint
     * with a transport guarantee that requires SSL.
     */
    public int getRedirectPort() {
        return this.redirectPort;
    }

    /**
     * Set the redirect port number.
     *
     * @param redirectPort The redirect port number (non-SSL to SSL)
     */
    public void setRedirectPort(int redirectPort) {
        this.redirectPort = redirectPort;
    }

    /**
     * Return the server socket factory used by this Container.
     */
    public ServerSocketFactory getFactory() {

        if (this.factory == null) {
            synchronized (this) {
                this.factory = new DefaultServerSocketFactory();
            }
        }
        return (this.factory);

    }

    /**
     * Set the server socket factory used by this Container.
     *
     * @param factory The new server socket factory
     */
    public void setFactory(ServerSocketFactory factory) {

        this.factory = factory;

    }

    /**
     * Return descriptive information about this Connector implementation.
     */
    public String getInfo() {

	return (info);

    }

    /**
     * Return the minimum number of processors to start at initialization.
     */
    public int getMinProcessors() {

	return (minProcessors);

    }

    /**
     * Set the minimum number of processors to start at initialization.
     *
     * @param minProcessors The new minimum processors
     */
    public void setMinProcessors(int minProcessors) {

	this.minProcessors = minProcessors;

    }

    /**
     * Return the maximum number of processors allowed, or <0 for unlimited.
     */
    public int getMaxProcessors() {

	return (maxProcessors);

    }

    /**
     * Set the maximum number of processors allowed, or <0 for unlimited.
     *
     * @param maxProcessors The new maximum processors
     */
    public void setMaxProcessors(int maxProcessors) {

	this.maxProcessors = maxProcessors;

    }

    /**
     * Return the port number on which we listen for AJP13 requests.
     */
    public int getPort() {

	return (this.port);

    }

    /**
     * Set the port number on which we listen for AJP13 requests.
     *
     * @param port The new port number
     */
    public void setPort(int port) {

	this.port = port;

    }

    /**
     * Return the scheme that will be assigned to requests received
     * through this connector.  Default value is "http".
     */
    public String getScheme() {

	return (this.scheme);

    }

    /**
     * Set the scheme that will be assigned to requests received through
     * this connector.
     *
     * @param scheme The new scheme
     */
    public void setScheme(String scheme) {

	this.scheme = scheme;

    }

    /**
     * Return the secure connection flag that will be assigned to requests
     * received through this connector.  Default value is "false".
     */
    public boolean getSecure() {

	return (this.secure);

    }

    /**
     * Set the secure connection flag that will be assigned to requests
     * received through this connector.
     *
     * @param secure The new secure connection flag
     */
    public void setSecure(boolean secure) {

	this.secure = secure;

    }

    /**
     * Returns the Service with which we are associated.
     */
    public Service getService() {
	return service;
    }

    /**
     * Set the Service with which we are associated.
     */
    public void setService(Service service) {
	this.service = service;
    }

    /**
     * Get the value of the tomcatAuthentication flag.
     */
    public boolean getTomcatAuthentication() {
        return tomcatAuthentication;
    }

    /**
     * Set the value of the tomcatAuthentication flag.
     */
    public void setTomcatAuthentication(boolean tomcatAuthentication) {
        this.tomcatAuthentication = tomcatAuthentication;
    }

    // --------------------------------------------------------- Public Methods

    /**
     * Create (or allocate) and return a Request object suitable for
     * specifying the contents of a Request to the responsible Container.
     */
    public Request createRequest() {

	Ajp13Request request = new Ajp13Request(this);
	request.setConnector(this);
	return (request);

    }

    /**
     * Create (or allocate) and return a Response object suitable for
     * receiving the contents of a Response from the responsible Container.
     */
    public Response createResponse() {

	Ajp13Response response = new Ajp13Response();
	response.setConnector(this);
	return (response);

    }

    /**
     * Invoke a pre-startup initialization. This is used to allow connectors
     * to bind to restricted ports under Unix operating environments.
     * ServerSocket (we start as root and change user? or I miss something?).
     */
    public void initialize() throws LifecycleException {
    }

    // -------------------------------------------------------- Package Methods

    /**
     * Recycle the specified Processor so that it can be used again.
     *
     * @param processor The processor to be recycled
     */
    void recycle(Ajp13Processor processor) {

        synchronized(processors) {
            if (debug > 0) {
                logger.log("added processor to available processors, available="
                           + processors.size());
            }
            processors.push(processor);
        }

    }

    // -------------------------------------------------------- Private Methods

    /**
     * Create (or allocate) and return an available processor for use in
     * processing a specific AJP13 request, if possible.  If the maximum
     * allowed processors have already been created and are in use, return
     * null instead.
     */
    private Ajp13Processor createProcessor() {

	synchronized (processors) {
	    if (processors.size() > 0)
		return ((Ajp13Processor) processors.pop());
	    if ((maxProcessors > 0) && (curProcessors < maxProcessors))
	        return (newProcessor());
	    else
	        return (null);
	}

    }

    /**
     * Create and return a new processor suitable for processing AJP13
     * requests and returning the corresponding responses.
     */
    private Ajp13Processor newProcessor() {

        Ajp13Processor processor = new Ajp13Processor(this, curProcessors++, threadGroup);
	if (processor instanceof Lifecycle) {
	    try {
	        ((Lifecycle) processor).start();
	    } catch (LifecycleException e) {
	        logger.log("newProcessor", e);
                curProcessors--;
	        return (null);
	    }
	}
	created.addElement(processor);
	return (processor);

    }

    /**
     * Open and return the server socket for this Connector.  If an IP
     * address has been specified, the socket will be opened only on that
     * address; otherwise it will be opened on all addresses.
     *
     * @exception IOException if an input/output error occurs
     */
    private ServerSocket open() throws IOException {

        // Acquire the server socket factory for this Connector
        ServerSocketFactory factory = getFactory();

	// If no address is specified, open a connection on all addresses
        if (address == null) {
	    logger.log(sm.getString("ajp13Connector.allAddresses"));
            try {
		return (factory.createSocket(port, acceptCount));
	    } catch(Exception ex ) {
		ex.printStackTrace();
		return null;
	    }
	}

	// Open a server socket on the specified address
        try {
            InetAddress is = InetAddress.getByName(address);
	    logger.log(sm.getString("ajp13Connector.anAddress", address));
            return (factory.createSocket(port, acceptCount, is));
	} catch (Exception e) {
	    try {
		logger.log(sm.getString("ajp13Connector.noAddress", address));
		return (factory.createSocket(port, acceptCount));
	    } catch( Exception e1 ) {
		e1.printStackTrace();
		return null;
	    }
	}

    }

    // ---------------------------------------------- Background Thread Methods

    /**
     * The background thread that listens for incoming TCP/IP connections and
     * hands them off to an appropriate processor.
     */
    public void run() {

        // Loop until we receive a shutdown command
	while (!stopped) {

	    // Accept the next incoming connection from the server socket
	    Socket socket = null;
	    try {
                if (debug > 0) {
                    logger.log("accepting socket...");
                }

		socket = serverSocket.accept();

                if (debug > 0) {
                    logger.log("accepted socket, assigning to processor.");
                }

                /* Warning :
                 *
                 * To be able to close more quickly a connection, it's recommanded
                 * to set linger to a small value.
                 *
                 * AJP13 connection SHOULD be closed under webserver responsability and
                 * in such case it's safe to close socket on Tomcat side without delay,
                 * which may be also the case for HTTP connectors.
                 *
                 * I (henri) recommand to set Linger to 0, making socket closed immediatly
                 * so the OS will free faster the underlying io descriptor and resources.
                 * It's very important under heavy load !
                 */

                if (connectionLinger < 0)
                	socket.setSoLinger(false, 0);
                else
                	socket.setSoLinger(true, connectionLinger);

                /* We don't need it since it's the native side which
                 * will set the connection with keep alive
                 * if specified in workers.properties.
                 *
                 * socket.setKeepAlive(true);
                 */

                /* Warning :
                 *
                 * AJP13 shouldn't use socket timeout on tomcat site since
                 * when Tomcat close a connection after a timeout is reached
                 * the socket stay in half-closed state until the webserver
                 * try to send a request to tomcat and detect the socket close
                 * when it will try to read the reply.
                 *
                 * On many Unix platforms the write() call didn't told
                 * webserver that the socket is closed.
                 */

                if (connectionTimeout >= 0) {
                    socket.setSoTimeout(connectionTimeout);
                }
            } catch (AccessControlException ace) {
                logger.log("socket accept security exception: "
                           + ace.getMessage());
                continue;
	    } catch (IOException e) {
		if (started && !stopped)
		    logger.log("accept: ", e);
		try {
                    if (serverSocket != null) {
                        serverSocket.close();
                    }
                    if (stopped) {
                        if (debug > 0) {
                            logger.log("run():  stopped, so breaking");
                        }
                        break;
                    } else {
                        if (debug > 0) {
                            logger.log("run():  not stopped, " +
                                       "so reopening server socket");
                        }
                        serverSocket = open();
                    }
                } catch (IOException ex) {
                    // If reopening fails, exit
                    logger.log("socket reopen: ", ex);
                    break;
                }
                continue;
	    }

	    // Hand this socket off to an appropriate processor
            if (debug > 0) {
                synchronized(processors) {
                    logger.log("about to create a processor, available="
                               + processors.size() + ", created=" + created.size()
                               + ", maxProcessors=" + maxProcessors);
                }
            }
	    Ajp13Processor processor = createProcessor();
	    if (processor == null) {
		try {
		    logger.log(sm.getString("ajp13Connector.noProcessor"));
		    socket.close();
		} catch (IOException e) {
		    ;
		}
		continue;
	    }
	    processor.assign(socket);

	    // The processor will recycle itself when it finishes

	}

	// Notify the threadStop() method that we have shut ourselves down
	synchronized (threadSync) {
	    threadSync.notifyAll();
	}

    }

    /**
     * Start the background processing thread.
     */
    private void threadStart() {

	logger.log(sm.getString("ajp13Connector.starting"));

	thread = new Thread(threadGroup, this, threadName);
	thread.setDaemon(true);
	thread.start();

    }

    /**
     * Stop the background processing thread.
     */
    private void threadStop() {

	logger.log(sm.getString("ajp13Connector.stopping"));

	stopped = true;
	synchronized (threadSync) {
	    try {
		threadSync.wait(5000);
	    } catch (InterruptedException e) {
		;
	    }
	}
	thread = null;

    }

    // ------------------------------------------------------ Lifecycle Methods

    /**
     * Add a lifecycle event listener to this component.
     *
     * @param listener The listener to add
     */
    public void addLifecycleListener(LifecycleListener listener) {

	lifecycle.addLifecycleListener(listener);

    }

    /**
     * Get the lifecycle listeners associated with this lifecycle. If this
     * Lifecycle has no listeners registered, a zero-length array is returned.
     */
    public LifecycleListener[] findLifecycleListeners() {
        return null; // FIXME: lifecycle.findLifecycleListeners();
    }

    /**
     * Remove a lifecycle event listener from this component.
     *
     * @param listener The listener to add
     */
    public void removeLifecycleListener(LifecycleListener listener) {

	lifecycle.removeLifecycleListener(listener);

    }

    /**
     * Begin processing requests via this Connector.
     *
     * @exception LifecycleException if a fatal startup error occurs
     */
    public void start() throws LifecycleException {

	// Validate and update our current state
	if (started)
	    throw new LifecycleException
		(sm.getString("ajp13Connector.alreadyStarted"));

        if (debug > 0) {
            debugThread = new DebugThread();
            debugThread.setDaemon(true);
            debugThread.start();
        }

        threadName = "Ajp13Connector[" + port + "]";
        threadGroup = new ThreadGroup(threadName);
        threadGroup.setDaemon(true);
        logger.setConnector(this);
        logger.setName(threadName);
	lifecycle.fireLifecycleEvent(START_EVENT, null);
	started = true;

	// Establish a server socket on the specified port
	try {
	    serverSocket = open();
	} catch (IOException e) {
	    throw new LifecycleException(threadName + ".open", e);
	}

	// Start our background thread
	threadStart();

	// Create the specified minimum number of processors
	while (curProcessors < minProcessors) {
	    if ((maxProcessors > 0) && (curProcessors >= maxProcessors))
		break;
	    Ajp13Processor processor = newProcessor();
	    recycle(processor);
	}

    }

    /**
     * Terminate processing requests via this Connector.
     *
     * @exception LifecycleException if a fatal shutdown error occurs
     */
    public void stop() throws LifecycleException {

	// Validate and update our current state
	if (!started)
	    throw new LifecycleException
		(sm.getString("ajp13Connector.notStarted"));
	lifecycle.fireLifecycleEvent(STOP_EVENT, null);
	started = false;

	// Gracefully shut down all processors we have created
	for (int i = created.size() - 1; i >= 0; i--) {
	    Ajp13Processor processor = (Ajp13Processor) created.elementAt(i);
	    if (processor instanceof Lifecycle) {
		try {
		    ((Lifecycle) processor).stop();
		} catch (LifecycleException e) {
		    logger.log("Ajp13Connector.stop", e);
		}
	    }
	}

	// Stop our background thread
	threadStop();

	// Close the server socket we were using
	if (serverSocket != null) {
	    try {
		serverSocket.close();
	    } catch (IOException e) {
		;
	    }
	    serverSocket = null;
	}

    }

    /**
     * Debugging thread used to debug thread activity in this
     * connector.
     */
    private class DebugThread extends Thread
    {
        public void run() {
            while (true) {
                try {
                    sleep(60 * 1000);
                } catch (InterruptedException e) {
                    break;
                }
                logger.log("active threads=" + threadGroup.activeCount());
                System.out.println("===================================");
                System.out.println("Ajp13Connector active threads="
                                   + threadGroup.activeCount());
                threadGroup.list();
                System.out.println("===================================");
            }
        }
    }

}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>motech</artifactId>
        <groupId>org.motechproject</groupId>
        <version>0.17-pr-2-SNAPSHOT</version>
        <relativePath>../../</relativePath>
    </parent>
    <artifactId>motech-platform-server-api</artifactId>
    <name>MOTECH Platform Server API</name>
    <packaging>bundle</packaging>
    <properties>
        <modules.root.dir>${basedir}/../..</modules.root.dir>
    </properties>
    <dependencies>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>com.springsource.javax.servlet</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.web</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.aop</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>org.springframework.transaction</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>com.springsource.org.apache.commons.lang</artifactId>
        </dependency>
        <dependency>
            <groupId>junit-addons</groupId>
            <artifactId>junit-addons</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>com.springsource.org.apache.commons.io</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>2.3.4</version>
                <extensions>true</extensions>
                <configuration>
                    <instructions>
                        <Export-Package>
                            org.motechproject.server.api;version=${project.version}
                        </Export-Package>
                    </instructions>
                </configuration>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <executions>
                    <execution>
                        <id>copy-bundles</id>
                        <phase>package</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${user.home}/.motech/bundles</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>target</directory>
                                    <includes>
                                        <include>*.jar</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


text:
package org.wwr.frc2013.lib;

import edu.wpi.first.wpilibj.AnalogChannel;
import edu.wpi.first.wpilibj.PIDSource;
import edu.wpi.first.wpilibj.livewindow.LiveWindowSendable;
import edu.wpi.first.wpilibj.tables.ITable;

/**
 *
 * @author Austin Reuland
 */
public class Potentiometer implements PIDSource, LiveWindowSendable {

	private AnalogChannel pot;

	/**
	 *
	 * @param channel Analog Channel of the Potentiometer
	 * @param avgBits Number of Averaging Bits
	 * @param ovrBits Number of Oversample Bits
	 */
	public Potentiometer(int channel, int avgBits, int ovrBits){
		this(1, channel, avgBits, ovrBits);
	}

	/**
	 *
	 * @param module Analog Module Number
	 * @param channel Analog Channel of the Potentiometer
	 * @param avgBits Number of Averaging Bits
	 * @param ovrBits Number of Oversample Bits
	 */
	public Potentiometer(int module, int channel, int avgBits, int ovrBits){
		pot = new AnalogChannel(module, channel);
		pot.setAverageBits(avgBits);
		pot.setOversampleBits(ovrBits);
	}

	/**
	 * Get raw value
	 * @return Potentiometer raw value
	 */
	public int getValue() {return pot.getValue(); }

	/**
	 * Get raw voltage
	 * @return Potentiometer raw voltage
	 */
	public double getVoltage() { return pot.getVoltage(); }

	private double lastRaw = 0;

	/**
	 * Get an Averaged value from the pot
	 * @return The average of the current and last values
	 */
	public double getAverage(){
		lastRaw = (lastRaw + getVoltage())/2;
		return lastRaw;
	}

	public int getAverageBits() { return pot.getAverageBits(); }

	public int getOversampleBits() { return pot.getOversampleBits(); }

	public double pidGet() { return pot.pidGet(); }

	public void updateTable() { pot.updateTable(); }

	public void startLiveWindowMode() { pot.startLiveWindowMode(); }

	public void stopLiveWindowMode() { pot.stopLiveWindowMode(); }

	public void initTable(ITable arg0) { pot.initTable(arg0); }

	public ITable getTable() { return pot.getTable(); }

	public String getSmartDashboardType() { return pot.getSmartDashboardType(); }

}


text:
package main

import "fmt"

type Car struct {
	wheelCount int
}

func (car Car) numberOfWheels() int {
	return car.wheelCount
}

type Ferrari struct {
	Car
}

// a behavior only available for the Ferrari
func (f Ferrari) sayHiToSchumacher() {
	fmt.Println("Hi Schumacher!")
}

type AstonMartin struct {
	Car
}

// a behavior only available for the AstonMartin
func (a AstonMartin) sayHiToBond() {
	fmt.Println("Hi Bond, James Bond!")
}

func main() {
	f := Ferrari{Car{4}}
	fmt.Println("A Ferrari has this many wheels: ", f.numberOfWheels()) //has car behavior
	f.sayHiToSchumacher()                                               //has Ferrari behavior

	a := AstonMartin{Car{4}}
	fmt.Println("An Aston Martin has this many wheels: ", a.numberOfWheels()) //has car behavior
	a.sayHiToBond()                                                           //has AstonMartin behavior
}


text:
package com.opengamma.analytics.financial.model.volatility.surface;

import java.util.Arrays;

import org.apache.commons.lang.Validate;

import com.opengamma.analytics.financial.model.option.definition.OptionDefinition;
import com.opengamma.analytics.financial.model.option.definition.SABRDataBundle;
import com.opengamma.analytics.math.MathException;
import com.opengamma.analytics.math.function.RealPolynomialFunction1D;
import com.opengamma.analytics.math.rootfinding.CubicRealRootFinder;
import com.opengamma.analytics.math.rootfinding.Polynomial1DRootFinder;
import com.opengamma.analytics.math.rootfinding.QuadraticRealRootFinder;
import com.opengamma.util.CompareUtils;

/**
 *
 */
public class SABRATMVolatilityCalibrationFunction {
  private static final Polynomial1DRootFinder<Double> QUADRATIC_FINDER = new QuadraticRealRootFinder();
  private static final Polynomial1DRootFinder<Double> ROOT_FINDER = new CubicRealRootFinder();

  public SABRDataBundle calibrate(final OptionDefinition option, final SABRDataBundle data) {
    Validate.notNull(option, "option");
    Validate.notNull(data, "data");
    final double beta = data.getBeta();
    final double t = option.getTimeToExpiry(data.getDate());
    final double rho = data.getRho();
    final double ksi = data.getVolOfVol();
    final double sigmaATM = data.getVolatility(t, option.getStrike());
    final double b = data.getCostOfCarry();
    final double f = data.getSpot() * Math.exp(b * t);
    final double beta1 = 1 - beta;
    final double f1 = Math.pow(f, beta1);
    final double a0 = -sigmaATM * f1;
    final double a1 = 1 + (2 - 3 * rho * rho) * ksi * ksi * t / 24;
    final double a2 = rho * beta * ksi * t / 4 / f1;
    final double a3 = beta1 * beta1 * t / 24 / f1 / f1;
    Double[] roots;
    if (CompareUtils.closeEquals(a3, 0, 1e-16)) {
      roots = QUADRATIC_FINDER.getRoots(new RealPolynomialFunction1D(new double[] {a0, a1, a2}));
    } else {
      roots = ROOT_FINDER.getRoots(new RealPolynomialFunction1D(new double[] {a0, a1, a2, a3}));
    }
    Arrays.sort(roots);
    if (roots[0] > 0) {
      return data.withAlpha(roots[0]);
    }
    for (final Double r : roots) {
      if (r > 0) {
        return data.withAlpha(r);
      }
    }
    throw new MathException("Could not find positive real root");
  }

}


text:
import optparse
import os
import shutil
import stat
import subprocess
import sys

from builds.GpBuild import GpBuild

CODEGEN_MODE = 'codegen'
ORCA_CODEGEN_DEFAULT_MODE = "orca_codegen"
ORCA_MODE = 'orca'
PLANNER_MODE = 'planner'
INSTALL_DIR = "/usr/local/gpdb"
DEPENDENCY_INSTALL_DIR = "/usr/local"

def copy_installed(output_dir):
    if os.path.normpath(INSTALL_DIR) != os.path.normpath(output_dir):
        status = subprocess.call("mkdir -p " + output_dir, shell=True)
        if status:
            return status
        return subprocess.call("cp -r %s/*  %s" % (INSTALL_DIR, output_dir), shell=True)
    return

def print_compiler_version():
    status = subprocess.call(["g++", "--version"])
    if status:
        return status
    return subprocess.call(["gcc", "--version"])

def create_gpadmin_user():
    status = subprocess.call("gpdb_src/concourse/scripts/setup_gpadmin_user.bash")
    os.chmod('/bin/ping', os.stat('/bin/ping').st_mode | stat.S_ISUID)
    if status:
        return status

def copy_output():
    for dirpath, dirs, diff_files in os.walk('gpdb_src/'):
        if 'regression.diffs' in diff_files:
            diff_file = dirpath + '/' + 'regression.diffs'
            print("======================================================================\n" +
                  "DIFF FILE: " + diff_file + "\n" +
                  "----------------------------------------------------------------------")
            with open(diff_file, 'r') as fin:
                print fin.read()
    shutil.copyfile("gpdb_src/src/test/regress/regression.diffs", "icg_output/regression.diffs")
    shutil.copyfile("gpdb_src/src/test/regress/regression.out", "icg_output/regression.out")

def install_dependencies(ci_common, dependencies, install_dir):
    for dependency in dependencies:
        status = ci_common.install_dependency(dependency, install_dir)
        if status:
            return status

def fail_on_error(status):
    if status:
        sys.exit(status)

def main():
    parser = optparse.OptionParser()
    parser.add_option("--build_type", dest="build_type", default="RELEASE")
    parser.add_option("--mode", choices=['orca', 'planner'])
    parser.add_option("--compiler", dest="compiler")
    parser.add_option("--cxxflags", dest="cxxflags")
    parser.add_option("--output_dir", dest="output_dir", default=INSTALL_DIR)
    parser.add_option("--configure-option", dest="configure_option", action="append",
                      help="Configure flags, ex --configure_option=--disable-orca --configure_option=--disable-gpcloud")
    parser.add_option("--gcc-env-file", dest="gcc_env_file", help="GCC env file to be sourced")
    parser.add_option("--orca-in-gpdb-install-location", dest="orca_in_gpdb_install_location", action="store_true",
                      help="Install ORCA header and library files in GPDB install directory")
    parser.add_option("--action", choices=['build', 'test'], dest="action", default='build',
                      help="Build GPDB or Run Install Check")
    parser.add_option("--gpdb_name", dest="gpdb_name")
    (options, args) = parser.parse_args()

    gpBuild = GpBuild(options.mode)
    status = print_compiler_version()
    fail_on_error(status)

    # optional gcc env file to be source before executing configure, make, make install commands
    gpBuild.set_gcc_env_file(options.gcc_env_file)

    install_dir = INSTALL_DIR if options.orca_in_gpdb_install_location else DEPENDENCY_INSTALL_DIR
    if options.action == 'test':
        # if required, install orca and xerces library & header
        # in the install directory of gpdb to avoid packaging from multiple directories
        status = gpBuild.install_dependency(options.gpdb_name, INSTALL_DIR)
        fail_on_error(status)

    # install any dependencies specified on the command line
    status = install_dependencies(gpBuild, args, install_dir)
    fail_on_error(status)

    configure_option = []
    if options.configure_option:
        configure_option.extend(options.configure_option)

    # add DEPENDENCY_INSTALL_LOC and INSTALL_DIR paths to configure options
    configure_option.append(
        '"--with-libs={0} {1}"'.format(os.path.join(DEPENDENCY_INSTALL_DIR, "lib"), os.path.join(INSTALL_DIR, "lib")))
    configure_option.append('"--with-includes={0} {1}"'.format(os.path.join(DEPENDENCY_INSTALL_DIR, "include"),
                                                               os.path.join(INSTALL_DIR, "include")))
    gpBuild.append_configure_options(configure_option)

    status = gpBuild.configure()
    fail_on_error(status)

    # compile and install gpdb
    if options.action == 'build':
        status = gpBuild.make()
        fail_on_error(status)

        status = gpBuild.make_install()
        fail_on_error(status)

        status = gpBuild.unittest()
        fail_on_error(status)

        status = copy_installed(options.output_dir)
        fail_on_error(status)
    # run install-check tests
    elif options.action == 'test':
        status = create_gpadmin_user()
        fail_on_error(status)
        if os.getenv("TEST_SUITE", "icg") == 'icw':
            status = gpBuild.install_check('world')
        else:
            status = gpBuild.install_check()
        if status:
            copy_output()
        return status

    return 0

if __name__ == "__main__":
    sys.exit(main())


text:
/* global QUnit */
sap.ui.define([
	"sap-ui-integration-editor",
	"sap/ui/integration/editor/Editor",
	"sap/ui/integration/Host",
	"sap/ui/thirdparty/sinon-4",
	"./../../../../ContextHost",
	"sap/base/util/deepEqual",
	"sap/ui/core/Core",
	"sap/base/util/deepClone",
	"sap/base/util/merge"
], function (
	x,
	Editor,
	Host,
	sinon,
	ContextHost,
	deepEqual,
	Core,
	deepClone,
	merge
) {
	"use strict";
	QUnit.config.reorder = false;

	var sBaseUrl = "test-resources/sap/ui/integration/qunit/editor/jsons/withDesigntime/sap.card/";
	var _aCheckedLanguages = [
		{
			"key": "fr-CA",
			"description": "Français (Canada)"
		},
		{
			"key": "zh-CN",
			"description": "简体中文"
		},
		{
			"key": "zh-TW",
			"description": "繁體中文"
		}
	];
	var oManifestForObjectListFieldsWithTranslations = {
		"sap.app": {
			"id": "test.sample",
			"i18n": "../i18ntrans/i18n.properties"
		},
		"sap.card": {
			"designtime": "designtime/objectListFieldWithTranslation",
			"type": "List",
			"configuration": {
				"parameters": {
					"objectsWithPropertiesDefinedAndValueFromJsonList": {}
				},
				"destinations": {
					"local": {
						"name": "local",
						"defaultUrl": "./"
					},
					"mock_request": {
						"name": "mock_request"
					}
				}
			}
		}
	};

	var oObject1InAdminChange = {
		"_dt": {
			"_uuid": "111771a4-0d3f-4fec-af20-6f28f1b894cb"
		},
		"key": "{i18n>string1}",
		"icon": "sap-icon://add",
		"text": "text",
		"url": "http://",
		"number": 0.5
	};
	var oObject2InAdminChange = {
		"_dt": {
			"_uuid": "222771a4-0d3f-4fec-af20-6f28f1b894cb"
		},
		"key": "string2",
		"icon": "sap-icon://add",
		"text": "text",
		"url": "http://",
		"number": 0.5
	};
	var oObject3InAdminChange = {
		"_dt": {
			"_uuid": "333771a4-0d3f-4fec-af20-6f28f1b894cb"
		},
		"key": "string3",
		"icon": "sap-icon://add",
		"text": "text",
		"url": "http://",
		"number": 0.5
	};
	var _oAdminChangesOfObjectListsWithTranslations = {
		"/sap.card/configuration/parameters/objectsWithPropertiesDefinedAndValueFromJsonList/value": [oObject1InAdminChange, oObject2InAdminChange, oObject3InAdminChange],
		":layer": 0,
		":multipleLanguage": true,
		":errors": false,
		"texts": {
			"en": {
				"/sap.card/configuration/parameters/objectsWithPropertiesDefinedAndValueFromJsonList/value": {
					"111771a4-0d3f-4fec-af20-6f28f1b894cb": {
						"key": "String1 EN Admin"
					}
				}
			},
			"fr": {
				"/sap.card/configuration/parameters/objectsWithPropertiesDefinedAndValueFromJsonList/value": {
					"111771a4-0d3f-4fec-af20-6f28f1b894cb": {
						"key": "String1 FR Admin"
					}
				}
			},
			"zh-CN": {
				"/sap.card/configuration/parameters/objectsWithPropertiesDefinedAndValueFromJsonList/value": {
					"111771a4-0d3f-4fec-af20-6f28f1b894cb": {
						"key": "String1 简体 Admin"
					}
				}
			}
		}
	};
	var _oExpectedValuesOfChangesFromAdmin = {
		"object1": {
			"default": "String 1 English",
			"en": "String1 EN Admin",
			"en-US": "String 1 US English",
			"es-MX": "String 1 Spanish MX",
			"fr": "String1 FR Admin",
			"fr-FR": "String 1 French",
			"fr-CA": "String 1 French CA",
			"zh-CN": "String1 简体 Admin"
		}
	};

	function createEditor(sLanguage, oDesigntime) {
		sLanguage = sLanguage || "en";
		Core.getConfiguration().setLanguage(sLanguage);
		var oEditor = new Editor({
			designtime: oDesigntime
		});
		var oContent = document.getElementById("content");
		if (!oContent) {
			oContent = document.createElement("div");
			oContent.style.position = "absolute";
			oContent.style.top = "200px";
			oContent.style.background = "white";

			oContent.setAttribute("id", "content");
			document.body.appendChild(oContent);
			document.body.style.zIndex = 1000;
		}
		oEditor.placeAt(oContent);
		return oEditor;
	}
	function destroyEditor(oEditor) {
		oEditor.destroy();
		var oContent = document.getElementById("content");
		if (oContent) {
			oContent.innerHTML = "";
			document.body.style.zIndex = "unset";
		}
	}

	Core.getConfiguration().setLanguage("en");
	document.body.className = document.body.className + " sapUiSizeCompact ";

	function wait(ms) {
		return new Promise(function (resolve) {
			setTimeout(function () {
				resolve();
			}, ms || 1000);
		});
	}

	QUnit.module("content mode", {
		beforeEach: function () {
			this.oHost = new Host("host");
			this.oContextHost = new ContextHost("contexthost");
		},
		afterEach: function () {
			this.oHost.destroy();
			this.oContextHost.destroy();
		}
	}, function () {
		_aCheckedLanguages.forEach(function(sLanguage) {
			var sLanguageKey = sLanguage.key;
			var sCaseTitle = "in " + sLanguageKey + " (" + sLanguage.description + ")";
			QUnit.test(sCaseTitle, function (assert) {
				var that = this;
				return new Promise(function (resolve, reject) {
					that.oEditor = createEditor(sLanguageKey);
					that.oEditor.setMode("content");
					that.oEditor.setAllowSettings(true);
					that.oEditor.setAllowDynamicValues(true);
					that.oEditor.setJson({
						baseUrl: sBaseUrl,
						host: "contexthost",
						manifest: oManifestForObjectListFieldsWithTranslations,
						manifestChanges: [_oAdminChangesOfObjectListsWithTranslations]
					});
					that.oEditor.attachReady(function () {
						assert.ok(that.oEditor.isReady(), "Editor is ready");
						var oLabel1 = that.oEditor.getAggregation("_formContent")[1];
						var oField1 = that.oEditor.getAggregation("_formContent")[2];
						var oSelectedValue1 = merge(deepClone(oObject1InAdminChange, 500), {"_dt": {"_selected": true, "_position": 1}});
						var oSelectedValue2 = merge(deepClone(oObject2InAdminChange, 500), {"_dt": {"_selected": true, "_position": 2}});
						var oSelectedValue3 = merge(deepClone(oObject3InAdminChange, 500), {"_dt": {"_selected": true, "_position": 3}});
						wait().then(function () {
							assert.ok(oLabel1.isA("sap.m.Label"), "Label 1: Form content contains a Label");
							assert.equal(oLabel1.getText(), "Object properties defined: value from Json list", "Label 1: Has label text");
							assert.ok(oField1.isA("sap.ui.integration.editor.fields.ObjectListField"), "Field 1: Object List Field");
							assert.ok(deepEqual(oField1._getCurrentProperty("value"), [oObject1InAdminChange, oObject2InAdminChange, oObject3InAdminChange]), "Field 1: Value");
							var oTable1 = oField1.getAggregation("_field");
							var oToolbar1 = oTable1.getToolbar();
							assert.equal(oTable1.getBinding().getCount(), 11, "Table 1: value length is 11");
							assert.equal(oToolbar1.getContent().length, 9, "Table toolbar 1: content length");
							var oEditButton1 = oToolbar1.getContent()[2];
							assert.ok(oEditButton1.getVisible(), "Table toolbar 1: edit button visible");
							assert.ok(!oEditButton1.getEnabled(), "Table toolbar 1: edit button disabled");
							var oRow1 = oTable1.getRows()[0];
							assert.ok(deepEqual(oRow1.getBindingContext().getObject(), oSelectedValue1), "Table 1: value object is the first row");
							var oKeyCell1 = oRow1.getCells()[1];
							var sKeyPropertyValue = _oExpectedValuesOfChangesFromAdmin["object1"][sLanguageKey] || _oExpectedValuesOfChangesFromAdmin["object1"]["default"];
							assert.equal(oKeyCell1.getText(), sKeyPropertyValue, "Row 1: key cell value");
							oTable1.setSelectedIndex(0);
							oTable1.fireRowSelectionChange({
								rowIndex: 0,
								userInteraction: true
							});
							assert.ok(oEditButton1.getEnabled(), "Table toolbar 1: edit button enabled");
							oEditButton1.onAfterRendering = function(oEvent) {
								oEditButton1.onAfterRendering = function () {};
								oEditButton1.firePress();
								wait().then(function () {
									var oAddButtonInPopover1 = oField1._oObjectDetailsPopover._oAddButton;
									assert.ok(!oAddButtonInPopover1.getVisible(), "Popover 1: add button not visible");
									var oUpdateButtonInPopover1 = oField1._oObjectDetailsPopover._oUpdateButton;
									assert.ok(oUpdateButtonInPopover1.getVisible(), "Popover 1: update button visible");
									var oCancelButtonInPopover1 = oField1._oObjectDetailsPopover._oCancelButton;
									assert.ok(oCancelButtonInPopover1.getVisible(), "Popover 1: cancel button visible");
									var oCloseButtonInPopover1 = oField1._oObjectDetailsPopover._oCloseButton;
									assert.ok(!oCloseButtonInPopover1.getVisible(), "Popover 1: close button not visible");
									var oSimpleForm1 = oField1._oObjectDetailsPopover.getContent()[0].getPages()[0].getContent()[0];
									assert.ok(oSimpleForm1.isA("sap.ui.layout.form.SimpleForm"), "Popover 1: content is SimpleForm");
									var oContents1 = oSimpleForm1.getContent();
									assert.equal(oContents1.length, 16, "SimpleForm 1: length");
									assert.ok(deepEqual(JSON.parse(oContents1[15].getValue()), oSelectedValue1), "SimpleForm 1 field textArea: Has the value");
									var oFormField1 = oContents1[1];
									assert.ok(oFormField1.isA("sap.m.Input"), "SimpleForm 1 field 1: Input Field");
									assert.ok(oFormField1.getVisible(), "SimpleForm 1 field 1: Visible");
									assert.ok(oFormField1.getEditable(), "SimpleForm 1 field 1: Editable");
									assert.equal(oFormField1.getValue(), oObject1InAdminChange.key, "SimpleForm 1 field 1: Has value");
									assert.ok(oFormField1.getShowValueHelp(), "SimpleForm 1 field 1: ShowValueHelp true");
									var oValueHelpIcon1 = oFormField1._oValueHelpIcon;
									assert.ok(oValueHelpIcon1, "SimpleForm 1 field 1: Value help icon exist");
									assert.ok(oValueHelpIcon1.getVisible(), "SimpleForm 1 field 1: Value help icon visible");
									assert.ok(oValueHelpIcon1.isA("sap.ui.core.Icon"), "SimpleForm 1 field 1: Input value help icon");
									assert.equal(oValueHelpIcon1.getSrc(), "sap-icon://translate", "SimpleForm 1 field 1: Input value help icon src");
									oValueHelpIcon1.firePress();
									wait(1500).then(function () {
										var oTranslationListPage1 = oField1._oTranslationListPage;
										var oSaveButton1 = oTranslationListPage1.getFooter().getContent()[1];
										assert.ok(oSaveButton1.getVisible(), "oTranslationListPage 1 footer: save button visible");
										assert.ok(!oSaveButton1.getEnabled(), "oTranslationListPage 1 footer: save button disabled");
										var oResetButton1 = oTranslationListPage1.getFooter().getContent()[2];
										assert.ok(oResetButton1.getVisible(), "oTranslationListPage 1 footer: reset button visible");
										assert.ok(!oResetButton1.getEnabled(), "oTranslationListPage 1 footer: reset button disabled");
										var oCancelButton1 = oTranslationListPage1.getFooter().getContent()[3];
										assert.ok(!oCancelButton1.getVisible(), "oTranslationListPage 1 footer: cancel button not visible");
										var oLanguageItems1 = oTranslationListPage1.getContent()[0].getItems();
										assert.equal(oLanguageItems1.length, 50, "oTranslationPopover 1 Content: length");
										for (var i = 0; i < oLanguageItems1.length; i++) {
											var oCustomData = oLanguageItems1[i].getCustomData();
											if (oCustomData && oCustomData.length > 0) {
												var sLanguage = oCustomData[0].getKey();
												var sExpectedValue = _oExpectedValuesOfChangesFromAdmin["object1"][sLanguage] || _oExpectedValuesOfChangesFromAdmin["object1"]["default"];
												var sCurrentValue = oLanguageItems1[i].getContent()[0].getItems()[1].getValue();
												assert.equal(sCurrentValue, sExpectedValue, "oTranslationPopover 1 Content: item " + i + " " + sLanguage + ", current: " + sCurrentValue + ", expected: " + sExpectedValue);
											}
										}
										oTranslationListPage1._navBtn.firePress();
										oCancelButtonInPopover1.firePress();
										wait().then(function () {
											oField1._oObjectDetailsPopover.attachEventOnce("afterOpen", function(oEvent) {
												var oCancelButtonInPopover2 = oField1._oObjectDetailsPopover._oCancelButton;
												assert.ok(oCancelButtonInPopover2.getVisible(), "Popover 2: cancel button visible");
												var oSimpleForm2 = oField1._oObjectDetailsPopover.getContent()[0].getPages()[0].getContent()[0];
												assert.ok(oSimpleForm2.isA("sap.ui.layout.form.SimpleForm"), "Popover 2: content is SimpleForm");
												var oContents2 = oSimpleForm2.getContent();
												assert.equal(oContents2.length, 16, "SimpleForm 2: length");
												assert.ok(deepEqual(JSON.parse(oContents2[15].getValue()), oSelectedValue2), "SimpleForm 2 field textArea: Has the value");
												var oFormField2 = oContents2[1];
												assert.ok(oFormField2.isA("sap.m.Input"), "SimpleForm 2 field 1: Input Field");
												assert.ok(oFormField2.getVisible(), "SimpleForm 2 field 1: Visible");
												assert.ok(oFormField2.getEditable(), "SimpleForm 2 field 1: Editable");
												assert.equal(oFormField2.getValue(), oObject2InAdminChange.key, "SimpleForm 2 field 1: Has value");
												assert.ok(!oFormField2.getShowValueHelp(), "SimpleForm 2 field 1: ShowValueHelp not true");
												var oValueHelpIcon2 = oFormField2._oValueHelpIcon;
												assert.ok(oValueHelpIcon2, "SimpleForm 2 field 1: Value help icon exist");
												assert.ok(!oValueHelpIcon2.getVisible(), "SimpleForm 2 field 1: Value help icon not visible");
												oCancelButtonInPopover2.firePress();
												wait().then(function () {
													oField1._oObjectDetailsPopover.attachEventOnce("afterOpen", function(oEvent) {
														var oSimpleForm3 = oField1._oObjectDetailsPopover.getContent()[0].getPages()[0].getContent()[0];
														assert.ok(oSimpleForm3.isA("sap.ui.layout.form.SimpleForm"), "Popover 3: content is SimpleForm");
														var oContents3 = oSimpleForm3.getContent();
														assert.equal(oContents3.length, 16, "SimpleForm 3: length");
														assert.ok(deepEqual(JSON.parse(oContents3[15].getValue()), oSelectedValue3), "SimpleForm 3 field textArea: Has the value");
														var oFormField3 = oContents3[1];
														assert.ok(oFormField3.isA("sap.m.Input"), "SimpleForm 3 field 1: Input Field");
														assert.ok(oFormField3.getVisible(), "SimpleForm 3 field 1: Visible");
														assert.ok(oFormField3.getEditable(), "SimpleForm 3 field 1: Editable");
														assert.equal(oFormField3.getValue(), oObject3InAdminChange.key, "SimpleForm 3 field 1: Has value");
														assert.ok(!oFormField3.getShowValueHelp(), "SimpleForm 3 field 1: ShowValueHelp not true");
														var oValueHelpIcon3 = oFormField3._oValueHelpIcon;
														assert.ok(oValueHelpIcon3, "SimpleForm 3 field 1: Value help icon exist");
														assert.ok(!oValueHelpIcon3.getVisible(), "SimpleForm 3 field 1: Value help icon not visible");
														destroyEditor(that.oEditor);
														resolve();
													});
													oTable1.setSelectedIndex(2);
													oTable1.fireRowSelectionChange({
														rowIndex: 2,
														userInteraction: true
													});
													assert.ok(oEditButton1.getEnabled(), "Table toolbar 1: edit button enabled");
													oEditButton1.firePress();
												});
											});
											oTable1.setSelectedIndex(1);
											oTable1.fireRowSelectionChange({
												rowIndex: 1,
												userInteraction: true
											});
											assert.ok(oEditButton1.getEnabled(), "Table toolbar 1: edit button enabled");
											oEditButton1.firePress();
										});
									});
								});
							};
						});
					});
				});
			});
		});
	});

	QUnit.done(function () {
		document.getElementById("qunit-fixture").style.display = "none";
	});
});


text:
package openframes.renders;

import openframes.blocks.Block;
import openframes.blocks.BlockItem;
import openframes.blocks.BlockRecord;
import openframes.blocks.BlockRenderer;
import openframes.blocks.Blocks;
import openframes.carriage.Carriage;
import openframes.entity.TemplateCarriageEntity;
import openframes.items.CarriageItem;
import openframes.util.Directions;

public class CarriageRenderer extends BlockRenderer {
    public CarriageRenderer() {
        Blocks.Carriage.RenderId = Initialize(Blocks.Carriage.blockID);
    }

    @Override
    public void Render(net.minecraft.tileentity.TileEntity TileEntity) {
        if (TileEntity instanceof TemplateCarriageEntity) {
            TemplateCarriageEntity Carriage = (TemplateCarriageEntity) TileEntity;

            if (Carriage.Pattern == null) {
                return;
            }

            if (Carriage.RenderPattern == false) {
                return;
            }

            SetSideSpan(0, 0, 1, 1);

            SetTextureSpan(openframes.carriage.Carriage.PlaceholderIcon);

            for (BlockRecord Record : Carriage.Pattern) {
                RenderGhost(Record.X, Record.Y, Record.Z);
            }
        }
    }

    @Override
    public net.minecraft.util.Icon GetIcon(net.minecraft.item.ItemStack Item, Directions Side) {
        if (Side != Directions.PosY) {
            int DecorationId = CarriageItem.GetDecorationId(Item);

            if (DecorationId != 0) {
                int DecorationMeta = CarriageItem.GetDecorationMeta(Item);

                try {
                    return (Block.Get(DecorationId).getIcon(Side.ordinal(), DecorationMeta));
                } catch (Throwable Throwable) {
                    Throwable.printStackTrace();
                }
            }
        }

        return (Blocks.Carriage.getIcon(0, BlockItem.GetBlockType(Item)));
    }
}


text:
from parser import (IF_RULE, ELSE_RULE, PREDICT_RULE)
from lexer import lex
import parser

'''
Stmt -> IF_RULE Stmt ELSE_RULE Stmt
Stmt -> PREDICT
'''

def sema_if(rules, idx, parent_node):
    if rules[idx].id != IF_RULE:
        raise Exception('Expected IF_RULE!, got {} at index {}'
                        .format(str(rules[idx], idx)))
    if_rule = rules[idx]
    if parent_node is None:
        parent_node = if_rule
    else:
        parent_node.childes.append(if_rule)
    print('DEBUG: ate if rule: {}'.format(rules[idx]))
    idx += 1
    idx = parse_tree(rules, idx, if_rule)
    if rules[idx].id != ELSE_RULE:
        raise Exception('Expected else rule, but seen {} rule at index {}'
                        .format(rules[idx], idx))
    print('DEBUG: ate else rule: {}'.format(rules[idx]))
    idx += 1
    idx = parse_tree(rules, idx, if_rule)
    return idx

def sema_predict(rules, idx, parent_node):
    if parent_node is None:
        raise Exception('Syntactic error, '
                        'predict statement cannot stand alone')
    if rules[idx].id != PREDICT_RULE:
        raise Exception('Expected PREDICT_RULE!, got {} at index {}'
                        .format(str(rules[idx]), idx))
    predict_rule = rules[idx]
    parent_node.childes.append(predict_rule)
    print('DEBUG: ate predict rule: {}'.format(predict_rule))
    return idx + 1

def parse_tree(rules, rule_idx, parent_node=None):
    rule0 = rules[rule_idx]
    if rule0.id == IF_RULE:
        rule_idx = sema_if(rules, rule_idx, parent_node)
    elif rule0.id == PREDICT_RULE:
        rule_idx = sema_predict(rules, rule_idx, parent_node)
    else:
        raise Exception('Uknown rule {}'.format(rule0))
    return rule_idx

def parse(tree_path):
    with open(tree_path) as tree_file:
        rules = parser.parse(lex(tree_file.read()))
        idx = parse_tree(rules, 0)
    return rules[0] if idx == len(rules) else None

if __name__ == '__main__':
    parse('tree.txt')


text:
package io.alakazam.jackson;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.guava.GuavaModule;
import com.google.common.base.Optional;
import com.google.common.cache.CacheBuilderSpec;
import com.google.common.net.HostAndPort;
import org.junit.Before;
import org.junit.Test;

import static org.fest.assertions.api.Assertions.assertThat;

public class GuavaExtrasModuleTest {
    private final ObjectMapper mapper = new ObjectMapper();

    @Before
    public void setUp() throws Exception {
        mapper.registerModule(new GuavaModule());
        mapper.registerModule(new GuavaExtrasModule());
    }

    @Test
    public void canDeserializeAHostAndPort() throws Exception {
        assertThat(mapper.readValue("\"example.com:8080\"", HostAndPort.class))
                .isEqualTo(HostAndPort.fromParts("example.com", 8080));
    }

    @Test
    public void canDeserializeCacheBuilderSpecs() throws Exception {
        assertThat(mapper.readValue("\"maximumSize=30\"", CacheBuilderSpec.class))
                .isEqualTo(CacheBuilderSpec.parse("maximumSize=30"));
    }

    @Test
    public void canDeserializeAbsentOptions() throws Exception {
        assertThat(mapper.readValue("null", new TypeReference<Optional<String>>() {}))
                .isEqualTo(Optional.absent());
    }

    @Test
    public void canDeserializePresentOptions() throws Exception {
        assertThat(mapper.readValue("\"woo\"", new TypeReference<Optional<String>>() {}))
                .isEqualTo(Optional.of("woo"));
    }
}