text:
package com.company.professor;

import com.company.professor.DaoSession;
import de.greenrobot.dao.DaoException;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT. Enable "keep" sections if you want to edit.
/**
 * Entity mapped to table "conquest_pokemon_stats".
 */
public class ConquestPokemonStats {

    private long PokemonSpeciesId;
    private long ConquestStatId;
    private long BaseStat;

    /** Used to resolve relations */
    private transient DaoSession daoSession;

    /** Used for active entity operations. */
    private transient ConquestPokemonStatsDao myDao;

    private PokemonSpecies PokemonSpecies;
    private Long PokemonSpecies__resolvedKey;

    private ConquestStats ConquestStats;
    private Long ConquestStats__resolvedKey;

    public ConquestPokemonStats() {
    }

    public ConquestPokemonStats(long PokemonSpeciesId) {
        this.PokemonSpeciesId = PokemonSpeciesId;
    }

    public ConquestPokemonStats(long PokemonSpeciesId, long ConquestStatId, long BaseStat) {
        this.PokemonSpeciesId = PokemonSpeciesId;
        this.ConquestStatId = ConquestStatId;
        this.BaseStat = BaseStat;
    }

    /** called by internal mechanisms, do not call yourself. */
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getConquestPokemonStatsDao() : null;
    }

    public long getPokemonSpeciesId() {
        return PokemonSpeciesId;
    }

    public void setPokemonSpeciesId(long PokemonSpeciesId) {
        this.PokemonSpeciesId = PokemonSpeciesId;
    }

    public long getConquestStatId() {
        return ConquestStatId;
    }

    public void setConquestStatId(long ConquestStatId) {
        this.ConquestStatId = ConquestStatId;
    }

    public long getBaseStat() {
        return BaseStat;
    }

    public void setBaseStat(long BaseStat) {
        this.BaseStat = BaseStat;
    }

    /** To-one relationship, resolved on first access. */
    public PokemonSpecies getPokemonSpecies() {
        long __key = this.PokemonSpeciesId;
        if (PokemonSpecies__resolvedKey == null || !PokemonSpecies__resolvedKey.equals(__key)) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            PokemonSpeciesDao targetDao = daoSession.getPokemonSpeciesDao();
            PokemonSpecies PokemonSpeciesNew = targetDao.load(__key);
            synchronized (this) {
                PokemonSpecies = PokemonSpeciesNew;
            	PokemonSpecies__resolvedKey = __key;
            }
        }
        return PokemonSpecies;
    }

    public void setPokemonSpecies(PokemonSpecies PokemonSpecies) {
        if (PokemonSpecies == null) {
            throw new DaoException("To-one property 'PokemonSpeciesId' has not-null constraint; cannot set to-one to null");
        }
        synchronized (this) {
            this.PokemonSpecies = PokemonSpecies;
            PokemonSpeciesId = PokemonSpecies.getId();
            PokemonSpecies__resolvedKey = PokemonSpeciesId;
        }
    }

    /** To-one relationship, resolved on first access. */
    public ConquestStats getConquestStats() {
        long __key = this.ConquestStatId;
        if (ConquestStats__resolvedKey == null || !ConquestStats__resolvedKey.equals(__key)) {
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ConquestStatsDao targetDao = daoSession.getConquestStatsDao();
            ConquestStats ConquestStatsNew = targetDao.load(__key);
            synchronized (this) {
                ConquestStats = ConquestStatsNew;
            	ConquestStats__resolvedKey = __key;
            }
        }
        return ConquestStats;
    }

    public void setConquestStats(ConquestStats ConquestStats) {
        if (ConquestStats == null) {
            throw new DaoException("To-one property 'ConquestStatId' has not-null constraint; cannot set to-one to null");
        }
        synchronized (this) {
            this.ConquestStats = ConquestStats;
            ConquestStatId = ConquestStats.getId();
            ConquestStats__resolvedKey = ConquestStatId;
        }
    }

    /** Convenient call for {@link AbstractDao#delete(Object)}. Entity must attached to an entity context. */
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /** Convenient call for {@link AbstractDao#update(Object)}. Entity must attached to an entity context. */
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** Convenient call for {@link AbstractDao#refresh(Object)}. Entity must attached to an entity context. */
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

}


text:
/**
 * FILE: AuthenticationDataTest.scala
 * PERCORSO /Codice/sgad/servertier/src/test/scala/sgad/servertier/dataaccess/data/userdata
 * DATA CREAZIONE: 20 Febbraio 2014
 * AUTORE: ProTech
 * EMAIL: protech.unipd@gmail.com
 *
 * Questo file è proprietà del gruppo ProTech, viene rilasciato sotto licenza Apache v2.
 *
 * DIARIO DELLE MODIFICHE:
 * 2014-02-20 - Creazione della classe - Segantin Fabio
 */

import org.scalatest._
import sgad.servertier.dataaccess.data.userdata.AuthenticationData

/**
 * Classe di Test per la classe AuthenticationData
 */
