text:
void print(struct Value a){
    if(a.type == TYPE_STRING){
        struct String str = value_as_string(&a);
        printf("\"%s\"", string_to_chars(&str));
    }
    else if(a.type == TYPE_KEYWORD){
        struct String kwd = value_as_keyword(&a);
        printf("%s", string_to_chars(&kwd));
    }
    else if(a.type == TYPE_LONG) {
        printf("%" PRIhi, value_as_long(&a));
    }
    else if(a.type == TYPE_FLOAT) {
        printf("%f", value_as_float(&a));
    }
    else if(a.type == TYPE_BOOL) {
        if (value_as_bool(&a)){
            printf("True");
        }
        else{
            printf("False");
        }
    }
    else if(a.type == TYPE_ARRAY) {
        printf("[ ");
        struct Value_array *arr = value_as_array(&a);
        for(size_t i = 0; i < arr->size; i++){
            print(*arr->values[i]);
            if(i < arr->size-1){
              printf(", ");
            }
        }
        printf(" ]");
    }
    else if(a.type == TYPE_UNDEF) {
        printf("undefined");
    }
}

struct Value add(struct Value a, struct Value b){
    if(a.type == TYPE_LONG && b.type == TYPE_LONG){
        return value_from_long(value_as_long(&a) + value_as_long(&b));
    }
    else if(a.type == TYPE_FLOAT && b.type == TYPE_FLOAT){
        return value_from_float(value_as_float(&a) + value_as_float(&b));
    }
    else if(a.type == TYPE_FLOAT && b.type == TYPE_LONG){
        return value_from_float(value_as_float(&a) + (float)value_as_long(&b));
    }
    else if(a.type == TYPE_LONG && b.type == TYPE_FLOAT){
        return value_from_float((float)value_as_long(&a) + value_as_float(&b));
    }
    else {
        ERROR("Mismatched types for add: %d != %d", a.type, b.type);
    }
}

struct Value mul(struct Value a, struct Value b){
    if(a.type == TYPE_LONG && b.type == TYPE_LONG){
        return value_from_long(value_as_long(&a) * value_as_long(&b));
    }
    else if(a.type == TYPE_FLOAT && b.type == TYPE_FLOAT){
        return value_from_float(value_as_float(&a) * value_as_float(&b));
    }
    else if(a.type == TYPE_FLOAT && b.type == TYPE_LONG){
        return value_from_float(value_as_float(&a) * (float)value_as_long(&b));
    }
    else if(a.type == TYPE_LONG && b.type == TYPE_FLOAT){
        return value_from_float((float)value_as_long(&a) * value_as_float(&b));
    }
    else {
        ERROR("Mismatched types for add: %d != %d", a.type, b.type);
    }
}

struct Value sub(struct Value a, struct Value b){
    if(a.type == TYPE_LONG && b.type == TYPE_LONG){
        return value_from_long(value_as_long(&a) - value_as_long(&b));
    }
    else if(a.type == TYPE_FLOAT && b.type == TYPE_FLOAT){
        return value_from_float(value_as_float(&a) - value_as_float(&b));
    }
    else if(a.type == TYPE_FLOAT && b.type == TYPE_LONG){
        return value_from_float(value_as_float(&a) - (float)value_as_long(&b));
    }
    else if(a.type == TYPE_LONG && b.type == TYPE_FLOAT){
        return value_from_float((float)value_as_long(&a) - value_as_float(&b));
    }
    else {
        ERROR("Mismatched types for sub: %d != %d", a.type, b.type);
    }
}

struct Value divide(struct Value a, struct Value b) {
    if(a.type == TYPE_LONG && b.type == TYPE_LONG){
        long bl = value_as_long(&b);
        if (bl == 0) {
            ERROR("Division by 0");
        }
        return long_divide(value_as_long(&a), bl);
    }
    else if(a.type == TYPE_FLOAT && b.type == TYPE_FLOAT){
        long bf = value_as_float(&b);
        if (bf == 0) {
            ERROR("Division by 0");
        }
        return value_from_float(value_as_float(&a) / bf);
    }
    else if(a.type == TYPE_FLOAT && b.type == TYPE_LONG){
        long bl = value_as_long(&b);
        if (bl == 0) {
            ERROR("Division by 0");
        }
        return value_from_float(value_as_float(&a) / (float) bl);
    }
    else if(a.type == TYPE_LONG && b.type == TYPE_FLOAT){
        long bf = value_as_float(&b);
        if (bf == 0) {
            ERROR("Division by 0");
        }
        return value_from_float((float) value_as_long(&a) / bf);
    }
    else {
        ERROR("Mismatched types for divide: %d != %d", a.type, b.type);
    }
}

struct Value long_divide(huo_int_t a, huo_int_t b) {
    if (a % b == 0) {
        return value_from_long(a / b);
    } else {
        return value_from_float((float) a /  (float) b);
    }
}

struct Value concat(struct Value a, struct Value b){
    if (a.type == TYPE_STRING && b.type == TYPE_STRING) {
        return string_concat(value_as_string(&a), value_as_string(&b));
    } else if (a.type == TYPE_ARRAY && b.type == TYPE_ARRAY) {
        return array_concat(value_as_array(&a), value_as_array(&b));
    } else {
        ERROR("Tried to concat %c and %c", a.type, b.type);
    }
}

struct Value array_concat(struct Value_array *a, struct Value_array *b) {
    return value_from_array(array_concat_heap(a, b));
}
struct Value string_concat(struct String a, struct String b) {
    return value_from_string(string_concat_stack(&a, &b));
}

struct Value not(struct Value a, struct Value b){
    if(a.type == TYPE_BOOL && b.type == TYPE_BOOL){
        return value_from_bool(value_as_bool(&a) != value_as_bool(&b));
    }
    else if(a.type == TYPE_FLOAT && b.type == TYPE_FLOAT){
        return value_from_bool(value_as_float(&a) != value_as_float(&b));
    }
    else if(a.type == TYPE_LONG && b.type == TYPE_LONG){
        return value_from_bool(value_as_long(&a) != value_as_long(&b));
    }
    else if(a.type == TYPE_STRING && b.type == TYPE_STRING){
        return value_from_bool(!string_matches_stack(value_as_string(&a), value_as_string(&b)));
    }
    else if(a.type == TYPE_ARRAY && b.type == TYPE_ARRAY){
        return value_from_bool(!array_matches(value_as_array(&a), value_as_array(&b)));
    }
    else {
        ERROR("Mismatched types: %d != %d", a.type, b.type);
    }
}

struct Value and(struct Value a, struct Value b){
    if(a.type == TYPE_BOOL && b.type == TYPE_BOOL){
        return value_from_bool(value_as_bool(&a) && value_as_bool(&b));
    } else {
        ERROR("& operator only takes boolean values: %d | %d != 1", a.type, b.type);
    }
}

struct Value or(struct Value a, struct Value b){
    if(a.type == TYPE_BOOL && b.type == TYPE_BOOL){
        return value_from_bool(value_as_bool(&a) || value_as_bool(&b));
    } else {
        ERROR("| operator only takes boolean values: %d | %d != 1", a.type, b.type);
    }
}

struct Value equals(struct Value a, struct Value b){
    if(a.type == TYPE_BOOL && b.type == TYPE_BOOL){
        return value_from_bool(value_as_bool(&a) == value_as_bool(&b));
    }
    else if(a.type == TYPE_FLOAT && b.type == TYPE_FLOAT){
        return value_from_bool(value_as_float(&a) == value_as_float(&b));
    }
    else if(a.type == TYPE_LONG && b.type == TYPE_LONG){
        return value_from_bool(value_as_long(&a) == value_as_long(&b));
    }
    else if(a.type == TYPE_STRING && b.type == TYPE_STRING){
        return value_from_bool(string_matches_stack(value_as_string(&a), value_as_string(&b)));
    }
    else if(a.type == TYPE_ARRAY && b.type == TYPE_ARRAY){
        return value_from_bool(array_matches(value_as_array(&a), value_as_array(&b)));
    }
    else if(a.type == TYPE_FLOAT && b.type == TYPE_LONG){
        return value_from_bool(value_as_float(&a) == (float)value_as_long(&b));
    }
    else if(a.type == TYPE_LONG && b.type == TYPE_FLOAT){
        return value_from_bool((float)value_as_long(&a) == value_as_float(&b));
    }
    else {
        ERROR("Mismatched types: %d != %d", a.type, b.type);
    }
}

struct Value greater_than(struct Value a, struct Value b){
    if(a.type == TYPE_BOOL && b.type == TYPE_BOOL){
        return value_from_bool(value_as_bool(&a) > value_as_bool(&b));
    }
    else if(a.type == TYPE_FLOAT && b.type == TYPE_FLOAT){
        return value_from_bool(value_as_float(&a) > value_as_float(&b));
    }
    else if(a.type == TYPE_LONG && b.type == TYPE_LONG){
        return value_from_bool(value_as_long(&a) > value_as_long(&b));
    }
    else {
        ERROR("Mismatched types: %d != %d", a.type, b.type);
    }
}

bool can_cast_to_size_t(huo_int_t i) {
    return i >= 0 && (huo_uint_t) i <= SIZE_MAX;
}

struct Value set(struct Value index_val, struct Value item, struct Value *to_set) {
    huo_int_t index = value_as_long(&index_val);
    if (!can_cast_to_size_t(index)) {
		unsigned long long size_max = SIZE_MAX;
        ERROR("Index out of range for set: should be 0 <= %" PRIhi " < %llu", index, size_max);
    }
    if (to_set->type == TYPE_ARRAY) {
        return value_from_array(array_set((size_t) index, item, value_as_array(to_set)));
    } else if (to_set->type == TYPE_STRING) {
        struct String set = string_set((size_t) index, value_as_string(&item), value_as_string(to_set));
        return value_from_string(string_copy_stack(&set));
    } else {
        ERROR("Set type invalid:  ('%c' != [TYPE_ARRAY, TYPE_STRING])", to_set->type);
    }
}

struct Value_array *array_set(size_t index, struct Value item, struct Value_array *array) {

    // Have to copy before incrementing size or else
    // recursive copies segfault
    struct Value *val = value_copy_heap(&item);

    if (index >= array->size) {
        RESIZE(array->values, index + 1);
        struct Value undef = {.type=TYPE_UNDEF};
        for (size_t i = array->size; i < index; i++) {
            array->values[i] = value_copy_heap(&undef);
        }
        array->size = index + 1;
    }
    array->values[index] = val;
    return array;
}

struct String string_set(size_t index, struct String item, struct String string){
    char c = string_index(&item, 0);
    if (index == string_length(&string)) {
        struct String char_str = string_from_char(c);
        string_concat_to(&string, &char_str);
    } else if (index < string_length(&string)) {
        string.body[index] = c;
    } else {
        ERROR("Invalid index: %zu > %zu", index, string_length(&string));
    }
    return string;
}

