text:
package uk.me.karlsen.ode.stores;

import java.util.ArrayList;
import java.util.List;

import uk.me.karlsen.ode.ReaderWriter;
import uk.me.karlsen.ode.TomeOfKnowledge;
import uk.me.karlsen.ode.types.Character;
import uk.me.karlsen.ode.utils.BinEditHelper;

public class CharacterStore {

	private Character char0;
	private Character char1;
	private Character char2;
	private List<Character> characters;

	private ReaderWriter rw;

	public CharacterStore(ReaderWriter rw) {
		this.rw = rw;
		characters = new ArrayList<Character>();
		this.readInCharacters();
	}

	//TODO -- make this code more concise
	public void readInCharacters() {

		byte[] startingStats;
		byte[] maxStats;
		byte[] blockingBonuses;
		byte[] bonusesAndFramesets;

		long pos = TomeOfKnowledge.MIN_STATS_OFFSET;
		rw.seek(pos);
		startingStats = new byte[TomeOfKnowledge.MIN_STATS_LENGTH_IN_BYTES];
		for(int j = 0; j < TomeOfKnowledge.MIN_STATS_LENGTH_IN_BYTES; j++){
			startingStats[j] = rw.readByte();
			pos++;
			rw.seek(pos);
		}

		BinEditHelper beh = new BinEditHelper(rw);
		long initWarriorStrength = beh.convertFourBytesToNumber(startingStats, 0);
		long initRogueStrength = beh.convertFourBytesToNumber(startingStats, 4);
		long initSorcStrength = beh.convertFourBytesToNumber(startingStats, 8);
		long initWarriorMagic = beh.convertFourBytesToNumber(startingStats, 12);
		long initRogueMagic = beh.convertFourBytesToNumber(startingStats, 16);
		long initSorcMagic = beh.convertFourBytesToNumber(startingStats, 20);
		long initWarriorDexterity = beh.convertFourBytesToNumber(startingStats, 24);
		long initRogueDexterity = beh.convertFourBytesToNumber(startingStats, 28);
		long initSorcDexterity = beh.convertFourBytesToNumber(startingStats, 32);
		long initWarriorVitality = beh.convertFourBytesToNumber(startingStats, 36);
		long initRogueVitality = beh.convertFourBytesToNumber(startingStats, 40);
		long initSorcVitality = beh.convertFourBytesToNumber(startingStats, 44);

		pos = TomeOfKnowledge.MAX_STATS_OFFSET;
		rw.seek(pos);
		maxStats = new byte[TomeOfKnowledge.MAX_STATS_LENGTH_IN_BYTES];
		for(int j = 0; j < TomeOfKnowledge.MAX_STATS_LENGTH_IN_BYTES; j++){
			maxStats[j] = rw.readByte();
			pos++;
			rw.seek(pos);
		}

		long maxWarriorStrength = beh.convertFourBytesToNumber(maxStats, 0);
		long maxWarriorMagic = beh.convertFourBytesToNumber(maxStats, 4);
		long maxWarriorDexterity = beh.convertFourBytesToNumber(maxStats, 8);
		long maxWarriorVitality = beh.convertFourBytesToNumber(maxStats, 12);
		long maxRogueStrength = beh.convertFourBytesToNumber(maxStats, 16);
		long maxRogueMagic = beh.convertFourBytesToNumber(maxStats, 20);
		long maxRogueDexterity = beh.convertFourBytesToNumber(maxStats, 24);
		long maxRogueVitality = beh.convertFourBytesToNumber(maxStats, 28);
		long maxSorcStrength = beh.convertFourBytesToNumber(maxStats, 32);
		long maxSorcMagic = beh.convertFourBytesToNumber(maxStats, 36);
		long maxSorcDexterity = beh.convertFourBytesToNumber(maxStats, 40);
		long maxSorcVitality = beh.convertFourBytesToNumber(maxStats, 44);

		pos = TomeOfKnowledge.BLOCKING_BONUSES_OFFSET;
		rw.seek(pos);
		blockingBonuses = new byte[TomeOfKnowledge.BLOCKING_BONUSES_LENGTH_IN_BYTES];
		for(int j = 0; j < TomeOfKnowledge.BLOCKING_BONUSES_LENGTH_IN_BYTES; j++){
			blockingBonuses[j] = rw.readByte();
			pos++;
			rw.seek(pos);
		}

		long warriorBlockingBonus = beh.convertFourBytesToNumber(blockingBonuses, 0);
		long rogueBlockingBonus = beh.convertFourBytesToNumber(blockingBonuses, 4);
		long sorcBlockingBonus = beh.convertFourBytesToNumber(blockingBonuses, 8);

		pos = TomeOfKnowledge.BONUSES_AND_FRAMESETS_OFFSET;
		rw.seek(pos);
		bonusesAndFramesets = new byte[TomeOfKnowledge.BONUSES_AND_FRAMESETS_LENGTH_IN_BYTES];
		for(int j = 0; j < TomeOfKnowledge.BONUSES_AND_FRAMESETS_LENGTH_IN_BYTES; j++){
			bonusesAndFramesets[j] = rw.readByte();
			pos++;
			rw.seek(pos);
		}

		/*
		0 	Idle frameset in the dungeon
		1 	Attacking frameset
		2 	Walking frameset in dungeon
		3 	Blocking speed
		4 	Death frameset
		5 	Frameset for magic casting
		6 	Hit recovery speed
		7 	Idle frameset in town
		8 	Walking frameset in town
		9 	Single handed weapon attacking speed
		10 	Spell casting speed
		*/

		int warriorDungeonIdleFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[0]);
		int warriorAttackingFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[1]);
		int warriorDungeonWalkFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[2]);
		int warriorBlockSpeed = beh.convertUnsignedByteToInt(bonusesAndFramesets[3]);
		int warriorDeathFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[4]);
		int warriorCastingFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[5]);
		int warriorHitRecoverySpeed = beh.convertUnsignedByteToInt(bonusesAndFramesets[6]);
		int warriorTownIdleFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[7]);
		int warriorTownWalkFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[8]);
		int warrior1hAttackSpeed = beh.convertUnsignedByteToInt(bonusesAndFramesets[9]);
		int warriorCastingSpeed = beh.convertUnsignedByteToInt(bonusesAndFramesets[10]);

		int rogueDungeonIdleFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[11]);
		int rogueAttackingFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[12]);
		int rogueDungeonWalkFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[13]);
		int rogueBlockSpeed = beh.convertUnsignedByteToInt(bonusesAndFramesets[14]);
		int rogueDeathFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[15]);
		int rogueCastingFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[16]);
		int rogueHitRecoverySpeed = beh.convertUnsignedByteToInt(bonusesAndFramesets[17]);
		int rogueTownIdleFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[18]);
		int rogueTownWalkFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[19]);
		int rogue1hAttackSpeed = beh.convertUnsignedByteToInt(bonusesAndFramesets[20]);
		int rogueCastingSpeed = beh.convertUnsignedByteToInt(bonusesAndFramesets[21]);

		int sorcDungeonIdleFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[22]);
		int sorcAttackingFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[23]);
		int sorcDungeonWalkFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[24]);
		int sorcBlockSpeed = beh.convertUnsignedByteToInt(bonusesAndFramesets[25]);
		int sorcDeathFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[26]);
		int sorcCastingFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[27]);
		int sorcHitRecoverySpeed = beh.convertUnsignedByteToInt(bonusesAndFramesets[28]);
		int sorcTownIdleFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[29]);
		int sorcTownWalkFrameset = beh.convertUnsignedByteToInt(bonusesAndFramesets[30]);
		int sorc1hAttackSpeed = beh.convertUnsignedByteToInt(bonusesAndFramesets[31]);
		int sorcCastingSpeed = beh.convertUnsignedByteToInt(bonusesAndFramesets[32]);

		//Creating characters
		char0 = new Character();
		char0.setClassName("Warrior");
		char0.setInitStrength(initWarriorStrength);
		char0.setInitMagic(initWarriorMagic);
		char0.setInitDexterity(initWarriorDexterity);
		char0.setInitVitality(initWarriorVitality);
		char0.setMaxStrength(maxWarriorStrength);
		char0.setMaxMagic(maxWarriorMagic);
		char0.setMaxDexterity(maxWarriorDexterity);
		char0.setMaxVitality(maxWarriorVitality);
		char0.setBlockingBonus(warriorBlockingBonus);
		char0.setDungeonIdleFrameset(warriorDungeonIdleFrameset);
		char0.setAttackingFrameset(warriorAttackingFrameset);
		char0.setDungeonWalkFrameset(warriorDungeonWalkFrameset);
		char0.setBlockSpeed(warriorBlockSpeed);
		char0.setDeathFrameset(warriorDeathFrameset);
		char0.setCastingFrameset(warriorCastingFrameset);
		char0.setHitRecoverySpeed(warriorHitRecoverySpeed);
		char0.setTownIdleFrameset(warriorTownIdleFrameset);
		char0.setTownWalkFrameset(warriorTownWalkFrameset);
		char0.setOneHandedAttackSpeed(warrior1hAttackSpeed);
		char0.setCastingSpeed(warriorCastingSpeed);

		char1 = new Character();
		char1.setClassName("Rogue");
		char1.setInitStrength(initRogueStrength);
		char1.setInitMagic(initRogueMagic);
		char1.setInitDexterity(initRogueDexterity);
		char1.setInitVitality(initRogueVitality);
		char1.setMaxStrength(maxRogueStrength);
		char1.setMaxMagic(maxRogueMagic);
		char1.setMaxDexterity(maxRogueDexterity);
		char1.setMaxVitality(maxRogueVitality);
		char1.setBlockingBonus(rogueBlockingBonus);
		char1.setDungeonIdleFrameset(rogueDungeonIdleFrameset);
		char1.setAttackingFrameset(rogueAttackingFrameset);
		char1.setDungeonWalkFrameset(rogueDungeonWalkFrameset);
		char1.setBlockSpeed(rogueBlockSpeed);
		char1.setDeathFrameset(rogueDeathFrameset);
		char1.setCastingFrameset(rogueCastingFrameset);
		char1.setHitRecoverySpeed(rogueHitRecoverySpeed);
		char1.setTownIdleFrameset(rogueTownIdleFrameset);
		char1.setTownWalkFrameset(rogueTownWalkFrameset);
		char1.setOneHandedAttackSpeed(rogue1hAttackSpeed);
		char1.setCastingSpeed(rogueCastingSpeed);

		char2 = new Character();
		char2.setClassName("Sorceror");
		char2.setInitStrength(initSorcStrength);
		char2.setInitMagic(initSorcMagic);
		char2.setInitDexterity(initSorcDexterity);
		char2.setInitVitality(initSorcVitality);
		char2.setMaxStrength(maxSorcStrength);
		char2.setMaxMagic(maxSorcMagic);
		char2.setMaxDexterity(maxSorcDexterity);
		char2.setMaxVitality(maxSorcVitality);
		char2.setBlockingBonus(sorcBlockingBonus);
		char2.setDungeonIdleFrameset(sorcDungeonIdleFrameset);
		char2.setAttackingFrameset(sorcAttackingFrameset);
		char2.setDungeonWalkFrameset(sorcDungeonWalkFrameset);
		char2.setBlockSpeed(sorcBlockSpeed);
		char2.setDeathFrameset(sorcDeathFrameset);
		char2.setCastingFrameset(sorcCastingFrameset);
		char2.setHitRecoverySpeed(sorcHitRecoverySpeed);
		char2.setTownIdleFrameset(sorcTownIdleFrameset);
		char2.setTownWalkFrameset(sorcTownWalkFrameset);
		char2.setOneHandedAttackSpeed(sorc1hAttackSpeed);
		char2.setCastingSpeed(sorcCastingSpeed);

		characters.add(char0);
		characters.add(char1);
		characters.add(char2);
	}

	//TODO -- make this code more concise
	public byte[] getInitStatBytes(){
		BinEditHelper beh = new BinEditHelper(rw);
		byte[] returnedStartingStats = new byte[TomeOfKnowledge.MIN_STATS_LENGTH_IN_BYTES];
		long warriorInitStrength = char0.getInitStrength();
		beh.setLongAsFourBytes(warriorInitStrength, returnedStartingStats, 0);
		long rogueInitStrength = char1.getInitStrength();
		beh.setLongAsFourBytes(rogueInitStrength, returnedStartingStats, 4);
		long sorcInitStrength = char2.getInitStrength();
		beh.setLongAsFourBytes(sorcInitStrength, returnedStartingStats, 8);
		long warriorInitMagic = char0.getInitMagic();
		beh.setLongAsFourBytes(warriorInitMagic, returnedStartingStats, 12);
		long rogueInitMagic = char1.getInitMagic();
		beh.setLongAsFourBytes(rogueInitMagic, returnedStartingStats, 16);
		long sorcInitMagic = char2.getInitMagic();
		beh.setLongAsFourBytes(sorcInitMagic, returnedStartingStats, 20);
		long warriorInitDex = char0.getInitDexterity();
		beh.setLongAsFourBytes(warriorInitDex, returnedStartingStats, 24);
		long rogueInitDex = char1.getInitDexterity();
		beh.setLongAsFourBytes(rogueInitDex, returnedStartingStats, 28);
		long sorcInitDex = char2.getInitDexterity();
		beh.setLongAsFourBytes(sorcInitDex, returnedStartingStats, 32);
		long warriorInitVit = char0.getInitVitality();
		beh.setLongAsFourBytes(warriorInitVit, returnedStartingStats, 36);
		long rogueInitVit = char1.getInitVitality();
		beh.setLongAsFourBytes(rogueInitVit, returnedStartingStats, 40);
		long sorcInitVit = char2.getInitVitality();
		beh.setLongAsFourBytes(sorcInitVit, returnedStartingStats, 44);
		return returnedStartingStats;
	}

	//TODO -- make this code more concise
	public byte[] getMaxStatBytes(){
		BinEditHelper beh = new BinEditHelper(rw);
		byte[] maxStats = new byte[TomeOfKnowledge.MAX_STATS_LENGTH_IN_BYTES];
		long warriorMaxStrength = char0.getMaxStrength();
		beh.setLongAsFourBytes(warriorMaxStrength, maxStats, 0);
		long warriorMaxMagic = char0.getMaxMagic();
		beh.setLongAsFourBytes(warriorMaxMagic, maxStats, 4);
		long warriorMaxDex = char0.getMaxDexterity();
		beh.setLongAsFourBytes(warriorMaxDex, maxStats, 8);
		long warriorMaxVit = char0.getMaxVitality();
		beh.setLongAsFourBytes(warriorMaxVit, maxStats, 12);
		long rogueMaxStrength = char1.getMaxStrength();
		beh.setLongAsFourBytes(rogueMaxStrength, maxStats, 16);
		long rogueMaxMagic = char1.getMaxMagic();
		beh.setLongAsFourBytes(rogueMaxMagic, maxStats, 20);
		long rogueMaxDex = char1.getMaxDexterity();
		beh.setLongAsFourBytes(rogueMaxDex, maxStats, 24);
		long rogueMaxVit = char1.getMaxVitality();
		beh.setLongAsFourBytes(rogueMaxVit, maxStats, 28);
		long sorcMaxStrength = char2.getMaxStrength();
		beh.setLongAsFourBytes(sorcMaxStrength, maxStats, 32);
		long sorcMaxMagic = char2.getMaxMagic();
		beh.setLongAsFourBytes(sorcMaxMagic, maxStats, 36);
		long sorcMaxDex = char2.getMaxDexterity();
		beh.setLongAsFourBytes(sorcMaxDex, maxStats, 40);
		long sorcMaxVit = char2.getMaxVitality();
		beh.setLongAsFourBytes(sorcMaxVit, maxStats, 44);
		return maxStats;
	}

	//TODO -- make this code more concise
	public byte[] getBlockingBonusBytes(){
		BinEditHelper beh = new BinEditHelper(rw);
		byte[] blockingBonuses = new byte[TomeOfKnowledge.BLOCKING_BONUSES_LENGTH_IN_BYTES];
		long warriorBlockingBonus = char0.getBlockingBonus();
		beh.setLongAsFourBytes(warriorBlockingBonus, blockingBonuses, 0);
		long rogueBlockingBonus = char1.getBlockingBonus();
		beh.setLongAsFourBytes(rogueBlockingBonus, blockingBonuses, 4);
		long sorcBlockingBonus = char2.getBlockingBonus();
		beh.setLongAsFourBytes(sorcBlockingBonus, blockingBonuses, 8);
		return blockingBonuses;
	}

	//TODO -- make this code more concise
	public byte[] getBonusesAndFramesetBytes(){
		byte[] bonusesAndFramesets = new byte[TomeOfKnowledge.BONUSES_AND_FRAMESETS_LENGTH_IN_BYTES];
		bonusesAndFramesets[0] = (byte) char0.getDungeonIdleFrameset();
		bonusesAndFramesets[1] = (byte) char0.getAttackingFrameset();
		bonusesAndFramesets[2] = (byte) char0.getDungeonWalkFrameset();
		bonusesAndFramesets[3] = (byte) char0.getBlockSpeed();
		bonusesAndFramesets[4] = (byte) char0.getDeathFrameset();
		bonusesAndFramesets[5] = (byte) char0.getCastingFrameset();
		bonusesAndFramesets[6] = (byte) char0.getHitRecoverySpeed();
		bonusesAndFramesets[7] = (byte) char0.getTownIdleFrameset();
		bonusesAndFramesets[8] = (byte) char0.getTownWalkFrameset();
		bonusesAndFramesets[9] = (byte) char0.getOneHandedAttackSpeed();
		bonusesAndFramesets[10] = (byte) char0.getCastingSpeed();
		bonusesAndFramesets[11] = (byte) char1.getDungeonIdleFrameset();
		bonusesAndFramesets[12] = (byte) char1.getAttackingFrameset();
		bonusesAndFramesets[13] = (byte) char1.getDungeonWalkFrameset();
		bonusesAndFramesets[14] = (byte) char1.getBlockSpeed();
		bonusesAndFramesets[15] = (byte) char1.getDeathFrameset();
		bonusesAndFramesets[16] = (byte) char1.getCastingFrameset();
		bonusesAndFramesets[17] = (byte) char1.getHitRecoverySpeed();
		bonusesAndFramesets[18] = (byte) char1.getTownIdleFrameset();
		bonusesAndFramesets[19] = (byte) char1.getTownWalkFrameset();
		bonusesAndFramesets[20] = (byte) char1.getOneHandedAttackSpeed();
		bonusesAndFramesets[21] = (byte) char1.getCastingSpeed();
		bonusesAndFramesets[22] = (byte) char2.getDungeonIdleFrameset();
		bonusesAndFramesets[23] = (byte) char2.getAttackingFrameset();
		bonusesAndFramesets[24] = (byte) char2.getDungeonWalkFrameset();
		bonusesAndFramesets[25] = (byte) char2.getBlockSpeed();
		bonusesAndFramesets[26] = (byte) char2.getDeathFrameset();
		bonusesAndFramesets[27] = (byte) char2.getCastingFrameset();
		bonusesAndFramesets[28] = (byte) char2.getHitRecoverySpeed();
		bonusesAndFramesets[29] = (byte) char2.getTownIdleFrameset();
		bonusesAndFramesets[30] = (byte) char2.getTownWalkFrameset();
		bonusesAndFramesets[31] = (byte) char2.getOneHandedAttackSpeed();
		bonusesAndFramesets[32] = (byte) char2.getCastingSpeed();
		return bonusesAndFramesets;
	}

	public void printCharacters() {
		for(Character c : characters){
			c.printCharacter();
		}
	}

	public void writeCharactersToEXE() {

		byte[] retrievedInitStatBytes = this.getInitStatBytes();
		rw.writeBytes(retrievedInitStatBytes, TomeOfKnowledge.MIN_STATS_OFFSET);

		byte[] retrievedMaxStatBytes = this.getMaxStatBytes();
		rw.writeBytes(retrievedMaxStatBytes, TomeOfKnowledge.MAX_STATS_OFFSET);

		byte[] retrievedBlockingBonusBytes = this.getBlockingBonusBytes();
		rw.writeBytes(retrievedBlockingBonusBytes, TomeOfKnowledge.BLOCKING_BONUSES_OFFSET);

		byte[] retrievedBonusesAndFramesetBytes = this.getBonusesAndFramesetBytes();
		rw.writeBytes(retrievedBonusesAndFramesetBytes, TomeOfKnowledge.BONUSES_AND_FRAMESETS_OFFSET);
	}

	public Character getCharacter(int i) {
		return characters.get(i);
	}

	public void setAllMaxStatsTo255() {
		for(Character c : characters){
			c.setMaxDexterity(255);
			c.setMaxMagic(255);
			c.setMaxStrength(255);
			c.setMaxVitality(255);
		}
	}

	//TODO -- The 3 methods below are "tacked on". Integrate them better.
	//FIXME -- broken due to change in the approach of reading/writing files
	public void setCharZeroStartingSkillBySpellID(int i) {
		long l = i;
		byte[] spellID = new byte[4];
		spellID[0] = (byte)(l >>>  0);
		spellID[1] = (byte)(l >>>  8);
		spellID[2] = (byte)(l >>> 16);
		spellID[3] = (byte)(l >>> 24);
		String[] spellNames = TomeOfKnowledge.createSpellNamesArray();
		String spellName = spellNames[i];
		byte[][] skillBytes = TomeOfKnowledge.createSkillBytesArray();
		byte[] bytesToUse = skillBytes[i];
//		rw.writeBytes(bytesToUse, TomeOfKnowledge.CHARACTER_ZERO_SKILL_LOC_1);
//		rw.writeBytes(bytesToUse, TomeOfKnowledge.CHARACTER_ZERO_SKILL_LOC_2);
//		rw.writeBytes(spellID, TomeOfKnowledge.CHARACTER_ZERO_SPELL_LOC_1);
	}

	//FIXME -- broken due to change in the approach of reading/writing files
	public void setCharOneStartingSkillBySpellID(int i) {
		long l = i;
		byte[] spellID = new byte[4];
		spellID[0] = (byte)(l >>>  0);
		spellID[1] = (byte)(l >>>  8);
		spellID[2] = (byte)(l >>> 16);
		spellID[3] = (byte)(l >>> 24);
		String[] spellNames = TomeOfKnowledge.createSpellNamesArray();
		String spellName = spellNames[i];
		byte[][] skillBytes = TomeOfKnowledge.createSkillBytesArray();
		byte[] bytesToUse = skillBytes[i];
//		rw.writeBytes(bytesToUse, TomeOfKnowledge.CHARACTER_ONE_SKILL_LOC_1);
//		rw.writeBytes(bytesToUse, TomeOfKnowledge.CHARACTER_ONE_SKILL_LOC_2);
//		rw.writeBytes(spellID, TomeOfKnowledge.CHARACTER_ONE_SPELL_LOC_1);

	}

	//FIXME -- broken due to change in the approach of reading/writing files
	public void setCharTwoStartingSkillBySpellID(int i) {
		long l = i;
		byte[] spellID = new byte[4];
		spellID[0] = (byte)(l >>>  0);
		spellID[1] = (byte)(l >>>  8);
		spellID[2] = (byte)(l >>> 16);
		spellID[3] = (byte)(l >>> 24);
		String[] spellNames = TomeOfKnowledge.createSpellNamesArray();
		String spellName = spellNames[i];
		byte[][] skillBytes = TomeOfKnowledge.createSkillBytesArray();
		byte[] bytesToUse = skillBytes[i];
//		rw.writeBytes(bytesToUse, TomeOfKnowledge.CHARACTER_TWO_SKILL_LOC_1);
//		rw.writeBytes(bytesToUse, TomeOfKnowledge.CHARACTER_TWO_SKILL_LOC_2);
//		rw.writeBytes(spellID, TomeOfKnowledge.CHARACTER_TWO_SPELL_LOC_1);
	}

	public String[] getCharacterNames() {
		String[] charNames = new String[3];
		charNames[0] = characters.get(0).getClassName();
		charNames[1] = characters.get(1).getClassName();
		charNames[2] = characters.get(2).getClassName();
		return charNames;
	}

	public Character getCharacterByName(String charName) {
		Character characterSelected = null;
		for(Character c : characters){
			if(c.getClassName().equals(charName)){
				characterSelected = c;
			}
		}
		return characterSelected;
	}

}


