text:
package com.lightcrafts.mediax.jai;
import java.awt.geom.AffineTransform;
import java.awt.image.RenderedImage;
import java.awt.image.renderable.ParameterBlock;
import java.awt.image.renderable.RenderableImage;
import java.beans.PropertyChangeListener;
import java.util.Vector;

/**
 * A class implementing the "MIP map" operation on a
 * RenderedImage.  Given a RenderedImage,
 * which represents the image at the highest resolution level, the
 * image at each lower resolution level may be derived by performing a
 * specific chain of operations to down sample the image at the next
 * higher resolution level repeatedly.  The highest resolution level is
 * defined as level 0.
 *
 *
 The downSampler is a chain of operations that is
 * used to derive the image at the next lower resolution level from
 * the image at the current resolution level.  That is, given an image
 * at resolution level i, the downSampler is
 * used to obtain the image at resolution level i+1.
 * The chain may contain one or more operation nodes; however, each
 * node must be a RenderedOp.  The parameter points to the
 * last node in the chain.  The very first node in the chain must be
 * a RenderedOp that takes one RenderedImage
 * as its source.  All other nodes may have multiple sources.  When
 * traversing back up the chain, if a node has more than one source,
 * the first source, source0, is used to move up the
 * chain.  This parameter is saved by reference.
 *
 * @see ImagePyramid
 *
 */
public class ImageMIPMap implements ImageJAI {

    /** The image with the highest resolution. */
    protected RenderedImage highestImage;

    /** The image at the current resolution level. */
    protected RenderedImage currentImage;

    /** The current resolution level. */
    protected int currentLevel = 0;

    /** The operation chain used to derive the lower resolution images. */
    protected RenderedOp downSampler;

    /**
     * A helper object to manage firing events.
     *
     * @since JAI 1.1
     */
    protected PropertyChangeSupportJAI eventManager = null;

    /**
     * A helper object to manage the image properties.
     *
     * @since JAI 1.1
     */
    protected WritablePropertySourceImpl properties = null;

    /** The default constructor. */
    protected ImageMIPMap() {
        eventManager = new PropertyChangeSupportJAI(this);
        properties = new WritablePropertySourceImpl(null, null, eventManager);
    }

    /**
     * Constructor.  The down sampler is an "affine" operation that
     * uses the supplied AffineTransform and
     * Interpolation objects.
     * All input parameters are saved by reference.
     *
     * @param image  The image with the highest resolution.
     * @param transform  An affine matrix used with an "affine" operation
     *        to derive the lower resolution images.
     * @param interpolation  The interpolation method for the "affine"
     *        operation.  It may be null, in which case the
     *        default "nearest neighbor" interpolation method is used.
     *
     * @throws IllegalArgumentException if image is
     *         null.
     * @throws IllegalArgumentException if transform is
     *         null.
     */
    public ImageMIPMap(RenderedImage image,
                       AffineTransform transform,
                       Interpolation interpolation) {
        this();

        if ( image == null || transform == null ) {
            throw new IllegalArgumentException(JaiI18N.getString("Generic0"));
        }

        ParameterBlock pb = new ParameterBlock();
        pb.addSource(image);
        pb.add(transform);
        pb.add(interpolation);

        downSampler = JAI.create("affine", pb);
        downSampler.removeSources();

        highestImage = image;
        currentImage = highestImage;
    }

    /**
     * Constructor.  The downSampler points to the last
     * operation node in the RenderedOp chain.  The very
     * first operation in the chain must not have any source images
     * specified; that is, its number of sources must be 0.  All input
     * parameters are saved by reference.
     *
     * @param image  The image with the highest resolution.
     * @param downSampler  The operation chain used to derive the lower
     *        resolution images.  No validation is done on the first
     *        operation in the chain.
     *
     * @throws IllegalArgumentException if image is null.
     * @throws IllegalArgumentException if downSampler is
     *         null.
     */
    public ImageMIPMap(RenderedImage image,
                       RenderedOp downSampler) {
        this();
        if (image == null || downSampler == null) {
            throw new IllegalArgumentException(JaiI18N.getString("Generic0"));
        }

        highestImage = image;
        currentImage = highestImage;
        this.downSampler = downSampler;
    }

    /**
     * Constructs a new ImageMIPMap from a
     * RenderedOp chain.  The downSampler
     * points to the last operation node in the
     * RenderedOp chain.  The source image is determined
     * by traversing up the chain: starting at the bottom node, given by
     * the downSample parameter, we move to the first
     * source of the node and repeat until we find either a sourceless
     * RenderedOp or any other type of
     * RenderedImage.
     *
     * The downSampler parameter is saved by reference
     * and should not be modified during the lifetime of any
     * ImageMIPMap referring to it.
     *
     * @param downSampler  The operation chain used to derive the lower
     *        resolution images.  The source of the first node in this
     *        chain is taken as the image with the highest resolution.
     *
     * @throws IllegalArgumentException if downSampler is
     *         null.
     * @throws IllegalArgumentException if downSampler
     *         has no sources.
     * @throws IllegalArgumentException if an object other than a
     *         RenderedImage is found in the
     *         downSampler chain.
     */
    public ImageMIPMap(RenderedOp downSampler) {
        this();

        if ( downSampler == null ) {
            throw new IllegalArgumentException(JaiI18N.getString("Generic0"));
        }

        if (downSampler.getNumSources() == 0) {
            throw new IllegalArgumentException(
                      JaiI18N.getString("ImageMIPMap0"));
        }

        // Find the highest resolution image from the chain.
        RenderedOp op = downSampler;
        while (true) {
            Object src = op.getNodeSource(0);

            if (src instanceof RenderedOp) {
                RenderedOp srcOp = (RenderedOp)src;

                if (srcOp.getNumSources() == 0) {
                    highestImage = srcOp;
                    op.removeSources();
                    break;
                } else {
                    op = srcOp;
                }
            } else if (src instanceof RenderedImage) {
                highestImage = (RenderedImage)src;
                op.removeSources();
                break;
            } else {
                throw new IllegalArgumentException(
                          JaiI18N.getString("ImageMIPMap1"));
            }
        }

        currentImage = highestImage;
        this.downSampler = downSampler;
    }

    /**
     * Returns an array of Strings recognized as names by
     * this property source.  If no property names match,
     * null will be returned.
     *
     *
 The default implementation returns null, i.e.,
     * no property names are recognized.
     *
     * @return An array of Strings giving the valid
     *         property names.
     */
    public String[] getPropertyNames() {
        return properties.getPropertyNames();
    }

    /**
     * Returns an array of Strings recognized as names by
     * this property source that begin with the supplied prefix.  If
     * no property names are recognized, or no property names match,
     * null will be returned.
     * The comparison is done in a case-independent manner.
     *
     * @return An array of Strings giving the valid
     *         property names.
     *
     * @param prefix the supplied prefix for the property source.
     *
     * @throws IllegalArgumentException if prefix is
     *                                  null.
     */
    public String[] getPropertyNames(String prefix) {
        return properties.getPropertyNames(prefix);
    }

    /**
     * Returns the class expected to be returned by a request for
     * the property with the specified name.  If this information
     * is unavailable, null will be returned.
     *
     * @return The Class expected to be return by a
     *         request for the value of this property or null.
     *
     * @exception IllegalArgumentException if name
     *                                     is null.
     *
     * @since JAI 1.1
     */
    public Class getPropertyClass(String name) {
        return properties.getPropertyClass(name);
    }

    /**
     * Returns the specified property.  The default implementation
     * returns java.awt.Image.UndefinedProperty.
     *
     * @param name  The name of the property.
     *
     * @return The value of the property, as an Object.
     *
     * @exception IllegalArgumentException if name
     *                                     is null.
     */
    public Object getProperty(String name) {
        return properties.getProperty(name);
    }

    /**
     * Sets a property on a ImageMIPMap.
     *
     * @param name a String containing the property's name.
     * @param value the property, as a general Object.
     *
     * @throws IllegalArgumentException  If name or
     *         value is null.
     *
     * @since JAI 1.1
     */
    public void setProperty(String name, Object value) {
        properties.setProperty(name, value);
    }

    /**
     * Removes the named property from the ImageMIPMap.
     *
     * @exception IllegalArgumentException if name
     *                                     is null.
     *
     * @since JAI 1.1
     */
    public void removeProperty(String name) {
        properties.removeProperty(name);
    }

    /**
     * Add a PropertyChangeListener to the listener list. The
     * listener is registered for all properties.
     *
     * @since JAI 1.1
     */
    public void addPropertyChangeListener(PropertyChangeListener listener) {
        eventManager.addPropertyChangeListener(listener);
    }

    /**
     * Add a PropertyChangeListener for a specific property. The
     * listener will be invoked only when a call on
     * firePropertyChange names that specific property.  The case of
     * the name is ignored.
     *
     * @since JAI 1.1
     */
    public void addPropertyChangeListener(String propertyName,
                                          PropertyChangeListener listener) {
        eventManager.addPropertyChangeListener(propertyName, listener);
    }

    /**
     * Remove a PropertyChangeListener from the listener list. This
     * removes a PropertyChangeListener that was registered for all
     * properties.
     *
     * @since JAI 1.1
     */
    public void removePropertyChangeListener(PropertyChangeListener listener) {
        eventManager.removePropertyChangeListener(listener);
    }

    /**
     * Remove a PropertyChangeListener for a specific property.  The case
     * of the name is ignored.
     *
     * @since JAI 1.1
     */
    public void removePropertyChangeListener(String propertyName,
                                             PropertyChangeListener listener) {
        eventManager.removePropertyChangeListener(propertyName, listener);
    }

    /**
     * Returns the current resolution level.  The highest resolution
     * level is defined as level 0.
     */
    public int getCurrentLevel() {
        return currentLevel;
    }

    /** Returns the image at the current resolution level. */
    public RenderedImage getCurrentImage() {
        return currentImage;
    }

    /**
     * Returns the image at the specified resolution level.  The
     * requested level must be greater than or equal to 0 or
     * null will be returned.
     *
     * @param level The specified level of resolution
     */
    public RenderedImage getImage(int level) {
        if (level < 0) {
            return null;
        }

        if (level < currentLevel) {	// restart from the highest image
            currentImage = highestImage;
            currentLevel = 0;
        }

        while (currentLevel < level) {
            getDownImage();
        }
        return currentImage;
    }

    /**
     * Returns the image at the next lower resolution level,
     * obtained by applying the downSampler on the
     * image at the current resolution level.
     */
    public RenderedImage getDownImage() {
        currentLevel++;

        /* Duplicate the downSampler op chain. */
        RenderedOp op = duplicate(downSampler, vectorize(currentImage));
        currentImage = op.getRendering();
        return currentImage;
    }