struct Value push(struct Value what, struct Value where) {
    if (where.type == TYPE_ARRAY) {
        return value_from_array(array_push(what, value_as_array(&where)));
    } else if (where.type == TYPE_STRING) {
        return value_from_string(string_push(value_as_string(&what), value_as_string(&where)));
    } else {
        ERROR("Push type invalid:  ('%c' != [TYPE_ARRAY, TYPE_STRING])", where.type);
    }
}

struct Value_array *array_push(struct Value a, struct Value_array *array){
    RESIZE(array->values, array->size + 1);
    array->values[array->size] = value_copy_heap(&a);
    array->size++;
    return array;
}

struct String string_push(struct String a, struct String str){
    if (string_length(&a) != 1) {
        ERROR("Character does not have length 1");
    }
    return string_concat_stack(&str, &a);
}

struct Value substring(struct Value start, struct Value end, struct Value what) {
    huo_int_t start_i = value_as_long(&start);
    huo_int_t end_i = value_as_long(&end);
    if (start_i < 0 || (huo_uint_t) start_i >= length(what)) {
        ERROR("Start index out of range for substring: should be 0 <= %" PRIhi " < %zu", start_i, length(what));
    }
    if (end_i < 0 || (huo_uint_t) end_i >= length(what)) {
        ERROR("End index out of range for substring: should be 0 <= %" PRIhi " < %zu", end_i, length(what));
    }

    return substring_ll((size_t) start_i, (size_t) end_i, what);
}

struct Value substring_ll(size_t start_i, size_t end_i, struct Value what) {
    //if (what.type == TYPE_ARRAY) {
    //    return value_from_array(array_slice(start_i, end_i, value_as_array(&what)));
    //} else
    if (what.type == TYPE_STRING) {
        return value_from_string(string_substring(start_i, end_i, value_as_string(&what)));
    } else {
        ERROR("Substring type invalid:  ('%c' != [TYPE_ARRAY, TYPE_STRING])", what.type);
    }
}

struct String string_substring(size_t start, size_t end, struct String str){
    assert(string_is_sane(&str));
    if (end > start) {
        struct String result = {
            .length = (end - start),
            .body = ARR_MALLOC(string_length(&str) + 1, char)
        };
        for(size_t i = 0; i < result.length; i++){
            result.body[i] = str.body[i + start];
        }
        result.body[result.length] = 0;
        assert(string_is_sane(&result));
        return result;
    } else {
        return string_from_chars(NULL);
    }
}

struct Value split(struct Value sep, struct Value what) {
    return string_split(value_as_string(&sep), value_as_string(&what));
}

struct Value string_split(struct String sep, struct String what) {

    assert(string_is_sane(&sep));
    assert(string_is_sane(&what));

    size_t c = 0;
    for(size_t i = 0; i < what.length; i++){
        if(sep.length == 0 || sep.body[0] == what.body[i]){
            c += 1;
        }
    }

    if (c == SIZE_MAX) {
        ERROR("Cannot split string into more than size_t pieces");
    }

    size_t *indexes = NULL;
    RESIZE(indexes, c);
    size_t d = 0;
    for(size_t i = 0; i < what.length; i++){
        if(sep.length == 0 || sep.body[0] == what.body[i]){
            indexes[d++] = i;
        }
    }
    assert (c == d);
    struct Value_array * array = malloc_or_die(sizeof(struct Value_array));
    array->values = NULL;
    RESIZE(array->values, c + 1);
    array->size = 0;
    for(size_t l = 0; l <= c; l++){
        size_t start = !l ? l : indexes[l-1] + 1;
        size_t end = (l < c) ? indexes[l] : what.length;

        struct Value item = value_from_string(string_substring(start, end, what));

        array->values[array->size] = value_copy_heap(&item);
        array->size++;
    }
    return value_from_array(array);
}

struct Value value_index(struct Value index, struct Value list) {
    huo_int_t i = value_as_long(&index);
    if(list.type == TYPE_ARRAY){
        struct Value_array *a = value_as_array(&list);
        if (i < 0) {
            ERROR("Negative index: %" PRIhi, i);
        }
        size_t len = a->size;
        if ((huo_uint_t) i >= len) {
            ERROR("Invalid index: %" PRIhi " (len %zu)", i, len);
        }
        return *a->values[i];
    }
    else if(list.type == TYPE_STRING){
        struct String s = value_as_string(&list);
        struct String indexed_char = string_from_char(string_index(&s, i));
        return value_from_string(string_copy_stack(&indexed_char));
    } else {
        ERROR("Index takes a string or array, but got '%c' != [TYPE_ARRAY|TYPE_STRING]).", list.type);
    }
}


text:
package fr.imie;

public interface ISerialiser {

	public abstract void persist(Jeux jeux);

	public abstract Jeux read();

}

redpajama_set_name: RedPajamaGithub


text:
package org.springframework.social.linkedin.api;

import java.io.Serializable;

/**
 * Model object to represent a Share
 *
 * @author Robert Drysdale
 */
public class NewShare implements Serializable {

	private static final long serialVersionUID = 1L;

	private String comment;

	private NewShareContent content;

	private NewShareVisibility visibility;

	public NewShare() {}

	public NewShare(String comment, NewShareContent content, NewShareVisibility visibility) {
		this.comment = comment;
		this.content = content;
		this.visibility = visibility;
	}

	public String getComment() {
		return comment;
	}

	public void setComment(String comment) {
		this.comment = comment;
	}

	public NewShareContent getContent() {
		return content;
	}

	public void setContent(NewShareContent content) {
		this.content = content;
	}

	public NewShareVisibility getVisibility() {
		return visibility;
	}

	public void setVisibility(NewShareVisibility visibility) {
		this.visibility = visibility;
	}

	public static class NewShareContent implements Serializable {
		private static final long serialVersionUID = 1L;

		private String title;
		private String submittedUrl;
		private String submittedImageUrl;
		private String description;

		public NewShareContent() {}

		public NewShareContent(String title, String submittedUrl) {
			this.title = title;
			this.submittedUrl = submittedUrl;
		}

		public NewShareContent(String title, String submittedUrl, String description) {
			this(title,submittedUrl);
			this.description = description;
		}

		public NewShareContent(String title, String submittedUrl, String submittedImageUrl, String description) {
			this(title,submittedUrl,description);
			this.submittedImageUrl = submittedImageUrl;
		}

		public String getTitle() {
			return title;
		}

		public void setTitle(String title) {
			this.title = title;
		}

		public String getSubmittedUrl() {
			return submittedUrl;
		}

		public void setSubmittedUrl(String submittedUrl) {
			this.submittedUrl = submittedUrl;
		}

		public String getSubmittedImageUrl(String submittedImageUrl) {
			return this.submittedImageUrl;
		}

		public void setSubmittedImageUrl(String submittedImageUrl) {
			this.submittedImageUrl = submittedImageUrl;
		}

		public String getDescription() {
			return description;
		}
	}

	public static class NewShareVisibility implements Serializable {
		private static final long serialVersionUID = 1L;

		private NewShareVisibilityCode code;

		public NewShareVisibility() {}

		public NewShareVisibility(NewShareVisibilityCode code) {
			this.code = code;
		}

		public NewShareVisibilityCode getCode() {
			return code;
		}

		public void setCode(NewShareVisibilityCode code) {
			this.code = code;
		}
	}

	public static enum NewShareVisibilityCode {
		ANYONE,
		CONNECTIONS_ONLY;

		public String toString() {
			return this.name().toLowerCase().replace('_', '-');
		}
	}

}


text:
<?php

namespace SteamCondenser\Servers;

abstract class TestableGameServer extends GameServer {

    public $challengeNumber;

    public $infoHash;

    public $ping;

    public $playerHash;

    public $rconAuthenticated;

    public $rulesHash;

    public $socket;

    public function getReply() {
        return parent::getReply();
    }

    public function handleResponseForRequest($request, $repeatOnFailure = true) {
        parent::handleResponseForRequest($request, $repeatOnFailure);
    }

    public function sendRequest(Packets\SteamPacket $packet) {
        parent::sendRequest($packet);
    }

}

class GameServerTest extends \PHPUnit_Framework_TestCase {

    public function setUp() {
        $this->serverBuilder = $this->getMockBuilder('\SteamCondenser\Servers\TestableGameServer');
        $this->serverBuilder->disableOriginalConstructor();
    }

    public function testGetReply() {
        $packet = $this->getMockForAbstractClass('\SteamCondenser\Servers\Packets\SteamPacket', ['']);

        $socket = $this->getMockBuilder('\SteamCondenser\Servers\Sockets\SteamSocket')->disableOriginalConstructor()->setMethods(['getReply'])->getMock();
        $socket->expects($this->once())->method('getReply')->will($this->returnValue($packet));
        $server = $this->getMockForAbstractClass('\SteamCondenser\Servers\TestableGameServer', ['127.0.0.1']);
        $server->socket = $socket;

        $this->assertEquals($packet, $server->getReply());
    }

    public function testSendRequest() {
        $packet = $this->getMockForAbstractClass('\SteamCondenser\Servers\Packets\SteamPacket', ['']);

        $socket = $this->getMockBuilder('\SteamCondenser\Servers\Sockets\SteamSocket')->disableOriginalConstructor()->setMethods(['getReply', 'send'])->getMock();
        $socket->expects($this->once())->method('send')->with($packet);
        $server = $this->getMockForAbstractClass('\SteamCondenser\Servers\TestableGameServer', ['127.0.0.1']);
        $server->socket = $socket;

        $server->sendRequest($packet);
    }

    public function testUpdatePing() {
        $server = $this->serverBuilder->setMethods(['getReply', 'initSocket', 'rconAuth', 'rconExec', 'sendRequest'])->getMock();
        $server->expects($this->once())->method('sendRequest')->with($this->isInstanceOf('\SteamCondenser\Servers\Packets\A2SINFOPacket'));
        $server->expects($this->once())->method('getReply')->will($this->returnCallback(function() { usleep(50000); }));

        $server->updatePing();
        $this->assertAttributeGreaterThanOrEqual(50, 'ping', $server);
    }

    public function testUpdateChallengeNumber() {
        $server = $this->serverBuilder->setMethods(['handleResponseForRequest', 'initSocket', 'rconAuth', 'rconExec'])->getMock();
        $server->expects($this->once())->method('handleResponseForRequest')->with($this->equalTo(GameServer::REQUEST_CHALLENGE));

        $server->updateChallengeNumber();
    }

    public function testUpdateServerInfo() {
        $server = $this->serverBuilder->setMethods(['handleResponseForRequest', 'initSocket', 'rconAuth', 'rconExec'])->getMock();
        $server->expects($this->once())->method('handleResponseForRequest')->with($this->equalTo(GameServer::REQUEST_INFO));

        $server->updateServerInfo();
    }

