text:
using System.Linq;
using System.Reflection.Metadata.Tests;
using Xunit;

namespace System.Reflection.Metadata.Ecma335.Tests
{
    public class MetadataTokensTests
    {
        // MetadataReader handles:
        private static readonly EntityHandle s_assemblyRefHandle = AssemblyReferenceHandle.FromRowId(1);
        private static readonly EntityHandle s_virtualAssemblyRefHandle = AssemblyReferenceHandle.FromVirtualIndex(AssemblyReferenceHandle.VirtualIndex.System_Runtime);
        private static readonly Handle s_virtualBlobHandle = BlobHandle.FromVirtualIndex(BlobHandle.VirtualIndex.AttributeUsage_AllowSingle, 0);
        private static readonly Handle s_userStringHandle = UserStringHandle.FromOffset(1);
        private static readonly Handle s_stringHandle = StringHandle.FromOffset(1);
        private static readonly Handle s_winrtPrefixedStringHandle = StringHandle.FromOffset(1).WithWinRTPrefix();
        private static readonly Handle s_blobHandle = BlobHandle.FromOffset(1);
        private static readonly Handle s_guidHandle = GuidHandle.FromIndex(5);
        private static readonly EntityHandle s_exportedTypeHandle = ExportedTypeHandle.FromRowId(42);

        // MetadataBuilder handles:
        private static readonly Handle s_writerStringHandle = StringHandle.FromWriterVirtualIndex(1);
        private static readonly Handle s_writerBlobHandle = BlobHandle.FromOffset(1);
        private static readonly Handle s_writerGuidHandle = GuidHandle.FromIndex(1);
        private static readonly Handle s_writerUserStringHandle = UserStringHandle.FromOffset(1);

        [Fact]
        public void GetRowNumber()
        {
            Assert.Equal(1, MetadataTokens.GetRowNumber(s_assemblyRefHandle));
            Assert.Equal(-1, MetadataTokens.GetRowNumber(s_virtualAssemblyRefHandle));
        }

        [Fact]
        public void GetHeapOffset()
        {
            Assert.Equal(-1, MetadataTokens.GetHeapOffset(s_virtualBlobHandle));
            Assert.Equal(-1, MetadataTokens.GetHeapOffset((BlobHandle)s_virtualBlobHandle));
            Assert.Equal(1, MetadataTokens.GetHeapOffset(s_userStringHandle));
            Assert.Equal(1, MetadataTokens.GetHeapOffset((UserStringHandle)s_userStringHandle));
            Assert.Equal(1, MetadataTokens.GetHeapOffset(s_stringHandle));
            Assert.Equal(1, MetadataTokens.GetHeapOffset((StringHandle)s_stringHandle));
            Assert.Equal(-1, MetadataTokens.GetHeapOffset(s_winrtPrefixedStringHandle));
            Assert.Equal(-1, MetadataTokens.GetHeapOffset((StringHandle)s_winrtPrefixedStringHandle));
            Assert.Equal(1, MetadataTokens.GetHeapOffset(s_blobHandle));
            Assert.Equal(1, MetadataTokens.GetHeapOffset((BlobHandle)s_blobHandle));
            Assert.Equal(5, MetadataTokens.GetHeapOffset(s_guidHandle));
            Assert.Equal(5, MetadataTokens.GetHeapOffset((GuidHandle)s_guidHandle));

            Assert.Equal(1, MetadataTokens.GetHeapOffset(s_writerUserStringHandle));
            Assert.Equal(1, MetadataTokens.GetHeapOffset((UserStringHandle)s_writerUserStringHandle));
            Assert.Equal(-1, MetadataTokens.GetHeapOffset(s_writerStringHandle));
            Assert.Equal(-1, MetadataTokens.GetHeapOffset((StringHandle)s_writerStringHandle));
            Assert.Equal(1, MetadataTokens.GetHeapOffset(s_writerBlobHandle));
            Assert.Equal(1, MetadataTokens.GetHeapOffset((BlobHandle)s_writerBlobHandle));
            Assert.Equal(1, MetadataTokens.GetHeapOffset(s_writerGuidHandle));
            Assert.Equal(1, MetadataTokens.GetHeapOffset((GuidHandle)s_writerGuidHandle));

            AssertExtensions.Throws<ArgumentException>("handle", () => MetadataTokens.GetHeapOffset(s_assemblyRefHandle));
            AssertExtensions.Throws<ArgumentException>("handle", () => MetadataTokens.GetHeapOffset(s_virtualAssemblyRefHandle));
        }

        [Fact]
        public void GetToken()
        {
            Assert.Equal(0x23000001, MetadataTokens.GetToken((Handle)s_assemblyRefHandle));
            Assert.Equal(0, MetadataTokens.GetToken((Handle)s_virtualAssemblyRefHandle));

            Assert.Equal(0x23000001, MetadataTokens.GetToken(s_assemblyRefHandle));
            Assert.Equal(0, MetadataTokens.GetToken(s_virtualAssemblyRefHandle));
            Assert.Equal(0x70000001, MetadataTokens.GetToken(s_userStringHandle));

            AssertExtensions.Throws<ArgumentException>("handle", () => MetadataTokens.GetToken(s_virtualBlobHandle));
            AssertExtensions.Throws<ArgumentException>("handle", () => MetadataTokens.GetToken(s_stringHandle));
            AssertExtensions.Throws<ArgumentException>("handle", () => MetadataTokens.GetToken(s_winrtPrefixedStringHandle));
            AssertExtensions.Throws<ArgumentException>("handle", () => MetadataTokens.GetToken(s_blobHandle));
            AssertExtensions.Throws<ArgumentException>("handle", () => MetadataTokens.GetToken(s_guidHandle));
        }

        [Fact]
        public void TryGetTableIndex()
        {
            var kinds =
                from i in Enumerable.Range(0, 255)
                let index = new Func<HandleKind, TableIndex?>(k =>
                {
                    TableIndex ti;
                    if (MetadataTokens.TryGetTableIndex(k, out ti))
                    {
                        Assert.Equal((int)k, (int)ti);
                        return ti;
                    }

                    return null;
                })((HandleKind)i)
                where index != null
                select index.Value;

            AssertEx.Equal(new TableIndex[]
            {
                TableIndex.Module,
                TableIndex.TypeRef,
                TableIndex.TypeDef,
                TableIndex.FieldPtr,
                TableIndex.Field,
                TableIndex.MethodPtr,
                TableIndex.MethodDef,
                TableIndex.ParamPtr,
                TableIndex.Param,
                TableIndex.InterfaceImpl,
                TableIndex.MemberRef,
                TableIndex.Constant,
                TableIndex.CustomAttribute,
                TableIndex.FieldMarshal,
                TableIndex.DeclSecurity,
                TableIndex.ClassLayout,
                TableIndex.FieldLayout,
                TableIndex.StandAloneSig,
                TableIndex.EventMap,
                TableIndex.EventPtr,
                TableIndex.Event,
                TableIndex.PropertyMap,
                TableIndex.PropertyPtr,
                TableIndex.Property,
                TableIndex.MethodSemantics,
                TableIndex.MethodImpl,
                TableIndex.ModuleRef,
                TableIndex.TypeSpec,
                TableIndex.ImplMap,
                TableIndex.FieldRva,
                TableIndex.EncLog,
                TableIndex.EncMap,
                TableIndex.Assembly,
                TableIndex.AssemblyRef,
                TableIndex.File,
                TableIndex.ExportedType,
                TableIndex.ManifestResource,
                TableIndex.NestedClass,
                TableIndex.GenericParam,
                TableIndex.MethodSpec,
                TableIndex.GenericParamConstraint,
                TableIndex.Document,
                TableIndex.MethodDebugInformation,
                TableIndex.LocalScope,
                TableIndex.LocalVariable,
                TableIndex.LocalConstant,
                TableIndex.ImportScope,
                TableIndex.StateMachineMethod,
                TableIndex.CustomDebugInformation
            }, kinds);
        }

        [Fact]
        public void TryGetHeapIndex()
        {
            HeapIndex index;
            Assert.True(MetadataTokens.TryGetHeapIndex(HandleKind.Blob, out index));
            Assert.Equal(HeapIndex.Blob, index);

            Assert.True(MetadataTokens.TryGetHeapIndex(HandleKind.String, out index));
            Assert.Equal(HeapIndex.String, index);

            Assert.True(MetadataTokens.TryGetHeapIndex(HandleKind.UserString, out index));
            Assert.Equal(HeapIndex.UserString, index);

            Assert.True(MetadataTokens.TryGetHeapIndex(HandleKind.NamespaceDefinition, out index));
            Assert.Equal(HeapIndex.String, index);

            Assert.True(MetadataTokens.TryGetHeapIndex(HandleKind.Guid, out index));
            Assert.Equal(HeapIndex.Guid, index);

            Assert.False(MetadataTokens.TryGetHeapIndex(HandleKind.Constant, out index));
            Assert.False(MetadataTokens.TryGetHeapIndex((HandleKind)255, out index));
        }

        [Fact]
        public void HandleFactories_FromToken()
        {
            Assert.Equal(s_assemblyRefHandle, MetadataTokens.Handle(0x23000001));
            Assert.Equal(s_userStringHandle, MetadataTokens.Handle(0x70000001));
            Assert.Equal(s_exportedTypeHandle, MetadataTokens.ExportedTypeHandle((int)(TokenTypeIds.ExportedType | s_exportedTypeHandle.RowId)));

            AssertExtensions.Throws<ArgumentException>("token", () => MetadataTokens.Handle(-1));
            AssertExtensions.Throws<ArgumentException>("token", () => MetadataTokens.Handle(0x71000001));
            AssertExtensions.Throws<ArgumentException>("token", () => MetadataTokens.Handle(0x72000001));
            AssertExtensions.Throws<ArgumentException>("token", () => MetadataTokens.Handle(0x73000001));
            AssertExtensions.Throws<ArgumentException>("token", () => MetadataTokens.Handle(0x74000001));
            AssertExtensions.Throws<ArgumentException>("token", () => MetadataTokens.Handle(0x7a000001));
            AssertExtensions.Throws<ArgumentException>("token", () => MetadataTokens.Handle(0x7e000001));
            AssertExtensions.Throws<ArgumentException>("token", () => MetadataTokens.Handle(0x7fffffff));
        }