class AuthenticationDataTest extends FlatSpec with PrivateMethodTester {
	val setHashPassword = PrivateMethod[Unit]('setHashPassword)

	"una AuthenticationDataTest" must "essere costruito solo con valori validi altrimenti lancia eccezione" in {
		intercept[IllegalArgumentException] {
			new AuthenticationData(null, "due", "tre")
		}
		intercept[IllegalArgumentException] {
			new AuthenticationData("uno", null, "tre")
		}
		intercept[IllegalArgumentException] {
			new AuthenticationData("uno", "due", null)
		}
		intercept[IllegalArgumentException] {
			new AuthenticationData("uno", null, null)
		}
		intercept[IllegalArgumentException] {
			new AuthenticationData(null, "due", null)
		}
		intercept[IllegalArgumentException] {
			new AuthenticationData(null, null, "tre")
		}
		intercept[IllegalArgumentException] {
			new AuthenticationData(null, null, null)
		}
		intercept[IllegalArgumentException] {
			new AuthenticationData("uno", "due", "tre").setHashPassword(null)
		}
		new AuthenticationData("uno", "due", "tre")
	}
	it must "mantenere la stessa email passata durante il costruttore" in {
		val authentication = new AuthenticationData("uno", "due", "tre")
		assert(authentication.getEmail == "due")
	}
	it must "mantenere lo stesso username passato al costruttore" in {
		val authentication = new AuthenticationData("uno", "due", "tre")
		assert(authentication.getUser == "uno")
	}
	it must "mantenere la hashPassword in maniera adeguata a seconda del costruttore o del metodo setter" in {
		val authentication = new AuthenticationData("uno", "due", "tre")
		assert(authentication.getHashPassword == "tre")
		val hash = authentication.getHashPassword
		authentication.setHashPassword("pippo")
		assert(hash != authentication.getHashPassword)
		assert(authentication.getHashPassword == "pippo")
		assert(authentication != hash)
	}
  it must "calcolare lo SHA-1 corretto della stringa passata in input" in {
    val authenticationData = new AuthenticationData("utente1", "passwordDiProva2014", "a9c0d4b0b3d5dbfeee15428bc9ad2c58b34748fd")
    assert(authenticationData.getHashPassword.equals(AuthenticationData.computeHash("passwordDiProva2014")))
  }
}

redpajama_set_name: RedPajamaGithub


text:
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectCodeStyleSettingsManager">
    <option name="PER_PROJECT_SETTINGS">
      <value>
        <option name="RIGHT_MARGIN" value="80" />
        <option name="WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN" value="true" />
        <Objective-C>
          <option name="INDENT_NAMESPACE_MEMBERS" value="0" />
          <option name="INDENT_DIRECTIVE_AS_CODE" value="true" />
          <option name="FUNCTION_BRACE_PLACEMENT" value="5" />
          <option name="FUNCTION_PARAMETERS_ALIGN_MULTILINE" value="false" />
          <option name="FUNCTION_CALL_ARGUMENTS_ALIGN_MULTILINE" value="false" />
          <option name="CLASS_CONSTRUCTOR_INIT_LIST_NEW_LINE_BEFORE_COLON" value="1" />
          <option name="SPACE_WITHIN_EMPTY_BRACES" value="true" />
          <option name="SPACE_AFTER_INIT_LIST_COLON" value="false" />
          <option name="SPACE_BEFORE_POINTER_IN_DECLARATION" value="false" />
          <option name="SPACE_AFTER_POINTER_IN_DECLARATION" value="true" />
          <option name="SPACE_BEFORE_REFERENCE_IN_DECLARATION" value="false" />
          <option name="SPACE_AFTER_REFERENCE_IN_DECLARATION" value="true" />
        </Objective-C>
        <Objective-C-extensions>
          <file>
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
          </file>
          <class>
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
            <option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
          </class>
          <extensions>
            <pair source="cpp" header="h" />
            <pair source="c" header="h" />
          </extensions>
        </Objective-C-extensions>
        <codeStyleSettings language="ObjectiveC">
          <option name="KEEP_BLANK_LINES_IN_DECLARATIONS" value="1" />
          <option name="KEEP_BLANK_LINES_IN_CODE" value="1" />
          <option name="ELSE_ON_NEW_LINE" value="true" />
          <option name="WHILE_ON_NEW_LINE" value="true" />
          <option name="CATCH_ON_NEW_LINE" value="true" />
          <option name="INDENT_CASE_FROM_SWITCH" value="false" />
          <option name="ALIGN_MULTILINE_BINARY_OPERATION" value="false" />
          <option name="SPACE_AROUND_MULTIPLICATIVE_OPERATORS" value="false" />
          <option name="BINARY_OPERATION_SIGN_ON_NEXT_LINE" value="true" />
          <option name="FOR_STATEMENT_WRAP" value="5" />
        </codeStyleSettings>
      </value>
    </option>
    <option name="PREFERRED_PROJECT_CODE_STYLE" value="Stroustrup modified" />
  </component>
</project>


text:
/* Note: the "good" way to implement tinyMCE would be to create a new db field type
 *
 * details = grappelliModels.RichText(...)
 *
 * This would translate into a standard textarea with a distinctive class name
 *
 * The JS would look for that class name and if it founds it it would load
 * dynamically the js required by the editor.
 *
 * That way you can have both standards and rich textarea on the same form
 * and you don't force the programmers to fiddle with JS paths in models.
 *
 * */
//(function($){
function CustomFileBrowser(field_name, url, type, win) {

    var cmsURL = "/admin/filebrowser/browse/?pop=2";
    cmsURL = cmsURL + "&type=" + type;

    tinyMCE.activeEditor.windowManager.open({
        file: cmsURL,
        width: 980,  // Your dimensions may differ - toy around with them!
        height: 500,
        resizable: "yes",
        scrollbars: "yes",
        inline: "no",  // This parameter only has an effect if you use the inlinepopups plugin!
        close_previous: "no",
    }, {
        window: win,
        input: field_name,
        editor_id: tinyMCE.selectedInstance.editorId,
    });
    return false;
}

tinyMCE.init({

    // General
    mode :              'textareas',
    theme :             'advanced',
    skin:               'grappelli',
    dialog_type:        'window',
    browsers:           'gecko,msie,safari,opera',
    editor_deselector : 'mceNoEditor',
    language:           "de",
    relative_urls:      false,
    plugins:            'advimage,advlink,fullscreen,paste,media,searchreplace,grappelli,grappelli_contextmenu,template',

    // callbackss
    file_browser_callback: 'CustomFileBrowser',

    // Layout
    width:              758,
    height:             300,
    indentation:        '10px',
    object_resizing:    false,

    // Accessibility
    cleanup_on_startup:     true,
    accessibility_warnings: false,
    remove_trailing_nbsp:   true,
    fix_list_elements :     true,
    remove_script_host:     true,

    // theme_advanced
    theme_advanced_toolbar_location: "top",
    theme_advanced_toolbar_align: "left",
    theme_advanced_statusbar_location: "bottom",
    theme_advanced_buttons1: "formatselect,styleselect,|,bold,italic,underline,|,bullist,numlist,blockquote,|,undo,redo,|,link,unlink,|,image,|,fullscreen,|,grappelli_adv",
    theme_advanced_buttons2: "search,|,pasteword,template,media,charmap,|,code,|,table,cleanup,grappelli_documentstructure",
    theme_advanced_buttons3: "",
    theme_advanced_path: false,
    theme_advanced_blockformats: "p,h2,h3,h4,pre",
    theme_advanced_styles: "[all] clearfix=clearfix;[p] small=small;[img] Image left-aligned=img_left;[img] Image left-aligned (nospace)=img_left_nospacetop;[img] Image right-aligned=img_right;[img] Image right-aligned (nospace)=img_right_nospacetop;[img] Image Block=img_block;[img] Image Block (nospace)=img_block_nospacetop;[div] column span-2=column span-2;[div] column span-4=column span-4;[div] column span-8=column span-8",
    theme_advanced_resizing : true,
    theme_advanced_resize_horizontal : false,
    theme_advanced_resizing_use_cookie : true,
    theme_advanced_styles: "Image left-aligned=img_left;Image left-aligned (nospace)=img_left_nospacetop;Image right-aligned=img_right;Image right-aligned (nospace)=img_right_nospacetop;Image Block=img_block",

    // Adv (?)
    advlink_styles: "intern=internal;extern=external",
    advimage_update_dimensions_onchange: true,

    // grappelli
    grappelli_adv_hidden: false,
    grappelli_show_documentstructure: 'on',

    // templates
    template_templates : [
        {
            title : "2 Spalten, symmetrisch",
            src : "/grappelli/tinymce/templates/2col/",
            description : "Symmetrical 2 Columns."
        },
        {
            title : "2 Spalten, symmetrisch mit Unterteilung",
            src : "/grappelli/tinymce/templates/4col/",
            description : "Asymmetrical 2 Columns: big left, small right."
        },
    ],

    // elements
    valid_elements : [
        '-p,','a[href|target=_blank|class]','-strong/-b','-em/-i','-u','-ol',
        '-ul','-li','br','img[class|src|alt=|width|height]','-h2,-h3,-h4','-pre','-blockquote','-code','-div'
    ].join(','),
    extended_valid_elements: [
        'a[name|class|href|target|title|onclick]',
        'img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name]',
        'br[clearfix]',
        '-p[class<clearfix?summary?code]',
        'h2[class<clearfix],h3[class<clearfix],h4[class<clearfix]',
        'ul[class<clearfix],ol[class<clearfix]',
        'div[class]',
        'object[align<bottom?left?middle?right?top|archive|border|class|classid'
          + "|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name"
          + "|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
          + "|onmouseout|onmouseover|onmouseup|standby|style|tabindex|title|type|usemap"
          + "|vspace|width]",
        'param[id|name|type|value|valuetype<DATA?OBJECT?REF]',
        'address'
    ].join(','),
    valid_child_elements : [
        'h1/h2/h3/h4/h5/h6/a[%itrans_na]',       'table[thead|tbody|tfoot|tr|td]',
        'strong/b/p/div/em/i/td[%itrans|#text]', 'body[%btrans|#text]'
    ].join(',')

    // custom cleanup
    // setup: function(ed) {
    //     // Gets executed before DOM to HTML string serialization
    //     ed.onBeforeGetContent.add(function(ed, o) {
    //         // State get is set when contents is extracted from editor
    //         if (o.get) {
    //             // Remove empty paragraphs (because this is bad)
    //             tinymce.each(ed.dom.select('p', o.node), function(n) {
    //                 alert(n.firstChild);
    //                 ed.dom.remove(n);
    //             });
    //             // Remove douple spaces
    //             // o.content = o.content.replace(/<(strong|b)([^>]*)>/g, '');
    //         }
    //     });
    // }
});
//}(jQuery));


text:
package rawdb

import (
	"bytes"
	"encoding/binary"
	"fmt"
	"math/big"

	"github.com/ethereum/go-ethereum/log"
	"github.com/fractalplatform/fractal/common"
	"github.com/fractalplatform/fractal/types"
	"github.com/fractalplatform/fractal/utils/rlp"
)

// ReadCanonicalHash retrieves the hash assigned to a canonical block number.
func ReadCanonicalHash(db DatabaseReader, number uint64) common.Hash {
	data, _ := db.Get(headerHashKey(number))
	if len(data) == 0 {
		return common.Hash{}
	}
	return common.BytesToHash(data)
}

// WriteCanonicalHash stores the hash assigned to a canonical block number.
func WriteCanonicalHash(db DatabaseWriter, hash common.Hash, number uint64) {
	if err := db.Put(headerHashKey(number), hash.Bytes()); err != nil {
		log.Crit("Failed to store number to hash mapping", "err", err)
	}
}

// DeleteCanonicalHash removes the number to hash canonical mapping.
func DeleteCanonicalHash(db DatabaseDeleter, number uint64) {
	if err := db.Delete(headerHashKey(number)); err != nil {
		log.Crit("Failed to delete number to hash mapping", "err", err)
	}
}

// ReadHeaderNumber returns the header number assigned to a hash.
func ReadHeaderNumber(db DatabaseReader, hash common.Hash) *uint64 {
	data, _ := db.Get(headerNumberKey(hash))
	if len(data) != 8 {
		return nil
	}
	number := binary.BigEndian.Uint64(data)
	return &number
}

// ReadHeadHeaderHash retrieves the hash of the current canonical head header.
func ReadHeadHeaderHash(db DatabaseReader) common.Hash {
	data, _ := db.Get(headHeaderKey)
	if len(data) == 0 {
		return common.Hash{}
	}
	return common.BytesToHash(data)
}

// WriteHeadHeaderHash stores the hash of the current canonical head header.
func WriteHeadHeaderHash(db DatabaseWriter, hash common.Hash) {
	if err := db.Put(headHeaderKey, hash.Bytes()); err != nil {
		log.Crit("Failed to store last header's hash", "err", err)
	}
}

// ReadIrreversibleNumber retrieves the irreversible number of chain.
func ReadIrreversibleNumber(db DatabaseReader) uint64 {
	data, err := db.Get(irreversibleNumberKey)
	if err != nil {
		log.Crit("Failed to get irreversible number ", "err", err)
	}
	if len(data) == 0 {
		return 0
	}
	return decodeBlockNumber(data)
}

// WriteIrreversibleNumber stores the irreversible number of chain.
func WriteIrreversibleNumber(db DatabaseWriter, number uint64) {
	if err := db.Put(irreversibleNumberKey, encodeBlockNumber(number)); err != nil {
		log.Crit("Failed to store irreversible number ", "err", err)
	}
}

// ReadHeadBlockHash retrieves the hash of the current canonical head block.
func ReadHeadBlockHash(db DatabaseReader) common.Hash {
	data, _ := db.Get(headBlockKey)
	if len(data) == 0 {
		return common.Hash{}
	}
	return common.BytesToHash(data)
}

// WriteHeadBlockHash stores the head block's hash.
func WriteHeadBlockHash(db DatabaseWriter, hash common.Hash) {
	if err := db.Put(headBlockKey, hash.Bytes()); err != nil {
		log.Crit("Failed to store last block's hash", "err", err)
	}
}

// ReadHeaderRLP retrieves a block header in its raw RLP database encoding.
func ReadHeaderRLP(db DatabaseReader, hash common.Hash, number uint64) rlp.RawValue {
	data, _ := db.Get(headerKey(number, hash))
	return data
}

// HasHeader verifies the existence of a block header corresponding to the hash.
func HasHeader(db DatabaseReader, hash common.Hash, number uint64) bool {
	if has, err := db.Has(headerKey(number, hash)); !has || err != nil {
		return false
	}
	return true
}

// ReadHeader retrieves the block header corresponding to the hash.
func ReadHeader(db DatabaseReader, hash common.Hash, number uint64) *types.Header {
	data := ReadHeaderRLP(db, hash, number)
	if len(data) == 0 {
		return nil
	}
	header := new(types.Header)
	if err := rlp.Decode(bytes.NewReader(data), header); err != nil {
		log.Crit("Invalid block header RLP", "hash", hash, "err", err)
		return nil
	}
	return header
}

// WriteHeader stores a block header into the database and also stores the hash-
// to-number mapping.
func WriteHeader(db DatabaseWriter, header *types.Header) {
	// Write the hash -> number mapping
	var (
		hash    = header.Hash()
		number  = header.Number.Uint64()
		encoded = encodeBlockNumber(number)
	)
	key := headerNumberKey(hash)
	if err := db.Put(key, encoded); err != nil {
		log.Crit("Failed to store hash to number mapping", "err", err)
	}
	// Write the encoded header
	data, err := rlp.EncodeToBytes(header)
	if err != nil {
		log.Crit("Failed to RLP encode header", "err", err)
	}
	key = headerKey(number, hash)
	if err := db.Put(key, data); err != nil {
		log.Crit("Failed to store header", "err", err)
	}
}

// DeleteHeader removes all block header data associated with a hash.
func DeleteHeader(db DatabaseDeleter, hash common.Hash, number uint64) {
	if err := db.Delete(headerKey(number, hash)); err != nil {
		log.Crit("Failed to delete header", "err", err)
	}
	if err := db.Delete(headerNumberKey(hash)); err != nil {
		log.Crit("Failed to delete hash to number mapping", "err", err)
	}
}

// ReadBodyRLP retrieves the block body (transactions and uncles) in RLP encoding.
func ReadBodyRLP(db DatabaseReader, hash common.Hash, number uint64) rlp.RawValue {
	data, _ := db.Get(blockBodyKey(number, hash))
	return data
}

// WriteBodyRLP stores an RLP encoded block body into the database.
func WriteBodyRLP(db DatabaseWriter, hash common.Hash, number uint64, rlp rlp.RawValue) {
	if err := db.Put(blockBodyKey(number, hash), rlp); err != nil {
		log.Crit("Failed to store block body", "err", err)
	}
}

// HasBody verifies the existence of a block body corresponding to the hash.
func HasBody(db DatabaseReader, hash common.Hash, number uint64) bool {
	if has, err := db.Has(blockBodyKey(number, hash)); !has || err != nil {
		return false
	}
	return true
}

// ReadBody retrieves the block body corresponding to the hash.
func ReadBody(db DatabaseReader, hash common.Hash, number uint64) *types.Body {
	data := ReadBodyRLP(db, hash, number)
	if len(data) == 0 {
		return nil
	}
	body := new(types.Body)
	if err := rlp.Decode(bytes.NewReader(data), body); err != nil {
		log.Error("Invalid block body RLP", "hash", hash, "err", err)
		return nil
	}
	return body
}

// WriteBody storea a block body into the database.
func WriteBody(db DatabaseWriter, hash common.Hash, number uint64, body *types.Body) {
	data, err := rlp.EncodeToBytes(body)
	if err != nil {
		log.Crit("Failed to RLP encode body", "err", err)
	}
	WriteBodyRLP(db, hash, number, data)
}

// DeleteBody removes all block body data associated with a hash.
func DeleteBody(db DatabaseDeleter, hash common.Hash, number uint64) {
	if err := db.Delete(blockBodyKey(number, hash)); err != nil {
		log.Crit("Failed to delete block body", "err", err)
	}
}

// ReadBlock retrieves an entire block corresponding to the hash, assembling it
// back from the stored header and body. If either the header or body could not
// be retrieved nil is returned.
//
// Note, due to concurrent download of header and block body the header and thus
// canonical hash can be stored in the database but the body data not (yet).
func ReadBlock(db DatabaseReader, hash common.Hash, number uint64) *types.Block {
	header := ReadHeader(db, hash, number)
	if header == nil {
		return nil
	}
	body := ReadBody(db, hash, number)
	if body == nil {
		return nil
	}
	return types.NewBlockWithHeader(header).WithBody(body.Transactions)
}

// WriteBlock serializes a block into the database, header and body separately.
func WriteBlock(db DatabaseWriter, block *types.Block) {
	WriteBody(db, block.Hash(), block.NumberU64(), block.Body())
	WriteHeader(db, block.Header())
}

// DeleteBlock removes all block data associated with a hash.
func DeleteBlock(db DatabaseDeleter, hash common.Hash, number uint64) {
	DeleteReceipts(db, hash, number)
	DeleteDetailTxs(db, hash, number)
	DeleteHeader(db, hash, number)
	DeleteBody(db, hash, number)
	DeleteTd(db, hash, number)
}

// ReadTd retrieves a block's total difficulty corresponding to the hash.
func ReadTd(db DatabaseReader, hash common.Hash, number uint64) *big.Int {
	data, _ := db.Get(headerTDKey(number, hash))
	if len(data) == 0 {
		return nil
	}
	td := new(big.Int)
	if err := rlp.Decode(bytes.NewReader(data), td); err != nil {
		log.Crit("Invalid block total difficulty RLP", "hash", hash, "err", err)
		return nil
	}
	return td
}

// WriteTd stores the total difficulty of a block into the database.
func WriteTd(db DatabaseWriter, hash common.Hash, number uint64, td *big.Int) {
	data, err := rlp.EncodeToBytes(td)
	if err != nil {
		log.Crit("Failed to RLP encode block total difficulty", "err", err)
	}
	if err := db.Put(headerTDKey(number, hash), data); err != nil {
		log.Crit("Failed to store block total difficulty", "err", err)
	}
}

// DeleteTd removes all block total difficulty data associated with a hash.
func DeleteTd(db DatabaseDeleter, hash common.Hash, number uint64) {
	if err := db.Delete(headerTDKey(number, hash)); err != nil {
		log.Crit("Failed to delete block total difficulty", "err", err)
	}
}

// ReadReceipts retrieves all the transaction receipts belonging to a block.
func ReadReceipts(db DatabaseReader, hash common.Hash, number uint64) []*types.Receipt {
	// Retrieve the flattened receipt slice
	data, _ := db.Get(blockReceiptsKey(number, hash))
	if len(data) == 0 {
		return nil
	}
	// Convert the revceipts from their storage form to their internal representation
	storageReceipts := []*types.Receipt{}
	if err := rlp.DecodeBytes(data, &storageReceipts); err != nil {
		fmt.Println("Invalid receipt array RLP", "hash", hash.String(), "err", err)
		return nil
	}
	receipts := make([]*types.Receipt, len(storageReceipts))
	for i, receipt := range storageReceipts {
		receipts[i] = (*types.Receipt)(receipt)
	}
	return receipts
}

// WriteReceipts stores all the transaction receipts belonging to a block.
func WriteReceipts(db DatabaseWriter, hash common.Hash, number uint64, receipts []*types.Receipt) {
	// Convert the receipts into their storage form and serialize them
	storageReceipts := make([]*types.Receipt, len(receipts))
	for i, receipt := range receipts {
		storageReceipts[i] = (*types.Receipt)(receipt)
	}
	bytes, err := rlp.EncodeToBytes(storageReceipts)
	if err != nil {
		log.Crit("Failed to encode block receipts", "err", err)
	}
	// Store the flattened receipt slice
	if err := db.Put(blockReceiptsKey(number, hash), bytes); err != nil {
		log.Crit("Failed to store block receipts", "err", err)
	}
}

// DeleteReceipts removes all receipt data associated with a block hash.
func DeleteReceipts(db DatabaseDeleter, hash common.Hash, number uint64) {
	if err := db.Delete(blockReceiptsKey(number, hash)); err != nil {
		log.Crit("Failed to delete block receipts", "err", err)
	}
}

// ReadDetailTxs retrieves all the contract log belonging to a block.
func ReadDetailTxs(db DatabaseReader, hash common.Hash, number uint64) []*types.DetailTx {
	// Retrieve the flattened receipt slice
	data, _ := db.Get(blockDetailTxsKey(number, hash))
	if len(data) == 0 {
		return nil
	}
	// Convert the revceipts from their storage form to their internal representation
	storageDetailTxs := []*types.DetailTx{}
	if err := rlp.DecodeBytes(data, &storageDetailTxs); err != nil {
		fmt.Println("Invalid detailtxs array RLP", "hash", hash.String(), "err", err)
		return nil
	}
	detailtxs := make([]*types.DetailTx, len(storageDetailTxs))
	for i, detailtx := range storageDetailTxs {
		detailtxs[i] = (*types.DetailTx)(detailtx)
	}
	return detailtxs
}

// WriteDetailTxs stores all the contract log belonging to a block.
func WriteDetailTxs(db DatabaseWriter, hash common.Hash, number uint64, dtxs []*types.DetailTx) {
	// Convert the receipts into their storage form and serialize them
	storageDetailTxs := make([]*types.DetailTx, len(dtxs))
	for i, dtx := range dtxs {
		storageDetailTxs[i] = (*types.DetailTx)(dtx)
	}
	bytes, err := rlp.EncodeToBytes(storageDetailTxs)
	if err != nil {
		log.Crit("Failed to encode block detailtxs", "err", err)
	}
	// Store the flattened receipt slice
	if err := db.Put(blockDetailTxsKey(number, hash), bytes); err != nil {
		log.Crit("Failed to store block detailtxs", "err", err)
	}
}

// DeleteDetailTxs removes all contract log data associated with a block hash.
func DeleteDetailTxs(db DatabaseDeleter, hash common.Hash, number uint64) {
	if err := db.Delete(blockDetailTxsKey(number, hash)); err != nil {
		log.Crit("Failed to delete block detailtxs", "err", err)
	}
}

// FindCommonAncestor returns the last common ancestor of two block headers
func FindCommonAncestor(db DatabaseReader, a, b *types.Header) *types.Header {
	for bn := b.Number.Uint64(); a.Number.Uint64() > bn; {
		a = ReadHeader(db, a.ParentHash, a.Number.Uint64()-1)
		if a == nil {
			return nil
		}
	}
	for an := a.Number.Uint64(); an < b.Number.Uint64(); {
		b = ReadHeader(db, b.ParentHash, b.Number.Uint64()-1)
		if b == nil {
			return nil
		}
	}
	for a.Hash() != b.Hash() {
		a = ReadHeader(db, a.ParentHash, a.Number.Uint64()-1)
		if a == nil {
			return nil
		}
		b = ReadHeader(db, b.ParentHash, b.Number.Uint64()-1)
		if b == nil {
			return nil
		}
	}
	return a
}

//WriteBlockStateOut block state operate for db
func WriteBlockStateOut(db DatabaseWriter, hash common.Hash, stateOut *types.StateOut) {
	data, err := rlp.EncodeToBytes(stateOut)
	if err != nil {
		log.Crit("Failed to RLP encode state out", "err", err)
	}
	if err := db.Put(blockStateOutKey(hash), data); err != nil {
		log.Crit("Failed to store block state out", "err", err)
	}
}

func ReadBlockStateOut(db DatabaseReader, hash common.Hash) *types.StateOut {
	data, _ := db.Get(blockStateOutKey(hash))
	if len(data) == 0 {
		return nil
	}
	stateOut := new(types.StateOut)
	if err := rlp.Decode(bytes.NewReader(data), stateOut); err != nil {
		log.Crit("Invalid block state RLP", "hash", hash, "err", err)
		return nil
	}
	return stateOut
}

func DeleteBlockStateOut(db DatabaseDeleter, hash common.Hash) {
	if err := db.Delete(blockStateOutKey(hash)); err != nil {
		log.Crit("Failed to delete block state", "err", err)
	}
}

func WriteOptBlockHash(db DatabaseWriter, hash common.Hash) {
	if err := db.Put(blockOptHash, hash.Bytes()); err != nil {
		log.Crit("Failed to store last opt block's hash", "err", err)
	}
}

func ReadOptBlockHash(db DatabaseReader) common.Hash {
	data, _ := db.Get(blockOptHash)
	if len(data) == 0 {
		return common.Hash{}
	}
	return common.BytesToHash(data)
}

func WriteSnapshot(db DatabaseWriter, key types.SnapshotBlock, snapshotInfo types.SnapshotInfo) {
	keyEnc, err := rlp.EncodeToBytes(key)
	if err != nil {
		log.Crit("Failed to RLP encode snapshotBlock", "err", err)
	}

	snapshotInfoEnc, err := rlp.EncodeToBytes(snapshotInfo)
	if err != nil {
		log.Crit("Failed to RLP encode snapshotInfo", "err", err)
	}

	if err := db.Put(blockSnapshotKey(keyEnc), snapshotInfoEnc); err != nil {
		log.Crit("Failed to store block snapshotInfo", "err", err)
	}
}

func ReadSnapshot(db DatabaseReader, key types.SnapshotBlock) *types.SnapshotInfo {
	keyEnc, err := rlp.EncodeToBytes(key)
	if err != nil {
		log.Crit("Failed to RLP encode snapshotBlock", "err", err)
	}

	snapshotInfoEnc, _ := db.Get(blockSnapshotKey(keyEnc))
	if len(snapshotInfoEnc) == 0 {
		return nil
	}

	snapshotInfo := new(types.SnapshotInfo)
	if err := rlp.Decode(bytes.NewReader(snapshotInfoEnc), snapshotInfo); err != nil {
		log.Crit("Invalid block snapshotInfo RLP", "number", key.Number, "hash", key.BlockHash, "err", err)
		return nil
	}
	return snapshotInfo
}


text:
#ifndef DEVSIM_READER_HH
#define DEVSIM_READER_HH
#include <string>
#include <cstddef>

//TODO: ensure stack size can trigger realloc

namespace dsMesh {
class DevsimLoader;
typedef DevsimLoader   *DevsimLoaderPtr;

class MeshRegion;
typedef MeshRegion   *MeshRegionPtr;

class MeshContact;
typedef MeshContact   *MeshContactPtr;

class MeshInterface;
typedef MeshInterface   *MeshInterfacePtr;

class Solution;
typedef Solution   *SolutionPtr;

class Equation;
typedef Equation   *EquationPtr;
}

namespace dsDevsimParse {
extern int meshlineno;
extern dsMesh::DevsimLoaderPtr    DevsimLoader;
extern dsMesh::MeshRegionPtr    MeshRegion;
extern dsMesh::MeshContactPtr   MeshContact;
extern dsMesh::MeshInterfacePtr MeshInterface;
extern dsMesh::SolutionPtr      Sol;
extern dsMesh::EquationPtr      Equation;
extern std::string errors;

void DeletePointers();

bool LoadMeshes(const std::string &/*filename*/, std::string &/*errorString*/);
}

#endif


text:
namespace Mall.Staff
{
    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Linq;