    public function testUpdatePlayers() {
        $server = $this->serverBuilder->setMethods(['handleResponseForRequest', 'initSocket', 'rconAuth', 'rconExec'])->getMock();
        $server->expects($this->once())->method('handleResponseForRequest')->with($this->equalTo(GameServer::REQUEST_PLAYER));

        $server->updatePlayers();
    }

    public function testUpdateRules() {
        $server = $this->serverBuilder->setMethods(['handleResponseForRequest', 'initSocket', 'rconAuth', 'rconExec'])->getMock();
        $server->expects($this->once())->method('handleResponseForRequest')->with($this->equalTo(GameServer::REQUEST_RULES));

        $server->updateRules();
    }

    public function testInitialize() {
        $server = $this->serverBuilder->setMethods(['initSocket', 'rconAuth', 'rconExec', 'updateChallengeNumber', 'updatePing', 'updateServerInfo'])->getMock();
        $server->expects($this->once())->method('updateChallengeNumber');
        $server->expects($this->once())->method('updatePing');
        $server->expects($this->once())->method('updateServerInfo');

        $server->initialize();
    }

    public function testIsRconAuthenticated() {
        $server = $this->serverBuilder->setMethods(['initSocket', 'rconAuth', 'rconExec'])->getMock();

        $this->assertEquals($this->readAttribute($server, 'rconAuthenticated'), $server->isRconAuthenticated());
    }

    public function testCachePing() {
        $server = $this->serverBuilder->setMethods(['initSocket', 'rconAuth', 'rconExec', 'updatePing'])->getMock();
        $server->expects($this->once())->method('updatePing');

        $server->getPing();
        $server->ping = 1;
        $server->getPing();
    }

    public function testCachePlayers() {
        $server = $this->serverBuilder->setMethods(['initSocket', 'rconAuth', 'rconExec', 'updatePlayers'])->getMock();
        $server->expects($this->once())->method('updatePlayers');

        $server->getPlayers();
        $server->playerHash = 1;
        $server->getPlayers();
    }

    public function testCacheRules() {
        $server = $this->serverBuilder->setMethods(['initSocket', 'rconAuth', 'rconExec', 'updateRules'])->getMock();
        $server->expects($this->once())->method('updateRules');

        $server->getRules();
        $server->rulesHash = 1;
        $server->getRules();
    }

    public function testCacheServerInfo() {
        $server = $this->serverBuilder->setMethods(['initSocket', 'rconAuth', 'rconExec', 'updateServerInfo'])->getMock();
        $server->expects($this->once())->method('updateServerInfo');

        $server->getServerInfo();
        $server->infoHash = 1;
        $server->getServerInfo();
    }

    public function testGetPlayerInfoFromSourceWithPassword() {
        $status = getFixture('status_source');
        $server = $this->serverBuilder->setMethods(['handleResponseForRequest', 'initSocket', 'rconAuth', 'rconExec'])->getMock();
        $someone = $this->getMock('stdClass', ['addInformation']);
        $somebody = $this->getMock('stdClass', ['addInformation']);

        $playerHash = ['someone' => $someone, 'somebody' => $somebody];
        $server->playerHash = $playerHash;

        $server->expects($this->once())->method('handleResponseForRequest')->with($this->equalTo(GameServer::REQUEST_PLAYER));
        $server->expects($this->once())->method('rconExec')->with($this->equalTo('status'))->will($this->returnValue($status));

        $someoneData = ['name' => 'someone', 'userid' => '1', 'uniqueid' => 'STEAM_0:0:123456', 'score' => '10', 'time' => '3:52', 'ping' => '12', 'loss' => '0', 'state' => 'active'];
        $somebodyData = ['name' => 'somebody', 'userid' => '2', 'uniqueid' => 'STEAM_0:0:123457', 'score' => '3', 'time' => '2:42', 'ping' => '34', 'loss' => '0', 'state' => 'active'];

        $somebody->expects($this->once())->method('addInformation')->with($this->equalTo($somebodyData));
        $someone->expects($this->once())->method('addInformation')->with($this->equalTo($someoneData));

        $server->expects($this->once())->method('rconAuth')->with($this->equalTo('password'));

        $server->updatePlayers('password');
    }

    public function testGetPlayerInfoFromSourceAuthenticated() {
        $status = getFixture('status_source');
        $server = $this->serverBuilder->setMethods(['handleResponseForRequest', 'initSocket', 'rconAuth', 'rconExec'])->getMock();
        $someone = $this->getMock('stdClass', ['addInformation']);
        $somebody = $this->getMock('stdClass', ['addInformation']);

        $playerHash = ['someone' => $someone, 'somebody' => $somebody];
        $server->playerHash = $playerHash;

        $server->expects($this->once())->method('handleResponseForRequest')->with($this->equalTo(GameServer::REQUEST_PLAYER));
        $server->expects($this->once())->method('rconExec')->with($this->equalTo('status'))->will($this->returnValue($status));

        $someoneData = ['name' => 'someone', 'userid' => '1', 'uniqueid' => 'STEAM_0:0:123456', 'score' => '10', 'time' => '3:52', 'ping' => '12', 'loss' => '0', 'state' => 'active'];
        $somebodyData = ['name' => 'somebody', 'userid' => '2', 'uniqueid' => 'STEAM_0:0:123457', 'score' => '3', 'time' => '2:42', 'ping' => '34', 'loss' => '0', 'state' => 'active'];

        $somebody->expects($this->once())->method('addInformation')->with($this->equalTo($somebodyData));
        $someone->expects($this->once())->method('addInformation')->with($this->equalTo($someoneData));

        $server->rconAuthenticated = true;
        $server->updatePlayers();
    }

    public function testGetPlayerInfoFromGoldSrcWithPassword() {
        $status = getFixture('status_goldsrc');
        $server = $this->serverBuilder->setMethods(['handleResponseForRequest', 'initSocket', 'rconAuth', 'rconExec'])->getMock();
        $someone = $this->getMock('stdClass', ['addInformation']);
        $somebody = $this->getMock('stdClass', ['addInformation']);

        $playerHash = ['someone' => $someone, 'somebody' => $somebody];
        $server->playerHash = $playerHash;

        $server->expects($this->once())->method('handleResponseForRequest')->with($this->equalTo(GameServer::REQUEST_PLAYER));
        $server->expects($this->once())->method('rconExec')->with($this->equalTo('status'))->will($this->returnValue($status));

        $someoneData = ['name' => 'someone', 'userid' => '1', 'uniqueid' => 'STEAM_0:0:123456', 'score' => '10', 'time' => '3:52', 'ping' => '12', 'loss' => '0', 'adr' => '0'];
        $somebodyData = ['name' => 'somebody', 'userid' => '2', 'uniqueid' => 'STEAM_0:0:123457', 'score' => '3', 'time' => '2:42', 'ping' => '34', 'loss' => '0', 'adr' => '0'];

        $somebody->expects($this->once())->method('addInformation')->with($this->equalTo($somebodyData));
        $someone->expects($this->once())->method('addInformation')->with($this->equalTo($someoneData));

        $server->expects($this->once())->method('rconAuth')->with($this->equalTo('password'));

        $server->updatePlayers('password');
    }

    public function testGetPlayerInfoFromGoldSrcAuthenticated() {
        $status = getFixture('status_goldsrc');
        $server = $this->serverBuilder->setMethods(['handleResponseForRequest', 'initSocket', 'rconAuth', 'rconExec'])->getMock();
        $someone = $this->getMock('stdClass', ['addInformation']);
        $somebody = $this->getMock('stdClass', ['addInformation']);

        $playerHash = ['someone' => $someone, 'somebody' => $somebody];
        $server->playerHash = $playerHash;

        $server->expects($this->once())->method('handleResponseForRequest')->with($this->equalTo(GameServer::REQUEST_PLAYER));
        $server->expects($this->once())->method('rconExec')->with($this->equalTo('status'))->will($this->returnValue($status));

        $someoneData = ['name' => 'someone', 'userid' => '1', 'uniqueid' => 'STEAM_0:0:123456', 'score' => '10', 'time' => '3:52', 'ping' => '12', 'loss' => '0', 'adr' => '0'];
        $somebodyData = ['name' => 'somebody', 'userid' => '2', 'uniqueid' => 'STEAM_0:0:123457', 'score' => '3', 'time' => '2:42', 'ping' => '34', 'loss' => '0', 'adr' => '0'];

        $somebody->expects($this->once())->method('addInformation')->with($this->equalTo($somebodyData));
        $someone->expects($this->once())->method('addInformation')->with($this->equalTo($someoneData));

        $server->rconAuthenticated = true;
        $server->updatePlayers();
    }

    public function testHandleChallengeRequest() {
        $server = $this->serverBuilder->setMethods(['initSocket', 'getReply', 'rconAuth', 'rconExec', 'sendRequest'])->getMock();
        $server->expects($this->once())->method('sendRequest')->with($this->isInstanceOf('\SteamCondenser\Servers\Packets\A2SPLAYERPacket'));

        $packet = $this->getMockBuilder('\SteamCondenser\Servers\Packets\S2CCHALLENGEPacket')->disableOriginalConstructor()->setMethods(['getChallengeNumber'])->getMock();
        $packet->expects($this->once())->method('getChallengeNumber')->will($this->returnValue(1234));
        $server->expects($this->once())->method('getReply')->will($this->returnValue($packet));

        $server->handleResponseForRequest(GameServer::REQUEST_CHALLENGE);

        $this->assertEquals(1234, $server->challengeNumber);
    }

    public function testHandleInfoRequest() {
        $server = $this->serverBuilder->setMethods(['initSocket', 'getReply', 'rconAuth', 'rconExec', 'sendRequest'])->getMock();
        $server->expects($this->once())->method('sendRequest')->with($this->isInstanceOf('\SteamCondenser\Servers\Packets\A2SINFOPacket'));

        $packet = $this->getMockBuilder('\SteamCondenser\Servers\Packets\S2AINFOBasePacket')->disableOriginalConstructor()->setMethods(['getInfo'])->getMock();
        $packet->expects($this->once())->method('getInfo')->will($this->returnValue(['test' => 'test']));
        $server->expects($this->once())->method('getReply')->will($this->returnValue($packet));

        $server->handleResponseForRequest(GameServer::REQUEST_INFO);

        $this->assertEquals(['test' => 'test'], $server->infoHash);
    }

    public function testHandlePlayersRequest() {
        $server = $this->serverBuilder->setMethods(['initSocket', 'getReply', 'rconAuth', 'rconExec', 'sendRequest'])->getMock();
        $server->expects($this->once())->method('sendRequest')->with($this->isInstanceOf('\SteamCondenser\Servers\Packets\A2SPLAYERPacket'));

        $packet = $this->getMockBuilder('\SteamCondenser\Servers\Packets\S2APLAYERPacket')->disableOriginalConstructor()->setMethods(['getPlayerHash'])->getMock();
        $packet->expects($this->once())->method('getPlayerHash')->will($this->returnValue(['test' => 'test']));
        $server->expects($this->once())->method('getReply')->will($this->returnValue($packet));

        $server->handleResponseForRequest(GameServer::REQUEST_PLAYER);

        $this->assertEquals(['test' => 'test'], $server->playerHash);
    }

