text:
// Copyright (c) 2012 Christopher Lux <christopherlux@gmail.com>
// Distributed under the Modified BSD License, see license.txt.

#include <algorithm>
#include <iostream>
#include <sstream>
#include <vector>

#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_int.hpp>
#include <boost/random/variate_generator.hpp>

#include <scm/core.h>
#include <scm/log.h>
#include <scm/core/pointer_types.h>
#include <scm/core/io/file.h>
#include <scm/core/time/accum_timer.h>
#include <scm/core/time/high_res_timer.h>

int main(int argc, char **argv)
{
    // the usual
    std::ios_base::sync_with_stdio(false);
    scm::shared_ptr<scm::core>      scm_core(new scm::core(argc, argv));

    typedef scm::time::accum_timer<scm::time::high_res_timer>  timer_type;

    // what we now try is to generate a very large file
    //  - check if it is written correctly by reading it back!
    //  - check if it memory runs full if we use the system cache
    //  - check what difference it makes not using the file cache
    //  - check if regular flush operations change the cache fillup

    using namespace scm;
    using namespace scm::io;

    std::string         out_file_name  = "e:/data/large_file_test_out_00.data";
    shared_ptr<file>    out_file       = make_shared<file>();

    std::cout << "opening output file: " << out_file_name << std::endl;
    if (!out_file->open(out_file_name,
                        std::ios_base::out | std::ios_base::trunc,
                        true /*disable system cache*/,
                        512 * 1024)) {
        std::cerr << "unable to open ouput file: " << out_file_name << std::endl;
        return -1;
    }

    // the important constants ////////////////////////////////////////////////////////////////////
    file::size_type     out_block_size   = out_file->vss_align_ceil(512ll * 1024);    // KiB
    file::size_type     out_file_size    = 40ll * 1024 * 1024 * 1024;                 // GiB
    bool                out_random_write = true;

    std::cout << "out_block_size:   " << out_block_size << std::endl
              << "out_file_size:    " << out_file_size  << std::endl
              << "out_random_write: " << (out_random_write ? "true" : "false") << std::endl;

    shared_array<char>  out_buffer(new char[out_block_size]);

    boost::mt19937       rand_gen;
    boost::uniform_int<> rand_dist(0, 255);
    boost::variate_generator<boost::mt19937&, boost::uniform_int<> > die(rand_gen, rand_dist);

    std::cout << "generating output block of random data" << std::endl;
    for (file::size_type i = 0; i < out_block_size; ++i) {
        out_buffer[i] = die();
    }

    // writing file ///////////////////////////////////////////////////////////////////////////////
    file::size_type     out_block_count = out_file_size / out_block_size;
    std::vector<file::size_type> out_positions;
    out_positions.reserve(out_block_count);

    for (file::size_type out_pos = 0; out_pos < out_block_count; ++out_pos) {
        out_positions[out_pos] = out_pos * out_block_size;
    }

    if (out_random_write) {
        std::random_shuffle(out_positions.begin(), out_positions.end());
    }

    timer_type          write_timer;
    std::cout << "starting to write file..." << std::endl;
    write_timer.start();
    for (file::size_type out_pos = 0; out_pos < out_block_count; ++out_pos) {
        if (out_file->write(out_buffer.get(), out_positions[out_pos], out_block_size) != out_block_size) {
            std::cerr << "error writing to file at position: " << out_pos * out_block_size << std::endl;
        }
        if (out_pos % (out_block_count / 100) == 0) {
            //write_timer.stop();
            //write_timer.start();
            std::cout << "writing file: " << std::fixed << 100.0 * (static_cast<double>(out_pos) / out_block_count) << "%";
            std::cout << "\xd";
        }
    }
    write_timer.stop();
    std::cout << "end writing file." << std::endl;

    out_file->close();

    double  write_time = time::to_seconds(write_timer.accumulated_duration());

    std::cout << "write time: " << std::fixed << std::setprecision(3) << write_time << "s, "
              << "write speed: " << (static_cast<double>(out_file_size) / (1024 * 1024)) / write_time << "MiB/s" << std::endl;

    // read back file and compare blocks //////////////////////////////////////////////////////////
    shared_ptr<file>    in_file       = make_shared<file>();

    std::cout << "opening input file: " << out_file_name << std::endl;
    if (!in_file->open(out_file_name,
                       std::ios_base::in,
                       true /*disable system cache*/,
                       512 * 1024)) {
        std::cerr << "unable to open input file: " << out_file_name << std::endl;
        return -1;
    }

    shared_array<char>  in_buffer(new char[out_block_size]);

    std::cout << "starting to reading file..." << std::endl;
    for (file::size_type in_pos = 0; in_pos < out_block_count; ++in_pos) {
        if (in_file->read(in_buffer.get(), in_pos * out_block_size, out_block_size) != out_block_size) {
            std::cerr << "error reading to file at position: " << in_pos * out_block_size << std::endl;
        }
        if (in_pos % (out_block_count / 100) == 0) {
            //write_timer.stop();
            //write_timer.start();
            std::cout << "reading file: " << std::fixed << 100.0 * (static_cast<double>(in_pos) / out_block_count) << "%";
            std::cout << "\xd";
        }
        for (file::size_type i = 0; i < out_block_size; ++i) {
            if (in_buffer[i] != out_buffer[i]) {
                std::cerr << "found error at file position: " << in_pos * out_block_size << std::endl;
            }
        }
    }
    std::cout << "end reading file." << std::endl;

    out_file->close();
    std::cout << "sick, sad world..." << std::endl;

    return 0;
}


text:
/**
 * noty - jQuery Notification Plugin v2.1.0
 * Contributors: https://github.com/needim/noty/graphs/contributors
 *
 * Examples and Documentation - http://needim.github.com/noty/
 *
 * Licensed under the MIT licenses:
 * http://www.opensource.org/licenses/mit-license.php
 *
 **/

if (typeof Object.create !== 'function') {
    Object.create = function (o) {
        function F() {
        }

        F.prototype = o;
        return new F();
    };
}

