text:
/*jslint browser: true, maxerr: 50, indent: 4, maxlen: 79 */
(function ($) {
    "use strict";

    //------------------------------
    //
    // Constants
    //
    //------------------------------

        /**
         * The date format for updates.
         */
    var DATE_FORMAT = "M j Y h:i A",

        /**
         * The selectors for finding wizard steps.
         */
        WIZ_SEARCH = [
            "[data-wizard-step*={0}]",
            "[data-wizard-not]:not([data-wizard-not*={0}])"
        ].join(", "),
        WIZ_LAST = $.strf(WIZ_SEARCH, "last"),
        RX_CLEAR_NUMERIC = /[^0-9\.\-]*/g,

    //------------------------------
    // Uploader
    //------------------------------

        UPLOADER_TEMPLATE = '
' +
            '' +
            '{dropProcessingText}' +
            '{statusText}' +
            '' +
            '

',
        UPLOADER_ICON = ' ',

    //------------------------------
    // Links
    //------------------------------

        /**
         * Classes which indicate disabled links.
         * @type {string}
         */
        DISABLED = ".disabled, .inactive",

    //------------------------------
    // Third party includes
    //------------------------------

        /**
         * URL for including typekits.
         * @type {string}
         */
        TYPEKIT_URL = "https://use.typekit.net/{}.js",

        /**
         * URL for including mathjax.
         * @type {string}
         */
        MATHJAX_URL = "https://c328740.ssl.cf1.rackcdn.com/mathjax/latest/MathJax.js?{}",

        /**
         * URL for including ckeditor.
         * @type {string}
         */
        CKEDITOR_URL = "https://s3.amazonaws.com/knewton.marketing/ckeditor/{}/ckeditor.js",
        CKEDITOR_JQUERY_URL = "https://s3.amazonaws.com/knewton.marketing/ckeditor/{}/adapters/jquery.js",

    //------------------------------
    // Bootstrap
    //------------------------------

        SPANS = "span" + [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12].join(" span"),

    //------------------------------
    //
    // Properties
    //
    //------------------------------

        /**
         * All the fixed table headers.
         */
        fixedHeaders = $(),

        /**
         * The queue for loading mathjax typesetters before it loads.
         * @type {jQuery}
         */
        mathjaxQueue = $();

    //------------------------------
    //
    // Methods
    //
    //------------------------------

    //------------------------------
    // Utility
    //------------------------------

    function uuid() {
        return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx"
            .replace(/[xy]/g, function (c) {
                var r = Math.random() * 16 | 0;
                if (c !== "x") {
                    r = r & 0x3 | 0x8;
                }
                return r.toString(16);
            });
    }

    /**
     * Returns the full name for the given user identity.
     * @param {Object} u The user identity.
     */
    function userFullName(u) {
        if (u) {
            if (u.first_name && u.last_name) {
                return $.strf("{} {}", u.first_name, u.last_name);
            }

            if (u.id) {
                return "[" + u.id + "]";
            }
        } else {
            return "(Unknown Unknown)";
        }
    }

    //------------------------------
    // Application
    //------------------------------

    /**
     * Show a loaded application.
     */
    function loadApplication() {
        $(".application-pane").show();
        $(".application-loading").hide();
    }

    //------------------------------
    // Authentication
    //------------------------------

    /**
     * Handles an authenticated user.
     * @param {Object} u The user identity.
     */
    function authenticated(u) {
        if (!$.whitelabel.authEveryTime) {
            loadApplication();
        }

        $(".when-authenticated").removeClass("hide");
        if (u !== null) {
            u.full_name = userFullName(u);
            $.update({
                ".user-first-name": {
                    text: u.first_name
                },
                ".user-last-name": {
                    text: u.last_name
                },
                ".user-full-name": {
                    text: u.full_name
                },
                ".user-email": {
                    text: u.email
                }
            });
            $("#user-profile, .user-profile").show();

            if ($.whitelabel.doLocalize) {
                // It's okay if this is empty, there's a default language
                $.setLanguage(u.language);
            }
        } else if ($.whitelabel.doLocalize) {
            // Use the default language
            $.setLanguage();
        }
    }

    //------------------------------
    // Links
    //------------------------------

    /**
     * Determine if the selector matches the element or a parent.
     * @param {jQuery} e The element.
     * @param {string} sel The selector.
     * @return {jQuery?} The matcher, if any.
     */
    function inStack(e, sel) {
        var o = null;

        if (e.is(sel)) {
            o = e;
        } else {
            o = e.parents(sel);
            if (!o.length) {
                o = null;
            }
        }

        return o;
    }

    /**
     * .inactive and .disabled clicks do nothing, unless it's a disabled
     * combined with a special click (ctrl/meta/middle-mouse)
     * @param {Event} event The click event.
     */
    function bodyClick(event) {
        var e = inStack($(event.target), ".inactive, .disabled"),
            special = (event.ctrlKey || event.metaKey || event.which === 2);

        // Allow disabled anchor tags with special click to go through.
        if (e && !(e.is("a.disabled") && special)) {
            event.preventDefault();
        }
    }

    function thirdPartyInclude(name, url, fn) {
        var e = $($.strf("meta[name={}]", name));
        if (e.length) {
            $.holdReady(true);
            $.getScript($.strf(url, e.attr("content")), function () {
                if ($.isFunction(fn)) {
                    fn();
                }
                $.holdReady();
            });
            e.remove();
        }
    }

    /**
     * Includes third party scripts after load.
     */
    function includeThirdParty() {
        thirdPartyInclude("mathjax", MATHJAX_URL, function () {
            MathJax.Hub.Config({
                tex2jax: {inlineMath: [['$_','$_']]}
            });
            mathjaxQueue.mathjax();
        });
        thirdPartyInclude("typekit", TYPEKIT_URL, function () {
            try { Typekit.load(); } catch (e) {}
        });
        thirdPartyInclude("ckeditor", CKEDITOR_URL, function() {
            thirdPartyInclude("ckeditor_jquery", CKEDITOR_JQUERY_URL,
                    function() {});
        });
    }

    function getQueryParams() {
        var path = window.location.search;
        if (path.substr(-1) === "/") {
            // Some odd bug adds a trailing slash to the search when using
            // a port. Strip the slash before testing. If you want to use
            // a slash in your query params... don't.
            path = path.slice(0, -1);
        }

        return $.deparam(path.substr(1));
    }

    function fluidApplication(not) {
        if (not) {
            $(".wl-container")
                .removeClass("container-fluid")
                .addClass("container");
            $(".wl-row")
                .removeClass("row-fluid")
                .addClass("row");
        } else {
            $(".wl-container")
                .removeClass("container")
                .addClass("container-fluid");
            $(".wl-row")
                .removeClass("row")
                .addClass("row-fluid");
        }
    }

    function customErrors() {
        $("body").addClass("custom-errors");
    }

    function framedApplication() {
        $("body").addClass("framed-application");
    }

    function largeContainers() {
        $("body").addClass("large-containers");
        $(".wl-row").removeClass("row").addClass("row-fluid");
    }

    function ucwords (str) {
        // http://kevin.vanzonneveld.net
        return (str + '')
                .replace(/^([a-z\u00E0-\u00FC])|\s+([a-z\u00E0-\u00FC])/g,
                        function (m) { return m.toUpperCase(); });
    }

    function columnApplication(left, center, right, fluid, flush, grail, cb) {
        fluid = Boolean(fluid);
        flush = Boolean(flush);
        grail = Boolean(grail);

        // ColumnBorder
        cb = parseInt(cb, 10);

        var leftRel = false,
            centerRel = false,
            rightRel = false,
            total = 0,
            hasLeft = false,
            hasCenter = false,
            hasRight = false;

        if (typeof left === "string") {
            leftRel = left.substr(-2) === "px" ||
                    right.substr(-1) === "%";
        }
        if (typeof center === "string") {
            centerRel = center.substr(-2) === "px" ||
                    center.substr(-1) === "%";
        }
        if (typeof right === "string") {
            rightRel = right.substr(-2) === "px" ||
                    right.substr(-1) === "%";
        }

        if (!leftRel) {
            left = parseInt(left, 10) || -1;
            hasLeft = left > -1;
        } else {
            hasLeft = true;
        }

        if (!centerRel) {
            center = parseInt(center, 10) || -1;
            hasCenter = left > -1;
        } else {
            hasCenter = true;
        }

        if (!rightRel) {
            right = parseInt(right, 10) || -1;
            hasRight = left > -1;
        } else {
            hasRight = true;
        }

        $("#body-wrapper")
            .addClass("row" + (fluid ? "-fluid" : "") +
                    (flush ? " no-space" : ""));

        if (hasLeft) {
            if (leftRel) {
                $("#application-left").css("width", left);
            } else {
                $("#application-left").addClass("span" + left);
            }
        } else {
            $("#application-left").remove();
        }

        if (hasCenter) {
            if (centerRel) {
                if (!grail) {
                    $("#application-body").css("width", center);
                }
            } else {
                $("#application-body").addClass("span" + center);
            }
        } else {
            $("#application-body").remove();
        }

        if (hasRight) {
            if (rightRel) {
                $("#application-right").css("width", right);
            } else {
                $("#application-right").addClass("span" + right);
            }
        } else {
            $("#application-right").remove();
        }

        if (grail) {
            $("body").addClass("grail-columns");
            right = parseInt(right, 10) + cb;
            left = parseInt(left, 10) + cb;
            total += left + right;

            $("#column-wrapper").css("left", total);
            $("#body-wrapper").css("marginLeft", -1 * right);

            $("#application-body").css({
                marginLeft: left,
                marginRight: right
            }).wrap($$("div#content-wrapper").css("right", left));
            // Need to move the content-wrapper to be first.
            $("#content-wrapper").parent()
                .prepend($("#content-wrapper").detach());
        }
    }

    function fixedTableHeaders(dTable) {
        var table = $(dTable[0]),
            headers;

        if (!table.hasClass("fixed-headers")) {
            headers = table.find("thead").children().clone(true)
                .appendTo("#fixed-headers").find("th").on("click",
                    function () {
                        table.find("tr:eq(0)").children().show().each(function (i, v) {
                            headers.eq(i)
                                .removeClass("sorting_asc sorting_desc sorting")
                                .addClass(v.className);
                            $(":focus").blur();
                        });
                    });
            table.data("headers", headers).addClass("fixed-headers").show();
            fixedHeaders = fixedHeaders.add(headers);
        } else {
            headers = table.data("headers").show().children().find("th");
        }

        table.find("tr:eq(0)").children().show().each(function (i, v) {
            headers.eq(i).css("width", $(v).width())
                .removeClass("sorting_asc sorting_desc sorting")
                .addClass(v.className);
        });
    }

    function preventDefault(event) {
        event.preventDefault();
    }

    function shadeClick(event) {
        event.preventDefault();

        if ($.whitelabel.deeplinkShades) {
            if ($.deeplink.query.hshade) {
                $.setRoute("?hshade=");
            } else {
                $.setRoute("?hshade=true");
            }
        } else {
            $("body").toggleClass("header-shade-open");
            $("#header-shade").toggle();
        }
    }

    function infoClick(event) {
        event.preventDefault();
        if ($.whitelabel.deeplinkShades && $.whitelabel.deeplinkInfoShade) {
            if ($.deeplink.query.ishade) {
                $.setRoute("?ishade=");
            } else {
                $.setRoute("?ishade=true");
            }
        } else {
            $("body").toggleClass("info-shade-open");
            $("#info-shade").toggle();
        }
    }

    //------------------------------
    // Framed table
    //------------------------------

    /**
     * Creates the framed table layout used extensively in retail.
     * @param {Array} headers The localization table headers.
     * @param {string} lcon The localization context for this table.
     * @param {string} cName The API call this table is populated from.
     * @param {string} uri The location to send the add button to.
     * @param {jQuery} extra Extra HTML to inject.
     * @param {Object?} cData The data to use in the API call.
     * @param {string?} act The localization string for the action.
     * @param {string?} title The localization string for the title.
     * @return {jQuery.dataTable} The data table instance of the first element.
     */
    function framedTable(headers, lcon, cName, uri, extra, cData, act, title) {
        var element = this.eq(0),
            table,
            dTable,
            thead,
            proxy,
            attrs = {
                "data-template": "framed-table",
                "data-refresh-call": cName
            },
            columnHeaders = [],
            actionUpdate = {
                html: $.loc(act || "act", lcon)
            };

        if ($.isPlainObject(uri)) {
            $.extend(true, actionUpdate, uri);
        } else if ($.isFunction(uri)) {
            actionUpdate.on = {"click": uri};
        } else {
            actionUpdate.attr = {href: uri};
        }

        proxy = $.api(cName, true, function (data) {
            table.find(".update-screen").addClass("hide");
            table.find(".updated_on").html($.dateformat.format(DATE_FORMAT));
            table.find(".refresher").removeClass("active")
                    .find(".icon-spin").removeClass("icon-spin");
        });
        table = element.attr(attrs).resetTemplate().update({
            ".title": $.loc(title || "title", lcon),
            ".no-content": $.loc("none", lcon),
            ".updated_on": $.dateformat.format(DATE_FORMAT),
            ".refresher": {
                on: {"click do-refresh": function (event) {
                    var e = $(this);
                    table.find(".updated_on").html($.loc("updating_now"));
                    event.preventDefault();
                    if (!e.is(".active")) {
                        table.find(".update-screen").css({
                            width: element.width(),
                            height: element.height()
                        }).removeClass("hide");
                        $(":focus").blur();
                        $(this).addClass("active")
                            .find(".icon-refresh").addClass("icon-spin");
                        proxy(cData);
                    }
                }}
            },
            ".trigger-button": actionUpdate
        }, 0);
        thead = table.find("tr.table-header").resetTemplate();

        if (extra !== undefined) {
            table.find(".extra").append(extra);
        }

        $.each(headers, function (index, pck) {
            var name, value;
            if ($.isArray(pck)) {
                name = pck[0];
                value = pck[1];
            } else {
                name = pck;
                value = null;
            }

            thead.update({html: $.loc(name, lcon)}, columnHeaders.length);
            columnHeaders.push(value);
        });

        dTable = table.find("table.table").dataTable({
            aaSorting: [[0, "asc"]],
            bAutoWidth: false,
            oLanguage: {
                sSearch: $.loc("search_table", "common"),
                sEmptyTable: $.loc("empty_table", "common"),
                sZeroRecords: $.loc("zero_table", "common")
            },
            iDisplayLength: 10,
            aoColumns: columnHeaders
        });

        table.find("table.table").wrap($$("div.table-scroller"));

        return dTable;
    }

    /**
     * Wrap a string in a span.nowrap element. This is used in the data table
     * for strings that shouldn't wrap.
     * @param {string} s The string to wrap.
     */
    function nowrap(s) {
        return $.strf('{}', s);
    }

    /**
     * Clears any currently active inplace trigers.
     */
    function clearInplace() {
        var e = $(".inplace-trigger.active-trigger")
                .removeClass("active-trigger");

        e.find(".triggered").addClass("hide");
        e.find(".untriggered").removeClass("hide");
    }

    /**
     * Turn an HREF into a link.
     */
    function hrefWrap(href, title, target) {
        if (!href) {
            return "";
        }

        if (!title) {
            title = "";
        } else {
            title = $.strf(' title="{}"', title);
        }

        if (!target) {
            target = "";
        } else {
            target = $.strf(' target="{}"', target);
        }

        return $.strf('{0}', href, title, target);
    }

    /**
     * Handle an inplace click.
     * @param {Event} event
     */
    function inplace(event) {
        var element = $(this),
            container = element.parents(".inplace-trigger");

        clearInplace();

        container.addClass("active-trigger")
            .find(".triggered").removeClass("hide")
            .find(":text:first").focus();

        if (!container.is(".inplace-trigger-rect")) {
            container.find(".untriggered").addClass("hide");
        }

        event.preventDefault();
    }

    //------------------------------
    // Modal workspace
    //------------------------------

    /**
     * Resets the specified (or all) workspace(s).
     * @param {string?} sel The selector to reset.
     */
    function resetWorkspaces(sel) {
        $(sel || ".workspace").removeClass("in dirty confirmed")
            .find(".modal-confirm, .modal-warning").slideUp("fast");
    }

    /**
     * Displays a modal warning message for the given workspace.
     * @param {string} msg The error message.
     */
    function modalWarning(msg) {
        var e = this.find(".modal-warning");
        if (msg) {
            e.find(".warning-message").html(msg);
            e.addClass("active-message").slideDown("fast");
        } else {
            if (e.hasClass("active-message")) {
                e.removeClass("active-message").slideUp("fast");
            }
        }
        return this;
    }

    /**
     * Triggered when the modal attempts to close.
     * @param {Event} event
     */
    function canHide(event) {
        var e = $(this),
            forDeeplink = ($.deeplink.isLoading || $.deeplink.isError);
        $(":focus").blur();
        if (e.is(".dirty:not(.confirmed)")) {
            e.trigger("prompt-force-close");
            if (e.is(".modal")) {
                e.find(".modal-confirm").slideDown("fast");
                return forDeeplink;
            }
            if (!forDeeplink && e.is(".lightbox")) {
                event.stopImmediatePropagation();
            }
        }

        if (e.is(".modal")) {
            resetWorkspaces(e);
            return true;
        }
    }

    /**
     * Click handler.
     * @param {event} Event The click event.
     */
    function cancelClose(event) {
        event.preventDefault();
        $(this).parents(".modal-confirm").slideUp("fast");
    }

    /**
     * Click handler.
     * @param {event} Event The click event.
     */
    function confirmAndClose(event) {
        event.preventDefault();
        var e = $(this).parents(".workspace")
                    .addClass("confirmed")
                    .trigger("force-closed");
        if (e.is(".lightbox")) {
            $.lightbox("!");
        } else if (e.is("modal")) {
            e.modal("hide");
        }
    }

    /**
     * Bubble up the save and close event click.
     * @param {Event} event
     */
    function bubbleSaveClose(event) {
        var e = $(this).parents(".workspace");
        if (e.is(".prompt-save-close,.force-save")) {
            event.preventDefault();
            e.trigger("force-save-closed");
        } else {
            e.trigger("save-close");
            confirmAndClose.call(this, event);
        }
    }

    /**
     * Creates a modal workspace.
     * @param {function} onCancel
     * @param {function} onSaveClose
     */
    function modalWorkspace(onCancel, onSaveClose, onClose, onForceSave) {
        return this.each(function () {
            var e = $(this).addClass("modal-workspace").on("hide", canHide);

            e.find(".cancel-close").on("click", cancelClose);
            e.find(".confirm-close").on("click", confirmAndClose);
            e.find(".save-close").on("click", bubbleSaveClose);
            if ($.isFunction(onForceSave)) {
                e.on("force-save-closed", onForceSave);
            }
            if ($.isFunction(onCancel)) {
                e.on("force-closed", onCancel);
            }
            if ($.isFunction(onSaveClose)) {
                e.on("save-close", onSaveClose);
            }
            if ($.isFunction(onClose)) {
                e.on("hidden", onClose);
            }

            e.on("force-closed", function (event) {
                $(this).parents(".modal").modal("hide");
            });
        });
    }

    /**
     * Creates a modal workspace.
     * @param {function} onCancel
     * @param {function} onSaveClose
     */
    function lightboxWorkspace(onPrompt, onSaveClose, onClose, onForceSave) {
        return this.each(function () {
            var e = $(this).addClass("lightbox-workspace")
                        .on("unloading.lightbox", canHide);

            e.find(".confirm-close").on("click", confirmAndClose);
            e.find(".save-close").on("click", bubbleSaveClose);
            if ($.isFunction(onPrompt)) {
                e.on("prompt-force-close", onPrompt);
            }
            if ($.isFunction(onSaveClose)) {
                e.on("save-close", onSaveClose);
            }
            if ($.isFunction(onClose)) {
                e.on("closed.lightbox", onClose);
            }
            if ($.isFunction(onForceSave)) {
                e.on("force-save-closed", onForceSave);
            }
        });
    }

    //------------------------------
    // Auto wizard
    //------------------------------

    function doWizardChange(e, tab, navigation, index) {
        var s = e.find("[data-wizard-step], [data-wizard-not]")
                    .addClass("hide"),
            x = s.filter($.strf(WIZ_SEARCH, index)),
            pages = navigation.children().length;

        x.removeClass("hide");
        e.trigger("wizard-step", [index, pages]);
        e.find(".modal-confirm").slideUp("fast");

        e.find("[data-wizard-active]")
            .removeClass("active")
            .filter("[data-wizard-active*=" + index + "]")
                .addClass("active");
    }

    function autoWizard() {
        return this.each(function () {
            var e = $(this),
                lastChange;
            e.find(".wizard-next, .wizard-prev")
                .on("click", preventDefault);
            e.bootstrapWizard({
                nextSelector: ".wizard-next",
                previousSelector: ".wizard-prev",
                onTabShow: function (tab, navigation, index) {
                    if (lastChange !== index) {
                        lastChange = index;
                        doWizardChange(e, tab, navigation, index);
                    }
                }
            });
        });
    }

    //------------------------------
    // Uploader
    //------------------------------

    function injectUploader(form, button, calls, selector, endpoint, extra) {
        var element = (selector === undefined) ?
                    form.find(":file").parent().empty()[0] :
                    form.find(selector).empty()[0],
            callResponse,
            callProxy,
            cb = $.isFunction(calls) ? calls : null,
            uploader = new qq.FineUploader({
                multiple: false,
                button: button,
                element: element,
                dragAndDrop: {
                    disableDefaultDropzone: true,
                    hideDropzones: false
                },
                request: {
                    inputName: "data",
                    customHeaders: {
                        "Authorization": $.api.authHeader
                    },
                    forceMultipart: true,
                    endpoint: endpoint || '/'
                },
                text: {
                    uploadButton: UPLOADER_ICON + $.loc("files", "common"),
                    failUpload: $.loc("failed_upload", "common")
                },
                autoUpload: true,
                template: UPLOADER_TEMPLATE,
                callbacks: {
                    onComplete: function (id, fileName, response) {
                        uploader.clearStoredFiles();
                        if (callResponse) {
                            $.extend(callResponse, response);
                            callProxy(200);
                        }
                        if (cb !== null) {
                            cb(true, response);
                        }
                    },
                    onError: function (id, fileName, reason) {
                        uploader.clearStoredFiles();
                        if (callResponse) {
                            callResponse.message = reason;
                            callProxy(400, callResponse);
                        }
                        if (cb !== null) {
                            cb(false, reason);
                        }
                    }
                },
                validation: {
                    allowedExtensions: ['jpeg', 'jpg', 'gif', 'png', 'svg'],
                    sizeLimit: 1048576
                }
            });

        // Software that tells you how you work is the devil.
        uploader._origMaybeParse = uploader._maybeParseAndSendUploadError;
        uploader._maybeParseAndSendUploadError = function (a, b, c, d) {
            var code = d.status;
            if (code >= 200 && code < 300 && $.inArray(code, [301, 304])) {
                // Successful, do nothing
            } else {
                uploader._origMaybeParse.apply(uploader, arguments);
            }
        }

        if (cb !== null) {
            return uploader;
        }

        $.api.intercept(calls, function (resp, data, headers, urlp, url, cp) {
            callProxy = cp;
            callResponse = resp;
            uploader._options.request.endpoint = url;
            uploader._handler._options.endpoint = url;
            uploader.uploadStoredFiles();
            return -1; // We will call the proxy when we're done
        });

        return uploader;
    }

    function loadBuildData() {
        if (window.location.host.match(/localhost|virtualhost/) === null) {
            $.ajax({
                url: ".build.json",
                cache: false,
                dataType: "json",
                success: function (data) {
                    $(".build-number").addClass("label-inverse")
                        .html("Build #" + data.build_id);
                }
            });
        } else {
            $(".build-number").addClass("label-error").html("Dev Mode");
        }
    }

    //------------------------------
    //
    // Event bindings
    //
    //------------------------------

    $(function () {
        $("#user-profile, .user-profile").hide();
        $(".when-authenticated").addClass("hide");
        $.authenticated(authenticated);

        $("body").on("click", bodyClick);
        $(".toggle-shade").on("click", shadeClick);
        $(".toggle-info").on("click", infoClick);

        loadBuildData();
    });

    //------------------------------
    // Deeplink
    //------------------------------

    $(function () {
        $.deeplink.application("#content", "#error", "#loading");
    });

    $.deeplink.bind("loading", function () {
        $(".modal").modal("hide");
        $.lightbox("!");
        resetWorkspaces();
        clearInplace();
        $.pageData = {};
        if ($.whitelabel.deeplinkShades) {
            if ($.deeplink.query.hshade) {
                $("#header-shade-loading").removeClass("hide");
                $("body").addClass("header-shade-open");
                $("#header-shade").show();
            } else {
                $("body").removeClass("header-shade-open");
                $("#header-shade").hide();

                // Don't allow more than one deeplink shade open at a time
                if ($.deeplink.query.ishade) {
                    $("body").addClass("info-shade-open");
                    $("#info-shade").show();
                } else {
                    $("body").removeClass("info-shade-open");
                    $("#info-shade").hide();
                }
            }
        }
        $(".page-pane").removeClass("active");
        fixedHeaders.hide();
    });

    $.deeplink.bind("loaded", function () {
        $("#header-shade-loading").addClass("hide");
    });

    $.deeplink.bind("error", function () {
        $(".modal").modal("hide");
        $.lightbox("!");
        if ($.whitelabel.deeplinkShades) {
            $("body").removeClass("header-shade-open info-shade-open");
            $("#header-shade, #info-shade").hide();
        }
    });

    $.route("/logout", function () {
        $.deeplink.softSetRoute("#/");
        $.logout();
    });

    function uniqueArray(arr) {
        return $.grep(arr, function(v, k) {
            return $.inArray(v, arr) === k;
        });
    }

    //------------------------------
    //
    // Exposure
    //
    //------------------------------

    //------------------------------
    // Utility
    //------------------------------

    $.extend($, {
        uniqueArray: uniqueArray,
        hrefWrap: hrefWrap,
        userFullName: userFullName,
        pageData: {},
        queryParams: getQueryParams(),
        includeThirdParty: includeThirdParty,
        fluidApplication: fluidApplication,
        framedApplication: framedApplication,
        customErrors: customErrors,
        largeContainers: largeContainers,
        columnApplication: columnApplication,
        fixedTableHeaders: fixedTableHeaders,
        ucwords: ucwords,
        loadApplication: loadApplication,
        nowrap: nowrap,
        uuid: uuid,
        clearInplace: clearInplace,
        date_format: DATE_FORMAT,
        whitelabel: {
            saveUserData: false,
            reloadOnLogout: true,
            logoutDestination: null,
            logoutGeneratesHistoryEvent: false,
            alwaysAuthenticate: false,
            showLoginAsPage: false,
            deeplinkShades: false,
            deeplinkInfoShade: false,
            doLocalize: true,
            canLogin: true,
            authEveryTime: false,
            keepSession: false
        }
    });

    function fixedWorkspace(makeFixed) {
        var e = $(this);
        if (makeFixed === false) {
            e.removeClass("fixed-body");
            e.find(".body-content").removeClass("scrollable");
        } else {
            e.addClass("fixed-body");
            e.find(".body-content").addClass("scrollable");
        }
    }

    $.extend($.fn, {
        treeRender: treeRender,
        modalWorkspace: modalWorkspace,
        lightboxWorkspace: lightboxWorkspace,
        fixedWorkspace: fixedWorkspace,
        modalWarning: modalWarning,
        framedTable: framedTable,
        autoWizard: autoWizard,
        injectUploader: function (button, calls, sel, url) {
            return injectUploader(this.eq(0), button, calls, sel, url);
        }
    });

    $.beforeFirstExtract.add(function () {
        if ($.queryParams.debug) {
            $("body").addClass("debug");
        }

        $("[data-href]").on("click", function () {
            var e = $(this),
                href = e.attr("data-href");

            if (e.is("refresh")) {
                window.location.replace(href);
            } else {
                window.location = href;
            }
        });

        $(".inplace-trigger").delegate(".untriggered a", "click", inplace);

        $('.scrollable').on('DOMMouseScroll mousewheel', function(ev) {
            var $this = $(this),
                scrollTop = this.scrollTop,
                scrollHeight = this.scrollHeight,
                height = $this.height(),
                delta = ev.originalEvent.wheelDelta,
                up = delta > 0,
                prevent = function() {
                    ev.stopPropagation();
                    ev.preventDefault();
                    ev.returnValue = false;
                    return false;
                };

            if (!$this.is(".scrollable") || (scrollHeight <= height)) {
                return;
            }

            if (!up && -delta > scrollHeight - height - scrollTop) {
                // Scrolling down, but this will take us past the bottom.
                $this.scrollTop(scrollHeight);
                return prevent();
            } else if (up && delta > scrollTop) {
                // Scrolling up, but this will take us past the top.
                $this.scrollTop(0);
                return prevent();
            }
        });

        $(".paginator")
            .delegate(".paginator-prev", "click", function (event) {
                event.preventDefault();
                var e = $(this),
                    p = e.parents(".paginator"),
                    d = p.data("paginator");

                if (e.is("disabled")) {
                    return;
                }

                d.current -= 1;
                if (d.current < 0) {
                    d.current = 0;
                }

                p.data("paginator", d);
                e.trigger("paginator-change", [d.current]);
            })
            .delegate(".paginator-next", "click", function (event) {
                event.preventDefault();
                var e = $(this),
                    p = e.parents(".paginator"),
                    d = p.data("paginator");

                if (e.is("disabled")) {
                    return;
                }

                d.current += 1;
                if (d.current > (d.total - 1)) {
                    d.current = (d.total - 1);
                }

                p.data("paginator", d);
                e.trigger("paginator-change", [d.current]);
            })
            .delegate(".paginator-page", "click", function (event) {
                event.preventDefault();
                var e = $(this),
                    p = e.parents(".paginator"),
                    d = p.data("paginator"),
                    i = parseInt(e.data("index"), 10);

                if (e.is("disabled") || isNaN(i)) {
                    return;
                }

                d.current  = i;
                if (d.current < 0) {
                    d.current = 0;
                }
                if (d.current > (d.total - 1)) {
                    d.current = (d.total - 1);
                }

                p.data("paginator", d);
                e.trigger("paginator-change", [d.current]);
            })
            .on("paginator-change", function () {
                var e = $(this),
                    d = e.data("paginator");
                if (d.current === (d.total - 1) || d.total === 0) {
                    e.find(".paginator-next").addClass("disabled muted");
                } else {
                    e.find(".paginator-next").removeClass("disabled muted");
                }

                if (d.current === 0) {
                    e.find(".paginator-prev").addClass("disabled muted");
                } else {
                    e.find(".paginator-prev").removeClass("disabled muted");
                }

                e.find(".paginator-page").removeClass("disabled muted")
                    .filter("[data-index=" + d.current + "]")
                        .addClass("disabled muted");
                e.trigger("paginator-changed", [d.current, d.total]);
            })
            .on("paginator-init", function (event, total, current) {
                var e = $(this),
                    d = e.data("paginator"),
                    p = e.find(".pages").resetTemplate(),
                    index;

                for (index = 0; index < total; index += 1) {
                    p.update({
                        text: (index + 1),
                        attr: {"data-index": index}
                    }, index);
                }

                e.data("paginator", $.extend(true, {}, d, {
                    total: total,
                    current: current || 0
                }))
                e.trigger("paginator-change");
            });

        $(".prevent-default-click").on("click", preventDefault);

        $(".pseudo-input span").attr("contenteditable", "true")
            .on("click focus", function (event) {
                $(event.currentTarget).attr("contenteditable", "true");
                if (event.type === "click") {
                    event.stopImmediatePropagation();
                } else {

                }
            })
            .on("change", function (event) {
                var e = $(event.currentTarget),
                    trunc = parseInt(e.data("truncate"), 10),
                    text = e.text();
                if (isNaN(trunc)) {
                    trunc = 0;
                }

                if (trunc && text.length > trunc) {
                    text = text.substring(0, trunc);
                }

                e.text(text).attr("contenteditable", "false");
            })
            .on("blur", function (event) {
                $(event.currentTarget).change();
            })
            .on("paste", function (event) {
                var e = $(event.currentTarget),
                    doTimeout = true,
                    text,
                    trunc = parseInt(e.data("truncate"), 10);
                if (isNaN(trunc)) {
                    trunc = 0;
                }

                if (event.clipboardData && event.clipboardData.getData) {
                    event.preventDefault();
                    text = e.clipboardData.getData('text/plain');
                    if (trunc && text.length > trunc) {
                        text = text.substring(0, trunc);
                    }
                    $(event.currentTarget).text(text).change();
                    doTimeout = false;
                }

                if (doTimeout) {
                    setTimeout(function () {
                        text = e.text();
                        if (trunc && text.length > trunc) {
                            text = text.substring(0, trunc);
                        }
                        e.text(text).change().focus();
                    }, 1);
                }
            })
            .on("keyup", function (event) {
                var e = $(event.currentTarget),
                    text = e.text(),
                    trunc = parseInt(e.data("truncate"), 10);
                if (isNaN(trunc)) {
                    trunc = 0;
                }
                if (trunc && text.length > trunc) {
                    text = text.substring(0, trunc);
                    e.text(text);
                }
            })
            .on("keypress", function (event) {
                var e = $(event.currentTarget),
                    k = event.which,
                    text,
                    trunc;
                if (!k ||
                    // control keys
                    $.inArray(k, $.allowedNumericKeys) > -1) {
                    if (k === 13) {
                        // Enter key
                        e.change().blur();
                        return false;
                    }
                    return true;
                }

                text = e.text();

                trunc  = parseInt(e.data("truncate"), 10);
                if (isNaN(trunc)) {
                    trunc = 0;
                }

                if ((text.length + 1) > trunc) {
                    return false;
                }
            });

        $(".in-sync")
            .on("keyup change", function (event) {
                var e = $(event.currentTarget),
                    n = e.attr("name"),
                    v;

                if (n) {
                    if (e.is(":input")) {
                        v = e.val();
                    } else {
                        v = e.text();
                    }

                    $("[name=" + n + "]").not(e).trigger("sync", [v]);
                }
            })
            .on("sync", function (event, v) {
                var e = $(event.currentTarget);
                if (e.is(":input")) {
                    e.val(v);
                } else {
                    e.text(v);
                }
            });

        $(document).on("click", ".tree-header", treeToggle);

        $.allowedNumericKeys = [
            // Control keys backspace, tab, end, home, left
            8, 9, 13, 35, 36, 37, 39
        ];

        $(".numeric")
            .on("keypress", function(event) {
                var k = event.which,
                    e = $(event.currentTarget),
                    kc = String.fromCharCode(k),
                    v = $.trim(e.val());

                if (!k ||
                    // control keys
                    $.inArray(k, $.allowedNumericKeys) > -1) {
                    return;
                } else if (!isNaN(parseInt(kc, 10))) {
                    return;
                } else if (kc === "." && v.indexOf(".") === -1) {
                    // Prefix with 0
                    if (v.length === 0) {
                        e.val("0");
                    }
                    return;
                } else if (kc === "-" && v.length === 0) {
                    // Let minus sign be used if it's the first character
                    return;
                }

                event.preventDefault();
            })
            .on("paste", function (event) {
                if (event.clipboardData && event.clipboardData.getData) {
                    event.preventDefault();
                    var text = e.clipboardData.getData('text/plain');
                    $(event.currentTarget)
                        .val(sanitizeNumberInput(text)).change();
                } else {
                    setTimeout(function () {
                        var val = $(event.currentTarget).val();
                        $(event.currentTarget)
                            .val(sanitizeNumberInput(val)).change();
                    }, 0);
                }
            });

        $(".editable-trim").on("blur change keyup", function (event) {
            var e = $(event.currentTarget);
            if (event.type === "keyup") {
                if (!(event.which === 8 || event.which === 46) ||
                        e.contents().length > 1 ) {
                        return;
                }
            }
            e.find("p").each(function (i, p) {
                p = $(p);
                var c = p.contents();
                if (c.length && c.length !== c.filter("br").length) {
                    return;
                }
                p.remove();
            });
        });
    });

    function sanitizeNumberInput(val) {
        var dec, isNeg = false;
        val = val.replace(RX_CLEAR_NUMERIC, "");
        val = val.split(".");
        if (val.length > 1) {
            dec = val.shift();
            val = dec + "." + val.join("");
        } else {
            val = val.join("");
        }

        if (val.substr(0, 1) === "-") {
            isNeg = true;
        }

        val = val.replace("-", "");

        if (val.substr(0, 1) === ".") {
            val = "0" + val;
        }

        if (val === "0.") {
            val += "0";
        }

        if (isNeg) {
            val = "-" + val;
        }

        return val;
    }

    function treeToggle(event) {
        var e = $(event.target);
        if (e.has(".tree-arrow")) {
            e.closest(".subtree").toggleClass("open");
        }
        $(":focus").blur();
    }

    function treeRender(obj) {
        var e = $(this);
        // @TODO: Implement convenience method for collapsetree
        //console.log(e, obj);
    }

    //------------------------------
    // Third party
    //------------------------------

    $.fn.mathjax = function (fn) {
        if (window.MathJax === undefined) {
            mathjaxQueue = mathjaxQueue.add(this);
            return this;
        }

        return this.each(function () {
            MathJax.Hub.Queue(["Typeset", MathJax.Hub, this]);

            if ($.isFunction(fn)) {
                MathJax.Hub.Queue(fn);
            }
        });
    };

}(window.jQuery));