    public function testHandleRulesRequest() {
        $server = $this->serverBuilder->setMethods(['initSocket', 'getReply', 'rconAuth', 'rconExec', 'sendRequest'])->getMock();
        $server->expects($this->once())->method('sendRequest')->with($this->isInstanceOf('\SteamCondenser\Servers\Packets\A2SRULESPacket'));

        $packet = $this->getMockBuilder('\SteamCondenser\Servers\Packets\S2ARULESPacket')->disableOriginalConstructor()->setMethods(['getRulesArray'])->getMock();
        $packet->expects($this->once())->method('getRulesArray')->will($this->returnValue(['test' => 'test']));
        $server->expects($this->once())->method('getReply')->will($this->returnValue($packet));

        $server->handleResponseForRequest(GameServer::REQUEST_RULES);

        $this->assertEquals(['test' => 'test'], $server->rulesHash);
    }

    public function testHandleUnexpectedResponse() {
        $server = $this->serverBuilder->setMethods(['initSocket', 'getReply', 'rconAuth', 'rconExec', 'sendRequest'])->getMock();
        $server->setLogger(\SteamCondenser\getLogger(get_class($server)));
        $server->expects($this->exactly(2))->method('sendRequest')->with($this->isInstanceOf('\SteamCondenser\Servers\Packets\A2SPLAYERPacket'));

        $packet1 = $this->getMockBuilder('\SteamCondenser\Servers\Packets\S2CCHALLENGEPacket')->disableOriginalConstructor()->setMethods(['getChallengeNumber'])->getMock();
        $packet1->expects($this->once())->method('getChallengeNumber')->will($this->returnValue(1234));
        $server->expects($this->at(1))->method('getReply')->will($this->returnValue($packet1));
        $packet2 = $this->getMockBuilder('\SteamCondenser\Servers\Packets\S2APLAYERPacket')->disableOriginalConstructor()->setMethods(['getPlayerHash'])->getMock();
        $packet2->expects($this->once())->method('getPlayerHash')->will($this->returnValue(['test' => 'test']));
        $server->expects($this->at(3))->method('getReply')->will($this->returnValue($packet2));

        $server->handleResponseForRequest(GameServer::REQUEST_PLAYER);

        $this->assertEquals(1234, $server->challengeNumber);
        $this->assertEquals(['test' => 'test'], $server->playerHash);
    }

}


text:
package uaa_test

import (
	"crypto/tls"
	"fmt"
	"net/http"

	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	"github.com/onsi/gomega/ghttp"

	. "github.com/cloudfoundry/bosh-cli/uaa"
	"github.com/cloudfoundry/bosh-utils/logger/loggerfakes"
)

var _ = Describe("Factory", func() {
	Describe("New", func() {
		var logger *loggerfakes.FakeLogger

		BeforeEach(func() {
			logger = &loggerfakes.FakeLogger{}
		})

		It("returns error if config is invalid", func() {
			_, err := NewFactory(logger).New(Config{})
			Expect(err).To(HaveOccurred())
		})

		It("UAA returns error if TLS cannot be verified", func() {
			server := ghttp.NewTLSServer()
			defer server.Close()

			config, err := NewConfigFromURL(server.URL())
			Expect(err).ToNot(HaveOccurred())

			config.Client = "client"
			config.ClientSecret = "fake-client-secret"

			uaa, err := NewFactory(logger).New(config)
			Expect(err).ToNot(HaveOccurred())

			_, err = uaa.ClientCredentialsGrant()
			Expect(err).To(HaveOccurred())
			Expect(err.Error()).To(ContainSubstring("x509: certificate signed by unknown authority"))
		})

		It("UAA succeeds making a request with client creds if TLS can be verified", func() {
			server := ghttp.NewUnstartedServer()

			cert, err := tls.X509KeyPair(validCert, validKey)
			Expect(err).ToNot(HaveOccurred())

			server.HTTPTestServer.TLS = &tls.Config{
				Certificates: []tls.Certificate{cert},
			}

			server.HTTPTestServer.StartTLS()

			config, err := NewConfigFromURL(server.URL())
			Expect(err).ToNot(HaveOccurred())

			config.Client = "client"
			config.ClientSecret = "fake-client-secret"
			config.CACert = validCACert

			uaa, err := NewFactory(logger).New(config)
			Expect(err).ToNot(HaveOccurred())

			server.AppendHandlers(
				ghttp.CombineHandlers(
					ghttp.VerifyRequest("POST", "/oauth/token"),
					ghttp.VerifyBody([]byte("grant_type=client_credentials")),
					ghttp.VerifyBasicAuth("client", "fake-client-secret"),
					ghttp.VerifyHeader(http.Header{"Content-Type": []string{"application/x-www-form-urlencoded"}}),
					ghttp.RespondWith(http.StatusOK, `{}`),
				),
			)

			_, err = uaa.ClientCredentialsGrant()
			Expect(err).ToNot(HaveOccurred())
		})

		Context("when the server url has a context path", func() {
			It("properly follows that path", func() {
				server := ghttp.NewUnstartedServer()

				cert, err := tls.X509KeyPair(validCert, validKey)
				Expect(err).ToNot(HaveOccurred())

				server.HTTPTestServer.TLS = &tls.Config{
					Certificates: []tls.Certificate{cert},
				}

				server.HTTPTestServer.StartTLS()

				config, err := NewConfigFromURL(fmt.Sprintf("%s/test_path", server.URL()))
				Expect(err).ToNot(HaveOccurred())

				config.Client = "client"
				config.ClientSecret = "fake-client-secret"
				config.CACert = validCACert

				uaa, err := NewFactory(logger).New(config)
				Expect(err).ToNot(HaveOccurred())

				server.AppendHandlers(
					ghttp.CombineHandlers(
						ghttp.VerifyRequest("POST", "/test_path/oauth/token"),
						ghttp.VerifyBody([]byte("grant_type=client_credentials")),
						ghttp.VerifyBasicAuth("client", "fake-client-secret"),
						ghttp.VerifyHeader(http.Header{"Content-Type": []string{"application/x-www-form-urlencoded"}}),
						ghttp.RespondWith(http.StatusOK, `{}`),
					),
				)

				_, err = uaa.ClientCredentialsGrant()
				Expect(err).ToNot(HaveOccurred())

			})
		})

		// terminateHttpConnection emulates an underlying transport error by
		// prematurely closing the connection. The goal of this slightly-hacky
		// method is to test the retry behavior of the lower-level http client.
		terminateHttpConnection := func(w http.ResponseWriter, req *http.Request) {
			conn, _, _ := w.(http.Hijacker).Hijack()
			conn.Close()
		}

		It("retries request 3 times if server cannot be reached", func() {
			server := ghttp.NewUnstartedServer()

			cert, err := tls.X509KeyPair(validCert, validKey)
			Expect(err).ToNot(HaveOccurred())

			server.HTTPTestServer.TLS = &tls.Config{
				Certificates: []tls.Certificate{cert},
			}

			server.HTTPTestServer.StartTLS()

			config, err := NewConfigFromURL(server.URL())
			Expect(err).ToNot(HaveOccurred())

			config.Client = "client"
			config.ClientSecret = "fake-client-secret"
			config.CACert = validCACert

			uaa, err := NewFactory(logger).New(config)
			Expect(err).ToNot(HaveOccurred())

			server.AppendHandlers(
				ghttp.CombineHandlers(
					ghttp.VerifyRequest("POST", "/oauth/token"),
					ghttp.VerifyBody([]byte("grant_type=client_credentials")),
					ghttp.VerifyBasicAuth("client", "fake-client-secret"),
					ghttp.VerifyHeader(http.Header{"Content-Type": []string{"application/x-www-form-urlencoded"}}),
					terminateHttpConnection,
				),
				ghttp.CombineHandlers(
					ghttp.VerifyRequest("POST", "/oauth/token"),
					ghttp.VerifyBody([]byte("grant_type=client_credentials")),
					ghttp.VerifyBasicAuth("client", "fake-client-secret"),
					ghttp.VerifyHeader(http.Header{"Content-Type": []string{"application/x-www-form-urlencoded"}}),
					terminateHttpConnection,
				),
				ghttp.CombineHandlers(
					ghttp.VerifyRequest("POST", "/oauth/token"),
					ghttp.VerifyBody([]byte("grant_type=client_credentials")),
					ghttp.VerifyBasicAuth("client", "fake-client-secret"),
					ghttp.VerifyHeader(http.Header{"Content-Type": []string{"application/x-www-form-urlencoded"}}),
					ghttp.RespondWith(http.StatusOK, `{}`),
				),
			)

			_, err = uaa.ClientCredentialsGrant()
			Expect(err).ToNot(HaveOccurred())
			Expect(len(server.ReceivedRequests())).To(Equal(3))
		})

		It("does not retry on non-successful http status codes", func() {
			server := ghttp.NewUnstartedServer()

			cert, err := tls.X509KeyPair(validCert, validKey)
			Expect(err).ToNot(HaveOccurred())

			server.HTTPTestServer.TLS = &tls.Config{
				Certificates: []tls.Certificate{cert},
			}

			server.HTTPTestServer.StartTLS()

			config, err := NewConfigFromURL(server.URL())
			Expect(err).ToNot(HaveOccurred())

			config.Client = "client"
			config.ClientSecret = "fake-client-secret"
			config.CACert = validCACert

			uaa, err := NewFactory(logger).New(config)
			Expect(err).ToNot(HaveOccurred())

			server.AppendHandlers(
				ghttp.CombineHandlers(
					ghttp.VerifyRequest("POST", "/oauth/token"),
					ghttp.VerifyBody([]byte("grant_type=client_credentials")),
					ghttp.VerifyBasicAuth("client", "fake-client-secret"),
					ghttp.VerifyHeader(http.Header{"Content-Type": []string{"application/x-www-form-urlencoded"}}),
					terminateHttpConnection,
				),
				ghttp.CombineHandlers(
					ghttp.VerifyRequest("POST", "/oauth/token"),
					ghttp.VerifyBody([]byte("grant_type=client_credentials")),
					ghttp.VerifyBasicAuth("client", "fake-client-secret"),
					ghttp.VerifyHeader(http.Header{"Content-Type": []string{"application/x-www-form-urlencoded"}}),
					ghttp.RespondWith(http.StatusUnauthorized, `{"no"=>"access"}`),
				),
			)

			_, err = uaa.ClientCredentialsGrant()
			Expect(err).To(HaveOccurred())
			Expect(err.Error()).To(ContainSubstring(`Requesting token via client credentials grant: UAA responded with non-successful status code '401' response '{"no"=>"access"}'`))
			Expect(len(server.ReceivedRequests())).To(Equal(2))
		})

	})
})