        [Fact]
        public void HandleFactories_FromTableIndex()
        {
            Assert.Equal(s_assemblyRefHandle, MetadataTokens.Handle(TableIndex.AssemblyRef, 1));
            Assert.Equal(s_exportedTypeHandle, MetadataTokens.Handle(TableIndex.ExportedType, s_exportedTypeHandle.RowId));

            Assert.Equal(s_assemblyRefHandle, MetadataTokens.EntityHandle(TableIndex.AssemblyRef, 1));
            Assert.Equal(s_exportedTypeHandle, MetadataTokens.EntityHandle(TableIndex.ExportedType, s_exportedTypeHandle.RowId));

            Assert.Equal(s_userStringHandle, MetadataTokens.Handle((TableIndex)0x70, 1));

            Assert.Throws<ArgumentOutOfRangeException>(() => MetadataTokens.Handle((TableIndex)0x71, 1));
            Assert.Throws<ArgumentOutOfRangeException>(() => MetadataTokens.Handle((TableIndex)0x72, 1));
            Assert.Throws<ArgumentOutOfRangeException>(() => MetadataTokens.Handle((TableIndex)0x73, 1));
            Assert.Throws<ArgumentOutOfRangeException>(() => MetadataTokens.Handle((TableIndex)0x74, 1));
            Assert.Throws<ArgumentOutOfRangeException>(() => MetadataTokens.Handle((TableIndex)0x7a, 1));
            Assert.Throws<ArgumentOutOfRangeException>(() => MetadataTokens.Handle((TableIndex)0x7e, 1));
            Assert.Throws<ArgumentOutOfRangeException>(() => MetadataTokens.Handle((TableIndex)0x7f, 0xffffff));
        }

        [Fact]
        public void SpecificHandleFactories()
        {
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.MethodDefinitionHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.MethodImplementationHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.MethodSpecificationHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.TypeDefinitionHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.ExportedTypeHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.TypeReferenceHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.TypeSpecificationHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.InterfaceImplementationHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.MemberReferenceHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.FieldDefinitionHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.EventDefinitionHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.PropertyDefinitionHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.StandaloneSignatureHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.ParameterHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.GenericParameterHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.GenericParameterConstraintHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.ModuleReferenceHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.AssemblyReferenceHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.CustomAttributeHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.DeclarativeSecurityAttributeHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.ConstantHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.ManifestResourceHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.AssemblyFileHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.DocumentHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.MethodDebugInformationHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.LocalScopeHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.LocalVariableHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.LocalConstantHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.ImportScopeHandle(1)));
            Assert.Equal(1, MetadataTokens.GetRowNumber(MetadataTokens.CustomDebugInformationHandle(1)));
            Assert.Equal(1, MetadataTokens.GetHeapOffset(MetadataTokens.UserStringHandle(1)));
            Assert.Equal(1, MetadataTokens.GetHeapOffset(MetadataTokens.StringHandle(1)));
            Assert.Equal(1, MetadataTokens.GetHeapOffset(MetadataTokens.BlobHandle(1)));
            Assert.Equal(1, MetadataTokens.GetHeapOffset(MetadataTokens.GuidHandle(1)));
            Assert.Equal(1, MetadataTokens.GetHeapOffset((BlobHandle)MetadataTokens.DocumentNameBlobHandle(1)));
        }
    }
}


text:
export default function fillTheBlanks (arr, num) {
  for (let i = arr.length; i < num; i++) {
    arr.push({})
  }
  return arr
}

redpajama_set_name: RedPajamaGithub


text:
#include "store/CCStore.h"
#include "store/CCStoreProductsRequestDelegate.h"
#import <StoreKit/StoreKit.h>
//USING_NS_CC_EXTRA;

class CCStoreReceiptVerifyRequestIOS;

@interface StoreIOS : NSObject < SKPaymentTransactionObserver, SKProductsRequestDelegate >
{
    cocos2d::extra::CCStoreIsSandbox isSandbox_;
    cocos2d::extra::CCStoreReceiptVerifyMode receiptVerifyMode_;
    NSString *receiptVerifyServerUrl_;

    cocos2d::extra::StoreTransactionObserver *transactionObserver_;
    cocos2d::extra::StoreProductsRequestDelegate *productRequestDelegate_;
    NSMutableDictionary *loadedProducts_;
    SKProductsRequest *productRequest_;
}

@property (nonatomic, assign) cocos2d::extra::CCStoreIsSandbox isSandbox;
@property (nonatomic, assign) cocos2d::extra::CCStoreReceiptVerifyMode receiptVerifyMode;
@property (nonatomic, retain) NSString *receiptVerifyServerUrl;

#pragma mark -
#pragma mark init

+ (StoreIOS *)sharedStore;
+ (void)purgeSharedStore;
- (id)init;
- (void)postInitWithTransactionObserver:(cocos2d::extra::StoreTransactionObserver *)observer;

#pragma mark -
#pragma mark Making a Purchase

- (BOOL)canMakePurchases;
- (void)purchase:(SKProduct *)product;
- (void)restore;
- (void)finishTransaction:(SKPaymentTransaction *)transaction;

#pragma mark -
#pragma mark Retrieving Product Information

- (void)requestProductData:(NSSet *)productsId andDelegate:(cocos2d::extra::StoreProductsRequestDelegate *)delegate;
- (void)cancelRequestProductData;
- (BOOL)isProductLoaded:(NSString *)productId;
- (SKProduct *)getProduct:(NSString *)productId;
- (void)cleanCachedProducts;

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response;
- (void)request:(SKRequest *)request didFailWithError:(NSError *)error;

#pragma mark -
#pragma mark Handling Transactions

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions;
- (void)transactionCompleted:(SKPaymentTransaction *)transaction andReceiptVerifyStatus:(int)receiptVerifyStatus;
- (void)transactionFailed:(SKPaymentTransaction *)transaction andReceiptVerifyStatus:(int)receiptVerifyStatus;
- (void)transactionRestored:(SKPaymentTransaction *)transaction andReceiptVerifyStatus:(int)receiptVerifyStatus;

#pragma mark -
#pragma mark Verifying Store Receipts

- (void)verifyTransactionReceipt:(SKPaymentTransaction *)transaction;

/* CCStoreReceiptVerifyRequestIOS */
- (void)verifyReceiptRequestFinished:(CCStoreReceiptVerifyRequestIOS *)handler;
- (void)verifyReceiptRequestFailed:(CCStoreReceiptVerifyRequestIOS *)handler;

#pragma mark -
#pragma mark helper

- (cocos2d::extra::StorePaymentTransaction *)createStorePaymentTransaction:(SKPaymentTransaction *)transaction
                                        andReceiptVerifyStatus:(int)receiptVerifyStatus;

@end


text:
const WebSocket = require('ws');
const PORT = 8080;//process.env.PORT || 27689;
const wss = new WebSocket.Server({
    port: PORT
});
	const USERNAME = 0;
    const CONNECTED = 1;
    const DISCONNECTED = 2;
    const ONLINE_USERS = 3;
	const ONLINE_ENEMIES = 4;
    const UPDATE_ENEMY_TARGETPOSITION = 5;
	const UPDATE_PLAYER_POSITION = 6;
	const UPDATE_PLAYER_INVENTORY = 7;
	const UPDATE_PLAYER_ANIMATION = 8;
	const UPDATE_PLAYER_STATS = 9;
	const UPDATE_ENEMY_POSITION = 10;

let uid = 0;

console.log("Listening on", PORT);

//user class
class User {
    constructor(obj) {
        this.id = uid++;
        this.ip = obj.ip !== void 0 ? obj.ip : "";
        this.socket = obj.socket;
		this.data = {
			servertype: 0,
			username: obj.username !== void 0 ? obj.username : "",
			idn: uid,
			tx: 0,
			tz: 0,
			x: 0,
			z: 0,
			y: 1,
			state: 0,
			gear: {head: 0, necklace: 0, body: 0, righthand: 0, lefthand: 0, rings: 0, shoes: 0},
			stats: {health: 1, attack: 1, magic: 1, accuracy: 1, dodge: 1, stunchance: 1, stamina: 1, armor: 1, speed: 1},
			inventory: [],
			gravity: -0.9,
			walkspd: 0.05,
			rotatespd: 0.02
		};

        if (!this.socket) {
            throw new Error("Fatal error, user", this.id, "got no socket!");
        }
    }
	//send a message
    send(msg) {
        this.socket.send(msg);
    }
	//valid username
    isValid() {
        return (this.data.username !== "");
    }
};

//enemy class
class Enemy {
	constructor(obj){
		this.servertype = 0;
		this.idn = uid++;
		this.username = "slime";
		this.stats = {health: 1, attack: 1, magic: 1, accuracy: 1, dodge: 1, stunchance: 1, stamina: 1, armor: 1, speed: 1};
		this.gear = {head: 0, necklace: 0, body: 0, righthand: 0, lefthand: 0, rings: 0, shoes: 0};
		this.x = Math.random();
		this.z = Math.random();
		this.y = 5;
		this.state = 0;
		this.tx = Math.floor(Math.random() * 101)-50;
		this.tz = Math.floor(Math.random() * 101)-50;
		this.gravity = -0.9;
		this.walkspd = 0.05;
		this.rotatespd = 0.02;
	}
};

let users = [];
let enemies = [];

//enemies.push(new Enemy())
enemies.push(new Enemy())

//removes the users from the array
let deleteUserFromUsers = (user) => {
    users.map((us, index) => {
        if (us === user || us === user) {
            users.splice(index, 1);
        }
    });
};

//gets all the online users
let getOnlineUsers = () => {
    let str = "";
    users.map((user, index) => {
		user.data.servertype = ONLINE_USERS;
        str += JSON.stringify(user.data);
        if (index < users.length - 1) str += "!!!";
    });
    return (str);
};

let getOnlineEnemies = () =>{
	let str = "";
	enemies.map((enemy, index) => {
		enemy.servertype = ONLINE_ENEMIES;
		str += JSON.stringify(enemy);
		if(index < enemies.length -1) str += "!!!";
	});
	return (str);
};

//send message to given user
let broadcastMessage = (type, msg) => {
    users.map((user) => {
		user.data.servertype = type;
        user.send(JSON.stringify(msg));
    });
};

let userAlreadyConnected = (user) => {
    for (let ii = 0; ii < users.length; ++ii) {
        const us = users[ii];
        if (us.ip === user.ip) return (true);
    };
    return (false);
};

let adduser = (user, data) =>{
	user.data.username = data.split('"servertype":' + USERNAME + " ")[1];
    console.log(user.ip + ":" + user.data.username, "connected!");
    broadcastMessage(CONNECTED, user.data);
    user.send(getOnlineUsers());
	user.send(getOnlineEnemies());
};