(function ($) {

    var NotyObject = {

        init:function (options) {

            // Mix in the passed in options with the default options
            this.options = $.extend({}, $.noty.defaults, options);

            this.options.layout = (this.options.custom) ? $.noty.layouts['inline'] : $.noty.layouts[this.options.layout];
            this.options.theme = $.noty.themes[this.options.theme];

            delete options.layout;
            delete options.theme;

            this.options = $.extend({}, this.options, this.options.layout.options);
            this.options.id = 'noty_' + (new Date().getTime() * Math.floor(Math.random() * 1000000));

            this.options = $.extend({}, this.options, options);

            // Build the noty dom initial structure
            this._build();

            // return this so we can chain/use the bridge with less code.
            return this;
        }, // end init

        _build:function () {

            // Generating noty bar
            var $bar = $('

').attr('id', this.options.id);
            $bar.append(this.options.template).find('.noty_text').html(this.options.text);

            this.$bar = (this.options.layout.parent.object !== null) ? $(this.options.layout.parent.object).css(this.options.layout.parent.css).append($bar) : $bar;

            // Set buttons if available
            if (this.options.buttons) {

                // If we have button disable closeWith & timeout options
                this.options.closeWith = [];
                this.options.timeout = false;

                var $buttons = $('
').addClass('noty_buttons');

                (this.options.layout.parent.object !== null) ? this.$bar.find('.noty_bar').append($buttons) : this.$bar.append($buttons);

                var self = this;

                $.each(this.options.buttons, function (i, button) {
                    var $button = $('<button/>').addClass((button.addClass) ? button.addClass : 'gray').html(button.text)
                        .appendTo(self.$bar.find('.noty_buttons'))
                        .bind('click', function () {
                            if ($.isFunction(button.onClick)) {
                                button.onClick.call($button, self);
                            }
                        });
                });
            }

            // For easy access
            this.$message = this.$bar.find('.noty_message');
            this.$closeButton = this.$bar.find('.noty_close');
            this.$buttons = this.$bar.find('.noty_buttons');

            $.noty.store[this.options.id] = this; // store noty for api

        }, // end _build

        show:function () {

            var self = this;

            $(self.options.layout.container.selector).append(self.$bar);

            self.options.theme.style.apply(self);

            ($.type(self.options.layout.css) === 'function') ? this.options.layout.css.apply(self.$bar) : self.$bar.css(this.options.layout.css || {});

            self.$bar.addClass(self.options.layout.addClass);

            self.options.layout.container.style.apply($(self.options.layout.container.selector));

            self.options.theme.callback.onShow.apply(this);

            if ($.inArray('click', self.options.closeWith) > -1)
                self.$bar.css('cursor', 'pointer').one('click', function (evt) {
                    self.stopPropagation(evt);
                    if (self.options.callback.onCloseClick) {
                        self.options.callback.onCloseClick.apply(self);
                    }
                    self.close();
                });

            if ($.inArray('hover', self.options.closeWith) > -1)
                self.$bar.one('mouseenter', function () {
                    self.close();
                });

            if ($.inArray('button', self.options.closeWith) > -1)
                self.$closeButton.one('click', function (evt) {
                    self.stopPropagation(evt);
                    self.close();
                });

            if ($.inArray('button', self.options.closeWith) == -1)
                self.$closeButton.remove();

            if (self.options.callback.onShow)
                self.options.callback.onShow.apply(self);

            self.$bar.animate(
                self.options.animation.open,
                self.options.animation.speed,
                self.options.animation.easing,
                function () {
                    if (self.options.callback.afterShow) self.options.callback.afterShow.apply(self);
                    self.shown = true;
                });

            // If noty is have a timeout option
            if (self.options.timeout)
                self.$bar.delay(self.options.timeout).promise().done(function () {
                    self.close();
                });

            return this;

        }, // end show

        close:function () {

            if (this.closed) return;
            if (this.$bar && this.$bar.hasClass('i-am-closing-now')) return;

            var self = this;

            if (!this.shown) { // If we are still waiting in the queue just delete from queue
                var queue = [];
                $.each($.noty.queue, function (i, n) {
                    if (n.options.id != self.options.id) {
                        queue.push(n);
                    }
                });
                $.noty.queue = queue;
                return;
            }

            self.$bar.addClass('i-am-closing-now');

            if (self.options.callback.onClose) {
                self.options.callback.onClose.apply(self);
            }

            self.$bar.clearQueue().stop().animate(
                self.options.animation.close,
                self.options.animation.speed,
                self.options.animation.easing,
                function () {
                    if (self.options.callback.afterClose) self.options.callback.afterClose.apply(self);
                })
                .promise().done(function () {

                    // Modal Cleaning
                    if (self.options.modal) {
                        $.notyRenderer.setModalCount(-1);
                        if ($.notyRenderer.getModalCount() == 0) $('.noty_modal').fadeOut('fast', function () {
                            $(this).remove();
                        });
                    }

                    // Layout Cleaning
                    $.notyRenderer.setLayoutCountFor(self, -1);
                    if ($.notyRenderer.getLayoutCountFor(self) == 0) $(self.options.layout.container.selector).remove();

                    // Make sure self.$bar has not been removed before attempting to remove it
                    if (typeof self.$bar !== 'undefined' && self.$bar !== null ) {
                        self.$bar.remove();
                        self.$bar = null;
                        self.closed = true;
                    }

                    delete $.noty.store[self.options.id]; // deleting noty from store

                    self.options.theme.callback.onClose.apply(self);

                    if (!self.options.dismissQueue) {
                        // Queue render
                        $.noty.ontap = true;

                        $.notyRenderer.render();
                    }

                    if (self.options.maxVisible > 0 && self.options.dismissQueue) {
                        $.notyRenderer.render();
                    }
                })

        }, // end close

        setText:function (text) {
            if (!this.closed) {
                this.options.text = text;
                this.$bar.find('.noty_text').html(text);
            }
            return this;
        },

        setType:function (type) {
            if (!this.closed) {
                this.options.type = type;
                this.options.theme.style.apply(this);
                this.options.theme.callback.onShow.apply(this);
            }
            return this;
        },

        setTimeout:function (time) {
            if (!this.closed) {
                var self = this;
                this.options.timeout = time;
                self.$bar.delay(self.options.timeout).promise().done(function () {
                    self.close();
                });
            }
            return this;
        },

        stopPropagation:function (evt) {
            evt = evt || window.event;
            if (typeof evt.stopPropagation !== "undefined") {
                evt.stopPropagation();
            } else {
                evt.cancelBubble = true;
            }
        },

        closed:false,
        shown:false

    }; // end NotyObject

    $.notyRenderer = {};

    $.notyRenderer.init = function (options) {

        // Renderer creates a new noty
        var notification = Object.create(NotyObject).init(options);

        (notification.options.force) ? $.noty.queue.unshift(notification) : $.noty.queue.push(notification);

        $.notyRenderer.render();

        return ($.noty.returns == 'object') ? notification : notification.options.id;
    };

    $.notyRenderer.render = function () {

        var instance = $.noty.queue[0];

        if ($.type(instance) === 'object') {
            if (instance.options.dismissQueue) {
                if (instance.options.maxVisible > 0) {
                    if ($(instance.options.layout.container.selector + ' li').length < instance.options.maxVisible) {
                        $.notyRenderer.show($.noty.queue.shift());
                    } else {

                    }
                } else {
                    $.notyRenderer.show($.noty.queue.shift());
                }
            } else {
                if ($.noty.ontap) {
                    $.notyRenderer.show($.noty.queue.shift());
                    $.noty.ontap = false;
                }
            }
        } else {
            $.noty.ontap = true; // Queue is over
        }

    };

    $.notyRenderer.show = function (notification) {

        if (notification.options.modal) {
            $.notyRenderer.createModalFor(notification);
            $.notyRenderer.setModalCount(+1);
        }

        // Where is the container?
        if ($(notification.options.layout.container.selector).length == 0) {
            if (notification.options.custom) {
                notification.options.custom.append($(notification.options.layout.container.object).addClass('i-am-new'));
            } else {
                $('body').append($(notification.options.layout.container.object).addClass('i-am-new'));
            }
        } else {
            $(notification.options.layout.container.selector).removeClass('i-am-new');
        }

        $.notyRenderer.setLayoutCountFor(notification, +1);

        notification.show();
    };

    $.notyRenderer.createModalFor = function (notification) {
        if ($('.noty_modal').length == 0)
            $('
').addClass('noty_modal').data('noty_modal_count', 0).css(notification.options.theme.modal.css).prependTo($('body')).fadeIn('fast');
    };

    $.notyRenderer.getLayoutCountFor = function (notification) {
        return $(notification.options.layout.container.selector).data('noty_layout_count') || 0;
    };

    $.notyRenderer.setLayoutCountFor = function (notification, arg) {
        return $(notification.options.layout.container.selector).data('noty_layout_count', $.notyRenderer.getLayoutCountFor(notification) + arg);
    };

    $.notyRenderer.getModalCount = function () {
        return $('.noty_modal').data('noty_modal_count') || 0;
    };

    $.notyRenderer.setModalCount = function (arg) {
        return $('.noty_modal').data('noty_modal_count', $.notyRenderer.getModalCount() + arg);
    };

    // This is for custom container
    $.fn.noty = function (options) {
        options.custom = $(this);
        return $.notyRenderer.init(options);
    };

    $.noty = {};
    $.noty.queue = [];
    $.noty.ontap = true;
    $.noty.layouts = {};
    $.noty.themes = {};
    $.noty.returns = 'object';
    $.noty.store = {};

    $.noty.get = function (id) {
        return $.noty.store.hasOwnProperty(id) ? $.noty.store[id] : false;
    };

    $.noty.close = function (id) {
        return $.noty.get(id) ? $.noty.get(id).close() : false;
    };

    $.noty.setText = function (id, text) {
        return $.noty.get(id) ? $.noty.get(id).setText(text) : false;
    };

    $.noty.setType = function (id, type) {
        return $.noty.get(id) ? $.noty.get(id).setType(type) : false;
    };

    $.noty.clearQueue = function () {
        $.noty.queue = [];
    };

    $.noty.closeAll = function () {
        $.noty.clearQueue();
        $.each($.noty.store, function (id, noty) {
            noty.close();
        });
    };

    var windowAlert = window.alert;

    $.noty.consumeAlert = function (options) {
        window.alert = function (text) {
            if (options)
                options.text = text;
            else
                options = {text:text};

            $.notyRenderer.init(options);
        };
    };

    $.noty.stopConsumeAlert = function () {
        window.alert = windowAlert;
    };

    $.noty.defaults = {
        layout:'top',
        theme:'agileUI',
        type:'alert',
        text:'',
        dismissQueue:true,
        template:'

',
        animation:{
            open:{height:'toggle'},
            close:{height:'toggle'},
            easing:'swing',
            speed:500
        },
        timeout:false,
        force:false,
        modal:false,
        maxVisible:5,
        closeWith:['click'],
        callback:{
            onShow:function () {
            },
            afterShow:function () {
            },
            onClose:function () {
            },
            afterClose:function () {
            },
            onCloseClick:function () {
            }
        },
        buttons:false
    };

    $(window).resize(function () {
        $.each($.noty.layouts, function (index, layout) {
            layout.container.style.apply($(layout.container.selector));
        });
    });

})(jQuery);

// Helpers
window.noty = function noty(options) {

    // This is for BC  -  Will be deleted on v2.2.0
    var using_old = 0
        , old_to_new = {
            'animateOpen':'animation.open',
            'animateClose':'animation.close',
            'easing':'animation.easing',
            'speed':'animation.speed',
            'onShow':'callback.onShow',
            'onShown':'callback.afterShow',
            'onClose':'callback.onClose',
            'onCloseClick':'callback.onCloseClick',
            'onClosed':'callback.afterClose'
        };

    jQuery.each(options, function (key, value) {
        if (old_to_new[key]) {
            using_old++;
            var _new = old_to_new[key].split('.');

            if (!options[_new[0]]) options[_new[0]] = {};

            options[_new[0]][_new[1]] = (value) ? value : function () {
            };
            delete options[key];
        }
    });

    if (!options.closeWith) {
        options.closeWith = jQuery.noty.defaults.closeWith;
    }

    if (options.hasOwnProperty('closeButton')) {
        using_old++;
        if (options.closeButton) options.closeWith.push('button');
        delete options.closeButton;
    }

    if (options.hasOwnProperty('closeOnSelfClick')) {
        using_old++;
        if (options.closeOnSelfClick) options.closeWith.push('click');
        delete options.closeOnSelfClick;
    }

    if (options.hasOwnProperty('closeOnSelfOver')) {
        using_old++;
        if (options.closeOnSelfOver) options.closeWith.push('hover');
        delete options.closeOnSelfOver;
    }

    if (options.hasOwnProperty('custom')) {
        using_old++;
        if (options.custom.container != 'null') options.custom = options.custom.container;
    }

    if (options.hasOwnProperty('cssPrefix')) {
        using_old++;
        delete options.cssPrefix;
    }

    if (options.theme == 'noty_theme_default') {
        using_old++;
        options.theme = 'agileUI';
    }

    if (!options.hasOwnProperty('dismissQueue')) {
        options.dismissQueue = jQuery.noty.defaults.dismissQueue;
    }

    if (!options.hasOwnProperty('maxVisible')) {
        options.maxVisible = jQuery.noty.defaults.maxVisible;
    }

    if (options.buttons) {
        jQuery.each(options.buttons, function (i, button) {
            if (button.click) {
                using_old++;
                button.onClick = button.click;
                delete button.click;
            }
            if (button.type) {
                using_old++;
                button.addClass = button.type;
                delete button.type;
            }
        });
    }

    if (using_old) {
        if (typeof console !== "undefined" && console.warn) {
            console.warn('You are using noty v2 with v1.x.x options. @deprecated until v2.2.0 - Please update your options.');
        }
    }

    // console.log(options);
    // End of the BC

    return jQuery.notyRenderer.init(options);
}

;(function($) {

    $.noty.themes.agileUI = {
        name: 'agileUI',
        helpers: {
            borderFix: function() {
                if (this.options.dismissQueue) {
                    var selector = this.options.layout.container.selector + ' ' + this.options.layout.parent.selector;
                }
            }
        },
        modal: {
            css: {
                position: 'fixed',
                width: '100%',
                height: '100%',
                backgroundColor: '#000',
                zIndex: 10000,
                opacity: 0.7,
                display: 'none',
                left: 0,
                top: 0
            }
        },
        style: function() {

            this.$bar.bind({
                mouseenter: function() { $(this).find('.noty_close').stop().fadeTo('normal',1); },
                mouseleave: function() { $(this).find('.noty_close').stop().fadeTo('normal',0); }
            });

            switch (this.options.type) {
                case 'alert':
                    this.$bar.addClass('bg-orange');break;
                case 'notification':
                    this.$bar.addClass('bg-blue');break;
                case 'warning':
                    this.$bar.addClass('bg-orange');break;
                case 'error':
                    this.$bar.addClass('bg-red');break;
                case 'information':
                    this.$bar.addClass('bg-gray');break;
                case 'success':
                    this.$bar.addClass('bg-green');break;
                default:
                    this.$bar.addClass('bg-black');break;
            }
        },
        callback: {
            onShow: function() { $.noty.themes.agileUI.helpers.borderFix.apply(this); },
            onClose: function() { $.noty.themes.agileUI.helpers.borderFix.apply(this); }
        }
    };

})(jQuery);

;(function($) {

    $.noty.layouts.bottom = {
        name: 'bottom',
        options: {},
        container: {
            object: '
',
            selector: 'ul#noty_bottom',
            style: function() {
                $(this).css({
                });
            }
        },
        parent: {
            object: '
',
            selector: 'li',
            css: {}
        },
        css: {
            display: 'none'
        },
        addClass: ''
    };

})(jQuery);

;(function($) {

    $.noty.layouts.top = {
        name: 'top',
        options: {},
        container: {
            object: '
',
            selector: 'ul#noty_top',
            style: function() {

            }
        },
        parent: {
            object: '
',
            selector: 'li',
            css: {}
        },
        css: {
            display: 'none'
        },
        addClass: ''
    };

})(jQuery);

;(function($) {

    $.noty.layouts.center = {
        name: 'center',
        options: { // overrides options

            modal: true,

        },
        container: {
            object: '
',
            selector: 'ul#noty_center',
            style: function() {
                $('li',this).addClass('radius-all-4 modal-dialog');
                $(this).css({
                    width: '300px',
                    height: 'auto'
                });

                // getting hidden height
                var dupe = $(this).clone().css({visibility:"hidden", display:"block", position:"absolute", top: 0, left: 0}).attr('id', 'dupe');
                $("body").append(dupe);
                dupe.find('.i-am-closing-now').remove();
                dupe.find('li').css('display', 'block');
                var actual_height = dupe.height();
                dupe.remove();

                if ($(this).hasClass('i-am-new')) {
                    $(this).css({
                        left: ($(window).width() - $(this).outerWidth(false)) / 2 + 'px',
                        top: ($(window).height() - actual_height) / 2 + 'px'
                    });
                } else {
                    $(this).animate({
                        left: ($(window).width() - $(this).outerWidth(false)) / 2 + 'px',
                        top: ($(window).height() - actual_height) / 2 + 'px'
                    }, 500);
                }

            }
        },
        parent: {
            object: '
',
            selector: 'li',
            css: {}
        },
        css: {
            display: 'none',
            width: '310px'
        },
        addClass: ''
    };

})(jQuery);

redpajama_set_name: RedPajamaGithub


text:
ROOT = ../../..

DIR = WMIMapper/WMIProvider

include $(ROOT)/mak/config.mak

LOCAL_DEFINES = -DPEGASUS_WMIPROVIDER_INTERNAL -DPEGASUS_INTERNALONLY

INCLUDES = -I..

ifeq ($(PEGASUS_WMIMAPPER_NEED_MSSDK),true)
  EXTRA_INCLUDES = -I"$(MSSdk)/Include" $(SYS_INCLUDES)
endif

LIBRARY = WMIProvider

LIBRARIES = \
	pegcommon

SOURCES = \
   WMIInstanceProvider.cpp \
   WMIClassProvider.cpp \
   WMIAssociatorProvider.cpp \
   WMIQualifierProvider.cpp \
   WMIMethodProvider.cpp \
   WMIReferenceProvider.cpp \
   WMIQueryProvider.cpp \
   WMIBaseProvider.cpp \
   WMICollector.cpp \
   WMIType.cpp \
   WMIFlavor.cpp \
   WMIValue.cpp \
   WMIString.cpp \
   WMIProperty.cpp \
   WMIQualifier.cpp \
   WMIQualifierSet.cpp \
   WMIDateTime.cpp \
   WMIObject.cpp \
   WMIObjectPath.cpp \
   WMIMethod.cpp \
   StdAfx.cpp \
   MyString.cpp

SYS_LIBS = uuid.lib wbemuuid.lib Framedyn.lib ws2_32.lib advapi32.lib
ifeq ($(CL_MAJOR_VERSION), 14)
  SYS_LIBS += comsuppw.lib
endif

include $(ROOT)/mak/library.mak


text:
div#wrapper {
	background-color: #f6f6ef;
	margin-bottom: 5px;
}

body, textarea, input, button {
	font-family: verdana;
	color: #828282;
}
textarea, input, button {
	font-family: monospace;
	color: black;
}
input[type="submit"], button {
	padding: 2px 5px;
	text-transform: lowercase;
}
a {
	color: black;
}
span.headerlinks {
	font-weight: normal;
	text-transform: lowercase;
}
span.headerlinks a:after {
	content: " |";
}
span.headerlinks a[href="/logout"]:after,
span.headerlinks a[href="/search"]:after {
	content: "";
}
span.headerlinks a {
	padding-right: 3px !important;
	padding-left: 0px !important;
}
div#header {
	background-color: #ff6600;
	padding: 3px 4px 2px 2px;
}
div#header a {
	color: black;
	font-size: 10pt;
}
a#l_holder {
	background-color: transparent !important;
	border: 1px solid white;
	margin-top: -1px;
}
div#header a.cur_url {
	color: white;
}
div#header span.headerlinks a[href="/"] {
	font-weight: bold;
	color: black !important;
	font-size: 0px;
}
div#header span.headerlinks a[href="/"]:after {
	content: "Lobsters";
	text-transform: none;
	font-size: 10pt;
	padding-right: 10px;
}