    using Mall.Goods;
    using Mall.SpaceHolder;
    using Mall.Interfaces;
    using Mall.Common;
    using Mall.Basic;

    class HRM : ManagmentWorkers
    {
        private List<BaseWorker> staff;

        public List<BaseWorker> Staff
        {
            get { return this.staff; }
        }

        /// <summary>
        /// Creating new HR with new list of Baseworkers
        /// </summary>
        public HRM(string name, byte age, Sex gender, decimal money, decimal salary, int workhours, int skill, Uniform uniform)
            :base(name,age,gender,money,salary,workhours,skill,uniform,ManagementType.HR)
        {
            this.staff = new List<BaseWorker>();
        }
        /// <summary>
        /// Asigns new HR and give it the current list of staff
        /// </summary>
        /// <param name="oldList">the current list of staff</param>
        public HRM(string name, byte age, Sex gender, decimal money, decimal salary, int workhours, int skill, Uniform uniform, List<BaseWorkervar> oldList)
            : base(name, age, gender, money, salary, workhours, skill, uniform, ManagementType.HR)
        {
            this.staff = oldList;
        }

        public void GetCompanyWorkers(SpaceHolder spaceholder)
        {
            staff = spaceholder.Employees;
        }

        public void HireCleaner()
        {
            var cleaner = HuamanGenerator.CreateCleaner();
        }