text:
#include "include/ConstValue.h"

class Paremeter;
class CudaRes;

class CudaAlgorithm {
 public:
  CudaAlgorithm(Paremeter* prm, CudaRes* res)
    : m_prm(prm)
    , m_res(res) {}
  // the function to use all alogrithms
  void Main();

 private:
  void Canny(Paremeter* prm, CudaRes* res);
  void EdgeTracing(Paremeter* prm, CudaRes* res);
  void EdgeConnecting(Paremeter* prm, CudaRes* res);
  void SetOrRemoveBoardCombination(int* source_image, int* edge_image,
                                   int image_width, int image_height,
                                   int board_combination_num,
                                   int set_or_removed);
  void ImageSegmentationByBoardCombination(int* source_image, int* edge_image,
                                           int* backup_image_4,
                                           int image_width, int image_height,
                                           int* board_combination,
                                           const int* kColourArray);
  void ImageSegmentationByScanLength(int* source_image, int* edge_image,
                                     int* backup_image_4,
                                     int image_width, int image_height,
                                     int* length_parameter);
  void LenaFrontAndBackSceneSegmentation(int* source_image, int* edge_image,
                                         int* backup_image_1,
                                         int* backup_image_4, int* dev_exist,
                                         int image_width, int image_height);
  void LenaSegmentationByBoard(int* source_image, int* edge_image,
                               int* backup_image_1, int* backup_image_4,
                               int image_width, int image_height);