text:
cc._currentProjectionMatrix = -1;

if (cc.ENABLE_GL_STATE_CACHE) {
    cc.MAX_ACTIVETEXTURE = 16;

    cc._currentShaderProgram = -1;
    cc._currentBoundTexture = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
    cc._blendingSource = -1;
    cc._blendingDest = -1;
    cc._GLServerState = 0;
    if(cc.TEXTURE_ATLAS_USE_VAO)
        cc._uVAO = 0;

    var _currBuffers = {};
    var _currBuffer;

    WebGLRenderingContext.prototype.glBindBuffer = WebGLRenderingContext.prototype.bindBuffer;
    WebGLRenderingContext.prototype.bindBuffer = function (target, buffer) {
        if (_currBuffers[target] !== buffer) {
            _currBuffers[target] = buffer;
            this.glBindBuffer(target, buffer);
        }

        if (!_currBuffer || _currBuffer !== buffer) {
            _currBuffer = buffer;
            return false;
        }
        else {
            return true;
        }
    };

    WebGLRenderingContext.prototype.glEnableVertexAttribArray = WebGLRenderingContext.prototype.enableVertexAttribArray;
    WebGLRenderingContext.prototype.enableVertexAttribArray = function (index) {
        if (index === cc.VERTEX_ATTRIB_FLAG_POSITION) {
            if (!this._vertexAttribPosition) {
                this.glEnableVertexAttribArray(index);
                this._vertexAttribPosition = true;
            }
        }
        else if (index === cc.VERTEX_ATTRIB_FLAG_COLOR) {
            if (!this._vertexAttribColor) {
                this.glEnableVertexAttribArray(index);
                this._vertexAttribColor = true;
            }
        }
        else if (index === cc.VERTEX_ATTRIB_FLAG_TEX_COORDS) {
            if (!this._vertexAttribTexCoords) {
                this.glEnableVertexAttribArray(index);
                this._vertexAttribTexCoords = true;
            }
        }
        else {
            this.glEnableVertexAttribArray(index);
        }
    };

    WebGLRenderingContext.prototype.glDisableVertexAttribArray = WebGLRenderingContext.prototype.disableVertexAttribArray;
    WebGLRenderingContext.prototype.disableVertexAttribArray = function (index) {
        if (index === cc.VERTEX_ATTRIB_FLAG_COLOR) {
            if (this._vertexAttribColor) {
                this.glDisableVertexAttribArray(index);
                this._vertexAttribColor = false;
            }
        }
        else if (index === cc.VERTEX_ATTRIB_FLAG_TEX_COORDS) {
            if (this._vertexAttribTexCoords) {
                this.glDisableVertexAttribArray(index);
                this._vertexAttribTexCoords = false;
            }
        }
        else if (index !== 0) {
            this.glDisableVertexAttribArray(index);
        }
    };
}