//when someone connects
wss.on('connection', function connection(ws, req) {
    console.log("someone connected");
    const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
    const user = new User({
        ip: ip,
        socket: ws
    });
	/*if (userAlreadyConnected(user)) {
        console.log("Already connected, skipping!");
        return;
    }*/
    users.push(user);
    console.log(users.length, "connected users!");
	//remove user from array
    ws.on('close', () => {
        deleteUserFromUsers(user);
        console.log(user.ip + ":" + user.data.username, "disconnected!");
        broadcastMessage(DISCONNECTED, user.data);
    });
	//when a message is received
    ws.on('message', function(data) {
		const servertype = data.split('"servertype":')[1];
        const type = parseInt(servertype);
		let obj;
		if(type !== USERNAME)
			obj = JSON.parse(data);
		//on received message do...
        switch (type) {
			case UPDATE_ENEMY_TARGETPOSITION:
					updateenemytargetposition(obj, type);
				break;
			case UPDATE_PLAYER_ANIMATION:
				break;
			case UPDATE_PLAYER_POSITION:
					updateplayerposition(user, obj, type);
				break;
			case UPDATE_PLAYER_INVENTORY:
					updateplayerinventory(user, obj, type);
				break;
			case UPDATE_PLAYER_STATS:
				break;
			case UPDATE_ENEMY_POSITION:
				break;
			case USERNAME:
				adduser(user, data);
            default:
                console.log("Unknown message of type", type, "from", ip, "data:", data);
                break;
        };

    });
});

let updateplayerposition = (user, obj, type) =>{

	user.data.x = obj.x;
	user.data.z = obj.z;
	user.data.y = obj.y;

	broadcastMessage(type, user.data);

}

let updateplayerinventory = (user, obj, type) =>{

	user.data.inventory = obj.inventory;
	user.data.gear = obj.gear;

	broadcastMessage(type, user.data);

}