 private:
  Paremeter* m_prm;
  CudaRes* m_res;
};
#endif  // IMAGEPROCESSING_INCLUDE_CUDAALGORITHM_H_

redpajama_set_name: RedPajamaGithub


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>mriya.all</groupId>
    <artifactId>mriya.all</artifactId>
    <version>1.0.0</version>
    <packaging>pom</packaging>
    <name>mriya.all</name>

    <modules>
        <module>mriya.client</module>
        <module>mriya.provider</module>
        <module>mriya.spring</module>
        <module>mriya.register</module>
        <module>mriya.register.redis</module>
    </modules>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.apache.mina</groupId>
                <artifactId>mina-core</artifactId>
                <version>2.0.7</version>
            </dependency>

            <dependency>
                <groupId>com.alibaba</groupId>
                <artifactId>fastjson</artifactId>
                <version>1.1.23</version>
            </dependency>
            <dependency>
                <groupId>commons-lang</groupId>
                <artifactId>commons-lang</artifactId>
                <version>2.5</version>
            </dependency>
            <dependency>
                <groupId>commons-io</groupId>
                <artifactId>commons-io</artifactId>
                <version>1.3.2</version>
            </dependency>
            <dependency>
                <groupId>commons-pool</groupId>
                <artifactId>commons-pool</artifactId>
                <version>1.5.6</version>
            </dependency>
            <dependency>
                <groupId>com.caucho</groupId>
                <artifactId>hessian</artifactId>
                <version>4.0.7</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>3.2.5.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>3.2.5.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-web</artifactId>
                <version>3.2.5.RELEASE</version>
            </dependency>
            <!--log-->
            <dependency>
                <groupId>log4j</groupId>
                <artifactId>log4j</artifactId>
                <version>1.2.12</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-log4j12</artifactId>
                <version>1.5.11</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>1.5.11</version>
            </dependency>

            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
                <version>2.5</version>
                <scope>provider</scope>
            </dependency>

            <!-- test -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>3.8.1</version>
                <scope>test</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <version>2.5.3</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