// GL State Cache functions

/**
 * Invalidates the GL state cache.

 * If CC_ENABLE_GL_STATE_CACHE it will reset the GL state cache.
 * @function
 */
cc.glInvalidateStateCache = function () {
    cc.kmGLFreeAll();
    cc._currentProjectionMatrix = -1;
    if (cc.ENABLE_GL_STATE_CACHE) {
        cc._currentShaderProgram = -1;
        for (var i = 0; i < cc.MAX_ACTIVETEXTURE; i++) {
            cc._currentBoundTexture[i] = -1;
        }
        cc._blendingSource = -1;
        cc._blendingDest = -1;
        cc._GLServerState = 0;
    }
};

/**
 * Uses the GL program in case program is different than the current one.

 * If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glUseProgram() directly.
 * @function
 * @param {WebGLProgram} program
 */
cc.glUseProgram = function (program) {
    if (program !== cc._currentShaderProgram) {
        cc._currentShaderProgram = program;
        cc._renderContext.useProgram(program);
    }
};

if(!cc.ENABLE_GL_STATE_CACHE){
    cc.glUseProgram = function (program) {
        cc._renderContext.useProgram(program);
    };
}

/**
 * Deletes the GL program. If it is the one that is being used, it invalidates it.

 * If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glDeleteProgram() directly.
 * @function
 * @param {WebGLProgram} program
 */
cc.glDeleteProgram = function (program) {
    if (cc.ENABLE_GL_STATE_CACHE) {
        if (program === cc._currentShaderProgram)
            cc._currentShaderProgram = -1;
    }
    gl.deleteProgram(program);
};

/**
 * Uses a blending function in case it not already used.

 * If CC_ENABLE_GL_STATE_CACHE is disabled, it will the glBlendFunc() directly.
 * @function
 * @param {Number} sfactor
 * @param {Number} dfactor
 */
cc.glBlendFunc = function (sfactor, dfactor) {
    if ((sfactor !== cc._blendingSource) || (dfactor !== cc._blendingDest)) {
        cc._blendingSource = sfactor;
        cc._blendingDest = dfactor;
        cc.setBlending(sfactor, dfactor);
    }
};

/**
 * @function
 * @param {Number} sfactor
 * @param {Number} dfactor
 */
cc.setBlending = function (sfactor, dfactor) {
    var ctx = cc._renderContext;
    if ((sfactor === ctx.ONE) && (dfactor === ctx.ZERO)) {
        ctx.disable(ctx.BLEND);
    } else {
        ctx.enable(ctx.BLEND);
        cc._renderContext.blendFunc(sfactor,dfactor);
        //TODO need fix for WebGL
        //ctx.blendFuncSeparate(ctx.SRC_ALPHA, dfactor, sfactor, dfactor);
    }
};

/**
 * @function
 * @param {Number} sfactor
 * @param {Number} dfactor
 */
cc.glBlendFuncForParticle = function(sfactor, dfactor) {
    if ((sfactor !== cc._blendingSource) || (dfactor !== cc._blendingDest)) {
        cc._blendingSource = sfactor;
        cc._blendingDest = dfactor;
        var ctx = cc._renderContext;
        if ((sfactor === ctx.ONE) && (dfactor === ctx.ZERO)) {
            ctx.disable(ctx.BLEND);
        } else {
            ctx.enable(ctx.BLEND);
            //TODO need fix for WebGL
            ctx.blendFuncSeparate(ctx.SRC_ALPHA, dfactor, sfactor, dfactor);
        }
    }
};

if (!cc.ENABLE_GL_STATE_CACHE) {
    cc.glBlendFunc = cc.setBlending;
}

/**
 * Resets the blending mode back to the cached state in case you used glBlendFuncSeparate() or glBlendEquation().

 * If CC_ENABLE_GL_STATE_CACHE is disabled, it will just set the default blending mode using GL_FUNC_ADD.
 * @function
 */
cc.glBlendResetToCache = function () {
    var ctx = cc._renderContext;
    ctx.blendEquation(ctx.FUNC_ADD);
    if (cc.ENABLE_GL_STATE_CACHE)
        cc.setBlending(cc._blendingSource, cc._blendingDest);
    else
        cc.setBlending(ctx.BLEND_SRC, ctx.BLEND_DST);
};

/**
 * sets the projection matrix as dirty
 * @function
 */
cc.setProjectionMatrixDirty = function () {
    cc._currentProjectionMatrix = -1;
};

/**
 * If the texture is not already bound, it binds it.

 * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
 * @function
 * @param {cc.Texture2D} textureId
 */
cc.glBindTexture2D = function (textureId) {
    cc.glBindTexture2DN(0, textureId);
};

/**
 * If the texture is not already bound to a given unit, it binds it.

 * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindTexture() directly.
 * @function
 * @param {Number} textureUnit
 * @param {cc.Texture2D} textureId
 */
cc.glBindTexture2DN = function (textureUnit, textureId) {
    if (cc._currentBoundTexture[textureUnit] === textureId)
        return;
    cc._currentBoundTexture[textureUnit] = textureId;

    var ctx = cc._renderContext;
    ctx.activeTexture(ctx.TEXTURE0 + textureUnit);
    if(textureId)
        ctx.bindTexture(ctx.TEXTURE_2D, textureId._webTextureObj);
    else
        ctx.bindTexture(ctx.TEXTURE_2D, null);
};
if (!cc.ENABLE_GL_STATE_CACHE){
    cc.glBindTexture2DN = function (textureUnit, textureId) {
        var ctx = cc._renderContext;
        ctx.activeTexture(ctx.TEXTURE0 + textureUnit);
        if(textureId)
            ctx.bindTexture(ctx.TEXTURE_2D, textureId._webTextureObj);
        else
            ctx.bindTexture(ctx.TEXTURE_2D, null);
    };
}

/**
 * It will delete a given texture. If the texture was bound, it will invalidate the cached.

 * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
 * @function
 * @param {WebGLTexture} textureId
 */
cc.glDeleteTexture = function (textureId) {
    cc.glDeleteTextureN(0, textureId);
};

/**
 * It will delete a given texture. If the texture was bound, it will invalidate the cached for the given texture unit.

 * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glDeleteTextures() directly.
 * @function
 * @param {Number} textureUnit
 * @param {WebGLTexture} textureId
 */
cc.glDeleteTextureN = function (textureUnit, textureId) {
    if (cc.ENABLE_GL_STATE_CACHE) {
        if (textureId === cc._currentBoundTexture[ textureUnit ])
            cc._currentBoundTexture[ textureUnit ] = -1;
    }
    cc._renderContext.deleteTexture(textureId);
};

/**
 * If the vertex array is not already bound, it binds it.

 * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glBindVertexArray() directly.
 * @function
 * @param {Number} vaoId
 */
cc.glBindVAO = function (vaoId) {
    if (!cc.TEXTURE_ATLAS_USE_VAO)
        return;

    if (cc.ENABLE_GL_STATE_CACHE) {
        if (cc._uVAO !== vaoId) {
            cc._uVAO = vaoId;
            //TODO need fixed
            //glBindVertexArray(vaoId);
        }
    } else {
        //glBindVertexArray(vaoId);
    }
};

/**
 * It will enable / disable the server side GL states.

 * If CC_ENABLE_GL_STATE_CACHE is disabled, it will call glEnable() directly.
 * @function
 * @param {Number} flags
 */
cc.glEnable = function (flags) {
    if (cc.ENABLE_GL_STATE_CACHE) {
        /*var enabled;

         */
        /* GL_BLEND */
        /*
         if ((enabled = (flags & cc.GL_BLEND)) != (cc._GLServerState & cc.GL_BLEND)) {
         if (enabled) {
         cc._renderContext.enable(cc._renderContext.BLEND);
         cc._GLServerState |= cc.GL_BLEND;
         } else {
         cc._renderContext.disable(cc._renderContext.BLEND);
         cc._GLServerState &= ~cc.GL_BLEND;
         }
         }*/
    } else {
        /*if ((flags & cc.GL_BLEND))
         cc._renderContext.enable(cc._renderContext.BLEND);
         else
         cc._renderContext.disable(cc._renderContext.BLEND);*/
    }
};

redpajama_set_name: RedPajamaGithub


text:
#pragma strict

static var High : int ;
var customLabel : GUIStyle ;

function Awake () {
  High = PlayerPrefs.GetInt("High") ;
}

function OnGUI()
{
  GUI.Label(Rect(Screen.width / 2 + 200 , Screen.height / 2 - 350 , 100 , 100) , "HIGH SCORE : " + High + "pt", customLabel) ;
  PlayerPrefs.SetInt("High" , High) ;
}


text:
const ADD_PACKAGE = 'ADD_PACKAGE';
const REMOVE_PACKAGE = 'REMOVE_PACKAGE';

export const actions = {
  addPackage(packageName) {
    return { type: ADD_PACKAGE, packageName };
  },

  removePackage(packageName) {
    return { type: REMOVE_PACKAGE, packageName };
  }
};

export const reducers = {
  packageList(state = [], action) {
    switch (action.type) {
      case ADD_PACKAGE:
        return state.indexOf(action.packageName) < 0
          ? [ ...state, action.packageName ]
          : state;

      case REMOVE_PACKAGE:
        return state.indexOf(action.packageName) < 0
          ? state
          : state.filter(item => item !== action.packageName);

      default:
        return state;
    }
  }
};


text:
require_relative "base"

module Redd
  module Clients
    # The client that doesn't need a user to function.
    # @note Of course, that means many editing methods throw an error.
    class Userless < Base
      # @!attribute [r] client_id
      attr_reader :client_id

      # @param [Hash] options The options to create the client with.
      # @see Base#initialize
      # @see Redd.it
      def initialize(client_id, secret, **options)
        @client_id = client_id
        @secret = secret
        super(**options)
      end

      # Authorize using the given data.
      # @return [Access] The access given by reddit.
      def authorize!
        response = auth_connection.post(
          "/api/v1/access_token",
          grant_type: "client_credentials"
        )

        @access = Access.new(response.body)
      end
    end
  end
end


text: Initial release as pod.


text:
package io.jaegertracing.internal.samplers;

import io.jaegertracing.internal.samplers.http.OperationSamplingParameters;
import io.jaegertracing.internal.samplers.http.PerOperationSamplingParameters;
import io.jaegertracing.spi.Sampler;
import java.util.HashMap;
import java.util.Map;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;