let updateenemytargetposition = (obj, type) =>{

	enemy.tx = Math.floor(Math.random() * 101)-50;
	enemy.tz = Math.floor(Math.random() * 101)-50;

	broadcastMessage(type, enemy);

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project name="Bootstrap Popover" default="local">
    <description>Rich Popovers to add small overlays of content, similar to what you see on an iPad. Uses the Bootstrap styling and extends Y.Bootstrap.Tooltip</description>
    <property file="build.properties" />
    <import file="${builddir}/3.x/bootstrap.xml" />
</project>


text:
  Vivans est
       un village
       géographiquement positionné dans le département de Loire en Rhône-Alpes. Elle totalisait 250 habitants en 2008.

Si vous envisagez de venir habiter à Vivans, vous pourrez facilement trouver une maison à vendre.

Le nombre de logements, à Vivans, était réparti en 2011 en deux appartements et 149 maisons soit
 un marché plutôt équilibré.

À proximité de Vivans sont situées les villes de
La Pacaudière à 6 km, 1 108 habitants,
Saint-Germain-Lespinasse localisée à 9 km, 1 145 habitants,
Artaix localisée à 8 km, 392 habitants,
Chenay-le-Châtel située à 4 km, 396 habitants,
Urbise située à 8 km, 126 habitants,
Noailly localisée à 7 km, 735 habitants,
 entre autres. De plus, Vivans est située à seulement 19 km de Roanne.

La commune compte quelques  équipements sportifs, elle dispose, entre autres, de une boucle de randonnée.


text:
package org.easycassandra.samples.javaee.rest.api;

import java.util.List;

/**
 *
 * @author otaviojava
 */
public interface CostOperations {

    boolean save(CostUnit bean);

    boolean update(CostUnit bean);

    boolean delete(String cityName);

    List<CostUnit> list();

    CostUnit retrieve(String city);

}


text:
let nextTodoId = 0

export const initialState = {
  items: [],
  visibilityFilter: 'SHOW_ALL',
}

export const addItem = (state, payload) => ({
  ...state,
  items: [
    ...state.items,
    {
      id: nextTodoId++,
      text: payload,
      completed: false,
    },
  ],
})

export const toggleItem = (state, payload) => ({
  ...state,
  items: state.items.map((item) => {
    if (item.id === payload) {
      item.completed = !item.completed
    }
    return item
  })
})

export const setVisibilityFilter = (state, payload) => ({
  ...state,
  visibilityFilter: payload,
})


text:
package metadata

import (
	"fmt"
	"math/rand"
	"testing"
	"time"

	"github.com/stretchr/testify/assert"
	"golang.org/x/net/context"

	"github.com/yunify/metad/backends"
	"github.com/yunify/metad/log"
	"github.com/yunify/metad/store"
	"github.com/yunify/metad/util/flatmap"
)

func init() {
	log.SetLevel("error")
	rand.Seed(int64(time.Now().Nanosecond()))
}

var (
	backend   = "local"
	maxNode   = 5
	sleepTime = 200 * time.Millisecond
)

func TestMetarepoData(t *testing.T) {

	metarepo := NewTestMetarepo()
	metarepo.DeleteData("/")

	clientIP := "192.168.0.1"
	accessRule := map[string][]store.AccessRule{
		clientIP: {
			{Path: "/", Mode: store.AccessModeRead},
		},
	}
	metarepo.PutAccessRule(accessRule)

	metarepo.StartSync()

	testData := FillTestData(metarepo)
	time.Sleep(sleepTime)
	ValidTestData(t, testData, metarepo.data)

	_, val := metarepo.Root(clientIP, "/nodes/0")
	assert.NotNil(t, val)

	mapVal, mok := val.(map[string]interface{})
	assert.True(t, mok)

	_, mok = mapVal["name"]
	assert.True(t, mok)

	metarepo.DeleteData("/nodes/0")

	time.Sleep(sleepTime)
	val = metarepo.GetData("/nodes/0")
	assert.Nil(t, val)

	subs := []string{"1", "3", "noexistkey"}
	//test batch delete
	err := metarepo.DeleteData("nodes", subs...)
	time.Sleep(sleepTime)
	assert.NoError(t, err)

	for _, sub := range subs {
		val = metarepo.GetData("/nodes/" + sub)
		assert.Nil(t, val)
	}

	val = metarepo.GetData("/nodes/2")
	assert.NotNil(t, val)

	metarepo.DeleteData("/")
	metarepo.StopSync()
}

func TestMetarepoMapping(t *testing.T) {

	metarepo := NewTestMetarepo()
	metarepo.DeleteData("/")
	metarepo.DeleteMapping("/")

	metarepo.StartSync()

	key := "node"
	mappings := make(map[string]interface{})
	for i := 0; i < maxNode; i++ {
		ip := fmt.Sprintf("192.168.1.%v", i)
		mapping := map[string]interface{}{
			key:     fmt.Sprintf("/nodes/%v", i),
			"nodes": "/",
		}
		mappings[ip] = mapping
	}
	// batch update
	err := metarepo.PutMapping("/", mappings, true)
	assert.NoError(t, err)
	time.Sleep(sleepTime)

	metarepo.DeleteMapping("/192.168.1.0")

	time.Sleep(sleepTime)
	val := metarepo.GetMapping("/192.168.1.0")
	assert.Nil(t, val)

	subs := []string{"192.168.1.1", "192.168.1.3", "noexistkey"}
	//test batch delete
	err = metarepo.DeleteMapping("/", subs...)
	time.Sleep(sleepTime)
	assert.NoError(t, err)

	for _, sub := range subs {
		val = metarepo.GetMapping("/" + sub)
		assert.Nil(t, val)
	}

	val = metarepo.GetMapping("/192.168.1.2")
	assert.NotNil(t, val)

	p := 4
	ip := fmt.Sprintf("192.168.1.%v", p)

	expectMapping0 := map[string]interface{}{
		"node":  fmt.Sprintf("/nodes/%v", p),
		"nodes": "/",
	}

	// test update replace(false)
	err = metarepo.PutMapping(ip, map[string]interface{}{"node2": "/nodes/2"}, false)
	assert.NoError(t, err)

	expectMapping1 := map[string]interface{}{
		"node":  fmt.Sprintf("/nodes/%v", p),
		"nodes": "/",
		"node2": "/nodes/2",
	}
	time.Sleep(sleepTime)
	mapping := metarepo.GetMapping(fmt.Sprintf("/%s", ip))
	assert.Equal(t, expectMapping1, mapping)

	// test update key
	err = metarepo.PutMapping(ip+"/node3", "/nodes/3", false)
	assert.NoError(t, err)

	expectMapping2 := map[string]interface{}{
		"node":  fmt.Sprintf("/nodes/%v", p),
		"nodes": "/",
		"node2": "/nodes/2",
		"node3": "/nodes/3",
	}
	time.Sleep(sleepTime)
	mapping = metarepo.GetMapping(fmt.Sprintf("/%s", ip))
	assert.Equal(t, expectMapping2, mapping)

	// test delete mapping
	metarepo.DeleteMapping(ip + "/node3")
	time.Sleep(sleepTime)
	mapping = metarepo.GetMapping(fmt.Sprintf("/%s", ip))
	assert.Equal(t, expectMapping1, mapping)

	// test update replace(true)
	err = metarepo.PutMapping(ip, expectMapping0, true)
	assert.NoError(t, err)
	time.Sleep(sleepTime)
	mapping = metarepo.GetMapping(fmt.Sprintf("/%s", ip))
	assert.Equal(t, expectMapping0, mapping)

	metarepo.DeleteData("/")
	metarepo.DeleteMapping("/")
	metarepo.StopSync()
}

func TestMetarepoSelf(t *testing.T) {
	metarepo := NewTestMetarepo()

	metarepo.DeleteMapping("/")
	metarepo.DeleteData("/")

	metarepo.StartSync()

	testData := FillTestData(metarepo)
	time.Sleep(sleepTime)
	ValidTestData(t, testData, metarepo.data)

	key := "node"
	mappings := make(map[string]interface{})
	for i := 0; i < maxNode; i++ {
		ip := fmt.Sprintf("192.168.1.%v", i)
		mapping := map[string]interface{}{
			key:     fmt.Sprintf("/nodes/%v", i),
			"nodes": "/",
		}
		mappings[ip] = mapping
	}
	// batch update
	err := metarepo.PutMapping("/", mappings, true)
	assert.NoError(t, err)
	time.Sleep(sleepTime)

	//test mapping get
	mappings2 := metarepo.GetMapping("/")
	assert.Equal(t, mappings, mappings2)

	// test GetSelf
	time.Sleep(sleepTime)
	p := rand.Intn(maxNode)
	ip := fmt.Sprintf("192.168.1.%v", p)

	val := metarepo.Self(ip, "/")
	mapVal, mok := val.(map[string]interface{})

	assert.True(t, mok)
	assert.NotNil(t, mapVal[key])

	val = metarepo.Self(ip, "/node/name")
	assert.Equal(t, fmt.Sprintf("node%v", p), val)

	//test date delete
	metarepo.DeleteData(fmt.Sprintf("/nodes/%v/name", p))

	time.Sleep(sleepTime)
	val = metarepo.Self(ip, "/node/name")
	assert.Nil(t, val)

	metarepo.PutData(fmt.Sprintf("/nodes/%v/name", p), fmt.Sprintf("node%v", p), true)

	//test mapping dir

	err = metarepo.PutMapping(ip, map[string]interface{}{
		"dir": map[string]interface{}{
			"n1": "/nodes/1",
			"n2": "/nodes/2",
		},
	}, false)
	assert.NoError(t, err)

	time.Sleep(sleepTime)
	val = metarepo.Self(ip, "/dir/n1/name")
	if val != "node1" {
		log.Error("except node1, but get %s, ip: %s, data: %s, mapping:%s", val, ip, metarepo.data.Json(), metarepo.mapping.Json())
		t.Fatal("except node1, but get", val)
	}
	assert.Equal(t, "node1", val)

	metarepo.DeleteData("/")
	metarepo.DeleteMapping("/")
	metarepo.StopSync()
}

func TestMetarepoRoot(t *testing.T) {

	metarepo := NewTestMetarepo()

	metarepo.DeleteMapping("/")
	metarepo.DeleteData("/")

	FillTestData(metarepo)

	metarepo.StartSync()
	time.Sleep(sleepTime)

	ip := "192.168.1.0"

	accessRule := map[string][]store.AccessRule{
		ip: {
			{Path: "/", Mode: store.AccessModeRead},
		},
	}
	metarepo.PutAccessRule(accessRule)

	mapping := make(map[string]interface{})
	mapping["node"] = "/nodes/0"
	err := metarepo.PutMapping(ip, mapping, true)
	assert.NoError(t, err)

	time.Sleep(sleepTime)
	_, val := metarepo.Root(ip, "/")
	mapVal, mok := val.(map[string]interface{})
	assert.True(t, mok)
	//println(fmt.Sprintf("%v", mapVal))
	assert.NotNil(t, mapVal["nodes"])
	selfVal := mapVal["self"]
	assert.NotNil(t, selfVal)
	assert.True(t, len(mapVal) > 1)

	metarepo.DeleteData("/")
	metarepo.DeleteMapping("/")
	metarepo.StopSync()
}

func TestWatch(t *testing.T) {
	metarepo := NewTestMetarepo()
	metarepo.DeleteMapping("/")
	metarepo.DeleteData("/")

	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	ip := "192.168.1.1"

	ch := make(chan interface{})
	defer close(ch)

	go func() {
		ch <- metarepo.Watch(ctx, ip, "/")
	}()

	FillTestData(metarepo)

	time.Sleep(sleepTime)

	metarepo.StartSync()

	time.Sleep(sleepTime)

	//println(metarepo.data.Json())
	var result interface{}
	select {
	case result = <-ch:
	case <-time.Tick(sleepTime):
		log.Error("TestWatch wait timeout, key: /, ip: %s, data: %s, mapping: %s", ip, metarepo.data.Json(), metarepo.mapping.Json())
		t.Fatal("TestWatch wait timeout")
	}

	m, mok := result.(map[string]interface{})
	assert.True(t, mok)
	//println(fmt.Sprintf("%v", m))
	assert.Equal(t, 1, len(m))
	assert.Equal(t, maxNode*2, len(flatmap.Flatten(m)))

	//test watch leaf node

	go func() {
		ch <- metarepo.Watch(ctx, ip, "/nodes/1/name")
	}()
	time.Sleep(sleepTime)

	metarepo.PutData("/nodes/1/name", "n1", false)

	select {
	case result = <-ch:
	case <-time.Tick(sleepTime):
		log.Error("TestWatch wait timeout for key /nodes/1/name , ip: %s, data: %s, mapping: %s", ip, metarepo.data.Json(), metarepo.mapping.Json())
		t.Fatal("TestWatch wait timeout")
	}

	assert.Equal(t, "UPDATE|n1", result)
	metarepo.StopSync()
}

func TestWatchSelf(t *testing.T) {
	metarepo := NewTestMetarepo()
	metarepo.DeleteMapping("/")
	metarepo.DeleteData("/")

	FillTestData(metarepo)
	metarepo.StartSync()

	ip := "192.168.1.1"

	err := metarepo.PutMapping(ip, map[string]interface{}{
		"node": "/nodes/1",
	}, true)
	assert.NoError(t, err)

	time.Sleep(sleepTime)

	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	ch := make(chan interface{})
	defer close(ch)

	for i := 0; i <= 10; i++ {
		go func() {
			ch <- metarepo.WatchSelf(ctx, "192.168.1.1", "/")
		}()
		time.Sleep(sleepTime)
		//test data change

		name := fmt.Sprintf("n1_%v", i)
		ip := fmt.Sprintf("192.168.1.%v", i)
		err = metarepo.PutData("/nodes/1", map[string]interface{}{
			"name": name,
			"ip":   ip,
		}, false)
		assert.NoError(t, err)

		//println(metarepo.data.Json())

		result := <-ch

		m, mok := result.(map[string]interface{})
		assert.True(t, mok)
		//println(fmt.Sprintf("%v", m))
		fmap := flatmap.Flatten(m)
		assert.Equal(t, fmt.Sprintf("UPDATE|%s", name), fmap["/node/name"])
		assert.Equal(t, fmt.Sprintf("UPDATE|%s", ip), fmap["/node/ip"])
	}

	// test watch self subdir
	go func() {
		ch <- metarepo.WatchSelf(ctx, "192.168.1.1", "/node")
	}()

	time.Sleep(sleepTime)

	err = metarepo.DeleteData("/nodes/1/name")
	assert.NoError(t, err)

	result := <-ch

	m, mok := result.(map[string]interface{})
	assert.True(t, mok)
	//println(fmt.Sprintf("%v", m))
	assert.Equal(t, "DELETE|n1_10", m["name"])

	log.Debug("TimerPool stat,total New:%v, Get:%v", metarepo.timerPool.TotalNew.Get(), metarepo.timerPool.TotalGet.Get())
	metarepo.StopSync()
}

func TestWatchCloseChan(t *testing.T) {
	metarepo := NewTestMetarepo()

	metarepo.StartSync()

	ip := "192.168.1.1"

	err := metarepo.PutMapping(ip, map[string]interface{}{
		"node": "/nodes/1",
	}, true)
	assert.NoError(t, err)

	time.Sleep(sleepTime)

	ctx1, cancel1 := context.WithCancel(context.Background())
	ctx2, cancel2 := context.WithCancel(context.Background())

	ch := make(chan interface{})
	defer close(ch)

	ch2 := make(chan interface{})
	defer close(ch2)

	go func() {
		ch <- metarepo.Watch(ctx1, "192.168.1.1", "/")
	}()
	go func() {
		ch2 <- metarepo.WatchSelf(ctx2, ip, "/")
	}()

	time.Sleep(sleepTime)

	cancel1()
	result := <-ch
	assert.NotNil(t, result)
	cancel2()
	result2 := <-ch2
	assert.NotNil(t, result2)
	metarepo.StopSync()
}

// TestSelfWatchNodeNotExist
// create a mapping with a node not exist, then update the node
func TestSelfWatchNodeNotExist(t *testing.T) {
	metarepo := NewTestMetarepo()

	metarepo.StartSync()

	//fmt.Printf("data:%p mapping:%p \n", metarepo.data.)

	ip := "192.168.1.1"

	err := metarepo.PutMapping(ip, map[string]interface{}{
		"host": "/hosts/i-local",
		"cmd":  "/cmd/i-local",
	}, true)
	assert.NoError(t, err)

	//err = metarepo.PutData("/hosts/i-local", ip , true)
	//assert.NoError(t, err)

	time.Sleep(sleepTime)
	ctx, cancel := context.WithCancel(context.Background())
	defer cancel()

	ch := make(chan interface{})
	defer close(ch)
	go func() {
		ch <- metarepo.WatchSelf(ctx, ip, "/")
	}()

	time.Sleep(sleepTime)

	err = metarepo.PutData("/cmd/i-local", "start", true)
	assert.NoError(t, err)
	result := <-ch
	println(fmt.Sprintf("%s", result))
	assert.NotNil(t, result)
	//closeChan <- true
	metarepo.StopSync()
}

func TestAccessRule(t *testing.T) {
	metarepo := NewTestMetarepo()
	metarepo.StartSync()

	data := map[string]interface{}{
		"clusters": map[string]interface{}{
			"cl-1": map[string]interface{}{
				"name": "cl-1",
				"env": map[string]interface{}{
					"username": "user1",
					"secret":   "123456",
				},
				"public_key": "public_key_val",
			},
			"cl-2": map[string]interface{}{
				"name": "cl-2",
				"env": map[string]interface{}{
					"username": "user2",
					"secret":   "1234567",
				},
				"public_key": "public_key_val2",
			},
		},
	}

	err := metarepo.PutData("/", data, true)
	assert.NoError(t, err)

	ip := "192.168.1.1"
	rules := map[string][]store.AccessRule{
		ip: {
			{Path: "/", Mode: store.AccessModeRead},
		},
	}

	err = metarepo.PutAccessRule(rules)
	assert.NoError(t, err)

	time.Sleep(sleepTime)

	rulesGet := metarepo.GetAccessRule([]string{ip})
	assert.Equal(t, rules, rulesGet)

	_, dataGet := metarepo.Root(ip, "/")
	assert.Equal(t, data, dataGet)

	metarepo.StopSync()
}

func NewTestMetarepo() *MetadataRepo {
	prefix := fmt.Sprintf("/prefix%v", rand.Intn(10000))
	group := fmt.Sprintf("/group%v", rand.Intn(10000))
	nodes := backends.GetDefaultBackends(backend)

	config := backends.Config{
		Backend:      backend,
		BackendNodes: nodes,
		Prefix:       prefix,
		Group:        group,
	}
	storeClient, err := backends.New(config)
	if err != nil {
		panic(err)
	}

	return New(storeClient)
}

func FillTestData(metarepo *MetadataRepo) map[string]string {
	nodes := make(map[string]interface{})
	for i := 0; i < maxNode; i++ {
		node := make(map[string]interface{})
		node["name"] = fmt.Sprintf("node%v", i)
		node["ip"] = fmt.Sprintf("192.168.1.%v", i)
		nodes[fmt.Sprintf("%v", i)] = node
	}
	testData := map[string]interface{}{
		"nodes": nodes,
	}
	err := metarepo.PutData("/", testData, true)
	if err != nil {
		log.Error("SetValues error", err.Error())
		panic(err)
	}
	return flatmap.Flatten(testData)
}

func ValidTestData(t *testing.T, testData map[string]string, metastore store.Store) {
	for k, v := range testData {
		_, storeVal := metastore.Get(k)
		assert.Equal(t, v, storeVal)
	}
}


text:
<?php

namespace Finwe\PhpCsFix\Rules;

use Finwe\PhpCsFix\Error;

/**
 * @author Matěj Humpál <finwe@finwe.info>
 */
interface IRule
{

	/**
	 * @param string $message
	 * @return mixed Match details, TRUE on simple success, FALSE on no match
	 */
	public function match($message);

	/**
	 * @param string[] $file File loaded to array per lines by file() function
	 * @param Error $error
	 * @return int Count of fixed errors
	 */
	public function fix(array &$file, Error $error);

}


text:
using System;
using System.Collections.Generic;
using NUnit.Framework;
using Moq;
using XenAdmin.Core;
using XenAPI;
using System.Linq;
using XenAdmin.Network;

namespace XenAdminTests.UnitTests
{
    [TestFixture, Category(TestCategories.Unit)]
    public class AutomatedUpdatesTests
    {

        private static Mock<Host> GetAMockHost(string productVersion, string buildNumber, List<Pool_patch> applied_patches = null)
        {
            var id = System.Guid.NewGuid().ToString();

            MockObjectManager mom = new MockObjectManager();

            mom.CreateNewConnection(id);

            Mock<Host> master = mom.NewXenObject<Host>(id);
            Mock<Pool> pool = mom.NewXenObject<Pool>(id);
            XenRef<Host> masterRef = new XenRef<Host>("master-ref");
            pool.Setup(p => p.master).Returns(masterRef);

            mom.MockCacheFor(id).Setup(c => c.Resolve(It.IsAny<XenRef<Pool>>())).Returns(pool.Object);

            mom.MockConnectionFor(id).Setup(c => c.Resolve(masterRef)).Returns(master.Object);
            mom.MockConnectionFor(id).Setup(c => c.Cache.Hosts).Returns(new Host[] { master.Object });
            mom.MockConnectionFor(id).Setup(c => c.Cache.Pools).Returns(new Pool[] { pool.Object });

            master.Setup(h => h.software_version).Returns(new Dictionary<string, string>());
            master.Setup(h => h.ProductVersion()).Returns(productVersion);
            master.Setup(h => h.AppliedPatches()).Returns(applied_patches ?? new List<Pool_patch>());
            master.Setup(h => h.BuildNumberRaw()).Returns(buildNumber);
            master.Setup(h => h.uuid).Returns(id);
            return master;
        }

        private static List<XenServerVersion> GetAVersionWithGivenNumberOfPatches(int numberOfPatches)
        {
            var serverVersions = new List<XenServerVersion>();

            var version = new XenServerVersion("7.0.0", "XenServer Test 7", true, false, "", new List<XenServerPatch>(), new List<XenServerPatch>(), DateTime.MinValue.ToString(), "buildNo", "", false, "");
            for (int ii = 0; ii < numberOfPatches; ii++)
            {
                var patch = new XenServerPatch("patch_uuid_" + ii, "patch name " + ii, "patch description" + ii, "", "", "1.0", "", "", "1970-01-01T00:00:00Z", "", "1000", "1000");
                version.Patches.Add(patch);
                version.MinimalPatches.Add(patch);
            }
            serverVersions.Add(version);

            return serverVersions;
        }

        private static void RemoveANumberOfPatchesPseudoRandomly(List<XenServerPatch> patches, int numberOfPatchesToRemove)
        {
            int expectedCount = patches.Count - numberOfPatchesToRemove;
            var rnd = new Random(777); //pseudo random to be able to repeat this test...

            while (patches.Count > expectedCount)
            {
                patches.RemoveAt(rnd.Next(patches.Count));
            }
        }

        [Test]
        public void GetUpgradeSequenceForNullConnection()
        {
            Assert.AreEqual(Updates.GetMinimalPatches((IXenConnection) null), null);
        }

        /// <summary>
        /// Version exists
        /// No patches in updates
        /// Nothing installed on host
        /// Result: update sequence has the host, but empty sequence
        /// </summary>
        [Test]
        public void NoPatchesForCurrentVersion()
        {
            // Arrange

            var serverVersions = GetAVersionWithGivenNumberOfPatches(0);
            var master = GetAMockHost(serverVersions.First().Version.ToString(), serverVersions.First().BuildNumber);
            SetXenServerVersionsInUpdates(serverVersions);

            var minimalPatches = Updates.GetMinimalPatches(master.Object.Connection);
            Assert.NotNull(minimalPatches);
            Assert.AreEqual(0, minimalPatches.Count);

            var upgradeSequence = Updates.GetPatchSequenceForHost(master.Object, minimalPatches);
            Assert.NotNull(upgradeSequence);
            Assert.AreEqual(0, upgradeSequence.Count);
        }

        /// <summary>
        /// Version exists
        /// 1 patch in updates. 1 in minimal list.
        /// 1 has to be installed on host
        /// Result: update sequence has the host, with the one single patch in it
        /// </summary>
        [Test]
        public void OnePatchToBeInstalledForCurrentVersion()
        {
            // Arrange

            var serverVersions = GetAVersionWithGivenNumberOfPatches(1);
            var patch = serverVersions.First().Patches[0];
            var master = GetAMockHost(serverVersions.First().Version.ToString(), serverVersions.First().BuildNumber);
            SetXenServerVersionsInUpdates(serverVersions);

            var minimalPatches = Updates.GetMinimalPatches(master.Object.Connection);
            Assert.NotNull(minimalPatches);
            Assert.AreEqual(1, minimalPatches.Count);

            var upgradeSequence = Updates.GetPatchSequenceForHost(master.Object, minimalPatches);
            Assert.NotNull(upgradeSequence);
            Assert.AreEqual(1, upgradeSequence.Count);
            Assert.NotNull(upgradeSequence[0]);
            Assert.AreEqual(upgradeSequence[0], patch);
        }

        /// <summary>
        /// Version exists
        /// 1 patch in updates. 1 in minimal list. But it is applied already on master.
        /// 0 has to be installed on host
        /// </summary>
        [Test]
        public void AlreadyInstalledOneFromMinimalForCurrentVersion()
        {
            // Arrange

            var serverVersions = GetAVersionWithGivenNumberOfPatches(1);
            var patch = serverVersions.First().Patches[0];

            Pool_patch pool_patch = new Pool_patch();
            pool_patch.uuid = patch.Uuid;

            var master = GetAMockHost(serverVersions.First().Version.ToString(), serverVersions.First().BuildNumber, new List<Pool_patch> {pool_patch});
            SetXenServerVersionsInUpdates(serverVersions);

            var minimalPatches = Updates.GetMinimalPatches(master.Object.Connection);
            Assert.NotNull(minimalPatches);
            Assert.AreEqual(1, minimalPatches.Count);

            var upgradeSequence = Updates.GetPatchSequenceForHost(master.Object, minimalPatches);
            Assert.NotNull(upgradeSequence);
            Assert.AreEqual(0, upgradeSequence.Count);
        }

        /// <summary>
        /// Version exists
        /// 100 patch in updates. 100 in minimal list.
        /// 100 has to be installed on host
        /// Result: update sequence has all the 100 patches in it
        /// </summary>
        [Test]
        public void HundredPatchToBeInstalledForCurrentVersion()
        {
            // Arrange
            var serverVersions = GetAVersionWithGivenNumberOfPatches(100);
            var master = GetAMockHost(serverVersions.First().Version.ToString(), serverVersions.First().BuildNumber);
            SetXenServerVersionsInUpdates(serverVersions);

            var minimalPatches = Updates.GetMinimalPatches(master.Object.Connection);
            Assert.NotNull(minimalPatches);
            Assert.AreEqual(100, minimalPatches.Count);

            var upgradeSequence = Updates.GetPatchSequenceForHost(master.Object, minimalPatches);
            Assert.NotNull(upgradeSequence);
            Assert.AreEqual(100, upgradeSequence.Count);

            for (int i = 100; i < 0; --i)
                Assert.AreEqual(upgradeSequence[i], serverVersions[0].Patches[i]);
        }

        /// <summary>
        /// Version exists
        /// 100 patch in updates. 51 in minimal list.
        /// 51 has to be installed on host
        /// Result: update sequence has all the 51 patches in it
        /// </summary>
        [Test]
        public void FiftyOnePatchToBeInstalledForCurrentVersion()
        {
            // Arrange
            var serverVersions = GetAVersionWithGivenNumberOfPatches(100);
            var master = GetAMockHost(serverVersions.First().Version.ToString(), serverVersions.First().BuildNumber);
            RemoveANumberOfPatchesPseudoRandomly(serverVersions.First().MinimalPatches, 49);
            SetXenServerVersionsInUpdates(serverVersions);

            // Assert

            var minimalPatches = Updates.GetMinimalPatches(master.Object.Connection);
            Assert.NotNull(minimalPatches);
            Assert.AreEqual(51, minimalPatches.Count);

            var upgradeSequence = Updates.GetPatchSequenceForHost(master.Object, minimalPatches);
            Assert.NotNull(upgradeSequence);
            Assert.AreEqual(51, upgradeSequence.Count);

            foreach (var patch in upgradeSequence)
                Assert.IsTrue(serverVersions.First().MinimalPatches.Contains(patch));

            Assert.False(upgradeSequence.Exists(seqpatch => !serverVersions.First().MinimalPatches.Contains(seqpatch)));
        }

        /// <summary>
        /// Version exists
        /// 100 patch in updates. 51 in minimal list.
        /// 41 has to be installed on host (only 41 of 51, because 10 is already installed from the Minimal list (as well as 5 other))
        /// Result: update sequence has all the 41 patches in it and all are from Minimal List and also not installed on the host
        /// </summary>
        [Test]
        public void FourtyOnePatchToBeInstalledForCurrentVersion()
        {
            // Arrange
            var serverVersions = GetAVersionWithGivenNumberOfPatches(100);
            RemoveANumberOfPatchesPseudoRandomly(serverVersions.First().MinimalPatches, 49);

            var pool_patches = new List<Pool_patch>();
            for (int ii = 0; ii < 10; ii++)
            {
                pool_patches.Add(new Pool_patch() { uuid = serverVersions.First().MinimalPatches[ii].Uuid });
            }

            var notMinimalPatchesInVersion = serverVersions.First().Patches.Where(p => !serverVersions.First().MinimalPatches.Exists(mp => mp.Uuid == p.Uuid)).ToList();
            for (int ii = 0; ii < 5; ii++)
            {
                pool_patches.Add(new Pool_patch() { uuid = notMinimalPatchesInVersion[ii].Uuid });
            }

            var master = GetAMockHost(serverVersions.First().Version.ToString(), serverVersions.First().BuildNumber, pool_patches);

            SetXenServerVersionsInUpdates(serverVersions);

            // Assert
            var minimalPatches = Updates.GetMinimalPatches(master.Object.Connection);
            Assert.NotNull(minimalPatches);
            Assert.AreEqual(51, minimalPatches.Count);

            var upgradeSequence = Updates.GetPatchSequenceForHost(master.Object, minimalPatches);
            Assert.NotNull(upgradeSequence);
            Assert.AreEqual(41, upgradeSequence.Count);

            foreach (var patch in upgradeSequence)
                Assert.IsTrue(serverVersions.First().MinimalPatches.Contains(patch) && !pool_patches.Exists(p  => p.uuid == patch.Uuid));

            Assert.False(upgradeSequence.Exists(seqpatch => !serverVersions.First().MinimalPatches.Contains(seqpatch)));
            Assert.True(upgradeSequence.Exists(seqpatch => !pool_patches.Exists(pp => pp.uuid == seqpatch.Uuid)));
        }

        /// <summary>
        /// Version exists
        /// 2 patch in updates. 1 in minimal list.
        /// 1 has to be installed on host
        /// Result: update sequence has the host, with the one single patch in it
        /// </summary>
        [Test]
        public void OnePatchOutOfTwoToBeInstalledForCurrentVersion()
        {
            // Arrange

            var serverVersions = GetAVersionWithGivenNumberOfPatches(2);
            var master = GetAMockHost(serverVersions.First().Version.ToString(), serverVersions.First().BuildNumber);
            RemoveANumberOfPatchesPseudoRandomly(serverVersions.First().MinimalPatches, 1);
            SetXenServerVersionsInUpdates(serverVersions);

            // Assert

            var minimalPatches = Updates.GetMinimalPatches(master.Object.Connection);
            Assert.NotNull(minimalPatches);
            Assert.AreEqual(1, minimalPatches.Count);

            var upgradeSequence = Updates.GetPatchSequenceForHost(master.Object, minimalPatches);
            Assert.NotNull(upgradeSequence);
            Assert.AreEqual(1, upgradeSequence.Count);
            Assert.AreEqual(upgradeSequence[0], serverVersions.First().MinimalPatches[0]);
        }

        /// <summary>
        /// Version exists
        /// 2 patch in updates. 2 in minimal list.
        /// 2 has to be installed on host
        /// Result: update sequence has the host, with the one single patch in it
        /// </summary>
        [Test]
        public void TwoPatchToBeInstalleOutOfTwodForCurrentVersion()
        {
            // Arrange

            var serverVersions = GetAVersionWithGivenNumberOfPatches(2);
            var master = GetAMockHost(serverVersions.First().Version.ToString(), serverVersions.First().BuildNumber);
            SetXenServerVersionsInUpdates(serverVersions);

            // Assert

            var minimalPatches = Updates.GetMinimalPatches(master.Object.Connection);
            Assert.NotNull(minimalPatches);
            Assert.AreEqual(2, minimalPatches.Count);

            var upgradeSequence = Updates.GetPatchSequenceForHost(master.Object, minimalPatches);
            Assert.NotNull(upgradeSequence);
            Assert.AreEqual(2, upgradeSequence.Count);

            for (int i = 0; i < upgradeSequence.Count; i++)
                Assert.AreEqual(upgradeSequence[i], serverVersions.First().MinimalPatches[i]);
        }

        /// <summary>
        /// Version does not exist
        /// Result: update sequence is null
        /// </summary>
        [Test]
        public void NoInfoForCurrentVersion()
        {
            // Arrange
            var serverVersions = GetAVersionWithGivenNumberOfPatches(200);
            var master = GetAMockHost(serverVersions.First().Version.ToString(), serverVersions.First().BuildNumber + "to_make_it_not_match");
            SetXenServerVersionsInUpdates(serverVersions);

            // assert
            var minimalPatches = Updates.GetMinimalPatches(master.Object.Connection);
            Assert.Null(minimalPatches);
        }

        /// <summary>
        /// Updates is static class, can't be mocked without refactoring - using this method instead
        /// </summary>
        /// <param name="serverVersions"></param>
        private void SetXenServerVersionsInUpdates(List<XenServerVersion> serverVersions)
        {
            Updates.XenServerVersions = serverVersions;
        }
    }
}


text:
home *[parallax] {
    background-repeat: no-repeat;
}

home #landing {
    color: white;

    background-image: url('images/3008_x_2000_otago.png');

    -webkit-background-size: cover;
    -moz-background-size: cover;
    -o-background-size: cover;
    background-size: cover;
}