text:
package org.openprovenance.model;
import java.io.File;
import java.io.StringWriter;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import javax.xml.bind.JAXBException;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.openprovenance.model.collections.CollectionFactory;

/**
 * Unit test for simple App.
 */
public class CycleTest
    extends TestCase
{
    /**
     * Create the test case
     *
     * @param testName name of the test case
     */
    public CycleTest( String testName )
    {
        super( testName );
    }

    /**
     * @return the suite of tests being tested
     */
    public static Test suite()
    {
        return new TestSuite( CycleTest.class );
    }

    static OPMGraph graph1;
    static OPMGraph graph2;

    /** Creates and serialises an OPM graph. */

    public void testCycle1() throws JAXBException,  java.io.FileNotFoundException,  java.io.IOException
    {
        OPMFactory oFactory=new OPMFactory();
        CollectionFactory cFactory=new CollectionFactory(oFactory);

        Collection<Account> summary=Collections.singleton(oFactory.newAccount("summary"));
        Collection<Account> detailed=Collections.singleton(oFactory.newAccount("detailed"));
        Collection<Account> superdetailed=Collections.singleton(oFactory.newAccount("superdetailed"));

        List<Account> summary_detailed=new LinkedList();
        summary_detailed.addAll(summary);
        summary_detailed.addAll(detailed);

        Process p1=oFactory.newProcess("p1",
                                       summary,
                                       "p1");
        Process p1a=oFactory.newProcess("p1a",
                                        detailed,
                                        "p1a");
        Process p1b=oFactory.newProcess("p1b",
                                        detailed,
                                        "p1b");
        Process p2=oFactory.newProcess("p2",
                                       detailed,
                                       "p2");

        Artifact a0=oFactory.newArtifact("a0",
                                         summary_detailed,
                                         "a0");
        Artifact a1=oFactory.newArtifact("a1",
                                         summary_detailed,
                                         "a1");
        Artifact a2=oFactory.newArtifact("a2",
                                         summary_detailed,
                                         "a2");
        Artifact a3=oFactory.newArtifact("a3",
                                         summary_detailed,
                                         "a3");

        Used u0=oFactory.newUsed(p1a,oFactory.newRole("in"),a0,detailed);
        Used u4=oFactory.newUsed(p1,oFactory.newRole("in"),a0,summary);
        Used u1=oFactory.newUsed(p1,oFactory.newRole("in"),a2,summary);
        Used u2=oFactory.newUsed(p2,oFactory.newRole("in"),a1,detailed);
        Used u3=oFactory.newUsed(p1b,oFactory.newRole("in"),a2,detailed);

        WasGeneratedBy wg1=oFactory.newWasGeneratedBy(a2,oFactory.newRole("out"),p2,detailed);
        WasGeneratedBy wg2=oFactory.newWasGeneratedBy(a1,oFactory.newRole("out"),p1a,detailed);
        WasGeneratedBy wg3=oFactory.newWasGeneratedBy(a1,oFactory.newRole("out"),p1,summary);
        WasGeneratedBy wg4=oFactory.newWasGeneratedBy(a3,oFactory.newRole("out"),p1b,detailed);
        WasGeneratedBy wg5=oFactory.newWasGeneratedBy(a3,oFactory.newRole("out"),p1,summary);

        Overlaps ov1=oFactory.newOverlaps(summary_detailed);

        WasDerivedFrom wdf1=oFactory.newWasDerivedFrom(a3,a2,summary_detailed);
        WasDerivedFrom wdf2=oFactory.newWasDerivedFrom(a2,a1,detailed);
        WasDerivedFrom wdf3=oFactory.newWasDerivedFrom(a1,a0,summary_detailed);

//         WasDerivedFrom wdf2=oFactory.newWasDerivedFrom("wdf2",a4,a1,"second",detailed);
//         WasDerivedFrom wdf3=oFactory.newWasDerivedFrom("wdf3",a5,a3,"add1",detailed);
//         WasDerivedFrom wdf4=oFactory.newWasDerivedFrom("wdf4",a6,a4,"add1",detailed);
//         WasDerivedFrom wdf5=cFactory.newContained("wdf5",a2,a5,detailed);
//         WasDerivedFrom wdf6=cFactory.newContained("wdf6",a2,a6,detailed);

        OPMGraph graph=oFactory.newOPMGraph(summary_detailed,
                                            new Overlaps[] { ov1 },
                                            new Process[] {p1,p1a,p1b,p2},
                                            new Artifact[] {a0, a1,a2,a3},
                                            null,
                                            new Object[] {u0, u1,u2,u3,u4,
                                                          wg1,wg2,wg3,wg4,wg5
                                            } );

        OPMGraph graph2=oFactory.newOPMGraph(summary_detailed,
                                            new Overlaps[] { ov1 },
                                            new Process[] {p1,p1a,p1b,p2},
                                            new Artifact[] {a0, a1,a2,a3},
                                            null,
                                            new Object[] {u0, u1,u2,u3,u4,
                                                          wg1,wg2,wg3,wg4,wg5,
                                                          wdf1,wdf2,wdf3
                                            } );

        OPMSerialiser serial=OPMSerialiser.getThreadOPMSerialiser();
        StringWriter sw=new StringWriter();
        serial.serialiseOPMGraph(sw,graph,true);
        serial.serialiseOPMGraph(new File("target/cycle1.xml"),graph,true);

        graph1=graph;

        assertTrue( true );

        OPMToDot toDot=new OPMToDot("src/test/resources/collectionConfig.xml");

        toDot.convert(graph1,"target/cycle1.dot", "target/cycle1.pdf");

        toDot=new OPMToDot("src/test/resources/collectionConfig1.xml");

        toDot.convert(graph1,"target/cycle2.dot", "target/cycle2.pdf");

        toDot=new OPMToDot("src/test/resources/collectionConfig2.xml");

        toDot.convert(graph1,"target/cycle3.dot", "target/cycle3.pdf");

        toDot=new OPMToDot("src/test/resources/collectionConfig3.xml");

        toDot.convert(graph1,"target/cycle4.dot", "target/cycle4.pdf");

        // no cycle

        sw=new StringWriter();
        serial.serialiseOPMGraph(sw,graph2,true);
        serial.serialiseOPMGraph(new File("target/nocycle1.xml"),graph,true);

        assertTrue( true );

        toDot=new OPMToDot("src/test/resources/collectionConfig.xml");

        toDot.convert(graph2,"target/nocycle1.dot", "target/nocycle1.pdf");

        toDot=new OPMToDot("src/test/resources/collectionConfig1.xml");

        toDot.convert(graph2,"target/nocycle2.dot", "target/nocycle2.pdf");

        toDot=new OPMToDot("src/test/resources/collectionConfig2.xml");

        toDot.convert(graph2,"target/nocycle3.dot", "target/nocycle3.pdf");

        toDot=new OPMToDot("src/test/resources/collectionConfig3.xml");

        toDot.convert(graph2,"target/nocycle4.dot", "target/nocycle4.pdf");

    }

}