ol.stories {
	list-style: decimal;
	padding-left: 32px;
	font-size: 10pt;
}

li.story {
	padding-bottom: 0px;
	margin-top: -3px;
}

li.story div.details {
	margin-left: 8px;
}

li.story .link a {
	font-size: 10pt;
	font-weight: normal;
}
ol.stories.list li.story div.details span.link a:visited {
	color: #828282;
}
li.story .byline {
	font-size: 7.5pt;
	padding-left: 0px;
}

span.domain {
	font-size: 8pt;
	font-style: normal;
}
span.domain:before {
	content: "(";
}
span.domain:after {
	content: ")";
}
span.domain:empty:before {
	content: "";
}
span.domain:empty:after {
	content: "";
}

li.story div.voters {
	width: 7px;
	margin-left: -5px;
}

li.story div.voters div.score {
	position: absolute;
	margin-left: 13px;
	margin-top: 5px;
	font-size: 7.5pt;
	margin-bottom: 0;
	color: #888;
}
li.story div.voters div.score:after {
	content: " points";
}
li.story div.voters a.upvoter {
	border-width: 4px;
	border-bottom-width: 8px;
	display: block;
	margin-left: 0px;
	margin-top: 7px;
	padding: 0;
}
li.story div.voters a.upvoter {
	border-color: transparent transparent #999 transparent;
}
li.story div.voters a.upvoter:hover {
	border-color: transparent transparent #999 transparent;
}
li.story.upvoted div.voters a.upvoter {
    border-bottom-color: transparent;
}

li.story div.voters a.downvoter {
	display: none;
}

div.comment_text {
	color: black;
	font-size: 9pt;
}

a.tag {
	font-size: 7pt;
}

.box .legend {
	background-color: transparent;
}


text:
.. _es-guide-reference-api-search-facets-query-facet:

===========
Query Facet
===========

A facet query allows to return a count of the hits matching the facet query. The query itself can be expressed using the Query DSL. For example:

.. code-block:: js

    {
        "facets" : {
            "wow_facet" : {
                "query" : {
                    "term" : { "tag" : "wow" }
                }
            }
        }
    }


text:
package org.springframework.cloud.function.rsocket;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.Type;
import java.util.Map;

import org.reactivestreams.Publisher;
import reactor.core.publisher.Flux;

import org.springframework.cloud.function.context.catalog.FunctionTypeUtils;
import org.springframework.cloud.function.json.JsonMapper;
import org.springframework.core.ResolvableType;
import org.springframework.core.codec.AbstractDecoder;
import org.springframework.core.codec.DecodingException;
import org.springframework.core.io.buffer.DataBuffer;
import org.springframework.core.io.buffer.DataBufferUtils;
import org.springframework.lang.Nullable;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.util.MimeType;
import org.springframework.util.MimeTypeUtils;

/**
 *
 * @author Oleg Zhurakousky
 * @since 3.1
 *
 */
class MessageAwareJsonDecoder extends AbstractDecoder<Object> {

	private final JsonMapper jsonMapper;

	MessageAwareJsonDecoder(JsonMapper jsonMapper) {
		super(MimeTypeUtils.APPLICATION_JSON);
		this.jsonMapper = jsonMapper;
	}

	@Override
	public boolean canDecode(ResolvableType elementType, @Nullable MimeType mimeType) {
		return mimeType != null && mimeType.isCompatibleWith(MimeTypeUtils.APPLICATION_JSON);
	}

	@SuppressWarnings("unchecked")
	@Override
	public Object decode(DataBuffer dataBuffer, ResolvableType targetType,
			@Nullable MimeType mimeType, @Nullable Map<String, Object> hints)
			throws DecodingException {

		ResolvableType type = ResolvableType.forClassWithGenerics(Map.class, String.class,
				Object.class);
		Map<String, Object> messageMap = (Map<String, Object>) doDecode(dataBuffer, type,
				mimeType, hints);
		if (messageMap.containsKey(FunctionRSocketUtils.PAYLOAD)) {
			Type requestedType = FunctionTypeUtils.getGenericType(targetType.getType());
			Object payload = this.jsonMapper.fromJson(
					messageMap.get(FunctionRSocketUtils.PAYLOAD), requestedType);

			if (FunctionTypeUtils.isMessage(targetType.getType())) {
				return MessageBuilder.withPayload(payload).copyHeaders(
						(Map<String, ?>) messageMap.get(FunctionRSocketUtils.HEADERS))
						.build();
			}
			else {
				return payload;
			}
		}
		else {
			return messageMap;
		}
	}

	private Object doDecode(DataBuffer dataBuffer, ResolvableType targetType,
			@Nullable MimeType mimeType, @Nullable Map<String, Object> hints)
			throws DecodingException {

		try {
			byte[] data = toByteArray(dataBuffer.asInputStream());
			return this.jsonMapper.fromJson(data, targetType.getType());
		}
		catch (IOException ex) {
			throw new IllegalStateException(ex);
		}
		finally {
			DataBufferUtils.release(dataBuffer);
		}
	}

	private byte[] toByteArray(final InputStream input) throws IOException {
		try (ByteArrayOutputStream output = new ByteArrayOutputStream()) {
			copyLarge(input, output, new byte[2048]);
			return output.toByteArray();
		}
	}

	private long copyLarge(final InputStream input, final OutputStream output,
			final byte[] buffer) throws IOException {
		long count = 0;
		int n;
		while (-1 != (n = input.read(buffer))) {
			output.write(buffer, 0, n);
			count += n;
		}
		return count;
	}

	@Override
	public Flux<Object> decode(Publisher<DataBuffer> inputStream,
			ResolvableType elementType, MimeType mimeType, Map<String, Object> hints) {
		return Flux.from(inputStream).map(buffer -> decode(buffer, elementType, mimeType, hints));
	}
}