        public void HireSecurity()
        {
            var security = HuamanGenerator.CreateSecurity();
            this.staff.Add(security);
        }

        public void HirePromoter()
        {
            var promoter = HuamanGenerator.CreatePromoter();
            this.staff.Add(promoter);
        }

        public void Fire(string name, byte age)
        {
            var maches = this.Staff.FindAll(empl => ((empl.Name == name) && (empl.Age == age)));

            foreach (var item in maches)
            {
                this.Staff.Remove(item);
                Console.WriteLine("Employee {0} who is {1} age old is fired!", name, age);
            }
        }

        public void GiveSmallPrommotion(BaseWorker employee)
        {

            employee.SmallPromotion();
        }

        public void GiveBigPromotion(Employee employee)
        {
            employee.BigPromotion();
        }

        public void PrintAllWorkers(SpaceHolder spaceholder)
        {
            Console.WriteLine("List of workers of {0}", spaceholder.Company.CompanyName);
            var employeelist = spaceholder.Employees;
            foreach (var item in employeelist)
            {
                Console.WriteLine(item.ToString());
            }
        }
    }
}


text: sudo apt-get install --only-upgrade libcommons-httpclient-java=3.1-10ubuntu0.1 -y


text:
package com.vaadin.v7.data.util;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import com.vaadin.data.provider.DataProvider;
import com.vaadin.v7.data.Container;
import com.vaadin.v7.data.Item;
import com.vaadin.v7.data.Property;

/**
 *

 * A wrapper class for adding external ordering to containers not implementing
 * the {@link Container.Ordered} interface.
 *

 *
 *

 * If the wrapped container is changed directly (that is, not through the
 * wrapper), and does not implement Container.ItemSetChangeNotifier and/or
 * Container.PropertySetChangeNotifier the hierarchy information must be updated
 * with the {@link #updateOrderWrapper()} method.
 *

 *
 * @author Vaadin Ltd.
 * @since 3.0
 *
 * @deprecated As of 8.0, replaced by {@link DataProvider}
 */
@Deprecated
@SuppressWarnings("serial")
public class ContainerOrderedWrapper implements Container.Ordered,
        Container.ItemSetChangeNotifier, Container.PropertySetChangeNotifier {

    /**
     * The wrapped container
     */
    private final Container container;

    /**
     * Ordering information, i.e. the mapping from Item ID to the next item ID.
     * The last item id should not be present
     */
    private Map<Object, Object> next;

    /**
     * Reverse ordering information for convenience and performance reasons. The
     * first item id should not be present
     */
    private Map<Object, Object> prev;

    /**
     * ID of the first Item in the container.
     */
    private Object first;

    /**
     * ID of the last Item in the container.
     */
    private Object last;

    /**
     * Is the wrapped container ordered by itself, i.e. does it implement the
     * Container.Ordered interface by itself? If it does, this class will use
     * the methods of the underlying container directly.
     */
    private boolean ordered = false;

    /**
     * The last known size of the wrapped container. Used to check whether items
     * have been added or removed to the wrapped container, when the wrapped
     * container does not send ItemSetChangeEvents.
     */
    private int lastKnownSize = -1;

    /**
     * Constructs a new ordered wrapper for an existing Container. Works even if
     * the to-be-wrapped container already implements the Container.Ordered
     * interface.
     *
     * @param toBeWrapped
     *            the container whose contents need to be ordered.
     */
    public ContainerOrderedWrapper(Container toBeWrapped) {

        container = toBeWrapped;
        ordered = container instanceof Container.Ordered;

        // Checks arguments
        if (container == null) {
            throw new NullPointerException("Null can not be wrapped");
        }

        // Creates initial order if needed
        updateOrderWrapper();
    }

    /**
     * Removes the specified Item from the wrapper's internal hierarchy
     * structure.
     *

     * Note : The Item is not removed from the underlying Container.
     *

     *
     * @param id
     *            the ID of the Item to be removed from the ordering.
     */
    private void removeFromOrderWrapper(Object id) {
        if (id != null) {
            final Object pid = prev.get(id);
            final Object nid = next.get(id);
            if (first.equals(id)) {
                first = nid;
            }
            if (last.equals(id)) {
                last = pid;
            }
            if (nid != null) {
                if (pid == null) {
                    prev.remove(nid);
                } else {
                    prev.put(nid, pid);
                }
            }
            if (pid != null) {
                if (nid == null) {
                    next.remove(pid);
                } else {
                    next.put(pid, nid);
                }
            }
            next.remove(id);
            prev.remove(id);
        }
    }

    /**
     * Registers the specified Item to the last position in the wrapper's
     * internal ordering. The underlying container is not modified.
     *
     * @param id
     *            the ID of the Item to be added to the ordering.
     */
    private void addToOrderWrapper(Object id) {

        // Adds the if to tail
        if (last != null) {
            next.put(last, id);
            prev.put(id, last);
            last = id;
        } else {
            first = last = id;
        }
    }

    /**
     * Registers the specified Item after the specified itemId in the wrapper's
     * internal ordering. The underlying container is not modified. Given item
     * id must be in the container, or must be null.
     *
     * @param id
     *            the ID of the Item to be added to the ordering.
     * @param previousItemId
     *            the Id of the previous item.
     */
    private void addToOrderWrapper(Object id, Object previousItemId) {

        if (last == previousItemId || last == null) {
            addToOrderWrapper(id);
        } else {
            if (previousItemId == null) {
                next.put(id, first);
                prev.put(first, id);
                first = id;
            } else {
                prev.put(id, previousItemId);
                next.put(id, next.get(previousItemId));
                prev.put(next.get(previousItemId), id);
                next.put(previousItemId, id);
            }
        }
    }

    /**
     * Updates the wrapper's internal ordering information to include all Items
     * in the underlying container.
     *

     * Note : If the contents of the wrapped container change without the
     * wrapper's knowledge, this method needs to be called to update the
     * ordering information of the Items.
     *

     */
    public void updateOrderWrapper() {

        if (!ordered) {

            final Collection<?> ids = container.getItemIds();

            // Recreates ordering if some parts of it are missing
            if (next == null || first == null || last == null || prev == null) {
                first = null;
                last = null;
                next = new Hashtable<Object, Object>();
                prev = new Hashtable<Object, Object>();
            }

            // Filter out all the missing items
            final LinkedList<?> l = new LinkedList<Object>(next.keySet());
            for (final Object id : l) {
                if (!container.containsId(id)) {
                    removeFromOrderWrapper(id);
                }
            }

            // Adds missing items
            for (final Object id : ids) {
                if (!next.containsKey(id) && last != id) {
                    addToOrderWrapper(id);
                }
            }
        }
    }

    /*
     * Gets the first item stored in the ordered container Don't add a JavaDoc
     * comment here, we use the default documentation from implemented
     * interface.
     */
    @Override
    public Object firstItemId() {
        if (ordered) {
            return ((Container.Ordered) container).firstItemId();
        }
        return first;
    }

    /*
     * Tests if the given item is the first item in the container Don't add a
     * JavaDoc comment here, we use the default documentation from implemented
     * interface.
     */
    @Override
    public boolean isFirstId(Object itemId) {
        if (ordered) {
            return ((Container.Ordered) container).isFirstId(itemId);
        }
        return first != null && first.equals(itemId);
    }

    /*
     * Tests if the given item is the last item in the container Don't add a
     * JavaDoc comment here, we use the default documentation from implemented
     * interface.
     */
    @Override
    public boolean isLastId(Object itemId) {
        if (ordered) {
            return ((Container.Ordered) container).isLastId(itemId);
        }
        return last != null && last.equals(itemId);
    }

    /*
     * Gets the last item stored in the ordered container Don't add a JavaDoc
     * comment here, we use the default documentation from implemented
     * interface.
     */
    @Override
    public Object lastItemId() {
        if (ordered) {
            return ((Container.Ordered) container).lastItemId();
        }
        return last;
    }

    /*
     * Gets the item that is next from the specified item. Don't add a JavaDoc
     * comment here, we use the default documentation from implemented
     * interface.
     */
    @Override
    public Object nextItemId(Object itemId) {
        if (ordered) {
            return ((Container.Ordered) container).nextItemId(itemId);
        }
        if (itemId == null) {
            return null;
        }
        return next.get(itemId);
    }

    /*
     * Gets the item that is previous from the specified item. Don't add a
     * JavaDoc comment here, we use the default documentation from implemented
     * interface.
     */
    @Override
    public Object prevItemId(Object itemId) {
        if (ordered) {
            return ((Container.Ordered) container).prevItemId(itemId);
        }
        if (itemId == null) {
            return null;
        }
        return prev.get(itemId);
    }

    /**
     * Registers a new Property to all Items in the Container.
     *
     * @param propertyId
     *            the ID of the new Property.
     * @param type
     *            the Data type of the new Property.
     * @param defaultValue
     *            the value all created Properties are initialized to.
     * @return true if the operation succeeded, false
     *         if not
     */
    @Override
    public boolean addContainerProperty(Object propertyId, Class<?> type,
            Object defaultValue) throws UnsupportedOperationException {

        return container.addContainerProperty(propertyId, type, defaultValue);
    }

    /**
     * Creates a new Item into the Container, assigns it an automatic ID, and
     * adds it to the ordering.
     *
     * @return the autogenerated ID of the new Item or null if the
     *         operation failed
     * @throws UnsupportedOperationException
     *             if the addItem is not supported.
     */
    @Override
    public Object addItem() throws UnsupportedOperationException {

        final Object id = container.addItem();
        if (!ordered && id != null) {
            addToOrderWrapper(id);
        }
        return id;
    }

    /**
     * Registers a new Item by its ID to the underlying container and to the
     * ordering.
     *
     * @param itemId
     *            the ID of the Item to be created.
     * @return the added Item or null if the operation failed
     * @throws UnsupportedOperationException
     *             if the addItem is not supported.
     */
    @Override
    public Item addItem(Object itemId) throws UnsupportedOperationException {
        final Item item = container.addItem(itemId);
        if (!ordered && item != null) {
            addToOrderWrapper(itemId);
        }
        return item;
    }

    /**
     * Removes all items from the underlying container and from the ordering.
     *
     * @return true if the operation succeeded, otherwise
     *         false
     * @throws UnsupportedOperationException
     *             if the removeAllItems is not supported.
     */
    @Override
    public boolean removeAllItems() throws UnsupportedOperationException {
        final boolean success = container.removeAllItems();
        if (!ordered && success) {
            first = last = null;
            next.clear();
            prev.clear();
        }
        return success;
    }

    /**
     * Removes an Item specified by the itemId from the underlying container and
     * from the ordering.
     *
     * @param itemId
     *            the ID of the Item to be removed.
     * @return true if the operation succeeded, false
     *         if not
     * @throws UnsupportedOperationException
     *             if the removeItem is not supported.
     */
    @Override
    public boolean removeItem(Object itemId)
            throws UnsupportedOperationException {

        final boolean success = container.removeItem(itemId);
        if (!ordered && success) {
            removeFromOrderWrapper(itemId);
        }
        return success;
    }

    /**
     * Removes the specified Property from the underlying container and from the
     * ordering.
     *

     * Note : The Property will be removed from all the Items in the Container.
     *

     *
     * @param propertyId
     *            the ID of the Property to remove.
     * @return true if the operation succeeded, false
     *         if not
     * @throws UnsupportedOperationException
     *             if the removeContainerProperty is not supported.
     */
    @Override
    public boolean removeContainerProperty(Object propertyId)
            throws UnsupportedOperationException {
        return container.removeContainerProperty(propertyId);
    }

    /*
     * Does the container contain the specified Item? Don't add a JavaDoc
     * comment here, we use the default documentation from implemented
     * interface.
     */
    @Override
    public boolean containsId(Object itemId) {
        return container.containsId(itemId);
    }

    /*
     * Gets the specified Item from the container. Don't add a JavaDoc comment
     * here, we use the default documentation from implemented interface.
     */
    @Override
    public Item getItem(Object itemId) {
        return container.getItem(itemId);
    }

    /*
     * Gets the ID's of all Items stored in the Container Don't add a JavaDoc
     * comment here, we use the default documentation from implemented
     * interface.
     */
    @Override
    public Collection<?> getItemIds() {
        if (ordered) {
            return ((Container.Ordered) container).getItemIds();
        } else if (first == null) {
            return new ArrayList<Object>();
        } else {
            List<Object> itemIds = new ArrayList<Object>();
            itemIds.add(first);
            Object current = first;
            while (next.containsKey(current)) {
                current = next.get(current);
                itemIds.add(current);
            }
            return itemIds;
        }

    }

    /*
     * Gets the Property identified by the given itemId and propertyId from the
     * Container Don't add a JavaDoc comment here, we use the default
     * documentation from implemented interface.
     */
    @Override
    public Property getContainerProperty(Object itemId, Object propertyId) {
        return container.getContainerProperty(itemId, propertyId);
    }

    /*
     * Gets the ID's of all Properties stored in the Container Don't add a
     * JavaDoc comment here, we use the default documentation from implemented
     * interface.
     */
    @Override
    public Collection<?> getContainerPropertyIds() {
        return container.getContainerPropertyIds();
    }

    /*
     * Gets the data type of all Properties identified by the given Property ID.
     * Don't add a JavaDoc comment here, we use the default documentation from
     * implemented interface.
     */
    @Override
    public Class<?> getType(Object propertyId) {
        return container.getType(propertyId);
    }

    /*
     * Gets the number of Items in the Container. Don't add a JavaDoc comment
     * here, we use the default documentation from implemented interface.
     */
    @Override
    public int size() {
        int newSize = container.size();
        assert newSize >= 0;
        if (lastKnownSize != -1 && newSize != lastKnownSize
                && !(container instanceof Container.ItemSetChangeNotifier)) {
            // Update the internal cache when the size of the container changes
            // and the container is incapable of sending ItemSetChangeEvents
            updateOrderWrapper();
        }
        lastKnownSize = newSize;
        return newSize;
    }

    /*
     * Registers a new Item set change listener for this Container. Don't add a
     * JavaDoc comment here, we use the default documentation from implemented
     * interface.
     */
    @Override
    public void addItemSetChangeListener(
            Container.ItemSetChangeListener listener) {
        if (container instanceof Container.ItemSetChangeNotifier) {
            ((Container.ItemSetChangeNotifier) container)
                    .addItemSetChangeListener(new PiggybackListener(listener));
        }
    }

    /**
     * @deprecated As of 7.0, replaced by
     *             {@link #addItemSetChangeListener(Container.ItemSetChangeListener)}
     */
    @Override
    @Deprecated
    public void addListener(Container.ItemSetChangeListener listener) {
        addItemSetChangeListener(listener);
    }

    /*
     * Removes a Item set change listener from the object. Don't add a JavaDoc
     * comment here, we use the default documentation from implemented
     * interface.
     */
    @Override
    public void removeItemSetChangeListener(
            Container.ItemSetChangeListener listener) {
        if (container instanceof Container.ItemSetChangeNotifier) {
            ((Container.ItemSetChangeNotifier) container)
                    .removeItemSetChangeListener(
                            new PiggybackListener(listener));
        }
    }

    /**
     * @deprecated As of 7.0, replaced by
     *             {@link #removeItemSetChangeListener(Container.ItemSetChangeListener)}
     */
    @Override
    @Deprecated
    public void removeListener(Container.ItemSetChangeListener listener) {
        removeItemSetChangeListener(listener);
    }

    /*
     * Registers a new Property set change listener for this Container. Don't
     * add a JavaDoc comment here, we use the default documentation from
     * implemented interface.
     */
    @Override
    public void addPropertySetChangeListener(
            Container.PropertySetChangeListener listener) {
        if (container instanceof Container.PropertySetChangeNotifier) {
            ((Container.PropertySetChangeNotifier) container)
                    .addPropertySetChangeListener(
                            new PiggybackListener(listener));
        }
    }

    /**
     * @deprecated As of 7.0, replaced by
     *             {@link #addPropertySetChangeListener(Container.PropertySetChangeListener)}
     */
    @Override
    @Deprecated
    public void addListener(Container.PropertySetChangeListener listener) {
        addPropertySetChangeListener(listener);
    }

    /*
     * Removes a Property set change listener from the object. Don't add a
     * JavaDoc comment here, we use the default documentation from implemented
     * interface.
     */
    @Override
    public void removePropertySetChangeListener(
            Container.PropertySetChangeListener listener) {
        if (container instanceof Container.PropertySetChangeNotifier) {
            ((Container.PropertySetChangeNotifier) container)
                    .removePropertySetChangeListener(
                            new PiggybackListener(listener));
        }
    }

    /**
     * @deprecated As of 7.0, replaced by
     *             {@link #removePropertySetChangeListener(Container.PropertySetChangeListener)}
     */
    @Override
    @Deprecated
    public void removeListener(Container.PropertySetChangeListener listener) {
        removePropertySetChangeListener(listener);
    }

    @Override
    public Item addItemAfter(Object previousItemId, Object newItemId)
            throws UnsupportedOperationException {

        // If the previous item is not in the container, fail
        if (previousItemId != null && !containsId(previousItemId)) {
            return null;
        }

        // Adds the item to container
        final Item item = container.addItem(newItemId);

        // Puts the new item to its correct place
        if (!ordered && item != null) {
            addToOrderWrapper(newItemId, previousItemId);
        }

        return item;
    }

    @Override
    public Object addItemAfter(Object previousItemId)
            throws UnsupportedOperationException {

        // If the previous item is not in the container, fail
        if (previousItemId != null && !containsId(previousItemId)) {
            return null;
        }

        // Adds the item to container
        final Object id = container.addItem();

        // Puts the new item to its correct place
        if (!ordered && id != null) {
            addToOrderWrapper(id, previousItemId);
        }

        return id;
    }

    /**
     * This listener 'piggybacks' on the real listener in order to update the
     * wrapper when needed. It proxies equals() and hashCode() to the real
     * listener so that the correct listener gets removed.
     *
     */
    private class PiggybackListener
            implements Container.PropertySetChangeListener,
            Container.ItemSetChangeListener {

        Object listener;

        public PiggybackListener(Object realListener) {
            listener = realListener;
        }

        @Override
        public void containerItemSetChange(ItemSetChangeEvent event) {
            updateOrderWrapper();
            ((Container.ItemSetChangeListener) listener)
                    .containerItemSetChange(event);

        }

        @Override
        public void containerPropertySetChange(PropertySetChangeEvent event) {
            updateOrderWrapper();
            ((Container.PropertySetChangeListener) listener)
                    .containerPropertySetChange(event);

        }

        @Override
        public boolean equals(Object obj) {
            return obj == listener || (obj != null && obj.equals(listener));
        }

        @Override
        public int hashCode() {
            return listener.hashCode();
        }

    }

}


text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for license information.

using AzureRedisCache.Tests.ScenarioTests;
using Microsoft.Azure;
using Microsoft.Azure.Management.Redis;
using Microsoft.Azure.Management.Redis.Models;
using Microsoft.Azure.Test;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace AzureRedisCache.Tests
{
    public class CreateUpdateDeleteFunctionalTests : TestBase, IClassFixture<TestsFixture>
    {
        private TestsFixture fixture;

        public CreateUpdateDeleteFunctionalTests(TestsFixture data)
        {
            fixture = data;
        }

        [Fact]
        public void CreateUpdateDeleteTest()
        {
            using (var context = MockContext.Start(this.GetType().FullName))
            {
                var _client = RedisCacheManagementTestUtilities.GetRedisManagementClient(this, context);

                var responseCreate = _client.Redis.Create(resourceGroupName: fixture.ResourceGroupName, name: fixture.RedisCacheName,
                                        parameters: new RedisCreateParameters
                                        {
                                            Location = RedisCacheManagementHelper.Location,
                                            Sku = new Sku()
                                            {
                                                Name = SkuName.Basic,
                                                Family = SkuFamily.C,
                                                Capacity = 0
                                            }
                                        });

                Assert.Contains(fixture.RedisCacheName, responseCreate.Id);
                Assert.Equal(RedisCacheManagementHelper.Location, responseCreate.Location);
                Assert.Equal(fixture.RedisCacheName, responseCreate.Name);
                Assert.Equal("Microsoft.Cache/Redis", responseCreate.Type);

                Assert.Equal("succeeded", responseCreate.ProvisioningState, ignoreCase: true);
                Assert.Equal(SkuName.Basic, responseCreate.Sku.Name);
                Assert.Equal(SkuFamily.C, responseCreate.Sku.Family);
                Assert.Equal(0, responseCreate.Sku.Capacity);

                Assert.Contains(fixture.RedisCacheName, responseCreate.HostName);
                Assert.Equal(6379, responseCreate.Port);
                Assert.Equal(6380, responseCreate.SslPort);
                Assert.False(responseCreate.EnableNonSslPort);

                var responseUpdate = _client.Redis.Update(resourceGroupName: fixture.ResourceGroupName, name: fixture.RedisCacheName,
                                        parameters: new RedisUpdateParameters
                                        {
                                            Sku = new Sku()
                                            {
                                                Name = SkuName.Basic,
                                                Family = SkuFamily.C,
                                                Capacity = 0
                                            },
                                            RedisConfiguration = new Dictionary<string, string>() {
                                                    {"maxmemory-policy","allkeys-lru"}
                                            },
                                            EnableNonSslPort = true
                                        });

                Assert.Contains(fixture.RedisCacheName, responseUpdate.Id);
                Assert.Equal(RedisCacheManagementHelper.Location, responseUpdate.Location);
                Assert.Equal(fixture.RedisCacheName, responseUpdate.Name);
                Assert.Equal("Microsoft.Cache/Redis", responseUpdate.Type);

                Assert.Equal(SkuName.Basic, responseUpdate.Sku.Name);
                Assert.Equal(SkuFamily.C, responseUpdate.Sku.Family);
                Assert.Equal(0, responseUpdate.Sku.Capacity);
                Assert.Equal("allkeys-lru", responseUpdate.RedisConfiguration["maxmemory-policy"]);

                Assert.Contains(fixture.RedisCacheName, responseUpdate.HostName);
                Assert.Equal(6379, responseUpdate.Port);
                Assert.Equal(6380, responseUpdate.SslPort);
                Assert.True(responseUpdate.EnableNonSslPort);

                _client.Redis.Delete(resourceGroupName: fixture.ResourceGroupName, name: fixture.RedisCacheName);
            }
        }
    }
}


text:
<?php

namespace Mcwork\Form;

use ContentinumComponents\Forms\AbstractForms;

/**
 * contentinum mcwork form page
 *
 * @author Michael Jochum, michael.jochum@jochum-mediaservices.de
 */
class PageContentGroup extends AbstractForms
{