home #landing .container-fluid {
   padding: 20px 15px 10px;
}

@media (min-width: 576px) {
  home #landing .container-fluid {
      padding: 30px 15px 10px;
  }
}

@media (min-width: 768px) {
  home #landing .container-fluid {
    padding: 40px 15px 10px;
  }
}

@media (min-width: 991px) {
  home #landing .container-fluid {
    padding: 40px 15px 10px;
  }

  home .feature {
      background-image: url('images/1920_x_1080_project.png');

      -webkit-background-size: cover;
      -moz-background-size: cover;
      -o-background-size: cover;
      background-size: cover;
  }

  home .feature2 {
      background-image: url('images/1920_x_1080_project2.png');

      -webkit-background-size: cover;
      -moz-background-size: cover;
      -o-background-size: cover;
      background-size: cover;
  }
}

home .ousa {
  background-image: url('images/1920_x_1080_ousa.png');

  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}

@media (min-width: 1200px) {
  home #landing .container-fluid {
    padding: 80px 15px 0px;
  }
}

home .container:first-child {
  padding: 50px 15px;
}

home .container {
  margin-bottom: 50px;
}

home .container:last-child {
  margin-bottom: 0px;
}

home .row {
  margin-bottom: 50px;
}

home .row:last-child {
  margin-bottom: 0px;
}