text:
<link href="{$base_url}/css/list.css" rel="stylesheet" type="text/css">

	{foreach $lists as $list}

id}">{$list->title}[{$list->update_time}]

	{/foreach}


text:
@interface SJNearController : SJBaseViewController

@end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Khumbu Himal 6: 443 (1977)

#### Original name
Ioplaca Poelt

### Remarks
null


text:
from django.db import migrations, models

class Migration(migrations.Migration):

    dependencies = [
        ('server', '0093_auto_20190318_1055'),
    ]

    operations = [
        migrations.AlterField(
            model_name='manageditem',
            name='name',
            field=models.CharField(max_length=255),
        ),
    ]


text:
package org.apache.skywalking.oap.server.microbench.core.config.group.openapi;

import org.apache.skywalking.oap.server.core.config.group.openapi.EndpointGroupingRule4Openapi;
import org.apache.skywalking.oap.server.core.config.group.openapi.EndpointGroupingRuleReader4Openapi;
import org.apache.skywalking.oap.server.library.util.StringFormatGroup.FormatResult;
import org.apache.skywalking.oap.server.microbench.base.AbstractMicrobenchmark;

import java.util.Collections;
import java.util.Map;

import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.infra.Blackhole;

@BenchmarkMode({Mode.Throughput})
@Threads(4)
public class EndpointGrouping4OpenapiBenchmark extends AbstractMicrobenchmark {
    private static final String APT_TEST_DATA = "  /products1/{id}/%d:\n" + "    get:\n" + "    post:\n"
        + "  /products2/{id}/%d:\n" + "    get:\n" + "    post:\n"
        + "  /products3/{id}/%d:\n" + "    get:\n";