    /**
     * form field elements
     *
     * @see \ContentinumComponents\Forms\AbstractForms::elements()
     */
    public function elements()
    {
        return array(

            array(
                'spec' => array(
                    'name' => 'groupStyle',
                    'required' => true,
                    'options' => array(
                        'label' => 'Content Group style',
                        'empty_option' => 'Select a style',
                        'value_options' => $this->getServiceLocator()->get('Templates\Styles'),
                        'deco-row' => $this->getDecorators(self::DECO_ELM_ROW)
                    ),
                    'type' => 'Select',
                    'attributes' => array(
                        'required' => 'required',
                        'id' => 'groupStyle'
                    )
                )
            ),

            array(
                'spec' => array(
                    'name' => 'groupElement',
                    'required' => false,
                    'options' => array(
                        'label' => 'Group element',
                        'empty_option' => 'Elements',
                        'value_options' => array(
                            'article' => '<article>',
                            'footer' => '<footer>',
                            'header' => '<header>',
                            'section' => '<section>'
                        ),
                        'deco-row' => $this->getDecorators(self::DECO_TAB_ROW)
                    ),
                    'type' => 'Select',
                    'attributes' => array(
                        'id' => 'groupElement'
                    )
                )
            ),

            array(
                'spec' => array(
                    'name' => 'groupElementAttribute',
                    'required' => false,
                    'options' => array(
                        'label' => 'Group attributte',
                        'deco-row' => $this->getDecorators(self::DECO_ELM_ROW)
                    ),
                    'type' => 'Textarea',
                    'attributes' => array(
                        'rows' => '2',
                        'id' => 'groupElementAttribute'
                    )
                )
            )
        );
    }