    /**
     * Duplicates a RenderedOp chain.  Each node in the
     * chain must be a RenderedOp.  The op
     * parameter points to the last RenderedOp in the chain.
     * The very first op in the chain must have no sources and its source
     * will be set to the supplied image vector.  When traversing up the
     * chain, if any node has more than one source, the first source will
     * be used.  The first source of each node is duplicated; all other
     * sources are copied by reference.
     *
     * @param op RenderedOp chain
     * @param vector of source images
     *
     * @throws IllegalArgumentException if op is null.
     * @throws IllegalArgumentException if images is null.
     */
    protected RenderedOp duplicate(RenderedOp op,
                                   Vector images) {
        if (images == null) {
            throw new IllegalArgumentException(JaiI18N.getString("Generic0"));
        }

        //
        // Duplicates a RenderedOp with the original OperationRegistry,
        // OperationName, ParameterBlock, and RenderingHints copied over
        // by reference.  No property information is copied.
        //
        op = new RenderedOp(op.getRegistry(),
                            op.getOperationName(),
                            op.getParameterBlock(),
                            op.getRenderingHints());

        ParameterBlock pb = new ParameterBlock();
        pb.setParameters(op.getParameters());

        Vector srcs = op.getSources();
        int numSrcs = srcs.size();

        if (numSrcs == 0) {	// first op in the chain
            pb.setSources(images);

        } else {		// recursively duplicate source0
            pb.addSource(duplicate((RenderedOp)srcs.elementAt(0), images));

            for (int i = 1; i < numSrcs; i++) {
                pb.addSource(srcs.elementAt(i));
            }
        }

        op.setParameterBlock(pb);
        return op;
    }

    /**
     * Returns the current image as a RenderableImage.
     * This method returns a MultiResolutionRenderableImage.
     * The numImages parameter indicates the number of
     * RenderedImages used to construct the
     * MultiResolutionRenderableImage.  Starting with the
     * current image, the images are obtained by finding the necessary
     * number of lower resolution images using the downSampler.
     * The current level and current image will not be changed.
     * If the width or height reaches 1, the downsampling will stop
     * and return the renderable image.
     *
     *
 The numImages should be greater than or equal to 1.
     * If a value of less than 1 is specified, this method uses 1 image,
     * which is the current image.
     *
     * @param numImages The number of lower resolution images.
     * @param minX The minimum X coordinate of the Renderable, as a float.
     * @param minY The minimum Y coordinate of the Renderable, as a float.
     * @param height The height of the Renderable, as a float.
     *
     * @throws IllegalArgumentException if height is less than 0.
     *
     * @see MultiResolutionRenderableImage
     */
    public RenderableImage getAsRenderable(int numImages,
                                           float minX,
                                           float minY,
                                           float height) {
        Vector v = new Vector();
        v.add(currentImage);

        RenderedImage image = currentImage;
        for (int i = 1; i < numImages; i++) {
            RenderedOp op = duplicate(downSampler, vectorize(image));
            image = op.getRendering();

            if ( image.getWidth() <= 1 || image.getHeight() <= 1 ) {
                break;
            }

            v.add(image);
        }

        return new MultiResolutionRenderableImage(v, minX, minY, height);
    }

    /**
     * Returns the current image as a RenderableImage.
     * This method returns a MultiResolutionRenderableImage
     * with the current image as the only source image, minX and minY
     * set to 0.0, and height set to 1.0.
     *
     * @see MultiResolutionRenderableImage
     */
    public RenderableImage getAsRenderable() {
        return getAsRenderable(1, 0.0F, 0.0F, 1.0F);
    }

    // XXX - see OpImage vectorize and consolidate?
    //       could be public static in PlanarImage
    /**
     * Creates and returns a Vector containing a single
     * element equal to the supplied RenderedImage.
     *
     *
     * @since JAI 1.1
     */
    protected final Vector vectorize(RenderedImage image) {
        Vector v = new Vector(1);
        v.add(image);
        return v;
    }

    /**
     * Creates and returns a Vector containing two
     * elements equal to the supplied RenderedImages
     * in the order given.
     *
     *
     * @since JAI 1.1
     */
    protected final Vector vectorize(RenderedImage im1, RenderedImage im2) {
        Vector v = new Vector(2);
        v.add(im1);
        v.add(im2);
        return v;
    }
}


text:
require "socket"

