text:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="cl.tavor.bancointeligente.activities.DepositsActivity">

    <ScrollView
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:card_view="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/background">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:id="@+id/scrollView"
            android:orientation="vertical">

            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                card_view:cardCornerRadius="8dp"
                card_view:cardElevation="4dp"
                android:layout_margin="8dp"
                android:foreground="?android:attr/selectableItemBackground"
                android:clickable="true"
                android:focusable="true"
                android:id="@+id/cardview_cashDeposit">

                <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content">

                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="160dp"
                        android:id="@+id/imageView_cashDeposit"
                        android:src="@color/background_material_light"
                        android:scaleType="centerCrop" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="40dp"
                        android:orientation="vertical"
                        android:background="@color/button_default"
                        android:gravity="center|left"
                        android:paddingLeft="16dp" >

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/button_deposit_cash"
                            android:id="@+id/textView_cashDeposit"
                            android:textSize="18sp"
                            android:textColor="@android:color/white"/>
                    </LinearLayout>

                </LinearLayout>

            </android.support.v7.widget.CardView>

            <android.support.v7.widget.CardView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                card_view:cardCornerRadius="8dp"
                card_view:cardElevation="4dp"
                android:layout_margin="8dp"
                android:foreground="?android:attr/selectableItemBackground"
                android:clickable="true"
                android:id="@+id/cardview_documentDeposit">

                <LinearLayout
                    android:orientation="vertical"
                    android:layout_width="match_parent"
                    android:layout_height="wrap_content" >

                    <ImageView
                        android:layout_width="match_parent"
                        android:layout_height="160dp"
                        android:id="@+id/imageView_documentDeposit"
                        android:src="@color/background_material_light"
                        android:scaleType="centerCrop" />

                    <LinearLayout
                        android:layout_width="match_parent"
                        android:layout_height="40dp"
                        android:orientation="vertical"
                        android:background="@color/button_default"
                        android:gravity="center|left"
                        android:paddingLeft="16dp" >

                        <TextView
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:text="@string/button_document_deposit"
                            android:id="@+id/textView_documentDeposit"
                            android:textSize="18sp"
                            android:textColor="@android:color/white"/>
                    </LinearLayout>
                </LinearLayout>

            </android.support.v7.widget.CardView>

        </LinearLayout>

    </ScrollView>

</RelativeLayout>