    /**
     * form input filter and validation
     *
     * @see \ContentinumComponents\Forms\AbstractForms::filter()
     */
    public function filter()
    {
        return array(

            'groupElement' => array(
                'required' => false
            ),
            'groupElementAttribute' => array(
                'required' => false
            )
        )
        ;
    }

    /**
     * initiation and get form
     *
     * @see \ContentinumComponents\Forms\AbstractForms::getForm()
     */
    public function getForm()
    {
        return $this->factory->createForm(array(
            'hydrator' => 'Zend\Stdlib\Hydrator\ArraySerializable',
            'elements' => $this->elements(),
            'input_filter' => $this->filter()
        ));
    }
}


text:
package izzyaxel.arcaneartificing.blocks.functional;

import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import izzyaxel.arcaneartificing.blocks.tileEntities.TEChaliceOfTheVoidFull;
import izzyaxel.arcaneartificing.main.AABlocks;
import izzyaxel.arcaneartificing.main.AAItems;
import izzyaxel.arcaneartificing.main.AAReference;
import izzyaxel.arcaneartificing.main.AAUtils;
import izzyaxel.arcaneartificing.main.dimension.pristineVistas.PristineTeleporter;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.server.management.ServerConfigurationManager;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.Explosion;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;

import java.util.ArrayList;

public class BlockChaliceOfTheVoidFull extends BlockContainer
{
	public BlockChaliceOfTheVoidFull()
	{
		super(Material.piston);
		this.setBlockName("chaliceOfTheVoidFull");
		this.setBlockTextureName(AAReference.MODID + ":chaliceOfTheVoid");
		this.setStepSound(Block.soundTypePiston);
		this.setHardness(6.0F);
		this.setResistance(1000.0F);
		this.setHarvestLevel("pickaxe", 3);
		AAUtils.AADespawn.registerItemToNeverDespawn(Item.getItemFromBlock(this));
		this.setTickRandomly(true);
		this.setBlockBounds(0, 0, 0, 1, 0.26f, 1);
	}

	@Override
	public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune)
	{
		ArrayList<ItemStack> drops = new ArrayList<ItemStack>();
		drops.add(new ItemStack(AAItems.pristinePendant, 1));
		drops.add(new ItemStack(Item.getItemFromBlock(AABlocks.chaliceOfTheVoidBlock), 1));
		return drops;
	}

	@Override
	public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
	{
		if(world.getBlock(x, y - 1, z) == AABlocks.stand && player instanceof EntityPlayerMP)
		{
			if(world.provider.dimensionId != AAReference.DIMID)
			{
				EntityPlayerMP playerMP = (EntityPlayerMP)player;
				ServerConfigurationManager configManager = playerMP.mcServer.getConfigurationManager();
				WorldServer worldServer = playerMP.mcServer.worldServerForDimension(AAReference.DIMID);

				playerMP.timeUntilPortal = 10;
				playerMP.setInPortal();
				configManager.transferPlayerToDimension(playerMP, AAReference.DIMID, new PristineTeleporter(worldServer));
				return true;
			}
			else
			{
				EntityPlayerMP playerMP = (EntityPlayerMP)player;
				ServerConfigurationManager configManager = playerMP.mcServer.getConfigurationManager();
				WorldServer worldServer = playerMP.mcServer.worldServerForDimension(0);

				playerMP.timeUntilPortal = 10;
				playerMP.setInPortal();
				configManager.transferPlayerToDimension(playerMP, 0, new PristineTeleporter(worldServer));
				return true;
			}
		}
		return false;
	}

	@Override
	public TileEntity createNewTileEntity(World world, int id)
	{
		return new TEChaliceOfTheVoidFull();
	}

	@Override
	public void onBlockExploded(World world, int x, int y, int z, Explosion explosion)
	{
		world.setBlockToAir(x, y, z);
		world.removeTileEntity(x, y, z);
		onBlockDestroyedByExplosion(world, x, y, z, explosion);
	}

	@Override
	public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int meta)
	{
		world.setBlockToAir(x, y, z);
		world.removeTileEntity(x, y, z);
	}

	@Override
	public boolean isOpaqueCube()
	{
		return false;
	}

	@Override
	public boolean renderAsNormalBlock()
	{
		return false;
	}

	@SideOnly(Side.CLIENT)
	@Override
	public int getRenderType()
	{
		return AAReference.chaliceOfTheVoidFullRenderID;
	}

	@Override
	public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z)
	{
		return new ItemStack(Item.getItemFromBlock(AABlocks.chaliceOfTheVoidBlock), 1);
	}
}


text:
<!doctype html>

{% include head.html %}

  {% include latex-commands.md %}

{% include navigation.html %}

    {% if page.image.path %}{% if page.image.credit %}
Image credit: {{ page.image.credit }}
{% endif %}{% endif %}

          {% for tag in page.tags %}
{{ tag }}
{% endfor %}

        {% if page.link %}

{% if page.headline %}{{ page.headline }}{% else %}{{ page.title }}{% endif %} →

        {% else %}

{% if page.headline %}{{ page.headline }}{% else %}{{ page.title }}{% endif %}

        {% endif %}

        {% if page.author %}
          {% assign author = site.data.authors[page.author] %}{% else %}{% assign author = site.owner %}
        {% endif %}
        {% if author.avatar contains 'http' %}

        {% elsif author.avatar %}

        {% endif %}
        By {{ author.name }}
        <time datetime="{{ page.date | date_to_xmlschema }}"> {{ page.date | date: "%B %d, %Y" }}</time>
        {% if page.modified %}<time datetime="{{ page.modified }}"> {{ page.modified | date: "%B %d, %Y" }}</time>{% endif %}
        {% if (site.owner.disqus-shortname and page.comments) or site.comments %} Comment{% endif %}
        {% unless page.hidden %}{% include social-share.html %}{% endunless %}
        {% if page.ads == true %}{% include ad-sidebar.html %}{% endif %}

        {% if page.hidden %}

              If you're somehow seeing this right now, look away. It's not finished, and I'm not sure when/if it will be.

        {% endif %}
        {{ content }}

          You may also like...

        {% if (site.owner.disqus-shortname and page.comments) or site.comments %}

          {% include disqus-comments.html %}
        {% endif %}

      {% if page.previous %}
        Previous
      {% endif %}
      {% if page.next %}
        Next
      {% endif %}

    {% include footer.html %}

{% include scripts.html %}


text:
package com.logginghub.logging.jul;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.is;

import java.net.InetSocketAddress;
import java.util.EnumSet;
import java.util.logging.Level;

import org.junit.Test;

import com.logginghub.integrationtests.logging.HubTestFixture;
import com.logginghub.integrationtests.logging.HubTestFixture.HubFixture;
import com.logginghub.logging.LogEvent;
import com.logginghub.logging.api.levelsetting.InstanceFilter;
import com.logginghub.logging.api.levelsetting.LevelSetting;
import com.logginghub.logging.api.levelsetting.LevelSettingsConfirmation;
import com.logginghub.logging.api.levelsetting.LevelSettingsGroup;
import com.logginghub.logging.api.levelsetting.MultipleResultListener;
import com.logginghub.logging.exceptions.ConnectorException;
import com.logginghub.logging.handlers.SocketHandler;
import com.logginghub.logging.messaging.SocketClient;
import com.logginghub.logging.modules.BaseHub;
import com.logginghub.logging.servers.SocketHub;
import com.logginghub.utils.Bucket;
import com.logginghub.utils.Result;

public class TestSocketHandler extends BaseHub {