/**
 * Computes {@link #sample(String, long)} using the name of the operation, and maintains a specific
 * {@link GuaranteedThroughputSampler} instance for each operation.
 */
@Slf4j
@EqualsAndHashCode
@ToString
@AllArgsConstructor(access = AccessLevel.PACKAGE)
@Getter(AccessLevel.PACKAGE) //Visible for testing
public class PerOperationSampler implements Sampler {
  private final int maxOperations;
  private Map<String, GuaranteedThroughputSampler> operationNameToSampler;
  private ProbabilisticSampler defaultSampler;
  private double lowerBound;

  public PerOperationSampler(int maxOperations, OperationSamplingParameters strategies) {
    this(maxOperations,
         new HashMap<String, GuaranteedThroughputSampler>(),
         new ProbabilisticSampler(strategies.getDefaultSamplingProbability()),
         strategies.getDefaultLowerBoundTracesPerSecond());
    update(strategies);
  }

  /**
   * Updates the GuaranteedThroughputSampler for each operation
   * @param strategies The parameters for operation sampling
   * @return true if any samplers were updated
   */
  public synchronized boolean update(final OperationSamplingParameters strategies) {
    boolean isUpdated = false;

    lowerBound = strategies.getDefaultLowerBoundTracesPerSecond();
    ProbabilisticSampler defaultSampler = new ProbabilisticSampler(strategies.getDefaultSamplingProbability());

    if (!defaultSampler.equals(this.defaultSampler)) {
      this.defaultSampler = defaultSampler;
      isUpdated = true;
    }

    Map<String, GuaranteedThroughputSampler> newOpsSamplers = new HashMap<String, GuaranteedThroughputSampler>();
    //add or update operation samples using given strategies
    for (PerOperationSamplingParameters strategy : strategies.getPerOperationStrategies()) {
      String operation = strategy.getOperation();
      double samplingRate = strategy.getProbabilisticSampling().getSamplingRate();
      GuaranteedThroughputSampler sampler = operationNameToSampler.get(operation);
      if (sampler != null) {
        isUpdated = sampler.update(samplingRate, lowerBound) || isUpdated;
        newOpsSamplers.put(operation, sampler);
      } else {
        if (newOpsSamplers.size() < maxOperations) {
          sampler = new GuaranteedThroughputSampler(samplingRate, lowerBound);
          newOpsSamplers.put(operation, sampler);
          isUpdated = true;
        } else {
          log.info("Exceeded the maximum number of operations({}) for per operations sampling",
              maxOperations);
        }
      }
    }

    operationNameToSampler = newOpsSamplers;
    return isUpdated;
  }

  @Override
  public synchronized SamplingStatus sample(String operation, long id) {
    GuaranteedThroughputSampler sampler = operationNameToSampler.get(operation);
    if (sampler != null) {
      return sampler.sample(operation, id);
    }

    if (operationNameToSampler.size() < maxOperations) {
      sampler = new GuaranteedThroughputSampler(defaultSampler.getSamplingRate(), lowerBound);
      operationNameToSampler.put(operation, sampler);
      return sampler.sample(operation, id);
    }

    return defaultSampler.sample(operation, id);
  }

  @Override
  public synchronized void close() {
    defaultSampler.close();
    for (GuaranteedThroughputSampler sampler : operationNameToSampler.values()) {
      sampler.close();
    }
  }
}


text:
require 'faraday'
require 'json'
require 'ostruct'

module BTCJammer
  # No official docs, this method is alluded to.
  class Terms
    def self.all
      response = Faraday.get("#{API_PUBLIC_URL}/terms.json")
      JSON.parse(response.body).collect { |t| OpenStruct.new t }
    end
  end
end


text:
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_COMPILER_IS_GNUCC)
  set(LINUX "1")
endif()

if(MSVC)
  SET(PLATFORM_NAME "win32")
endif()
if(APPLE)
  SET(PLATFORM_NAME "osx")
endif()
if(LINUX)
  SET(PLATFORM_NAME "linux")
endif()

if(NOT CMAKE_BUILD_TYPE)
  message(STATUS "No build type selected (defaulting to Release)")
  set(CMAKE_BUILD_TYPE "Release")
endif()

set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/../bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/../bin)

if(APPLE)
  add_definitions(-mmacosx-version-min=10.5)
  add_definitions(-arch i386 -arch x86_64)
  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -arch i386 -arch x86_64")
  set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mmacosx-version-min=10.5")
  set(CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS} -mmacosx-version-min=10.5")
  set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_CXX_FLAGS} -mmacosx-version-min=10.5")
endif()

if(MSVC)
  set_target_properties(PROPERTIES PREFIX "../") # The Prefix Hack!
endif()

set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "" FORCE)
set(DEBUG_CONFIGURATIONS "Debug")