# Ruby version of the WakeOnLan command.  Originally written by K.Kodama.
class WakeOnLan
  attr :socket

  # Create a new instance. No arguments required.
  def initialize
    @socket=UDPSocket.open()
    @socket.setsockopt(Socket::SOL_SOCKET,Socket::SO_BROADCAST,1)
  end

  # Close the socket opened by WakeOnLan initialization
  def close
    @socket.close
    @socket=""
  end

  # Wake a host.
  #
  # == Options
  # * <tt>:mac => "ff:ff:ff:ff:ff:ff"</tt> - Specify the destination MAC Address. Defaults to the broadcast MAC, "ff:ff:ff:ff:ff:ff"
  # * <tt>:address => "255.255.255.255"</tt> - Specify the destination address.  Either a IP or hostname.  Defaults to "255.255.255.255"
  # * <tt>:port => 9</tt> - The destination port. Defaults to the discard port, 9
  # * <tt>:count => 1</tt> - How many time to send the MagicPacket.  Defaults to 1
  # * <tt>:interval => 0.01</tt> - How many seconds to wait between sending packets. Defaults to 0.01
  # * <tt>:verbose => false</tt> - What to return?  Returns a string summary if true, else returns <tt>:count</tt>.
  def wake(options = {})
    mac = options[:mac] ||= "ff:ff:ff:ff:ff:ff"
    address = options[:address] ||= "255.255.255.255"
    port = options[:port] ||= 9
    count = options[:count] || 1
    interval = options[:interval] || 0.01
    verbose = options[:verbose] || false

    magicpacket = (0xff.chr)*6+(mac.split(/:/).pack("H*H*H*H*H*H*"))*16

    count.times {
      @socket.send(magicpacket, 0, address, port)

      sleep interval if interval > 0 unless count == 1
    }

    if verbose
      if count == 1
        return "Sending magic packet to #{address}:#{port} with #{mac}"
      else
        return "Sending magic packet to #{address}:#{port} with #{mac} #{count} times"
      end
    else
      return count
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
define(
[
    'utils',
    'models',
    'view_mixins',
    'views/common',
    'views/dialogs',
    'text!templates/cluster/settings_tab.html',
    'text!templates/cluster/settings_group.html'
],
function(utils, models, viewMixins, commonViews, dialogViews, settingsTabTemplate, settingsGroupTemplate) {
    'use strict';
    var SettingsTab, SettingGroup;

    SettingsTab = commonViews.Tab.extend({
        template: _.template(settingsTabTemplate),
        mixins: [viewMixins.toggleablePassword],
        hasChanges: function() {
            return !_.isEqual(this.settings.toJSON().editable, this.settings.initialAttributes);
        },
        events: {
            'click .btn-apply-changes:not([disabled])': 'applyChanges',
            'click .btn-revert-changes:not([disabled])': 'revertChanges',
            'click .btn-load-defaults:not([disabled])': 'loadDefaults'
        },
        calculateButtonsState: function() {
            var hasChanges = this.hasChanges();
            this.$('.btn-revert-changes').attr('disabled', !hasChanges);
            this.$('.btn-apply-changes').attr('disabled', !hasChanges || this.settings.validationError);
            this.$('.btn-load-defaults').attr('disabled', this.isLocked());
        },
        disableControls: function() {
            this.$('.btn, input, select').attr('disabled', true);
        },
        isLocked: function() {
            return this.model.task({group: 'deployment', status: 'running'}) || !this.model.isAvailableForSettingsChanges();
        },
        applyChanges: function() {
            this.disableControls();
            return this.settings.save(null, {patch: true, wait: true})
                .done(_.bind(this.updateInitialSettings, this))
                .always(_.bind(function() {
                    this.render();
                    this.model.fetch();
                }, this))
                .fail(_.bind(function() {
                    this.calculateButtonsState();
                    utils.showErrorDialog({
                        title: $.t('cluster_page.settings_tab.settings_error.title'),
                        message: $.t('cluster_page.settings_tab.settings_error.saving_warning')
                    });
                }, this));
        },
        revertChanges: function() {
            this.loadInitialSettings();
        },
        beforeTearDown: function() {
            this.loadInitialSettings();
        },
        loadDefaults: function() {
            this.disableControls();
            this.settings.fetch({url: _.result(this.settings, 'url') + '/defaults'})
                .fail(function() {
                    utils.showErrorDialog({
                        title: $.t('cluster_page.settings_tab.settings_error.title'),
                        message: $.t('cluster_page.settings_tab.settings_error.load_defaults_warning')
                    });
                })
                .always(_.bind(this.render, this));
        },
        updateInitialSettings: function() {
            this.settings.initialAttributes = this.settings.toJSON().editable;
        },
        loadInitialSettings: function() {
            this.settings.set(_.cloneDeep(this.settings.initialAttributes));
            this.updateSettings();
        },
        onSettingChange: function() {
            this.$('input.error').removeClass('error');
            this.$('.parameter-description').removeClass('hide');
            this.$('.validation-error').addClass('hide');
            this.settings.isValid();
            this.calculateButtonsState();
        },
        composeBindings: function() {
            var bindings = {};
            _.each(this.settings.attributes, function(group, groupName) {
                if (group.metadata.toggleable) {
                    bindings['input[name="' + groupName + '.enabled' + '"]'] = {
                        observe: groupName + '.metadata.enabled',
                        attributes: [{
                            name: 'disabled',
                            observe: groupName + '.metadata.disabled',
                            onGet: _.bind(function(value) {
                                return value || this.isLocked();
                            }, this)
                        }]
                    };
                }
                bindings['div[data-settings-group="' + groupName + '"]'] = {
                    observe: groupName + '.metadata.visible',
                    visible: true,
                    visibleFn: function($el, isVisible) {
                        $el.parents('.fieldset-group').toggle(isVisible);
                    }
                };
                var isGroupDisabled = _.bind(function(groupName) {
                    var groupData = this.settings.get(groupName + '.metadata');
                    if (groupData.enabled && (groupData.hasDependentRole || this.checkDependentSettings(groupName, 'metadata'))) {
                       return false;
                    }
                    return groupData.enabled === false || groupData.disabled;
                }, this);
                _.each(group, function(setting, settingName) {
                    if (settingName == 'metadata') {return;}
                    var settingPath = groupName + '.' + settingName;
                    bindings['[name="' + settingPath + '"]'] = {
                        observe: [settingPath + '.value', settingPath + '.visible'],
                        onGet: function(value) {
                            return value[0];
                        },
                        onSet: function(value) {
                            return [value, setting.visible];
                        },
                        visible: function() {
                            return setting.visible;
                        },
                        visibleFn: function($el, isVisible) {
                            $el.parents('.setting-container').toggleClass('hide', !isVisible);
                        },
                        attributes: [{
                            name: 'disabled',
                            observe: [groupName + '.metadata.*', settingPath + '.disabled'],
                            onGet: _.bind(function(value) {
                                var isSettingDisabled = value[1];
                                return this.isLocked() || isGroupDisabled(groupName) || isSettingDisabled;
                            }, this)
                        }]
                    };
                    _.each(setting.values, function(option, index) {
                        bindings['input[name="' + settingPath + '"][value="' + option.data + '"]'] = {
                            observe: [settingPath + '.visible', settingPath + '.values'],
                            onGet: function(value) {
                                return value[1];
                            },
                            visible: function(value) {
                                return setting.visible && value[index].visible;
                            },
                            visibleFn: function($el, isVisible) {
                                $el.parents('.parameter-box:first').toggleClass('hide', !isVisible);
                            },
                            attributes: [{
                                name: 'disabled',
                                observe: [groupName + '.metadata.*', settingPath + '.disabled', settingPath + '.values'],
                                onGet: _.bind(function(value) {
                                    var isSettingDisabled = value[1];
                                    var values = value[2];
                                    return this.isLocked() || isGroupDisabled(groupName) || isSettingDisabled || values[index].disabled;
                                }, this)
                            }]
                        };
                    }, this);
                }, this);
            }, this);
            this.stickit(this.settings, bindings);
        },
        getValueAttribute: function(settingName) {
            return settingName == 'metadata' ? 'enabled' : 'value';
        },
        checkDependentSettings: function(groupName, settingName) {
            var unsupportedTypes = ['text', 'password'];
            var settingPath = groupName + '.' + settingName;
            var processedSetting = this.settings.get(settingPath);
            var valueAttribute = this.getValueAttribute(settingName);
            var notToggleableGroup = settingName == 'metadata' && !processedSetting.toggleable;
            if (notToggleableGroup || _.contains(unsupportedTypes, this.settings.get(settingPath).type)) {
                return false;
            }
            var isDependent = function(restriction) {
                return restriction.action == 'disable' && _.contains(restriction.condition, 'settings:' + settingPath);
            };
            // collect restrictions to check
            var restrictions = [];
            _.each(this.settings.attributes, function(group, groupName) {
                // FIXME(ja): invisible dependent settings and options should not be checked also
                if (this.checkRestrictions(group.metadata, 'hide')) { return; }
                _.each(group, function(setting, settingName) {
                    if (_.contains(unsupportedTypes, setting.type) || groupName + '.' + settingName == settingPath) { return; }
                    if (setting[this.getValueAttribute(settingName)] == true) { // for checkboxes and toggleable setting groups
                        restrictions.push(_.find(setting.restrictions, isDependent));
                    } else {
                        var activeOption = _.find(setting.values, {data: setting.value}); // for dropdowns and radio groups
                        if (activeOption) {
                            restrictions.push(_.find(activeOption.restrictions, isDependent));
                        }
                    }
                }, this);
            }, this);
            restrictions = _.compact(restrictions);
            if (restrictions.length) {
                var processedValues = _.without(_.pluck(processedSetting.values, 'data'), processedSetting[valueAttribute]) || [!processedSetting[valueAttribute]];
                var configModels = _.extend({}, this.configModels, {settings: new models.Settings(this.settings.toJSON().editable)});
                return _.any(restrictions, function(restriction) {
                    var suitableValues = _.filter(processedValues, function(value) {
                        configModels.settings.get(settingPath)[valueAttribute] = value;
                        return !utils.evaluateExpression(restriction.condition, configModels).value;
                    });
                    return !suitableValues.length;
                });
            }
            return false;
        },
        checkRestrictions: function(setting, action) {
            return _.any(_.where(setting.restrictions, {action: action}), function(restriction) {
                return utils.evaluateExpression(restriction.condition, this.configModels).value;
            }, this);
        },
        calculateSettingState: function(groupName, settingName) {
            var settingPath = groupName + '.' + settingName;
            var setting = this.settings.get(settingPath);
            this.settings.set(settingPath + '.disabled', setting.hasDependentRole || this.checkRestrictions(setting, 'disable') || this.checkDependentSettings(groupName, settingName));
            this.settings.set(settingPath + '.visible', !this.checkRestrictions(setting, 'hide'));
            _.each(setting.values, function(value, index) {
                var values = _.cloneDeep(setting.values);
                values[index].disabled = this.checkRestrictions(values[index], 'disable');
                values[index].visible = !this.checkRestrictions(values[index], 'hide');
                this.settings.set(settingPath + '.values', values);
            }, this);
        },
        composeListeners: function(groupName, settingName) {
            var settingPath = groupName + '.' + settingName;
            var callback = _.bind(this.calculateSettingState, this, groupName, settingName);
            var collectRestrictions = function(setting) {
                return _.compact(_.flatten(_.union(setting.restrictions, _.pluck(setting.values, 'restrictions'))));
            };
            _.each(collectRestrictions(this.settings.get(settingPath)), function(restriction) {
                var evaluatedRestriction = utils.evaluateExpression(restriction.condition, this.configModels);
                _.invoke(evaluatedRestriction.modelPaths, 'change', callback);
            }, this);
            // handle dependent settings
            _.each(this.settings.attributes, function(group, groupName) {
                _.each(group, function(setting, settingName) {
                    if (groupName + '.' + settingName == settingPath) { return; }
                    var isDependent = function(restriction) {
                        return _.contains(restriction.condition, 'settings:' + settingPath);
                    };
                    if (_.any(collectRestrictions(setting), isDependent)) {
                        this.settings.on('change:' + groupName + '.' + settingName + '.' + this.getValueAttribute(settingName), callback);
                    }
                }, this);
            }, this);
        },
        checkDependentRoles: function(groupName, settingName) {
            var settingPath = groupName + '.' + settingName;
            var rolesData = this.model.get('release').get('roles_metadata');
            this.settings.get(settingPath).hasDependentRole = _.any(this.model.get('release').get('roles'), function(role) {
                var roleDependencies = _.map(rolesData[role].depends, utils.expandRestriction);
                var hasSatisfiedDependencies = _.any(roleDependencies, function(dependency) {
                    var evaluatedDependency = utils.evaluateExpression(dependency.condition, this.configModels);
                    return _.contains(dependency.condition, 'settings:' + settingPath) && evaluatedDependency.value;
                }, this);
                var assignedNodes = this.model.get('nodes').filter(function(node) { return node.hasRole(role); });
                return hasSatisfiedDependencies && assignedNodes.length;
            }, this);
        },
        renderSettingGroup: function(groupName) {
            var settings = this.settings.get(groupName);
            var settingGroupView = new SettingGroup({
                settings: settings,
                groupName: groupName,
                locked: this.isLocked()
            });
            this.registerSubView(settingGroupView);
            this.$('.settings').append(settingGroupView.render().el);
        },
        render: function() {
            this.tearDownRegisteredSubViews();
            this.$el.html(this.template({
                loading: this.loading,
                locked: this.isLocked()
            })).i18n();
            if (this.loading.state() != 'pending') {
                this.$('.settings').html('');
                var sortedSettings = _.sortBy(_.keys(this.settings.attributes), _.bind(function(setting) {
                    return this.settings.get(setting + '.metadata.weight');
                }, this));
                _.each(sortedSettings, this.renderSettingGroup, this);
                this.composeBindings();
                this.onSettingChange();
            }
            return this;
        },
        updateSettings: function() {
            this.settings.expandRestrictions();
             _.each(this.settings.attributes, function(group, groupName) {
                _.each(group, function(setting, settingName) {
                    this.calculateSettingState(groupName, settingName);
                }, this);
            }, this);
        },
        initialize: function(options) {
            this.model.on('change:status', this.render, this);
            this.model.get('tasks').bindToView(this, [{group: 'deployment'}], function(task) {
                task.on('change:status', this.render, this);
            });
            this.settings = this.model.get('settings');
            this.settings.on('invalid', function(model, errors) {
                _.each(errors, function(error) {
                    var input = this.$('input[name="' + error.field + '"]');
                    input.addClass('error');
                    input.parent().siblings('.description').addClass('hide');
                    input.parent().siblings('.validation-error').text(error.message).removeClass('hide');
                }, this);
            }, this);
            (this.loading = $.when(this.settings.fetch({cache: true}), this.model.get('networkConfiguration').fetch({cache: true}))).done(_.bind(function() {
                this.updateInitialSettings();
                this.configModels = {
                    cluster: this.model,
                    settings: this.settings,
                    networking_parameters: this.model.get('networkConfiguration').get('networking_parameters'),
                    version: app.version,
                    default: this.settings
                };
                this.settings.expandRestrictions();
                _.each(this.settings.attributes, function(group, groupName) {
                    _.each(group, function(setting, settingName) {
                        this.composeListeners(groupName, settingName);
                        this.checkDependentRoles(groupName, settingName);
                        this.calculateSettingState(groupName, settingName);
                    }, this);
                }, this);
                this.settings.on('change', this.onSettingChange, this);
                this.settings.on('sync', this.updateSettings, this);
            }, this));
            if (this.loading.state() == 'pending') {
                this.loading.done(_.bind(this.render, this));
            }
        }
    });

    SettingGroup = Backbone.View.extend({
        template: _.template(settingsGroupTemplate),
        className: 'fieldset-group wrapper',
        render: function() {
            this.$el.html(this.template(this.options)).i18n();
            return this;
        }
    });

    return SettingsTab;
});


text:
package httpHandlers

import (
	"fmt"
	"net/http"
	"web_apps/news_aggregator/modules/database"
	"web_apps/news_aggregator/modules/utils"
)

// SuggestRand suggest rand data
func SuggestRand(w http.ResponseWriter, r *http.Request) {
	utils.Info(fmt.Sprintf("suggest rand handled!"))

	news, err := database.SuggestRand()
	if err != nil {
		return
	}

	// send to json response
	respondToJSON(w, news)
}


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Mycopath. Mycol. appl. 37: 270 (1969)

#### Original name
Hamaspora sinica var. trisepta Monoson, 1969

### Remarks
null


text:
package com.dreamerpartner.codereview.convert;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.collections.CollectionUtils;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;

import com.dreamerpartner.codereview.model.NoticeModel;
import com.dreamerpartner.codereview.util.DateUtil;