    private static Map<String, String> createTestFile(int size) {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("paths:\n");
        for (int i = 0; i <= size; i++) {
            stringBuilder.append(String.format(APT_TEST_DATA, i, i, i));
        }
        return Collections.singletonMap("whatever", stringBuilder.toString());
    }

    @State(Scope.Benchmark)
    public static class FormatClassPaths20 {
        private final EndpointGroupingRule4Openapi rule = new EndpointGroupingRuleReader4Openapi(createTestFile(3)).read();

        public FormatResult format(String serviceName, String endpointName) {
            return rule.format(serviceName, endpointName);
        }
    }

    @State(Scope.Benchmark)
    public static class FormatClassPaths50 {
        private final EndpointGroupingRule4Openapi rule = new EndpointGroupingRuleReader4Openapi(createTestFile(9)).read();

        public FormatResult format(String serviceName, String endpointName) {
            return rule.format(serviceName, endpointName);
        }
    }

    @State(Scope.Benchmark)
    public static class FormatClassPaths200 {
        private final EndpointGroupingRule4Openapi rule = new EndpointGroupingRuleReader4Openapi(createTestFile(39)).read();

        public FormatResult format(String serviceName, String endpointName) {
            return rule.format(serviceName, endpointName);
        }
    }

    @Benchmark
    public void formatEndpointNameMatchedPaths20(Blackhole bh, FormatClassPaths20 formatClass) {
        bh.consume(formatClass.format("serviceA", "GET:/products1/123"));
    }

    @Benchmark
    public void formatEndpointNameMatchedPaths50(Blackhole bh, FormatClassPaths50 formatClass) {
        bh.consume(formatClass.format("serviceA", "GET:/products1/123"));
    }

    @Benchmark
    public void formatEndpointNameMatchedPaths200(Blackhole bh, FormatClassPaths200 formatClass) {
        bh.consume(formatClass.format("serviceA", "GET:/products1/123"));
    }

}

/*
* The test is assumed each endpoint need to run all match within it's rules group.
*
# JMH version: 1.21
# VM version: JDK 1.8.0_292, OpenJDK 64-Bit Server VM, 25.292-b10
# VM invoker: /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home/jre/bin/java
# VM options: -javaagent:/Applications/IntelliJ IDEA CE.app/Contents/lib/idea_rt.jar=58702:/Applications/IntelliJ IDEA CE.app/Contents/bin -Dfile.encoding=UTF-8 -Xmx512m -Xms512m
# Warmup: 5 iterations, 10 s each
# Measurement: 5 iterations, 10 s each
# Timeout: 10 min per iteration
# Threads: 4 threads, will synchronize iterations
# Benchmark mode: Throughput, ops/time

Benchmark                                                                                Mode  Cnt        Score        Error   Units
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths20                                    thrpt    5  4318121.026 ± 529374.132   ops/s
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths20:·gc.alloc.rate                     thrpt    5     4579.740 ±    561.095  MB/sec
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths20:·gc.alloc.rate.norm                thrpt    5     1168.000 ±      0.001    B/op
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths20:·gc.churn.PS_Eden_Space            thrpt    5     4604.284 ±    560.596  MB/sec
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths20:·gc.churn.PS_Eden_Space.norm       thrpt    5     1174.266 ±      6.626    B/op
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths20:·gc.churn.PS_Survivor_Space        thrpt    5        0.476 ±      0.122  MB/sec
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths20:·gc.churn.PS_Survivor_Space.norm   thrpt    5        0.121 ±      0.031    B/op
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths20:·gc.count                          thrpt    5     1427.000               counts
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths20:·gc.time                           thrpt    5      839.000                   ms
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths200                                   thrpt    5   551316.187 ±  60567.899   ops/s
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths200:·gc.alloc.rate                    thrpt    5     3912.675 ±    429.916  MB/sec
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths200:·gc.alloc.rate.norm               thrpt    5     7816.000 ±      0.001    B/op
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths200:·gc.churn.PS_Eden_Space           thrpt    5     3932.895 ±    421.307  MB/sec
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths200:·gc.churn.PS_Eden_Space.norm      thrpt    5     7856.526 ±     45.989    B/op
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths200:·gc.churn.PS_Survivor_Space       thrpt    5        0.396 ±      0.101  MB/sec
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths200:·gc.churn.PS_Survivor_Space.norm  thrpt    5        0.791 ±      0.172    B/op
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths200:·gc.count                         thrpt    5     1219.000               counts
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths200:·gc.time                          thrpt    5      737.000                   ms
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths50                                    thrpt    5  2163149.470 ±  67179.001   ops/s
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths50:·gc.alloc.rate                     thrpt    5     4508.870 ±    141.755  MB/sec
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths50:·gc.alloc.rate.norm                thrpt    5     2296.000 ±      0.001    B/op
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths50:·gc.churn.PS_Eden_Space            thrpt    5     4532.354 ±    146.421  MB/sec
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths50:·gc.churn.PS_Eden_Space.norm       thrpt    5     2307.956 ±     10.377    B/op
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths50:·gc.churn.PS_Survivor_Space        thrpt    5        0.454 ±      0.116  MB/sec
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths50:·gc.churn.PS_Survivor_Space.norm   thrpt    5        0.231 ±      0.066    B/op
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths50:·gc.count                          thrpt    5     1405.000               counts
EndpointGroupingBenchmark4Openapi.formatEndpointNameMatchedPaths50:·gc.time                           thrpt    5      841.000                   ms
 */


text:
//-----------------------------------------------------------------------
// <copyright file="NamespaceDoc.cs" company="Patrick 'Ricky' Smith">
//  This file is part of the Twitterizer library (http://www.twitterizer.net/)
//
//  Copyright (c) 2010, Patrick "Ricky" Smith (ricky@digitally-born.com)
//  All rights reserved.
//
//  Redistribution and use in source and binary forms, with or without modification, are
//  permitted provided that the following conditions are met:
//
//  - Redistributions of source code must retain the above copyright notice, this list
//    of conditions and the following disclaimer.
//  - Redistributions in binary form must reproduce the above copyright notice, this list
//    of conditions and the following disclaimer in the documentation and/or other
//    materials provided with the distribution.
//  - Neither the name of the Twitterizer nor the names of its contributors may be
//    used to endorse or promote products derived from this software without specific
//    prior written permission.
//
//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
//  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
//  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
//  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
//  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
//  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
//  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
//  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
//  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
//  POSSIBILITY OF SUCH DAMAGE.
// </copyright>
// <author>Ricky Smith</author>
// <summary>The dummy file for supplying xml documentation for the Twitterizer.Core namespace.</summary>
//-----------------------------------------------------------------------

namespace Twitterizer.Core
{
    /// <summary>
    /// The <see cref="Twitterizer.Core"/> namespace contains abstract classes and interfaces
    /// </summary>
    [System.Runtime.CompilerServices.CompilerGenerated]
    internal class NamespaceDoc
    {
    }
}


text:
package com.bankonet.test;

import com.bankonet.model.BankonetException;
import com.bankonet.model.CompteCourant;

public class TestDebitCompte {

	 public static void main(String[] args) {

		 CompteCourant c1 = new CompteCourant(4, "compte courant 1", 0, 1000);
		 try {
			if (c1.debitAutorise(500)) {
				 c1.debiter(500);
			 }
		} catch (BankonetException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

}
}


text:
package com.microsoft.azure.keyvault.extensions.cryptography.algorithms;

public class Aes128Cbc extends AesCbc {

    public static final String AlgorithmName = "A128CBC";

    public Aes128Cbc() {
        super(AlgorithmName);
    }

}


text:
import java.awt.*;
import java.awt.event.*;
import java.io.File;
import java.util.ArrayList;

/**
 * This class holds all the Screens to be displayed in the game and also switches to/from them when necessary. When creating a new screen it sets it's ScreenController to the same as this one, so to change anything in ScreenManager just call the methods in the ScreenController and it should work.
 * @author Reed Weichler
 *
 */
public class ScreenManager implements MouseListener, MouseMotionListener,KeyListener{

	private GameScreen game;
	private Screen menu;

	private boolean paused;
	private ScreenController controller;

	/**
	 * position of mouse on the screen
	 */
	public static Point mouse = new Point();

	/*public static Server server;
	public static Client client;

	public static Connector connection;*/

	private ArrayList<Integer> pressedKeys;

	private boolean thinked = true;

	/**
	 * creates a new ScreenManager with a ScreenController with a FileOpener as specified
	 * @param opener the FileOpener that will be put inside the created ScreenController
	 */
	public ScreenManager(FileOpener opener){
		pressedKeys = new ArrayList<Integer>();
		controller = new ScreenController(this,opener);
		renew();
	}

	/**
	 * refreshes everything to where it's like you just opened the program
	 */
	public void renew(){
		game = null;
		menu = new MainScreen();
		menu.controller = controller;
		paused = true;
		//setBackground(Color.BLACK);
		//topLeftBox = new Point(Global.W/2 - 50,Global.H -Global.GROUND_LEVEL - 100);
		//wBox = 32;
		//hBox = 100;
		////bgMusic = new AePlayWaveLoop("sound/original_theme.wav");
		////bgMusic.start();
		//main = new MainClass(this.getFontMetrics(CHAT_BOLD));
		//inGame = false;
		//pw = password.toCharArray();
		//nextChar = 0;
		//updateBox();
		//for(int i = 0; i < MARIO_COLORS.length; i++){
		//	Hero h = new Hero();
		//	h.setSpriteColor(i);
		//	MARIO_COLORS[i] = (h.IMAGE[0]).getBuffer();
		//}
	}