set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -DUNICODE -D_UNICODE")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUNICODE -D_UNICODE")
if(MSVC)
  set(CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Gm")
  set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Gm")
  set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /Gm")
  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Zi /Gm")
  set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_CRT_SECURE_NO_WARNINGS")
endif()

set(INCLUDE_DIR ../include)
set(SRC_DIR ../src)
set(GORILLA_INCLUDE_DIR ../../../include)

include_directories(${INCLUDE_DIR})
include_directories(${GORILLA_INCLUDE_DIR})
add_subdirectory(../../../build ${CMAKE_BINARY_DIR}/gorilla)


text:
package com.deltadna.android.sdk.ads.provider.admob;

import android.content.Context;

import com.google.android.gms.ads.MobileAds;

class InitialisationHelper {

    static final String NON_PERSONALISED_ADS = "npa";

    private static boolean initialised;

    static void initialise(Context context, String appId) {
        synchronized (InitialisationHelper.class) {
            if (!initialised) {
                MobileAds.initialize(context, appId);
                initialised = true;
            }
        }
    }
}


text:
from django.contrib.auth import logout as auth_logout
from django.contrib.auth.decorators import login_required
from django.shortcuts import redirect
from django.views.decorators.http import require_GET

@require_GET
@login_required
def logout(request):
    auth_logout(request)
    return redirect('myhpom:home')


text:
package com.planet_ink.coffee_mud.Abilities.Prayers;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.core.collections.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Libraries.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

public class Prayer_FleshRock extends Prayer
{
	@Override public String ID() { return "Prayer_FleshRock"; }
	private final static String localizedName = CMLib.lang().L("Flesh Rock");
	@Override public String name() { return localizedName; }
	private final static String localizedStaticDisplay = CMLib.lang().L("(Flesh to Rock)");
	@Override public String displayText() { return localizedStaticDisplay; }
	@Override public int abstractQuality(){return Ability.QUALITY_MALICIOUS;}
	@Override public int classificationCode(){return Ability.ACODE_PRAYER|Ability.DOMAIN_CORRUPTION;}
	@Override public long flags(){return Ability.FLAG_NEUTRAL;}
	protected CharState prevState=null;

	public Item statue=null;
	@Override
	public boolean tick(Tickable ticking, int tickID)
	{
		if((tickID==Tickable.TICKID_MOB)
		&&(statue!=null)
		&&(affected instanceof MOB))
		{
			final MOB mob=(MOB)affected;
			mob.makePeace(true);
			if((statue.owner()!=null)&&(statue.owner()!=mob.location()))
			{
				Room room=null;
				if(statue.owner() instanceof MOB)
					room=((MOB)statue.owner()).location();
				else
				if(statue.owner() instanceof Room)
					room=(Room)statue.owner();
				if((room!=null)&&(room!=mob.location()))
					room.bringMobHere(mob,false);
			}
		}
		return super.tick(ticking,tickID);
	}

	@Override
	public boolean okMessage(final Environmental myHost, final CMMsg msg)
	{
		if(affected instanceof MOB)
		{
			final MOB mob=(MOB)affected;
			if(msg.source().getVictim()==mob)
				msg.source().setVictim(null);
			if(mob.isInCombat())
			{
				final MOB victim=mob.getVictim();
				if(victim!=null)
					victim.makePeace(true);
				mob.makePeace(true);
			}
			mob.recoverMaxState();
			mob.resetToMaxState();
			mob.curState().setHunger(1000);
			mob.curState().setThirst(1000);
			mob.recoverCharStats();
			mob.recoverPhyStats();

			// when this spell is on a MOBs Affected list,
			// it should consistantly prevent the mob
			// from trying to do ANYTHING except sleep
			if(msg.amISource(mob))
			{
				if((!msg.sourceMajor(CMMsg.MASK_ALWAYS))
				&&(msg.sourceMajor()>0))
				{
					mob.tell(L("Statues can't do that."));
					return false;
				}
			}
		}
		if(!super.okMessage(myHost,msg))
			return false;

		if(affected instanceof MOB)
		{
			final MOB mob=(MOB)affected;
			if(msg.source().getVictim()==affected)
				msg.source().setVictim(null);
			if(mob.isInCombat())
			{
				final MOB victim=mob.getVictim();
				if(victim!=null)
					victim.makePeace(true);
				mob.makePeace(true);
			}
		}
		return true;
	}

	@Override
	public void affectPhyStats(Physical affected, PhyStats affectableStats)
	{
		super.affectPhyStats(affected,affectableStats);
		// when this spell is on a MOBs Affected list,
		// it should consistantly put the mob into
		// a sleeping state, so that nothing they do
		// can get them out of it.
		if(affected instanceof MOB)
		{
			//affectableStats.setReplacementName("a statue of "+affected.name());
			affectableStats.setSensesMask(affectableStats.sensesMask()|PhyStats.CAN_NOT_MOVE);
			affectableStats.setSensesMask(affectableStats.sensesMask()|PhyStats.CAN_NOT_HEAR);
			affectableStats.setSensesMask(affectableStats.sensesMask()|PhyStats.CAN_NOT_SMELL);
			affectableStats.setSensesMask(affectableStats.sensesMask()|PhyStats.CAN_NOT_SPEAK);
			affectableStats.setSensesMask(affectableStats.sensesMask()|PhyStats.CAN_NOT_TASTE);
			affectableStats.setDisposition(affectableStats.disposition()|PhyStats.IS_NOT_SEEN);
		}
	}

	@Override
	public void unInvoke()
	{
		// undo the affects of this spell
		if(!(affected instanceof MOB))
			return;
		final MOB mob=(MOB)affected;

		super.unInvoke();
		if(canBeUninvoked())
		{
			if(statue!=null)
				statue.destroy();
			if((mob.location()!=null)&&(!mob.amDead()))
				mob.location().show(mob,null,CMMsg.MSG_OK_VISUAL,L("<S-YOUPOSS> flesh is no longer made of rock."));
			if(prevState!=null)
				prevState.copyInto(mob.curState());
			CMLib.commands().postStand(mob,true);
		}
	}

	@Override
	public boolean invoke(MOB mob, List<String> commands, Physical givenTarget, boolean auto, int asLevel)
	{
		final MOB target=this.getTarget(mob,commands,givenTarget);
		if(target==null)
			return false;

		if(!super.invoke(mob,commands,givenTarget,auto,asLevel))
			return false;

		int levelDiff=target.phyStats().level()-(mob.phyStats().level()+(2*getXLEVELLevel(mob)));
		if(levelDiff<0)
			levelDiff=0;
		boolean success=proficiencyCheck(mob,-(levelDiff*5),auto);

		if(success)
		{
			invoker=mob;
			final CMMsg msg=CMClass.getMsg(mob,target,this,verbalCastCode(mob,target,auto),auto?"":L("^S<S-NAME> @x1 and point(s) at <T-NAMESELF>.^?",prayWord(mob)));
			if(mob.location().okMessage(mob,msg))
			{
				mob.location().send(mob,msg);
				if(msg.value()<=0)
				{
					int a=0;
					while(a<target.numEffects()) // personal effects
					{
						final Ability A=target.fetchEffect(a);
						final int s=target.numEffects();
						if(A!=null)
							A.unInvoke();
						if(target.numEffects()==s)
							a++;
					}
					CMLib.commands().postStand(target,true);
					statue=CMClass.getItem("GenItem");
					String name=target.name();
					if(name.startsWith("A "))
						name="a "+name.substring(2);
					if(name.startsWith("An "))
						name="an "+name.substring(3);
					if(name.startsWith("The "))
						name="the "+name.substring(4);
					statue.setName(L("a rocky statue of @x1",name));
					statue.setDisplayText(L("a rocky statue of @x1 stands here.",name));
					statue.setDescription(L("It`s a hard rocky statue, which looks exactly like @x1.",name));
					statue.setMaterial(RawMaterial.RESOURCE_GRANITE);
					statue.basePhyStats().setWeight(2000);
					mob.location().show(target,null,CMMsg.MSG_OK_VISUAL,L("<S-NAME> turn(s) into rock!!"));
					success=maliciousAffect(mob,target,asLevel,(mob.phyStats().level()+(2*getXLEVELLevel(mob))),-1)!=null;
					target.makePeace(true);
					if(mob.getVictim()==target)
						mob.setVictim(null);
					final Ability A=target.fetchEffect(ID());
					if(success&&(A!=null))
					{
						mob.location().addItem(statue);
						statue.addEffect(A);
						A.setAffectedOne(target);
						statue.recoverPhyStats();
						((Prayer_FleshRock)A).prevState=(CharState)target.curState().copyOf();
					}
				}
			}
		}
		else
			return maliciousFizzle(mob,target,L("<S-NAME> @x1 and point(s) at <T-NAMESELF>, but nothing happens.",prayWord(mob)));

		// return whether it worked
		return success;
	}
}


text:
// ------------------------------------------------------------------------
//
//  The Grumpy Wizards Website Service
//  Copyright (C) 2016 Adrian Hall
//
// ------------------------------------------------------------------------
//  Creates an express application server.
// ------------------------------------------------------------------------
/* global __dirname */
var bodyParser = require('body-parser');
var compression = require('compression');
var cookieParser = require('cookie-parser');
var express = require('express');
var path = require('path');
var LogMaster = require('./logger');
var staticFiles = require('./static');
var zumo = require('azure-mobile-apps');
var transactionLogger = LogMaster.transactionLogger;
var errorLogger = LogMaster.errorLogger;

/**
 * Create an express web application and configure it
 *
 * @param {boolean} logging - set to false to disable all logging
 * @returns {Promise.<express>} A promise that resolves to an express applications
 */
function webApplication(logging) {
    var app = express(),
        mobileApp = zumo({ swagger: true, homePage: false });

    // Basic application settings & middleware
    if (logging) app.use(transactionLogger);
    app.use(compression());
    app.use(bodyParser.urlencoded({ extended: true }));
    app.use(bodyParser.json());
    app.use(cookieParser());

    // Azure Mobile Apps
    mobileApp.api.import(path.join(__dirname, 'api'));
    // mobileApp.tables.import(path.join(__dirname, 'tables'));
    app.use(mobileApp);

    // Static Files
    app.use(staticFiles);

    // Promisify the response as we have no async initialization yet.
    return mobileApp.tables.initialize().then(() => {
        app.use(errorLogger);
        return app;
    });
}

module.exports = webApplication;


text:
function r(n,t,i){return JSON.stringify(n,t,i)}export{r as a};
//# sourceMappingURL=chunk-3V3LTFJF.js.map


text:
ACCEPTED

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

#### Published in
Blumea 47:566. 2002

#### Original name
Sclerachne punctata R.Br.

### Remarks
null


text:
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

#nullable disable

using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Screens.Select.Leaderboards;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.Sprites;
using osu.Game.Resources.Localisation.Web;

namespace osu.Game.Overlays.BeatmapSet.Scores
{
    public class NoScoresPlaceholder : Container
    {
        private readonly SpriteText text;

        public NoScoresPlaceholder()
        {
            AutoSizeAxes = Axes.Both;
            Child = text = new OsuSpriteText();
        }

        public override void Show() => this.FadeIn(200, Easing.OutQuint);

        public override void Hide() => this.FadeOut(200, Easing.OutQuint);

        public void ShowWithScope(BeatmapLeaderboardScope scope)
        {
            Show();

            switch (scope)
            {
                default:
                    text.Text = BeatmapsetsStrings.ShowScoreboardNoScoresGlobal;
                    break;

                case BeatmapLeaderboardScope.Friend:
                    text.Text = BeatmapsetsStrings.ShowScoreboardNoScoresFriend;
                    break;

                case BeatmapLeaderboardScope.Country:
                    text.Text = BeatmapsetsStrings.ShowScoreboardNoScoresCountry;
                    break;
            }
        }
    }
}


text:
                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>

                        <img src="<?php echo base_url() ?>img/logo.png" alt="" class="img-responsive" />

                       Creative Ink Printing & Manufacturing Company

Date: <?php echo date('m/d/Y'); ?>

                      <?php $hidden = ''; ?>
                      <?php if(current_url() == base_url() || current_url() == base_url('auth/postlogin') || current_url() == base_url('auth/forgotpassword') || current_url() == base_url('auth/reset')): ?>
                          <?php $hidden = 'hidden'; ?>
                      <?php endif; ?>

                 <li class="<?php echo $hidden ?>" class="logout"><button style="margin-top: 8px; color:#fff; text-decoration:none;" class="btn btn-link" data-toggle="modal" data-target="#logoutModal"> Log out</button>


text:
function Add-VSAppMeshVirtualNodeBackend {
    <#
    .SYNOPSIS
        Adds an AWS::AppMesh::VirtualNode.Backend resource property to the template. An object that represents the backends that a virtual node is expected to send outbound traffic to.

    .DESCRIPTION
        Adds an AWS::AppMesh::VirtualNode.Backend resource property to the template.
An object that represents the backends that a virtual node is expected to send outbound traffic to.

    .LINK
        http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appmesh-virtualnode-backend.html

    .PARAMETER VirtualService
        Specifies a virtual service to use as a backend for a virtual node.

        Type: VirtualServiceBackend
        Documentation: http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-appmesh-virtualnode-backend.html#cfn-appmesh-virtualnode-backend-virtualservice
        UpdateType: Mutable

    .FUNCTIONALITY
        Vaporshell
    #>
    [OutputType('Vaporshell.Resource.AppMesh.VirtualNode.Backend')]
    [cmdletbinding()]
    Param
    (
        [parameter(Mandatory = $false)]
        $VirtualService
    )
    Begin {
        $obj = [PSCustomObject]@{}
        $commonParams = @('Verbose','Debug','ErrorAction','WarningAction','InformationAction','ErrorVariable','WarningVariable','InformationVariable','OutVariable','OutBuffer','PipelineVariable')
    }
    Process {
        foreach ($key in $PSBoundParameters.Keys | Where-Object {$commonParams -notcontains $_}) {
            switch ($key) {
                Default {
                    $obj | Add-Member -MemberType NoteProperty -Name $key -Value $PSBoundParameters.$key
                }
            }
        }
    }
    End {
        $obj | Add-ObjectDetail -TypeName 'Vaporshell.Resource.AppMesh.VirtualNode.Backend'
        Write-Verbose "Resulting JSON from $($MyInvocation.MyCommand): `n`n$($obj | ConvertTo-Json -Depth 5)`n"
    }
}


text:
{% extends "base.html" %}

{% block body %}
  <div class="content">
    {% block content %}{% endblock content %}
  </div>
{% endblock body %}


text:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Text;

using Hydra.Framework.Helpers;

#pragma warning disable 419  // Ambigious cref in XML comment

namespace Hydra.Framework.Collections
{
    /// <summary>
    /// The class that is used to implement IList<T> to view a sub-range
    /// of an nodeCollection. The object stores a wrapped nodeCollection, and a start/count indicating
    /// a sub-range of the nodeCollection. Insertion/deletions through the sub-range view
    /// cause the count to change up to the size of the underlying nodeCollection. Elements
    /// fall off the end of the underlying nodeCollection.
    /// </summary>
    [Serializable]
    public class ArrayRange<T>
        : AbstractList<T>
    {
        #region Member Variables
        /// <summary>
        /// Start
        /// </summary>
        private readonly int start;

        /// <summary>
        /// Wrapped Array
        /// </summary>
        private readonly T[] wrappedArray;

        /// <summary>
        /// Item Count
        /// </summary>
        private int count;
        #endregion

        #region Constructors
        /// <summary>
        /// Create a sub-range view object on the indicate part
        /// of the nodeCollection.
        /// </summary>
        /// <param name="wrappedArray">Array to wrap.</param>
        /// <param name="start">The start indexFunction of the view in the wrapped list.</param>
        /// <param name="count">The number of items in the view.</param>
        public ArrayRange(T[] wrappedArray, int start, int count)
        {
            this.wrappedArray = wrappedArray;
            this.start = start;
            this.count = count;
        }
        #endregion

        #region Overrides
        /// <summary>
        /// Gets the count.
        /// </summary>
        /// <value>The count.</value>
        public override int Count
        {
            get
            {
                return count;
            }
        }

        /// <summary>
        /// Gets or sets T at the specified index.
        /// </summary>
        /// <value></value>
        public override T this[int index]
        {
            get
            {
                if (index < 0 ||
                    index >= count)
                    throw new ArgumentOutOfRangeException("indexFunction");

                return wrappedArray[start + index];
            }
            set
            {
                if (index < 0 ||
                    index >= count)
                    throw new ArgumentOutOfRangeException("indexFunction");

                wrappedArray[start + index] = value;
            }
        }

        /// <summary>
        /// Clears this instance.
        /// </summary>
        public override void Clear()
        {
            Array.Copy(wrappedArray, start + count, wrappedArray, start, wrappedArray.Length - (start + count));
            Algorithms.FillRange(wrappedArray, wrappedArray.Length - count, count, default(T));
            count = 0;
        }

        /// <summary>
        /// Inserts the specified index.
        /// </summary>
        /// <param name="index">The index.</param>
        /// <param name="item">The item.</param>
        public override void Insert(int index, T item)
        {
            if (index < 0 ||
                index > count)
                throw new ArgumentOutOfRangeException("indexFunction");

            int i = start + index;

            if (i + 1 < wrappedArray.Length)
                Array.Copy(wrappedArray, i, wrappedArray, i + 1, wrappedArray.Length - i - 1);

            if (i < wrappedArray.Length)
                wrappedArray[i] = item;

            if (start + count < wrappedArray.Length)
                ++count;
        }

        /// <summary>
        /// Removes at.
        /// </summary>
        /// <param name="index">The index.</param>
        public override void RemoveAt(int index)
        {
            if (index < 0 ||
                index >= count)
                throw new ArgumentOutOfRangeException("indexFunction");

            int i = start + index;

            if (i < wrappedArray.Length - 1)
                Array.Copy(wrappedArray, i + 1, wrappedArray, i, wrappedArray.Length - i - 1);

            wrappedArray[wrappedArray.Length - 1] = default(T);

            --count;
        }
        #endregion
    }
}


text:
.class public final Landroid/provider/Contacts$GroupMembership;
.super Ljava/lang/Object;
.source "Contacts.java"

# interfaces
.implements Landroid/provider/BaseColumns;
.implements Landroid/provider/Contacts$GroupsColumns;

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Landroid/provider/Contacts;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x19
    name = "GroupMembership"
.end annotation

.annotation runtime Ljava/lang/Deprecated;
.end annotation

# static fields
.field public static final CONTENT_DIRECTORY:Ljava/lang/String; = "groupmembership"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final CONTENT_ITEM_TYPE:Ljava/lang/String; = "vnd.android.cursor.item/contactsgroupmembership"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final CONTENT_TYPE:Ljava/lang/String; = "vnd.android.cursor.dir/contactsgroupmembership"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final CONTENT_URI:Landroid/net/Uri; = null
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final DEFAULT_SORT_ORDER:Ljava/lang/String; = "group_id ASC"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final GROUP_ID:Ljava/lang/String; = "group_id"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final GROUP_SYNC_ACCOUNT:Ljava/lang/String; = "group_sync_account"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final GROUP_SYNC_ACCOUNT_TYPE:Ljava/lang/String; = "group_sync_account_type"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final GROUP_SYNC_ID:Ljava/lang/String; = "group_sync_id"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final PERSON_ID:Ljava/lang/String; = "person"
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

.field public static final RAW_CONTENT_URI:Landroid/net/Uri;
    .annotation runtime Ljava/lang/Deprecated;
    .end annotation
.end field

# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 1053
    const-string v0, "content://contacts/groupmembership"

    invoke-static {v0}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v0

    sput-object v0, Landroid/provider/Contacts$GroupMembership;->CONTENT_URI:Landroid/net/Uri;

    .line 1061
    const-string v0, "content://contacts/groupmembershipraw"

    invoke-static {v0}, Landroid/net/Uri;->parse(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v0

    sput-object v0, Landroid/provider/Contacts$GroupMembership;->RAW_CONTENT_URI:Landroid/net/Uri;

    return-void
.end method

.method private constructor <init>()V
    .locals 0

    .prologue
    .line 1046
    invoke-direct/range {p0 .. p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


text:
RSpec.describe RuboCop::Cop::Style::EvalWithLocation do
  subject(:cop) { described_class.new(config) }

  let(:config) { RuboCop::Config.new }

  it 'registers an offense when using `#eval` without any arguments' do
    expect_offense(<<-RUBY.strip_indent)
      eval <<-CODE
      ^^^^^^^^^^^^ Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.
        do_something
      CODE
    RUBY
  end

  it 'registers an offense when using `#eval` with `binding` only' do
    expect_offense(<<-RUBY.strip_indent)
      eval <<-CODE, binding
      ^^^^^^^^^^^^^^^^^^^^^ Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.
        do_something
      CODE
    RUBY
  end

  it 'registers an offense when using `#eval` without lineno' do
    expect_offense(<<-RUBY.strip_indent)
      eval <<-CODE, binding, __FILE__
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.
        do_something
      CODE
    RUBY
  end

  it 'registers an offense when using `#eval` with an incorrect line number' do
    expect_offense(<<-RUBY.strip_indent)
      eval 'do_something', binding, __FILE__, __LINE__ + 1
                                              ^^^^^^^^^^^^ Use `__LINE__` instead of `__LINE__ + 1`, as they are used by backtraces.
    RUBY
  end

  it 'registers an offense when using `#eval` with a heredoc and ' \
     'an incorrect line number' do
    expect_offense(<<-RUBY.strip_indent)
      eval <<-CODE, binding, __FILE__, __LINE__ + 2
                                       ^^^^^^^^^^^^ Use `__LINE__ + 1` instead of `__LINE__ + 2`, as they are used by backtraces.
        do_something
      CODE
    RUBY
  end

  it 'registers an offense when using `#eval` with a string on a new line ' do
    expect_offense(<<-RUBY.strip_indent)
      eval('puts 42',
           binding,
           __FILE__,
           __LINE__)
           ^^^^^^^^ Use `__LINE__ - 3` instead of `__LINE__`, as they are used by backtraces.
    RUBY
  end

  it 'registers an offense when using `#class_eval` without any arguments' do
    expect_offense(<<-RUBY.strip_indent)
      C.class_eval <<-CODE
      ^^^^^^^^^^^^^^^^^^^^ Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.
        do_something
      CODE
    RUBY
  end

  it 'registers an offense when using `#module_eval` without any arguments' do
    expect_offense(<<-RUBY.strip_indent)
      M.module_eval <<-CODE
      ^^^^^^^^^^^^^^^^^^^^^ Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.
        do_something
      CODE
    RUBY
  end

  it 'registers an offense when using `#instance_eval` without any arguments' do
    expect_offense(<<-RUBY.strip_indent)
      foo.instance_eval <<-CODE
      ^^^^^^^^^^^^^^^^^^^^^^^^^ Pass `__FILE__` and `__LINE__` to `eval` method, as they are used by backtraces.
        do_something
      CODE
    RUBY
  end

  it 'registers an offense when using `#class_eval` with an incorrect lineno' do
    expect_offense(<<-RUBY.strip_indent)
      C.class_eval <<-CODE, __FILE__, __LINE__
                                      ^^^^^^^^ Use `__LINE__ + 1` instead of `__LINE__`, as they are used by backtraces.
        do_something
      CODE
    RUBY
  end

  it 'accepts `eval` with a heredoc, a filename and `__LINE__ + 1`' do
    expect_no_offenses(<<-RUBY.strip_indent)
      eval <<-CODE, binding, __FILE__, __LINE__ + 1
        do_something
      CODE
    RUBY
  end

  it 'accepts `eval` with a code that is a variable' do
    expect_no_offenses(<<-RUBY.strip_indent)
      code = something
      eval code
    RUBY
  end

  it 'accepts `eval` with a string, a filename and `__LINE__`' do
    expect_no_offenses(<<-RUBY.strip_indent)
      eval 'do_something', binding, __FILE__, __LINE__
    RUBY
  end

  it 'accepts `eval` with a string, a filename and `__LINE__` on a new line' do
    expect_no_offenses(<<-RUBY.strip_indent)
      eval 'do_something', binding, __FILE__,
           __LINE__ - 1
    RUBY
  end
end


text:
using namespace std;
class RFID{
	public:
	static char named_pipe[20];
	static void init(const char* name){
		assert(name != 0);
		strncpy(named_pipe,name,sizeof(named_pipe));
		cout<<"Creating pipe "<<named_pipe;
		int success=mkfifo(named_pipe,0666);
		if(success !=0){
			cout<<"Error in creating pipe!"<<endl;
			exit(1);
		}
		cout<<"pipe created ..."<<endl;
	}
	static int64_t readCard(){
		char buff[20];

		int fd = open(named_pipe,O_WRONLY);
		assert(fd != -1 && "error opening");
		cout<<"writing..."<<endl;
		int bytes = write(fd,"GET",sizeof("GET"));
		close(fd);

		assert(bytes != -1 && "write successful");
		cout<<"writing complete"<<endl;
		fd = open(named_pipe,O_RDONLY);
		assert(fd != -1 && "error opening");
		cout<<"reading..."<<endl;
		bytes = read(fd,buff,12);
		assert(bytes != -1 && "read successful");
		buff[12]=0;
		if(buff[0]=='F')return -1;
		return atoll(buff);
		close(fd);
	}
};
char RFID::named_pipe[] = {'\0'};


text:
#ifndef itkSpatialFunctionImageEvaluatorFilter_h
#define itkSpatialFunctionImageEvaluatorFilter_h

#include "itkImageFunction.h"
#include "itkImageRegionIterator.h"
#include "itkImageToImageFilter.h"
#include "itkSize.h"
#include "itkSpatialFunction.h"

namespace itk
{
/** \class SpatialFunctionImageEvaluatorFilter
 * \brief Evaluates a SpatialFunction onto a source image
 *
 * SpatialFunctionImageEvaluatorFilter walks an input image and evaluates
 * the function at every pixel location. The output of the spatial function
 * and the pixel type of the output image must be compatible.
 *
 * Like its parent ImageToImageFilter, this class functions in the filtering
 * pipeline and produces a unique output image.
 *
 * \ingroup ImageFilters
 * \ingroup ITKSpatialFunction
 */
template <typename TSpatialFunction, typename TInputImage, typename TOutputImage>
class ITK_TEMPLATE_EXPORT SpatialFunctionImageEvaluatorFilter : public ImageToImageFilter<TInputImage, TOutputImage>
{
public:
  ITK_DISALLOW_COPY_AND_ASSIGN(SpatialFunctionImageEvaluatorFilter);

  /** Standard class type aliases. */
  using Self = SpatialFunctionImageEvaluatorFilter;
  using Superclass = ImageToImageFilter<TInputImage, TOutputImage>;
  using Pointer = SmartPointer<Self>;
  using ConstPointer = SmartPointer<const Self>;

  /** Method for creation through the object factory. */
  itkNewMacro(Self);

  /** Run-time type information (and related methods). */
  itkTypeMacro(SpatialFunctionImageEvaluatorFilter, ImageToImageFilter);

  /** Number of dimensions. */
  static constexpr unsigned int NDimensions = TInputImage::ImageDimension;

  /** Image size type alias. */
  using SizeType = typename TInputImage::SizeType;

  /** Image index type alias. */
  using IndexType = typename TOutputImage::IndexType;

  /** Image pixel value type alias. */
  using PixelType = typename TOutputImage::PixelType;

  /** Typedef to describe the output image region type. */
  using OutputImageRegionType = typename TOutputImage::RegionType;

  /** Type of function. */
  using FunctionType = TSpatialFunction;

  /** Return type of function. */
  using FunctionValueType = typename FunctionType::OutputType;

  /** Typedef describing vector info. */
  using PositionType = typename FunctionType::InputType;

  /** Set the internal spatial function. */
  void
  SetFunction(FunctionType * PixelFunction)
  {
    m_PixelFunction = PixelFunction;
  }

protected:
  SpatialFunctionImageEvaluatorFilter();
  ~SpatialFunctionImageEvaluatorFilter() override = default;

  /** Method for evaluating the implicit function over the image. */
  void
  GenerateData() override;

  void
  PrintSelf(std::ostream & os, Indent indent) const override;

private:
  /** The function that will be evaluated over the image */
  FunctionType * m_PixelFunction;
};
} // end namespace itk

#ifndef ITK_MANUAL_INSTANTIATION
#  include "itkSpatialFunctionImageEvaluatorFilter.hxx"
#endif

#endif


text:
package org.apache.spark.sql.avro

import java.math.BigDecimal
import java.nio.ByteBuffer

import scala.collection.JavaConverters._
import scala.collection.mutable.ArrayBuffer

import org.apache.avro.{LogicalTypes, Schema, SchemaBuilder}
import org.apache.avro.Conversions.DecimalConversion
import org.apache.avro.LogicalTypes.{TimestampMicros, TimestampMillis}
import org.apache.avro.Schema.Type._
import org.apache.avro.generic._
import org.apache.avro.util.Utf8

import org.apache.spark.sql.catalyst.{InternalRow, NoopFilters, StructFilters}
import org.apache.spark.sql.catalyst.expressions.{SpecificInternalRow, UnsafeArrayData}
import org.apache.spark.sql.catalyst.util.{ArrayBasedMapData, ArrayData, DateTimeUtils, GenericArrayData}
import org.apache.spark.sql.catalyst.util.DateTimeConstants.MILLIS_PER_DAY
import org.apache.spark.sql.execution.datasources.DataSourceUtils
import org.apache.spark.sql.internal.SQLConf
import org.apache.spark.sql.internal.SQLConf.LegacyBehaviorPolicy
import org.apache.spark.sql.types._
import org.apache.spark.unsafe.types.UTF8String
/**
 * A deserializer to deserialize data in avro format to data in catalyst format.
 */
class AvroDeserializer(
    rootAvroType: Schema,
    rootCatalystType: DataType,
    datetimeRebaseMode: LegacyBehaviorPolicy.Value,
    filters: StructFilters) {

  def this(rootAvroType: Schema, rootCatalystType: DataType) {
    this(
      rootAvroType,
      rootCatalystType,
      LegacyBehaviorPolicy.withName(SQLConf.get.getConf(SQLConf.LEGACY_AVRO_REBASE_MODE_IN_READ)),
      new NoopFilters)
  }

  private lazy val decimalConversions = new DecimalConversion()

  private val dateRebaseFunc = DataSourceUtils.creteDateRebaseFuncInRead(
    datetimeRebaseMode, "Avro")

  private val timestampRebaseFunc = DataSourceUtils.creteTimestampRebaseFuncInRead(
    datetimeRebaseMode, "Avro")

  private val converter: Any => Option[Any] = rootCatalystType match {
    // A shortcut for empty schema.
    case st: StructType if st.isEmpty =>
      (data: Any) => Some(InternalRow.empty)

    case st: StructType =>
      val resultRow = new SpecificInternalRow(st.map(_.dataType))
      val fieldUpdater = new RowUpdater(resultRow)
      val applyFilters = filters.skipRow(resultRow, _)
      val writer = getRecordWriter(rootAvroType, st, Nil, applyFilters)
      (data: Any) => {
        val record = data.asInstanceOf[GenericRecord]
        val skipRow = writer(fieldUpdater, record)
        if (skipRow) None else Some(resultRow)
      }

    case _ =>
      val tmpRow = new SpecificInternalRow(Seq(rootCatalystType))
      val fieldUpdater = new RowUpdater(tmpRow)
      val writer = newWriter(rootAvroType, rootCatalystType, Nil)
      (data: Any) => {
        writer(fieldUpdater, 0, data)
        Some(tmpRow.get(0, rootCatalystType))
      }
  }

  def deserialize(data: Any): Option[Any] = converter(data)

  /**
   * Creates a writer to write avro values to Catalyst values at the given ordinal with the given
   * updater.
   */
  private def newWriter(
      avroType: Schema,
      catalystType: DataType,
      path: List[String]): (CatalystDataUpdater, Int, Any) => Unit =
    (avroType.getType, catalystType) match {
      case (NULL, NullType) => (updater, ordinal, _) =>
        updater.setNullAt(ordinal)

      // TODO: we can avoid boxing if future version of avro provide primitive accessors.
      case (BOOLEAN, BooleanType) => (updater, ordinal, value) =>
        updater.setBoolean(ordinal, value.asInstanceOf[Boolean])

      case (INT, IntegerType) => (updater, ordinal, value) =>
        updater.setInt(ordinal, value.asInstanceOf[Int])

      case (INT, DateType) => (updater, ordinal, value) =>
        updater.setInt(ordinal, dateRebaseFunc(value.asInstanceOf[Int]))

      case (LONG, LongType) => (updater, ordinal, value) =>
        updater.setLong(ordinal, value.asInstanceOf[Long])

      case (LONG, TimestampType) => avroType.getLogicalType match {
        // For backward compatibility, if the Avro type is Long and it is not logical type
        // (the `null` case), the value is processed as timestamp type with millisecond precision.
        case null | _: TimestampMillis => (updater, ordinal, value) =>
          val millis = value.asInstanceOf[Long]
          val micros = DateTimeUtils.millisToMicros(millis)
          updater.setLong(ordinal, timestampRebaseFunc(micros))
        case _: TimestampMicros => (updater, ordinal, value) =>
          val micros = value.asInstanceOf[Long]
          updater.setLong(ordinal, timestampRebaseFunc(micros))
        case other => throw new IncompatibleSchemaException(
          s"Cannot convert Avro logical type ${other} to Catalyst Timestamp type.")
      }

      // Before we upgrade Avro to 1.8 for logical type support, spark-avro converts Long to Date.
      // For backward compatibility, we still keep this conversion.
      case (LONG, DateType) => (updater, ordinal, value) =>
        updater.setInt(ordinal, (value.asInstanceOf[Long] / MILLIS_PER_DAY).toInt)

      case (FLOAT, FloatType) => (updater, ordinal, value) =>
        updater.setFloat(ordinal, value.asInstanceOf[Float])

      case (DOUBLE, DoubleType) => (updater, ordinal, value) =>
        updater.setDouble(ordinal, value.asInstanceOf[Double])

      case (STRING, StringType) => (updater, ordinal, value) =>
        val str = value match {
          case s: String => UTF8String.fromString(s)
          case s: Utf8 =>
            val bytes = new Array[Byte](s.getByteLength)
            System.arraycopy(s.getBytes, 0, bytes, 0, s.getByteLength)
            UTF8String.fromBytes(bytes)
        }
        updater.set(ordinal, str)

      case (ENUM, StringType) => (updater, ordinal, value) =>
        updater.set(ordinal, UTF8String.fromString(value.toString))

      case (FIXED, BinaryType) => (updater, ordinal, value) =>
        updater.set(ordinal, value.asInstanceOf[GenericFixed].bytes().clone())

      case (BYTES, BinaryType) => (updater, ordinal, value) =>
        val bytes = value match {
          case b: ByteBuffer =>
            val bytes = new Array[Byte](b.remaining)
            b.get(bytes)
            bytes
          case b: Array[Byte] => b
          case other => throw new RuntimeException(s"$other is not a valid avro binary.")
        }
        updater.set(ordinal, bytes)

      case (FIXED, d: DecimalType) => (updater, ordinal, value) =>
        val bigDecimal = decimalConversions.fromFixed(value.asInstanceOf[GenericFixed], avroType,
          LogicalTypes.decimal(d.precision, d.scale))
        val decimal = createDecimal(bigDecimal, d.precision, d.scale)
        updater.setDecimal(ordinal, decimal)

      case (BYTES, d: DecimalType) => (updater, ordinal, value) =>
        val bigDecimal = decimalConversions.fromBytes(value.asInstanceOf[ByteBuffer], avroType,
          LogicalTypes.decimal(d.precision, d.scale))
        val decimal = createDecimal(bigDecimal, d.precision, d.scale)
        updater.setDecimal(ordinal, decimal)

      case (RECORD, st: StructType) =>
        // Avro datasource doesn't accept filters with nested attributes. See SPARK-32328.
        // We can always return `false` from `applyFilters` for nested records.
        val writeRecord = getRecordWriter(avroType, st, path, applyFilters = _ => false)
        (updater, ordinal, value) =>
          val row = new SpecificInternalRow(st)
          writeRecord(new RowUpdater(row), value.asInstanceOf[GenericRecord])
          updater.set(ordinal, row)

      case (ARRAY, ArrayType(elementType, containsNull)) =>
        val elementWriter = newWriter(avroType.getElementType, elementType, path)
        (updater, ordinal, value) =>
          val collection = value.asInstanceOf[java.util.Collection[Any]]
          val result = createArrayData(elementType, collection.size())
          val elementUpdater = new ArrayDataUpdater(result)

          var i = 0
          val iter = collection.iterator()
          while (iter.hasNext) {
            val element = iter.next()
            if (element == null) {
              if (!containsNull) {
                throw new RuntimeException(s"Array value at path ${path.mkString(".")} is not " +
                  "allowed to be null")
              } else {
                elementUpdater.setNullAt(i)
              }
            } else {
              elementWriter(elementUpdater, i, element)
            }
            i += 1
          }

          updater.set(ordinal, result)

      case (MAP, MapType(keyType, valueType, valueContainsNull)) if keyType == StringType =>
        val keyWriter = newWriter(SchemaBuilder.builder().stringType(), StringType, path)
        val valueWriter = newWriter(avroType.getValueType, valueType, path)
        (updater, ordinal, value) =>
          val map = value.asInstanceOf[java.util.Map[AnyRef, AnyRef]]
          val keyArray = createArrayData(keyType, map.size())
          val keyUpdater = new ArrayDataUpdater(keyArray)
          val valueArray = createArrayData(valueType, map.size())
          val valueUpdater = new ArrayDataUpdater(valueArray)
          val iter = map.entrySet().iterator()
          var i = 0
          while (iter.hasNext) {
            val entry = iter.next()
            assert(entry.getKey != null)
            keyWriter(keyUpdater, i, entry.getKey)
            if (entry.getValue == null) {
              if (!valueContainsNull) {
                throw new RuntimeException(s"Map value at path ${path.mkString(".")} is not " +
                  "allowed to be null")
              } else {
                valueUpdater.setNullAt(i)
              }
            } else {
              valueWriter(valueUpdater, i, entry.getValue)
            }
            i += 1
          }

          // The Avro map will never have null or duplicated map keys, it's safe to create a
          // ArrayBasedMapData directly here.
          updater.set(ordinal, new ArrayBasedMapData(keyArray, valueArray))

      case (UNION, _) =>
        val allTypes = avroType.getTypes.asScala
        val nonNullTypes = allTypes.filter(_.getType != NULL)
        val nonNullAvroType = Schema.createUnion(nonNullTypes.asJava)
        if (nonNullTypes.nonEmpty) {
          if (nonNullTypes.length == 1) {
            newWriter(nonNullTypes.head, catalystType, path)
          } else {
            nonNullTypes.map(_.getType) match {
              case Seq(a, b) if Set(a, b) == Set(INT, LONG) && catalystType == LongType =>
                (updater, ordinal, value) => value match {
                  case null => updater.setNullAt(ordinal)
                  case l: java.lang.Long => updater.setLong(ordinal, l)
                  case i: java.lang.Integer => updater.setLong(ordinal, i.longValue())
                }

              case Seq(a, b) if Set(a, b) == Set(FLOAT, DOUBLE) && catalystType == DoubleType =>
                (updater, ordinal, value) => value match {
                  case null => updater.setNullAt(ordinal)
                  case d: java.lang.Double => updater.setDouble(ordinal, d)
                  case f: java.lang.Float => updater.setDouble(ordinal, f.doubleValue())
                }

              case _ =>
                catalystType match {
                  case st: StructType if st.length == nonNullTypes.size =>
                    val fieldWriters = nonNullTypes.zip(st.fields).map {
                      case (schema, field) => newWriter(schema, field.dataType, path :+ field.name)
                    }.toArray
                    (updater, ordinal, value) => {
                      val row = new SpecificInternalRow(st)
                      val fieldUpdater = new RowUpdater(row)
                      val i = GenericData.get().resolveUnion(nonNullAvroType, value)
                      fieldWriters(i)(fieldUpdater, i, value)
                      updater.set(ordinal, row)
                    }

                  case _ =>
                    throw new IncompatibleSchemaException(
                      s"Cannot convert Avro to catalyst because schema at path " +
                        s"${path.mkString(".")} is not compatible " +
                        s"(avroType = $avroType, sqlType = $catalystType).\n" +
                        s"Source Avro schema: $rootAvroType.\n" +
                        s"Target Catalyst type: $rootCatalystType")
                }
            }
          }
        } else {
          (updater, ordinal, value) => updater.setNullAt(ordinal)
        }

      case _ =>
        throw new IncompatibleSchemaException(
          s"Cannot convert Avro to catalyst because schema at path ${path.mkString(".")} " +
            s"is not compatible (avroType = $avroType, sqlType = $catalystType).\n" +
            s"Source Avro schema: $rootAvroType.\n" +
            s"Target Catalyst type: $rootCatalystType")
    }

  // TODO: move the following method in Decimal object on creating Decimal from BigDecimal?
  private def createDecimal(decimal: BigDecimal, precision: Int, scale: Int): Decimal = {
    if (precision <= Decimal.MAX_LONG_DIGITS) {
      // Constructs a `Decimal` with an unscaled `Long` value if possible.
      Decimal(decimal.unscaledValue().longValue(), precision, scale)
    } else {
      // Otherwise, resorts to an unscaled `BigInteger` instead.
      Decimal(decimal, precision, scale)
    }
  }

  private def getRecordWriter(
      avroType: Schema,
      sqlType: StructType,
      path: List[String],
      applyFilters: Int => Boolean): (CatalystDataUpdater, GenericRecord) => Boolean = {
    val validFieldIndexes = ArrayBuffer.empty[Int]
    val fieldWriters = ArrayBuffer.empty[(CatalystDataUpdater, Any) => Unit]

    val length = sqlType.length
    var i = 0
    while (i < length) {
      val sqlField = sqlType.fields(i)
      val avroField = avroType.getField(sqlField.name)
      if (avroField != null) {
        validFieldIndexes += avroField.pos()

        val baseWriter = newWriter(avroField.schema(), sqlField.dataType, path :+ sqlField.name)
        val ordinal = i
        val fieldWriter = (fieldUpdater: CatalystDataUpdater, value: Any) => {
          if (value == null) {
            fieldUpdater.setNullAt(ordinal)
          } else {
            baseWriter(fieldUpdater, ordinal, value)
          }
        }
        fieldWriters += fieldWriter
      } else if (!sqlField.nullable) {
        throw new IncompatibleSchemaException(
          s"""
             |Cannot find non-nullable field ${path.mkString(".")}.${sqlField.name} in Avro schema.
             |Source Avro schema: $rootAvroType.
             |Target Catalyst type: $rootCatalystType.
           """.stripMargin)
      }
      i += 1
    }

    (fieldUpdater, record) => {
      var i = 0
      var skipRow = false
      while (i < validFieldIndexes.length && !skipRow) {
        fieldWriters(i)(fieldUpdater, record.get(validFieldIndexes(i)))
        skipRow = applyFilters(i)
        i += 1
      }
      skipRow
    }
  }

  private def createArrayData(elementType: DataType, length: Int): ArrayData = elementType match {
    case BooleanType => UnsafeArrayData.fromPrimitiveArray(new Array[Boolean](length))
    case ByteType => UnsafeArrayData.fromPrimitiveArray(new Array[Byte](length))
    case ShortType => UnsafeArrayData.fromPrimitiveArray(new Array[Short](length))
    case IntegerType => UnsafeArrayData.fromPrimitiveArray(new Array[Int](length))
    case LongType => UnsafeArrayData.fromPrimitiveArray(new Array[Long](length))
    case FloatType => UnsafeArrayData.fromPrimitiveArray(new Array[Float](length))
    case DoubleType => UnsafeArrayData.fromPrimitiveArray(new Array[Double](length))
    case _ => new GenericArrayData(new Array[Any](length))
  }

  /**
   * A base interface for updating values inside catalyst data structure like `InternalRow` and
   * `ArrayData`.
   */
  sealed trait CatalystDataUpdater {
    def set(ordinal: Int, value: Any): Unit

    def setNullAt(ordinal: Int): Unit = set(ordinal, null)
    def setBoolean(ordinal: Int, value: Boolean): Unit = set(ordinal, value)
    def setByte(ordinal: Int, value: Byte): Unit = set(ordinal, value)
    def setShort(ordinal: Int, value: Short): Unit = set(ordinal, value)
    def setInt(ordinal: Int, value: Int): Unit = set(ordinal, value)
    def setLong(ordinal: Int, value: Long): Unit = set(ordinal, value)
    def setDouble(ordinal: Int, value: Double): Unit = set(ordinal, value)
    def setFloat(ordinal: Int, value: Float): Unit = set(ordinal, value)
    def setDecimal(ordinal: Int, value: Decimal): Unit = set(ordinal, value)
  }

  final class RowUpdater(row: InternalRow) extends CatalystDataUpdater {
    override def set(ordinal: Int, value: Any): Unit = row.update(ordinal, value)

    override def setNullAt(ordinal: Int): Unit = row.setNullAt(ordinal)
    override def setBoolean(ordinal: Int, value: Boolean): Unit = row.setBoolean(ordinal, value)
    override def setByte(ordinal: Int, value: Byte): Unit = row.setByte(ordinal, value)
    override def setShort(ordinal: Int, value: Short): Unit = row.setShort(ordinal, value)
    override def setInt(ordinal: Int, value: Int): Unit = row.setInt(ordinal, value)
    override def setLong(ordinal: Int, value: Long): Unit = row.setLong(ordinal, value)
    override def setDouble(ordinal: Int, value: Double): Unit = row.setDouble(ordinal, value)
    override def setFloat(ordinal: Int, value: Float): Unit = row.setFloat(ordinal, value)
    override def setDecimal(ordinal: Int, value: Decimal): Unit =
      row.setDecimal(ordinal, value, value.precision)
  }

  final class ArrayDataUpdater(array: ArrayData) extends CatalystDataUpdater {
    override def set(ordinal: Int, value: Any): Unit = array.update(ordinal, value)

    override def setNullAt(ordinal: Int): Unit = array.setNullAt(ordinal)
    override def setBoolean(ordinal: Int, value: Boolean): Unit = array.setBoolean(ordinal, value)
    override def setByte(ordinal: Int, value: Byte): Unit = array.setByte(ordinal, value)
    override def setShort(ordinal: Int, value: Short): Unit = array.setShort(ordinal, value)
    override def setInt(ordinal: Int, value: Int): Unit = array.setInt(ordinal, value)
    override def setLong(ordinal: Int, value: Long): Unit = array.setLong(ordinal, value)
    override def setDouble(ordinal: Int, value: Double): Unit = array.setDouble(ordinal, value)
    override def setFloat(ordinal: Int, value: Float): Unit = array.setFloat(ordinal, value)
    override def setDecimal(ordinal: Int, value: Decimal): Unit = array.update(ordinal, value)
  }
}


text:
class ofApp : public ofBaseApp{

public:
    void setup();
    void update();
    void draw();
    void exit();

    void drawPointCloud();
    void drawPointCloudAll();

    void keyPressed(int key);
    void keyReleased(int key);
    void mouseMoved(int x, int y );
    void mouseDragged(int x, int y, int button);
    void mousePressed(int x, int y, int button);
    void mouseReleased(int x, int y, int button);
    void windowResized(int w, int h);
    void dragEvent(ofDragInfo dragInfo);
    void gotMessage(ofMessage msg);

private:
    void numBlobsIndicator(int n);
    void startTotalMesh();

    int timeSegment;
    int nextSegmentDistance;
    int startCameraDist;
    int cameraDist;

    bool controlBlobsManually = false;
    int numBlobs = 0;
    int usedBlobs =-1;

    ofxKinect kinect;

    ofxCvGrayscaleImage	grayImage;
    ofxCvGrayscaleImage	depthImage;
    ofxCvColorImage		colorImage;
    ofxCvGrayscaleImage	redImage;

    ofxCvContourFinder 	contourFinder;

    int nearThreshold;
    int farThreshold;;

    // used for viewing the point cloud
    ofEasyCam easyCam;

    deque<vector<ofMesh> > totalMesh;
    int lastMinute = 0;
    int lastSecond = 0;
    int actualMinute = 0;
    int lastPictureTaken =0;

    int w;
    int h;
    int minConnectionDistance; //how far can we connect vertexes
    int maxConnectionDistance; //how far can we connect vertexes
    int nearby;//how far to sample the neighbor

    int minFigureDistance; //min distance from camera things being recorded should be
    int maxFigureDistance; //min distance from camera things being recorded should be

    ofPoint lastSampleLoc[2];
    double getAngleBetweenBlobs(ofxCvBlob blob0, ofxCvBlob blob1);
    ofQuaternion qFromV(ofVec3f u, ofVec3f v);
    ofQuaternion twoToQ(ofxCvBlob blob0, ofxCvBlob blob1);

    int lastCameraDist;
    int diffCameraDist;
    int previousNBlobs;
};


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Ukr. bot. Zh. 45(5): 62 (1988)

#### Original name
Erysiphe hydrophyllacearum U. Braun

### Remarks
null


text:
var test = require('ava');
var OpenT2T = require('opent2t').OpenT2T;
var config = require('./testConfig');
var translatorPath = require('path').join(__dirname, '..');

var OpenT2TLogger = require('opent2t').Logger;
var logger = new OpenT2TLogger("info");
logger.verbose("Config:");
logger.verbose(JSON.stringify(config, null, 2));
var opent2t = new OpenT2T(logger);

///
/// Run a series of tests to validate the translator
///

// Get
test.serial('Get', t => {

    return opent2t.createTranslatorAsync(translatorPath, 'thingTranslator', config)
        .then(translator => {
            // TEST: translator is valid
            t.is(typeof translator, 'object') && t.truthy(translator);
            return opent2t.invokeMethodAsync(translator, 'org.opent2t.sample.hub.superpopular', 'getPlatforms', [true])
                .then((hub) => {

                    console.log("Hub schema:");
                    console.log(JSON.stringify(hub.schema, null, 2));
                    console.log("Hub Platforms:");
                    console.log(JSON.stringify(hub.platforms, null, 2));
                    console.log("Hub Errors:");
                    console.log(hub.errors);

                    // TEST: something was returned
                    t.truthy(hub);

                    // TEST: hub has devices
                    t.truthy(hub.platforms);
                    t.true(hub.platforms.length > 0);
                });
        });
});


text:
import Ember from 'ember';
import LoginControllerMixin from 'simple-auth/mixins/login-controller-mixin';

export default Ember.Controller.extend(LoginControllerMixin, {
  authenticator: 'simple-auth-authenticator:devise',

  queryParams: ['registrationSuccessful'],

  identification: null,
  password: null,
  registrationSuccessful: false,
  loginFailed: false,

  actions: {
    authenticate: function() {
      // HACK: wipe the registrationSuccessful message upon log in attempt
      if (this.get('registrationSuccessful')) {
        this.set('registrationSuccessful', false);
      }

      // quickly exit and avoid the AJAX call if either the email or password is empty
      if (Ember.isEmpty(this.get('identification')) || Ember.isEmpty(this.get('password'))) {
        this.set('loginFailed', true);
        return;
      }

      // wipe the failed message and make the AJAX call to log the user in
      // this._super() is defined by ember-simple-auth in
      // the LoginControllerMixin included in this controller
      this.set('loginFailed', false);
      return this._super().catch(() => {
        // log in failed, either invalid email or password
        this.set('loginFailed', true);
      });
    }
  }
});


text:
package com.moac.android.interceptordemo.fragment;

import com.moac.android.interceptordemo.R;
import com.moac.android.interceptordemo.api.TracksApi;
import com.moac.android.interceptordemo.fetch.FetchScheduler;
import com.moac.android.interceptordemo.injection.InjectingFragment;
import com.moac.android.interceptordemo.viewmodel.Track;
import com.moac.android.interceptordemo.viewmodel.TracksViewModel;
import com.squareup.picasso.Picasso;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import java.util.concurrent.TimeUnit;

import javax.inject.Inject;

import rx.android.schedulers.AndroidSchedulers;
import rx.subscriptions.CompositeSubscription;

public class DisplayFragment extends InjectingFragment {

    private static final String TAG = DisplayFragment.class.getSimpleName();

    @Inject
    TracksViewModel mViewModelProvider;

    @Inject
    Picasso mPicasso;

    @Inject
    FetchScheduler mFetchScheduler;

    @Inject
    TracksApi mTracksApi;

    private CompositeSubscription mViewModelSubscription;
    private TextView mArtistTextView;
    private TextView mTitleTextView;
    private ImageView mTrackImageView;

    @Override
    public View onCreateView(LayoutInflater inflater,
                             ViewGroup container,
                             Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_display, container, false);
        mArtistTextView = (TextView) rootView.findViewById(R.id.textView_artist);
        mTitleTextView = (TextView) rootView.findViewById(R.id.textView_title);
        mTrackImageView = (ImageView) rootView.findViewById(R.id.imageView_track);
        return rootView;
    }

    @Override
    public void onStart() {
        super.onStart();
        mViewModelSubscription = new CompositeSubscription();

        // Update the displayed track every 5 seconds
        mViewModelSubscription.add(mViewModelProvider.getTrackDataStream(5, TimeUnit.SECONDS)
                                                     .observeOn(AndroidSchedulers.mainThread())
                                                     .subscribe(this::renderTrack,
                                                                DisplayFragment::logError,
                                                                DisplayFragment::logCompleted));

        // Fetch a new set of tracks every 20 seconds
        mFetchScheduler.start(20, TimeUnit.SECONDS);
    }

    @Override
    public void onStop() {
        super.onStop();
        mViewModelSubscription.clear();
        mFetchScheduler.stop();
    }

    private void renderTrack(@NonNull final Track track) {
        Log.i(TAG, "Rendering new track: " + track);
        mPicasso.load(track.getArtworkUrl())
                .into(mTrackImageView);
        mArtistTextView.setText(track.getArtist());
        mTitleTextView.setText(track.getTitle());
    }

    private static int logCompleted() {
        return Log.w(TAG, "ViewModelProvider Observable completed!");
    }

    private static int logError(final Throwable throwable) {
        return Log.e(TAG, "ViewModelProvider Observable errored!", throwable);
    }

}


text:
#pragma once
#include <aws/timestream-query/TimestreamQuery_EXPORTS.h>
#include <aws/core/utils/memory/stl/AWSString.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace TimestreamQuery
{
namespace Model
{

  /**
   *
The requested resource could not be found.

See Also:
   AWS
   * API Reference

   */
  class AWS_TIMESTREAMQUERY_API ResourceNotFoundException
  {
  public:
    ResourceNotFoundException();
    ResourceNotFoundException(Aws::Utils::Json::JsonView jsonValue);
    ResourceNotFoundException& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    inline const Aws::String& GetMessage() const{ return m_message; }

    inline bool MessageHasBeenSet() const { return m_messageHasBeenSet; }

    inline void SetMessage(const Aws::String& value) { m_messageHasBeenSet = true; m_message = value; }

    inline void SetMessage(Aws::String&& value) { m_messageHasBeenSet = true; m_message = std::move(value); }

    inline void SetMessage(const char* value) { m_messageHasBeenSet = true; m_message.assign(value); }

    inline ResourceNotFoundException& WithMessage(const Aws::String& value) { SetMessage(value); return *this;}

    inline ResourceNotFoundException& WithMessage(Aws::String&& value) { SetMessage(std::move(value)); return *this;}

    inline ResourceNotFoundException& WithMessage(const char* value) { SetMessage(value); return *this;}

    /**
     *
The ARN of the scheduled query.

     */
    inline const Aws::String& GetScheduledQueryArn() const{ return m_scheduledQueryArn; }

    /**
     *
The ARN of the scheduled query.

     */
    inline bool ScheduledQueryArnHasBeenSet() const { return m_scheduledQueryArnHasBeenSet; }

    /**
     *
The ARN of the scheduled query.

     */
    inline void SetScheduledQueryArn(const Aws::String& value) { m_scheduledQueryArnHasBeenSet = true; m_scheduledQueryArn = value; }

    /**
     *
The ARN of the scheduled query.

     */
    inline void SetScheduledQueryArn(Aws::String&& value) { m_scheduledQueryArnHasBeenSet = true; m_scheduledQueryArn = std::move(value); }

    /**
     *
The ARN of the scheduled query.

     */
    inline void SetScheduledQueryArn(const char* value) { m_scheduledQueryArnHasBeenSet = true; m_scheduledQueryArn.assign(value); }

    /**
     *
The ARN of the scheduled query.

     */
    inline ResourceNotFoundException& WithScheduledQueryArn(const Aws::String& value) { SetScheduledQueryArn(value); return *this;}

    /**
     *
The ARN of the scheduled query.

     */
    inline ResourceNotFoundException& WithScheduledQueryArn(Aws::String&& value) { SetScheduledQueryArn(std::move(value)); return *this;}

    /**
     *
The ARN of the scheduled query.

     */
    inline ResourceNotFoundException& WithScheduledQueryArn(const char* value) { SetScheduledQueryArn(value); return *this;}

  private:

    Aws::String m_message;
    bool m_messageHasBeenSet;

    Aws::String m_scheduledQueryArn;
    bool m_scheduledQueryArnHasBeenSet;
  };

} // namespace Model
} // namespace TimestreamQuery
} // namespace Aws