public class NoticeModelConvert implements LuceneModelConvert<NoticeModel>{

	@Override
	public List<NoticeModel> converts(List<Document> docs) {
		if(CollectionUtils.isEmpty(docs))
			return null;
		List<NoticeModel> result = new ArrayList<NoticeModel>(docs.size());
		for (Document doc : docs) {
			result.add(convert(doc, true));
		}
		return result;
	}

	@Override
	public NoticeModel convert(Document doc, boolean isList) {
		NoticeModel model = new NoticeModel();
		model.setId(doc.get("id"));
		model.setTitle(doc.get("title"));
		if(!isList)
			model.setContent(doc.get("content"));
		model.setType(doc.get("type"));
		model.setGroupKey(doc.get("groupKey"));
		model.setCreateBy(doc.get("createBy"));
		model.setCreateTime(DateUtil.parseZHDateStr(doc.get("createTime")));
		return model;
	}

	@Override
	public Document convert(NoticeModel model) {
		Document doc = new Document();
		doc.add(new StringField("id", model.getId(), Field.Store.YES));
		doc.add(new StringField("title", model.getTitle(), Field.Store.YES));
		doc.add(new TextField("content", model.getContent(), Field.Store.YES));
		doc.add(new StringField("type", model.getType(), Field.Store.YES));
		doc.add(new StringField("groupKey", model.getGroupKey(), Field.Store.YES));
		doc.add(new StringField("createBy", model.getCreateBy(), Field.Store.YES));
		doc.add(new StringField("createTime", model.getCreateTime(), Field.Store.YES));
		return doc;
	}

}


text:
package com.gopivotal.manager;

import org.apache.catalina.LifecycleException;
import org.apache.catalina.LifecycleState;

interface LifecycleStateMachine {

    /**
     * Returns the current {@link LifecycleState}
     *
     * @return the current {@link LifecycleState}
     */
    LifecycleState getLifecycleState();

    /**
     * Whether a transition from the current {@link LifecycleState} to a new {@link LifecycleState} is meaningful.
     * That is, should it have any effect.
     *
     * @param lifecycleState the new {@link LifecycleState}
     * @return {@code true} if the transition is meaningful, {@code false} otherwise
     */
    boolean isMeaningfulTransition(LifecycleState lifecycleState);

    /**
     * Transition from the current {@link LifecycleState} to a new {@link LifecycleState}.
     *
     * @param lifecycleState the new {@link LifecycleState}
     * @throws LifecycleException if the transition is not legal
     */
    void transition(LifecycleState lifecycleState) throws LifecycleException;

}


text:
namespace Problem_3.Range_Exceptions
{
    using System;

    public class RangeExceptionMain
    {
        static void Main()
        {
            try
            {
                int number = 300;
                if(number < 1 || number > 100)
                {
                    throw new InvalidRangeException<int>("INvalid input", 1, 100);
                }
            }

            catch(InvalidRangeException<int> ex)
            {
                Console.WriteLine(ex.Message);
            }

            try
            {
                DateTime date = new DateTime(1993, 10, 23);
                if (date < new DateTime(1995, 05, 01) || date > new DateTime(1997, 04, 12))
                {
                    throw new InvalidRangeException<DateTime>("Invalid date", new DateTime(1995, 05, 01),
                        new DateTime(1997, 04, 12));
                }
            }
            catch(InvalidRangeException<DateTime> ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    }
}


text:
'use strict';
var path = require('path');

// Attempt to load the bindings module from various possible locations
function load_extension() {
    var ext_dirs = [
        'build/bindings', 'build/Release', 'out/Release', 'Release',
        'build/Debug', 'out/Debug',
    ], i;
    for (i in ext_dirs) {
        try {
            return require(path.join(__dirname, '../..', ext_dirs[i],
                                      'posix.node'));

        } catch (error) {
            if (!/Cannot find module/.test(error.message)) {
                throw error;
            }
        }
    }
    throw "unable to load the node-posix extension module";
}

var posix = load_extension();

var syslog_constants = {};
posix.update_syslog_constants(syslog_constants);

function syslog_const(value) {
    if (syslog_constants[value] === undefined) {
        throw "invalid syslog constant value: " + value;
    }

    return syslog_constants[value];
}

function syslog_flags(option, prefix) {
    prefix = prefix || "";
    var opt = 0, key, flag;
    for (key in option) {
        flag = syslog_const(prefix + key); // checks all flags
        opt |= option[key] ? flag : 0;
    }
    return opt;
}

module.exports = {
    getgid: process.getgid,
    getuid: process.getuid,
    setgid: process.setgid,
    setuid: process.setuid,

    chroot: posix.chroot,
    closelog: posix.closelog,
    getegid: posix.getegid,
    geteuid: posix.geteuid,
    getgrnam: posix.getgrnam,
    getpgid: posix.getpgid,
    getppid: posix.getppid,
    getpwnam: posix.getpwnam,
    getrlimit: posix.getrlimit,
    setrlimit: posix.setrlimit,
    setsid: posix.setsid,

    openlog: function (ident, option, facility) {
        return posix.openlog(ident, syslog_flags(option),
                             syslog_const(facility));
    },

    syslog: function (priority, message) {
        return posix.syslog(syslog_const(priority), message);
    },

    setlogmask: function (maskpri) {
        var bits = posix.setlogmask(syslog_flags(maskpri, "mask_")), flags = {}, key;
        for (key in syslog_constants) {
            if (key.match("^mask_")) {
                flags[key.substr(5, 10)] = (bits & syslog_constants[key])
                    ? true : false;
            }
        }
        return flags;
    },

    // http://pubs.opengroup.org/onlinepubs/007904875/functions/getpgrp.html
    getpgrp: function () {
        return posix.getpgid(0);
    },

    seteuid: function (euid) {
        euid = (typeof (euid) === 'string') ? posix.getpwnam(euid).uid : euid;
        return posix.seteuid(euid);
    },

    setreuid: function (ruid, euid) {
        ruid = (typeof (ruid) === 'string') ? posix.getpwnam(ruid).uid : ruid;
        euid = (typeof (euid) === 'string') ? posix.getpwnam(euid).uid : euid;
        return posix.setreuid(ruid, euid);
    },

    setegid: function (egid) {
        egid = (typeof (egid) === 'string') ? posix.getgrnam(egid).gid : egid;
        return posix.setegid(egid);
    },

    setregid: function (rgid, egid) {
        rgid = (typeof (rgid) === 'string') ? posix.getgrnam(rgid).gid : rgid;
        egid = (typeof (egid) === 'string') ? posix.getgrnam(egid).gid : egid;
        return posix.setregid(rgid, egid);
    },

    gethostname: posix.gethostname,
    sethostname: posix.sethostname,
};

if ('initgroups' in posix) {
    // initgroups is in SVr4 and 4.3BSD, not POSIX
    module.exports.initgroups = function (user, group) {
        var gid = (typeof (group) === 'string') ? posix.getgrnam(group).gid : group;
        return posix.initgroups(user, gid);
    }
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:batch="http://www.springframework.org/schema/batch"
	xmlns:util="http://www.springframework.org/schema/util"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-3.0.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.1.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.1.xsd">

	<description>Job that reads a set of files, stores them in a db and creates a miabis tab file</description>

	<import resource="classpath*:**/job-csv-db-config.xml" />

	<context:property-placeholder location="classpath*:**/database.properties" />

 	<batch:job id="job1">

		<batch:step id="step1" next="step2">
			<batch:tasklet transaction-manager="transactionManager" start-limit="100" >
				<batch:chunk reader="contactInfoReader" writer="contactInfoWriter" commit-interval="100" />
			</batch:tasklet>
		</batch:step>

		<batch:step id="step2" next="step3">
			<batch:tasklet transaction-manager="transactionManager" start-limit="100" >
				<batch:chunk reader="biobankReader" writer="biobankWriter" commit-interval="100" />
			</batch:tasklet>
		</batch:step>

		<batch:step id="step3" next="step4">
			<batch:tasklet transaction-manager="transactionManager" start-limit="100" >
				<batch:chunk reader="sampleCollectionReader" writer="sampleCollectionWriter" commit-interval="100" />
			</batch:tasklet>
		</batch:step>

		<batch:step id="step4" next="step5">
			<batch:tasklet transaction-manager="transactionManager" start-limit="100" >
				<batch:chunk reader="studyReader" writer="studyWriter" commit-interval="100" />
			</batch:tasklet>
		</batch:step>

		<batch:step id="step5" next="step6">
			<batch:tasklet transaction-manager="transactionManager" start-limit="100" >
				<batch:chunk reader="sampleReader" writer="sampleWriter" commit-interval="100" />
			</batch:tasklet>
		</batch:step>

		<batch:step id="step6">
			<batch:tasklet transaction-manager="transactionManager" start-limit="100" >
				<batch:chunk reader="jdbcCursorItemReader" writer="tabFileItemWriter" commit-interval="100" />
			</batch:tasklet>
		</batch:step>

	</batch:job>
</beans>


text:
#include "config.h"
#include "WKView.h"

#include "WKAPICast.h"
#include "WKViewPrivate.h"
#include "WebKitWebViewBasePrivate.h"

using namespace WebKit;
using namespace WebCore;

WKViewRef WKViewCreate(WKContextRef contextRef, WKPageGroupRef pageGroupRef)
{
    return toAPI(webkitWebViewBaseCreate(toImpl(contextRef), toImpl(pageGroupRef)));
}

WKPageRef WKViewGetPage(WKViewRef viewRef)
{
    return toAPI(webkitWebViewBaseGetPage(toImpl(viewRef)));
}

void WKViewSetFocus(WKViewRef viewRef, bool focused)
{
    webkitWebViewBaseSetFocus(toImpl(viewRef), focused);
}


text:
#import "APPEmailComposer.h"
#import "APPEmailComposerImpl.h"
#import "Cordova/NSData+Base64.h"
#import "Cordova/CDVAvailability.h"
#import <MobileCoreServices/MobileCoreServices.h>

#include "TargetConditionals.h"

@interface APPEmailComposer ()

@property (nonatomic, retain) CDVInvokedUrlCommand* command;

/**
 * Implements the plugin functionality.
 */
@property (nonatomic, retain) APPEmailComposerImpl* impl;

@end

@implementation APPEmailComposer

#pragma mark -
#pragma mark Lifecycle

- (void)pluginInitialize
{
    _impl = [[APPEmailComposerImpl alloc] init];
}

#pragma mark -
#pragma mark Public

/**
 * Checks if the mail composer is able to send mails.
 *
 * @param callbackId
 *      The ID of the JS function to be called with the result
 */
- (void) isAvailable:(CDVInvokedUrlCommand*)command
{
    [self.commandDelegate runInBackground:^{
        NSString* scheme = command.arguments[0];
        NSArray* boolArray = [_impl canSendMail:scheme];
        CDVPluginResult* result;

        result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK
                                     messageAsMultipart:boolArray];

        [self.commandDelegate sendPluginResult:result
                                    callbackId:command.callbackId];
    }];
}

/**
 * Shows the email composer view with pre-filled data.
 *
 * @param properties
 *      The email properties like subject, body, attachments
 */
- (void) open:(CDVInvokedUrlCommand*)command
{
    NSDictionary* props = command.arguments[0];

    _command = command;

    [self.commandDelegate runInBackground:^{
        NSString* scheme = [props objectForKey:@"app"];

        if (![_impl canSendMail:scheme]) {
            NSLog(@"Dont know how to handle %@. Using iMail instead.", scheme);
            scheme = @"mailto:";
        }

        // iMail
        if ([self canUseAppleMail:scheme])
        {
            if (TARGET_IPHONE_SIMULATOR && !IsAtLeastiOSVersion(@"8.3"))
            {
                [self informAboutIssueWithSimulators];
                [self execCallback: NO];
                return;
            }
            else
            {
                [self presentMailComposerFromProperties:props];
            }
        }
        // URL scheme
        else
        {
            [self openURLFromProperties:props];
        }
    }];
}

#pragma mark -
#pragma mark MFMailComposeViewControllerDelegate

/**
 * Delegate will be called after the mail composer did finish an action
 * to dismiss the view.
 */
- (void) mailComposeController:(MFMailComposeViewController*)controller
           didFinishWithResult:(MFMailComposeResult)result
                         error:(NSError*)error
{
    [controller dismissViewControllerAnimated:YES completion:nil];

    [self execCallback: result == MFMailComposeResultSent];
}

#pragma mark -
#pragma mark Private

/**
 * Displays the email draft.
 *
 * @param draft
 *      The email composer view
 */
- (void) presentMailComposerFromProperties:(NSDictionary*)props
{
    MFMailComposeViewController* draft =
    [_impl mailComposerFromProperties:props delegateTo:self];

    [self.viewController presentViewController:draft
                                      animated:YES
                                    completion:NULL];
}

/**
 * Instructs the application to open the specified URL.
 *
 * @param url
 * A mailto: compatible URL.
 */
- (void) openURLFromProperties:(NSDictionary*)props
{
    NSURL* url = [_impl urlFromProperties:props];

    [[UIApplication sharedApplication] openURL:url];
}

/**
 * If the specified app if the buil-in iMail framework can be used.
 *
 * @param scheme
 * An URL scheme.
 * @return
 * true if the scheme does refer to the email: scheme.
 */
- (BOOL) canUseAppleMail:(NSString*) scheme
{
    return [scheme hasPrefix:@"mailto"];
}

/**
 * Presents a dialog to the user to inform him about an issue with the iOS8
 * simulator in combination with the mail library.
 */
- (void) informAboutIssueWithSimulators
{
    [[[UIAlertView alloc] initWithTitle:@"Email-Composer Plug-in"
                               message:@"Plug-in cannot run on the iOS8 Simulator.\nPlease downgrade or use a physical device."
                              delegate:nil
                     cancelButtonTitle:@"OK"
                     otherButtonTitles:nil] show];
}

/**
 * Invokes the callback without any parameter.
 */
- (void) execCallback:(BOOL) sent
{
    CDVPluginResult *result = [CDVPluginResult
                               resultWithStatus:CDVCommandStatus_OK messageAsBool:sent];

    [self.commandDelegate sendPluginResult:result
                                callbackId:_command.callbackId];
}

@end


text:
<!DOCTYPE html>