text:
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.example.android.displayingbitmaps.ui.MyFragmentActivity">

    <FrameLayout
        android:id="@+id/contents"
        android:paddingBottom="@dimen/activity_vertical_margin"
        android:paddingLeft="@dimen/activity_horizontal_margin"
        android:paddingRight="@dimen/activity_horizontal_margin"
        android:paddingTop="@dimen/activity_vertical_margin"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</merge>


text:
package com.github.basking2.jaxos.paxos;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;

/**
 * In-memory cache that times out values.
 */
public class DefaultPaxosProposerDao<V> implements PaxosProposerDao<V> {

    final Cache<String, Proposal<V>> proposals;

    final LoadingCache<String, Integer> promises;

    public DefaultPaxosProposerDao(final long timeout, TimeUnit timeunit) {
        proposals = CacheBuilder.newBuilder().
                expireAfterWrite(timeout, timeunit).
                build();
        promises = CacheBuilder.newBuilder().
                expireAfterWrite(timeout, timeunit).
                build(new CacheLoader<String, Integer>() {
                    @Override
                    public Integer load(String key) throws Exception {
                        return 0;
                    }
                });
    }

    @Override
    public void storeProposal(String instance, Proposal<V> proposal) {
        proposals.put(instance, proposal);
    }

    @Override
    public Proposal<V> loadProposal(String instance) {
        return proposals.getIfPresent(instance);
    }

    @Override
    public Integer countPromise(String instance) {
        try {
            Integer i = promises.get(instance) + 1;

            promises.put(instance, i);

            return i;
        } catch (ExecutionException e) {
            throw new RuntimeException("Unexpected error.", e);
        }
    }

    @Override
    public void resetPromise(String instance) {
        promises.put(instance, 0);
    }
}


text:
package org.broadleafcommerce.cms.page.domain;

import org.broadleafcommerce.common.copy.CreateResponse;
import org.broadleafcommerce.common.copy.MultiTenantCopyContext;
import org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyTransform;
import org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyTransformMember;
import org.broadleafcommerce.common.extensibility.jpa.copy.DirectCopyTransformTypes;
import org.broadleafcommerce.common.extensibility.jpa.copy.ProfileEntity;
import org.broadleafcommerce.common.i18n.service.DynamicTranslationProvider;
import org.broadleafcommerce.common.presentation.AdminPresentation;
import org.broadleafcommerce.openadmin.audit.AdminAuditable;
import org.broadleafcommerce.openadmin.audit.AdminAuditableListener;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Embedded;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * Created by bpolster.
 */
@Entity
@Inheritance(strategy = InheritanceType.JOINED)
@Table(name = "BLC_PAGE_FLD")
@EntityListeners(value = { AdminAuditableListener.class })
@DirectCopyTransform({
        @DirectCopyTransformMember(templateTokens = DirectCopyTransformTypes.SANDBOX, skipOverlaps=true),
        @DirectCopyTransformMember(templateTokens = DirectCopyTransformTypes.MULTITENANT_SITE, skipOverlaps=true)
})
public class PageFieldImpl implements PageField, ProfileEntity {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(generator = "PageFieldId")
    @GenericGenerator(
        name="PageFieldId",
        strategy="org.broadleafcommerce.common.persistence.IdOverrideTableGenerator",
        parameters = {
            @Parameter(name="segment_value", value="PageFieldImpl"),
            @Parameter(name="entity_name", value="org.broadleafcommerce.cms.page.domain.PageFieldImpl")
        }
    )
    @Column(name = "PAGE_FLD_ID")
    protected Long id;

    @Embedded
    @AdminPresentation(excluded = true)
    protected AdminAuditable auditable = new AdminAuditable();

    @Column (name = "FLD_KEY")
    protected String fieldKey;

    @Column (name = "VALUE")
    protected String stringValue;

    @Column(name = "LOB_VALUE", length = Integer.MAX_VALUE-1)
    @Lob
    @Type(type = "org.hibernate.type.StringClobType")
    protected String lobValue;

    @ManyToOne(targetEntity = PageImpl.class, optional = false, cascade = CascadeType.REFRESH)
    @JoinColumn(name = "PAGE_ID")
    protected Page page;

    @Override
    public Long getId() {
        return id;
    }

    @Override
    public void setId(Long id) {
        this.id = id;
    }

    @Override
    public String getFieldKey() {
        return fieldKey;
    }

    @Override
    public void setFieldKey(String fieldKey) {
        this.fieldKey = fieldKey;
    }

    @Override
    public String getValue() {
        if (stringValue != null && stringValue.length() > 0) {
            return DynamicTranslationProvider.getValue(page, "pageTemplate|" + fieldKey, stringValue);
        } else {
            return DynamicTranslationProvider.getValue(page, "pageTemplate|" + fieldKey, lobValue);
        }
    }

    @Override
    public void setValue(String value) {
        if (value != null) {
            if (value.length() <= 256) {
                stringValue = value;
                lobValue = null;
            } else {
                stringValue = null;
                lobValue = value;
            }
        } else {
            lobValue = null;
            stringValue = null;
        }
    }

    @Override
    public AdminAuditable getAuditable() {
        return auditable;
    }

    @Override
    public void setAuditable(AdminAuditable auditable) {
        this.auditable = auditable;
    }

    @Override
    public Page getPage() {
        return page;
    }

    @Override
    public void setPage(Page page) {
        this.page = page;
    }

    @Override
    public <G extends PageField> CreateResponse<G> createOrRetrieveCopyInstance(MultiTenantCopyContext context) throws CloneNotSupportedException {

        CreateResponse<G> createResponse = context.createOrRetrieveCopyInstance(this);
        if (createResponse.isAlreadyPopulated()) {
            return createResponse;
        }
        PageField cloned = createResponse.getClone();
        if (page != null) {
            cloned.setPage(page.createOrRetrieveCopyInstance(context).getClone());
        }
        cloned.setFieldKey(fieldKey);
        //we don't want to engage the dynamic behavior housed in the getter/setter methods for these fields
        ((PageFieldImpl) cloned).stringValue = stringValue;
        ((PageFieldImpl) cloned).lobValue = lobValue;

        return createResponse;

    }
}


text:
@import url('http://js.arcgis.com/3.12/dijit/themes/claro/claro.css');

.jimu-widget-NetworkTrace .flagbutton
{
    float: left;
    cursor: pointer;
    width: 42px;
    height: 42px;
    background-repeat: no-repeat;
    background-image: url("../images/add-flags.png");
    background-color: #858585;
}

.jimu-widget-NetworkTrace .esriCTSaveToLayerButton
{
    float: left;
    cursor: pointer;
    width: 24px;
    height: 24px;
    background-repeat: no-repeat;
    margin-right: 10px;
    background-image: url("../images/save-layer.png");
}

.jimu-widget-NetworkTrace .esriCTBackButton
{
    float: left;
    margin-top: 5%;
    margin-left: 6%;
    cursor: pointer;
    width: 13px;
    height: 13px;
    background-repeat: no-repeat;
    background-color: black;
    background-image: url("../images/back-arrow.png");
}

.jimu-widget-NetworkTrace .esriCTExportToCSVButton
{
    float: right;
    cursor: pointer;
    width: 24px;
    height: 24px;
    background-repeat: no-repeat;
    background-image: url("../images/download-csv.png");
}

.jimu-widget-NetworkTrace .barrierButton
{
    float: left;
    cursor: pointer;
    width: 42px;
    height: 42px;
    background-repeat: no-repeat;
    background-image: url("../images/add-barriers.png");
    background-color: #858585;
}

.jimu-widget-NetworkTrace .flagButtonselected
{
    float: left;
    cursor: pointer;
    width: 42px;
    height: 42px;
    background-repeat: no-repeat;
    background-image: url("../images/add-flags-select.png");
    background-color: #858585;
}

.jimu-widget-NetworkTrace .barrierButtonselected
{
    float: left;
    cursor: pointer;
    width: 42px;
    height: 42px;
    background-repeat: no-repeat;
    background-image: url("../images/add-barriers-select .png");
    background-color: #858585;
}

.jimu-widget-NetworkTrace .esriCTImageDiv
{
    float: right;
    margin-right: 10px;
}

.jimu-widget-NetworkTrace .tracePanel
{
    padding: 10px 20px;
}

.jimu-widget-NetworkTrace .traceControl
{
    float: left;
    width: 100%;
}

.jimu-widget-NetworkTrace .btnFlagStyle
{
    width: 50%;
}

.jimu-widget-NetworkTrace .btnBarrierStyle
{
    width: 50%;
    float: right;
}

.jimu-widget-NetworkTrace .flagLabel
{
    float: left;
    margin: 17px 10px 0 0;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 60%;
}

.jimu-widget-NetworkTrace .barrierLabel
{
    float: left;
    margin: 17px 10px 0 0;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    max-width: 60%;
}

.jimu-widget-NetworkTrace .traceButtons
{
    float: left;
    width: 100%;
    text-align: center;
    margin-top: 20px;
    margin-bottom: 20px;
}

.resultItemButton
{
    padding: 0;
    width: 40px;
    height: 40px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    cursor: pointer;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    -o-border-radius: 5px;
    border-radius: 5px;
    outline: none;
    background-position: center center;
    background-repeat: no-repeat;
    border: 0;
    margin-right: 10px;
    float: left;
}

.resultItemLabel
{
    display: table-cell;
    width: 100%;
    vertical-align: middle;
    text-align: left;
    cursor: pointer;
    color: blue;
    text-decoration: underline;
}

.resultItemSubDiv
{
    clear: both;
    display: table;
    text-align: center;
    width: 100%;
    margin: 5px;
}

.resultItemButtonSkipIcon
{
    background-image: url("../images/skip.png");
    background-color: #666666;
}

.resultItemButtonSkipIconSelected
{
    background-color: #ff0000 !important;
}

.resultItemButtonZoomIcon
{
    background-image: url("../images/ZoomTo.png");
    background-color: #666666;
    margin-bottom: 5px;
    margin-top: 5px;
}

.resultItemButtonZoomIconSelected
{
    background-image: url("../images/ZoomTo.png");
    background-color: #ff0000;
    margin-bottom: 5px;
    margin-top: 5px;
}

.jimu-widget-NetworkTrace .runIconidle
{
    display: none;
}

.jimu-widget-NetworkTrace .runIconProcessing
{
    background-image: url("../images/loading.gif");
    background-position: center bottom;
    background-repeat: no-repeat;
    background-size: 100% auto;
    height: 60px;
    margin: 0 auto;
    width: 40px;
}

.jimu-widget-NetworkTrace .traceControlDisabledDiv
{
    pointer-events: none;
}

.claro .dijitTitlePaneContentInner
{
    /*overflow-x: auto;*/
    padding: 0px;
}