    @Test public void test_level_setting() throws ConnectorException {

        // Fire up the hub
        HubFixture hubFixture = fixture.createSocketHub(EnumSet.of(HubTestFixture.Features.ChannelSubscriptions));
        SocketHub hub = hubFixture.start();

        // Create a j.u.l. logger and configure it programmatically
        java.util.logging.Logger logger = java.util.logging.Logger.getLogger("testLogger");
        logger.setLevel(Level.INFO);

        SocketHandler handler = new SocketHandler("j.u.l. test handler");
        handler.addConnectionPoint(new InetSocketAddress(hub.getPort()));
        handler.setLevel(Level.FINE);

        // Typically the appender doesn't connect until it logs something for the first time
        handler.getAppenderHelper().getSocketClient().connect();

        logger.addHandler(handler);

        // Create a socket client we'll use to set the log levels
        SocketClient clientA = fixture.createClientAutoSubscribe("clientA", hub);

        Bucket<LogEvent> events = fixture.createEventBucketFor(clientA);

        logger.fine("Hello world");

        assertThat(logger.getLevel().getName(), is("INFO"));

        // We should have sent 1 message so far, just the subscription message
        assertThat(handler.getAppenderHelper().getSocketClient().getSent(), is(1));

        // Use the API from clientA to set the level on our logger
        final Bucket<Result<LevelSettingsConfirmation>> results = new Bucket<Result<LevelSettingsConfirmation>>();
        InstanceFilter filter = new InstanceFilter();
        LevelSettingsGroup settings = new LevelSettingsGroup();
        settings.add(new LevelSetting("testLogger", "FINE"));

        MultipleResultListener<LevelSettingsConfirmation> listener = new MultipleResultListener<LevelSettingsConfirmation>() {
            @Override public void onResult(Result<LevelSettingsConfirmation> result) {
                results.add(result);
            }
        };

        clientA.getLevelSettingAPI().setLevels(filter, settings, listener);

        results.waitForMessages(1);
        assertThat(results.get(0).isSuccessful(), is(true));

        logger.fine("Hello world");

        events.waitForMessages(1);

        assertThat(events.get(0).getMessage(), is("Hello world"));

    }

    @Test public void test_level_setting_instance_filter() throws ConnectorException {

        // Fire up the hub
        HubFixture hubFixture = fixture.createSocketHub(EnumSet.of(HubTestFixture.Features.ChannelSubscriptions));
        SocketHub hub = hubFixture.start();

        // Create a j.u.l. logger and configure it programmatically
        java.util.logging.Logger logger = java.util.logging.Logger.getLogger("testLogger");
        logger.setLevel(Level.INFO);

        SocketHandler handler = new SocketHandler("j.u.l. test handler");
        handler.addConnectionPoint(new InetSocketAddress(hub.getPort()));
        handler.setLevel(Level.FINE);

        // Typically the appender doesn't connect until it logs something for the first time
        handler.getAppenderHelper().getSocketClient().connect();
        logger.addHandler(handler);

        // Create a socket client we'll use to set the log levels
        SocketClient clientA = fixture.createClientAutoSubscribe("clientA", hub);

        // We should have sent 1 message so far, just the subscription message
        assertThat(handler.getAppenderHelper().getSocketClient().getSent(), is(1));

        // Use the API from clientA to set the level on our logger
        final Bucket<Result<LevelSettingsConfirmation>> results = new Bucket<Result<LevelSettingsConfirmation>>();
        InstanceFilter filter = new InstanceFilter();
        filter.setHostFilter("anotherhost");

        LevelSettingsGroup settings = new LevelSettingsGroup();
        settings.add(new LevelSetting("testLogger", "FINE"));

        MultipleResultListener<LevelSettingsConfirmation> listener = new MultipleResultListener<LevelSettingsConfirmation>() {
            @Override public void onResult(Result<LevelSettingsConfirmation> result) {
                results.add(result);
            }
        };

        clientA.getLevelSettingAPI().setLevels(filter, settings, listener);
        results.waitForMessages(1);
        assertThat(results.get(0).isSuccessful(), is(false));

    }

}


text:
#pragma once

#include <Core/Definitions.hpp>

#include <Core/Reflection/Reflection.hpp>
#include <Core/Reflection/Enumerator.hpp>

#include <Core/Containers/Array.hpp>

#include <Core/Utility/TemplateUtil.hpp>

namespace Fade {

enum class EPropertyType : unsigned char
{
	Integer,
	UnsignedInteger,
	Short,
	UnsignedShort,
	Byte,
	UnsignedByte,
	Boolean,
	Float,
	Double,
	String,
	WideString,
	Enum,
	Class,
	Struct,
	Array
};

class CProperty : public CReflectable
{
public:
	CProperty(const char* a_Name, usize a_Size, usize a_Offset, EPropertyType a_Type)
		: CReflectable(a_Name)
		, m_Size(a_Size)
		, m_Offset(a_Offset)
		, m_Type(a_Type)
	{
	}

	EReflectableType GetType() const override
	{
		return EReflectableType::Property;
	}

	const std::string& GetTypeString() const override
	{
		static std::string TypeStr("property");
		return TypeStr;
	}

	usize GetSize() const
	{
		return m_Size;
	}

	usize GetOffset() const
	{
		return m_Offset;
	}

private:
	usize			m_Size;
	usize			m_Offset;
	EPropertyType	m_Type;
};

class CEnumeratorProperty : public CProperty
{
public:
	explicit CEnumeratorProperty(const char* a_Name, usize a_Size, usize a_Offset, EPropertyType a_Type) noexcept
		: CProperty(a_Name, a_Size, a_Offset, a_Type)
		, m_Enumerator(nullptr)
	{
	}

	void __Internal_InitializeEnumPtr(const char* a_Name)
	{
		CReflectableRegistry& Registry = CReflectableRegistry::Get();
		CEnumerator* Enumerator = dynamic_cast<CEnumerator*>(Registry.GetReflectable(a_Name));
		if (Enumerator != nullptr)
		{
			m_Enumerator = Enumerator;
		}
	}

private:
	CEnumerator* m_Enumerator;
};

template <typename, typename = void>
struct PropertyFactory;

#define DEFINE_MEMBER_FN(type, enumType) \
template<> \
struct PropertyFactory<type, void> \
{ \
	static CProperty* MakeProperty(const char* a_Name, size_t a_MemberOffset) \
	{ \
	return new CProperty(a_Name, sizeof(type), a_MemberOffset, EPropertyType::##enumType); \
	} \
};

DEFINE_MEMBER_FN(float, Float)
DEFINE_MEMBER_FN(double, Double)
DEFINE_MEMBER_FN(int, Integer)
DEFINE_MEMBER_FN(unsigned int, UnsignedInteger)
DEFINE_MEMBER_FN(short, Short)
DEFINE_MEMBER_FN(unsigned short, UnsignedShort)
DEFINE_MEMBER_FN(char, Byte)
DEFINE_MEMBER_FN(unsigned char, UnsignedByte)
DEFINE_MEMBER_FN(bool, Boolean)

/**
 * enum specialization for member factory
 */
	template <typename T>
struct PropertyFactory<T, typename TEnableIf<std::is_enum_v<T>>::type>
{
	static CProperty* MakeProperty(const char* a_Name, size_t a_Offset)
	{
		// create enum property
		CEnumeratorProperty* Prop = new CEnumeratorProperty(a_Name, sizeof(T), a_Offset, EPropertyType::Enum);
		// TODO: we should defer the initialization of the enum pointer to a later point
		// where all reflected enums have been initialized
		Prop->__Internal_InitializeEnumPtr<T>();
		return Prop;
	}
};

/**
 * dynamic array specialization for member factory
 */
template <typename T>
struct PropertyFactory<TArray<T>, void>
{
	static CProperty* MakeProperty(const char* a_Name, size_t a_Offset)
	{
		return nullptr;
	}
};

}


text:
class Page
  include Mongoid::Document
  field :name
  field :time, :type => Integer
  field :lines, :type => Array