  <meta charset="utf-8">

  <meta name="viewport" content="width=device-width, initial-scale=1.0">

  <title>Welcome to Dynamo's documentation! — dynamo 1.3.5 documentation</title>

  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/css/custom.css" type="text/css" />
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="The Dynamo Controller Backend" href="theDynamoControllerBackEnd.html" />

             dynamo

                1.3.5

  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>

Dynamo Documentation

The Dynamo Controller Backend

The Dynamo Controller Frontend

Installation

Creating Many-to-Many Relationships Between Dynamo Models

Dynamo Methods

Deleting Categories

Relating Models To Themselves with Dynamo

License

License

          dynamo

Docs »

Welcome to Dynamo’s documentation!

             View page source

Welcome to Dynamo’s documentation!¶

When you want to use a package but it doesn't have good documentation...

What is Dynamo?¶

Dynamo is a package you can use in your existing Laravel application to quickly build admins using real database tables. You may be familiar with php artisan
which allows you to create models, views, and controllers, and migration files with some scaffolding.

Dynamo does this, as well as generating the bootstrap index view and forms for creating the models. For an example,
see the screenshots below showing a form on the backend of the website for the administrator to use to create Faqs.

This ^ is the index view of a module that shows a table of all the FAQs in the database.

This ^ is the form view of a module that shows the form that the website administrator uses to create a new FAQ or update an existing FAQ.

The Dynamo Artisan Command¶

Dynamo allows you to create a complete controller, model, migration, and route for your backend admin module with one command:

php artisan make:dynamo Employee

After running this you will notice an autogenerated route in your routes->web.php file. You will notice a new database migration
has been created in your database->migrations directory. You will notice a new model made in your app directory.
You will notice a new Dynamo Controller in your controller directory. By default the controller directory is set in your dynamo config file in config->dynamo.php:

'controller_namespace' => 'App\Http\Controllers',

'controller_path' => app_path('/Http/Controllers'),

Need to opt out of some of the Dynamo magic?

php artisan make:dynamo Employee --migration=no --model=no --controller=no --route=no

I recommend starting out with the quick-start video below to see what Dynamo is capable of doing and seeing if it is right for you.
If you see that it is right for you, you can install Dynamo by running:

composer require jzpeepz/dynamo

Quick-Start Video¶

Dynamo Documentation

The Dynamo Controller Backend

The Dynamo Controller Frontend

Installation

Creating Many-to-Many Relationships Between Dynamo Models

Dynamo Methods

Deleting Categories

Relating Models To Themselves with Dynamo

License

License

        Next

        © Copyright 2018, Jonathan Peoples, Colton Williams

  Built with Sphinx using a theme provided by Read the Docs.


text:
import collections

from PairOption import *

class RepositoryOption(PairOption):
	def __init__(self, shortname, longname, description = None,
				keyname = None, multiple = False, required = False,
				valueoptional = False, repospecifier = False):
		PairOption.__init__(self, shortname, longname,
				description = description,
				keyname = keyname,
				multiple = multiple,
				required = required,
				valueoptional = valueoptional,
				default = {})
		self.repospecifier = repospecifier

	def __parseSpecifier__(self, key, value):
		path = None
		revision = None # Default version value
		commitid = None

		if value:
			localsplit = value[1].split("@")
			refsplit = localsplit[0].split(":")
			revision = localsplit[0]

			if len(localsplit) >= 2:
				path = localsplit[1]

			if len(refsplit) >= 2:
				revision = refsplit[0]
				commitid = refsplit[1]

			if revision and len(revision) == 0:
				revision = None

		returnvalue = {}
		returnvalue["name"] = key
		returnvalue["repo"] = self.repospecifier
		returnvalue["ref"] = revision
		returnvalue["commit"] = commitid
		returnvalue["path"] = path
		return returnvalue

	def __addMatch__(self, instance, key, value):
		instance.getAsType(dict)[key] = self.__parseSpecifier__(key, value)


text:
{
    matrix_id: '1941',
    name: 'CAG_mat1916',
    group: 'JGD_CAG',
    description: 'CAG matrix set from Michael Monagan, Simon Fraser Univ., Canada',
    author: 'M. Monagan',
    editor: 'J.-G. Dumas',
    date: '2008',
    kind: 'combinatorial problem',
    problem_2D_or_3D: '0',
    num_rows: '1916',
    num_cols: '1916',
    nonzeros: '195985',
    num_explicit_zeros: '0',
    num_strongly_connected_components: '31',
    num_dmperm_blocks: '31',
    structural_full_rank: 'true',
    structural_rank: '1916',
    pattern_symmetry: '0.300',
    numeric_symmetry: '0.212',
    rb_type: 'integer',
    structure: 'unsymmetric',
    cholesky_candidate: 'no',
    positive_definite: 'no',
    notes: 'CAG matrix set from Michael Monagan, Simon Fraser Univ., Canada
From Jean-Guillaume Dumas\' Sparse Integer Matrix Collection,
http://ljk.imag.fr/membres/Jean-Guillaume.Dumas/simc.html

Strongly Connected Graph Components and Computing
Characteristic Polynomials of Integer Matrices in Maple,
Simon Lo, Michael Monagan, Allan Wittkopf
{sclo,mmonagan,wittkopf} at cecm.sfu.ca
Centre for Experimental and Constructive Mathematics,
Department of Mathematics, Simon Fraser University,
Burnaby, B.C., V5A 1S6, Canada.

abstract:
Let A be an n x n matrix of integers. We present details of our Maple
implementation of a simple modular method for computing the
characteristic polynomial of A.  We consider several different
representations for the computation modulo primes, in particular, the
use of double precision floats.  The algorithm used in Maple releases
7-10 is the Berkowitz algorithm. We present some timings comparing the
two algorithms on a sequence of matrices arising from an application in
combinatorics of Jocelyn Quaintance. These matrices have a hidden block
structure. Once identified, we can further reduce the computing time
dramatically.  This work has been incorporated into Maple 11\'s
LinearAlgebra package.

http://www.cecm.sfu.ca/~monaganm/papers/CP8.pdf

Filename in JGD collection: CAG/mat1916.sms
',
    norm: '9.171274e+02',
    min_singular_value: '3.761160e-04',
    condition_number: '2.438416e+06',
    svd_rank: '1916',
    sprank_minus_rank: '0',
    null_space_dimension: '0',
    full_numerical_rank: 'yes',
    image_files: 'CAG_mat1916.png,CAG_mat1916_dmperm.png,CAG_mat1916_svd.png,CAG_mat1916_APlusAT_graph.gif,CAG_mat1916_graph.gif,',
}


text:
$:.unshift(File.expand_path(File.dirname(__FILE__))) unless
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))

require 'digest/md5'
require 'date'
require 'ipaddr'
require 'bindata'
require 'eventmachine'
require 'hashie'

module OpenTTD
  MASTER_SERVER_VERSION = 2 # protocol version
  MASTER_SERVER_HOST    = 'master.openttd.org'
  CONTENT_SERVER_HOST   = 'content.openttd.org'
  MASTER_SERVER_PORT    = 3978
  CONTENT_SERVER_PORT   = 3978