home .photo-credit {
    margin-top: 1.5rem;
    background-color: rgb(0, 0, 0);
    background-color: rgba(0, 0, 0, 0.3);
    color:white;
    text-decoration:none;
    padding: 6px 10px 4px;
    font-size:0.6rem;
    line-height:1.2;
    display:inline-block;
    border-radius:4px;
}

home .about-image {
  margin-top: 10px;
  margin-bottom: 30px;
}


text:
package org.apache.hadoop.fs.s3a.commit;

import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

import org.junit.AfterClass;
import org.junit.Rule;
import org.junit.rules.TemporaryFolder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.s3a.commit.files.SuccessData;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.v2.MiniMRYarnCluster;
import org.apache.hadoop.mapreduce.v2.jobhistory.JHAdminConfig;
import org.apache.hadoop.yarn.conf.YarnConfiguration;

import static org.apache.hadoop.util.Preconditions.checkNotNull;
import static org.apache.hadoop.fs.s3a.S3ATestUtils.assume;
import static org.apache.hadoop.fs.s3a.S3ATestUtils.deployService;
import static org.apache.hadoop.fs.s3a.S3ATestUtils.getTestPropertyBool;
import static org.apache.hadoop.fs.s3a.S3ATestUtils.prepareTestConfiguration;
import static org.apache.hadoop.fs.s3a.S3ATestUtils.terminateService;
import static org.apache.hadoop.fs.s3a.commit.CommitConstants.FS_S3A_COMMITTER_STAGING_TMP_PATH;
import static org.apache.hadoop.fs.s3a.commit.CommitConstants.FS_S3A_COMMITTER_STAGING_UNIQUE_FILENAMES;

/**
 * Full integration test MR jobs.
 *
 * This is all done on shared static mini YARN and (optionally) HDFS clusters,
 * set up before any of the tests methods run.
 *
 * To isolate tests properly for parallel test runs, that static state
 * needs to be stored in the final classes implementing the tests, and
 * exposed to the base class, with the setup clusters in the
 * specific test suites creating the clusters with unique names.
 *
 * This is "hard" to do in Java, unlike, say, Scala.
 *
 * Note: this turns out not to be the root cause of ordering problems
 * with the Terasort tests (that is hard coded use of a file in the local FS),
 * but this design here does make it clear that the before and after class
 * operations are explicitly called in the subclasses.
 * If two subclasses of this class are instantiated in the same JVM, in order,
 * they are guaranteed to be isolated.
 *
 */
public abstract class AbstractYarnClusterITest extends AbstractCommitITest {

  private static final Logger LOG =
      LoggerFactory.getLogger(AbstractYarnClusterITest.class);

  private static final int TEST_FILE_COUNT = 1;
  private static final int SCALE_TEST_FILE_COUNT = 10;

  public static final int SCALE_TEST_KEYS = 100;
  public static final int BASE_TEST_KEYS = 10;

  public static final int NO_OF_NODEMANAGERS = 2;

  private boolean scaleTest;

  /**
   * The static cluster binding with the lifecycle of this test; served
   * through instance-level methods for sharing across methods in the
   * suite.
   */
  @SuppressWarnings("StaticNonFinalField")
  private static ClusterBinding clusterBinding;

  @AfterClass
  public static void teardownClusters() throws IOException {
    terminateCluster(clusterBinding);
    clusterBinding = null;
  }

  /**
   * This is the cluster binding which every subclass must create.
   */
  protected static final class ClusterBinding {

    private String clusterName;

    private final MiniDFSClusterService hdfs;

    private final MiniMRYarnCluster yarn;

    public ClusterBinding(
        final String clusterName,
        final MiniDFSClusterService hdfs,
        final MiniMRYarnCluster yarn) {
      this.clusterName = clusterName;
      this.hdfs = hdfs;
      this.yarn = checkNotNull(yarn);
    }

    public MiniDFSClusterService getHdfs() {
      return hdfs;
    }

    /**
     * Get the cluster FS, which will either be HDFS or the local FS.
     * @return a filesystem.
     * @throws IOException failure
     */
    public FileSystem getClusterFS() throws IOException {
      MiniDFSClusterService miniCluster = getHdfs();
      return miniCluster != null
          ? miniCluster.getClusterFS()
          : FileSystem.getLocal(yarn.getConfig());
    }

    public MiniMRYarnCluster getYarn() {
      return yarn;
    }

    public Configuration getConf() {
      return getYarn().getConfig();
    }

    public String getClusterName() {
      return clusterName;
    }

    public void terminate() {
      terminateService(getYarn());
      terminateService(getHdfs());
    }
  }

  /**
   * Create the cluster binding.
   * The configuration will be patched by propagating down options
   * from the maven build and turning off unwanted
   * YARN features.
   *
   * If an HDFS cluster is requested,
   * the HDFS and YARN clusters will share the same configuration, so
   * the HDFS cluster binding is implicitly propagated to YARN.
   * If one is not requested, the local filesystem is used as the cluster FS.
   * @param conf configuration to start with.
   * @param useHDFS should an HDFS cluster be instantiated.
   * @return the cluster binding.
   * @throws IOException failure.
   */
  protected static ClusterBinding createCluster(
      final JobConf conf,
      final boolean useHDFS) throws IOException {
    prepareTestConfiguration(conf);
    conf.setBoolean(JHAdminConfig.MR_HISTORY_CLEANER_ENABLE, false);
    conf.setLong(CommonConfigurationKeys.FS_DU_INTERVAL_KEY, Long.MAX_VALUE);
    // minicluster tests overreact to not enough disk space.
    conf.setBoolean(YarnConfiguration.NM_DISK_HEALTH_CHECK_ENABLE, false);
    conf.setInt(YarnConfiguration.NM_MAX_PER_DISK_UTILIZATION_PERCENTAGE, 100);
    // create a unique cluster name based on the current time in millis.
    String timestamp = LocalDateTime.now().format(
        DateTimeFormatter.ofPattern("yyyy-MM-dd-HH.mm.ss.SS"));
    String clusterName = "yarn-" + timestamp;
    MiniDFSClusterService miniDFSClusterService =
        useHDFS
            ? deployService(conf, new MiniDFSClusterService())
            : null;
    MiniMRYarnCluster yarnCluster = deployService(conf,
        new MiniMRYarnCluster(clusterName, NO_OF_NODEMANAGERS));
    return new ClusterBinding(clusterName, miniDFSClusterService, yarnCluster);
  }