text:
"""Module states Para"""

def start(st_reg_number):
    """Checks the number valiaty for the Para state"""
    divisor = 11

    if len(st_reg_number) > 9:
        return False

    if len(st_reg_number) < 9:
        return False

    if st_reg_number[0:2] != "15":
        return False

    sum_total = 0
    peso = 9
    for i in range(len(st_reg_number)-1):
        sum_total = sum_total + int(st_reg_number[i]) * peso
        peso = peso - 1

    rest_division = sum_total % divisor
    digit = divisor - rest_division

    if rest_division < 2:
        digit = 0

    if rest_division > 1:
        digit = 11 - rest_division

    return digit == int(st_reg_number[len(st_reg_number)-1])


text:
/*
 * Pathfinder
 * Core application for storage and analysis of IT landscape data
 *
 * OpenAPI spec version: 5.0.813
 *
 *
 * NOTE: This class is auto generated by the swagger code generator program.
 * https://github.com/swagger-api/swagger-codegen.git
 * Do not edit the class manually.
 */

package net.leanix.api.models;

import java.util.Objects;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Design
 */

public class Design {
  /**
   * Gets or Sets activeMode
   */
  public enum ActiveModeEnum {
    CUSTOM("CUSTOM"),

    CLASSIC("CLASSIC"),

    MODERN("MODERN"),

    EAS("EAS"),

    CNS_MI("CNS_MI"),

    CNS_CI("CNS_CI");

    private String value;

    ActiveModeEnum(String value) {
      this.value = value;
    }

    @Override
    public String toString() {
      return String.valueOf(value);
    }

    @JsonCreator
    public static ActiveModeEnum fromValue(String text) {
      for (ActiveModeEnum b : ActiveModeEnum.values()) {
        if (String.valueOf(b.value).equals(text)) {
          return b;
        }
      }
      return null;
    }
  }

  @JsonProperty("activeMode")
  private ActiveModeEnum activeMode = null;

  @JsonProperty("customCss")
  private Map<String, Object> customCss = new HashMap<String, Object>();

  public Design activeMode(ActiveModeEnum activeMode) {
    this.activeMode = activeMode;
    return this;
  }

   /**
   * Get activeMode
   * @return activeMode
  **/
  @ApiModelProperty(example = "null", required = true, value = "")
  public ActiveModeEnum getActiveMode() {
    return activeMode;
  }

  public void setActiveMode(ActiveModeEnum activeMode) {
    this.activeMode = activeMode;
  }

  public Design customCss(Map<String, Object> customCss) {
    this.customCss = customCss;
    return this;
  }

  public Design putCustomCssItem(String key, Object customCssItem) {
    this.customCss.put(key, customCssItem);
    return this;
  }

   /**
   * Get customCss
   * @return customCss
  **/
  @ApiModelProperty(example = "null", value = "")
  public Map<String, Object> getCustomCss() {
    return customCss;
  }