end

require 'openttd/encoding'
require 'openttd/data_type'
require 'openttd/payload'
require 'openttd/packet'
require 'openttd/client'
require 'openttd/version'


text:
package org.rakam.kume.transport;

import com.esotericsoftware.kryo.Kryo;
import com.esotericsoftware.kryo.KryoException;
import org.rakam.kume.ByteBufOutput;
import org.rakam.kume.transport.serialization.KryoFactory;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PacketEncoder extends MessageToByteEncoder<Packet> {
    private final Kryo kryo;
    final static Logger LOGGER = LoggerFactory.getLogger(PacketEncoder.class);

    public PacketEncoder() {
        this.kryo = KryoFactory.getKryoInstance();
    }

    @Override
    protected void encode(ChannelHandlerContext ctx, Packet msg, ByteBuf out) throws Exception {
        try {
            out.writeInt(msg.sequence);
            out.writeShort(msg.service);
            kryo.writeClassAndObject(new ByteBufOutput(out), msg.data);
        } catch (KryoException e) {
            LOGGER.error("error while serializing packet {}", msg, e);
        } catch (Exception e) {
            LOGGER.error("error while serializing packet {}", msg, e);
        }
    }
}


text:
std::ostream& operator <<(std::ostream &out,
                          const ossimRpfCompressionLookupOffsetRecord& data)
{
   data.print(out);

   return out;
}

ossimRpfCompressionLookupOffsetRecord::ossimRpfCompressionLookupOffsetRecord()
{
   clearFields();
}

ossimErrorCode ossimRpfCompressionLookupOffsetRecord::parseStream(ossim::istream& in,
                                                                  ossimByteOrder byteOrder)
{
   if(in)
   {
      ossimEndian anEndian;

      in.read((char*)&theCompressionLookupTableId, 2);
      in.read((char*)&theNumberOfCompressionLookupRecords, 4);
      in.read((char*)&theNumberOfValuesPerCompressionLookupRecord, 2);
      in.read((char*)&theCompressionLookupValueBitLength, 2);
      in.read((char*)&theCompressionLookupTableOffset, 4);

      if(anEndian.getSystemEndianType() != byteOrder)
      {
         anEndian.swap(theCompressionLookupTableId);
         anEndian.swap(theNumberOfCompressionLookupRecords);
         anEndian.swap(theNumberOfValuesPerCompressionLookupRecord);
         anEndian.swap(theCompressionLookupValueBitLength);
         anEndian.swap(theCompressionLookupTableOffset);
      }
   }
   else
   {
      return ossimErrorCodes::OSSIM_ERROR;
   }

   return ossimErrorCodes::OSSIM_OK;
}

void ossimRpfCompressionLookupOffsetRecord::print(std::ostream& out)const
{
   out << "theCompressionLookupTableId:                 " << theCompressionLookupTableId
       << "\ntheNumberOfCompressionLookupRecords:         " << theNumberOfCompressionLookupRecords
       << "\ntheNumberOfValuesPerCompressionLookupRecord: " << theNumberOfValuesPerCompressionLookupRecord
       << "\ntheCompressionLookupValueBitLength:          " << theCompressionLookupValueBitLength
       << "\ntheCompressionLookupTableOffset:             " << theCompressionLookupTableOffset;
}

void ossimRpfCompressionLookupOffsetRecord::clearFields()
{
   theCompressionLookupTableId                  = 0;
   theNumberOfCompressionLookupRecords          = 0;
   theNumberOfValuesPerCompressionLookupRecord  = 0;
   theCompressionLookupValueBitLength           = 0;
   theCompressionLookupTableOffset              = 0;
}


text:
package ir.abforce.dinorunner.custom;

import org.andengine.entity.Entity;
import org.andengine.entity.particle.Particle;
import org.andengine.entity.particle.modifier.IParticleModifier;

/**
 * Created by Ali Reza on 9/1/15.
 */
public class ExpireOnGroundParticleModifier implements IParticleModifier<Entity> {
    private float mBaseY;

    public ExpireOnGroundParticleModifier(float pBaseY) {
        this.mBaseY = pBaseY;
    }

    @Override
    public void onUpdateParticle(Particle<Entity> pParticle) {
        if(pParticle.getEntity().getY() <= this.mBaseY){
            pParticle.setExpired(true);
        }
    }

    @Override
    public void onInitializeParticle(Particle<Entity> pParticle) {

    }
}


text: echo connect | JLinkExe -if swd -speed 4000 -device nrf52


text:
package org.bndtools.builder;

import java.util.Collection;

import org.bndtools.api.BndtoolsConstants;
import org.bndtools.api.ILogger;
import org.bndtools.api.Logger;
import org.bndtools.utils.workspace.WorkspaceUtils;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResourceChangeEvent;
import org.eclipse.core.resources.IResourceChangeListener;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.WorkspaceJob;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;

import aQute.bnd.build.Project;
import aQute.bnd.build.Workspace;
import bndtools.central.Central;

public class CnfWatcher implements IResourceChangeListener {
	private static final ILogger	logger		= Logger.getLogger(CnfWatcher.class);
	private static final CnfWatcher	INSTANCE	= new CnfWatcher();

	static CnfWatcher install() {
		ResourcesPlugin.getWorkspace()
			.addResourceChangeListener(INSTANCE, IResourceChangeEvent.POST_CHANGE);
		return INSTANCE;
	}

	private CnfWatcher() {}

	@Override
	public void resourceChanged(final IResourceChangeEvent event) {
		if (Central.isWorkspaceInited()) {
			processEvent(event);
		} else {
			Central.onWorkspace(workspace -> processEvent(event));
		}
	}

	private void processEvent(IResourceChangeEvent event) {
		try {
			final Workspace workspace = Central.getWorkspaceIfPresent();

			if (workspace == null) {
				// this can happen during first project creation in an empty
				// workspace
				logger.logInfo("Unable to get workspace", null);
				return;
			}

			final IProject cnfProject = WorkspaceUtils.findCnfProject(ResourcesPlugin.getWorkspace()
				.getRoot(), workspace);
			if (cnfProject == null)
				return;

			IResourceDelta delta = event.getDelta();
			if (delta.findMember(cnfProject.getFullPath()) == null)
				return;

			Collection<Project> allProjects = workspace.getAllProjects();
			if (allProjects.isEmpty())
				return;

			Project p = allProjects.iterator()
				.next();
			DeltaWrapper dw = new DeltaWrapper(p, delta, new BuildLogger(BuildLogger.LOG_NONE, "", 0));
			if (dw.hasCnfChanged()) {
				workspace.clear();
				workspace.forceRefresh();
				workspace.getPlugins();

				BndtoolsBuilder.dirty.addAll(allProjects);

				WorkspaceJob j = new WorkspaceJob("Update errors on workspace") {
					@Override
					public IStatus runInWorkspace(IProgressMonitor arg0) throws CoreException {
						try {
							MarkerSupport ms = new MarkerSupport(cnfProject);
							ms.deleteMarkers("*");
							ms.setMarkers(workspace, BndtoolsConstants.MARKER_BND_WORKSPACE_PROBLEM);
							return Status.OK_STATUS;
						} catch (Exception e) {
							return new Status(IStatus.ERROR, BndtoolsBuilder.PLUGIN_ID, "updating errors for workspace",
								e);
						}
					}
				};
				j.schedule();
			}
		} catch (Exception e) {
			logger.logError("Detecting changes in cnf failed, ignoring", e);
		}
	}
}


text:
cask :v1 => 'data-integration' do
  version :latest
  sha256 :no_check

  url 'https://sourceforge.net/projects/pentaho/files/latest/download'
  homepage 'http://community.pentaho.com'
  license :oss
  tags :vendor => 'Pentaho',
       :name   => 'Pentaho Data Integration'

  app 'data-integration/Data Integration.app'
end


text:
Document management system on the blockchain with clever ACL and automatic declassification of documents

http://cubefriendly.github.io/ethclassify/ for more info


text:
/**
* <auto-generated />
* This file was generated by a StringTemplate 4 template.
* Don't change it directly as your change would get overwritten. Instead, make changes
* to the .stg file (i.e. the StringTemplate 4 template file) and save it to regenerate this file.
*
* For more infor on StringTemplate 4 template please go to -
* https://github.com/antlr/antlrcs
*
* @author  Kola Oyewumi
* @version 1.0.0
* @since   2017-01-03
*
* A class which represents the inbound_email_autoreply table.
*/

package com.sugaronrest.modules;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.sugaronrest.restapicalls.Module;
import com.sugaronrest.restapicalls.CustomDateDeserializer;
import com.sugaronrest.restapicalls.CustomDateSerializer;

import java.util.Date;

@Module(name = "", tablename = "inbound_email_autoreply")
@JsonRootName(value = "inbound_email_autoreply")
@JsonIgnoreProperties(ignoreUnknown = true)
public class InboundEmailAutoreply {
    public String getId() {
        return id;
    }

    public void setId(String value) {
        id = value;
    }
    public Integer getDeleted() {
        return deleted;
    }

    public void setDeleted(Integer value) {
        deleted = value;
    }
    public Date getDateEntered() {
        return dateEntered;
    }

    public void setDateEntered(Date value) {
        dateEntered = value;
    }
    public Date getDateModified() {
        return dateModified;
    }

    public void setDateModified(Date value) {
        dateModified = value;
    }
    public String getAutorepliedTo() {
        return autorepliedTo;
    }

    public void setAutorepliedTo(String value) {
        autorepliedTo = value;
    }
    public String getIeId() {
        return ieId;
    }

    public void setIeId(String value) {
        ieId = value;
    }

    @JsonProperty("id")
    private String id;

    @JsonProperty("deleted")
    private Integer deleted;

    @JsonProperty("date_entered")
    @JsonDeserialize(using = CustomDateDeserializer.class)
    @JsonSerialize(using = CustomDateSerializer.class)
    private Date dateEntered;

    @JsonProperty("date_modified")
    @JsonDeserialize(using = CustomDateDeserializer.class)
    @JsonSerialize(using = CustomDateSerializer.class)
    private Date dateModified;

    @JsonProperty("autoreplied_to")
    private String autorepliedTo;

    @JsonProperty("ie_id")
    private String ieId;

}


text:
<?xml version="1.0" encoding="utf-8" ?>
<Settings xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <!-- Add your custom configuration sections and parameters here. -->
  <!--
  <Section Name="MyConfigSection">
    <Parameter Name="MyParameter" Value="Value1" />
  </Section>
  -->
</Settings>