  /**
   * Terminate the cluster if it is not null.
   * @param cluster the cluster
   */
  protected static void terminateCluster(ClusterBinding cluster) {
    if (cluster != null) {
      cluster.terminate();
    }
  }

  /**
   * Get the cluster binding for this subclass.
   * @return the cluster binding
   */
  protected ClusterBinding getClusterBinding() {
    return clusterBinding;
  }

  protected MiniMRYarnCluster getYarn() {
    return getClusterBinding().getYarn();
  }

  /**
   * Get the cluster filesystem -hdfs or local.
   * @return the filesystem shared across the yarn nodes.
   */
  protected FileSystem getClusterFS() throws IOException {
    return getClusterBinding().getClusterFS();
  }

  /**
   * We stage work into a temporary directory rather than directly under
   * the user's home directory, as that is often rejected by CI test
   * runners.
   */
  @Rule
  public final TemporaryFolder stagingFilesDir = new TemporaryFolder();

  /**
   * The name of the committer as returned by
   * {@link AbstractS3ACommitter#getName()}
   * and used for committer construction.
   */
  protected abstract String committerName();

  /**
   * binding on demand rather than in a BeforeClass static method.
   * Subclasses can override this to change the binding options.
   * @return the cluster binding
   */
  protected ClusterBinding demandCreateClusterBinding() throws Exception {
    return createCluster(new JobConf(), false);
  }

  @Override
  public void setup() throws Exception {
    super.setup();

    scaleTest = getTestPropertyBool(
        getConfiguration(),
        KEY_SCALE_TESTS_ENABLED,
        DEFAULT_SCALE_TESTS_ENABLED);
    if (getClusterBinding() == null) {
      clusterBinding = demandCreateClusterBinding();
    }
    assertNotNull("cluster is not bound",
        getClusterBinding());

  }

  @Override
  protected int getTestTimeoutMillis() {
    return SCALE_TEST_TIMEOUT_SECONDS * 1000;
  }

  /**
   * Create a job configuration.
   * This creates a new job conf from the yarn
   * cluster configuration then calls
   * {@link #applyCustomConfigOptions(JobConf)} to allow it to be customized.
   * @return the new job configuration.
   * @throws IOException failure
   */
  protected JobConf newJobConf() throws IOException {
    JobConf jobConf = new JobConf(getYarn().getConfig());
    jobConf.addResource(getConfiguration());
    applyCustomConfigOptions(jobConf);
    return jobConf;
  }

  protected Job createJob(Configuration jobConf) throws IOException {
    Job mrJob = Job.getInstance(jobConf, getMethodName());
    patchConfigurationForCommitter(mrJob.getConfiguration());
    return mrJob;
  }

  /**
   * Patch the (job) configuration for this committer.
   * @param jobConf configuration to patch
   * @return a configuration which will run this configuration.
   */
  protected Configuration patchConfigurationForCommitter(
      final Configuration jobConf) {
    jobConf.setBoolean(FS_S3A_COMMITTER_STAGING_UNIQUE_FILENAMES,
        isUniqueFilenames());
    bindCommitter(jobConf,
        CommitConstants.S3A_COMMITTER_FACTORY,
        committerName());
    // pass down the scale test flag
    jobConf.setBoolean(KEY_SCALE_TESTS_ENABLED, isScaleTest());
    // and fix the commit dir to the local FS across all workers.
    String staging = stagingFilesDir.getRoot().getAbsolutePath();
    LOG.info("Staging temp dir is {}", staging);
    jobConf.set(FS_S3A_COMMITTER_STAGING_TMP_PATH, staging);
    return jobConf;
  }

  /**
   * Get the file count for the test.
   * @return the number of mappers to create.
   */
  public int getTestFileCount() {
    return isScaleTest() ? SCALE_TEST_FILE_COUNT : TEST_FILE_COUNT;
  }

  /**
   * Override point to let implementations tune the MR Job conf.
   * @param jobConf configuration
   */
  protected void applyCustomConfigOptions(JobConf jobConf) throws IOException {

  }

  /**
   * Override point for any committer specific validation operations;
   * called after the base assertions have all passed.
   * @param destPath destination of work
   * @param successData loaded success data
   * @throws Exception failure
   */
  protected void customPostExecutionValidation(Path destPath,
      SuccessData successData)
      throws Exception {

  }

  /**
   * Assume that scale tests are enabled.
   */
  protected void requireScaleTestsEnabled() {
    assume("Scale test disabled: to enable set property " +
            KEY_SCALE_TESTS_ENABLED,
        isScaleTest());
  }

  public boolean isScaleTest() {
    return scaleTest;
  }

  public boolean isUniqueFilenames() {
    return false;
  }
}


text:
package com.gikk.streamutil.gui.tabs;

import java.net.URL;
import java.util.List;
import java.util.ResourceBundle;

import com.gikk.streamutil.GikkBot;
import com.gikk.streamutil.task.OneTimeTask;
import com.gikk.streamutil.task.RepeatedTask;
import com.gikk.streamutil.twitchApi.SimpleChannelHandler;
import com.gikk.streamutil.twitchApi.SimpleChannelSubscriptionHandler;
import com.gikk.streamutil.twitchApi.SimpleStreamHandler;
import com.gikk.streamutil.twitchApi.TwitchApi;
import com.gikk.streamutil.users.ObservableUser;
import com.gikk.streamutil.users.UserStatus;
import com.mb3364.twitch.api.models.Channel;
import com.mb3364.twitch.api.models.ChannelSubscription;
import com.mb3364.twitch.api.models.Stream;
import com.mb3364.twitch.api.models.User;

import javafx.application.Platform;
import javafx.collections.ObservableList;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.PropertyValueFactory;

/**Probably the most monolithic class in the entire project.

 * This class handles the Stream settings and statistics. It displays the number of viewers we currently have,
 * number of followers and subs, latest follower and subs and more. It also allows the user to change the stream
 * title and game on Twitch.

 *
 *
 * @author Simon
 *
 */
public class StreamSettingsController extends _TabControllerBase{
	//*************************************************************************************************************
	//									VARIABLES
	//*************************************************************************************************************
	@FXML TextField txt_streamStatus;
	@FXML TextField txt_streamGame;
	@FXML Button btn_streamStatusApply;
	@FXML Label lbl_viewerCount; 	@FXML Label lbl_followerCount; 	@FXML Label lbl_subscriberCount;
	@FXML Label lbl_latestFollower; @FXML Label lbl_lastestSubscriber; @FXML Label lbl_alltimeViews;

	@FXML TableView<ObservableUser> Tbl_UsersOnline;
	private ObservableList<ObservableUser> usersOnline;
	private TwitchApi api;

	private String onlineStreamStatus = "DEFAULT_STRING_WILL_BE_REPLACED",
				   onlineStreamGame   = "DEFAULT_STRING_WILL_BE_REPLACED",
				   onlineSubCount     = "DEFAULT_STRING_WILL_BE_REPLACED",
				   onlineViewCount    = "DEFAULT_STRING_WILL_BE_REPLACED",
				   onlineAlltimeViewCount = "DEFAULT_STRING_WILL_BE_REPLACED";

	@Override
	public int getWeight() {
		return -1;
	};

	//*************************************************************************************************************
	//									INITIALIZER
	//*************************************************************************************************************
	@SuppressWarnings("unchecked")
	@Override
	public void initialize(URL location, ResourceBundle resources) {
		this.api = TwitchApi.GET();

		//Fetch the online list
		usersOnline = GikkBot.GET().getUsersOnlineList();

		//Setup the UsersOnline table
		Tbl_UsersOnline.getColumns().addAll( getColumns() );
		Tbl_UsersOnline.setItems(usersOnline);

		//Poll the API for stream details (viewer count and such)
		RepeatedTask pollApiService = new PollApiService(api, this);
		pollApiService.schedule(100, 60 * 1000 );	//Poll the api almost immediately, then 1 time per minute

		//Make sure that the latest follower is kept updated
		api.addOnNewFollowerListener( (follower, total, isNew) -> setFollowers(follower, total) );
		lbl_followerCount.setText( Integer.toString( api.getFollowerCount() ) );
		lbl_latestFollower.setText( api.getLatestFollower() );

		//Make the apply button fire on ENTER strokes too
		btn_streamStatusApply.defaultButtonProperty().bind(btn_streamStatusApply.focusedProperty());
	}

	//*************************************************************************************************************
	//									FXML METHODS
	//*************************************************************************************************************

	/**Pushes the current stream settings to Twitch. After the buttons been pushed, there is a delay until the button
	 * reactivates again, so that the user doesn't spam Twitch with requests.
	 *
	 * @param e Ignored
	 */
	@FXML protected void applyStreamStatus(ActionEvent e){
		btn_streamStatusApply.setDisable(true);
		api.setStatus( txt_streamStatus.getText(), txt_streamGame.getText() );

		OneTimeTask t = new OneTimeTask() {
			@Override
			public void onExecute() {
				Platform.runLater( () -> btn_streamStatusApply.setDisable(false) );
			}
		};
		t.schedule(5 * 1000);

		txt_streamStatus.requestFocus();
	}

	@FXML protected void titleFieldAction(ActionEvent e){
		txt_streamGame.requestFocus();
	}

	@FXML protected void gameFieldAction(ActionEvent e){
		btn_streamStatusApply.requestFocus();
	}

	/**************************************************************************************************
	 *
	 * These different set-methods are split up since they will receive answers from the API
	 * at different times, and sometimes only few of them will actually be invoked.
	 *
	 **************************************************************************************************/
	//**************************************************************************************************
	//									PRIVATE
	//**************************************************************************************************
	private void setStatuses(String status, String game, String viewerCount, String alltimeViewCount){
		//Status and Game can be null, in case the user hasn't set one for his/her stream
		if( status == null )
			status = "Connected! Try setting a status!";
		if( game == null )
			game = "Connected! Try setting a game!";

		final String newStatus = status;
		final String newGame   = game;
		Platform.runLater( () -> {
			if( !onlineStreamStatus.matches(newStatus) ){
				onlineStreamStatus = newStatus;
				txt_streamStatus.setText(newStatus);
			}
			if( !onlineStreamGame.matches(newGame) ){
				onlineStreamGame = newGame;
				txt_streamGame.setText(newGame);
			}
			if( !onlineAlltimeViewCount.matches(alltimeViewCount)){
				onlineAlltimeViewCount = alltimeViewCount;
				lbl_alltimeViews.setText(alltimeViewCount);
			}

		} );
	}