	/**
	 * corrects syncronization with drawing and thinking
	 * @return true if did think, false if not
	 */
	public boolean didThink(){
		return thinked;
	}

	/**
	 * draws the menu Screen and game GameScreen
	 * @param g the Graphics to be drawn to
	 */
	public void draw(Graphics g){
		//System.out.println("Draw");
		((Graphics2D)g).setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);

		if(!paused && game != null){
			game.draw(g);
		}else{
			if(menu instanceof PauseScreen)
				game.draw(g);
			menu.draw(g);
		}
		thinked = false;
		/*if(inGame){
			main.draw(g, this);
			if(connected){
				g.setFont(CHAT_BOLD);
				g.setColor(Color.WHITE);
				if(typing)
					g.drawString("You: " + typedString, 5,getHeight()-6);
				else
					g.drawString("Press ~ to chat!", 5,getHeight()-6);
			}
		}*/
	}

	/**
	 * starts level editor mode (new file)
	 * @param marioColor the color the Hero should be
	 */
	public void levelEditor(int marioColor){
		game = new LevelEditor();
		menu = new PauseScreen(true);
		game.controller = controller;
		menu.controller = controller;
		game.init(marioColor);

	}

	/**
	 * starts level editor mode (open file)
	 * @param marioColor the color the Hero should be
	 * @param f the file to be opened which contains the level data
	 */
	public void levelEditor(int marioColor, File f){
		game = new LevelEditor();
		boolean init;
		try{
			init = game.init(marioColor, f);
		}catch(Exception ex){
			if(menu instanceof MainScreen)
				((MainScreen)menu).loadFailed();
			game = null;
			return;
		}
		if(!init){
			game = null;
			return;
		}
		paused = false;
		menu = new PauseScreen(true);
		game.controller = controller;
		menu.controller = controller;

	}

	/**
	 * saves the level, if any to file
	 * @param f the file to be written to
	 * @return true if successfully written, false if not
	 */
	public boolean saveGame(File f){
		if(game != null){
			return game.saveGame(f);
		}
		return false;
	}

	/**
	 * starts single player mode
	 * @param marioColor the color the Hero should be
	 * @param f the file to be opened and read
	 */
	public void singlePlayer(int marioColor, File f){
		if(game == null || !(game instanceof SinglePlayer))
			game = new SinglePlayer();
		boolean init;
		game.loading = true;
		try{
			init = game.init(marioColor, f);
		}catch(Exception ex){
			if(menu instanceof MainScreen)
				((MainScreen)menu).loadFailed();
			game = null;
			return;
		}
		if(!init){
			game = null;
			return;
		}
		paused = false;
		menu = new PauseScreen(false);
		game.controller = controller;
		menu.controller = controller;
	}

	/**
	 * called every frame, updates think in the GameScreen and menu Screen.
	 */
	public void think(){
		//System.out.println("Think");
		if(!paused){
			game.think();
		}else{
			menu.think();
		}
		thinked = true;
	}

	/**
	 * pauses/unpauses the game, if one is in session
	 * @param pause if true, the game pauses. if false, it unpauses
	 */
	public void pause(boolean pause){
		paused = pause;
	}

	/**
	 * called when a key is pressed
	 * @param event the KeyEvent from keyPressed/keyReleased
	 * @param pressed is true if the key was pressed down, is false if not
	 */
	public void key(KeyEvent event, boolean pressed){
		if(!paused){
			game.key(event, pressed);
		}else{
			menu.key(event, pressed);
		}
	}

	/**
	 * called when a mouse button is pressed
	 * @param event the MouseEvent from mousePressed/mouseReleased
	 * @param pressed is true if the mouse was pressed down, is false if not
	 */
	public void mouse(MouseEvent event, boolean pressed){
		if(paused){
			menu.mouse(event, pressed);
		}else{
			game.mouse(event,pressed);
		}
	}

	public void keyPressed(KeyEvent event){
		int code = event.getKeyCode();
		if(pressedKeys.size() != 0 && pressedKeys.get(pressedKeys.size()-1).equals(code) || pressedKeys.indexOf(code) != -1)
			return;
		pressedKeys.add(code);
		key(event,true);
	}
	public void keyReleased(KeyEvent event){
		int code = event.getKeyCode();
		int index = pressedKeys.indexOf(code);
		if(index != -1)
			pressedKeys.remove(index);
		key(event,false);
	}

	/*private int findKey(int value, int low, int high) {
		if (high < low)
			return -1;
		if(low == high){
			if(pressedKeys.get(low) == value){
				return low;
			}else{
				return -1;
			}
		}
		int mid = low + (high - low) / 2;
		if (pressedKeys.get(mid) > value)
			return findKey(value, low, mid-1);
		else if (pressedKeys.get(mid) < value)
			return findKey(value, mid+1, high);
		return mid; // found
	}*/

	public void keyTyped(KeyEvent event){}

	public void mouseClicked(MouseEvent event){}
	public void mousePressed(MouseEvent event){
		mouse(event,true);
	}
	public void mouseReleased(MouseEvent event){
		mouse(event,false);
	}
	public void mouseExited(MouseEvent event){}
	public void mouseEntered(MouseEvent event){}

	public void mouseMoved(MouseEvent event){
		mouse.setLocation(event.getX(),event.getY());
	}
	public void mouseDragged(MouseEvent event){
		mouseMoved(event);
	}

}


text:
package com.jetbrains.python.testing.doctest;

import com.google.common.collect.Lists;
import com.jetbrains.python.psi.*;

import java.util.List;
import java.util.StringTokenizer;

/**
 * User: catherine
 */
public class PythonDocTestUtil {

  private PythonDocTestUtil() {
  }

  public static List<PyElement> getDocTestCasesFromFile(PyFile file) {
    List<PyElement> result = Lists.newArrayList();
    for (PyClass cls : file.getTopLevelClasses()) {
      if (isDocTestClass(cls)) {
        result.add(cls);
      }
    }
    for (PyFunction cls : file.getTopLevelFunctions()) {
      if (isDocTestFunction(cls)) {
        result.add(cls);
      }
    }
    if (file.getDocStringExpression() != null) {
      PyStringLiteralExpression docString = file.getDocStringExpression();
      if (docString != null && hasExample(docString.getStringValue())) {
        result.add(file);
      }
    }
    return result;
  }

  public static boolean isDocTestFunction(PyFunction pyFunction) {
    if (pyFunction.getDocStringExpression() == null) return false;
    PyStringLiteralExpression docString = pyFunction.getDocStringExpression();
    if (docString != null && !hasExample(docString.getStringValue())) return false;
    return true;
  }

  public static boolean isDocTestClass(PyClass pyClass) {
    for (PyFunction cls : pyClass.getMethods(false)) {
      if (isDocTestFunction(cls)) {
        return true;
      }
    }
    if (pyClass.getDocStringExpression() != null) {
      PyStringLiteralExpression docString = pyClass.getDocStringExpression();
      if (docString != null && hasExample(docString.getStringValue())) {
        return true;
      }
    }
    return false;
  }

  public static boolean hasExample(final String docString) {
    boolean hasExample = false;
    StringTokenizer tokenizer = new StringTokenizer(docString, "\n");
    while (tokenizer.hasMoreTokens()) {
      String str = tokenizer.nextToken().trim();
      if (str.startsWith(">>>")) {
        hasExample = true;
        break;
      }
    }
    return hasExample;
  }
}


text:
check_formatting ()
{
  diff -u <(cat $1) <(./node_modules/.bin/clang-format -style=file $1) &>/dev/null
  if [ $? -eq 1 ]
  then
    echo "Error: formatting is required for *.ts files:"
    echo "    cd chrome-launcher"
    echo "    yarn format"
    exit 1
  fi
}

check_formatting "`find src -type f -name '*.ts'`"


text:
__docformat__ = "restructuredtext en"

from turbomail.message import Message
from turbomail.control import interface

from genshi.template.loader import package
from genshi.template import MarkupTemplate, NewTextTemplate

#-------------------------------------------------------------------------------

class TemplateMessage(Message):
    """
    This is a genshi-based template mail renderer.
    """

    # we need the staticmethod to prevent self being bound as first param
    loader = staticmethod(package("abl.devtools", ""))

    def __init__(self, **kwargs):
        """
        This is a genshi-based template mail renderer.

        It derives from L{Message} and introduces three
        additional keyword-args:

         - "html" for a MarkupTemplate
         - "text" for a TextTemplate
         - "subject" for a TextTemplate to use for the subject

        The templates are currently always loaded relative
        to the package::

          abl.devtools

        """
        html = kwargs.pop("html", None)
        text = kwargs.pop("text", None)
        subject = kwargs.pop("subject", None)
        super(TemplateMessage, self).__init__(**kwargs)
        self._html_template = self._text_template = None
        if html is not None:
            _, _, inf, _ = self.loader(html)
            self._html_template = MarkupTemplate(inf)
        if text is not None:
            _, _, inf, _ = self.loader(text)
            self._text_template = NewTextTemplate(inf)
        else:
            self._text_template = None
        if subject is not None:
            _, _, inf, _ = self.loader(subject)
            self._subject_template = NewTextTemplate(inf)
        else:
            self._subject_template = None

    def render(self, **values):

        if self._html_template is not None:
            self.rich = self._html_template.generate(**values).render('html', doctype='html')

        if self._text_template is not None:
            self.plain = self._text_template.generate(**values).render()

        if self._subject_template is not None:
            subject = self._subject_template.generate(**values).render()
            # ensure the subject is just one line
            subject = " ".join(subject.split("\n"))
            self.subject = subject

    def send(self):
        interface.send(self)

def configure(conf):
    """
    Configures the turbomail system.
    """
    default_conf = {
        "manager" :             "immediate",
        "transport" :           "smtp",
        "smtp.server" :         "localhost",
        "message.encoding" :    "utf-8",
        "utf8qp.on" :           True,
        }
    default_conf.update(conf)
    for key in default_conf.keys():
        default_conf["mail." + key] = default_conf[key]
        del default_conf[key]
    default_conf["mail.on"] = True
    interface.start(default_conf)