  def to_hash
    h = {
      :name => name,
      :time => time,
      :lines => lines
    }
    h[:lines] = ["(empty)"] if !lines or lines.length < 1
    return h
  end
end


text:
package net.francesbagual.github.eip.pattern.channel.invalidmessage.mdb;

import java.util.logging.Logger;

import javax.ejb.ActivationConfigProperty;
import javax.ejb.MessageDriven;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.ObjectMessage;

import net.francesbagual.github.eip.pattern.channel.invalidmessage.message.InvalidMessage;

@MessageDriven(name = "InvalidMessageMDB", activationConfig = {
		@ActivationConfigProperty(propertyName = "destinationLookup", propertyValue = "queue/invalidmessage"),
		@ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
		@ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto-acknowledge") })
public class InvalidMessageMDB implements MessageListener {

	private final static Logger LOGGER = Logger.getLogger(InvalidMessageMDB.class.toString());

	@Override
	public void onMessage(Message receivedMessage) {
		try {
			if (receivedMessage instanceof ObjectMessage) {
				ObjectMessage msg = (ObjectMessage) receivedMessage;
				InvalidMessage invalidMessage = (InvalidMessage) msg.getObject();
				LOGGER.info("Invalid message " + invalidMessage.toString() + " has been sent to " + invalidMessage.getSender());
			} else {
				LOGGER.warning("Sending invalid message to the invalid message queue!! WTF :)");
				LOGGER.warning("Received " + receivedMessage.toString());
			}
		} catch (JMSException e) {
			throw new RuntimeException(e);
		}
	}

}


text:
let React;
let ReactNoop;
let Scheduler;
let act;
let LegacyHidden;
let Offscreen;
let Suspense;
let useState;
let useEffect;
let startTransition;
let textCache;

describe('ReactOffscreen', () => {
  beforeEach(() => {
    jest.resetModules();

    React = require('react');
    ReactNoop = require('react-noop-renderer');
    Scheduler = require('scheduler');
    act = require('jest-react').act;
    LegacyHidden = React.unstable_LegacyHidden;
    Offscreen = React.unstable_Offscreen;
    Suspense = React.Suspense;
    useState = React.useState;
    useEffect = React.useEffect;
    startTransition = React.startTransition;

    textCache = new Map();
  });

  function resolveText(text) {
    const record = textCache.get(text);
    if (record === undefined) {
      const newRecord = {
        status: 'resolved',
        value: text,
      };
      textCache.set(text, newRecord);
    } else if (record.status === 'pending') {
      const thenable = record.value;
      record.status = 'resolved';
      record.value = text;
      thenable.pings.forEach(t => t());
    }
  }

  function readText(text) {
    const record = textCache.get(text);
    if (record !== undefined) {
      switch (record.status) {
        case 'pending':
          Scheduler.unstable_yieldValue(`Suspend! [${text}]`);
          throw record.value;
        case 'rejected':
          throw record.value;
        case 'resolved':
          return record.value;
      }
    } else {
      Scheduler.unstable_yieldValue(`Suspend! [${text}]`);
      const thenable = {
        pings: [],
        then(resolve) {
          if (newRecord.status === 'pending') {
            thenable.pings.push(resolve);
          } else {
            Promise.resolve().then(() => resolve(newRecord.value));
          }
        },
      };

      const newRecord = {
        status: 'pending',
        value: thenable,
      };
      textCache.set(text, newRecord);

      throw thenable;
    }
  }

  function Text({text}) {
    Scheduler.unstable_yieldValue(text);
    return text;
  }

  function AsyncText({text}) {
    readText(text);
    Scheduler.unstable_yieldValue(text);
    return text;
  }

  // @gate enableOffscreen
  test('basic example of suspending inside hidden tree', async () => {
    const root = ReactNoop.createRoot();

    function App() {
      return (
        <Suspense fallback={<Text text="Loading..." />}>

            <Text text="Visible" />

          <Offscreen mode="hidden">

              <AsyncText text="Hidden" />

          </Offscreen>
        </Suspense>
      );
    }

    // The hidden tree hasn't finished loading, but we should still be able to
    // show the surrounding contents. The outer Suspense boundary
    // isn't affected.
    await act(async () => {
      root.render(<App />);
    });
    expect(Scheduler).toHaveYielded(['Visible', 'Suspend! [Hidden]']);
    expect(root).toMatchRenderedOutput(Visible);

    // When the data resolves, we should be able to finish prerendering
    // the hidden tree.
    await act(async () => {
      await resolveText('Hidden');
    });
    expect(Scheduler).toHaveYielded(['Hidden']);
    expect(root).toMatchRenderedOutput(
      <>
        Visible
        Hidden
      </>,
    );
  });

  // @gate www
  test('LegacyHidden does not handle suspense', async () => {
    const root = ReactNoop.createRoot();

    function App() {
      return (
        <Suspense fallback={<Text text="Loading..." />}>

            <Text text="Visible" />

          <LegacyHidden mode="hidden">

              <AsyncText text="Hidden" />

          </LegacyHidden>
        </Suspense>
      );
    }

    // Unlike Offscreen, LegacyHidden never captures if something suspends
    await act(async () => {
      root.render(<App />);
    });
    expect(Scheduler).toHaveYielded([
      'Visible',
      'Suspend! [Hidden]',
      'Loading...',
    ]);
    // Nearest Suspense boundary switches to a fallback even though the
    // suspended content is hidden.
    expect(root).toMatchRenderedOutput(
      <>
        Visible
        Loading...
      </>,
    );
  });

  // @gate experimental || www
  test("suspending inside currently hidden tree that's switching to visible", async () => {
    const root = ReactNoop.createRoot();

    function Details({open, children}) {
      return (
        <Suspense fallback={<Text text="Loading..." />}>

            <Text text={open ? 'Open' : 'Closed'} />

          <Offscreen mode={open ? 'visible' : 'hidden'}>
            {children}
          </Offscreen>
        </Suspense>
      );
    }

    // The hidden tree hasn't finished loading, but we should still be able to
    // show the surrounding contents. It doesn't matter that there's no
    // Suspense boundary because the unfinished content isn't visible.
    await act(async () => {
      root.render(

          <AsyncText text="Async" />
        ,
      );
    });
    expect(Scheduler).toHaveYielded(['Closed', 'Suspend! [Async]']);
    expect(root).toMatchRenderedOutput(Closed);

    // But when we switch the boundary from hidden to visible, it should
    // now bubble to the nearest Suspense boundary.
    await act(async () => {
      startTransition(() => {
        root.render(

            <AsyncText text="Async" />
          ,
        );
      });
    });
    expect(Scheduler).toHaveYielded(['Open', 'Suspend! [Async]', 'Loading...']);
    // It should suspend with delay to prevent the already-visible Suspense
    // boundary from switching to a fallback
    expect(root).toMatchRenderedOutput(Closed);

    // Resolve the data and finish rendering
    await act(async () => {
      await resolveText('Async');
    });
    expect(Scheduler).toHaveYielded(['Open', 'Async']);
    expect(root).toMatchRenderedOutput(
      <>
        Open
        Async
      </>,
    );
  });

  // @gate enableOffscreen
  test("suspending inside currently visible tree that's switching to hidden", async () => {
    const root = ReactNoop.createRoot();

    function Details({open, children}) {
      return (
        <Suspense fallback={<Text text="Loading..." />}>

            <Text text={open ? 'Open' : 'Closed'} />

          <Offscreen mode={open ? 'visible' : 'hidden'}>
            {children}
          </Offscreen>
        </Suspense>
      );
    }

    // Initial mount. Nothing suspends
    await act(async () => {
      root.render(

          <Text text="(empty)" />
        ,
      );
    });
    expect(Scheduler).toHaveYielded(['Open', '(empty)']);
    expect(root).toMatchRenderedOutput(
      <>
        Open
        (empty)
      </>,
    );

    // Update that suspends inside the currently visible tree
    await act(async () => {
      startTransition(() => {
        root.render(

            <AsyncText text="Async" />
          ,
        );
      });
    });
    expect(Scheduler).toHaveYielded(['Open', 'Suspend! [Async]', 'Loading...']);
    // It should suspend with delay to prevent the already-visible Suspense
    // boundary from switching to a fallback
    expect(root).toMatchRenderedOutput(
      <>
        Open
        (empty)
      </>,
    );

    // Update that hides the suspended tree
    await act(async () => {
      startTransition(() => {
        root.render(

            <AsyncText text="Async" />
          ,
        );
      });
    });
    // Now the visible part of the tree can commit without being blocked
    // by the suspended content, which is hidden.
    expect(Scheduler).toHaveYielded(['Closed', 'Suspend! [Async]']);
    expect(root).toMatchRenderedOutput(
      <>
        Closed
        (empty)
      </>,
    );

    // Resolve the data and finish rendering
    await act(async () => {
      await resolveText('Async');
    });
    expect(Scheduler).toHaveYielded(['Async']);
    expect(root).toMatchRenderedOutput(
      <>
        Closed
        Async
      </>,
    );
  });

  // @gate experimental || www
  test('update that suspends inside hidden tree', async () => {
    let setText;
    function Child() {
      const [text, _setText] = useState('A');
      setText = _setText;
      return <AsyncText text={text} />;
    }

    function App({show}) {
      return (
        <Offscreen mode={show ? 'visible' : 'hidden'}>

            <Child />

        </Offscreen>
      );
    }

    const root = ReactNoop.createRoot();
    resolveText('A');
    await act(async () => {
      root.render(<App show={false} />);
    });
    expect(Scheduler).toHaveYielded(['A']);

    await act(async () => {
      startTransition(() => {
        setText('B');
      });
    });
  });

  // @gate experimental || www
  test('updates at multiple priorities that suspend inside hidden tree', async () => {
    let setText;
    let setStep;
    function Child() {
      const [text, _setText] = useState('A');
      setText = _setText;

      const [step, _setStep] = useState(0);
      setStep = _setStep;

      return <AsyncText text={text + step} />;
    }

    function App({show}) {
      return (
        <Offscreen mode={show ? 'visible' : 'hidden'}>

            <Child />

        </Offscreen>
      );
    }

    const root = ReactNoop.createRoot();
    resolveText('A0');
    await act(async () => {
      root.render(<App show={false} />);
    });
    expect(Scheduler).toHaveYielded(['A0']);
    expect(root).toMatchRenderedOutput(A0);

    await act(async () => {
      setStep(1);
      ReactNoop.flushSync(() => {
        setText('B');
      });
    });
    expect(Scheduler).toHaveYielded([
      // The high priority render suspends again
      'Suspend! [B0]',
      // There's still pending work in another lane, so we should attempt
      // that, too.
      'Suspend! [B1]',
    ]);
    expect(root).toMatchRenderedOutput(A0);

    // Resolve the data and finish rendering
    await act(async () => {
      resolveText('B1');
    });
    expect(Scheduler).toHaveYielded(['B1']);
    expect(root).toMatchRenderedOutput(B1);
  });

  // Only works in new reconciler
  // @gate enableOffscreen
  test('detect updates to a hidden tree during a concurrent event', async () => {
    // This is a pretty complex test case. It relates to how we detect if an
    // update is made to a hidden tree: when scheduling the update, we walk up
    // the fiber return path to see if any of the parents is a hidden Offscreen
    // component. This doesn't work if there's already a render in progress,
    // because the tree might be about to flip to hidden. To avoid a data race,
    // queue updates atomically: wait to queue the update until after the
    // current render has finished.

    let setInner;
    function Child({outer}) {
      const [inner, _setInner] = useState(0);
      setInner = _setInner;

      useEffect(() => {
        // Inner and outer values are always updated simultaneously, so they
        // should always be consistent.
        if (inner !== outer) {
          Scheduler.unstable_yieldValue(
            'Tearing! Inner and outer are inconsistent!',
          );
        } else {
          Scheduler.unstable_yieldValue('Inner and outer are consistent');
        }
      }, [inner, outer]);

      return <Text text={'Inner: ' + inner} />;
    }

    let setOuter;
    function App({show}) {
      const [outer, _setOuter] = useState(0);
      setOuter = _setOuter;
      return (
        <>

            <Text text={'Outer: ' + outer} />

          <Offscreen mode={show ? 'visible' : 'hidden'}>

              <Child outer={outer} />

          </Offscreen>
          <Suspense fallback={<Text text="Loading..." />}>

              <AsyncText text={'Async: ' + outer} />

          </Suspense>
        </>
      );
    }

    // Render a hidden tree
    const root = ReactNoop.createRoot();
    resolveText('Async: 0');
    await act(async () => {
      root.render(<App show={true} />);
    });
    expect(Scheduler).toHaveYielded([
      'Outer: 0',
      'Inner: 0',
      'Async: 0',
      'Inner and outer are consistent',
    ]);
    expect(root).toMatchRenderedOutput(
      <>
        Outer: 0
        Inner: 0
        Async: 0
      </>,
    );

    await act(async () => {
      // Update a value both inside and outside the hidden tree. These values
      // must always be consistent.
      setOuter(1);
      setInner(1);
      // In the same render, also hide the offscreen tree.
      root.render(<App show={false} />);

      if (gate(flags => flags.enableSyncDefaultUpdates)) {
        expect(Scheduler).toFlushUntilNextPaint([
          // The outer update will commit, but the inner update is deferred until
          // a later render.
          'Outer: 1',

          // Something suspended. This means we won't commit immediately; there
          // will be an async gap between render and commit. In this test, we will
          // use this property to schedule a concurrent update. The fact that
          // we're using Suspense to schedule a concurrent update is not directly
          // relevant to the test — we could also use time slicing, but I've
          // chosen to use Suspense the because implementation details of time
          // slicing are more volatile.
          'Suspend! [Async: 1]',

          'Loading...',
        ]);
      } else {
        // When default updates are time sliced, React yields before preparing
        // the fallback.
        expect(Scheduler).toFlushUntilNextPaint([
          'Outer: 1',
          'Suspend! [Async: 1]',
        ]);
        expect(Scheduler).toFlushUntilNextPaint(['Loading...']);
      }

      // Assert that we haven't committed quite yet
      expect(root).toMatchRenderedOutput(
        <>
          Outer: 0
          Inner: 0
          Async: 0
        </>,
      );

      // Before the tree commits, schedule a concurrent event. The inner update
      // is to a tree that's just about to be hidden.
      setOuter(2);
      setInner(2);

      // Commit the previous render.
      jest.runAllTimers();
      expect(root).toMatchRenderedOutput(
        <>
          Outer: 1
          Inner: 0
          Async: 0
          Loading...
        </>,
      );

      // Now reveal the hidden tree at high priority.
      ReactNoop.flushSync(() => {
        root.render(<App show={true} />);
      });
      expect(Scheduler).toHaveYielded([
        'Outer: 1',

        // There are two pending updates on Inner, but only the first one
        // is processed, even though they share the same lane. If the second
        // update were erroneously processed, then Inner would be inconsistent
        // with Outer.
        'Inner: 1',

        'Suspend! [Async: 1]',
        'Loading...',
        'Inner and outer are consistent',
      ]);
    });
    expect(Scheduler).toHaveYielded([
      'Outer: 2',
      'Inner: 2',
      'Suspend! [Async: 2]',
      'Loading...',
      'Inner and outer are consistent',
    ]);
    expect(root).toMatchRenderedOutput(
      <>
        Outer: 2
        Inner: 2
        Async: 0
        Loading...
      </>,
    );
  });
});


text:
git pull origin master
git reset --hard origin/master