.dijitButtonNode
{
    border: 0px solid gray;
}

.dijitValidationTextBoxError input.dijitValidationInner, .dijitSelect input, .dijitTextBox input.dijitArrowButtonInner
{
    height: 28px !important;
}

.jimu-widget-NetworkTrace .DynamicCheckbox
{
    margin-right: 5px;
}

.jimu-widget-NetworkTrace .DateAndTime
{
    width: 12em !important;
}

.dijitTimeTextBox
{
    width: 12em !important;
}

.dijitDateTextBox
{
    width: 12em !important;
}

.jimu-widget-NetworkTrace .resultPanelStyle
{
    width: 100%;
}

.jimu-widget-NetworkTrace .resultItemClass
{
    padding: 8px;
    padding-left: 19px;
}

.jimu-widget-NetworkTrace .jimu-btn
{
    font-size: 12px;
    min-width: 70px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    margin-right: 12px;
    overflow: hidden;
    max-width: 45%;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 31px;
    padding: 0 15px;
    height: 31px;
}

.jimu-widget-NetworkTrace .jimu-btn.jimu-state-disabled
{
    pointer-events: none;
}

.jimu-widget-NetworkTrace .esriCTSaveButton .jimu-btn
{
    max-width: 95% !important;
}

.jimu-widget-NetworkTrace .esriCThiddenDIV
{
    height: 30px;
    width: 100%;
}

.jimu-widget-NetworkTrace .resultPanelContainer
{
    clear: both;
    position: relative;
    width: 100%;
}

.jimu-widget-frame.jimu-container
{
    background-color: white;
    overflow: auto;
    padding: 0px;
    position: relative;
}

.dijitArrowNode
{
    float: right;
}

.claro .dijitTitlePaneTitleOpen, .claro .dijitTitlePaneTitleFixedOpen
{
    background-color: #E9EEF4;
    color: Black;
}

.dijitTitlePane
{
    background-color: #fff;
}

.claro .dijitTitlePaneTitle
{
    background-color: #efefef;
    background-image: none;
    background-repeat: repeat-x;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-top: 1px solid #b5bcc7;
    color: #494949;
    min-height: 17px;
    padding: 7px 15px;
}

.claro .dijitTitlePaneContentOuter
{
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-top: 1px solid #b5bcc7; /* padding: 0 10px; */
}

.dijitheadPaneTitle
{
    background-color: #ccc;
    background-image: none;
    background-repeat: repeat-x;
    border-left: none;
    border-right: none;
    border-bottom: none;
    border-top: 1px solid #b5bcc7;
    color: #494949;
    min-height: 17px;
}

.jimu-widget-NetworkTrace .esriCThyperlinkDiv
{
    max-width: 30%;
    font-weight: bold;
    color: #485566;
    font-size: 14px;
    float: left;
    cursor: pointer;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 50px;
    margin-left: 10px;
}

.jimu-widget-NetworkTrace .esriCThyperlinkDiv:hover
{
    text-decoration: underline;
}

.jimu-widget-NetworkTrace .resultsHeadText
{
    padding: 5px;
    font-weight: bold;
    padding-bottom: 30px;
}