  public void setCustomCss(Map<String, Object> customCss) {
    this.customCss = customCss;
  }

  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Design design = (Design) o;
    return Objects.equals(this.activeMode, design.activeMode) &&
        Objects.equals(this.customCss, design.customCss);
  }

  @Override
  public int hashCode() {
    return Objects.hash(activeMode, customCss);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Design {\n");

    sb.append("    activeMode: ").append(toIndentedString(activeMode)).append("\n");
    sb.append("    customCss: ").append(toIndentedString(customCss)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }

}


text:
/**
 * This example shows simple two way data binding. When the value is changed by the user
 * in the field, the change is reflected in the panel title. Similarly, when the value is
 * changed in the view model, the same change is reflected in the text field.
 */
Ext.define('KitchenSink.view.binding.TwoWay', {
    extend: 'Ext.panel.Panel',
    alias: 'widget.binding-two-way',

    //<example>
    requires: ['KitchenSink.view.binding.TwoWayController'],
    otherContent: [{
        type: 'ViewController',
        path: 'app/view/binding/TwoWayController.js'
    }],
    //</example>

    width: 300,
    bodyPadding: 10,

    controller: 'binding.twoway',
    viewModel: {
        data: {
            title: 'The title'
        }
    },

    bind: {
        title: '{title}'
    },

    items: {
        xtype: 'textfield',
        fieldLabel: 'Title',
        labelWidth: 50,
        // The default config for textfield in a bind is "value" (two-way):
        bind: '{title}'
    },

    tbar: [{
        text: 'Random Title',
        handler: 'onTitleButtonClick'
    }]
});


text:
import socket

from oslo_config import cfg
from oslo_utils import netutils

netconf_opts = [
    cfg.StrOpt('my_ip',
               default=netutils.get_my_ipv4(),
               help='IP address of this host'),
    cfg.StrOpt('my_block_storage_ip',
               default='$my_ip',
               help='Block storage IP address of this host'),
    cfg.StrOpt('host',
               default=socket.gethostname(),
               help='Name of this node.  This can be an opaque identifier.  '
                    'It is not necessarily a hostname, FQDN, or IP address. '
                    'However, the node name must be valid within '
                    'an AMQP key, and if using ZeroMQ, a valid '
                    'hostname, FQDN, or IP address'),
    cfg.BoolOpt('use_ipv6',
                default=False,
                help='Use IPv6'),
]

def register_opts(conf):
    conf.register_opts(netconf_opts)

def list_opts():
    return {'DEFAULT': netconf_opts}


text:
<!DOCTYPE html>

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="Bulma v0.5.0 is an open source CSS framework based on Flexbox and built with Sass. It's 100% responsive, fully modular, and available for free.">

  <title>Columns powered by Flexbox | Bulma v0.5.0: a modern CSS framework based on Flexbox</title>

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css">
  <link rel="stylesheet" href="http://bulma.io/versions/0.5.0/css/bulma-docs.css">

  <link rel="canonical" href="http://bulma.io/versions/0.5.0/documentation/grid/columns/">
  <link rel="alternate" type="application/rss+xml" title="Bulma v0.5.0: a modern CSS framework based on Flexbox" href="http://bulma.io/versions/0.5.0/feed.xml">

  <meta property="og:url" content="http://bulma.io/versions/0.5.0">
  <meta property="og:type" content="website">
  <meta property="og:title" content="Bulma v0.5.0: a modern CSS framework based on Flexbox">
  <meta property="og:image" content="http://bulma.io/versions/0.5.0/images/bulma-banner.png">
  <meta property="og:image:type" content="image/png">
  <meta property="og:image:width" content="1200">
  <meta property="og:image:height" content="630">
  <meta property="og:description" content="Bulma v0.5.0 is an open source CSS framework based on Flexbox and built with Sass. It's 100% responsive, fully modular, and available for free.">

  <meta name="twitter:card" content="summary_large_image">
  <meta name="twitter:site" content="@jgthms">
  <meta name="twitter:creator" content="@jgthms">
  <meta name="twitter:title" content="Bulma v0.5.0: a modern CSS framework based on Flexbox">
  <meta name="twitter:image" content="http://bulma.io/versions/0.5.0/images/bulma-banner.png">
  <meta name="twitter:description" content="Bulma v0.5.0 is an open source CSS framework based on Flexbox and built with Sass. It's 100% responsive, fully modular, and available for free.">

  <link rel="apple-touch-icon" sizes="180x180" href="http://bulma.io/versions/0.5.0/favicons/apple-touch-icon.png?v=201701041855">
  <link rel="icon" type="image/png" href="http://bulma.io/versions/0.5.0/favicons/favicon-32x32.png?v=201701041855" sizes="32x32">
  <link rel="icon" type="image/png" href="http://bulma.io/versions/0.5.0/favicons/favicon-16x16.png?v=201701041855" sizes="16x16">
  <link rel="manifest" href="http://bulma.io/versions/0.5.0/favicons/manifest.json?v=201701041855">
  <link rel="mask-icon" href="http://bulma.io/versions/0.5.0/favicons/safari-pinned-tab.svg?v=201701041855" color="#00d1b2">
  <link rel="shortcut icon" href="http://bulma.io/versions/0.5.0/favicons/favicon.ico?v=201701041855">
  <meta name="msapplication-config" content="http://bulma.io/versions/0.5.0/favicons/browserconfig.xml?v=201701041855">
  <meta name="theme-color" content="#00d1b2">

      You are viewing the deprecated 0.5.0 version of the website.
      Click here to view the latest version

        Home

          Docs

            Overview

            Modifiers

            Grid

            Form

            Elements

              Components

            Layout

                0.5.0

                  View all versions

          Blog

                  24 Jul 2017

Access previous Bulma versions

                  10 Mar 2017

New field element (for better controls)

                  11 Apr 2016

Metro UI CSS grid with Bulma tiles

            More posts

                    Stay up to date!

                      Subscribe

          More

                    Extensions

                    Side projects to enhance Bulma

        Github

        Twitter

              Tweet

              Download

            Documentation

            Everything you need to create a website with Bulma

            Overview

            Modifiers

            Grid

            Form

            Elements

              Components

            Layout

        Columns

        Tiles

Columns

A simple way to build responsive columns

To build a grid, just:

Add a columns container

Add as many column elements as you want

Each column will have an equal width, no matter the number of columns.

First column

Second column

Third column

Fourth column

<div class="columns">
  <div class="column">
    First column
  </div>
  <div class="column">
    Second column
  </div>
  <div class="column">
    Third column
  </div>
  <div class="column">
    Fourth column
  </div>
</div>

Sizes

If you want to change the size of a single column, you can use one the following classes:

          is-three-quarters

          is-two-thirds

          is-half

          is-one-third

          is-one-quarter

The other columns will fill up the remaining space automatically.

          is-three-quarters

Auto

Auto

          is-two-thirds

Auto

Auto

          is-half

Auto

Auto

          is-one-third

Auto

Auto

          is-one-quarter

Auto

<div class="columns">
  <div class="column is-three-quarters">
    <p class="notification is-info">
      <code class="html">is-three-quarters</code>
    </p>
  </div>
  <div class="column">
    <p class="notification is-warning">Auto</p>
  </div>
  <div class="column">
    <p class="notification is-danger">Auto</p>
  </div>
</div>

<div class="columns">
  <div class="column is-two-thirds">
    <p class="notification is-info">
      <code class="html">is-two-thirds</code>
    </p>
  </div>
  <div class="column">
    <p class="notification is-warning">Auto</p>
  </div>
  <div class="column">
    <p class="notification is-danger">Auto</p>
  </div>
</div>

<div class="columns">
  <div class="column is-half">
    <p class="notification is-info">
      <code class="html">is-half</code>
    </p>
  </div>
  <div class="column">
    <p class="notification is-warning">Auto</p>
  </div>
  <div class="column">
    <p class="notification is-danger">Auto</p>
  </div>
</div>

<div class="columns">
  <div class="column is-one-third">
    <p class="notification is-info">
      <code class="html">is-one-third</code>
    </p>
  </div>
  <div class="column">
    <p class="notification is-success">Auto</p>
  </div>
  <div class="column">
    <p class="notification is-warning">Auto</p>
  </div>
</div>

<div class="columns">
  <div class="column is-one-quarter">
    <p class="notification is-info">
      <code class="html">is-one-quarter</code>
    </p>
  </div>
  <div class="column">
    <p class="notification is-success">Auto</p>
  </div>
</div>

12 columns

As the grid can be divided into 12 columns, there are size classes for each division:

is-2

is-3

is-4

is-5

is-6

is-7

is-8

is-9

is-10

is-11

Naming

Each modifier class is named after how many columns you want out of 12. So if you want 7 columns out of 12, use is-7.

is-2

1

1

1

1

1

1

1

1

1

1

is-3

1

1

1

1

1

1

1

1

1

is-4

1

1

1

1

1

1

1

1

is-5

1

1

1

1

1

1

1

is-6

1

1

1

1

1

1

is-7

1

1

1

1

1

is-8

1

1

1

1

is-9

1

1

1

is-10

1

1

is-11

1

Offset

While you can use empty columns (like <div class="column"></div>) to create horizontal space around .column elements, you can also use offset modifiers like .is-offset-x:

          is-half

          is-offset-one-quarter

          is-4

          is-offset-8

          is-11

          is-offset-1

<div class="columns is-mobile">
  <div class="column is-half is-offset-one-quarter"></div>
</div>

<div class="columns is-mobile">
  <div class="column is-4 is-offset-8"></div>
</div>

<div class="columns is-mobile">
  <div class="column is-11 is-offset-1"></div>
</div>

Responsiveness

By default, columns are only activated from tablet onwards. This means columns are stacked on top of each other on mobile.

If you want columns to work on mobile too, just add the is-mobile modifier on the columns container:

1

2

3

4

<div class="columns is-mobile">
  <div class="column">1</div>
  <div class="column">2</div>
  <div class="column">3</div>
  <div class="column">4</div>
</div>

Resize

If you want to see the difference, resize your browser and see when the columns are stacked and when they are horizontally distributed.

If you only want columns on desktop, just use the is-desktop modifier on the columns container:

1

2

3

4

<div class="columns is-desktop">
  <div class="column">1</div>
  <div class="column">2</div>
  <div class="column">3</div>
  <div class="column">4</div>
</div>

Different sizes per breakpoint

You can define a column size for each viewport size: mobile, tablet, and desktop.

          is-half-mobile

          is-one-third-tablet

          is-one-quarter-desktop

1

1

1

1

Resize

If you want to see these classes in action, resize your browser window and see how the same column varies in width at each breakpoint.

<div class="columns is-mobile">
  <div class="column is-half-mobile is-one-third-tablet is-one-quarter-desktop">
    <code>is-half-mobile</code><br>
    <code>is-one-third-tablet</code><br>
    <code>is-one-quarter-desktop</code>
  </div>
  <div class="column">1</div>
  <div class="column">1</div>
  <div class="column">1</div>
  <div class="column">1</div>
</div>

Nesting

        You can nest columns to have more flexibility in your design. You only need to follow this structure:

          columns: top-level columns container

              column

                  columns: nested columns

                      column and so on…

        The difference with multiline columns is the order in the HTML code: all the blue columns appear before the red ones. Resize to a narrower viewport to see the result.

First column

First nested column

Second nested column

Second column

50%

Auto

Auto

<div class="columns">
  <div class="column">
    First column
    <div class="columns is-mobile">
      <div class="column">
        First nested column
      </div>
      <div class="column">
        Second nested column
      </div>
    </div>
  </div>
  <div class="column">
    Second column
    <div class="columns is-mobile">
      <div class="column is-half">
        50%
      </div>
      <div class="column">
        Auto
      </div>
      <div class="column">
        Auto
      </div>
    </div>
  </div>
</div>

Multiline

Whenever you want to start a new line, you can close a columns container and start a new one. But you can also add the is-multiline modifier and add more column elements that would fit in a single row.

is-one-quarter

is-one-quarter

is-one-quarter

is-one-quarter

is-half

is-one-quarter

is-one-quarter

is-one-quarter

Auto

<div class="columns is-multiline is-mobile">
  <div class="column is-one-quarter">
    <code>is-one-quarter</code>
  </div>
  <div class="column is-one-quarter">
    <code>is-one-quarter</code>
  </div>
  <div class="column is-one-quarter">
    <code>is-one-quarter</code>
  </div>
  <div class="column is-one-quarter">
    <code>is-one-quarter</code>
  </div>
  <div class="column is-half">
    <code>is-half</code>
  </div>
  <div class="column is-one-quarter">
    <code>is-one-quarter</code>
  </div>
  <div class="column is-one-quarter">
    <code>is-one-quarter</code>
  </div>
  <div class="column">
    Auto
  </div>
</div>

Gapless

If you want to remove the space between the columns, add the is-gapless modifier on the columns container:

First column

Second column

Third column

Fourth column

<div class="columns is-gapless">
  <div class="column">First column</div>
  <div class="column">Second column</div>
  <div class="column">Third column</div>
  <div class="column">Fourth column</div>
</div>

You can combine it with the is-multiline modifier:

is-one-quarter

is-one-quarter

is-one-quarter

is-one-quarter

is-half

is-one-quarter

is-one-quarter

is-one-quarter

Auto

<div class="columns is-gapless is-multiline is-mobile">
  <div class="column is-one-quarter">
    <code>is-one-quarter</code>
  </div>
  <div class="column is-one-quarter">
    <code>is-one-quarter</code>
  </div>
  <div class="column is-one-quarter">
    <code>is-one-quarter</code>
  </div>
  <div class="column is-one-quarter">
    <code>is-one-quarter</code>
  </div>
  <div class="column is-half">
    <code>is-half</code>
  </div>
  <div class="column is-one-quarter">
    <code>is-one-quarter</code>
  </div>
  <div class="column is-one-quarter">
    <code>is-one-quarter</code>
  </div>
  <div class="column">
    Auto
  </div>
</div>

Narrow column

If you want a column to only take the space it needs, use the is-narrow modifier. The other column(s) will fill up the remaining space.

Narrow column

This column is only 200px wide.

Flexible column

This column will take up the remaining space available.

<div class="columns">
  <div class="column is-narrow">
    <div class="box" style="width: 200px;">
      <p class="title is-5">Narrow column</p>
      <p class="subtitle">This column is only 200px wide.</p>
    </div>
  </div>
  <div class="column">
    <div class="box">
      <p class="title is-5">Flexible column</p>
      <p class="subtitle">This column will take up the remaining space available.</p>
    </div>
  </div>
</div>

As for the size modifiers, you can have narrow columns for different breakpoints:

          is-narrow-mobile

          is-narrow-tablet

          is-narrow-desktop

      This page is open source.
      Noticed a typo?
      Or something unclear?

        Improve this page on GitHub

Bulma Partners

Check out their products!

Bulma Newsletter

Get notified when v1 is ready!

          <form action="https://bbxdesign.us3.list-manage.com/subscribe/post?u=b43b93fe633f0560b2a72a69c&id=52585e8803" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate>

                  <input type="email" value="" name="EMAIL" class="input is-flat required email" id="mce-EMAIL" placeholder="email address" required>

                  <input type="submit" value="Subscribe" name="subscribe" id="mc-embedded-subscribe" class="button is-white is-outlined">

                <input type="text" name="b_b43b93fe633f0560b2a72a69c_52585e8803" tabindex="-1" value="">

          </form>

          Bulma by Jeremy Thomas.

            @jgthms

            Support and share the love!

            Tweet

            <form class="paypal-form" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
              <input type="hidden" name="cmd" value="_s-xclick">
              <input type="hidden" name="hosted_button_id" value="8WMKYSRFN6A78">
              <input type="image" src="http://bulma.io/versions/0.5.0/images/paypal-donate.png" border="0" name="submit" alt="PayPal – The safer, easier way to pay online." height="30">

            </form>

            More helpful tools:

        Source code licensed MIT.

        Website content licensed CC BY-NC-SA 4.0.


text:
namespace blink {

LogicalRect PhysicalRect::ConvertToLogical(WritingMode mode,
                                           TextDirection direction,
                                           PhysicalSize outer_size,
                                           PhysicalSize inner_size) const {
  return LogicalRect(
      offset.ConvertToLogical(mode, direction, outer_size, inner_size),
      size.ConvertToLogical(mode));
}

bool PhysicalRect::Contains(const PhysicalRect& other) const {
  return offset.left <= other.offset.left && offset.top <= other.offset.top &&
         Right() >= other.Right() && Bottom() >= other.Bottom();
}

bool PhysicalRect::Intersects(const PhysicalRect& other) const {
  // Checking emptiness handles negative widths as well as zero.
  return !IsEmpty() && !other.IsEmpty() && offset.left < other.Right() &&
         other.offset.left < Right() && offset.top < other.Bottom() &&
         other.offset.top < Bottom();
}

bool PhysicalRect::IntersectsInclusively(const PhysicalRect& other) const {
  // TODO(pdr): How should negative widths or heights be handled?
  return offset.left <= other.Right() && other.offset.left <= Right() &&
         offset.top <= other.Bottom() && other.offset.top <= Bottom();
}

void PhysicalRect::Unite(const PhysicalRect& other) {
  if (other.IsEmpty())
    return;
  if (IsEmpty()) {
    *this = other;
    return;
  }

  UniteEvenIfEmpty(other);
}

void PhysicalRect::UniteIfNonZero(const PhysicalRect& other) {
  if (other.size.IsZero())
    return;
  if (size.IsZero()) {
    *this = other;
    return;
  }

  UniteEvenIfEmpty(other);
}

void PhysicalRect::UniteEvenIfEmpty(const PhysicalRect& other) {
  LayoutUnit left = std::min(offset.left, other.offset.left);
  LayoutUnit top = std::min(offset.top, other.offset.top);
  LayoutUnit right = std::max(Right(), other.Right());
  LayoutUnit bottom = std::max(Bottom(), other.Bottom());
  offset = {left, top};
  size = {right - left, bottom - top};
}

void PhysicalRect::Expand(const NGPhysicalBoxStrut& strut) {
  ExpandEdges(strut.top, strut.right, strut.bottom, strut.left);
}

void PhysicalRect::Expand(const LayoutRectOutsets& outsets) {
  ExpandEdges(outsets.Top(), outsets.Right(), outsets.Bottom(), outsets.Left());
}

void PhysicalRect::ExpandEdgesToPixelBoundaries() {
  int left = FloorToInt(offset.left);
  int top = FloorToInt(offset.top);
  int max_right = (offset.left + size.width).Ceil();
  int max_bottom = (offset.top + size.height).Ceil();
  offset.left = LayoutUnit(left);
  offset.top = LayoutUnit(top);
  size.width = LayoutUnit(max_right - left);
  size.height = LayoutUnit(max_bottom - top);
}

void PhysicalRect::Contract(const NGPhysicalBoxStrut& strut) {
  ExpandEdges(-strut.top, -strut.right, -strut.bottom, -strut.left);
}

void PhysicalRect::Contract(const LayoutRectOutsets& outsets) {
  ExpandEdges(-outsets.Top(), -outsets.Right(), -outsets.Bottom(),
              -outsets.Left());
}

void PhysicalRect::Intersect(const PhysicalRect& other) {
  PhysicalOffset new_offset(std::max(X(), other.X()), std::max(Y(), other.Y()));
  PhysicalOffset new_max_point(std::min(Right(), other.Right()),
                               std::min(Bottom(), other.Bottom()));

  // Return a clean empty rectangle for non-intersecting cases.
  if (new_offset.left >= new_max_point.left ||
      new_offset.top >= new_max_point.top) {
    new_offset = PhysicalOffset();
    new_max_point = PhysicalOffset();
  }

  offset = new_offset;
  size = {new_max_point.left - new_offset.left,
          new_max_point.top - new_offset.top};
}

bool PhysicalRect::InclusiveIntersect(const PhysicalRect& other) {
  PhysicalOffset new_offset(std::max(X(), other.X()), std::max(Y(), other.Y()));
  PhysicalOffset new_max_point(std::min(Right(), other.Right()),
                               std::min(Bottom(), other.Bottom()));

  if (new_offset.left > new_max_point.left ||
      new_offset.top > new_max_point.top) {
    *this = PhysicalRect();
    return false;
  }

  offset = new_offset;
  size = {new_max_point.left - new_offset.left,
          new_max_point.top - new_offset.top};
  return true;
}

LayoutRect PhysicalRect::ToLayoutFlippedRect(
    const ComputedStyle& style,
    const PhysicalSize& container_size) const {
  if (!style.IsFlippedBlocksWritingMode())
    return {offset.left, offset.top, size.width, size.height};
  return {container_size.width - offset.left - size.width, offset.top,
          size.width, size.height};
}

String PhysicalRect::ToString() const {
  return String::Format("%s %s", offset.ToString().Ascii().c_str(),
                        size.ToString().Ascii().c_str());
}

PhysicalRect UnionRect(const Vector<PhysicalRect>& rects) {
  PhysicalRect result;
  for (const auto& rect : rects)
    result.Unite(rect);
  return result;
}

PhysicalRect UnionRectEvenIfEmpty(const Vector<PhysicalRect>& rects) {
  wtf_size_t count = rects.size();
  if (!count)
    return PhysicalRect();

  PhysicalRect result = rects[0];
  for (wtf_size_t i = 1; i < count; ++i)
    result.UniteEvenIfEmpty(rects[i]);

  return result;
}

std::ostream& operator<<(std::ostream& os, const PhysicalRect& value) {
  return os << value.ToString();
}

WTF::TextStream& operator<<(WTF::TextStream& ts, const PhysicalRect& r) {
  // This format is required by some layout tests.
  ts << "at ("
     << WTF::TextStream::FormatNumberRespectingIntegers(r.X().ToFloat());
  ts << "," << WTF::TextStream::FormatNumberRespectingIntegers(r.Y().ToFloat());
  ts << ") size "
     << WTF::TextStream::FormatNumberRespectingIntegers(r.Width().ToFloat());
  ts << "x"
     << WTF::TextStream::FormatNumberRespectingIntegers(r.Height().ToFloat());
  return ts;
}

}  // namespace blink


text:
{-# OPTIONS_HADDOCK hide, prune #-}
module Handler.Home.LuciConnect
  ( luciConnectPane
  ) where

import Import
import Text.Julius

luciConnectPane :: Handler (Text,Text, Widget)
luciConnectPane = do
  luciConnectedClass <- newIdent
  luciConnectingClass <- newIdent
  luciDisconnectedClass <- newIdent
  muser <- maybeAuth
  let urole = muserRole muser
  return . (,,) luciConnectedClass luciDisconnectedClass $ do
    connectButton <- newIdent
    luciProxyUrl <- newIdent
    luciConnectedInfo <- newIdent
    luciConnectingInfo <- newIdent

    hiddenPaneClass  <- newIdent
    visiblePaneClass <- newIdent

    let connectForm =
          [hamlet|

            $if urole /= UR_NOBODY

                Connect to Luci

                  connect

                  Host address
                  <input.form-control ##{luciProxyUrl} type="url" value="ws://localhost/luci">
            $else

                <input type="hidden" style="display: none;" ##{luciProxyUrl} type="url" value="ws://localhost/luci">
          |]
        connectedInfo =
          [hamlet|

              Connected to Luci at

           |]
        connectingInfo =
          [hamlet|

              Connecting to Luci at

              ...
           |]

    toWidgetHead
      [cassius|
       .#{hiddenPaneClass}
         display: none

       .#{visiblePaneClass}
         display: block
         margin: 0
         padding: 0
      |]
    toWidgetHead
      [julius|
        /** Registers one callback; comes from Handler.Home.PanelServices.
         *  onClick :: JSString -> IO () -- address of websocket host
         *  return :: IO ()
         */
        function registerUserConnectToLuci(onClick){
          document.getElementById('#{rawJS connectButton}').onclick = function(){
            var url = document.getElementById('#{rawJS luciProxyUrl}').value;
            if (url) {onClick(url);}
          };
        }

        /** Display "luci connected message"; comes from Handler.Home.PanelServices.
         *  connectedHost :: JSString -- address of websocket host
         *  return :: IO ()
         */
        function showLuciConnected(connectedHost){
          Array.prototype.slice.call(
            document.getElementsByClassName('#{rawJS luciDisconnectedClass}')).forEach(function(e){
               e.className = "#{rawJS luciDisconnectedClass} #{rawJS hiddenPaneClass}";
             });
          Array.prototype.slice.call(
            document.getElementsByClassName('#{rawJS luciConnectingClass}')).forEach(function(e){
               e.className = "#{rawJS luciConnectingClass} #{rawJS hiddenPaneClass}";
             });
          document.getElementById('#{rawJS luciConnectedInfo}').innerText = connectedHost;
          Array.prototype.slice.call(
            document.getElementsByClassName('#{rawJS luciConnectedClass}')).forEach(function(e){
               e.className = "#{rawJS luciConnectedClass} #{rawJS visiblePaneClass}";
             });
        }

        /** Display "luci connected message"; comes from Handler.Home.PanelServices.
         *  connectedHost :: JSString -- address of websocket host
         *  return :: IO ()
         */
        function showLuciConnecting(connectedHost){
          Array.prototype.slice.call(
            document.getElementsByClassName('#{rawJS luciDisconnectedClass}')).forEach(function(e){
               e.className = "#{rawJS luciDisconnectedClass} #{rawJS hiddenPaneClass}";
             });
          Array.prototype.slice.call(
            document.getElementsByClassName('#{rawJS luciConnectedClass}')).forEach(function(e){
               e.className = "#{rawJS luciConnectedClass} #{rawJS hiddenPaneClass}";
             });
          document.getElementById('#{rawJS luciConnectingInfo}').innerText = connectedHost;
          Array.prototype.slice.call(
            document.getElementsByClassName('#{rawJS luciConnectingClass}')).forEach(function(e){
               e.className = "#{rawJS luciConnectingClass} #{rawJS visiblePaneClass}";
             });
        }

        /** Display "connect to luci" form; comes from Handler.Home.PanelServices.
         *  defaultHost :: JSString -- default address of websocket host
         *  return :: IO ()
         */
        function showLuciConnectForm(defaultHost){
          Array.prototype.slice.call(
            document.getElementsByClassName('#{rawJS luciConnectedClass}')).forEach(function(e){
               e.className = "#{rawJS luciConnectedClass} #{rawJS hiddenPaneClass}";
             });
          Array.prototype.slice.call(
            document.getElementsByClassName('#{rawJS luciConnectingClass}')).forEach(function(e){
               e.className = "#{rawJS luciConnectingClass} #{rawJS hiddenPaneClass}";
             });
          if (defaultHost) {
            document.getElementById('#{rawJS luciProxyUrl}').value = defaultHost;
          } else {
            document.getElementById('#{rawJS luciProxyUrl}').value = "";
          }
          Array.prototype.slice.call(
            document.getElementsByClassName('#{rawJS luciDisconnectedClass}')).forEach(function(e){
               e.className = "#{rawJS luciDisconnectedClass} #{rawJS visiblePaneClass}";
             });
        }
      |]
    toWidgetBody
      [hamlet|

          ^{connectForm}

          ^{connectedInfo}

          ^{connectingInfo}
      |]


text:
using System;
using System.Collections.Generic;
using Thrift.Server;
using Thrift.Transport;

namespace CSharpTutorial
{
    public class CalculatorHandler : Calculator.Iface
    {
        Dictionary<int, SharedStruct> log;

        public CalculatorHandler()
        {
            log = new Dictionary<int, SharedStruct>();
        }

        public void ping()
        {
            Console.WriteLine("ping()");
        }

        public int add(int n1, int n2)
        {
            Console.WriteLine("add({0},{1})", n1, n2);
            return n1 + n2;
        }

        public int calculate(int logid, Work work)
        {
            Console.WriteLine("calculate({0}, [{1},{2},{3}])", logid, work.Op, work.Num1, work.Num2);
            int val = 0;
            switch (work.Op)
            {
                case Operation.ADD:
                    val = work.Num1 + work.Num2;
                    break;

                case Operation.SUBTRACT:
                    val = work.Num1 - work.Num2;
                    break;

                case Operation.MULTIPLY:
                    val = work.Num1 * work.Num2;
                    break;

                case Operation.DIVIDE:
                    if (work.Num2 == 0)
                    {
                        InvalidOperation io = new InvalidOperation();
                        io.What = (int)work.Op;
                        io.Why = "Cannot divide by 0";
                        throw io;
                    }
                    val = work.Num1 / work.Num2;
                    break;

                default:
                    {
                        InvalidOperation io = new InvalidOperation();
                        io.What = (int)work.Op;
                        io.Why = "Unknown operation";
                        throw io;
                    }
            }

            SharedStruct entry = new SharedStruct();
            entry.Key = logid;
            entry.Value = val.ToString();
            log[logid] = entry;

            return val;
        }

        public SharedStruct getStruct(int key)
        {
            Console.WriteLine("getStruct({0})", key);
            return log[key];
        }

        public void zip()
        {
            Console.WriteLine("zip()");
        }
    }

    public class CSharpServer
    {
        public static void Main()
        {
            try
            {
                CalculatorHandler handler = new CalculatorHandler();
                Calculator.Processor processor = new Calculator.Processor(handler);
                TServerTransport serverTransport = new TServerSocket(9090);
                TServer server = new TSimpleServer(processor, serverTransport);

                // Use this for a multithreaded server
                // server = new TThreadPoolServer(processor, serverTransport);

                Console.WriteLine("Starting the server...");
                server.Serve();
            }
            catch (Exception x)
            {
                Console.WriteLine(x.StackTrace);
            }
            Console.WriteLine("done.");
        }
    }
}


text:
package com.talis.hbase.rdf.util;

import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.ResourceFactory;

public class Vocab
{
    public static Resource type( String namespace, String localName )
    {
        return ResourceFactory.createResource( namespace + localName ) ;
    }

    public static Resource resource( String namespace, String localName )
    {
        return ResourceFactory.createResource( namespace + localName ) ;
    }

    public static Property property( String namespace, String localName )
    {
        return ResourceFactory.createProperty( namespace + localName ) ;
    }
}


text:
ARG IMAGE_NAME
FROM ${IMAGE_NAME}:latest
LABEL maintainer "Takuya Takeuchi <takuya.takeuchi.dev@gmail.com>"

# install gosu to execute process by non-root user
RUN apt-get update && apt-get install -y --no-install-recommends \
    gosu

# to use add-apt-repository
RUN apt-get update && apt-get install -y --no-install-recommends \
    software-properties-common

RUN add-apt-repository ppa:git-core/ppa \
 && apt-get update && apt-get install -y --no-install-recommends \
    git \
 && apt-get clean && rm -rf /var/lib/apt/lists/*

# copy build script and run
COPY runBuild.sh /runBuild.sh
RUN chmod 744 /runBuild.sh
ENTRYPOINT ["./runBuild.sh"]


text:
* This is material for a python training.
* Slides are based on reveal.js
* Slides served [here](http://droub.github.io/prez)


text:
<?php
namespace Apps\Console;

use Cygnite\Console\CraftApplication;

/**
 * Class Bootstrap
 *
 * @package Apps\Console
 */
class Kernel extends CraftApplication
{
    /**
     * Add craft console commands in the array stack
     *
     * @var array
     */
    protected $commands = [
        'Apps\Console\Commands\GreetCommand',
    ];

    public function __construct($consoleApp, $version)
    {
        parent::__construct($consoleApp, $version);
    }

    /**
     * We will register all console commands here
     *
     * @return array
     */
    protected function setCommands()
    {
        return $this->register($this->commands);
    }

    /**
     * Run registered commands
     *
     * @return $this|void
     */
    public function run()
    {
        $this->setCommands()
            ->execute();
    }
}


text:
package javax.swing.border;

import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;

/**
 * A border that consists of a line whose thickness and color can be
 * specified. There also is a variant with rounded corners.
 *
 * @author Sascha Brawer (brawer@dandelis.ch)
 */
public class LineBorder extends AbstractBorder
{
  /**
   * Determined using the serialver tool
   * of Apple/Sun JDK 1.3.1 on MacOS X 10.1.5.
   */
  static final long serialVersionUID = -787563427772288970L;

  /**
   * A shared instance of a black, one pixel thick, plain LineBorder.
   * The singleton object is lazily created by {@link
   * #createBlackLineBorder()} upon its first invocation.
   */
  private static LineBorder blackLineBorder;

  /**
   * A shared instance of a gray, one pixel thick, plain LineBorder.
   * The singleton object is lazily created by {@link
   * #createGrayLineBorder()} upon its first invocation.
   */
  private static LineBorder grayLineBorder;

  /**
   * The width of the line in pixels.
   */
  protected int thickness;

  /**
   * The color of the line.
   */
  protected Color lineColor;

  /**
   * Indicates whether the line is drawn with rounded corners
   * (true) or not ((false).
   */
  protected boolean roundedCorners;

  /**
   * Constructs a LineBorder given its color.  The border will be one
   * pixel thick and have plain corners.
   *
   * @param color the color for drawing the border.
   *
   * @see #LineBorder(java.awt.Color, int, boolean)
   */
  public LineBorder(Color color)
  {
    this(color, /* thickness */ 1, /* roundedCorners */ false);
  }

  /**
   * Constructs a LineBorder given its color and thickness.  The
   * border will have plain corners.
   *
   * @param color the color for drawing the border.
   * @param thickness the width of the line in pixels.
   *
   * @see #LineBorder(java.awt.Color, int, boolean)
   */
  public LineBorder(Color color, int thickness)
  {
    this (color, thickness, /* roundedCorners */ false);
  }

  /**
   * Constructs a LineBorder given its color, thickness, and whether
   * it has rounded corners.
   *
   *

   *
   *
Note that the enlarged view in the right-hand picture shows
   * that the implementation draws one more pixel than specified,
   * provided that roundedCorders is true
   * and anti-aliasing is turned on while painting. While this might
   * be considered a bug, the Sun reference implementation (at least
   * JDK 1.3.1 on Apple MacOS X 10.1.5) can be observed to fill
   * exactly the same pixels as shown above. The GNU Classpath
   * LineBorder replicates the observed behavior of the Sun
   * implementation.
   *
   * @param color the color for drawing the border.
   * @param thickness the width of the line in pixels.
   * @param roundedCorners true for rounded corners,
   *        false for plain corners.
   *
   * @since 1.3
   */
  // For the bug mentioned in the JavaDoc, please see also the comment
  // in the paintBorder method below.
  //
  public LineBorder(Color color, int thickness, boolean roundedCorners)
  {
    if ((color == null) || (thickness < 0))
      throw new IllegalArgumentException();

    this.lineColor = color;
    this.thickness = thickness;
    this.roundedCorners = roundedCorners;
  }

  /**
   * Returns a black, one pixel thick, plain {@link LineBorder}. The method
   * may always return the same (singleton) {@link LineBorder} instance.
   *
   * @return The border.
   */
  public static Border createBlackLineBorder()
  {
    /* Swing is not designed to be thread-safe, so there is no
     * need to synchronize the access to the global variable.
     */
    if (blackLineBorder == null)
      blackLineBorder = new LineBorder(Color.black);

    return blackLineBorder;
  }

  /**
   * Returns a gray, one pixel thick, plain {@link LineBorder}. The method
   * may always return the same (singleton) {@link LineBorder} instance.
   *
   * @return The border.
   */
  public static Border createGrayLineBorder()
  {
    /* Swing is not designed to be thread-safe, so there is no
     * need to synchronize the access to the global variable.
     */
    if (grayLineBorder == null)
      grayLineBorder = new LineBorder(Color.gray);

    return grayLineBorder;
  }

  /**
   * Paints the line border around a given Component.
   *
   * @param c the component whose border is to be painted.
   * @param g the graphics for painting.
   * @param x the horizontal position for painting the border.
   * @param y the vertical position for painting the border.
   * @param width the width of the available area for painting the border.
   * @param height the height of the available area for painting the border.
   */
  public void paintBorder(Component c, Graphics  g,
                          int x, int y, int width, int height)
  {
    Color oldColor = g.getColor();

    try
    {
      g.setColor(lineColor);

      // If width and height were not adjusted, the border would
      // appear one pixel too large in both directions.
      width -= 1;
      height -= 1;

      // Blurred, too large appearance
      // -----------------------------
      // While Java 2D has introduced line strokes of arbitrary width,
      // it seems desirable to keep this code independent of Java 2D.
      // Therefore, multiple nested rectangles (or rounded rectangles)
      // are drawn in order to simulate a line whose thickness is
      // greater than one pixel.
      //
      // This hack causes a blurred appearance when anti-aliasing is
      // on. Interestingly enough, though, the Sun JDK 1.3.1 (at least
      // on MacOS X 10.1.5) shows exactly the same appearance under
      // this condition. It thus seems likely that Sun does the same
      // hack for simulating thick lines.  For this reason, the
      // blurred appearance seems acceptable -- especially since GNU
      // Classpath tries to be compatible with the Sun reference
      // implementation.
      for (int i = 0; i < thickness; i++)
      {
        if (roundedCorners)
          g.drawRoundRect(x, y, width, height, thickness, thickness);
        else
          g.drawRect(x, y, width, height);

        x += 1;
        y += 1;
        width -= 2;
        height -= 2;
      }
    }
    finally
    {
      g.setColor(oldColor);
    }
  }

  /**
   * Measures the width of this border.
   *
   * @param c the component whose border is to be measured.
   *
   * @return an Insets object whose left, right,
   *         top and bottom fields indicate the
   *         width of the border at the respective edge, which is the
   *         thickness of the line.
   *
   * @see #getBorderInsets(java.awt.Component, java.awt.Insets)
   */
  public Insets getBorderInsets(Component c)
  {
    return new Insets(thickness, thickness, thickness, thickness);
  }

  /**
   * Measures the width of this border, storing the results into a
   * pre-existing Insets object.
   *
   * @param insets an Insets object for holding the result values.
   *        After invoking this method, the left,
   *        right, top and
   *        bottom fields indicate the width of the
   *        border at the respective edge, which is the thickness
   *        of the line.
   *
   * @return the same object that was passed for insets.
   *
   * @see #getBorderInsets(Component)
   */
  public Insets getBorderInsets(Component c, Insets insets)
  {
    insets.left = insets.right = insets.top = insets.bottom = thickness;
    return insets;
  }

  /**
   * Returns the color of the line.
   *
   * @return The line color (never null).
   */
  public Color getLineColor()
  {
    return lineColor;
  }

  /**
   * Returns the thickness of the line in pixels.
   *
   * @return The line thickness (in pixels).
   */
  public int getThickness()
  {
    return thickness;
  }

  /**
   * Returns whether this LineBorder os drawm with rounded
   * or with plain corners.
   *
   * @return true if the corners are rounded,
   *         false if the corners are plain.
   */
  public boolean getRoundedCorners()
  {
    return roundedCorners;
  }

  /**
   * Determines whether this border fills every pixel in its area
   * when painting.
   *
   * @return true if the corners are plain and the line
   *         color is fully opaque; false if the corners
   *         are rounded or the line color is partially transparent.
   */
  public boolean isBorderOpaque()
  {
    return (!roundedCorners) && (lineColor.getAlpha() == 255);
  }
}


text:
/*
 Usage:
 bin/eclairjs.sh examples/mllib/random_forest_regression_example.js [file]
 */

function run(sc) {
    var MLUtils = require("eclairjs/mllib/MLUtils");
    var RandomForest = require('eclairjs/mllib/tree/RandomForest');
    var Tuple = require('eclairjs/Tuple');

    var datapath = ((typeof args !== "undefined") && (args.length > 1)) ? args[1] : "examples/data/mllib/sample_libsvm_data.txt";

    var data = MLUtils.loadLibSVMFile(sc, datapath);

// Split the data into training and test sets (30% held out for testing)
    var splits = data.randomSplit([0.7, 0.3]);
    var trainingData = splits[0];
    var testData = splits[1];

// Set parameters.
// Empty categoricalFeaturesInfo indicates all features are continuous.
    var categoricalFeaturesInfo = {};
    var numTrees = 3; // Use more in practice.
    var featureSubsetStrategy = "auto"; // Let the algorithm choose.
    var impurity = "variance";
    var maxDepth = 4;
    var maxBins = 32;
    var seed = 12345;

// Train a RandomForest model.
    var model = RandomForest.trainRegressor(
        trainingData,
        categoricalFeaturesInfo,
        numTrees,
        featureSubsetStrategy,
        impurity,
        maxDepth,
        maxBins,
        seed
    );

// Evaluate model on test instances and compute test error
    var predictionAndLabel = testData.mapToPair(function (p, model) {
        return new Tuple(model.predict(p.getFeatures()), p.getLabel());
    }, [model]);

    var testMSE = predictionAndLabel.map(function (tup) {
            var diff = tup[0] - tup[1];
            return diff * diff;
        }).reduce(function (a, b) {
            return a + b;
        }) / testData.count();

    var ret = {};
    ret.testMSE = testMSE;
    ret.model = model;
    return ret;
}

/*
 check if SparkContext is defined, if it is we are being run from Unit Test
 */

if (typeof sparkContext === 'undefined') {
    var SparkConf = require('eclairjs/SparkConf');
    var SparkContext = require('eclairjs/SparkContext');
    var sparkConf = new SparkConf().setAppName("Random Forest Regression Example");
    var sc = new SparkContext(sparkConf);
    var result = run(sc);
    print("Test Mean Squared Error: " + result.testMSE);
    print("Learned regression forest model:\n" + result.model.toDebugString());

// Save and load model
    result.model.save(sc, "target/tmp/myRandomForestRegressionModel");
    var RandomForestModel = require('eclairjs/mllib/tree/model/RandomForestModel');
    var sameModel = RandomForestModel.load(
        sc,
        "target/tmp/myRandomForestRegressionModel"
    );

    sc.stop();
}


text:
"""
This file provides functions to extract data from the "Sums" histogram. The functions should, return (lists of)
plottables.
"""

from rootpy import asrootpy

from utils import \
    gen_random_name,\
    get_est_dirs,\
    make_estimator_title,\
    remap_x_values,\
    remove_zero_value_points,\
    remove_points_with_equal_x,\
    remove_points_with_x_err_gt_1NchRef,\
    remove_non_mutual_points

import ROOT

def get_meanpt_vs_estmult(resutlts_est_dir, pids):
    """
    Create a 1Dprofile for the given pids and the given estimator name
    """
    # find the mult vs pt histograms for the given pids
    mult_vs_pts = []
    for pid in pids:
        mult_vs_pts.append(asrootpy(getattr(resutlts_est_dir.mult_pt, pid)))
    profx = sum(mult_vs_pts).ProfileX()
    profx.name = gen_random_name()
    return profx

def get_dNdeta_in_classifier_bin_interval(sums_classifier_dir, event_counter, classifier_bin_interval):
    """
    Get dN/deta for a given interval of classifier bin indices
    Parameters
    ----------
    sums_classifier_dir : TList
        Sums directory of a classifier
    event_counter : Hist1D
        Event counter histogram with the classifier value on the xaxis
    classifier_bin_interval : list
        classifier value bin edges given as bin indices
    Returns
    -------
    Hist1D
    """
    hist_name = "eta_classifier_{0}".format(sums_classifier_dir.GetName())
    h2d = asrootpy(sums_classifier_dir.FindObject(hist_name))
    if not h2d:
        raise ValueError("Could not find histogram {0}".format(hist_name))
    h2d.yaxis.set_range(classifier_bin_interval[0], classifier_bin_interval[1])
    h = asrootpy(h2d.projection_x(gen_random_name()))
    h.title = "{0} - {1} %".format(100 * classifier_bin_interval[0], 100 * classifier_bin_interval[1])
    # scale by the number of events in this mult_interval and bin width
    try:
        h.Scale((1.0 /
                 float(event_counter.Integral(classifier_bin_interval[0], classifier_bin_interval[1]))),
                "width")
    except ZeroDivisionError:
        # If this happens, we have empty bins in dN/deta! The stats must suck!
        raise ZeroDivisionError("Your statistics are terrible! Consider increasing the classifier value interval to avoid this")
    return h

def get_identified_vs_mult(h3d, pdg):
    """
    Return 1D counter histogram of identified particles vs N_ch^est
    Parameters
    ----------
    h3d: Hist3D
         x: est_mult; y: pT; z: pids1
    pdg: str
         pdg code as string
    Return
    ------
    Hist1D:
         x: Nch_est y: counts
    """
    pid_bin = h3d.zaxis.find_bin(pdg)
    if pid_bin == 0:
        raise ValueError("given pdg ({0}) does not exist in histogram".format(pdg))

    h3d.zaxis.SetRange(pid_bin, pid_bin)
    h = asrootpy(h3d.Project3D("yx").ProjectionX())
    h.SetName(gen_random_name())
    return h

def get_correlation_histogram(sums, classifier1, classifier2):
    """
    Returns the correlation histogram between classifier 1 and 2

    Parameters
    ----------
    sums : TList
           Sums directory
    classifier1 : str
           Name of estimator 1
    classifier2 : str
           Name of estimator 2
    Returns
    -------
    Hist2D :
        Hist2D with classifier1 on the x- and classifier2 on the y-axis_title

    Raises
    ------
    ValueError :
        If either of the classifiers was not found

    """
    if not isinstance(sums, ROOT.TList):
        raise TypeError("{0} is not of type ROOT.TList".format(sums))
    naming_pattern = "corr_this_with_{0}"
    try:
        corr_hist = asrootpy(sums.FindObject(classifier1).FindObject(naming_pattern.format(classifier2)))
    except TypeError:
        # The first classifier was not found, raising TypeError when trying to find the 2nd one
        raise ValueError("Classifier {0} was not found in given list".format(classifier1))
    if not corr_hist:
        raise ValueError("Correlation histogram {0} vs {1} not found".format(classifier1, classifier2))
    return corr_hist

def get_PNch_vs_estmult(sums, est):
    """
    Parameters
    ----------
    sums : TList
           Sums directory
    est : str
          Estimator name
    Returns
    -------
    Hist1D :
            Counter Histogram for Number of events with Nch in the estimator region
    """
    if not isinstance(sums, ROOT.TList):
        raise TypeError("{0} is not of type ROOT.TList".format(sums))
    # nasty hardcoded:
    ref_est = "EtaLt05"
    corr_hist = get_correlation_histogram(sums, est, ref_est)
    return asrootpy(corr_hist.ProjectionX(gen_random_name()))

def get_pT_distribution(results_est_dir, pids, classifier_bin_interval, normalized=False):
    """
    Parameters
    ----------
    results_est_dir : TDirectory
        Directory of a given estimator
    pids : list
        List of strings denoting requested pids
    classifier_bin_interval : tuple
        Lower and upper limit of classifier value for which the p_T distribution should be made.
        This value needs to be given as bin indices!
    normalized : Boolean
        Should the distribution be normalized to yield P(p_T)?
    Returns
    -------
    Hist1D :
        Histogram P(p_T)
    """
    mult_pt_hists = []
    for pid in pids:
        mult_pt_hists.append(getattr(results_est_dir.mult_pt, pid))
    summed_mult_pt = sum(mult_pt_hists)
    summed_mult_pt.xaxis.SetRange(*classifier_bin_interval)
    projy = asrootpy(summed_mult_pt.ProjectionY())
    projy.name = gen_random_name()
    event_counter = asrootpy(results_est_dir.event_counter)
    # Scale by the number of events in the interval;
    projy.Scale(1.0 / event_counter.Integral(*classifier_bin_interval))
    if normalized:
        projy.Scale(1.0 / projy.Integral())
    return projy

def get_mean_nMPI(sums_est_dir, classifier_bin_interval):
    """
    Get the mean nMPI of events in a given N_ch interval
    Parameters
    ----------
    sums_est_dir : TList
        List for a given estimator
    nch_low, nch_up : int
        Lower and upper limit of Nch for which <nMPI> should be calculated
    Returns
    -------
    Float :
           <nMPI>
    """
    nch_vs_nmpi = asrootpy(sums_est_dir.FindObject("corr_this_with_nMPI"))
    nch_vs_nmpi.xaxis.SetRange(*classifier_bin_interval)
    return nch_vs_nmpi.GetMean(2)

def get_graphs_particle_ratios_vs_refmult(plottingcls, pids1, pids2, scale=None, ytitle=''):
    """
    Returns list of ratios of the two pid-lists (pids1/pids2) vs refmult.
    This function depends on the correlation histograms to be present in f
    """
    ratios = []
    ref_classifier = 'EtaLt05'
    for est_dir in get_est_dirs(plottingcls.sums, plottingcls.considered_ests):
        h3d = asrootpy(est_dir.FindObject("classifier_pT_PID_{0}".format(est_dir.GetName())))
        corr_hist = get_correlation_histogram(plottingcls.sums, est_dir.GetName(), ref_classifier)
        pids1_vs_estmult = sum([get_identified_vs_mult(h3d, pdg) for pdg in pids1])
        pids2_vs_estmult = sum([get_identified_vs_mult(h3d, pdg) for pdg in pids2])

        # remap histograms using the correlation between the current estimator and the reference one
        pids1_vs_refmult = remap_x_values(pids1_vs_estmult, corr_hist)
        pids2_vs_refmult = remap_x_values(pids2_vs_estmult, corr_hist)

        # sanitize
        for g in [pids1_vs_refmult, pids2_vs_refmult]:
            remove_zero_value_points(g)
            remove_points_with_x_err_gt_1NchRef(g)
            remove_points_with_equal_x(g)
        remove_non_mutual_points(pids1_vs_refmult, pids2_vs_refmult)

        try:
            ratio = pids1_vs_refmult / pids2_vs_refmult
        except ZeroDivisionError:
            print "ZeroDivisionError in {0}".format(est_dir.GetName())
            continue
        if scale:
            ratio.Scale(scale)
        ratio.title = make_estimator_title(est_dir.GetName())
        ratios.append(ratio)
    return ratios