text:
(function (context) {

    var DEFAULT_DATA_TABLE_LIMIT = 8;

    var objToString = Object.prototype.toString;
    var TYPED_ARRAY = {
        '[object Int8Array]': 1,
        '[object Uint8Array]': 1,
        '[object Uint8ClampedArray]': 1,
        '[object Int16Array]': 1,
        '[object Uint16Array]': 1,
        '[object Int32Array]': 1,
        '[object Uint32Array]': 1,
        '[object Float32Array]': 1,
        '[object Float64Array]': 1
    };

    var testHelper = {};

    /**
     * @param {Object} opt
     * @param {string|Array.<string>} [opt.title] If array, each item is on a single line.
     *        Can use '**abc**', means abc.
     * @param {Option} opt.option
     * @param {Object} [opt.info] info object to display.
     * @param {string} [opt.infoKey='option']
     * @param {Object|Array} [opt.dataTable]
     * @param {Array.<Object|Array>} [opt.dataTables] Multiple dataTables.
     * @param {number} [opt.dataTableLimit=DEFAULT_DATA_TABLE_LIMIT]
     * @param {number} [opt.width]
     * @param {number} [opt.height]
     * @param {boolean} [opt.draggable]
     * @param {boolean} [opt.lazyUpdate]
     * @param {boolean} [opt.notMerge]
     * @param {Array.<Object>|Object} [opt.button] {text: ..., onClick: ...}, or an array of them.
     * @param {Array.<Object>|Object} [opt.buttons] {text: ..., onClick: ...}, or an array of them.
     * @param {boolean} [opt.recordCanvas] 'ut/lib/canteen.js' is required.
     */
    testHelper.create = function (echarts, domOrId, opt) {
        var dom = getDom(domOrId);

        if (!dom) {
            return;
        }

        var title = document.createElement('div');
        var left = document.createElement('div');
        var chartContainer = document.createElement('div');
        var buttonsContainer = document.createElement('div');
        var dataTableContainer = document.createElement('div');
        var infoContainer = document.createElement('div');
        var recordCanvasContainer = document.createElement('div');

        title.setAttribute('title', dom.getAttribute('id'));

        title.className = 'test-title';
        dom.className = 'test-chart-block';
        left.className = 'test-chart-block-left';
        chartContainer.className = 'test-chart';
        buttonsContainer.className = 'test-buttons';
        dataTableContainer.className = 'test-data-table';
        infoContainer.className = 'test-info';
        recordCanvasContainer.className = 'record-canvas';

        if (opt.info) {
            dom.className += ' test-chart-block-has-right';
            infoContainer.className += ' test-chart-block-right';
        }

        left.appendChild(recordCanvasContainer);
        left.appendChild(buttonsContainer);
        left.appendChild(dataTableContainer);
        left.appendChild(chartContainer);
        dom.appendChild(infoContainer);
        dom.appendChild(left);
        dom.parentNode.insertBefore(title, dom);

        var chart;

        var optTitle = opt.title;
        if (optTitle) {
            if (optTitle instanceof Array) {
                optTitle = optTitle.join('\n');
            }
            title.innerHTML = '
'
                + testHelper.encodeHTML(optTitle)
                    .replace(/\*\*([^*]+?)\*\*/g, '$1')
                    .replace(/\n/g, '
')
                + '
';
        }

        if (opt.option) {
            chart = testHelper.createChart(echarts, chartContainer, opt.option, opt, opt.setOptionOpts);
        }

        var dataTables = opt.dataTables;
        if (!dataTables && opt.dataTable) {
            dataTables = [opt.dataTable];
        }
        if (dataTables) {
            var tableHTML = [];
            for (var i = 0; i < dataTables.length; i++) {
                tableHTML.push(createDataTableHTML(dataTables[i], opt));
            }
            dataTableContainer.innerHTML = tableHTML.join('');
        }

        var buttons = opt.buttons || opt.button;
        if (!(buttons instanceof Array)) {
            buttons = buttons ? [buttons] : [];
        }
        if (buttons.length) {
            for (var i = 0; i < buttons.length; i++) {
                var btnDefine = buttons[i];
                if (btnDefine) {
                    var btn = document.createElement('button');
                    btn.innerHTML = testHelper.encodeHTML(btnDefine.name || btnDefine.text || 'button');
                    btn.addEventListener('click', btnDefine.onClick || btnDefine.onclick);
                    buttonsContainer.appendChild(btn);
                }
            }
        }

        if (opt.info) {
            infoContainer.innerHTML = createObjectHTML(opt.info, opt.infoKey || 'option');
        }

        if (opt.recordCanvas) {
            recordCanvasContainer.innerHTML = ''
                + '<button>Show Canvas Record</button>'
                + '<button>Clear Canvas Record</button>'
                + '
<textarea></textarea>
<button>Close</button>
';
            var buttons = recordCanvasContainer.getElementsByTagName('button');
            var canvasRecordButton = buttons[0];
            var clearButton = buttons[1];
            var closeButton = buttons[2];
            var recordArea = recordCanvasContainer.getElementsByTagName('textarea')[0];
            var contentAraa = recordArea.parentNode;
            canvasRecordButton.addEventListener('click', function () {
                var content = [];
                eachCtx(function (zlevel, ctx) {
                    content.push('Layer zlevel: ' + zlevel, '\n\n');
                    if (typeof ctx.stack !== 'function') {
                        alert('Missing: ');
                        return;
                    }
                    var stack = ctx.stack();
                    for (var i = 0; i < stack.length; i++) {
                        var line = stack[i];
                        content.push(JSON.stringify(line), '\n');
                    }
                });
                contentAraa.style.display = 'block';
                recordArea.value = content.join('');
            });
            clearButton.addEventListener('click', function () {
                eachCtx(function (zlevel, ctx) {
                    ctx.clear();
                });
                recordArea.value = 'Cleared.';
            });
            closeButton.addEventListener('click', function () {
                contentAraa.style.display = 'none';
            });
        }

        function eachCtx(cb) {
            var layers = chart.getZr().painter.getLayers();
            for (var zlevel in layers) {
                if (layers.hasOwnProperty(zlevel)) {
                    var layer = layers[zlevel];
                    var canvas = layer.dom;
                    var ctx = canvas.getContext('2d');
                    cb(zlevel, ctx);
                }
            }
        }

        return chart;
    };

    /**
     * @param {ECharts} echarts
     * @param {HTMLElement|string} domOrId
     * @param {Object} option
     * @param {boolean|number} opt If number, means height
     * @param {boolean} opt.lazyUpdate
     * @param {boolean} opt.notMerge
     * @param {number} opt.width
     * @param {number} opt.height
     * @param {boolean} opt.draggable
     */
    testHelper.createChart = function (echarts, domOrId, option, opt) {
        if (typeof opt === 'number') {
            opt = {height: opt};
        }
        else {
            opt = opt || {};
        }

        var dom = getDom(domOrId);

        if (dom) {
            if (opt.width != null) {
                dom.style.width = opt.width + 'px';
            }
            if (opt.height != null) {
                dom.style.height = opt.height + 'px';
            }

            var chart = echarts.init(dom);

            if (opt.draggable) {
                window.draggable.init(dom, chart, {throttle: 70, addPlaceholder: true});
            }

            option && chart.setOption(option, {
                lazyUpdate: opt.lazyUpdate,
                notMerge: opt.notMerge
            });
            testHelper.resizable(chart);

            return chart;
        }
    };

    testHelper.resizable = function (chart) {
        if (window.attachEvent) {
            window.attachEvent('onresize', chart.resize);
        } else if (window.addEventListener) {
            window.addEventListener('resize', chart.resize, false);
        }
    };

    // Clean params specified by `cleanList` and seed a param specifid by `newVal` in URL.
    testHelper.setURLParam = function (cleanList, newVal) {
        var params = getParamListFromURL();
        for (var i = params.length - 1; i >= 0; i--) {
            for (var j = 0; j < cleanList.length; j++) {
                if (params[i] === cleanList[j]) {
                    params.splice(i, 1);
                }
            }
        }
        newVal && params.push(newVal);
        params.sort();
        location.search = params.join('&');
    };

    // Whether has param `val` in URL.
    testHelper.hasURLParam = function (val) {
        var params = getParamListFromURL();
        for (var i = params.length - 1; i >= 0; i--) {
            if (params[i] === val) {
                return true;
            }
        }
        return false;
    };

    // Nodejs `path.resolve`.
    testHelper.resolve = function () {
        var resolvedPath = '';
        var resolvedAbsolute;

        for (var i = arguments.length - 1; i >= 0 && !resolvedAbsolute; i--) {
            var path = arguments[i];
            if (path) {
                resolvedPath = path + '/' + resolvedPath;
                resolvedAbsolute = path[0] === '/';
            }
        }

        if (!resolvedAbsolute) {
            throw new Error('At least one absolute path should be input.');
        }

        // Normalize the path
        resolvedPath = normalizePathArray(resolvedPath.split('/'), false).join('/');

        return '/' + resolvedPath;
    };

    testHelper.encodeHTML = function (source) {
        return String(source)
            .replace(/&/g, '&')
            .replace(/</g, '<')
            .replace(/>/g, '>')
            .replace(/"/g, '"')
            .replace(/'/g, ''');
    };

    /**
     * @public
     * @return {string} Current url dir.
     */
    testHelper.dir = function () {
        return location.origin + testHelper.resolve(location.pathname, '..');
    };

    /**
     * Not accurate.
     * @param {*} type
     * @return {string} 'function', 'array', 'typedArray', 'regexp',
     *       'date', 'object', 'boolean', 'number', 'string'
     */
    var getType = testHelper.getType = function (value) {
        var type = typeof value;
        var typeStr = objToString.call(value);

        return !!TYPED_ARRAY[objToString.call(value)]
            ? 'typedArray'
            : typeof type === 'function'
            ? 'function'
            : typeStr === '[object Array]'
            ? 'array'
            : typeStr === '[object Number]'
            ? 'number'
            : typeStr === '[object Boolean]'
            ? 'boolean'
            : typeStr === '[object String]'
            ? 'string'
            : typeStr === '[object RegExp]'
            ? 'regexp'
            : typeStr === '[object Date]'
            ? 'date'
            : !!value && type === 'object'
            ? 'object'
            : null;
    };

    /**
     * JSON.stringify(obj, null, 2) will vertically layout array, which takes too much space.
     * Can print like:
     * [
     *     {name: 'xxx', value: 123},
     *     {name: 'xxx', value: 123},
     *     {name: 'xxx', value: 123}
     * ]
     * {
     *     arr: [33, 44, 55],
     *     str: 'xxx'
     * }
     *
     * @param {*} object
     * @param {opt|string} [opt] If string, means key.
     * @param {string} [opt.key=''] Top level key, if given, print like: 'someKey: [asdf]'
     * @param {string} [opt.objectLineBreak=true]
     * @param {string} [opt.arrayLineBreak=false]
     * @param {string} [opt.indent=4]
     * @param {string} [opt.lineBreak='\n']
     * @param {string} [opt.quotationMark='\'']
     */
    var printObject = testHelper.printObject = function (obj, opt) {
        opt = typeof opt === 'string'
            ? {key: opt}
            : (opt || {});

        var indent = opt.indent != null ? opt.indent : 4;
        var lineBreak = opt.lineBreak != null ? opt.lineBreak : '\n';
        var quotationMark = opt.quotationMark != null ? opt.quotationMark : '\'';

        return doPrint(obj, opt.key, 0).str;

        function doPrint(obj, key, depth) {
            var codeIndent = (new Array(depth * indent + 1)).join(' ');
            var subCodeIndent = (new Array((depth + 1) * indent + 1)).join(' ');
            var hasLineBreak = false;

            var preStr = key != null ? (key + ': ' ) : '';
            var str;

            var objType = getType(obj);

            switch (objType) {
                case 'function':
                    hasLineBreak = true;
                    str = preStr + quotationMark + obj + quotationMark;
                    break;
                case 'regexp':
                case 'date':
                    str = preStr + quotationMark + obj + quotationMark;
                    break;
                case 'array':
                case 'typedArray':
                    hasLineBreak = opt.arrayLineBreak != null ? opt.arrayLineBreak : false;
                    // If no break line in array, print in single line, like [12, 23, 34].
                    // else, each item takes a line.
                    var childBuilder = [];
                    for (var i = 0, len = obj.length; i < len; i++) {
                        var subResult = doPrint(obj[i], null, depth + 1);
                        childBuilder.push(subResult.str);
                        if (subResult.hasLineBreak) {
                            hasLineBreak = true;
                        }
                    }
                    var tail = hasLineBreak ? lineBreak : '';
                    var delimiter = ',' + (hasLineBreak ? (lineBreak + subCodeIndent) : ' ');
                    var subPre = hasLineBreak ? subCodeIndent : '';
                    var endPre = hasLineBreak ? codeIndent : '';
                    str = ''
                        + preStr + '[' + tail
                        + subPre + childBuilder.join(delimiter) + tail
                        + endPre + ']';
                    break;
                case 'object':
                    hasLineBreak = opt.objectLineBreak != null ? opt.objectLineBreak : true;
                    var childBuilder = [];
                    for (var i in obj) {
                        if (obj.hasOwnProperty(i)) {
                            var subResult = doPrint(obj[i], i, depth + 1);
                            childBuilder.push(subResult.str);
                            if (subResult.hasLineBreak) {
                                hasLineBreak = true;
                            }
                        }
                    }
                    str = ''
                        + preStr + '{' + (hasLineBreak ? lineBreak : '')
                        + (childBuilder.length
                            ? (hasLineBreak ? subCodeIndent : '') + childBuilder.join(',' + (hasLineBreak ? lineBreak + subCodeIndent: ' ')) + (hasLineBreak ? lineBreak: '')
                            : ''
                        )
                        + (hasLineBreak ? codeIndent : '') + '}';
                    break;
                case 'boolean':
                case 'number':
                    str = preStr + obj + '';
                    break;
                case 'string':
                    str = preStr + quotationMark + obj + quotationMark;
                    break;
                default:
                    str = preStr + obj + '';
            }

            return {
                str: str,
                hasLineBreak: hasLineBreak
            };
        }
    };

    function createDataTableHTML(data, opt) {
        var sourceFormat = detectSourceFormat(data);
        var dataTableLimit = opt.dataTableLimit || DEFAULT_DATA_TABLE_LIMIT;

        if (!sourceFormat) {
            return '';
        }

        var html = ['

'];

        if (sourceFormat === 'arrayRows') {
            for (var i = 0; i < data.length && i <= dataTableLimit; i++) {
                var line = data[i];
                var htmlLine = ['
'];
                for (var j = 0; j < line.length; j++) {
                    var val = i === dataTableLimit ? '...' : line[j];
                    htmlLine.push('' + testHelper.encodeHTML(val) + '	');
                }
                htmlLine.push('
');
                html.push(htmlLine.join(''));
            }
        }
        else if (sourceFormat === 'objectRows') {
            for (var i = 0; i < data.length && i <= dataTableLimit; i++) {
                var line = data[i];
                var htmlLine = ['
'];
                for (var key in line) {
                    if (line.hasOwnProperty(key)) {
                        var keyText = i === dataTableLimit ? '...' : key;
                        htmlLine.push('' + testHelper.encodeHTML(keyText) + '	');
                        var val = i === dataTableLimit ? '...' : line[key];
                        htmlLine.push('' + testHelper.encodeHTML(val) + '	');
                    }
                }
                htmlLine.push('
');
                html.push(htmlLine.join(''));
            }
        }
        else if (sourceFormat === 'keyedColumns') {
            for (var key in data) {
                var htmlLine = ['
'];
                htmlLine.push('' + testHelper.encodeHTML(key) + '	');
                if (data.hasOwnProperty(key)) {
                    var col = data[key] || [];
                    for (var i = 0; i < col.length && i <= dataTableLimit; i++) {
                        var val = i === dataTableLimit ? '...' : col[i];
                        htmlLine.push('' + testHelper.encodeHTML(val) + '	');
                    }
                }
                htmlLine.push('
');
                html.push(htmlLine.join(''));
            }
        }

        html.push('

');

        return html.join('');
    }

    function detectSourceFormat(data) {
        if (data.length) {
            for (var i = 0, len = data.length; i < len; i++) {
                var item = data[i];

                if (item == null) {
                    continue;
                }
                else if (item.length) {
                    return 'arrayRows';
                }
                else if (typeof data === 'object') {
                    return 'objectRows';
                }
            }
        }
        else if (typeof data === 'object') {
            return 'keyedColumns';
        }
    }

    function createObjectHTML(obj, key) {
        return [
            '
',
            testHelper.encodeHTML(printObject(obj, key)),
            '
'
        ].join('');
    }

    var getDom = testHelper.getDom = function (domOrId) {
        return getType(domOrId) === 'string' ? document.getElementById(domOrId) : domOrId;
    }

    // resolves . and .. elements in a path array with directory names there
    // must be no slashes or device names (c:\) in the array
    // (so also no leading and trailing slashes - it does not distinguish
    // relative and absolute paths)
    function normalizePathArray(parts, allowAboveRoot) {
        var res = [];
        for (var i = 0; i < parts.length; i++) {
            var p = parts[i];

            // ignore empty parts
            if (!p || p === '.') {
                continue;
            }

            if (p === '..') {
                if (res.length && res[res.length - 1] !== '..') {
                    res.pop();
                } else if (allowAboveRoot) {
                    res.push('..');
                }
            } else {
                res.push(p);
            }
        }

        return res;
    }

    function getParamListFromURL() {
        var params = location.search.replace('?', '');
        return params ? params.split('&') : [];
    }

    context.testHelper = testHelper;

})(window);

redpajama_set_name: RedPajamaGithub


text:
$(document).ready(function() {
    $('.explorer-container').popover();
});


text:
cmake_minimum_required( VERSION 3.0.2 )

# define the cross compilation target
set( CMAKE_SYSTEM_NAME      "Generic" )
set( CMAKE_SYSTEM_PROCESSOR "Atmel-AVR" )

# mark the toolchain file as advanced
mark_as_advanced( CMAKE_TOOLCHAIN_FILE )

# mark unused, built-in CMake variables as advanced
mark_as_advanced( CMAKE_INSTALL_PREFIX )

# locate build tools
find_program( CMAKE_C_COMPILER   avr-gcc )
find_program( CMAKE_CXX_COMPILER avr-g++ )
find_program( CMAKE_LINKER       avr-ld )
find_program( CMAKE_NM           avr-nm )
find_program( CMAKE_OBJCOPY      avr-objcopy )
find_program( CMAKE_OBJDUMP      avr-objdump )
find_program( CMAKE_AR           avr-gcc-ar )
find_program( CMAKE_RANLIB       avr-ranlib )
find_program( CMAKE_STRIP        avr-strip )
mark_as_advanced(
    CMAKE_C_COMPILER
    CMAKE_CXX_COMPILER
)

# locate load tools
find_program( ATMEL_AVR_LOADER avrdude )
mark_as_advanced( ATMEL_AVR_LOADER )

# alter CMake archive creation to enable LTO
set( CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>" )
set( CMAKE_C_ARCHIVE_FINISH true )
set( CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>" )
set( CMAKE_CXX_ARCHIVE_FINISH true )

# provide optional MMCU configuration variables (defaults are for the Adafruit Metro Mini)
set( ATMEL_AVR_MMCU "atmega328p"  CACHE STRING "Atmel AVR MMCU" )
set( ATMEL_AVR_F_CPU "16000000UL" CACHE STRING "Atmel AVR CPU frequency in Hz" )

# provide optional loader configuration variables (defaults are for the Adafruit Metro
#       Mini)
option(
    ATMEL_AVR_LOADER_ENABLE_ALWAYS_RECOVER_FUSES
    "Atmel AVR avrdude always recover fuses"
    OFF
)
mark_as_advanced( ATMEL_AVR_LOADER_ENABLE_ALWAYS_RECOVER_FUSES )
if( ${ATMEL_AVR_LOADER_ENABLE_ALWAYS_RECOVER_FUSES} )
    set( ATMEL_AVR_LOADER_ALWAYS_RECOVER_FUSES "ALWAYS_RECOVER_FUSES" )

endif( ${ATMEL_AVR_LOADER_ENABLE_ALWAYS_RECOVER_FUSES} )

option(
    ATMEL_AVR_LOADER_ENABLE_AUTO_ERASE_FLASH
    "Atmel AVR avrdude auto erase flash"
    OFF
)
mark_as_advanced( ATMEL_AVR_LOADER_ENABLE_AUTO_ERASE_FLASH )
if( ${ATMEL_AVR_LOADER_ENABLE_AUTO_ERASE_FLASH} )
    set( ATMEL_AVR_LOADER_AUTO_ERASE_FLASH "AUTO_ERASE_FLASH" )

endif( ${ATMEL_AVR_LOADER_ENABLE_AUTO_ERASE_FLASH} )

option(
    ATMEL_AVR_LOADER_ENABLE_DISABLE_AUTO_VERIFY
    "Atmel AVR avrdude disable auto verify"
    OFF
)
mark_as_advanced( ATMEL_AVR_LOADER_ENABLE_DISABLE_AUTO_VERIFY )
if( ${ATMEL_AVR_LOADER_ENABLE_DISABLE_AUTO_VERIFY} )
    set( ATMEL_AVR_LOADER_DISABLE_AUTO_VERIFY "DISABLE_AUTO_VERIFY" )

endif( ${ATMEL_AVR_LOADER_ENABLE_DISABLE_AUTO_VERIFY} )

option(
    ATMEL_AVR_LOADER_ENABLE_DISABLE_FUSE_CHECK
    "Atmel AVR avrdude always recover fuses"
    OFF
)
mark_as_advanced( ATMEL_AVR_LOADER_ENABLE_DISABLE_FUSE_CHECK )
if( ${ATMEL_AVR_LOADER_ENABLE_DISABLE_FUSE_CHECK} )
    set( ATMEL_AVR_LOADER_DISABLE_FUSE_CHECK "DISABLE_FUSE_CHECK" )

endif( ${ATMEL_AVR_LOADER_ENABLE_DISABLE_FUSE_CHECK} )

option(
    ATMEL_AVR_LOADER_ENABLE_OVERRIDE_SIG_CHECK
    "Atmel AVR avrdude always recover fuses"
    OFF
)
mark_as_advanced( ATMEL_AVR_LOADER_ENABLE_OVERRIDE_SIG_CHECK )
if( ${ATMEL_AVR_LOADER_ENABLE_OVERRIDE_SIG_CHECK} )
    set( ATMEL_AVR_LOADER_OVERRIDE_SIG_CHECK "OVERRIDE_SIG_CHECK" )

endif( ${ATMEL_AVR_LOADER_ENABLE_OVERRIDE_SIG_CHECK} )

set( ATMEL_AVR_LOADER_BAUD_RATE      "115200"  CACHE STRING "Atmel AVR avrdude baud rate" )
set( ATMEL_AVR_LOADER_BIT_CLOCK      ""        CACHE STRINg "Atmel AVR avrdude bit clock" )
set( ATMEL_AVR_LOADER_CONFIG_FILE    ""        CACHE STRING "Atmel AVR avrdude config file" )
set( ATMEL_AVR_LOADER_DELAY          ""        CACHE STRING "Atmel AVR avrdude delay" )
set( ATMEL_AVR_LOADER_EXIT_SPEC      ""        CACHE STRING "Atmel AVR avrdude exit spec" )
set( ATMEL_AVR_LOADER_EXTENDED_PARAM ""        CACHE STRING "Atmel AVR avrdude extended parameter" )
set( ATMEL_AVR_LOADER_PART           "m328p"   CACHE STRING "Atmel AVR avrdude part" )
set( ATMEL_AVR_LOADER_PORT           ""        CACHE STRING "Atmel AVR avrdude connection port" )
set( ATMEL_AVR_LOADER_PROGRAMMER     "arduino" CACHE STRING "Atmel AVR avrdude programmer" )
set( ATMEL_AVR_LOADER_VERBOSITY      "VERBOSE" CACHE STRING "Atmel AVR avrdude verbosity" )

# Add load targets for an executable. The following load targets will be created:
#       <executable>-hex-eeprom
#               Creates the <executable>.eeprom.hex file for the EEPROM load/verify. This
#               target is added to ALL.
#       <executable>-hex-flash
#               Creates the <executable>.flash.hex file for the flash load/verify. This
#               target is added to ALL.
#       <executable>-load-eeprom
#               Load the EEPROM hex file.
#       <executable>-load-flash
#               Load the flash hex file.
#       <executable>-verify-eeprom
#               Verify EEPROM against the EEPROM hex file.
#       <executable>-verify-flash
#               Verify flash against the flash hex file.
#
# SYNOPSIS
#       atmel_avr_add_load_target( <executable>
#                                  [ALWAYS_RECOVER_FUSES]
#                                  [AUTO_ERASE_FLASH]
#                                  [DISABLE_AUTO_VERIFY]
#                                  [DISABLE_FUSE_CHECK]
#                                  [OVERRIDE_SIG_CHECK]
#                                  [BAUD_RATE <baud_rate>]
#                                  [BIT_CLOCK <bit_clock>]
#                                  [CONFIG_FILE <config_file>]
#                                  [DELAY <delay> ]
#                                  [EXIT_SPEC <exit_spec>]
#                                  [EXTENDED_PARAM <extended_param>]
#                                  [PART <part>]
#                                  [PORT <port>]
#                                  [PROGRAMMER <programmer>]
#                                  [VERBOSITY VERY_QUIET|QUIET|VERBOSE|VERY_VERBOSE] )
#
# OPTIONS
#       ALWAYS_RECOVER_FUSES
#               Equivalent to avrdude's -s option. Only affects "-load-" targets.
#       AUTO_ERASE_FLASH
#               Equivalent to NOT supplying avrdude's -D option. Only affects "-load-"
#               targets.
#       DISABLE_AUTO_VERIFY
#               Equivalent to avrdude's -V option. Only affects "-load-" targets.
#       DISABLE_FUSE_CHECK
#               Equivalent to avrdude's -u option. Only affects "-load-" targets.
#       OVERRIDE_SIG_CHECK
#               Equivalent to avrdude's -F option.
#       BAUD_RATE <baud_rate>
#               Equivalent to avrdude's -b option.
#       BIT_CLOCK <bit_clock>
#               Equivalent to avrdude's -B option.
#       CONFIG_FILE <config_file>
#               Equivalent to avrdude's -C option.
#       DELAY <delay>
#               Equivalent to avrdude's -i option.
#       <executable>
#               The name of the executable to make the load targets for.
#       EXIT_SPEC <exit_spec>
#               Equivalent to avrdude's -E option.
#       EXTENDED_PARAM <extended_param>
#               Equivalent to avrdude's -x option.
#       PART <part>
#               Equivalent to avrdude's -p option. If not provided, defaults to m328p.
#       PORT <port>
#               Equivalent to avrdude's -P option.
#       PROGRAMMER <programmer>
#               Equivalent to avrdude's -c option. If not provided, defaults to arduino.
#       VERBOSITY VERY_QUIET|QUIET|VERBOSE|VERY_VERBOSE
#               VERY_QUIET is equivalent to avrdude's -q -q option. QUIET is equivalent to
#               avrdude's -q option. VERBOSE is equivalent to avrdude's -v option.
#               VERY_VERBOSE is equivalent to avrdude's -v -v option.
#
# EXAMPLES
#       atmel_avr_add_load_target(
#           foo
#           CONFIG_FILE /home/jsmith/bin/arduino-1.8.1/hardware/tools/avr/etc/avrdude.conf
#           VERBOSITY VERBOSE
#           PART atmega328p
#           PROGRAMMER arduino
#           PORT /dev/ttyUSB0
#           BAUD_RATE 115200
#       )
#       atmel_avr_add_load_target(
#           foo
#           CONFIG_FILE /home/jsmith/bin/arduino-1.8.1/hardware/tools/avr/etc/avrdude.conf
#           VERBOSITY VERBOSE
#           PORT /dev/ttyUSB0
#           BAUD_RATE 115200
#       )
function( atmel_avr_add_load_target EXECUTABLE )
    # parse arguments
    set(
        options
        ALWAYS_RECOVER_FUSES
        AUTO_FLASH_ERASE
        DISABLE_AUTO_VERIFY
        DISABLE_FUSE_CHECK
        OVERRIDE_SIG_CHECK
    )
    set(
        one_value_args
        BAUD_RATE
        BIT_CLOCK
        CONFIG_FILE
        DELAY
        EXIT_SPEC
        EXTENDED_PARAM
        PART
        PORT
        PROGRAMMER
        VERBOSITY
    )
    set(
        multi_value_args
    )
    include( CMakeParseArguments )
    cmake_parse_arguments(
        atmel_avr_add_load_target
        "${options}"
        "${one_value_args}"
        "${multi_value_args}"
        ${ARGN}
    )

    # ensure there are no unrecognized arguments
    if( NOT "${atmel_avr_add_load_target_UNPARSED_ARGUMENTS}" STREQUAL "" )
        message(
            FATAL_ERROR
            "'${atmel_avr_add_load_target_UNPARSED_ARGUMENTS}' are not recognized arguments"
        )

    endif( NOT "${atmel_avr_add_load_target_UNPARSED_ARGUMENTS}" STREQUAL "" )

    # define how to build the flash hex file
    add_custom_command(
        OUTPUT ${EXECUTABLE}.flash.hex
        COMMAND ${CMAKE_OBJCOPY} -O ihex -R .eeprom ${EXECUTABLE} ${EXECUTABLE}.flash.hex
        DEPENDS ${EXECUTABLE}
    )

    # define how to build the EEPROM hex file
    add_custom_command(
        OUTPUT ${EXECUTABLE}.eeprom.hex
        COMMAND ${CMAKE_OBJCOPY} -O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load
        --no-change-warnings --change-section-lma .eeprom=0 ${EXECUTABLE} ${EXECUTABLE}.eeprom.hex
        DEPENDS ${EXECUTABLE}
    )

    # add the flash hex file target
    add_custom_target(
        ${EXECUTABLE}-hex-flash ALL
        DEPENDS ${EXECUTABLE}.flash.hex
    )

    # add the EEPROM hex file target
    add_custom_target(
        ${EXECUTABLE}-hex-eeprom ALL
        DEPENDS ${EXECUTABLE}.eeprom.hex
    )

    # configure the loader flags
    set( loader_load_flash_flags    "" )
    set( loader_load_eeprom_flags   "" )
    set( loader_verify_flash_flags  "" )
    set( loader_verify_eeprom_flags "" )

    if( NOT "${atmel_avr_add_load_target_PART}" STREQUAL "" )
        list( APPEND loader_load_flash_flags    "-p" ${atmel_avr_add_load_target_PART} )
        list( APPEND loader_load_eeprom_flags   "-p" ${atmel_avr_add_load_target_PART} )
        list( APPEND loader_verify_flash_flags  "-p" ${atmel_avr_add_load_target_PART} )
        list( APPEND loader_verify_eeprom_flags "-p" ${atmel_avr_add_load_target_PART} )

    else( NOT "${atmel_avr_add_load_target_PART}" STREQUAL "" )
        list( APPEND loader_load_flash_flags    "-p" "m328p" )
        list( APPEND loader_load_eeprom_flags   "-p" "m328p" )
        list( APPEND loader_verify_flash_flags  "-p" "m328p" )
        list( APPEND loader_verify_eeprom_flags "-p" "m328p" )

    endif( NOT "${atmel_avr_add_load_target_PART}" STREQUAL "" )

    if( NOT "${atmel_avr_add_load_target_BAUD_RATE}" STREQUAL "" )
        list( APPEND loader_load_flash_flags    "-b" ${atmel_avr_add_load_target_BAUD_RATE} )
        list( APPEND loader_load_eeprom_flags   "-b" ${atmel_avr_add_load_target_BAUD_RATE} )
        list( APPEND loader_verify_flash_flags  "-b" ${atmel_avr_add_load_target_BAUD_RATE} )
        list( APPEND loader_verify_eeprom_flags "-b" ${atmel_avr_add_load_target_BAUD_RATE} )

    endif( NOT "${atmel_avr_add_load_target_BAUD_RATE}" STREQUAL "" )

    if( NOT "${atmel_avr_add_load_target_BIT_CLOCK}" STREQUAL "" )
        list( APPEND loader_load_flash_flags    "-B" ${atmel_avr_add_load_target_BIT_CLOCK} )
        list( APPEND loader_load_eeprom_flags   "-B" ${atmel_avr_add_load_target_BIT_CLOCK} )
        list( APPEND loader_verify_flash_flags  "-B" ${atmel_avr_add_load_target_BIT_CLOCK} )
        list( APPEND loader_verify_eeprom_flags "-B" ${atmel_avr_add_load_target_BIT_CLOCK} )

    endif( NOT "${atmel_avr_add_load_target_BIT_CLOCK}" STREQUAL "" )

    if( NOT "${atmel_avr_add_load_target_PROGRAMMER}" STREQUAL "" )
        list( APPEND loader_load_flash_flags    "-c" ${atmel_avr_add_load_target_PROGRAMMER} )
        list( APPEND loader_load_eeprom_flags   "-c" ${atmel_avr_add_load_target_PROGRAMMER} )
        list( APPEND loader_verify_flash_flags  "-c" ${atmel_avr_add_load_target_PROGRAMMER} )
        list( APPEND loader_verify_eeprom_flags "-c" ${atmel_avr_add_load_target_PROGRAMMER} )

    else( NOT "${atmel_avr_add_load_target_PROGRAMMER}" STREQUAL "" )
        list( APPEND loader_load_flash_flags    "-c" "arduino" )
        list( APPEND loader_load_eeprom_flags   "-c" "arduino" )
        list( APPEND loader_verify_flash_flags  "-c" "arduino" )
        list( APPEND loader_verify_eeprom_flags "-c" "arduino" )

    endif( NOT "${atmel_avr_add_load_target_PROGRAMMER}" STREQUAL "" )

    if( NOT "${atmel_avr_add_load_target_CONFIG_FILE}" STREQUAL "" )
        list( APPEND loader_load_flash_flags    "-C" ${atmel_avr_add_load_target_CONFIG_FILE} )
        list( APPEND loader_load_eeprom_flags   "-C" ${atmel_avr_add_load_target_CONFIG_FILE} )
        list( APPEND loader_verify_flash_flags  "-C" ${atmel_avr_add_load_target_CONFIG_FILE} )
        list( APPEND loader_verify_eeprom_flags "-C" ${atmel_avr_add_load_target_CONFIG_FILE} )

    endif( NOT "${atmel_avr_add_load_target_CONFIG_FILE}" STREQUAL "" )

    if( NOT ${atmel_avr_add_load_target_AUTO_FLASH_ERASE} )
        list( APPEND loader_load_flash_flags "-D" )

    endif( NOT ${atmel_avr_add_load_target_AUTO_FLASH_ERASE} )

    if( NOT "${atmel_avr_add_load_target_EXIT_SPEC}" STREQUAL "" )
        list( APPEND loader_load_flash_flags    "-E" ${atmel_avr_add_load_target_EXIT_SPEC} )
        list( APPEND loader_load_eeprom_flags   "-E" ${atmel_avr_add_load_target_EXIT_SPEC} )
        list( APPEND loader_verify_flash_flags  "-E" ${atmel_avr_add_load_target_EXIT_SPEC} )
        list( APPEND loader_verify_eeprom_flags "-E" ${atmel_avr_add_load_target_EXIT_SPEC} )

    endif( NOT "${atmel_avr_add_load_target_EXIT_SPEC}" STREQUAL "" )

    if( ${atmel_avr_add_load_target_OVERRIDE_SIG_CHECK} )
        list( APPEND loader_load_flash_flags    "-F" )
        list( APPEND loader_load_eeprom_flags   "-F" )
        list( APPEND loader_verify_flash_flags  "-F" )
        list( APPEND loader_verify_eeprom_flags "-F" )

    endif( ${atmel_avr_add_load_target_OVERRIDE_SIG_CHECK} )

    if( NOT "${atmel_avr_add_load_target_DELAY}" STREQUAL "" )
        list( APPEND loader_load_flash_flags    "-i" ${atmel_avr_add_load_target_DELAY} )
        list( APPEND loader_load_eeprom_flags   "-i" ${atmel_avr_add_load_target_DELAY} )
        list( APPEND loader_verify_flash_flags  "-i" ${atmel_avr_add_load_target_DELAY} )
        list( APPEND loader_verify_eeprom_flags "-i" ${atmel_avr_add_load_target_DELAY} )

    endif( NOT "${atmel_avr_add_load_target_DELAY}" STREQUAL "" )

    if( NOT "${atmel_avr_add_load_target_PORT}" STREQUAL "" )
        list( APPEND loader_load_flash_flags    "-P" ${atmel_avr_add_load_target_PORT} )
        list( APPEND loader_load_eeprom_flags   "-P" ${atmel_avr_add_load_target_PORT} )
        list( APPEND loader_verify_flash_flags  "-P" ${atmel_avr_add_load_target_PORT} )
        list( APPEND loader_verify_eeprom_flags "-P" ${atmel_avr_add_load_target_PORT} )

    endif( NOT "${atmel_avr_add_load_target_PORT}" STREQUAL "" )

    if( NOT "${atmel_avr_add_load_target_VERBOSITY}" STREQUAL "" )
        if( "${atmel_avr_add_load_target_VERBOSITY}" STREQUAL "VERY_QUIET" )
            list( APPEND loader_load_flash_flags    "-q" "-q" )
            list( APPEND loader_load_eeprom_flags   "-q" "-q" )
            list( APPEND loader_verify_flash_flags  "-q" "-q" )
            list( APPEND loader_verify_eeprom_flags "-q" "-q" )

        elseif( "${atmel_avr_add_load_target_VERBOSITY}" STREQUAL "QUIET" )
            list( APPEND loader_load_flash_flags    "-q" )
            list( APPEND loader_load_eeprom_flags   "-q" )
            list( APPEND loader_verify_flash_flags  "-q" )
            list( APPEND loader_verify_eeprom_flags "-q" )

        elseif( "${atmel_avr_add_load_target_VERBOSITY}" STREQUAL "VERBOSE" )
            list( APPEND loader_load_flash_flags    "-v" )
            list( APPEND loader_load_eeprom_flags   "-v" )
            list( APPEND loader_verify_flash_flags  "-v" )
            list( APPEND loader_verify_eeprom_flags "-v" )

        elseif( "${atmel_avr_add_load_target_VERBOSITY}" STREQUAL "VERY_VERBOSE" )
            list( APPEND loader_load_flash_flags    "-v" "-v" )
            list( APPEND loader_load_eeprom_flags   "-v" "-v" )
            list( APPEND loader_verify_flash_flags  "-v" "-v" )
            list( APPEND loader_verify_eeprom_flags "-v" "-v" )

        else( "${atmel_avr_add_load_target_VERBOSITY}}" STREQUAL "VERY_QUIET" )
            message(
                FATAL_ERROR
                "'${atmel_avr_add_load_target_VERBOSITY}' is not a valid verbosity"
            )

        endif( "${atmel_avr_add_load_target_VERBOSITY}" STREQUAL "VERY_QUIET" )

    endif( NOT "${atmel_avr_add_load_target_VERBOSITY}" STREQUAL "" )

    if( ${atmel_avr_add_load_target_DISABLE_FUSE_CHECK} )
        list( APPEND loader_load_flash_flags  "-u" )
        list( APPEND loader_load_eeprom_flags "-u" )

    endif( ${atmel_avr_add_load_target_DISABLE_FUSE_CHECK} )

    if( ${atmel_avr_add_load_target_ALWAYS_RECOVER_FUSES} )
        list( APPEND loader_load_flash_flags  "-s" )
        list( APPEND loader_load_eeprom_flags "-s" )

    endif( ${atmel_avr_add_load_target_ALWAYS_RECOVER_FUSES} )

    if( ${atmel_avr_add_load_target_DISABLE_AUTO_VERIFY} )
        list( APPEND loader_load_flash_flags  "-V" )
        list( APPEND loader_load_eeprom_flags "-V" )

    endif( ${atmel_avr_add_load_target_DISABLE_AUTO_VERIFY} )

    if( NOT "${atmel_avr_add_load_target_EXTENDED_PARAM}" STREQUAL "" )
        list( APPEND loader_load_flash_flags    "-x" ${atmel_avr_add_load_target_EXTENDED_PARAM} )
        list( APPEND loader_load_eeprom_flags   "-x" ${atmel_avr_add_load_target_EXTENDED_PARAM} )
        list( APPEND loader_verify_flash_flags  "-x" ${atmel_avr_add_load_target_EXTENDED_PARAM} )
        list( APPEND loader_verify_eeprom_flags "-x" ${atmel_avr_add_load_target_EXTENDED_PARAM} )

    endif( NOT "${atmel_avr_add_load_target_EXTENDED_PARAM}" STREQUAL "" )

    # add the flash load target
    add_custom_target(
        ${EXECUTABLE}-load-flash
        COMMAND
        ${ATMEL_AVR_LOADER} ${loader_load_flash_flags} -U flash:w:${EXECUTABLE}.flash.hex
        DEPENDS ${EXECUTABLE}.flash.hex
    )

    # add the EEPROM load target
    add_custom_target(
        ${EXECUTABLE}-load-eeprom
        COMMAND
        ${ATMEL_AVR_LOADER} ${loader_load_eeprom_flags} -U eeprom:w:${EXECUTABLE}.eeprom.hex
        DEPENDS ${EXECUTABLE}.eeprom.hex
    )

    # add the flash verify target
    add_custom_target(
        ${EXECUTABLE}-verify-flash
        COMMAND
        ${ATMEL_AVR_LOADER} ${loader_verify_flash_flags} -U flash:v:${EXECUTABLE}.flash.hex:i
        DEPENDS ${EXECUTABLE}.flash.hex
    )

    # add the EEPROM verify target
    add_custom_target(
        ${EXECUTABLE}-verify-eeprom
        COMMAND
        ${ATMEL_AVR_LOADER} ${loader_verify_eeprom_flags} -U eeprom:v:${EXECUTABLE}.eeprom.hex:i
        DEPENDS ${EXECUTABLE}.eeprom.hex
    )

endfunction( atmel_avr_add_load_target )


text:
package gr.iti.mklab.simmo.core.associations;

import gr.iti.mklab.simmo.core.Association;
import gr.iti.mklab.simmo.core.UserAccount;
import org.mongodb.morphia.annotations.*;

import java.util.Date;

/**
 * Affiliation models the implicit relation between two {@link gr.iti.mklab.simmo.core.UserAccount}
 * e.g. be friends with, follows
 *
 * @author kandreadou
 * @version 1.0.0
 * @since August 21, 2014
 */
@Entity("Association")
public class Affiliation extends Association {

    public enum AFFILIATION_TYPE {
        FRIENDS_WITH, FOLLOWS, UNDEFINED
    }

    private AFFILIATION_TYPE affiliationType;

    private Date affiliationDate;

    public Affiliation(){}

    public Affiliation(UserAccount account, UserAccount affiliated, AFFILIATION_TYPE type, Date date) {
        super(account, affiliated);
        this.affiliationType = type;
        this.affiliationDate = date;
    }

    public Affiliation(UserAccount account, UserAccount affiliated) {
        super(account, affiliated);
    }

    public UserAccount getFirstAccount() {
        return (UserAccount) one;
    }

    public UserAccount getSecondAccount() {
        return (UserAccount) other;
    }

}


text:
const Error = require('@cardstack/plugin-utils/error');
const find = require('../async-find');

module.exports = class Field {
  constructor(model, plugins, allGrants, defaultValues, authLog) {
    this.id = model.id;
    this.authLog = authLog;
    if (!model.attributes || !model.attributes['field-type']) {
      throw new Error(`field ${model.id} has no field-type attribute`);
    }
    this.fieldType = model.attributes['field-type'];
    this.searchable = model.attributes.searchable == null ? true : model.attributes.searchable;

    // Default values are modeled as relationships to separate models
    // so that we can distinguish a default value of null from not
    // having a default value.

    this.defaultAtUpdate = this._lookupDefaultValue(model, 'default-at-update', defaultValues);
    this.defaultAtCreate = this._lookupDefaultValue(model, 'default-at-create', defaultValues);

    this.plugin = plugins.lookupFeatureAndAssert('field-types', this.fieldType);
    this.isRelationship = this.plugin.isRelationship;

    if (model.relationships && model.relationships['related-types'] && model.relationships['related-types'].data.length > 0) {
      this.relatedTypes = Object.create(null);
      for (let typeRef of model.relationships['related-types'].data) {
        if (typeRef.type !== 'content-types') {
          throw new Error(`field "${this.id}" has a related type that is not of type "content-types"`, {
            status: 400,
            title: "Non-type in related-types"
          });
        }
        this.relatedTypes[typeRef.id] = true;
      }
    } else {
      this.relatedTypes = null;
    }

    this.grants = allGrants.filter(g => g.fields == null || g.fields.includes(model.id));
  }

  _lookupDefaultValue(model, relationship, defaultValues) {
    if (model.relationships &&
        model.relationships[relationship] &&
        model.relationships[relationship].data) {
      let valueModelId = model.relationships[relationship].data.id;
      let valueModel = defaultValues.get(valueModelId);
      if (!valueModel) {
        throw new Error(`field ${this.id} refers to missing default value ${valueModelId}`);
      }
      return valueModel;
    }
  }

  _sectionName() {
    // only these two fields are hard-coded to be allowed at the top level of the document
    if (this.id === 'type' || this.id === 'id') {
      return 'top';
    }
    return this.isRelationship ? 'relationships' : 'attributes';
  }

  valueFrom(pendingChange, side='finalDocument') {
    let document = pendingChange[side];
    if (document) {
      let section = this._sectionName();
      if (section === 'top') {
        return document[this.id];
      } else if (document[section]) {
        return document[section][this.id];
      }
    }
  }

  pointer() {
    let sectionName = this._sectionName();
    if (sectionName === 'top') {
      return `/data/${this.id}`;
    } else {
      return `/data/${sectionName}/${this.id}`;
    }
  }

  _checkInWrongSection(pendingChange, errors) {
    let sectionName = this.isRelationship ? 'attributes' : 'relationships';
    let section = pendingChange.finalDocument[sectionName];
    if (section && section[this.id]) {
      errors.push(new Error(`field "${this.id}" should be in ${this._sectionName()}, not ${sectionName}`, {
        status: 400,
        source: { pointer: `/data/${sectionName}/${this.id}` }
      }));
    }
  }

  _validateFormat(value, errors) {
    // every field is allowed to be null -- validator plugins only run
    // when a non-null value is present. If you don't want to allow
    // null, you can do that via a constraint instead.
    if (value == null) { return; }

    let result = this.plugin.valid(value, { relatedTypes: this.relatedTypes });
    if (!result) {
      result = `${JSON.stringify(value)} is not a valid value for field "${this.id}"`;
    } else if (typeof result === 'string') {
      result = `field "${this.id}" ${result}`;
    }
    if (typeof result === 'string') {
      errors.push(new Error(result, {
        status: 400,
        title: "Validation error"
      }));
    }
  }

  async _defaultValueFor(pendingChange /*, context */) {
    let defaultInput;
    if (!pendingChange.originalDocument) {
      // We are creating.
      //   - If there's a creation default, use it.
      //
      //   - Otherwise an update default could apply here.
      //
      //   - Otherwise, "type" is special because we always have an
      //     implicit default type (if we didn't already know the
      //     type, we wouldn't have even gotten to here). Without
      //     this, anyone with a creation grant for a type would also
      //     need a field write grant for "type", which would be
      //     annoyingly redundant.
      //
      //   - Otherwise ask the field-type plugin it is has a default.
      //
      //   - Otherwise all fields default to null.
      defaultInput = this.defaultAtCreate || this.defaultAtUpdate || { value: this.id === 'type' ? pendingChange.finalDocument.type : (this.plugin.default || null) };
    } else {
      defaultInput = this.defaultAtUpdate;
    }

    if (defaultInput) {
      // A default was set. Now we run it through the plugin
      // implementation, if there is one.
      if (defaultInput.value != null && typeof this.plugin.generateDefault === 'function') {
        return { value: await this.plugin.generateDefault(defaultInput.value) };
      } else {
        return defaultInput;
      }
    }
  }

  async applyDefault(pendingChange,  context) {
    let defaultValue = await this._defaultValueFor(pendingChange, context);
    if (defaultValue) {
      pendingChange.serverProvidedValues.set(this.id,defaultValue.value);
      if (!pendingChange.originalDocument) {
        if (this.valueFrom(pendingChange, 'finalDocument') !== undefined) {
          // The user provided a value at creation, so defaults do not
          // apply.
          return;
        }
      } else {
        let newValue = this.valueFrom(pendingChange, 'finalDocument');
        let oldValue = this.valueFrom(pendingChange, 'originalDocument');
        if (newValue !== oldValue) {
          // The user is altering this value, so defaults do not apply.
          return;
        }
      }

      let section = this._sectionName();
      if (section === 'top') {
        pendingChange.finalDocument[this.id] = defaultValue.value;
      } else {
        if (!pendingChange.finalDocument[section]) {
          pendingChange.finalDocument[section] = {};
        }
        pendingChange.finalDocument[section][this.id] = defaultValue.value;
      }
    }
  }

  async validationErrors(pendingChange, context) {
    let value = this.valueFrom(pendingChange, 'finalDocument');
    let grant;

    if (pendingChange.serverProvidedValues.has(this.id) && pendingChange.serverProvidedValues.get(this.id) === value) {
      this.authLog.debug("approved field write for %s because it matches server provided default", this.id);
    } else if (pendingChange.originalDocument && value === this.valueFrom(pendingChange, 'originalDocument')) {
      this.authLog.debug("approved field write for %s because it was unchanged", this.id);
    } else if ((grant = await find(this.grants, async g => g['may-write-field'] && await g.matches(pendingChange, context)))) {
      this.authLog.debug("approved field write for %s because of grant %s", this.id, grant.id);
    } else {
      // Denied
      this.authLog.debug("denied field write for %s", this.id);
      return [new Error(`You may not write field "${this.id}"`, {
        status: 401
      })];
    }

    let errors = [];
    this._checkInWrongSection(pendingChange, errors);
    this._validateFormat(value, errors);
    return errors;
  }
  mapping() {
    let m = {
      [this.id]: Object.assign({}, this.plugin.defaultMapping())
    };

    if (!this.searchable) {
      if (m[this.id].type === 'object') {
        m[this.id].enabled = false;
      } else {
        m[this.id].index = false;
      }
    }

    if (this.plugin.derivedMappings) {
      Object.assign(m, this.plugin.derivedMappings(this.id));
    }
    return m;
  }
  get sortFieldName() {
    if (this.plugin.sortFieldName) {
      return this.plugin.sortFieldName(this.id);
    } else {
      return this.id;
    }
  }
  get queryFieldName() {
    if (this.plugin.queryFieldName) {
      return this.plugin.queryFieldName(this.id);
    } else {
      return this.id;
    }
  }

  derivedFields(value) {
    if (this.plugin.derivedFields) {
      return this.plugin.derivedFields(this.id, value);
    }
  }

};


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1" />
<title>TestLoadIncrementalHFilesSplitRecovery xref</title>
<link type="text/css" rel="stylesheet" href="../../../../../stylesheet.css" />

1
18  package org.apache.hadoop.hbase.mapreduce;
19
20  import static org.junit.Assert.assertEquals;
21  import static org.junit.Assert.assertTrue;
22  import static org.junit.Assert.fail;
23
24  import java.io.IOException;
25  import java.nio.ByteBuffer;
26  import java.util.Collection;
27  import java.util.Deque;
28  import java.util.List;
29  import java.util.NavigableMap;
30  import java.util.concurrent.ExecutorService;
31  import java.util.concurrent.atomic.AtomicInteger;
32
33  import org.apache.commons.logging.Log;
34  import org.apache.commons.logging.LogFactory;
35  import org.apache.hadoop.conf.Configuration;
36  import org.apache.hadoop.fs.FileSystem;
37  import org.apache.hadoop.fs.Path;
38  import org.apache.hadoop.hbase.HBaseTestingUtility;
39  import org.apache.hadoop.hbase.HColumnDescriptor;
40  import org.apache.hadoop.hbase.HRegionInfo;
41  import org.apache.hadoop.hbase.HRegionLocation;
42  import org.apache.hadoop.hbase.HTableDescriptor;
43  import org.apache.hadoop.hbase.LargeTests;
44  import org.apache.hadoop.hbase.TableExistsException;
45  import org.apache.hadoop.hbase.client.HConnection;
46  import org.apache.hadoop.hbase.client.HTable;
47  import org.apache.hadoop.hbase.client.Result;
48  import org.apache.hadoop.hbase.client.ResultScanner;
49  import org.apache.hadoop.hbase.client.Scan;
50  import org.apache.hadoop.hbase.ipc.HRegionInterface;
51  import org.apache.hadoop.hbase.regionserver.HRegionServer;
52  import org.apache.hadoop.hbase.regionserver.TestHRegionServerBulkLoad;
53  import org.apache.hadoop.hbase.util.Bytes;
54  import org.apache.hadoop.hbase.util.Pair;
55  import org.junit.AfterClass;
56  import org.junit.BeforeClass;
57  import org.junit.Test;
58  import org.junit.experimental.categories.Category;
59  import org.mockito.Mockito;
60
61  import com.google.common.collect.Multimap;
62
63  /**
64   * Test cases for the atomic load error handling of the bulk load functionality.
65   */
66  @Category(LargeTests.class)
67  public class TestLoadIncrementalHFilesSplitRecovery {
68    final static Log LOG = LogFactory.getLog(TestHRegionServerBulkLoad.class);
69
70    static HBaseTestingUtility util;
71
72    final static int NUM_CFS = 10;
73    final static byte[] QUAL = Bytes.toBytes("qual");
74    final static int ROWCOUNT = 100;
75
76    private final static byte[][] families = new byte[NUM_CFS][];
77    static {
78      for (int i = 0; i < NUM_CFS; i++) {
79        families[i] = Bytes.toBytes(family(i));
80      }
81    }
82
83    static byte[] rowkey(int i) {
84      return Bytes.toBytes(String.format("row_%08d", i));
85    }
86
87    static String family(int i) {
88      return String.format("family_%04d", i);
89    }
90
91    static byte[] value(int i) {
92      return Bytes.toBytes(String.format("%010d", i));
93    }
94
95    public static void buildHFiles(FileSystem fs, Path dir, int value)
96        throws IOException {
97      byte[] val = value(value);
98      for (int i = 0; i < NUM_CFS; i++) {
99        Path testIn = new Path(dir, family(i));
100
101       TestHRegionServerBulkLoad.createHFile(fs, new Path(testIn, "hfile_" + i),
102           Bytes.toBytes(family(i)), QUAL, val, ROWCOUNT);
103     }
104   }
105
106   /**
107    * Creates a table with given table name and specified number of column
108    * families if the table does not already exist.
109    */
110   private void setupTable(String table, int cfs) throws IOException {
111     try {
112       LOG.info("Creating table " + table);
113       HTableDescriptor htd = new HTableDescriptor(table);
114       for (int i = 0; i < 10; i++) {
115         htd.addFamily(new HColumnDescriptor(family(i)));
116       }
117
118       util.getHBaseAdmin().createTable(htd);
119     } catch (TableExistsException tee) {
120       LOG.info("Table " + table + " already exists");
121     }
122   }
123
124   private Path buildBulkFiles(String table, int value) throws Exception {
125     Path dir = util.getDataTestDir(table);
126     Path bulk1 = new Path(dir, table+value);
127     FileSystem fs = util.getTestFileSystem();
128     buildHFiles(fs, bulk1, value);
129     return bulk1;
130   }
131
132   /**
133    * Populate table with known values.
134    */
135   private void populateTable(String table, int value) throws Exception {
136     // create HFiles for different column families
137     LoadIncrementalHFiles lih = new LoadIncrementalHFiles(util.getConfiguration());
138     Path bulk1 = buildBulkFiles(table, value);
139     HTable t = new HTable(util.getConfiguration(), Bytes.toBytes(table));
140     lih.doBulkLoad(bulk1, t);
141   }
142
143   /**
144    * Split the known table in half.  (this is hard coded for this test suite)
145    */
146   private void forceSplit(String table) {
147     try {
148       // need to call regions server to by synchronous but isn't visible.
149       HRegionServer hrs = util.getRSForFirstRegionInTable(Bytes
150           .toBytes(table));
151
152       for (HRegionInfo hri : hrs.getOnlineRegions()) {
153         if (Bytes.equals(hri.getTableName(), Bytes.toBytes(table))) {
154           // splitRegion doesn't work if startkey/endkey are null
155           hrs.splitRegion(hri, rowkey(ROWCOUNT / 2)); // hard code split
156         }
157       }
158
159       // verify that split completed.
160       int regions;
161       do {
162         regions = 0;
163         for (HRegionInfo hri : hrs.getOnlineRegions()) {
164           if (Bytes.equals(hri.getTableName(), Bytes.toBytes(table))) {
165             regions++;
166           }
167         }
168         if (regions != 2) {
169           LOG.info("Taking some time to complete split...");
170           Thread.sleep(250);
171         }
172       } while (regions != 2);
173     } catch (IOException e) {
174       e.printStackTrace();
175     } catch (InterruptedException e) {
176       e.printStackTrace();
177     }
178   }
179
180   @BeforeClass
181   public static void setupCluster() throws Exception {
182     util = new HBaseTestingUtility();
183     util.startMiniCluster(1);
184   }
185
186   @AfterClass
187   public static void teardownCluster() throws Exception {
188     util.shutdownMiniCluster();
189   }
190
191   /**
192    * Checks that all columns have the expected value and that there is the
193    * expected number of rows.
194    */
195   void assertExpectedTable(String table, int count, int value) {
196     try {
197       assertEquals(util.getHBaseAdmin().listTables(table).length, 1);
198
199       HTable t = new HTable(util.getConfiguration(), table);
200       Scan s = new Scan();
201       ResultScanner sr = t.getScanner(s);
202       int i = 0;
203       for (Result r : sr) {
204         i++;
205         for (NavigableMap<byte[], byte[]> nm : r.getNoVersionMap().values()) {
206           for (byte[] val : nm.values()) {
207             assertTrue(Bytes.equals(val, value(value)));
208           }
209         }
210       }
211       assertEquals(count, i);
212     } catch (IOException e) {
213       fail("Failed due to exception");
214     }
215   }
216
217   /**
218    * Test that shows that exception thrown from the RS side will result in an
219    * exception on the LIHFile client.
220    */
221   @Test(expected=IOException.class)
222   public void testBulkLoadPhaseFailure() throws Exception {
223     String table = "bulkLoadPhaseFailure";
224     setupTable(table, 10);
225
226     final AtomicInteger attmptedCalls = new AtomicInteger();
227     final AtomicInteger failedCalls = new AtomicInteger();
228     LoadIncrementalHFiles lih = new LoadIncrementalHFiles(
229         util.getConfiguration()) {
230
231       protected List<LoadQueueItem> tryAtomicRegionLoad(final HConnection conn,
232           byte[] tableName, final byte[] first, Collection<LoadQueueItem> lqis)
233       throws IOException {
234         int i = attmptedCalls.incrementAndGet();
235         if (i == 1) {
236           HConnection errConn = null;
237           try {
238             errConn = getMockedConnection(util.getConfiguration());
239           } catch (Exception e) {
240             LOG.fatal("mocking cruft, should never happen", e);
241             throw new RuntimeException("mocking cruft, should never happen");
242           }
243           failedCalls.incrementAndGet();
244           return super.tryAtomicRegionLoad(errConn, tableName, first, lqis);
245         }
246
247         return super.tryAtomicRegionLoad(conn, tableName, first, lqis);
248       }
249     };
250
251     // create HFiles for different column families
252     Path dir = buildBulkFiles(table, 1);
253     HTable t = new HTable(util.getConfiguration(), Bytes.toBytes(table));
254     lih.doBulkLoad(dir, t);
255
256     fail("doBulkLoad should have thrown an exception");
257   }
258
259   private HConnection getMockedConnection(final Configuration conf)
260   throws IOException {
261     HConnection c = Mockito.mock(HConnection.class);
262     Mockito.when(c.getConfiguration()).thenReturn(conf);
263     Mockito.doNothing().when(c).close();
264     // Make it so we return a particular location when asked.
265     final HRegionLocation loc = new HRegionLocation(HRegionInfo.FIRST_META_REGIONINFO,
266         "example.org", 1234);
267     Mockito.when(c.getRegionLocation((byte[]) Mockito.any(),
268         (byte[]) Mockito.any(), Mockito.anyBoolean())).
269       thenReturn(loc);
270     Mockito.when(c.locateRegion((byte[]) Mockito.any(), (byte[]) Mockito.any())).
271       thenReturn(loc);
272     HRegionInterface hri = Mockito.mock(HRegionInterface.class);
273     Mockito.when(hri.bulkLoadHFiles(Mockito.anyList(), (byte [])Mockito.any(),
274       Mockito.anyBoolean())).thenThrow(new IOException("injecting bulk load error"));
275     Mockito.when(c.getHRegionConnection(Mockito.anyString(), Mockito.anyInt())).
276       thenReturn(hri);
277     return c;
278   }
279
280   /**
281    * This test exercises the path where there is a split after initial
282    * validation but before the atomic bulk load call. We cannot use presplitting
283    * to test this path, so we actually inject a split just before the atomic
284    * region load.
285    */
286   @Test
287   public void testSplitWhileBulkLoadPhase() throws Exception {
288     final String table = "splitWhileBulkloadPhase";
289     setupTable(table, 10);
290     populateTable(table,1);
291     assertExpectedTable(table, ROWCOUNT, 1);
292
293     // Now let's cause trouble.  This will occur after checks and cause bulk
294     // files to fail when attempt to atomically import.  This is recoverable.
295     final AtomicInteger attemptedCalls = new AtomicInteger();
296     LoadIncrementalHFiles lih2 = new LoadIncrementalHFiles(
297         util.getConfiguration()) {
298
299       protected void bulkLoadPhase(final HTable htable, final HConnection conn,
300           ExecutorService pool, Deque<LoadQueueItem> queue,
301           final Multimap<ByteBuffer, LoadQueueItem> regionGroups) throws IOException {
302         int i = attemptedCalls.incrementAndGet();
303         if (i == 1) {
304           // On first attempt force a split.
305           forceSplit(table);
306         }
307
308         super.bulkLoadPhase(htable, conn, pool, queue, regionGroups);
309       }
310     };
311
312     // create HFiles for different column families
313     HTable t = new HTable(util.getConfiguration(), Bytes.toBytes(table));
314     Path bulk = buildBulkFiles(table, 2);
315     lih2.doBulkLoad(bulk, t);
316
317     // check that data was loaded
318     // The three expected attempts are 1) failure because need to split, 2)
319     // load of split top 3) load of split bottom
320     assertEquals(attemptedCalls.get(), 3);
321     assertExpectedTable(table, ROWCOUNT, 2);
322   }
323
324   /**
325    * This test splits a table and attempts to bulk load.  The bulk import files
326    * should be split before atomically importing.
327    */
328   @Test
329   public void testGroupOrSplitPresplit() throws Exception {
330     final String table = "groupOrSplitPresplit";
331     setupTable(table, 10);
332     populateTable(table, 1);
333     assertExpectedTable(table, ROWCOUNT, 1);
334     forceSplit(table);
335
336     final AtomicInteger countedLqis= new AtomicInteger();
337     LoadIncrementalHFiles lih = new LoadIncrementalHFiles(
338         util.getConfiguration()) {
339       protected List<LoadQueueItem> groupOrSplit(
340           Multimap<ByteBuffer, LoadQueueItem> regionGroups,
341           final LoadQueueItem item, final HTable htable,
342           final Pair<byte[][], byte[][]> startEndKeys) throws IOException {
343         List<LoadQueueItem> lqis = super.groupOrSplit(regionGroups, item, htable, startEndKeys);
344         if (lqis != null) {
345           countedLqis.addAndGet(lqis.size());
346         }
347         return lqis;
348       }
349     };
350
351     // create HFiles for different column families
352     Path bulk = buildBulkFiles(table, 2);
353     HTable ht = new HTable(util.getConfiguration(), Bytes.toBytes(table));
354     lih.doBulkLoad(bulk, ht);
355
356     assertExpectedTable(table, ROWCOUNT, 2);
357     assertEquals(20, countedLqis.get());
358   }
359
360   /**
361    * This simulates an remote exception which should cause LIHF to exit with an
362    * exception.
363    */
364   @Test(expected = IOException.class)
365   public void testGroupOrSplitFailure() throws Exception {
366     String table = "groupOrSplitFailure";
367     setupTable(table, 10);
368
369     LoadIncrementalHFiles lih = new LoadIncrementalHFiles(
370         util.getConfiguration()) {
371       int i = 0;
372
373       protected List<LoadQueueItem> groupOrSplit(
374           Multimap<ByteBuffer, LoadQueueItem> regionGroups,
375           final LoadQueueItem item, final HTable table,
376           final Pair<byte[][], byte[][]> startEndKeys) throws IOException {
377         i++;
378
379         if (i == 5) {
380           throw new IOException("failure");
381         }
382         return super.groupOrSplit(regionGroups, item, table, startEndKeys);
383       }
384     };
385
386     // create HFiles for different column families
387     Path dir = buildBulkFiles(table,1);
388     HTable t = new HTable(util.getConfiguration(), Bytes.toBytes(table));
389     lih.doBulkLoad(dir, t);
390
391     fail("doBulkLoad should have thrown an exception");
392   }
393
394   @org.junit.Rule
395   public org.apache.hadoop.hbase.ResourceCheckerJUnitRule cu =
396     new org.apache.hadoop.hbase.ResourceCheckerJUnitRule();
397 }
398

This page was automatically generated by Maven


text:
<md-toolbar>

Projects

      Projects
      keyboard_arrow_right

{{ project.name }}

 {{ project.lastActiveBranch }}

change branch

      search
      <input type="search" placeholder="Rechercher">

      <button md-raised-button color="secondary" (click)="onUnfold()">

      </button>

      <button md-raised-button color="secondary" (click)="onFold()">

      </button>

      <button md-raised-button color="secondary" (click)="onExport()">

      </button>

      <button md-raised-button color="primary" class="padding-horizontal" (click)="onCommit()" disabled="{{ isSaveDisabled() }}">
        I'm done!
         0">{{ project.pendingChanges.length }}
      </button>

</md-toolbar>


text:
package com.loca.addressbook.remoteregistry;

public class RemoteCatalogueFactory {

    private int defaultPort = 61616;
    //ll

    public RemoteCatalogueFactory() {

    }

    public RemoteCatalogueProxy create(String host) {
        return new AtomicRemoteCatalogueProxy(host, defaultPort);
    }
}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <base data-ice="baseUrl" href="../../../">
  <title data-ice="title">src/concepts/target.js | API Document</title>
  <link type="text/css" rel="stylesheet" href="css/style.css">
  <link type="text/css" rel="stylesheet" href="css/prettify-tomorrow.css">

  Home

  Reference
  Source

  Repository

    <input class="search-input">

commands
CCommand

CGive

CMsg

CSay

CSpawnpoint

CTell

CW

concepts
CCoordinate

CItem

CPlayer

CTargetSelector

constants
Vitems

helpers
FtoDataTag

src/concepts/target.js

/** @module concepts */

/**
 * The target selector
 *
 * @example
 * const target = new TargetSelector('p');
 * target.toString(); // @p
 *
 * const targetWithArgs = new TargetSelector('p', {
 *   coordinate: [x, y, z],
 *   radius: [min, max],
 *   gamemode: Gamemode.ALL,
 *   count: 3,
 *   level: [min, max],
 *   score: [min, max],
 *   team: 'Red',
 *   name: 'name',
 *   volume: [dx, dy, dz],
 *   vertical: [min, max],
 *   horizontal: [min, max],
 *   type: 'Creeper'
 * });
 *
 * @see
 * http://minecraft.gamepedia.com/Commands#Target_selector_arguments
 */
export default class TargetSelector {

  /**
   * @param {string} variable can be 'p', 'r', 'a', 'e'.
   * @param {object} args the options for variable.
   */
  constructor(variable, args) {
    this._variable = {
      'p': '@p', // nearest player
      'r': '@r', // random player
      'a': '@a', // all players
      'e': '@e' // all entities
    }[variable || 'p'];
    this._arguments = this._getArgsString(args);
  }

  _getArgsString(args) {
    if (typeof args == 'undefined') {
      return '';
    }
    let str = '';
    for (let key in args) {
      let value = args[key], arr = [];
      switch (key) {
        case 'coordinate':
          if (value instanceof Array) {
            let x = value[0], y = value[1], z = value[2];
            if (x) arr.push(`x=${x}`);
            if (y) arr.push(`y=${y}`);
            if (z) arr.push(`z=${z}`);
          }
          break;
        case 'radius':
          if (value instanceof Array) {
            let rmin = value[0], rmax = value[1];
            if (rmin) arr.push(`rm=${rmin}`);
            if (rmax) arr.push(`r=${rmax}`);
          }
          break;
        case 'gamemode':
          if (value instanceof Number) {
            arr.push(`m=${value}`);
          }
          break;
        case 'count':
          if (value instanceof Number) {
            arr.push(`c=${value}`);
          }
          break;
        // TODO: resolve the rest arguments.
        default:
          throw new Error(`unresolved argument: ${key}`);
          break;
      }
      str += str ? ',' : '';
      str += arr.join(',');
    }
    return `[${str}]`;
  }

  /**
   * return assembled string.
   * @returns {string}
   */
  toString() {
    return [this._variable, this._arguments].join('');
  }

}

  Generated by ESDoc(0.4.0)


text:
@interface CAEmitterBehavior (TFEasyCoder)

-(CAEmitterBehavior  *(^)(NSString *  name))set_name;
-(CAEmitterBehavior  *(^)(BOOL  enabled))set_enabled;

//superclass pros NSObject
-(CAEmitterBehavior  *(^)(NSArray *  accessibilityElements))set_accessibilityElements;
-(CAEmitterBehavior  *(^)(NSArray *  accessibilityCustomActions))set_accessibilityCustomActions;
-(CAEmitterBehavior  *(^)(BOOL  isAccessibilityElement))set_isAccessibilityElement;
-(CAEmitterBehavior  *(^)(NSString *  accessibilityLabel))set_accessibilityLabel;
-(CAEmitterBehavior  *(^)(NSString *  accessibilityHint))set_accessibilityHint;
-(CAEmitterBehavior  *(^)(NSString *  accessibilityValue))set_accessibilityValue;
-(CAEmitterBehavior  *(^)(unsigned long long  accessibilityTraits))set_accessibilityTraits;
-(CAEmitterBehavior  *(^)(UIBezierPath *  accessibilityPath))set_accessibilityPath;
-(CAEmitterBehavior  *(^)(CGPoint  accessibilityActivationPoint))set_accessibilityActivationPoint;
-(CAEmitterBehavior  *(^)(NSString *  accessibilityLanguage))set_accessibilityLanguage;
-(CAEmitterBehavior  *(^)(BOOL  accessibilityElementsHidden))set_accessibilityElementsHidden;
-(CAEmitterBehavior  *(^)(BOOL  accessibilityViewIsModal))set_accessibilityViewIsModal;
-(CAEmitterBehavior  *(^)(BOOL  shouldGroupAccessibilityChildren))set_shouldGroupAccessibilityChildren;
-(CAEmitterBehavior  *(^)(long long  accessibilityNavigationStyle))set_accessibilityNavigationStyle;

@end


text:
namespace base {

class Time;

// Argument type used to specify the hour clock type.
enum HourClockType {
  k12HourClock,  // Uses 1-12. e.g., "3:07 PM"
  k24HourClock,  // Uses 0-23. e.g., "15:07"
};

// Argument type used to specify whether or not to include AM/PM sign.
enum AmPmClockType {
  kDropAmPm,  // Drops AM/PM sign. e.g., "3:07"
  kKeepAmPm,  // Keeps AM/PM sign. e.g., "3:07 PM"
};

// Returns the time of day, e.g., "3:07 PM".
BASE_I18N_EXPORT string16 TimeFormatTimeOfDay(const Time& time);

// Returns the time of day in the specified hour clock type. e.g.
// "3:07 PM" (type == k12HourClock, ampm == kKeepAmPm).
// "3:07"    (type == k12HourClock, ampm == kDropAmPm).
// "15:07"   (type == k24HourClock).
BASE_I18N_EXPORT string16 TimeFormatTimeOfDayWithHourClockType(
    const Time& time,
    HourClockType type,
    AmPmClockType ampm);

// Returns a shortened date, e.g. "Nov 7, 2007"
BASE_I18N_EXPORT string16 TimeFormatShortDate(const Time& time);

// Returns a numeric date such as 12/13/52.
BASE_I18N_EXPORT string16 TimeFormatShortDateNumeric(const Time& time);

// Returns a numeric date and time such as "12/13/52 2:44:30 PM".
BASE_I18N_EXPORT string16 TimeFormatShortDateAndTime(const Time& time);

// Formats a time in a friendly sentence format, e.g.
// "Monday, March 6, 2008 2:44:30 PM".
BASE_I18N_EXPORT string16 TimeFormatFriendlyDateAndTime(const Time& time);

// Formats a time in a friendly sentence format, e.g.
// "Monday, March 6, 2008".
BASE_I18N_EXPORT string16 TimeFormatFriendlyDate(const Time& time);

// Gets the hour clock type of the current locale. e.g.
// k12HourClock (en-US).
// k24HourClock (en-GB).
BASE_I18N_EXPORT HourClockType GetHourClockType();

}  // namespace base

#endif  // BASE_I18N_TIME_FORMATTING_H_


text:
package org.lastaflute.db.jta;

import org.lastaflute.jta.core.ExtendedTransaction;
import org.lastaflute.jta.core.LaTransactionManager;

/**
 * @author jflute
 */
public class HookedTransactionManager extends LaTransactionManager {

    @Override
    protected ExtendedTransaction createTransaction() {
        return newRomanticTransaction();
    }

    protected RomanticTransaction newRomanticTransaction() {
        return new RomanticTransaction();
    }
}


text:
package nl.xillio.xill.plugins.mongodb.constructs;

import nl.xillio.xill.TestUtils;
import nl.xillio.xill.api.components.MetaExpression;
import nl.xillio.xill.api.components.RobotID;
import nl.xillio.xill.api.construct.ConstructContext;
import nl.xillio.xill.plugins.mongodb.services.Connection;
import nl.xillio.xill.plugins.mongodb.services.ConnectionFactory;
import nl.xillio.xill.plugins.mongodb.services.ConnectionManager;
import org.testng.annotations.Test;

import java.util.UUID;

import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;

public class ConnectConstructTest extends TestUtils {
    @Test
    public void testCreateNewConnection() {
        ConnectionFactory factory = mock(ConnectionFactory.class, RETURNS_DEEP_STUBS);
        ConnectionManager connectionManager = new ConnectionManager(factory);
        ConnectConstruct connectConstruct = new ConnectConstruct(connectionManager);
        ConstructContext context = new ConstructContext(RobotID.dummyRobot(), RobotID.dummyRobot(), connectConstruct, null, UUID.randomUUID(), null, null);
        MetaExpression result = connectConstruct.process(
                fromValue("database"),
                fromValue("localhost"),
                fromValue(1423),
                fromValue("username"),
                fromValue("password123"),
                context);

        assertEquals(result.getStringValue(), "Mongo[username@localhost:1423/database]");
        assertFalse(result.getMeta(Connection.class).isClosed());
    }
}


text:
// Copyright 2009 the Sputnik authors.  All rights reserved.
/**
 * Catching objects with try/catch/finally statement
 *
 * @path ch12/12.14/S12.14_A18_T1.js
 * @description Catching undefined
 */

// CHECK#1
try{
  throw undefined;
}
catch(e){
  if (e!==undefined) $ERROR('#1: Exception === undefined. Actual: '+e);
}


text:
=============================
Douglas on the command line
=============================

Douglas comes with a command line tool called ``douglas-cmd``.  It allows
you to create new blogs, verify your configuration, run compiling,
render single urls, and run command line functions implemented in plugins.

For help, do:

.. code-block:: bash

   $ douglas-cmd --help

It'll list the commands and options available.

If you tell it where your config file is, then it'll list commands and
options available as well as those implemented in plugins you have installed.

For example:

.. code-block:: bash

   $ douglas-cmd --config=/path/to/config.py --help

For more information on compiling, see :ref:`compiling`.


text:
/**
 * Wraps the event watcher of a contract into a JS Promise
 * @param {Object} event - The event we are watching
 * @param {function} cb - Supports optional callback function that can override the "stopWatching"
 */
function eventPromise(event, cb = null) {
    return new Promise((resolve, reject) => {
        event.watch((err, result) => {
            if (!err) {
                if (cb) {
                    // Do something with every watch event hit
                    cb(result);
                } else {
                    // Otherwise just stop watching on the first hit
                    event.stopWatching();
                }
                // Resolve with the last result plus the event
                // (in case we need to manually stop watching - or do anything else with it)
                resolve({result, event});
            } else {
                reject(err);
            }
        });
    });
}

/*
* Original Solution (adpated to normal promise)
* zeppelin-solidity/test/helpers/expectThrow.js
* https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/test/helpers/expectThrow.js
*/
function expectThrow(promise, done) {
    promise.then(() => {
        assert.fail('Expected throw not received');
        done();
    })
    .catch(error => {
        // TODO: Check jump destination to destinguish between a throw
        //       and an actual invalid jump.
        const invalidOpcode = error.message.search('invalid opcode') >= 0;
        // TODO: When we contract A calls contract B, and B throws, instead
        //       of an 'invalid jump', we get an 'out of gas' error. How do
        //       we distinguish this from an actual out of gas event? (The
        //       testrpc log actually show an 'invalid jump' event.)
        const outOfGas = error.message.search('out of gas') >= 0;
        assert(invalidOpcode || outOfGas, "Expected throw, got '" + error + "' instead");
        done();
    });
};

module.exports = { eventPromise, expectThrow };


text:
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------------------------

namespace System.ServiceModel.Configuration
{
    using System.ComponentModel;
    using System.Configuration;
    using System.ServiceModel;
    using System.Globalization;
    using System.ServiceModel.Security;
    using System.ServiceModel.Channels;
    using System.Net.Security;

    public partial class NetNamedPipeBindingElement : StandardBindingElement
    {
        public NetNamedPipeBindingElement(string name)
            : base(name)
        {
        }

        public NetNamedPipeBindingElement()
            : this(null)
        {
        }

        protected override Type BindingElementType
        {
            get { return typeof(NetNamedPipeBinding); }
        }

        [ConfigurationProperty(ConfigurationStrings.TransactionFlow, DefaultValue = TransactionFlowDefaults.Transactions)]
        public bool TransactionFlow
        {
            get { return (bool)base[ConfigurationStrings.TransactionFlow]; }
            set { base[ConfigurationStrings.TransactionFlow] = value; }
        }

        [ConfigurationProperty(ConfigurationStrings.TransferMode, DefaultValue = ConnectionOrientedTransportDefaults.TransferMode)]
        [ServiceModelEnumValidator(typeof(TransferModeHelper))]
        public TransferMode TransferMode
        {
            get { return (TransferMode)base[ConfigurationStrings.TransferMode]; }
            set { base[ConfigurationStrings.TransferMode] = value; }
        }

        [ConfigurationProperty(ConfigurationStrings.TransactionProtocol, DefaultValue = TransactionFlowDefaults.TransactionProtocolString)]
        [TypeConverter(typeof(TransactionProtocolConverter))]
        public TransactionProtocol TransactionProtocol
        {
            get { return (TransactionProtocol)base[ConfigurationStrings.TransactionProtocol]; }
            set { base[ConfigurationStrings.TransactionProtocol] = value; }
        }

        [ConfigurationProperty(ConfigurationStrings.HostNameComparisonMode, DefaultValue = ConnectionOrientedTransportDefaults.HostNameComparisonMode)]
        [ServiceModelEnumValidator(typeof(HostNameComparisonModeHelper))]
        public HostNameComparisonMode HostNameComparisonMode
        {
            get { return (HostNameComparisonMode)base[ConfigurationStrings.HostNameComparisonMode]; }
            set { base[ConfigurationStrings.HostNameComparisonMode] = value; }
        }

        [ConfigurationProperty(ConfigurationStrings.MaxBufferPoolSize, DefaultValue = TransportDefaults.MaxBufferPoolSize)]
        [LongValidator(MinValue = 0)]
        public long MaxBufferPoolSize
        {
            get { return (long)base[ConfigurationStrings.MaxBufferPoolSize]; }
            set { base[ConfigurationStrings.MaxBufferPoolSize] = value; }
        }

        [ConfigurationProperty(ConfigurationStrings.MaxBufferSize, DefaultValue = TransportDefaults.MaxBufferSize)]
        [IntegerValidator(MinValue = 1)]
        public int MaxBufferSize
        {
            get { return (int)base[ConfigurationStrings.MaxBufferSize]; }
            set { base[ConfigurationStrings.MaxBufferSize] = value; }
        }

        [ConfigurationProperty(ConfigurationStrings.MaxConnections, DefaultValue = ConnectionOrientedTransportDefaults.MaxPendingConnectionsConst)]
        [IntegerValidator(MinValue = 0)]
        public int MaxConnections
        {
            get { return (int)base[ConfigurationStrings.MaxConnections]; }
            set { base[ConfigurationStrings.MaxConnections] = value; }
        }

        [ConfigurationProperty(ConfigurationStrings.MaxReceivedMessageSize, DefaultValue = TransportDefaults.MaxReceivedMessageSize)]
        [LongValidator(MinValue = 1)]
        public long MaxReceivedMessageSize
        {
            get { return (long)base[ConfigurationStrings.MaxReceivedMessageSize]; }
            set { base[ConfigurationStrings.MaxReceivedMessageSize] = value; }
        }

        [ConfigurationProperty(ConfigurationStrings.ReaderQuotas)]
        public XmlDictionaryReaderQuotasElement ReaderQuotas
        {
            get { return (XmlDictionaryReaderQuotasElement)base[ConfigurationStrings.ReaderQuotas]; }
        }

        [ConfigurationProperty(ConfigurationStrings.Security)]
        public NetNamedPipeSecurityElement Security
        {
            get { return (NetNamedPipeSecurityElement)base[ConfigurationStrings.Security]; }
        }

        protected internal override void InitializeFrom(Binding binding)
        {
            base.InitializeFrom(binding);
            NetNamedPipeBinding npnpBinding = (NetNamedPipeBinding)binding;

            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.TransactionFlow, npnpBinding.TransactionFlow);
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.TransferMode, npnpBinding.TransferMode);
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.TransactionProtocol, npnpBinding.TransactionProtocol);
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.HostNameComparisonMode, npnpBinding.HostNameComparisonMode);
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxBufferPoolSize, npnpBinding.MaxBufferPoolSize);
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxBufferSize, npnpBinding.MaxBufferSize);
            if (npnpBinding.IsMaxConnectionsSet)
            {
                ConfigurationProperty maxConnectionsProperty = this.Properties[ConfigurationStrings.MaxConnections];
                SetPropertyValue(maxConnectionsProperty, npnpBinding.MaxConnections, false /*ignore locks*/);
            }
            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxReceivedMessageSize, npnpBinding.MaxReceivedMessageSize);
            this.Security.InitializeFrom(npnpBinding.Security);
            this.ReaderQuotas.InitializeFrom(npnpBinding.ReaderQuotas);
        }

        protected override void OnApplyConfiguration(Binding binding)
        {
            NetNamedPipeBinding npnpBinding = (NetNamedPipeBinding)binding;

            npnpBinding.TransactionFlow = this.TransactionFlow;
            npnpBinding.TransferMode = this.TransferMode;
            npnpBinding.TransactionProtocol = this.TransactionProtocol;
            npnpBinding.HostNameComparisonMode = this.HostNameComparisonMode;
            npnpBinding.MaxBufferPoolSize = this.MaxBufferPoolSize;
            PropertyInformationCollection propertyInfo = this.ElementInformation.Properties;
            if (propertyInfo[ConfigurationStrings.MaxBufferSize].ValueOrigin != PropertyValueOrigin.Default)
            {
                npnpBinding.MaxBufferSize = this.MaxBufferSize;
            }
            if (this.MaxConnections != 0)
            {
                npnpBinding.MaxConnections = this.MaxConnections;
            }
            npnpBinding.MaxReceivedMessageSize = this.MaxReceivedMessageSize;
            this.Security.ApplyConfiguration(npnpBinding.Security);
            this.ReaderQuotas.ApplyConfiguration(npnpBinding.ReaderQuotas);
        }
    }
}


text:
package morbrian.mormessages.persistence;

import morbrian.mormessages.model.ForumEntity;
import morbrian.mormessages.model.MessageEntity;
import org.slf4j.Logger;

import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.List;

@ApplicationScoped public class Repository {

  public static final int DEFAULT_QUERY_OFFSET = 0;

  public static final int DEFAULT_RESULT_SIZE = 100;

  public static final Calendar DEFAULT_QUERY_GREATER_THAN = new GregorianCalendar(2010, 0, 1);

  @Inject private transient Logger logger;

  @Inject private EntityManager em;

  public List<ForumEntity> listForums() {
    //noinspection unchecked
    return listForums(DEFAULT_QUERY_OFFSET, DEFAULT_RESULT_SIZE, DEFAULT_QUERY_GREATER_THAN);
  }

  public List<ForumEntity> listForums(Integer offset, Integer resultSize, Calendar greaterThan) {
    //noinspection unchecked
    return em.createNamedQuery(ForumEntity.FIND_ALL_WHERE_MODIFIED_GREATER_THAN)
        .setParameter("modifiedTime",
            (greaterThan != null) ? greaterThan : DEFAULT_QUERY_GREATER_THAN)
        .setFirstResult((offset != null) ? offset : DEFAULT_QUERY_OFFSET)
        .setMaxResults((resultSize != null) ? resultSize : DEFAULT_RESULT_SIZE).getResultList();
  }

  public ForumEntity findForumByUuid(String uuid) throws NoResultException {
    return (ForumEntity) em.createNamedQuery(ForumEntity.FIND_ONE_BY_UUID)
        .setParameter("uuid", uuid).getSingleResult();
  }

  public ForumEntity findForumByTitle(String title) throws NoResultException {
    return (ForumEntity) em.createNamedQuery(ForumEntity.FIND_ONE_BY_TITLE)
        .setParameter("title", title).getSingleResult();
  }

  public List<MessageEntity> listMessagesInForum(String forumUuid) {
    return listMessagesInForum(forumUuid, DEFAULT_QUERY_OFFSET, DEFAULT_RESULT_SIZE,
        DEFAULT_QUERY_GREATER_THAN);
  }

  public List<MessageEntity> listMessagesInForum(String forumUuid, Integer offset,
      Integer resultSize, Calendar greaterThan) {
    //noinspection unchecked
    return em.createNamedQuery(MessageEntity.FIND_ALL_IN_FORUM_WHERE_MODIFIED_GREATER_THAN)
        .setParameter("forumUuid", forumUuid).setParameter("modifiedTime",
            (greaterThan != null) ? greaterThan : DEFAULT_QUERY_GREATER_THAN)
        .setFirstResult((offset != null) ? offset : DEFAULT_QUERY_OFFSET)
        .setMaxResults((resultSize != null) ? resultSize : DEFAULT_RESULT_SIZE).getResultList();
  }

  public MessageEntity findMessageByUuid(String uuid) throws NoResultException {
    return (MessageEntity) em.createNamedQuery(MessageEntity.FIND_ONE_BY_UUID)
        .setParameter("uuid", uuid).getSingleResult();
  }

}