.jimu-widget-NetworkTrace .esriCTResultHead
{
    float: left;
    margin-top: 8px;
    margin-left: 10px;
    width: 69%;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.jimu-widget-NetworkTrace .dijitheadPanelIcons
{
    float: right;
}

.jimu-widget-NetworkTrace .saveToLayer
{
    float: left;
}

.jimu-widget-NetworkTrace .exportToCsv
{
    float: left;
}

.claro .dijitTitlePaneTitleFocus
{
    outline: none;
}

.jimu-widget-NetworkTrace .esriCTMainDiv
{
    width: 100%;
}

.jimu-widget-NetworkTrace .esriCTTopDiv
{
    height: 50px;
    border-bottom: 1px solid #000;
    text-align: center;
    float: left;
    width: 100%;
}

.jimu-widget-NetworkTrace .esriCTBackButtonLinkLbl
{
    float: left;
    margin-top: 5%;
}

.jimu-widget-NetworkTrace .esriCTSaveButton
{
    height: 30px;
    width: 100%;
    float: left;
    vertical-align: middle;
    text-align: center;
}

.jimu-widget-NetworkTrace .esriCTTitleSaveToLayer
{
    width: 65%;
    font-size: 14px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 50px;
    margin-left: 0px;
    margin-right: 0px;
}

.jimu-widget-NetworkTrace .esriCTCommonDiv
{
    padding: 5px 0px 3px 0px;
    clear: both;
    float: left;
    margin-left: 29px;
}

.jimu-widget-NetworkTrace .esriCTWidth
{
    width: 100%;
    margin-bottom: 5px;
}

.jimu-widget-NetworkTrace .esriCTLeft
{
    float: left;
    margin-right: 15px;
}

.jimu-widget-NetworkTrace .esriCTRight
{
    float: left;
}

.jimu-widget-NetworkTrace .esriCTTextbox
{
    width: 144px;
    height: 30px;
}

.jimu-widget-NetworkTrace .esriCTDateTextbox
{
    width: 134px;
    height: 23px;
}

.jimu-widget-NetworkTrace .esriCTTimeTextbox
{
    width: 131px;
    height: 23px;
}

.jimu-widget-NetworkTrace .esriCTChkMargin
{
    margin-bottom: 5px;
    width: 45%;
}

.jimu-widget-NetworkTrace .esriCTHidden
{
    display: none;
}

.jimu-widget-NetworkTrace .esriCTOutageControl
{
    width: 144px !important;
}

.jimu-widget-NetworkTrace .esriCTOutageAreaVisibilty
{
    width: 99%;
    height: 100%;
    float: left;
}

.jimu-widget-NetworkTrace .esriCTBtnPos
{
    margin-left: 200px;
}

.jimu-widget-NetworkTrace .esriCTExportToCSVBtnDiv
{
    margin-left: 30px;
    margin-top: 10px;
}

.jimu-widget-NetworkTrace .esriCTLabelMargin
{
    margin-left: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
    display: block;
    width: 250px;
}

.jimu-widget-NetworkTrace .esriCTInfoLink
{
    color: black;
    margin: 0 auto;
    cursor: pointer;
}

.jimu-widget-NetworkTrace .esriCTParamCheckBox
{
    position: relative;
    margin: 0px 0px 7px 0px;
}

.jimu-widget-NetworkTrace .esriCTChkLabel
{
    position: absolute;
    top: 2px;
    left: 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    width: 250px;
}

.claro .dijitSelect, .claro .dijitTextBox
{
    width: 144px;
}

.esriCTChkGroup
{
    width: 159px;
    float: left;
    margin: 5px 0;
}

.attrResultInfoTable
{
    border-collapse: collapse;
}

.attrResultInfoTable td.attrName
{
    color: #888888;
    padding-right: 5px;
}

.attrResultInfoTable td
{
    padding: 2px;
    padding-bottom: 5px;
}

.attrHeader
{
    font-weight: bold;
}

.attrSeparator
{
    border: none;
    border-top: 1px solid #333333;
    margin-top: 6px;
    margin-bottom: 6px;
}

.jimu-widget-NetworkTrace .esriAttributeInspector .atiButton, .jimu-widget-NetworkTrace .esriAttributeInspector .atiLayerName
{
    display: none;
}

.jimu-widget-NetworkTrace .esriAttributeInspector .atiButtons
{
    display: none;
}

.resultItem
{
    border-bottom: 1px solid #b5bcc7;
}

.jimu-widget-NetworkTrace .lastTitlePaneNodeBorder
{
    border-bottom: 1px solid #b5bcc7;
}

.resultItem:last-child
{
    border-bottom: 0px;
}

.jimu-widget-NetworkTrace .lastTitlePane
{
}


text:
{% load humanize %}
{% load mathfilters %}

      Reference
      Account Title
      Account Type
      {% comment %} {% if user.is_superuser %} {% endcomment %}
      Actions
      {% comment %} {% endif %} {% endcomment %}

    {% for account in all_accounts %}

{{ account.ref_num }}

      {{ account.account_title }}
      {{ account.account_type }}
      {% comment %} {% if user.is_superuser %} {% endcomment %}

      {% comment %} {% endif %} {% endcomment %}

    {% endfor %}


text:
// Copyright 2009 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @fileoverview Provides the base goog.ui.Control and goog.ui.ControlRenderer
 * for media types, as well as a media model consistent with the Yahoo Media RSS
 * specification {@link http://search.yahoo.com/mrss/}.
 *
 * The goog.ui.media.* package is basically a set of goog.ui.ControlRenderers
 * subclasses (such as goog.ui.media.Youtube, goog.ui.media.Picasa, etc) that
 * should all work with the same goog.ui.Control (goog.ui.media.Media) logic.
 *
 * This design guarantees that all different types of medias will behave alike
 * (in a base level) but will look different.
 *
 * In MVC terms, {@link goog.ui.media.Media} is the Controller,
 * {@link goog.ui.media.MediaRenderer} + CSS definitions are the View and
 * {@code goog.ui.media.MediaModel} is the data Model. Typically,
 * MediaRenderer will be subclassed to provide media specific renderers.
 * MediaRenderer subclasses are also responsible for defining the data model.
 *
 * This design is strongly patterned after:
 * http://go/closure_control_subclassing
 *
 * goog.ui.media.MediaRenderer handles the basic common ways to display media,
 * such as displaying tooltips, frames, minimize/maximize buttons, play buttons,
 * etc. Its subclasses are responsible for rendering media specific DOM
 * structures, like youtube flash players, picasa albums, etc.
 *
 * goog.ui.media.Media handles the Control of Medias, by listening to events
 * and firing the appropriate actions. It knows about the existence of captions,
 * minimize/maximize buttons, and takes all the actions needed to change states,
 * including delegating the UI actions to MediaRenderers.
 *
 * Although MediaRenderer is a base class designed to be subclassed, it can
 * be used by itself:
 *
 *

 *   var renderer = new goog.ui.media.MediaRenderer();
 *   var control = new goog.ui.media.Media('hello world', renderer);
 *   var control.render(goog.dom.getElement('mediaHolder'));
 *

 *
 * It requires a few CSS rules to be defined, which you should use to control
 * how the component is displayed. {@link goog.ui.ControlRenderer}s is very CSS
 * intensive, which separates the UI structure (the HTML DOM elements, which is
 * created by the {@code goog.ui.media.MediaRenderer}) from the UI view (which
 * nodes are visible, which aren't, where they are positioned. These are defined
 * on the CSS rules for each state). A few examples of CSS selectors that needs
 * to be defined are:
 *
 *

 *
.goog-ui-media
 *
.goog-ui-media-hover
 *
.goog-ui-media-selected
 *

 *
 * If you want to have different custom renderers CSS namespaces (eg. you may
 * want to show a small thumbnail, or you may want to hide the caption, etc),
 * you can do so by using:
 *
 *

 *   var renderer = goog.ui.ControlRenderer.getCustomRenderer(
 *       goog.ui.media.MediaRenderer, 'my-custom-namespace');
 *   var media = new goog.ui.media.Media('', renderer);
 *   media.render(goog.dom.getElement('parent'));
 *

 *
 * Which will allow you to set your own .my-custom-namespace-hover,
 * .my-custom-namespace-selected CSS selectors.
 *
 * NOTE(user): it seems like an overkill to subclass goog.ui.Control instead of
 * using a factory, but we wanted to make sure we had more control over the
 * events for future media implementations. Since we intent to use it in many
 * different places, it makes sense to have a more flexible design that lets us
 * control the inner workings of goog.ui.Control.
 *
 * TODO(user): implement, as needed, the Media specific state changes UI, such
 * as minimize/maximize buttons, expand/close buttons, etc.
 *
 */

goog.provide('goog.ui.media.Media');
goog.provide('goog.ui.media.MediaRenderer');

goog.require('goog.style');
goog.require('goog.ui.Component');
goog.require('goog.ui.Control');
goog.require('goog.ui.ControlRenderer');

/**
 * Provides the control mechanism of media types.
 *
 * @param {goog.ui.media.MediaModel} dataModel The data model to be used by the
 *     renderer.
 * @param {goog.ui.ControlRenderer=} opt_renderer Renderer used to render or
 *     decorate the component; defaults to {@link goog.ui.ControlRenderer}.
 * @param {goog.dom.DomHelper=} opt_domHelper Optional DOM helper, used for
 *     document interaction.
 * @constructor
 * @extends {goog.ui.Control}
 * @final
 */
goog.ui.media.Media = function(dataModel, opt_renderer, opt_domHelper) {
  goog.ui.Control.call(this, null, opt_renderer, opt_domHelper);

  // Sets up the data model.
  this.setDataModel(dataModel);
  this.setSupportedState(goog.ui.Component.State.OPENED, true);
  this.setSupportedState(goog.ui.Component.State.SELECTED, true);
  // TODO(user): had to do this to for mouseDownHandler not to
  // e.preventDefault(), because it was not allowing the event to reach the
  // flash player. figure out a better way to not e.preventDefault().
  this.setAllowTextSelection(true);

  // Media items don't use RTL styles, so avoid accessing computed styles to
  // figure out if the control is RTL.
  this.setRightToLeft(false);
};
goog.inherits(goog.ui.media.Media, goog.ui.Control);

/**
 * The media data model used on the renderer.
 *
 * @type {goog.ui.media.MediaModel}
 * @private
 */
goog.ui.media.Media.prototype.dataModel_;

/**
 * Sets the media model to be used on the renderer.
 * @param {goog.ui.media.MediaModel} dataModel The media model the renderer
 *     should use.
 */
goog.ui.media.Media.prototype.setDataModel = function(dataModel) {
  this.dataModel_ = dataModel;
};

/**
 * Gets the media model renderer is using.
 * @return {goog.ui.media.MediaModel} The media model being used.
 */
goog.ui.media.Media.prototype.getDataModel = function() {
  return this.dataModel_;
};

/**
 * Base class of all media renderers. Provides the common renderer functionality
 * of medias.
 *
 * The current common functionality shared by Medias is to have an outer frame
 * that gets highlighted on mouse hover.
 *
 * TODO(user): implement more common UI behavior, as needed.
 *
 * NOTE(user): I am not enjoying how the subclasses are changing their state
 * through setState() ... maybe provide abstract methods like
 * goog.ui.media.MediaRenderer.prototype.preview = goog.abstractMethod;
 * goog.ui.media.MediaRenderer.prototype.play = goog.abstractMethod;
 * goog.ui.media.MediaRenderer.prototype.minimize = goog.abstractMethod;
 * goog.ui.media.MediaRenderer.prototype.maximize = goog.abstractMethod;
 * and call them on this parent class setState ?
 *
 * @constructor
 * @extends {goog.ui.ControlRenderer}
 */
goog.ui.media.MediaRenderer = function() {
  goog.ui.ControlRenderer.call(this);
};
goog.inherits(goog.ui.media.MediaRenderer, goog.ui.ControlRenderer);

/**
 * Builds the common DOM structure of medias. Builds an outer div, and appends
 * a child div with the {@code goog.ui.Control.getContent} content. Marks the
 * caption with a {@code this.getClassClass()} + '-caption' css flag, so that
 * specific renderers can hide/show the caption as desired.
 *
 * @param {goog.ui.Control} control The control instance.
 * @return {Element} The DOM structure that represents control.
 * @override
 */
goog.ui.media.MediaRenderer.prototype.createDom = function(control) {
  var domHelper = control.getDomHelper();
  var div = domHelper.createElement('div');
  div.className = this.getClassNames(control).join(' ');

  var dataModel = control.getDataModel();

  // Only creates DOMs if the data is available.
  if (dataModel.getCaption()) {
    var caption = domHelper.createElement('div');
    caption.className = goog.getCssName(this.getCssClass(), 'caption');
    caption.appendChild(domHelper.createDom(
        'p', goog.getCssName(this.getCssClass(), 'caption-text'),
        dataModel.getCaption()));
    domHelper.appendChild(div, caption);
  }

  if (dataModel.getDescription()) {
    var description = domHelper.createElement('div');
    description.className = goog.getCssName(this.getCssClass(), 'description');
    description.appendChild(domHelper.createDom(
        'p', goog.getCssName(this.getCssClass(), 'description-text'),
        dataModel.getDescription()));
    domHelper.appendChild(div, description);
  }

  // Creates thumbnails of the media.
  var thumbnails = dataModel.getThumbnails() || [];
  for (var index = 0; index < thumbnails.length; index++) {
    var thumbnail = thumbnails[index];
    var thumbnailElement = domHelper.createElement('img');
    thumbnailElement.src = thumbnail.getUrl();
    thumbnailElement.className = this.getThumbnailCssName(index);

    // Check that the size is defined and that the size's height and width
    // are defined. Undefined height and width is deprecated but still
    // seems to exist in some cases.
    var size = thumbnail.getSize();

    if (size && goog.isDefAndNotNull(size.height) &&
        goog.isDefAndNotNull(size.width)) {
      goog.style.setSize(thumbnailElement, size);
    }
    domHelper.appendChild(div, thumbnailElement);
  }

  if (dataModel.getPlayer()) {
    // if medias have players, allow UI for a play button.
    var playButton = domHelper.createElement('div');
    playButton.className = goog.getCssName(this.getCssClass(), 'playbutton');
    domHelper.appendChild(div, playButton);
  }

  control.setElementInternal(div);

  this.setState(
      control,
      /** @type {goog.ui.Component.State} */ (control.getState()),
      true);

  return div;
};

/**
 * Returns a renamable CSS class name for a numbered thumbnail. The default
 * implementation generates the class names goog-ui-media-thumbnail0,
 * goog-ui-media-thumbnail1, and the generic goog-ui-media-thumbnailn.
 * Subclasses can override this method when their media requires additional
 * specific class names (Applications are supposed to know how many thumbnails
 * media will have).
 *
 * @param {number} index The thumbnail index.
 * @return {string} CSS class name.
 * @protected
 */
goog.ui.media.MediaRenderer.prototype.getThumbnailCssName = function(index) {
  switch (index) {
    case 0: return goog.getCssName(this.getCssClass(), 'thumbnail0');
    case 1: return goog.getCssName(this.getCssClass(), 'thumbnail1');
    case 2: return goog.getCssName(this.getCssClass(), 'thumbnail2');
    case 3: return goog.getCssName(this.getCssClass(), 'thumbnail3');
    case 4: return goog.getCssName(this.getCssClass(), 'thumbnail4');
    default: return goog.getCssName(this.getCssClass(), 'thumbnailn');
  }
};


text:
#ifndef LIEF_PE_UTILS_H_
#define LIEF_PE_UTILS_H_
#include <vector>
#include <string>

#include "LIEF/PE/enums.hpp"
#include "LIEF/visibility.h"
#include "LIEF/errors.hpp"
#include "LIEF/errors.hpp"

namespace LIEF {
class BinaryStream;

namespace PE {
class Binary;
class Import;

//! Enum to define the behavior of LIEF::PE::get_imphash
enum class IMPHASH_MODE {
  DEFAULT = 0,    /**< Default implementation */
  LIEF = DEFAULT, /**< Same as IMPHASH_MODE::DEFAULT */
  PEFILE,         /**< Use pefile algorithm */
  VT = PEFILE,    /**< Same as IMPHASH_MODE::PEFILE since Virus Total is using pefile */
};

//! check if the `file` is a PE file
LIEF_API bool is_pe(const std::string& file);

//! check if the raw data is a PE file
LIEF_API bool is_pe(const std::vector<uint8_t>& raw);

//! if the input `file` is a PE one, return `PE32` or `PE32+`
LIEF_API result<PE_TYPE> get_type(const std::string& file);

//! Return `PE32` or `PE32+`
LIEF_API result<PE_TYPE> get_type(const std::vector<uint8_t>& raw);

// In this case we assume that stream contains a valid PE stream
LIEF_LOCAL result<PE_TYPE> get_type_from_stream(BinaryStream& stream);

//! Compute the hash of imported functions
//!
//! By default, it generates an hash with the following properties:
//!   * Order agnostic
//!   * Casse agnostic
//!   * Ordinal (**in some extent**) agnostic
//!
//! If one needs the same output as Virus Total (i.e. pefile), you can pass IMPHASH_MODE::PEFILE
//! as second parameter.
//!
//! @warning The default algorithm used to compute the *imphash* value has some variations compared to Yara, pefile, VT implementation
//!
//! @see https://www.fireeye.com/blog/threat-research/2014/01/tracking-malware-import-hashing.html
LIEF_API std::string get_imphash(const Binary& binary, IMPHASH_MODE mode = IMPHASH_MODE::DEFAULT);

//! Take a PE::Import as entry and try to resolve imports
//! by ordinal.
//!
//! The ``strict`` boolean parameter enables to throw an LIEF::not_found exception
//! if the ordinal can't be resolved. Otherwise it skips the entry.
//!
//! @param[in] import Import to resolve
//! @param[in] strict If set to ``true``, throw an exception if the import can't be resolved
//! @param[in] use_std If ``true``, it will use the [pefile](https://github.com/erocarrera/pefile/tree/09264be6f731bf8578aee8638cc4046154e03abf/ordlookup) look-up table for resolving imports
//!
//! @return The PE::import resolved with PE::ImportEntry::name set
LIEF_API result<Import> resolve_ordinals(const Import& import, bool strict=false, bool use_std=false);

LIEF_API ALGORITHMS algo_from_oid(const std::string& oid);
}
}
#endif


text:
namespace Poco {
namespace Util {

class Util_API XMLConfiguration: public AbstractConfiguration
	/// This configuration class extracts configuration properties
	/// from an XML document. An XPath-like syntax for property
	/// names is supported to allow full access to the XML document.
	/// XML namespaces are not supported. The name of the root element
	/// of the XML document is not significant and ignored.
	/// Periods in tag names are not supported.
	///
	/// Given the following XML document as an example:
	///
	///     <config>
	///         <prop1>value1</prop1>
	///         <prop2>value2</prop2>
	///         <prop3>
	///            <prop4 attr="value3"/>
	///            <prop4 attr="value4"/>
	///         </prop3>
	///         <prop5 id="first">value5</prop5>
	///         <prop5 id="second">value6</prop5>
	///     </config>
	///
	/// The following property names would be valid and would
	/// yield the shown values:
	///
	///     prop1                 -> value1
	///     prop2                 -> value2
	///     prop3.prop4           -> (empty string)
	///     prop3.prop4[@attr]    -> value3
	///     prop3.prop4[1][@attr] -> value4
	///     prop5[0]              -> value5
	///     prop5[1]              -> value6
	///     prop5[@id=first]      -> value5
	///     prop5[@id='second']   -> value6
	///
	/// Enumerating attributes is not supported.
	/// Calling keys("prop3.prop4") will return an empty range.
{
public:
	XMLConfiguration();
		/// Creates an empty XMLConfiguration.

	XMLConfiguration(Poco::XML::InputSource* pInputSource);
		/// Creates an XMLConfiguration and loads the XML document from
		/// the given InputSource.

	XMLConfiguration(std::istream& istr);
		/// Creates an XMLConfiguration and loads the XML document from
		/// the given stream.

	XMLConfiguration(const std::string& path);
		/// Creates an XMLConfiguration and loads the XML document from
		/// the given path.

	XMLConfiguration(const Poco::XML::Document* pDocument);
		/// Creates the XMLConfiguration using the given XML document.

	XMLConfiguration(const Poco::XML::Node* pNode);
		/// Creates the XMLConfiguration using the given XML node.

	void load(Poco::XML::InputSource* pInputSource);
		/// Loads the XML document containing the configuration data
		/// from the given InputSource.

	void load(std::istream& istr);
		/// Loads the XML document containing the configuration data
		/// from the given stream.

	void load(const std::string& path);
		/// Loads the XML document containing the configuration data
		/// from the given file.

	void load(const Poco::XML::Document* pDocument);
		/// Loads the XML document containing the configuration data
		/// from the given XML document.

	void load(const Poco::XML::Node* pNode);
		/// Loads the XML document containing the configuration data
		/// from the given XML node.

	void loadEmpty(const std::string& rootElementName);
		/// Loads an empty XML document containing only the
		/// root element with the given name.

	void save(const std::string& path) const;
		/// Writes the XML document containing the configuration data
		/// to the file given by path.

	void save(std::ostream& str) const;
		/// Writes the XML document containing the configuration data
		/// to the given stream.

	void save(Poco::XML::DOMWriter& writer, const std::string& path) const;
		/// Writes the XML document containing the configuration data
		/// to the file given by path, using the given DOMWriter.
		///
		/// This can be used to use a DOMWriter with custom options.

	void save(Poco::XML::DOMWriter& writer, std::ostream& str) const;
		/// Writes the XML document containing the configuration data
		/// to the given stream.
		///
		/// This can be used to use a DOMWriter with custom options.

protected:
	bool getRaw(const std::string& key, std::string& value) const;
	void setRaw(const std::string& key, const std::string& value);
	void enumerate(const std::string& key, Keys& range) const;
	void removeRaw(const std::string& key);
	~XMLConfiguration();

private:
	const Poco::XML::Node* findNode(const std::string& key) const;
	Poco::XML::Node* findNode(const std::string& key);
	static Poco::XML::Node* findNode(std::string::const_iterator& it, const std::string::const_iterator& end, Poco::XML::Node* pNode, bool create = false);
	static Poco::XML::Node* findElement(const std::string& name, Poco::XML::Node* pNode, bool create);
	static Poco::XML::Node* findElement(int index, Poco::XML::Node* pNode, bool create);
	static Poco::XML::Node* findElement(const std::string& attr, const std::string& value, Poco::XML::Node* pNode);
	static Poco::XML::Node* findAttribute(const std::string& name, Poco::XML::Node* pNode, bool create);

	Poco::XML::AutoPtr<Poco::XML::Node>     _pRoot;
	Poco::XML::AutoPtr<Poco::XML::Document> _pDocument;
};

} } // namespace Poco::Util

#endif // Util_XMLConfiguration_INCLUDED


text:
<?php

defined('_JEXEC') or die('Restricted access');

class EasyBlogVideoRevver
{
	private function getCode( $url )
	{
		preg_match( '/\/video\/(.*)\/(?=.)/i' , $url , $matches );

		if( !empty( $matches ) )
		{
			return $matches[1];
		}

		return false;
	}

	public function getEmbedHTML( $url , $width , $height )
	{
		$code	= $this->getCode( $url );

		if( $code )
		{
			return '<script src="http://flash.revver.com/player/1.0/player.js?mediaId:' . $code . ';width:' . $width . ';height:' . $height . ';" type="text/javascript"></script>';
		}
		return false;
	}
}


text:
include_recipe 'omnibus::prepare'
include_recipe 'omnibus::build'
include_recipe 'omnibus::package'
include_recipe 'omnibus::release'


text:
module M
  module Runners
    class Base
      def suites
        raise 'Not implemented'
      end

      def run(_test_arguments)
        raise 'Not implemented'
      end

      def test_methods(suite_class)
        suite_class.test_methods
      end
    end
  end
end


text:
package br.com.uol.pagseguro.infra;

import java.io.IOException;
import java.net.URL;
import java.util.List;

import javax.net.ssl.HttpsURLConnection;
import javax.xml.parsers.ParserConfigurationException;

import org.xml.sax.SAXException;

import br.com.uol.pagseguro.domain.Error;
import br.com.uol.pagseguro.domain.HttpError;
import br.com.uol.pagseguro.exception.PagSeguroServiceException;
import br.com.uol.pagseguro.logs.PagSeguroDummyLogger;
import br.com.uol.pagseguro.logs.Logger;
import br.com.uol.pagseguro.logs.PagSeguroLoggerFactory;
import br.com.uol.pagseguro.properties.PagSeguroSystem;
import br.com.uol.pagseguro.xmlparser.ErrorsParser;

/**
 * Encapsulates web service calls
 */
public class HttpsURLConnectionUtil {

    /**
     * PagSeguro Log tool
     * @see PagSeguroDummyLogger
     */
    static Logger log =  PagSeguroLoggerFactory.getLogger(HttpsURLConnectionUtil.class);

	private static final String HTTP_METHOD_POST = "POST";

	private static final String HTTP_METHOD_GET = "GET";

    /**
     * Creates a http connection and makes a remote call
     *
     * @param method
     * @param urlPath
     * @param contentType
     * @param xml
     * @return
     * @throws PagSeguroServiceException
     */
    private static HttpsURLConnection getHttpsURLConnection(String method, String urlPath, String contentType,
            String xml) throws PagSeguroServiceException {

        log.debug("method: " + method + ", content-type:" + contentType + ", target URL: " + urlPath);

        URL url;
        HttpsURLConnection connection;
        try {

            // Creates a connection
            url = new URL(urlPath);
            connection = (HttpsURLConnection) url.openConnection();
            connection.setRequestMethod(method);
            connection.setDoOutput(true);
            connection.setDoInput(true);
            connection.setRequestProperty("Content-type", contentType);

            // write the XML
            if (xml != null && !xml.equals("")) {
                log.debug("sending XML: " + xml);
                connection.getOutputStream().write(xml.getBytes(PagSeguroSystem.getPagSeguroEncoding()));
            }

            // handle the response
            int responseCode = connection.getResponseCode();

            if (responseCode != HttpsURLConnection.HTTP_OK) {
                if (responseCode == HttpsURLConnection.HTTP_BAD_REQUEST) {

                    List errors = ErrorsParser.readErrosXml(connection.getErrorStream());
                    log(errors);

                    throw new PagSeguroServiceException(errors, HttpError.fromValue(responseCode));
                }

                log.error("HTTP: " + responseCode + ". Error during PagSeguro API call.");
                throw new PagSeguroServiceException(HttpError.fromValue(responseCode));
            }

            log.debug("API call success: " + responseCode);

            // returns the http connection
            return connection;

        } catch (IOException e) {
            log.error("Error while parsing the response", e);
        } catch (ParserConfigurationException e) {
            log.error("Error while parsing the response", e);
        } catch (SAXException e) {
            log.error("Error while parsing the response", e);
        }

        return null;

    }

    /**
     * makes a post request in the informed URL
     *
     * @param urlPath
     * @param contentType
     * @param xml
     * @return
     * @throws PagSeguroServiceException
     */
    public static HttpsURLConnection getHttpsPostConnection(String urlPath, String contentType, String xml)
            throws PagSeguroServiceException {
        return getHttpsURLConnection(HTTP_METHOD_POST, urlPath, contentType, xml);
    }

    /**
     * makes a get request n the informed URL
     *
     * @param urlPath
     * @param contentType
     * @return
     * @throws PagSeguroServiceException
     */
    public static HttpsURLConnection getHttpsGetConnection(String urlPath, String contentType)
            throws PagSeguroServiceException {
        return getHttpsURLConnection(HTTP_METHOD_GET, urlPath, contentType, null);
    }

    private static void log(List errors) {
        String print = "HTTP: " + HttpsURLConnection.HTTP_BAD_REQUEST + ". Validation error in PagSeguro webservice: \n";

        for (int i = 0; i < errors.size(); i++) {
            Error error = (Error) errors.get(i);
            print += "> ";
            print += error.getCode() + " - " + error.getMessage();
            print += "\n";
        }

        log.error(print);
    }
}


text:
package de.ne0.sonar.plsql.plugin.core;

import org.sonar.api.batch.AbstractSourceImporter;
import org.sonar.api.batch.Phase;
import org.sonar.api.batch.SensorContext;
import org.sonar.api.resources.InputFileUtils;
import org.sonar.api.resources.ProjectFileSystem;

@Phase(name = Phase.Name.PRE)
public class PlSQLSourceImporter  extends AbstractSourceImporter {
	 public PlSQLSourceImporter(PlSQL plsql) {
		    super(plsql);
		  }

		  protected void analyse(ProjectFileSystem fileSystem, SensorContext context) {
		    parseDirs(context, InputFileUtils.toFiles(fileSystem.mainFiles(PlSQL.KEY)), fileSystem.getSourceDirs(), false, fileSystem.getSourceCharset());
		  }

		  @Override
		  public String toString() {
		    return getClass().getSimpleName();
		  }
}


text:
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Notifications extends Model
{
    protected $table = 'notifications';
    protected $fillable = ['title','content'];
}