text:
<?xml version="1.0" encoding="utf-8"?>

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/holo_textfield_default_holo_light" android:state_enabled="true" android:state_window_focused="false" />
    <item android:drawable="@drawable/holo_textfield_disabled_holo_light" android:state_enabled="false" android:state_window_focused="false" />
    <item android:drawable="@drawable/holo_textfield_activated_holo_light" android:state_enabled="true" android:state_focused="true" />
    <item android:drawable="@drawable/holo_textfield_focused_holo_light" android:state_activated="true" android:state_enabled="true" />
    <item android:drawable="@drawable/holo_textfield_default_holo_light" android:state_enabled="true" />
    <item android:drawable="@drawable/holo_textfield_disabled_focused_holo_light" android:state_focused="true" />
    <item android:drawable="@drawable/holo_textfield_disabled_holo_light" />
</selector>


text:
/**
 * generated by Xtext
 */
package com.crubier.lil.generator;

import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtext.generator.IFileSystemAccess;
import org.eclipse.xtext.generator.IGenerator;
import org.eclipse.xtext.xbase.lib.InputOutput;

/**
 * Generates code from your model files on save.
 *
 * see http://www.eclipse.org/Xtext/documentation.html#TutorialCodeGeneration
 */
@SuppressWarnings("all")
public class LilGeneratorC implements IGenerator {
  public void doGenerate(final Resource resource, final IFileSystemAccess fsa) {
    InputOutput.<String>println("generate C code");
  }
}


text:
Ext.define('devilry.statistics.sidebarplugin.qualifiesforexam.advanced.Filter', {
    config: {
        pointspecArgs: undefined,
        must_pass: []
    },

    requires: [
        'devilry.statistics.sidebarplugin.qualifiesforexam.advanced.PointSpec'
    ],

    strTpl: Ext.create('Ext.XTemplate',
        '
',
            '<tpl if="must_pass.length > 0">',
                '
Must pass: ',
                    '<tpl for="must_pass">',
                        '(<tpl for=".">',
                            '{data.short_name}',
                            '<tpl if="xindex < xcount"> OR </tpl>',
                        '</tpl>)',
                        '<tpl if="xindex < xcount"> AND </tpl>',
                    '</tpl>',
                '
',
            '</tpl>',
            '<tpl if="pointassignments.length > 0">',
                '
Must have between ',
                    '<tpl if="!min">0</tpl><tpl if="min">{min}</tpl>',
                    ' and ',
                    '<tpl if="!max">∞</tpl><tpl if="max">{max}</tpl>',
                    ' points in total (including both ends) on ',
                    '<tpl for="pointassignments">',
                        '(',
                        '<tpl if="length > 1">best of: </tpl>',
                        '<tpl for=".">',
                            '{data.short_name}',
                            '<tpl if="xindex < xcount">, </tpl>',
                        '</tpl>)',
                        '<tpl if="xindex < xcount"> AND </tpl>',
                    '</tpl>',
                '
',
            '</tpl>',
        '
'
    ),

    constructor: function(config) {
        this.initConfig(config);
        this.pointspec = Ext.create('devilry.statistics.sidebarplugin.qualifiesforexam.advanced.PointSpec', this.pointspecArgs);
    },

    toReadableSummary: function(assignment_store) {
        var data = {
            must_pass: this._assignmentIdListToAssignmentRecords(assignment_store, this.must_pass),
            min: this.pointspec.min,
            max: this.pointspec.max,
            pointassignments: this._assignmentIdListToAssignmentRecords(assignment_store, this.pointspec.assignments)
        };
        return this.strTpl.apply(data);
    },

    _assignmentIdListToAssignmentRecords: function(assignment_store, arrayOfArrayOfassignmentIds) {
        var arrayOfArrayOfAssignmentRecords = [];
        Ext.each(arrayOfArrayOfassignmentIds, function(assignmentIds, index) {
            var assignmentRecords = [];
            Ext.each(assignmentIds, function(assignmentId, index) {
                var assignmentRecordIndex = assignment_store.findExact('id', assignmentId);
                var assignmentRecord = assignment_store.getAt(assignmentRecordIndex);
                assignmentRecords.push(assignmentRecord);
            });
            arrayOfArrayOfAssignmentRecords.push(assignmentRecords);
        });
        return arrayOfArrayOfAssignmentRecords;
    },

    match: function(studentRecord) {
        return this._matchIsPassingGrade(studentRecord) && this._matchPointspec(studentRecord);
    },

    _matchIsPassingGrade: function(studentRecord) {
        if(this.must_pass.length === 0) {
            return true;
        }
        var matches = true;
        Ext.each(this.must_pass, function(assignment_ids, index) {
            var one_of_them_is_passing = studentRecord.countPassingAssignments(assignment_ids) > 0;
            if(!one_of_them_is_passing) {
                matches = false;
                return false; // Break
            }
        }, this);
        return matches;
    },

    _matchPointspec: function(studentRecord) {
        if(!this.pointspec) {
            return true;
        }
        return this.pointspec.match(studentRecord);
    },

    toExportObject: function() {
        return {
            must_pass: this.must_pass,
            pointspecArgs: this.pointspec.toExportObject()
        };
    }
});


text:
package org.springframework.boot.autoconfigure.web.reactive;

import java.net.InetAddress;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import org.springframework.boot.autoconfigure.web.ServerProperties;
import org.springframework.boot.web.reactive.server.ConfigurableReactiveWebServerFactory;
import org.springframework.boot.web.server.Ssl;

import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

/**
 * Tests for {@link ReactiveWebServerFactoryCustomizer}.
 *
 * @author Brian Clozel
 * @author Yunkun Huang
 */
public class ReactiveWebServerFactoryCustomizerTests {

	private ServerProperties properties = new ServerProperties();

	private ReactiveWebServerFactoryCustomizer customizer;

	@BeforeEach
	public void setup() {
		this.customizer = new ReactiveWebServerFactoryCustomizer(this.properties);
	}

	@Test
	public void testCustomizeServerPort() {
		ConfigurableReactiveWebServerFactory factory = mock(
				ConfigurableReactiveWebServerFactory.class);
		this.properties.setPort(9000);
		this.customizer.customize(factory);
		verify(factory).setPort(9000);
	}

	@Test
	public void testCustomizeServerAddress() {
		ConfigurableReactiveWebServerFactory factory = mock(
				ConfigurableReactiveWebServerFactory.class);
		InetAddress address = mock(InetAddress.class);
		this.properties.setAddress(address);
		this.customizer.customize(factory);
		verify(factory).setAddress(address);
	}