text:
package org.knowm.xchange.hitbtc.v2.dto;

import com.fasterxml.jackson.annotation.JsonProperty;

public class HitbtcAddress {

  private final String address;

  public HitbtcAddress(@JsonProperty("address") String address) {
    this.address = address;
  }

  public String getAddress() {
    return address;
  }

  @Override
  public String toString() {
    return "HitbtcAddress{" +
        "address='" + address + '\'' +
        '}';
  }
}


text:
(function (define) {
	'use strict';

	define(function (require) {

		var interceptor, mixinUtil, defaulter;

		interceptor = require('../interceptor');
		mixinUtil = require('../util/mixin');

		defaulter = (function () {

			function mixin(prop, target, defaults) {
				if (prop in target || prop in defaults) {
					target[prop] = mixinUtil({}, defaults[prop], target[prop]);
				}
			}

			function copy(prop, target, defaults) {
				if (prop in defaults && !(prop in target)) {
					target[prop] = defaults[prop];
				}
			}

			var mappings = {
				method: copy,
				path: copy,
				params: mixin,
				headers: mixin,
				entity: copy,
				mixin: mixin
			};

			return function (target, defaults) {
				for (var prop in mappings) {
					/*jshint forin: false */
					mappings[prop](prop, target, defaults);
				}
				return target;
			};

		}());

		/**
		 * Provide default values for a request. These values will be applied to the
		 * request if the request object does not already contain an explicit value.
		 *
		 * For 'params', 'headers', and 'mixin', individual values are mixed in with the
		 * request's values. The result is a new object representiing the combined
		 * request and config values. Neither input object is mutated.
		 *
		 * @param {Client} [client] client to wrap
		 * @param {string} [config.method] the default method
		 * @param {string} [config.path] the default path
		 * @param {Object} [config.params] the default params, mixed with the request's existing params
		 * @param {Object} [config.headers] the default headers, mixed with the request's existing headers
		 * @param {Object} [config.mixin] the default "mixins" (http/https options), mixed with the request's existing "mixins"
		 *
		 * @returns {Client}
		 */
		return interceptor({
			request: function handleRequest(request, config) {
				return defaulter(request, config);
			}
		});

	});

}(
	typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }
	// Boilerplate for AMD and Node
));


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/activity_inefficient_list"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="folderit.net.ejemplos.clase3.InefficientListActivity">

    <ListView
        android:id="@+id/inneficient_listview"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</LinearLayout>


text:
import CPL
connection = CPL.cpl_connection()

from flask import Flask, request, jsonify

app = Flask(__name__)

def serialize_object_info(obj):
    return {
        'id': obj.object.id,
        'creation_time': obj.creation_time,
        'prefix': obj.prefix,
        'name': obj.name,
        'type': type,
        'bundle': bundle.id
    }

def serialize_relation_info(rel):
	return {
		'id': rel.id,
		'ancestor': rel.ancestor.id,
		'descendant': rel.descendant.id,
		'type': rel.type,
		'bundle': bundle.id,
		'base': rel.base.id,
		'other': rel.other.id
	}

@app.route("/provapi/bundle/<id>")
def bundle_get(id):
	try:
		info = cpl_bundle(id).info()
		return jsonify(name=info.name,
					   creation_time=info.creation_time,
					   creation_session=info.creation_session)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/bundle", methods=['POST'])
def bundle_post():
	try:
		content = request.get_json()
		bundle = connection.create_bundle(content['name'])
		return jsonify(id=bundle.id)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/bundle", methods=['PUT'])
def bundle_put():
	try:
		content = request.get_json()
		bundle = connection.lookup_bundle(content['name'])
		return jsonify(id=bundle.id)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/bundles", methods=['PUT'])
def bundles_put():
	try:
		content = request.get_json()
		bundles = connection.lookup_all_bundles(content['name'])
		return jsonify(ids=[bundle.id for bundle in bundles])
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/bundle/<id>/prefix")
@app.route("/provapi/bundle/<id>/prefix/<string:prefix>")
def bundle_prefix_get(id, prefix=None):
	try:
		prefixes = cpl_bundle(id).prefixes(prefix)
		return jsonify(prefixes)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/bundle/<id>/prefix", methods=['POST'])
def bundle_prefix_post(id):
	try:
		content = request.get_json()
		cpl_bundle(id).add_prefix(content['prefix'],
								  content['iri'])
		return jsonify(success=true)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/bundle/<id>/property")
@app.route("/provapi/bundle/<id>/property/<string:prefix>:<string:name>")
def bundle_property_get(id, prefix=None, name=None):
	try:
		properties = cpl_bundle(id).properties(prefix, name)
		return jsonify(properties)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/bundle/<id>/property", methods=['POST'])
def bundle_property_post(id):
	try:
		content = request.get_json()
		cpl_bundle(id).add_property(content['prefix'],
									content['name'],
									content['value'])
		return jsonify(success=true)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/bundle/<id>/object")
def bundle_objects_get(id):
	try:
		objects = connection.get_bundle_objects(cpl_bundle(id))
		return jsonify([serialize_object_info(o) for o in objects])
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/bundle/<id>/relation")
def bundle_relations_get(id):
	try:
		relations = connection.get_bundle_relations(cpl_bundle(id))
		return jsonify([serialize_relation_info(r) for r in relations])
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/object/<id>")
def object_get(id):
	try:
		info = cpl_object(id).info
		return jsonify(serialize_object_info(info))
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/object", methods=['POST'])
def object_post():
	try:
		content = request.get_json()
		o = connection.create_object(content['prefix'],
								 content['name'],
								 content['type'],
								 cpl_bundle(content['bundle']
								 	if content['bundle'] else None))
		return jsonify(id=o.id)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/object", methods=['PUT'])
def object_put():
	try:
		content = request.get_json()
		o = connection.lookup_object(content['prefix'],
								 content['name'],
								 content['type'],
								 cpl_bundle(content['bundle']
								 	if content['bundle'] else None))
		return jsonify(id=o.id)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/objects", methods=['PUT'])
def objects_put():
	try:
		content = request.get_json()
		objects = connection.lookup_all_objects(content['prefix'],
								 content['name'],
								 content['type'],
								 cpl_bundle(content['bundle']
								 	if content['bundle'] else None))
		return jsonify(ids=[o.id for o in objects])
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/object/<id>/property")
@app.route("/provapi/object/<id>/property/<string:prefix>:<string:property>")
def object_property_get(id, prefix=None, property=None):
	try:
		properties = cpl_object(id).properties(prefix, name)
		return jsonify(properties)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/object/<id>/property")
def object_property_post(id):
	try:
		content = request.get_json()
		cpl_object(id).add_property(content['prefix'],
									content['name'],
									content['value'])
		return jsonify(success=true)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/object/property", methods=['PUT'])
def object_property_put():
	try:
		content = request.get_json()
		objects = connection.lookup_by_property(content['prefix'],
									 content['key'],
									 content['value'])
		return jsonify([o.id for o in objects])
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/object/<id>/relation/ancestors")
def object_ancestors_get(id):
	try:
		relations = cpl_object(id).relations()
		return jsonify([serialize_relation_info(info) for info in relations])
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/object/<id>/relation/descendants")
def object_descendants_get(id):
	try:
		relations = cpl_object(id).relations(CPL.D_DESCENDANTS)
		return jsonify([serialize_relation_info(info) for info in relations])
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/object/<id>/relation", methods=['POST'])
def object_relation_post(id):
	try:
		content = request.get_json()
		if content['dest']:
			relation = cpl_object(id).relation_to(cpl_object(content['dest']),
												  content['type'],
												  cpl_bundle(content['bundle']))
		else:
			relation = cpl_object(id).relation_from(cpl_object(content['src']),
												  	content['type'],
												  	cpl_bundle(content['bundle']))
		return jsonify(id=relation.id)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/relation/<id>/property")
@app.route("/provapi/relation/<id>/property/<string:prefix>:<string:name>")
def relation_property_get(id, prefix=None, name=None):
	try:
		properties = cpl_relation(id, NOne, None, None, None, None).properties(prefix, name)
		return jsonify(properties)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/relation/<id>/property", methods=['POST'])
def relation_property_post(id):
	try:
		content = request.get_json()
		cpl_relation(id, None, None, None, None, None).add_property(content['prefix'],
									content['name'],
									content['value'])
		return jsonify(success=true)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/json/validate", methods=['POST'])
def json_validate():
	try:
		content = request.get_json()
		ret = connection.validate_json(content['JSON'])
		if ret == None:
			return jsonify(success=true)
		else:
			return jsonify(error=ret.out_string)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/json", methods=['POST'])
def json_post():
	try:
		content = request.get_json()
		anchors = [(cpl_object(a['id']), a['name']) for a in content['anchor_objects']]
		bundle = connection.import_document_json(content['JSON'],
										content['bundle_name'],
										anchors)
		return jsonify(id=bundle.id)
	except Exception as e:
		return jsonify(error=str(e))

@app.route("/provapi/bundle/<id>/json")
def bundle_json_get(id):
	try:
		json = export_bundle_json([cpl_bundle(id)])
		return jsonify(JSON=json)
	except Exception as e:
		return jsonify(error=str(e))

if __name__ == "__main__":
	app.run()


text:
working_dir=/hps/nobackup2/production/ensembl/anja/vep_data/
perl  $HOME/bin/ensembl-vep/vep \
--species homo_sapiens \
--cache \
--offline \
--dir /nfs/production/panda/ensembl/variation/data/VEP/ \
--input_file $working_dir/input/grch37/vep_cache_test.txt \
--output_file $working_dir/output/grch37/vep_cache_test_95_37_merged.out \
--force_overwrite \
--cache_version 95 \
--assembly GRCh37 \
--everything \
--merged \
--use_given_ref \