	private void setViewers(String viewers){
		if( !onlineViewCount.matches(viewers)){
			Platform.runLater( () ->{
				onlineViewCount = viewers;
				lbl_viewerCount.setText(viewers);
			} );
		}
	}

	private void setFollowers(String latestFollower, int newTotal){
		String newTotalString = Integer.toString(newTotal);
		Platform.runLater( () -> {
			lbl_followerCount.setText(newTotalString);
			lbl_latestFollower.setText(latestFollower);
		});
	}

	private void setSubscribers(String subCount, String latestSub){
		if( !onlineSubCount.matches(subCount) ){
			Platform.runLater( () -> {
				lbl_subscriberCount.setText(subCount);
				lbl_lastestSubscriber.setText(latestSub);

				onlineSubCount = subCount;
			});
		}
	}

	/**
	 * Creates table columns for displaying the currently online users
	 */
	@SuppressWarnings({ "rawtypes", "unchecked" })
	private TableColumn[] getColumns(){
		TableColumn[] cols = new TableColumn[7];

		cols[0] = new TableColumn<User, String>("UserName");
		cols[1] = new TableColumn<User, UserStatus>("Status");
		cols[2] = new TableColumn<User, Boolean>("Follower");
		cols[3]	= new TableColumn<User, Boolean>("Sub");
		cols[4] = new TableColumn<User, Boolean>("Trusted");
		cols[5] = new TableColumn<User, Integer>("Time");
		cols[6]	= new TableColumn<User, Integer>("Lines");

		cols[0].setCellValueFactory( new PropertyValueFactory<User, String>("userName") );
		cols[1].setCellValueFactory( new PropertyValueFactory<User, UserStatus>("status") );
		cols[2].setCellValueFactory( new PropertyValueFactory<User, Boolean>("follower") );
		cols[3].setCellValueFactory( new PropertyValueFactory<User, Boolean>("subscriber") );
		cols[4].setCellValueFactory( new PropertyValueFactory<User, Boolean>("trusted") );
		cols[5].setCellValueFactory( new PropertyValueFactory<User, Integer>("timeOnline") );
		cols[6].setCellValueFactory( new PropertyValueFactory<User, Integer>("linesWritten") );

        cols[0].setPrefWidth(200); cols[0].setEditable(false);
        cols[1].setPrefWidth(110); cols[1].setEditable(false); cols[1].getStyleClass().add( "center-align" );
		cols[2].setPrefWidth(60);  cols[2].setEditable(false); cols[2].getStyleClass().add( "center-align" );
		cols[3].setPrefWidth(60);  cols[3].setEditable(false); cols[3].getStyleClass().add( "center-align" );
		cols[4].setPrefWidth(60);  cols[4].setEditable(false); cols[4].getStyleClass().add( "center-align" );
		cols[5].setPrefWidth(60);  cols[5].setEditable(false); cols[5].getStyleClass().add( "center-align" );
		cols[6].setPrefWidth(60);  cols[6].setEditable(false); cols[6].getStyleClass().add( "center-align" );

		return cols;
	}

	//*************************************************************************************************************
	//									INNER CLASS : Poll API
	//*************************************************************************************************************
	private class PollApiService extends RepeatedTask{
		private final TwitchApi api;
		private final StreamSettingsController ssc;

		protected PollApiService(TwitchApi api, StreamSettingsController ssc) {
			this.api = api;
			this.ssc = ssc;
		}

		/**This method is called periodically. It polls the Twitch API to retrieve how many viewers we have, how many followers,
		 * which game we have on Twitch's side and so on.
		 *
		 * It also updates the list of our most recent followers and subscribers
		 */
		@Override
		public void onExecute() {
			api.getStreamInfo( new SimpleChannelHandler() {

				@Override
				public void onSuccess(Channel channel) {
					ssc.setStatuses(channel.getStatus(),
								    channel.getGame(),
								    "OFFLINE",
								    String.valueOf( channel.getViews() ) );

					if( channel.isPartner() )
						getSubs();
					else
						ssc.setSubscribers("0", "-");
				}
			} );

			api.getViewers( new SimpleStreamHandler() {

				@Override
				public void onSuccess(Stream stream) {
					String viewers = stream == null ? "OFFLINE" : String.valueOf( stream.getViewers() );
					ssc.setViewers(viewers);
				}
			});
		}

		private void getSubs(){
			api.getSubscribers( new SimpleChannelSubscriptionHandler() {
				@Override
				public void onSuccess(int total, List<ChannelSubscription> subscriptions) {
					String count = String.valueOf(total);
					String latest = total == 0 ? "-" : subscriptions.get(0).getUser().getDisplayName();

					ssc.setSubscribers(count, latest);
				}
			} );
		}
	}
}


text:
<?php

/* start the session */
session_start();

/* include the slidecaptcha class */
require_once __DIR__.'/SlideCaptcha.php';

/* set the unlock key */
if (SlideCaptcha::validate()) {
	die('SlideCaptcha Valid');
} else {
	die('SlideCaptcha Not Valid');
}

?>


text:
namespace silk
{
namespace stream
{

class IVoltage : public IScalar_Stream<Semantic::VOLTAGE>
{
public:
    typedef std::true_type can_be_filtered_t;

    typedef float                   Value; //volts
    typedef stream::Sample<Value>     Sample;
    virtual auto get_samples() const -> std::vector<Sample> const& = 0;
};

}
}


text:
About:

**Arch-Update-Notifier** is a program to automatically check for system updates for **Arch Linux**

Features:

* Autostart.

* Automatically checking updates.

* Notifications about new updates.

* Automatic updates Arch-Update-Notifier.

* The translations (Polish and English).

* Automatically install updates.

GUI Install:

Download this: https://raw.githubusercontent.com/DamiaX/AuN/master/Arch-Update-Notifier file.

Give permissions to run.
Run this file on terminal.

Terminal Install:

Step 1: Download (Method 1/2: Use wget to download a install script and give permissions to run)

wget https://raw.githubusercontent.com/DamiaX/AuN/master/Arch-Update-Notifier -O AuN;
chmod +x AuN

Step 1: Download (Method 2/2: Use curl to download a install script and give permissions to run)

curl https://raw.githubusercontent.com/DamiaX/AuN/master/Arch-Update-Notifier > AuN;
chmod +x AuN

Step 2: Run the AuN script.

./AuN

Uninstall Arch-Update-Notifier:

Method 1: Manually uninstalling the program files.

sudo rm -rf ~/.config/autostart/aun-run.desktop removing autostart applications.

sudo rm -rf /usr/local/sbin/arch-update* removing the application

sudo rm -rf /usr/local/sbin/aun-* removing the application

sudo rm -rf $HOME/.AuN_data removing configuration files.

Method 2: Starting automatic uninstaller

sudo arch-update -r

Advanced usage examples and notes:

-h or --help view the content of help.

-v or --version display the version of the program.

-u or --update check the available program updates.

-r or --remove remove application.

-c or --copy install program.

-ts or --time-setting change the search time settings for new updates.

-ai or --auto-install settings for automatic updates.

-a or --author display information about the author of the program.

Author:

Damian Majchrzak (https://www.facebook.com/DamiaX).


text:
import flask

app = flask.Flask(__name__)

@app.route("/")
def hello_world():
    return flask.render_template("index.html")

@app.route("/video")
def video_world():
    return flask.render_template("video.html")

@app.route("/videoGame")
def video_game():
    return flask.render_template("videoGame.html")

@app.route("/CarmelaGame")
def carmela_game():
    return flask.render_template("CarmelaGame.html")

if __name__ == '__main__':
    app.debug = True
    app.run()


text:
using namespace System::Collections::Generic;
namespace EntityInterface { class Switch; }

namespace GUILayer
{
    public ref class EntityLayer
    {
    public:
                //// //// ////   G O B   I N T E R F A C E   //// //// ////
        using DocumentTypeId = EntityInterface::DocumentTypeId;
        using ObjectTypeId = EntityInterface::ObjectTypeId;
        using DocumentId = EntityInterface::DocumentId;
        using ObjectId = EntityInterface::ObjectId;
        using ObjectTypeId = EntityInterface::ObjectTypeId;
        using PropertyId = EntityInterface::PropertyId;
        using ChildListId = EntityInterface::ChildListId;

        DocumentId CreateDocument(DocumentTypeId docType);
        bool DeleteDocument(DocumentId doc, DocumentTypeId docType);

        value struct PropertyInitializer
        {
            PropertyId _prop;
            const void* _src;
            unsigned _elementType;
            unsigned _arrayCount;
            bool _isString;

            PropertyInitializer(PropertyId prop, const void* src, unsigned elementType, unsigned arrayCount, bool isString)
                : _prop(prop), _src(src), _elementType(elementType), _arrayCount(arrayCount), _isString(isString) {}
        };

        ObjectId AssignObjectId(DocumentId doc, ObjectTypeId type);
        bool CreateObject(DocumentId doc, ObjectId obj, ObjectTypeId objType, IEnumerable<PropertyInitializer>^ initializers);
        bool DeleteObject(DocumentId doc, ObjectId obj, ObjectTypeId objType);
        bool SetProperty(DocumentId doc, ObjectId obj, ObjectTypeId objType, IEnumerable<PropertyInitializer>^ initializers);
        bool GetProperty(DocumentId doc, ObjectId obj, ObjectTypeId objType, PropertyId prop, void* dest, unsigned* destSize);

        bool SetObjectParent(DocumentId doc,
            ObjectId childId, ObjectTypeId childTypeId,
            ObjectId parentId, ObjectTypeId parentTypeId, int insertionPosition);

        ObjectTypeId GetTypeId(System::String^ name);
        DocumentTypeId GetDocumentTypeId(System::String^ name);
        PropertyId GetPropertyId(ObjectTypeId type, System::String^ name);
        ChildListId GetChildListId(ObjectTypeId type, System::String^ name);

        EntityInterface::Switch& GetSwitch();

        EntityLayer(std::shared_ptr<EntityInterface::Switch> swtch);
        ~EntityLayer();
    protected:
        clix::shared_ptr<EntityInterface::Switch> _switch;
    };

}


text:
package uk.gov.hmrc.ct.computations

import uk.gov.hmrc.ct.box.{Calculated, CtBoxIdentifier, CtInteger}
import uk.gov.hmrc.ct.computations.calculations.QualifyingExpenditureOnMachineryCalculation
import uk.gov.hmrc.ct.computations.retriever.ComputationsBoxRetriever

case class CP253(value: Int) extends CtBoxIdentifier(name = "Qualifying expenditure on machinery and plant on other assets") with CtInteger

object CP253 extends Calculated[CP253, ComputationsBoxRetriever] with QualifyingExpenditureOnMachineryCalculation {

  override def calculate(fieldValueRetriever: ComputationsBoxRetriever): CP253 = {
    qualifyingExpenditureCalculation(fieldValueRetriever.retrieveCP82(),
                                     fieldValueRetriever.retrieveCP83())
  }

}