	@Test
	public void testCustomizeServerSsl() {
		ConfigurableReactiveWebServerFactory factory = mock(
				ConfigurableReactiveWebServerFactory.class);
		Ssl ssl = mock(Ssl.class);
		this.properties.setSsl(ssl);
		this.customizer.customize(factory);
		verify(factory).setSsl(ssl);
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<PRONOM-Report xmlns="http://pronom.nationalarchives.gov.uk">
  <report_format_detail>
    <FileFormat>
      <FormatID>2416</FormatID>
      <FormatName>Visual Basic Binary Form File</FormatName>
      <FormatVersion>
      </FormatVersion>
      <FormatAliases>
      </FormatAliases>
      <FormatFamilies>
      </FormatFamilies>
      <FormatTypes>Text (Unstructured)</FormatTypes>
      <FormatDisclosure>
      </FormatDisclosure>
      <FormatDescription>Generated in Visual Basic, frx files encode the binary data for images specified by the accompanying .frm file.</FormatDescription>
      <BinaryFileFormat>
      </BinaryFileFormat>
      <ByteOrders>
      </ByteOrders>
      <ReleaseDate>
      </ReleaseDate>
      <WithdrawnDate>
      </WithdrawnDate>
      <ProvenanceSourceID>234</ProvenanceSourceID>
      <ProvenanceName>National Library of Australia / National Library of Australia</ProvenanceName>
      <ProvenanceSourceDate>06 Jan 2022</ProvenanceSourceDate>
      <ProvenanceDescription>
      </ProvenanceDescription>
      <LastUpdatedDate>06 Jan 2022</LastUpdatedDate>
      <FormatNote>
      </FormatNote>
      <FormatRisk>
      </FormatRisk>
      <TechnicalEnvironment>
      </TechnicalEnvironment>
      <FileFormatIdentifier>
        <Identifier>fmt/1590</Identifier>
        <IdentifierType>PUID</IdentifierType>
      </FileFormatIdentifier>
      <ExternalSignature>
        <ExternalSignatureID>2876</ExternalSignatureID>
        <Signature>frx</Signature>
        <SignatureType>File extension</SignatureType>
      </ExternalSignature>
    </FileFormat>
    <SearchCriteria>Criteria</SearchCriteria>
  </report_format_detail>
</PRONOM-Report>


text:
function(is_task)
  map_get_special("${ARGN}" $type)
  ans(type)
  if("${type}" STREQUAL "task")
    return(true)
  endif()
  return(false)
endfunction()


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed to the Apache Software Foundation (ASF) under one or more
  ~ contributor license agreements.  See the NOTICE file distributed with
  ~ this work for additional information regarding copyright ownership.
  ~ The ASF licenses this file to You under the Apache License, Version 2.0
  ~ (the "License"); you may not use this file except in compliance with
  ~ the License.  You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  ~
  -->
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <groupId>org.apache.skywalking</groupId>
        <artifactId>jetty-scenario</artifactId>
        <version>5.0.0</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>jetty-dist</artifactId>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>assemble</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <descriptors>
                                <descriptor>src/main/assembly/assembly.xml</descriptor>
                            </descriptors>
                            <outputDirectory>../target/</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>


text:
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:minHeight="?android:attr/listPreferredItemHeightSmall"
    android:padding="10dp"
    android:orientation="horizontal">

    <android.widget.IconTextView
        android:id="@android:id/icon"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="{fa-user}"
        android:textColor="?colorPrimary"
        android:textAppearance="@android:style/TextAppearance.Large"/>

    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="10dp"
        android:orientation="vertical">

        <TextView
            android:id="@+id/name"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textStyle="bold"
            android:textAppearance="@android:style/TextAppearance.Medium"/>

        <TextView
            android:id="@+id/role"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="@android:style/TextAppearance.Medium"/>

        <TextView
            android:id="@+id/phone"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textAppearance="@android:style/TextAppearance.Medium"
            android:textColorLink="?colorPrimary"
            android:autoLink="phone"/>

    </LinearLayout>

</LinearLayout>


text:
#stumpwise-bar {
	background:#039;
	height:26px;
	padding:4px;
	position:fixed;
	right:5px;
	top:0px;
	text-align:left;
	box-shadow:0 0 4px #000;
	-moz-box-shadow:0 0 4px #000;
	-webkit-box-shadow:0 0 4px #000;
	border-bottom-left-radius:8px;
	-webkit-border-bottom-left-radius:8px;
	-moz-border-radius-bottomleft:8px;
	border-bottom-right-radius:8px;
	-webkit-border-bottom-right-radius:8px;
	-moz-border-radius-bottomright:8px;
	white-space:nowrap;
}
.stumpwise-bar-button {
	height:26px;
	border-radius:4px;
	-moz-border-radius:4px;
	-webkit-border-radius:4px;
	color:#FFF;
	text-decoration:none;
}
#stumpwise-bar-logo img { width:95px; }
#stumpwise-bar-join img { width:148px; }
#stumpwise-bar-contribute img { width:98px; }

/* ColorBox Core Style - Don't Change */
#colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
#cboxOverlay{position:fixed; width:100%; height:100%;}
#cboxMiddleLeft, #cboxBottomLeft{clear:left;}
#cboxContent{position:relative; overflow:hidden;}
#cboxLoadedContent{overflow:auto;}
#cboxLoadedContent iframe{display:block; width:100%; height:100%; border:0;}
#cboxTitle{margin:0;}
#cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;}
#cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}

/* ColorBox Custom Style */
#cboxOverlay{background:rgba(0,0,0,0.5);}
#colorbox{}
    #cboxTopLeft{width:14px; height:14px; background:url(/images/colorbox/controls.png) -14px 0 no-repeat;}
    #cboxTopRight{width:14px; height:14px; background:url(/images/colorbox/controls.png) -28px 0 no-repeat;}
    #cboxBottomLeft{width:14px; height:14px; background:url(/images/colorbox/controls.png) -14px -14px no-repeat;}
    #cboxBottomRight{width:14px; height:14px; background:url(/images/colorbox/controls.png) -28px -14px no-repeat;}
    #cboxMiddleLeft{width:14px; background:url(/images/colorbox/controls.png) left top repeat-y;}
    #cboxMiddleRight{width:14px; background:url(/images/colorbox/controls.png) right top repeat-y;}
    #cboxTopCenter{height:14px; background:url(/images/colorbox/border.png) 0 0 repeat-x;}
    #cboxBottomCenter{height:14px; background:url(/images/colorbox/border.png) 0 -14px repeat-x;}
    #cboxContent{background:#fff;}
        #cboxLoadedContent{margin-bottom:28px; margin-bottom:0;}
        #cboxTitle{position:absolute; bottom:4px; left:0; text-align:center; width:100%; color:#949494;}
        #cboxCurrent{position:absolute; bottom:4px; left:58px; color:#949494;}
        #cboxSlideshow{position:absolute; bottom:4px; right:30px; color:#0092ef;}
        #cboxPrevious{display:none !important; position:absolute; bottom:0; left:0px; background:url(/images/colorbox/controls.png) -75px 0px no-repeat; width:25px; height:25px; text-indent:-9999px;}
        #cboxPrevious.hover{display:none !important; background-position:-75px -25px;}
        #cboxNext{display:none !important; position:absolute; bottom:0; left:27px; background:url(/images/colorbox/controls.png) -50px 0px no-repeat; width:25px; height:25px; text-indent:-9999px;}
        #cboxNext.hover{display:none !important; background-position:-50px -25px;}
        #cboxLoadingOverlay{background:url(/images/colorbox/loading_background.png) center center no-repeat;}
        #cboxLoadingGraphic{background:url(/images/colorbox/loading.gif) center center no-repeat;}
        #cboxClose{display:none !important; width:20px; height:20px; text-indent:-9999px;}
        #cboxClose.hover{display:none !important; background-position:-25px -25px;}


text:
@interface LYTDataValues ()

@property (nonatomic, strong) NSArray *filteredValues;

@end

@implementation LYTDataValues

- (id)init {
    return [self initWithFilter:nil];
}

- (id)initWithRequired:(BOOL)required {
    return [self initWithFilter:^BOOL(id value) {
        return (value != nil) || !required;
    }];
}

- (id)initWithValues:(NSArray *)values {
    self = [super init];
    if (self) {
        self.filteredValues = values;
    }
    return self;
}

- (id)initWithFilter:(BOOL(^)(id value))filter {
    self = [super init];
    if (self) {
        if (filter) {
            NSMutableArray *filteredValues = [NSMutableArray array];
            for (id object in self.values) {
                id reportedObject = object;
                if ([object isKindOfClass:[NSNull class]]) {
                    reportedObject = nil;
                }
                if (filter(reportedObject)) {
                    [filteredValues addObject:object];
                }
            }
            self.filteredValues = filteredValues;
        } else {
            self.filteredValues = self.values;
        }

        NSAssert([self.filteredValues count] > 0, @"After filtering the values, there must be at least one value for the LYTDataValues subclass.");
    }

    return self;
}

- (NSUInteger)numberOfValues {
    return [self.filteredValues count];
}

- (id)valueAtIndex:(NSUInteger)index {
    return self.filteredValues[index];
}

@end


text:
package org.jboss.pnc.integration.client;

import org.jboss.pnc.rest.restmodel.ProductVersionRest;

public class ProductVersionRestClient extends AbstractRestClient<ProductVersionRest> {

    private static final String PRODUCT_VERSION_REST_ENDPOINT = "/pnc-rest/rest/product-versions/";

    public ProductVersionRestClient() {
        super(PRODUCT_VERSION_REST_ENDPOINT, ProductVersionRest.class);
    }
}


text:
package org.tdc.modeldef;

import org.tdc.model.AttribNode;
import org.tdc.model.ModelVisitor;

/**
 * A {@link NodeDef} implementation specific to attributes.
 */
public class AttribNodeDef extends NodeDef implements AttribNode {

	private String name;
	private boolean isRequired;

	public AttribNodeDef(ElementNodeDef parent, ModelDefSharedState sharedState) {
		super(parent, sharedState);
	}

	@Override
	public String getName() {
		return name;
	}

	public void setName(String name) {
		getSharedState().throwExceptionIfImmutable("setName");
		this.name = name;
	}

	@Override
	public boolean isRequired() {
		return isRequired;
	}

	public void setRequired(boolean isRequired) {
		getSharedState().throwExceptionIfImmutable("setRequired");
		this.isRequired = isRequired;
	}

	@Override
	public ElementNodeDef getParent() {
		return (ElementNodeDef)super.getParent();
	}

	@Override
	public String getDispName() {
		return "@" + getName();
	}

	@Override
	public String getDispOccurs() {
		return isRequired ? "1..1" : "0..1";
	}

	@Override
	public void accept(ModelVisitor visitor) {
		visitor.visit(this);
	}

	@Override
	public boolean isChildOfChoice() {
		// attributes will always be children of elements, nothing else
		return false;
	}
}


text:
from ..cw_model import CWModel

class ShipmentMethod(CWModel):

    def __init__(self, json_dict=None):
        self.id = None  # (Integer)
        self.name = None  # *(String(50))
        self.defaultFlag = None  # (Boolean)
        self.trackingUrl = None  # (String(200))
        self.shippingType = None  # (Enum)
        self._info = None  # (Metadata)

        # initialize object with json dict
        super().__init__(json_dict)


text:
"use strict";

var App = {
  init: function init(assets) {
    assets = assets || {};
    if (assets.templates) {
      TemplateStore.init(assets.templates);
    }
  }
};


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Nov. gen. pl. (Lipsiae) pl. 1 (1797)

#### Original name
Hydnum spathulatum (Schrad.) Fr., 1822

### Remarks
null


text:
This is a sample app using the HBase native API to interact with Cloud
Bigtable.

## Provision a Bigtable Cluster

In order to provision a Cloud Bigtable cluster you will first need to create a
Google Cloud Platform project. You can create a project using the [Developer
Console](https://cloud.google.com/console).

After you have created a project you can create a new [Cloud Bigtable cluster](https://cloud.google.com/bigtable/docs/creating-cluster) by
clicking on the "Storage" -> "Cloud Bigtable" menu item and clicking on the
"New Cluster" button.  After that, enter the cluster name, ID, zone, and number
of nodes. Once you have entered those values, click the "Create" button to
provision the cluster.

## Build

You can install the dependencies and build the project using maven.

    $ mvn package -Dbigtable.projectID=myProject -Dbigtable.instanceID=myInstance

## Run the code

You can run a command using the hbasecli.sh script. Try checking the available commands:

    $ ./hbasecli.sh -help

You can create a new table using the `create` command:

    $ ./hbasecli.sh create mytable columnfamily

You can verify that the table was created using the `list` command:

    $ ./hbasecli.sh list

You can then add some data to the table using the put command:

    $ ./hbasecli.sh put mytable rowid columnfamily columnname value

You can then get all the values for the row using the `get` command:

    $ ./hbasecli.sh get mytable rowid

You can also `scan` the table to get all rows, or a filtered set of rows:

    $ ./hbasecli.sh scan mytable filterexp

- ### Filter expressions

    The `scan` command allows you to specify a filter expression, which uses the
    following format:

        [column_family]:[column_qualifier][operator][value]

    The following operators are supported:

    * `=`: Equal to
    * `<`: Less than
    * `<=`: Less than or equal to
    * `>`: Greater than
    * `>=`: Greater than or equal to

    For example, the filter expression `cf1:mycolumn>po` would match rows in which
    `cf1:mycolumn` contains a byte string whose value comes after the byte string
    `po`. This expression would match the values `pony` and `sunrise`, because these
    values come after the value `po`. The expression would not match the values
    `apple` or `pi`, which come before `po`.

    NOTE - the operators should be escaped with a backslash.

You can finally delete the an existing table using the `delete` command:

    $ ./hbasecli.sh delete mytable

## Understanding the code

The simple CLI uses the [HBase Native API](http://hbase.apache.org/book.html#hbase_apis)
to make calls to Cloud Bigtable. This should be a simple example to allow you to
get started connecting to Cloud Bigtable and using the API.

Connections are created using the ConnectionFactory class. Calling createConnection()
with no arguments uses the default configuration which is loaded from the hbase-site.xml
file on the classpath.

    Connection connection  = ConnectionFactory.createConnection();

Actions on tables and other administration can be done via the Admin class.

    Admin admin = connection.getAdmin();
    // List tables
    HTableDescriptor[] tables = admin.listTables();
    // Create table
    admin.createTable(new HTableDescriptor("mytable"));

For more information see the [HBase Native API documentation](https://hbase.apache.org/apidocs/).

## Contributing changes

* See [CONTRIBUTING.md](../../CONTRIBUTING.md)

## Licensing

* See [LICENSE](../../LICENSE)