text:
<?php

namespace kartik\base;

/**
 * Asset bundle for loading animations
 *
 * @author Kartik Visweswaran <kartikv2@gmail.com>
 * @since 1.0
 */
class AnimateAsset extends AssetBundle
{
    /**
     * @inheritdoc
     */
    public function init()
    {
        $this->setSourcePath(__DIR__ . '/assets');
        $this->setupAssets('css', ['css/animate']);
        parent::init();
    }
}


text:
/*
* jQuery Flight Indicators plugin
* By Sébastien Matton (seb_matton@hotmail.com)
* Published under GPLv3 License.
*
* https://github.com/sebmatton/jQuery-Flight-Indicators
*/
div.instrument {
    width: 215px;
    height: 215px;
    position: relative;
    display: inline-block;
    overflow: hidden
}

div.instrument .box {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%
}

div.instrument.attitude div.roll {
    transform: rotate(0deg)
}

div.instrument.attitude div.roll div.pitch {
    top: 0
}

div.instrument.heading div.yaw, div.instrument.vario div.vario {
    transform: rotate(0deg)
}

div.instrument.speed div.airspeed {
    transform: rotate(90deg)
}

div.instrument.altimeter div.pressure {
    transform: rotate(40deg)
}

div.instrument.altimeter div.needle, div.instrument.altimeter div.needleSmall {
    transform: rotate(90deg)
}

redpajama_set_name: RedPajamaGithub


text:
@import Foundation;
@import UIKit;

@protocol RenderDelegate <NSObject>
-(void) containerRendInStart;
-(void) containerRendOutStart;
-(void) containerRendOutFinish;
@end

enum ContainerStatus{
	New, Rend, Rendout, End
};

@interface Container : NSObject

@property (nonatomic, retain) UIView *contentView;
@property (nonatomic, retain) UIView *renderView;
@property (nonatomic, retain) NSTimer *renderTimer;
//@property (nonatomic) NSTimeInterval duration;
@property (nonatomic) NSTimeInterval rendinAnimationDuration;
@property (nonatomic) enum ContainerStatus rendState;
@property (nonatomic, weak) id <RenderDelegate> delegate;

-(id) initWithRenderView: (UIView *)initRenderView;
-(void) rendIn;
-(void) rendOut;

@end


text:
.class public Lcom/ub/main/foodsale/FoodCouponListAdapter$ViewHolder;
.super Ljava/lang/Object;
.source "FoodCouponListAdapter.java"

# annotations
.annotation system Ldalvik/annotation/EnclosingClass;
    value = Lcom/ub/main/foodsale/FoodCouponListAdapter;
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x1
    name = "ViewHolder"
.end annotation

# instance fields
.field public count:Landroid/widget/TextView;

.field public image:Landroid/widget/ImageView;

.field public info:Landroid/widget/TextView;

.field public money:Landroid/widget/TextView;

.field public name:Landroid/widget/TextView;

.field public selectimage:Landroid/widget/ImageView;

.field final synthetic this$0:Lcom/ub/main/foodsale/FoodCouponListAdapter;

# direct methods
.method public constructor <init>(Lcom/ub/main/foodsale/FoodCouponListAdapter;)V
    .locals 0
    .parameter

    .prologue
    .line 29
    iput-object p1, p0, Lcom/ub/main/foodsale/FoodCouponListAdapter$ViewHolder;->this$0:Lcom/ub/main/foodsale/FoodCouponListAdapter;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


text: export { Binoculars32 as default } from "../../";


text:
<?php
# Generated by the protocol buffer compiler.  DO NOT EDIT!
# source: google/ads/googleads/v12/services/campaign_extension_setting_service.proto

namespace Google\Ads\GoogleAds\V12\Services;

use Google\Protobuf\Internal\GPBType;
use Google\Protobuf\Internal\RepeatedField;
use Google\Protobuf\Internal\GPBUtil;

/**
 * The result for the campaign extension setting mutate.
 *
 * Generated from protobuf message google.ads.googleads.v12.services.MutateCampaignExtensionSettingResult
 */
class MutateCampaignExtensionSettingResult extends \Google\Protobuf\Internal\Message
{
    /**
     * Returned for successful operations.
     *
     * Generated from protobuf field string resource_name = 1 [(.google.api.resource_reference) = {
     */
    protected $resource_name = '';
    /**
     * The mutated campaign extension setting with only mutable fields after
     * mutate. The field will only be returned when response_content_type is set
     * to "MUTABLE_RESOURCE".
     *
     * Generated from protobuf field .google.ads.googleads.v12.resources.CampaignExtensionSetting campaign_extension_setting = 2;
     */
    protected $campaign_extension_setting = null;

    /**
     * Constructor.
     *
     * @param array $data {
     *     Optional. Data for populating the Message object.
     *
     *     @type string $resource_name
     *           Returned for successful operations.
     *     @type \Google\Ads\GoogleAds\V12\Resources\CampaignExtensionSetting $campaign_extension_setting
     *           The mutated campaign extension setting with only mutable fields after
     *           mutate. The field will only be returned when response_content_type is set
     *           to "MUTABLE_RESOURCE".
     * }
     */
    public function __construct($data = NULL) {
        \GPBMetadata\Google\Ads\GoogleAds\V12\Services\CampaignExtensionSettingService::initOnce();
        parent::__construct($data);
    }

    /**
     * Returned for successful operations.
     *
     * Generated from protobuf field string resource_name = 1 [(.google.api.resource_reference) = {
     * @return string
     */
    public function getResourceName()
    {
        return $this->resource_name;
    }

    /**
     * Returned for successful operations.
     *
     * Generated from protobuf field string resource_name = 1 [(.google.api.resource_reference) = {
     * @param string $var
     * @return $this
     */
    public function setResourceName($var)
    {
        GPBUtil::checkString($var, True);
        $this->resource_name = $var;

        return $this;
    }

    /**
     * The mutated campaign extension setting with only mutable fields after
     * mutate. The field will only be returned when response_content_type is set
     * to "MUTABLE_RESOURCE".
     *
     * Generated from protobuf field .google.ads.googleads.v12.resources.CampaignExtensionSetting campaign_extension_setting = 2;
     * @return \Google\Ads\GoogleAds\V12\Resources\CampaignExtensionSetting|null
     */
    public function getCampaignExtensionSetting()
    {
        return $this->campaign_extension_setting;
    }

    public function hasCampaignExtensionSetting()
    {
        return isset($this->campaign_extension_setting);
    }

    public function clearCampaignExtensionSetting()
    {
        unset($this->campaign_extension_setting);
    }

    /**
     * The mutated campaign extension setting with only mutable fields after
     * mutate. The field will only be returned when response_content_type is set
     * to "MUTABLE_RESOURCE".
     *
     * Generated from protobuf field .google.ads.googleads.v12.resources.CampaignExtensionSetting campaign_extension_setting = 2;
     * @param \Google\Ads\GoogleAds\V12\Resources\CampaignExtensionSetting $var
     * @return $this
     */
    public function setCampaignExtensionSetting($var)
    {
        GPBUtil::checkMessage($var, \Google\Ads\GoogleAds\V12\Resources\CampaignExtensionSetting::class);
        $this->campaign_extension_setting = $var;

        return $this;
    }

}


text:
@interface UIImage (CRBoilerplate)

// maskImage must be a black-and-white image represting the alpha mask to apply.
- (UIImage *) cr_imageWithOverlayColor:(UIColor *)color mask:(UIImage *)maskImage;
- (UIImage *) cr_greyscaleImage;

@end


text:
package io.vertx.core.shareddata;

import io.vertx.Lifecycle;
import io.vertx.LoggingTestWatcher;
import io.vertx.core.*;
import io.vertx.core.spi.cluster.ClusterManager;
import io.vertx.ext.cluster.infinispan.InfinispanClusterManager;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

/**
 * @author Thomas Segismont
 */
public class InfinispanClusteredAsynchronousLockTest extends ClusteredAsynchronousLockTest {

  @Rule
  public LoggingTestWatcher watchman = new LoggingTestWatcher();

  @Rule
  public TemporaryFolder temporaryFolder = new TemporaryFolder();

  @Override
  public void setUp() throws Exception {
    System.setProperty("jgroups.file.location", temporaryFolder.newFolder().getAbsolutePath());
    super.setUp();
  }

  @Override
  protected void clusteredVertx(VertxOptions options, Handler<AsyncResult<Vertx>> ar) {
    CountDownLatch latch = new CountDownLatch(1);
    Promise<Vertx> promise = Promise.promise();
    promise.future().onComplete(ar);
    super.clusteredVertx(options, asyncResult -> {
      if (asyncResult.succeeded()) {
        promise.complete(asyncResult.result());
      } else {
        promise.fail(asyncResult.cause());
      }
      latch.countDown();
    });
    try {
      assertTrue(latch.await(2, TimeUnit.MINUTES));
    } catch (InterruptedException e) {
      fail(e.getMessage());
    }
  }

  @Override
  protected ClusterManager getClusterManager() {
    return new InfinispanClusterManager();
  }

  @Override
  @Test
  public void testLockReleasedForClosedNode() throws Exception {
    super.testLockReleasedForClosedNode();
  }

  @Override
  @Test
  public void testLockReleasedForKilledNode() throws Exception {
    super.testLockReleasedForKilledNode();
  }

  @Override
  protected void closeClustered(List<Vertx> clustered) throws Exception {
    Lifecycle.closeClustered(clustered);
  }
}


text:
/*--------------------------------------------------------------------
 *JAVASCRIPT "jquery.stepProgressBar.js"
 *Version:    0.1.5 - 2016
 *author:     Mickaël Roy
 *website:    http://www.mickaelroy.com
 *Licensed MIT
-----------------------------------------------------------------------*/

(function ($){

    var pluginName = 'stepProgressBar';

    /**
     * The plugin constructor
     * @param {DOM Element} element The DOM element where plugin is applied
     * @param {Object} options Options passed to the constructor
     */
    function StepProgressBar(element, options) {
        // Store a reference to the source element
        this.el = element;

        // Store a jQuery reference  to the source element
        this.$el = $(element);

        // Set a random (and normally unique) id for the object
        this.instanceId = Math.round(new Date().getTime() + (Math.random() * 100));

        // Set the instance options extending the plugin defaults and
        // the options passed by the user
        this.settings = $.extend({}, $.fn[pluginName].defaults, options);

        this.stepFields = [
            'value',
            'topLabel',
            'bottomLabel',
            'mouseOver',
            'click',
        ];

        // Initialize the plugin instance
        this.init();
    }

    /**
     * Set up your Plugin protptype with desired methods.
     * It is a good practice to implement 'init' and 'destroy' methods.
     */
    StepProgressBar.prototype = {

        /**
         * Initialize the plugin instance.
         * Set any other attribtes, store any other element reference, register
         * listeners, etc
         *
         * When bind listerners remember to name tag it with your plugin's name.
         * Elements can have more than one listener attached to the same event
         * so you need to tag it to unbind the appropriate listener on destroy:
         *
         * @example
         * this.$someSubElement.on('click.' + pluginName, function() {
         *      // Do something
         * });
         *
         */
        init: function() {
            // init bar structure
            this._buildBar();

            if(this.settings.steps && this.settings.steps.length > 0) {
                // init steps wrapper structure
                this._buildStepsWrapper();
                // update steps / progress / labels values & elements
                this._updateSteps();
            }
        },

        /**
         * The 'destroy' method is were you free the resources used by your plugin:
         * references, unregister listeners, etc.
         *
         * Remember to unbind for your event:
         *
         * @example
         * this.$someSubElement.off('.' + pluginName);
         *
         * Above example will remove any listener from your plugin for on the given
         * element.
         */
        destroy: function() {
            // Remove any attached data from your plugin
        },

        // To call a real private method from those public methods, you need to use 'call' or 'apply':
        //privateMethod.call(this);

        /**
         * getCurrentValue method
         *
         * @example
         * $('#element').pluginName('getCurrentValue');
         */
        getCurrentValue: function() {
            return this.settings.currentValue;
        },

        /**
         * setCurrentValue method
         *
         * @example
         * $('#element').pluginName('setCurrentValue', value);
         *
         * @param  {number} value [the value to set for selector]
         */
        setCurrentValue: function(value) {
            this.settings.currentValue = value;
            this._updateProgress();
            this._findNextStep();
            this._updateNextStepElm();
        },

        /**
         * findStep method
         *
         * @example
         * $('#element').pluginName('findStep', value);
         *
         * @param  {object} step [value of the step object to retreive]
         */
        findStep: function(value) {
            if(!isNullOrUndefined(value) && !isNullOrUndefined(this.settings.steps) && this.settings.steps.length > 0) {
                for(var i = 0; i < this.settings.steps.length; i++) {
                    if(this.settings.steps[i].value == value)
                        return this.settings.steps[i];
                }
            } else return;
        },

        /**
         * addStep method
         *
         * @example
         * $('#element').pluginName('addStep', step);
         *
         * @param  {object} step [the step object to add]
         */
        addStep: function(step) {
            if(!isNullOrUndefined(step) && !isNullOrUndefined(step.value)) {
                // add new built step to steps array
                this.settings.steps.push(step);
                // refresh steps
                this._updateSteps();
            }
        },

        /**
         * removeStep method
         *
         * @example
         * $('#element').pluginName('removeStep', value);
         *
         * @param  {object} step [value of the step object to remove]
         */
        removeStep: function(value) {
            if(!isNullOrUndefined(value) && !isNullOrUndefined(this.settings.steps) && this.settings.steps.length > 0) {
                for(var i = 0; i < this.settings.steps.length; i++) {
                    if(this.settings.steps[i].value == value) {
                        this._deleteStep(this.settings.steps[i], i);
                        return;
                    }
                }
                // refresh steps
                this._updateSteps();
            }
        },

        // To call a call a pseudo private method:
        //this._pseudoPrivateMethod();

        /**
         * You can use the name convention functions started with underscore are
         * private. Really calls to functions starting with underscore are
         * filtered, for example:
         *
         *  @example
         *  $('#element').jqueryPlugin('_pseudoPrivateMethod');  // Will not work
         */

        // method that build progress bar HTML structure
        _buildBar: function() {
            this.$el.addClass('step-progressbar-container');
            if(this.settings.rounded)
                this.$el.addClass('step-progressbar-rounded');

            this.topLabelContainer = $('<div>');
            this.topLabelContainer.addClass('step-progressbar-toplabels');
            this.$el.append(this.topLabelContainer);

            this.barContainer = $('<div>');
            this.barContainer.addClass('step-progressbar-bar-wrapper');
            this.$el.append(this.barContainer);
            this.barElm = $('<span>');
            this.barElm.addClass('step-progressbar-bar');
            this.barContainer.append(this.barElm);
            this.progressElm = $('<span>');
            this.progressElm.addClass('step-progressbar-progress');
            this.barElm.append(this.progressElm);

            this.bottomLabelContainer = $('<div>');
            this.bottomLabelContainer.addClass('step-progressbar-bottomlabels');
            this.$el.append(this.bottomLabelContainer);
        },

        // method that build HTML steps wraper structure
        _buildStepsWrapper: function() {
            this.stepsWrapper = $('<span>');
            this.stepsWrapper.addClass('step-progressbar-steps-wrapper');
            this.barElm.append(this.stepsWrapper);
            this.stepsContainer = $('<span>');
            this.stepsContainer.addClass('step-progressbar-steps');
            this.stepsWrapper.append(this.stepsContainer);

            this.toplabelWrapper = $('<span>');
            this.toplabelWrapper.addClass('step-progressbar-labels-wrapper');
            this.topLabelContainer.append(this.toplabelWrapper);
            this.bottomlabelWrapper = $('<span>');
            this.bottomlabelWrapper.addClass('step-progressbar-labels-wrapper');
            this.bottomLabelContainer.append(this.bottomlabelWrapper);
        },

        // method that claculates current progress value (in percent)
        _calcCurrentProgressValue: function() {
            if(isNullOrUndefined(this.settings.steps) || (this.settings.steps && this.settings.steps.length <= 0)) {
                this.progressValue = 100;
            } else {
                var minAndMax = this._retrieveMinAndMaxSteps();
                var minValue = minAndMax.minValue;
                var maxValue = minAndMax.maxValue;

                this.progressValue = getPercentValue(this.settings.currentValue, minValue, maxValue);
            }
            return this.progressValue;
        },

        // method that claculates steps progress value (in percent)
        _calcStepsProgressValues: function() {
            if(isNullOrUndefined(this.settings.steps) || (this.settings.steps && this.settings.steps.length <= 0)) {
                return;
            } else {
                var minAndMax = this._retrieveMinAndMaxSteps();
                var minValue = minAndMax.minValue;
                var maxValue = minAndMax.maxValue;

                for(var i = 0; i < this.settings.steps.length; i++) {
                    var step = this.settings.steps[i];

                    step.progressValue = getPercentValue(step.value, minValue, maxValue);
                }
                return this.settings.steps;
            }
        },

        // method that retreive min & max steps
        _retrieveMinAndMaxSteps: function() {
            if(isNullOrUndefined(this.settings.steps) || (this.settings.steps && this.settings.steps.length <= 0)) {
                return;
            } else {
                var minValue, maxValue, minStep, maxStep;
                for(var i = 0; i < this.settings.steps.length; i++) {
                    if(isNullOrUndefined(minStep)) {
                        minValue = this.settings.steps[i].value;
                        minStep = this.settings.steps[i];
                    }
                    if(isNullOrUndefined(maxStep)) {
                        maxValue = this.settings.steps[i].value;
                        maxStep = this.settings.steps[i];
                    }
                    if(this.settings.steps[i].value < minValue) {
                        minValue = this.settings.steps[i].value;
                        minStep = this.settings.steps[i];
                    }
                    if(this.settings.steps[i].value > maxValue) {
                        maxValue = this.settings.steps[i].value;
                        maxStep = this.settings.steps[i];
                    }
                }
                return {minValue: minValue, minStep: minStep, maxValue: maxValue, maxStep: maxStep};
            }
        },

        // method that finds the step which's following the current value
        _findNextStep: function() {
            if(isNullOrUndefined(this.settings.steps) || (this.settings.steps && this.settings.steps.length <= 0))
                return;
            else if(isNullOrUndefined(this.settings.currentValue)) {
                var minAndMax = this._retrieveMinAndMaxSteps();
                if(minAndMax.maxStep) {
                    this._setNextStep(minAndMax.maxStep);
                    return minAndMax.maxStep;
                } else if(minAndMax.minStep) {
                    this._setNextStep(minAndMax.minStep);
                    return minAndMax.minStep;
                } else
                    return;
            } else {
                var nextStep;
                for(var i = 0; i < this.settings.steps.length; i++) {
                    if(isNullOrUndefined(nextStep) && !isNullOrUndefined(this.settings.steps[i].value) && this.settings.steps[i].value > this.settings.currentValue)
                        nextStep = this.settings.steps[i];
                    else if(!isNullOrUndefined(nextStep) && !isNullOrUndefined(this.settings.steps[i].value) && this.settings.steps[i].value > this.settings.currentValue && this.settings.steps[i].value < nextStep.value)
                        nextStep = this.settings.steps[i];
                }
                if(!isNullOrUndefined(nextStep))
                    this._setNextStep(nextStep);

                return nextStep;
            }
        },

        // method that sets 'isNextStep' field depending on the provided step parameter
        _setNextStep: function(step) {
            if(isNullOrUndefined(this.settings.steps) || (this.settings.steps && this.settings.steps.length <= 0))
                return;
            for(var i = 0; i < this.settings.steps.length; i++) {
                this.settings.steps[i].isNextStep = false;
            }
            step.isNextStep = true;
        },

        // method that updates steps element in order to distinguish which one is corresponding to the next step
        _updateNextStepElm: function() {
            if(isNullOrUndefined(this.settings.steps) || (this.settings.steps && this.settings.steps.length <= 0))
                return;
            for(var i = 0; i < this.settings.steps.length; i++) {
                if(this.settings.steps[i].isNextStep == true && !isNullOrUndefined(this.settings.steps[i].stepElement)) {
                    this.settings.steps[i].stepElement.addClass('step-progressbar-nextstep');
                    this.settings.steps[i].topLabelElement.addClass('step-progressbar-nextstep');
                    this.settings.steps[i].bottomLabelElement.addClass('step-progressbar-nextstep');
                } else if((this.settings.steps[i].isNextStep == false || isNullOrUndefined(this.settings.steps[i].isNextStep)) && !isNullOrUndefined(this.settings.steps[i].stepElement)) {
                    this.settings.steps[i].stepElement.removeClass('step-progressbar-nextstep');
                    this.settings.steps[i].topLabelElement.removeClass('step-progressbar-nextstep');
                    this.settings.steps[i].bottomLabelElement.removeClass('step-progressbar-nextstep');
                }
            }
        },

        // method that updates
        _updateSteps: function() {
            // sort steps
            this.settings.steps.sort(sortByValue);

            // remove duplicated steps
            this._mergeDuplicatedSteps();

            // calculate current progress value depending on steps
            this._updateProgress();

            // calculate steps progress values (in percent)
            this._calcStepsProgressValues();
            // find the step that follows the current progress value
            this._findNextStep();

            for(var i = 0; i < this.settings.steps.length; i++) {
                // for following method calls we suppose that steps are sorted, if it's not always the case we'll have to implementa sort function.

                // create progress bar step element
                this._buildStep(this.settings.steps[i], i);

                // create top label corresponding to that step
                this._buildTopLabel(this.settings.steps[i], i);

                // create bottom label corresponding to that step
                this._buildBottomLabel(this.settings.steps[i], i);
            }

            // update next step html classes
            this._updateNextStepElm();
        },

        // method that updates the bar progress value.
        _updateProgress: function() {
            if(this.progressElm)
                this.progressElm.css('width', this._calcCurrentProgressValue() + '%');
        },

        // method that build a step element. (index is useful to add special classes for 1st and last steps)
        _buildStep: function(step, index) {
            if(isNullOrUndefined(step) || (!isNullOrUndefined(step) && isNullOrUndefined(step.progressValue)))
                return;

            if(isNullOrUndefined(step.stepElement)) {
                var stepElm = $('<span>');
                stepElm.addClass('step-progressbar-step');
                this.stepsContainer.append(stepElm);
                step.stepElement = stepElm;
            }
            // following removeClass are useful just for step update
            step.stepElement.removeClass('step-progressbar-firststep');
            step.stepElement.removeClass('step-progressbar-laststep');
            if(index == 0)
                step.stepElement.addClass('step-progressbar-firststep');
            if(index == this.settings.steps.length - 1)
                step.stepElement.addClass('step-progressbar-laststep');
            step.stepElement.css('left', step.progressValue + '%');
        },

        // method that delete HTML elements for a step.
        _deleteStep: function(step, index) {
            if(isNullOrUndefined(step))
                return;

            if(step.stepElement)
                step.stepElement.remove();
            if(step.topLabelElement)
                step.topLabelElement.remove();
            if(step.bottomLabelElement)
                step.bottomLabelElement.remove();

            this.settings.steps.splice(index, 1);
            delete step;
        },

        // method that detects duplicated steps and merges them
        _mergeDuplicatedSteps: function() {
            var duplicatedSteps = [];

            // sort steps for faster duplication detection
            this.settings.steps.sort(sortByValue);

            for(var i = 0; i < this.settings.steps.length - 1; i++) {
                if(this.settings.steps[i].value == this.settings.steps[i + 1].value) {
                    var mergedStep = this._mergeSteps(this.settings.steps[i], this.settings.steps[i + 1]);
                    this.settings.steps[i] = mergedStep;
                    this.settings.steps[i + 1] = mergedStep;
                    duplicatedSteps.push(i + 1);
                }
            }

            if(!isNullOrUndefined(duplicatedSteps) && duplicatedSteps.length > 0) {
                // we sort indexes by descendant order to use the splice() correctly method to remove duplicated steps
                duplicatedSteps.sort();
                duplicatedSteps.reverse();
                for(var j = 0; j < duplicatedSteps.length; j++) {
                    this.settings.steps.splice(duplicatedSteps[j], 1);
                }
            }
        },

        // method that gives the result of the two given steps merge
        _mergeSteps: function(step1, step2) {
            if(isNullOrUndefined(step1) && isNullOrUndefined(step2))
                return;
            if(isNullOrUndefined(step1) && !isNullOrUndefined(step2))
                return step2;
            if(!isNullOrUndefined(step1) && isNullOrUndefined(step2))
                return step1;

            var mergedStep = {};
            if(!isNullOrUndefined(this.stepFields) && this.stepFields.length >= 0) {
                for(var i = 0; i < this.stepFields.length; i++) {
                    var field = this.stepFields[i];
                    mergedStep[field] = step1[field] ? step1[field]  : step2[field];
                }
            }
            return mergedStep;
        },

        // method that builds the topLabel element. (index is useful to add special classes for 1st and last steps)
        _buildTopLabel: function(step, index) {
            if(isNullOrUndefined(step) || (!isNullOrUndefined(step) && isNullOrUndefined(step.progressValue)))
                return;

            if(isNullOrUndefined(step.topLabelElement)) {
                var topLabelElm = $('<span>');
                topLabelElm.addClass('step-progressbar-steplabel');
                this.toplabelWrapper.append(topLabelElm);
                step.topLabelElement = topLabelElm;
            }
            // following removeClass are useful just for step update
            step.topLabelElement.removeClass('step-progressbar-firststep');
            step.topLabelElement.removeClass('step-progressbar-laststep');
            if(index == 0)
                step.topLabelElement.addClass('step-progressbar-firststep');
            if(index == this.settings.steps.length - 1)
                step.topLabelElement.addClass('step-progressbar-laststep');
            step.topLabelElement.css('left', step.progressValue + '%');
            var label = step.topLabel ? step.topLabel : (!isNullOrUndefined(step.value) ? (step.value + this.settings.unit) : '');
            step.topLabelElement.html(label);
        },

        // method that builds the bottomLabel element. (index is useful to add special classes for 1st and last steps)
        _buildBottomLabel: function(step, index) {
            if(isNullOrUndefined(step) || (!isNullOrUndefined(step) && isNullOrUndefined(step.progressValue)))
                return;

            if(isNullOrUndefined(step.bottomLabelElement)) {
                var bottomLabelElm = $('<span>');
                bottomLabelElm.addClass('step-progressbar-steplabel');
                this.bottomlabelWrapper.append(bottomLabelElm);
                step.bottomLabelElement = bottomLabelElm;
            }
            // following removeClass are useful just for step update
            step.bottomLabelElement.removeClass('step-progressbar-firststep');
            step.bottomLabelElement.removeClass('step-progressbar-laststep');
            if(index == 0)
                step.bottomLabelElement.addClass('step-progressbar-firststep');
            if(index == this.settings.steps.length - 1)
                step.bottomLabelElement.addClass('step-progressbar-laststep');
            step.bottomLabelElement.css('left', step.progressValue + '%');
            step.bottomLabelElement.html(step.bottomLabel);
        }
    };

    /**
     * These are real private methods. A plugin instance has access to them
     * @return {[type]}
     */

    //
    var isNullOrUndefined = function(variable) {
        return (variable === null || variable === undefined);
    };

    //
    var getPercentValue = function(value, min, max) {
        if(isNullOrUndefined(value))
            return undefined;
        else {
            if(isNullOrUndefined(min) && isNullOrUndefined(max))
                return 100;
            else if(isNullOrUndefined(min) && !isNullOrUndefined(max)) {
                if(value < max)
                    return 0;
                else
                    return 100;
            } else if(isNullOrUndefined(max) && !isNullOrUndefined(min)) {
                if(value < min)
                    return 0;
                else
                    return 100;
            } else if(!isNullOrUndefined(min) && !isNullOrUndefined(max)) {
                if(value < min)
                    return 0;
                else if(value > max)
                    return 100;
                else
                   return (value - min) / (max - min) * 100;
            }
        }
    };

    // Closure to use to sort array by "value" field
    function sortByValue(a, b) {
      return a.value - b.value;
    };

    $.fn[pluginName] = function(options) {
        var args = arguments;

        if (options === undefined || typeof options === 'object') {
            // Creates a new plugin instance, for each selected element, and
            // stores a reference withint the element's data
            return this.each(function() {
                if (!$.data(this, 'plugin_' + pluginName)) {
                    $.data(this, 'plugin_' + pluginName, new StepProgressBar(this, options));
                }
            });
        } else if (typeof options === 'string' && options[0] !== '_' && options !== 'init') {
            // Call a public pluguin method (not starting with an underscore) for each
            // selected element.
            if ($.inArray(options, $.fn[pluginName].getters) !== -1) {
                // If the method allows to work as a getter then break the chainability so we can return a value
                // instead the element reference.
                var instance = $.data(this[0], 'plugin_' + pluginName);
                return instance[options].apply(instance, Array.prototype.slice.call(args, 1));
            } else {
                // Invoke the speficied method on each selected element
                return this.each(function() {
                    var instance = $.data(this, 'plugin_' + pluginName);
                    if (instance instanceof StepProgressBar && typeof instance[options] === 'function') {
                        instance[options].apply(instance, Array.prototype.slice.call(args, 1));
                    }
                });
            }
        }
    };

    /**
     * Names of the pluguin methods that can act as a getter method.
     * @type {Array}
     */
    $.fn[pluginName].getters = ['getCurrentValue', 'findStep'];

    /**
     * Default options
     */
    $.fn[pluginName].defaults = {
        currentValue    : 0, /* current progress value (does not have to be in percent) */
        steps           : [], /* all progression steps */
        rounded         : true, /* to switch between classic/rounded bar */
        unit            : '', /* values unit */
        responsiveLimit : 480, /* bound value below which the progressbar has to be adapted */
        progressLabel   : function(currentValue, maxValue, minValue, percentValue) {
            return (percentValue + '%');
        }, /* in order to customize label that will be displayed on progress bar. */
        progressFill    : undefined /* if we want to fill progress bar with animated gradient for ex. */
    };

}(jQuery));


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Annls mycol. 28: 91 (1930)

#### Original name
Oxydothis poliothea Syd.

### Remarks
null


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="About Sing Your Creativity. Mission and Team.">
    <meta name="author" content="Sylvester Klirowski">

    <title>Sing Your Creativity</title>

    <link rel="stylesheet" href="../css/bootstrap.min.css" type="text/css">

    <link href='http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Merriweather:400,300,300italic,400italic,700,700italic,900,900italic' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="../font-awesome/css/font-awesome.min.css" type="text/css">

    <link rel="stylesheet" href="../css/animate.css" type="text/css">

    <link rel="stylesheet" href="../css/creative.css" type="text/css">

    <link rel="stylesheet" href="../css/custom.css" type="text/css">

    <link rel="icon" type="image/png" href="../img/logos/SYC-logo.png"/>

                <button type="button" class="navbar-toggle collapsed alternate" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                    Toggle navigation

                </button>
                 Sing Your Creativity

                    Services

Teambuilding

Individual Therapeutic Singing

Workshop / Singing Together

Conducting Choirs

Music Samples

Events

                    About Us

Our Mission

Team

Media

Contact

                    Register

            x

                        "I believe that singing is the most fun, healthy, effective and easy method to connect with ourselves and people around us. It releases stress and unlocks our natural potential to think creatively. My mission is to share my passion and my experience with my students the participants of SYC workshops!" ~ Eva Klirowska

 Eva is a professional singer, choir conductor and teacher. She has 23 years of experience in teaching music to adults and adolescents. Over her career she has performed in the USA, Switzerland and Poland. She practices singing with
                        passion and uses it as therapy.

Facilitator of therapeutic singing workshops

Singing together for your well-being

Cultural district of the Malevoz hospital in Monthey (since March 2017)

HEP  College of Pedagogy  in St-Maurice, (since September 2017)

Body awareness through singing

Cultural district of the Malevoz hospital in Monthey (since October 2017)

Teacher

"Sing Your Creativity" in Monthey (since 2010)

"The Source" Music School in Renens, VD (1998-2003)

"EJMA Valais" Music School in Martigny, VS (2003-2005)

"Alfa" Music School in Sion, VS (2005-2010)

Individual voice lessons

Choir Conductor

"Mixed Choir of Morgins" in Morgins, VS (since 2010)

"Esperance" in Troistorrents, VS (since 2008)

"Choeur d'Hommes" in Val d'illiez, VS (since 2014)

"Savièse Chante "in Savièse, VS (2000-2007)

"Polyphonia" in Vernayaz, VS (2000-2002)

Regular practice sessions and extensive performing

Les Divadevas

Founder of the vocal group "Les Divadevas" (2003 - 2020)

Musical Education

Vocal training and classical music studies at the Nowowiejski Music Conservatory in Szczecin, Poland (1984-1989)

Jazz studies at Berklee College of Music in Boston, USA (1993-1997)

Dance Background

Dancer in a youth dance group "Rytm" in Poland (1975-1986)

(Extensive performing and winners in consecutive annual national competitions)

                        "Each time I review videos made for Sing Your Creativity, I'm amazed at how people get involved and work together with such positive energy although they seldom know one another! It really has a powerful impact on teams." ~ Olivier Gallen

 After managing IT Purchasing projects for international companies for over 10 years, Olivier decided to follow his passion in photography, media and hiking. He is now focusing on what makes people find their inner passion and
                        how they can use that in their personal and professional life.

Olivier's Profile

Olivier's Gallery

                        "Having spent ample time in numerous groups and corporate settings, I've come to understand the importance of team-building seminars. SYC provides a very unique experience in that it brings music into the mix." ~ Sylvester Klirowski

 With a background in computer science, over the past decade Sylvester has been involved in many areas of the software industry, from Analyst to Consulting to Sales. More recently he has transitioned to web and application development,
                        which he finds fascinating and exciting.

Sylvester's Website

Sylvester's Profile

                        "Lawyer by day and dancer by night, I trade my work clothes for dance gear every day. As such, I strongly believe that art and music not only allows us to stay balanced, but also brings the best out of us. This is what SYC does so well - it enables everyone to connect with their inner Artist, and is perfectly adapted for our work environment." ~ Marlena Wisniak

 With a background in law and international relations, Marlena practiced law at a Geneva-based firm, where she advised private sector actors and non profits in their support for public interest. Currently working in Human Rights
                        and international development, she is also a professional dancer and has 10 years of experience in teaching. Seeing SYC as an opportunity to combine work and leisure as a means towards self-fulfillment, she greatly supports its
                        mission.

Marlena's Profile

Our mission

At SYC, we strongly believe that success is measured not by individual performance, but by how well we perform and interact collectively. Our mission is to bring music into the interaction process, as it is one of the best platforms
                        for human connectivity.

Meet our team

                                Eva Klirowska

                                Program Coordinator

                                Olivier Gallen

                                Media Producer

                                Sylvester Klirowski

                                Web Designer

                                Marlena Wisniak

                                Legal Advisor


text:
package com.interview.problems.cake.builder;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * @author "Jigar Gosalia"
 *
 */
public class QualityFactorHolder {

	/**
	 *
	 */
	private static Map<String, String> qualityFactorMap = new LinkedHashMap<String, String>();

	/**
	 * @return
	 */
	public static Map<String, String> getQualityFactorMap() {
		return qualityFactorMap;
	}

	// Static Block to have pre-defined quality factors
	static {
		qualityFactorMap.put("fco", "1");
		qualityFactorMap.put("ocf", "2");
		qualityFactorMap.put("cfo", "3");
		qualityFactorMap.put("cof", "4");
		qualityFactorMap.put("ofc", "5");
		qualityFactorMap.put("foc", "6");
		qualityFactorMap.put("ocsrf", "7");
		qualityFactorMap.put("focsr", "8");
		qualityFactorMap.put("fcosr", "9");
		qualityFactorMap.put("fcsor", "10");
		qualityFactorMap.put("chf", "11");
		qualityFactorMap.put("NONE", "New Combination, so no quality factor found");
	}
}


text:
require 'litexbrl/tdnet/account_item'
require 'litexbrl/tdnet/summary_attribute'
require 'litexbrl/tdnet/results_forecast_attribute'
require 'litexbrl/tdnet/company_attribute'
require 'litexbrl/tdnet/financial_information'
require 'litexbrl/tdnet/summary'
require 'litexbrl/tdnet/results_forecast'
require 'litexbrl/tdnet/financial_information2'
require 'litexbrl/tdnet/summary2'
require 'litexbrl/tdnet/results_forecast2'
require 'litexbrl/tdnet/cash_flow2'

module LiteXBRL
  module TDnet

    class << self

      def parse(path)
        doc = File.open(path) {|f| Nokogiri::XML f }
        read doc
      end

      def parse_string(str)
        doc = Nokogiri::XML str
        read doc
      end

      def parse_cash_flow(str)
        doc = Nokogiri::XML str
        CashFlow2.read doc
      end

      private

      def read(doc)
        document = find_reader doc

        document.read doc
      end

      def find_reader(doc)
        namespaces = doc.namespaces

        # TODO 委嬢する?
        if summary? namespaces
          Summary
        elsif summary2? namespaces
          Summary2
        elsif results_forecast? namespaces
          ResultsForecast
        elsif results_forecast2? namespaces
          ResultsForecast2
        else
          raise StandardError.new "ドキュメントがありません"
        end
      end

      def summary?(namespaces)
        namespaces.keys.any? {|ns| /tdnet-.+(jpsm|ussm|ifsm)/ =~ ns }
      end

      def summary2?(namespaces)
        namespaces.keys.any? {|ns| /tse-.+(jpsm|ussm|ifsm)/ =~ ns }
      end

      def results_forecast?(namespaces)
        namespaces.keys.any? {|ns| /tdnet-rvfc/ =~ ns }
      end

      def results_forecast2?(namespaces)
        namespaces.keys.any? {|ns| /tse-rvfc/ =~ ns }
      end

    end

  end
end


text:
package falgout.backup;

public enum StandardSyntax implements Syntax {
    GLOB, REGEX;

    @Override
    public String toString() {
        return super.toString().toLowerCase();
    }
}


text:
def test_post(request):
    if 'upload' in request.files:
        if "image/jpeg" == request.get_upload_type('upload'):
            with open("static/upload.jpg", 'wb') as f:
                f.write(request.get_upload_content('upload'))
            return """<img src="/static/upload.jpg">"""
    return """<form method="post" enctype="multipart/form-data">
<input type="file" name="upload">
<input type="submit">
</form>"""


text:
#import "SLTBoardLayer_Private.h"

@implementation SLTBoardLayer

@synthesize token = _token;
@synthesize index = _index;

-(id) initWithToken:(NSString*)theToken andLayerIndex:(NSInteger)theLayerIndex
{
    self = [super init];
    if (self) {
        _token = theToken;
        _index = theLayerIndex;
    }
    return self;
}

-(void) regenerate
{
    //override
}

@end


text:
void smmOutputAst(PSmmAstNode module, FILE* f, PIbsAllocator a);

#endif


text:
class PrioritiesController < ApplicationController
  before_filter :authenticateAdmin

  # GET /priorities
  # GET /priorities.json
  def index
    @priorities = Priority.all

    respond_to do |format|
      format.html # index.html.erb
      format.json { render json: @priorities }
    end
  end

  # GET /priorities/1
  # GET /priorities/1.json
  def show
    @priority = Priority.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.json { render json: @priority }
    end
  end

  # GET /priorities/new
  # GET /priorities/new.json
  def new
    @priority = Priority.new

    respond_to do |format|
      format.html # new.html.erb
      format.json { render json: @priority }
    end
  end

  # GET /priorities/1/edit
  def edit
    @priority = Priority.find(params[:id])
  end

  # POST /priorities
  # POST /priorities.json
  def create
    @priority = Priority.new(params[:priority])

    respond_to do |format|
      if @priority.save
        format.html { redirect_to @priority, notice: 'Priority was successfully created.' }
        format.json { render json: @priority, status: :created, location: @priority }
      else
        format.html { render action: "new" }
        format.json { render json: @priority.errors, status: :unprocessable_entity }
      end
    end
  end

  # PUT /priorities/1
  # PUT /priorities/1.json
  def update
    @priority = Priority.find(params[:id])

    respond_to do |format|
      if @priority.update_attributes(params[:priority])
        format.html { redirect_to @priority, notice: 'Priority was successfully updated.' }
        format.json { head :no_content }
      else
        format.html { render action: "edit" }
        format.json { render json: @priority.errors, status: :unprocessable_entity }
      end
    end
  end

  # DELETE /priorities/1
  # DELETE /priorities/1.json
  def destroy
    @priority = Priority.find(params[:id])
    @priority.destroy

    respond_to do |format|
      format.html { redirect_to priorities_url }
      format.json { head :no_content }
    end
  end
end


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<TITLE>
ClassBasedVertexFactory (JGraphT : a free Java graph library)
</TITLE>

<META NAME="date" CONTENT="2012-01-19">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD

org.jgrapht.graph

Class ClassBasedVertexFactory<V>

java.lang.Object
  org.jgrapht.graph.ClassBasedVertexFactory<V>

All Implemented Interfaces:
VertexFactory<V>

public class ClassBasedVertexFactory<V>
extends java.lang.Object
implements VertexFactory<V>

A VertexFactory for producing vertices by using a class as a factory.

Since:

July 5, 2007

Author:

Guillaume Boulmier

Constructor Summary

ClassBasedVertexFactory(java.lang.Class<? extends V> vertexClass)

Method Summary

 V
createVertex()

          Creates a new vertex.

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

ClassBasedVertexFactory

public ClassBasedVertexFactory(java.lang.Class<? extends V> vertexClass)

Method Detail

createVertex

public V createVertex()

Description copied from interface: VertexFactory

Creates a new vertex.

Specified by:
createVertex in interface VertexFactory<V>

Returns:
the new vertex
See Also:
VertexFactory.createVertex()

      Overview
      Package
    Class
      Tree
      Deprecated
      Index
      Help

 PREV CLASS
 NEXT CLASS

  FRAMES
 NO FRAMES

  All Classes

  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD


text:
typedef void(^BWKRequestCompletionHandler)(BWKResponse *response);

@interface BWKRequest : NSObject

@property (strong, nonatomic) NSURL *url;

+ (BWKRequest *)requestWithURL:(NSString *)stringURL;
- (void)sendAsync:(BWKRequestCompletionHandler)completion;

@end


text:
import argparse
import sys
import Uploader

my_parser = argparse.ArgumentParser(
    description='XSVF file processor.',
    epilog='Parameters can be in a file, one per line, using @"file name"',
    fromfile_prefix_chars='@')
my_parser.add_argument(
    '-v', '--version',
    action='version',
    version='%(prog)s version 1.0.0')
my_parser.add_argument(
    '-d', '--debug',
    default=1,
    type=int,
    help='Debug verbosity'
         ' (type %(type)s, default=%(default)s)')
my_parser.add_argument(
    '-i', '--iterations',
    default=3,
    type=int,
    help='Number of iterations'
         ' (type %(type)s, default=%(default)s)')

def main():
    Uploader.Uploader.add_arguments(my_parser)
    args = my_parser.parse_args()
    u = Uploader.Uploader(args)
    fileNameList = []
    for i in range(0, args.iterations):
        fileNameList.append(open("/dev/zero", mode='r'))
    u.upload_all_files(fileNameList)
    error_code = u.error_code
    sys.exit(error_code)

if __name__ == '__main__':
    main()


text:
/*!
 * Copyright (c) 2015 by Contributors
 * \file dropout-inl.h
 * \brief
 * \author Bing Xu, Da Zheng, Hang Zhang
*/

#ifndef MXNET_OPERATOR_NN_DROPOUT_INL_H_
#define MXNET_OPERATOR_NN_DROPOUT_INL_H_
#include <dmlc/logging.h>
#include <dmlc/parameter.h>
#include <mxnet/operator.h>
#include <map>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include "../mxnet_op.h"
#include "../mshadow_op.h"
#include "../random/sampler.h"
#include "../tensor/elemwise_binary_broadcast_op.h"

#if (MSHADOW_USE_MKL == 1) && defined(_OPENMP) && !defined(__CUDACC__)
#define MXNET_USE_MKL_DROPOUT 1
#endif

#if MXNET_USE_MKL_DROPOUT
#include <omp.h>

#include <mkl_vml_functions.h>
#include <mkl_vsl.h>
#endif  // MXNET_USE_MKL_DROPOUT

#define MXNET_USE_CUDNN_DROPOUT MXNET_USE_CUDNN == 1 && CUDNN_MAJOR >= 7

namespace dropout {
enum DropoutOpInputs {kData};
enum DropoutOpOutputs {kOut, kMask};
enum DropoutOpForwardResource {kRandom};
enum DropoutOpMode {kTraining, kAlways};
}  // namespace dropout

namespace mxnet {
namespace op {

const int MAX_DIM = 5;

struct DropoutParam : public dmlc::Parameter<DropoutParam> {
  float p;
  int mode;
  mxnet::TShape axes;
  dmlc::optional<bool> cudnn_off;
  DMLC_DECLARE_PARAMETER(DropoutParam) {
    DMLC_DECLARE_FIELD(p).set_default(0.5)
    .set_range(0, 1)
    .describe("Fraction of the input that gets dropped out during training time.");
    DMLC_DECLARE_FIELD(mode)
    .add_enum("training", dropout::kTraining)
    .add_enum("always", dropout::kAlways)
    .set_default(dropout::kTraining)
    .describe("Whether to only turn on dropout during training or to also turn on for inference.");
    DMLC_DECLARE_FIELD(axes).set_default(mxnet::TShape(0, 0))
    .describe("Axes for variational dropout kernel.");
    DMLC_DECLARE_FIELD(cudnn_off).set_default(dmlc::optional<bool>(false))
    .describe("Whether to turn off cudnn in dropout operator. "
              "This option is ignored if axes is specified.");
  }
};  // struct DropoutParam

template<typename xpu, typename DType>
class DropoutOp {
#if MXNET_USE_MKL_DROPOUT
  static void BernoulliGenerate(common::random::RandGenerator<cpu, DType> gen,
                                int n, double p, int* r) {
    typename RandGenerator<xpu, DType>::Impl genImpl(&gen, 1);
    const int seed = 17 + abs(genImpl.rand() % 4096);
    CHECK_GE(seed, 0);
    const int nthr = engine::OpenMP::Get()->GetRecommendedOMPThreadCount();
#pragma omp parallel num_threads(nthr)
    {
      const int ithr = omp_get_thread_num();
      const int avg_amount = (n + nthr - 1) / nthr;
      const int my_offset = ithr * avg_amount;
      const int my_amount = std::min(my_offset + avg_amount, n) - my_offset;
      if (my_amount > 0) {
        VSLStreamStatePtr stream;
        vslNewStream(&stream, VSL_BRNG_MCG31, seed);
        vslSkipAheadStream(stream, my_offset);
        viRngBernoulli(VSL_RNG_METHOD_BERNOULLI_ICDF, stream, my_amount, r + my_offset, p);
        vslDeleteStream(&stream);
      }
    }
  }
  static inline bool MKLAvailable() {
    // BernoulliGenerate expects an array int, so for types smaller than int, the mask buffer
    // will be too small, so we can;t use MKL in those cases
    return sizeof(DType) >= sizeof(int);
  }

  // MKL forward pass
  inline void MKLForward(const OpContext &ctx,
                         const std::vector<TBlob> &in_data,
                         const std::vector<TBlob> &out_data) {
    Stream<xpu> *s = ctx.get_stream<xpu>();
    RandGenerator<xpu, DType> *pgen = ctx.requested[0].get_parallel_random<xpu, DType>();
    CHECK_NOTNULL(pgen);
    Tensor<xpu, 2, DType> mask = out_data[dropout::kMask].FlatTo2D<xpu, DType>(s);
    Tensor<xpu, 2, DType> data = in_data[dropout::kData].FlatTo2D<xpu, DType>(s);
    Tensor<xpu, 2, DType> out = out_data[dropout::kOut].FlatTo2D<xpu, DType>(s);
    DType *outptr = out.dptr_;
    DType *dataptr = data.dptr_;
    auto maskptr = reinterpret_cast<int *>(mask.dptr_);
    int count = mask.shape_[0] * mask.shape_[1];
    if (sizeof(DType) > sizeof(int)) {
      // allocating new buffer to avoiding memory overlapping between `mask.dptr_` and `maskptr`
      Tensor<xpu, 1, int> temp = ctx.requested[1].get_space_typed<xpu, 1, int>(Shape1(count), s);
      maskptr = temp.dptr_;
    }
    BernoulliGenerate(*pgen, count, this->pkeep_, maskptr);
    const float pk_1 = 1.0f / this->pkeep_;
#pragma omp parallel for num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount())
    for (int i = 0; i < count; ++i) {
      const DType maskVal = static_cast<DType>(maskptr[i]) * pk_1;
      outptr[i] = dataptr[i] * maskVal;
      mask.dptr_[i] = maskVal;
    }
  }

  // MKL backward pass
  inline void MKLBackward(const OpContext &ctx,
                          const std::vector<TBlob> &in_grad,
                          const std::vector<TBlob> &out_data,
                          const std::vector<TBlob> &out_grad) {
    Stream<xpu> *s = ctx.get_stream<xpu>();
    Tensor<xpu, 2, DType> grad = out_grad[dropout::kOut].FlatTo2D<xpu, DType>(s);
    Tensor<xpu, 2, DType> mask = out_data[dropout::kMask].FlatTo2D<xpu, DType>(s);
    Tensor<xpu, 2, DType> gdata = in_grad[dropout::kData].FlatTo2D<xpu, DType>(s);
    DType *ingradptr = gdata.dptr_;
    const DType *outgradptr = grad.dptr_;
    const DType *maskptr = mask.dptr_;
    const int count = mask.shape_[0] * mask.shape_[1];
#pragma omp parallel for num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount())
    for (int i = 0; i < count; ++i) {
      ingradptr[i] = outgradptr[i] * maskptr[i];
    }
  }

#endif  // #if MXNET_USE_MKL_DROPOUT

 public:
  /*!
   * \brief Dropout kernel, compute dropout tensor
   */
  struct DropoutKernel {
    /*!
     * \brief Dropout kernel function
     * \param id Thread number (0-based representing count)
     * \param gen Random number generator
     * \param N Total number of items in the output
     * \param step Step between items, related to parallelism
     * \param dropout_out Output dropout values
     * \param mask_out  Output mask (is multiplied to create dropout output, may be 0)
     * \param input_data Input data to perform the dropout on
     * \param pkeep Dropout rate (keep when the generated random number is less than this value)
     */
    MSHADOW_XINLINE static void Map(index_t id,
                                    RandGenerator<xpu, DType> gen,
                                    const index_t N,
                                    const index_t step,
                                    DType *dropout_out,
                                    DType *mask_out,
                                    const DType *input_data,
                                    const real_t pkeep) {
      RNG_KERNEL_LOOP(xpu, DType, id, gen, N, step, {
        const real_t rand_num = static_cast<real_t>(genImpl.uniform());
        mask_out[i] = mshadow_op::threshold_eq::Map<real_t>(rand_num, pkeep) * (1.0f / pkeep);
        dropout_out[i] = input_data[i] * mask_out[i];
      });
    }
  };
  struct BernoulliKernel {
    /*! \brief Bernoulli kernel for generating mask */
    MSHADOW_XINLINE static void Map(index_t id,
                                    RandGenerator<xpu, DType> gen,
                                    const index_t N,
                                    const index_t step,
                                    DType *mask_out,
                                    const real_t pkeep) {
      RNG_KERNEL_LOOP(xpu, DType, id, gen, N, step, {
        const real_t rand_num = static_cast<real_t>(genImpl.uniform());
        mask_out[i] = mshadow_op::threshold::Map<real_t>(rand_num, pkeep) * (1.0f / pkeep);
      });
    }
  };

  explicit DropoutOp(const DropoutParam &param, Context ctx) {
    this->pkeep_ = 1.0f - param.p;
    this->mode_ = static_cast<dropout::DropoutOpMode>(param.mode);
    this->axes_ = param.axes;
    this->dropout_passthrough_ = true;
#if MXNET_USE_CUDNN_DROPOUT
    this->cudnn_off_ = param.cudnn_off && param.cudnn_off.value();
    this->ctx_ = ctx;
    if (ctx.dev_type == kGPU && this->pkeep_ > 0 && !this->cudnn_off_) {
      dtype_ = mshadow::DataType<DType>::kCudnnFlag;
      CUDNN_CALL(cudnnCreateTensorDescriptor(&x_desc_));
      CUDNN_CALL(cudnnCreateTensorDescriptor(&y_desc_));
      CUDNN_CALL(cudnnCreateTensorDescriptor(&dx_desc_));
      CUDNN_CALL(cudnnCreateTensorDescriptor(&dy_desc_));
    }
#endif  // MXNET_USE_CUDNN_DROPOUT
  }

  ~DropoutOp() {
#if MXNET_USE_CUDNN_DROPOUT
    if (this->ctx_.dev_type == kGPU && this->pkeep_ > 0 && !this->cudnn_off_) {
      CUDNN_CALL(cudnnDestroyTensorDescriptor(x_desc_));
      CUDNN_CALL(cudnnDestroyTensorDescriptor(y_desc_));
      CUDNN_CALL(cudnnDestroyTensorDescriptor(dx_desc_));
      CUDNN_CALL(cudnnDestroyTensorDescriptor(dy_desc_));
    }
#endif  // MXNET_USE_CUDNN_DROPOUT
  }

#if MXNET_USE_CUDNN_DROPOUT && defined(__CUDACC__)
  inline bool CuDNNAvailable() {
    return this->pkeep_ > 0 && !this->cudnn_off_;
  }

  inline void CuDNNForward(const OpContext &ctx,
                           const TBlob &in,
                           const TBlob &mask,
                           const TBlob &out) {
      Stream<xpu> *s = ctx.get_stream<xpu>();

      // set dropout state.
      ctx.requested[0].get_cudnn_dropout_desc(&dropout_desc_, s, 1.0f - this->pkeep_, seed_);

      // describe input/output tensor
      int dim[4], stride[4];
      dim[0] = 1;
      dim[1] = 1;
      dim[2] = 1;
      dim[3] = out.Size();
      stride[0] = out.Size();
      stride[1] = out.Size();
      stride[2] = out.Size();
      stride[3] = 1;
      CUDNN_CALL(cudnnSetTensorNdDescriptor(x_desc_,
                                            dtype_,
                                            4,
                                            dim,
                                            stride));
      CUDNN_CALL(cudnnSetTensorNdDescriptor(y_desc_,
                                            dtype_,
                                            4,
                                            dim,
                                            stride));

      // perform dropout with cudnn
      CUDNN_CALL(cudnnDropoutGetReserveSpaceSize(x_desc_, &dropout_reserve_byte_));
      // cudnn uses bits to record the positions that are dropped, so reserve bytes is always
      // 1/8 of input size.
      CHECK_GE(mask.Size() * sizeof(DType), dropout_reserve_byte_) <<
        "The size of the mask space is smaller than the required cudnn reserved space.";
      CUDNN_CALL(cudnnDropoutForward(s->dnn_handle_,
                                     dropout_desc_,
                                     x_desc_,
                                     in.dptr<DType>(),
                                     y_desc_,
                                     out.dptr<DType>(),
                                     mask.dptr<DType>(),
                                     dropout_reserve_byte_));
  }

  inline void CuDNNBackward(const OpContext &ctx,
                            const TBlob &out_grad,
                            const TBlob &mask,
                            const TBlob &in_grad) {
      Stream<xpu> *s = ctx.get_stream<xpu>();

      // describe input/output tensor
      int dim[4], stride[4];
      dim[0] = 1;
      dim[1] = 1;
      dim[2] = 1;
      dim[3] = in_grad.Size();
      stride[0] = in_grad.Size();
      stride[1] = in_grad.Size();
      stride[2] = in_grad.Size();
      stride[3] = 1;
      CUDNN_CALL(cudnnSetTensorNdDescriptor(dy_desc_,
                                            dtype_,
                                            4,
                                            dim,
                                            stride));
      CUDNN_CALL(cudnnSetTensorNdDescriptor(dx_desc_,
                                            dtype_,
                                            4,
                                            dim,
                                            stride));

      // perform dropout with cudnn
      CUDNN_CALL(cudnnDropoutBackward(s->dnn_handle_,
                                      dropout_desc_,
                                      dy_desc_,
                                      out_grad.dptr<DType>(),
                                      dx_desc_,
                                      in_grad.dptr<DType>(),
                                      mask.dptr<DType>(),
                                      dropout_reserve_byte_));
  }
#endif  // MXNET_USE_CUDNN_DROPOUT && defined(__CUDACC__)

  void Forward(const OpContext &ctx,
               const std::vector<TBlob> &in_data,
               const std::vector<OpReqType> &req,
               const std::vector<TBlob> &out_data) {
    this->dropout_passthrough_ = true;
    if (req[dropout::kOut] != kNullOp) {
      CHECK_EQ(in_data.size(), 1U);
      if (ctx.is_train) {
        CHECK_EQ(out_data.size(), 2U);
      }
      Stream<xpu> *s = ctx.get_stream<xpu>();
      const TBlob &in = in_data[dropout::kData];
      const TBlob &out = out_data[dropout::kOut];
      const TBlob &mask = out_data[dropout::kMask];
      if (this->pkeep_ < 1 && (ctx.is_train || this->mode_ == dropout::kAlways)) {
        this->dropout_passthrough_ = false;
        if (this->axes_.ndim() == 0) {
#if MXNET_USE_MKL_DROPOUT
          if (MKLAvailable()) {
            MKLForward(ctx, in_data, out_data);
            return;
          }
#endif  // MXNET_USE_MKL_DROPOUT
#if MXNET_USE_CUDNN_DROPOUT && defined(__CUDACC__)
          if (CuDNNAvailable()) {
            CuDNNForward(ctx, in, mask, out);
            return;
          }
#endif  // MXNET_USE_CUDNN_DROPOUT && defined(__CUDACC__)
          RandGenerator<xpu, DType> *pgen = ctx.requested[0].get_parallel_random<xpu, DType>();
          CHECK_NOTNULL(pgen);
          CHECK(req[dropout::kOut] != kAddTo);
          LaunchRNG<DropoutKernel, xpu>(s, pgen, out.Size(),
                                        out.dptr<DType>(),
                                        mask.dptr<DType>(),
                                        in.dptr<DType>(),
                                        this->pkeep_);
          return;
        } else {
          RandGenerator<xpu, DType> *pgen = ctx.requested[0].get_parallel_random<xpu, DType>();
          CHECK_NOTNULL(pgen);
          // initialize the mask
          LaunchRNG<BernoulliKernel, xpu>(s, pgen, mask.Size(),
                                          mask.dptr<DType>(),
                                          this->pkeep_);
          // broadcast mul
          mxnet::TShape new_lshape, new_rshape, new_oshape;
          int ndim = BinaryBroadcastShapeCompact(in.shape_,
                                                 mask.shape_, out.shape_,
                                                 &new_lshape, &new_rshape, &new_oshape);
          if (!ndim) {
            MXNET_ASSIGN_REQ_SWITCH(req[dropout::kOut], Req, {
              mxnet_op::Kernel<mxnet_op::op_with_req<mshadow_op::mul, Req>, xpu>::Launch(
                s, out.Size(), out.dptr<DType>(), in.dptr<DType>(),
                mask.dptr<DType>());
            });
          } else {
            BROADCAST_NDIM_SWITCH(ndim, NDim, {
              mshadow::Shape<NDim> oshape = new_oshape.get<NDim>();
              mshadow::Shape<NDim> lstride = mxnet_op::calc_stride(new_lshape.get<NDim>());
              mshadow::Shape<NDim> rstride = mxnet_op::calc_stride(new_rshape.get<NDim>());
              mxnet_op::Kernel<mxnet_op::binary_broadcast_kernel<NDim, mshadow_op::mul>, xpu>::
              template LaunchEx(s, new_oshape.Size(), req[dropout::kOut],
              lstride, rstride, oshape,
              in.dptr<DType>(),
              mask.dptr<DType>(), out.dptr<DType>());
            });
          }
        }
      } else {
        if (req[dropout::kOut] == kWriteInplace) return;

        MXNET_ASSIGN_REQ_SWITCH(req[dropout::kOut], Req, {
          mxnet_op::Kernel<mxnet_op::op_with_req<mshadow_op::identity, Req>, xpu>::Launch(
            s, out.Size(), out.dptr<DType>(), in.dptr<DType>());
        });
      }
    }
  }

  void Backward(const OpContext &ctx,
                const std::vector<TBlob> &out_grad,
                const std::vector<TBlob> &out_data,
                const std::vector<OpReqType> &req,
                const std::vector<TBlob> &in_grad) {
    using namespace mshadow;
    using namespace mshadow::expr;
    Stream<xpu> *s = ctx.get_stream<xpu>();
    if (!this->dropout_passthrough_) {
      this->dropout_passthrough_ = true;
      const TBlob &gdata = in_grad[dropout::kData];
      const TBlob &grad = out_grad[dropout::kOut];
      const TBlob &mask = out_data[dropout::kMask];
      if (this->axes_.ndim() == 0) {
#if MXNET_USE_MKL_DROPOUT
        if (MKLAvailable()) {
          MKLBackward(ctx, in_grad, out_data, out_grad);
          return;
        }
#endif  // MXNET_USE_MKL_DROPOUT
#if MXNET_USE_CUDNN_DROPOUT && defined(__CUDACC__)
        if (CuDNNAvailable()) {
          CuDNNBackward(ctx, grad, mask, gdata);
          return;
        }
#endif  // MXNET_USE_CUDNN_DROPOUT && defined(__CUDACC__)
        // standard case for dropout
        CHECK_EQ(grad.Size(), mask.Size());
        MXNET_ASSIGN_REQ_SWITCH(req[dropout::kData], Req, {
          mxnet_op::Kernel<mxnet_op::op_with_req<mshadow_op::mul, Req>, xpu>::Launch(
            s, gdata.Size(), gdata.dptr<DType>(), grad.dptr<DType>(), mask.dptr<DType>());
        });
        return;
      } else {
        // broardcast mul
        mxnet::TShape new_lshape, new_rshape, new_oshape;
        int ndim = BinaryBroadcastShapeCompact(grad.shape_,
                                               mask.shape_, gdata.shape_,
                                               &new_lshape, &new_rshape, &new_oshape);
        if (!ndim) {
          MXNET_ASSIGN_REQ_SWITCH(req[dropout::kData], Req, {
            mxnet_op::Kernel<mxnet_op::op_with_req<mshadow_op::mul, Req>, xpu>::Launch(
              s, gdata.Size(), gdata.dptr<DType>(), grad.dptr<DType>(), mask.dptr<DType>());
          });
        } else {
          BROADCAST_NDIM_SWITCH(ndim, NDim, {
            mshadow::Shape<NDim> oshape = new_oshape.get<NDim>();
            mshadow::Shape<NDim> lstride = mxnet_op::calc_stride(new_lshape.get<NDim>());
            mshadow::Shape<NDim> rstride = mxnet_op::calc_stride(new_rshape.get<NDim>());
            mxnet_op::Kernel<mxnet_op::binary_broadcast_kernel<NDim, mshadow_op::mul>, xpu>::
            template LaunchEx(s, new_oshape.Size(), req[0], lstride, rstride, oshape,
            grad.dptr<DType>(), mask.dptr<DType>(), gdata.dptr<DType>());
          });
        }
      }
    } else {
      const TBlob& gdata = in_grad[dropout::kData];
      const TBlob& grad = out_grad[dropout::kOut];
      MXNET_ASSIGN_REQ_SWITCH(req[dropout::kData], Req, {
        mxnet_op::Kernel<mxnet_op::op_with_req<mshadow_op::identity, Req>, xpu>::Launch(
          s, gdata.Size(), gdata.dptr<DType>(), grad.dptr<DType>());
      });
    }
  }

 private:
  /*! \brief Dropout rate (keep when the generated random number is less than this value) */
  real_t pkeep_;
  /*! \brief Dropout mode */
  dropout::DropoutOpMode mode_;
  /*! \brief Axes on which dropout mask is shared in the form of broadcast multiply */
  mxnet::TShape axes_;
  /*! \brief Flag to record whether forward is executed in pass-through mode */
  bool dropout_passthrough_;
#if MXNET_USE_CUDNN_DROPOUT
  bool cudnn_off_;
  Context ctx_;
  cudnnDataType_t dtype_;
  cudnnDropoutDescriptor_t dropout_desc_;
  uint64_t seed_ = 17 + rand() % 4096;  // NOLINT(runtime/threadsafe_fn)
  size_t dropout_reserve_byte_;
  cudnnTensorDescriptor_t x_desc_, y_desc_, dx_desc_, dy_desc_;
#endif  // MXNET_USE_CUDNN_DROPOUT
};  // class DropoutOp

template<typename xpu>
void DropoutCompute(const OpStatePtr& state,
                    const OpContext& ctx,
                    const std::vector<TBlob>& inputs,
                    const std::vector<OpReqType>& req,
                    const std::vector<TBlob>& outputs) {
  MSHADOW_REAL_TYPE_SWITCH(inputs[0].type_flag_, DType, {
    DropoutOp<xpu, DType>& op = state.get_state<DropoutOp<xpu, DType>>();
    op.Forward(ctx, inputs, req, outputs);
  });
}

template<typename xpu>
void DropoutGradCompute(const OpStatePtr& state,
                        const OpContext& ctx,
                        const std::vector<TBlob>& inputs,
                        const std::vector<OpReqType>& req,
                        const std::vector<TBlob>& outputs) {
  CHECK_EQ(inputs.size(), 2U);
  CHECK_EQ(outputs.size(), 1);
  CHECK_EQ(req.size(), 1);
  std::vector<TBlob> out_grads(2);
  std::vector<TBlob> out_data(2);
  out_grads[dropout::kOut] = inputs[0];
  out_data[dropout::kMask] = inputs[1];

  MSHADOW_REAL_TYPE_SWITCH(inputs[0].type_flag_, DType, {
    DropoutOp<xpu, DType>& op = state.get_state<DropoutOp<xpu, DType>>();
    op.Backward(ctx, out_grads, out_data, req, outputs);
  });
}

}  // namespace op
}  // namespace mxnet

#endif  // MXNET_OPERATOR_NN_DROPOUT_INL_H_


text:
import { ConsumerHeartbeat } from '../../../src/lib/consumer/consumer-heartbeat';
import { promisifyAll } from 'bluebird';
import { getConsumer } from '../../common/consumer';
import { getRedisInstance } from '../../common/redis';
import {
  createQueue,
  defaultQueue,
} from '../../common/message-producing-consuming';
import { shutDownBaseInstance } from '../../common/base-instance';

describe('Consumer heartbeat: check online/offline consumers', () => {
  test('Case 1', async () => {
    const redisClient = await getRedisInstance();
    const HeartbeatAsync = promisifyAll(ConsumerHeartbeat);
    await createQueue(defaultQueue, false);
    const consumer = getConsumer();
    await consumer.runAsync();

    //
    const validHeartbeatIds = await HeartbeatAsync.getValidHeartbeatIdsAsync(
      redisClient,
    );

    expect(validHeartbeatIds.length).toBe(1);
    expect(validHeartbeatIds[0]).toBe(consumer.getId());

    //
    const validHeartbeats = await HeartbeatAsync.getValidHeartbeatsAsync(
      redisClient,
    );
    expect(validHeartbeats.length).toBe(1);
    const { consumerId: id2 } = validHeartbeats[0] ?? {};
    expect(id2).toBe(consumer.getId());

    //
    const expiredHeartbeatKeys =
      await HeartbeatAsync.getExpiredHeartbeatIdsAsync(redisClient);
    expect(expiredHeartbeatKeys.length).toBe(0);

    await shutDownBaseInstance(consumer);

    //
    const validHeartbeatKeys2 = await HeartbeatAsync.getValidHeartbeatIdsAsync(
      redisClient,
    );
    expect(validHeartbeatKeys2.length).toBe(0);

    //
    const validHeartbeats2 = await HeartbeatAsync.getValidHeartbeatsAsync(
      redisClient,
    );
    expect(validHeartbeats2.length).toBe(0);

    //
    const expiredHeartbeatKeys2 =
      await HeartbeatAsync.getExpiredHeartbeatIdsAsync(redisClient);
    expect(expiredHeartbeatKeys2.length).toBe(0);
  });
});


text:
package org.apache.hadoop.hdfs.server.namenode;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.StorageType;
import org.apache.hadoop.fs.XAttr;
import org.apache.hadoop.hdfs.DFSConfigKeys;
import org.apache.hadoop.hdfs.DFSTestUtil;
import org.apache.hadoop.hdfs.DistributedFileSystem;
import org.apache.hadoop.hdfs.HdfsConfiguration;
import org.apache.hadoop.hdfs.MiniDFSCluster;
import org.apache.hadoop.hdfs.MiniDFSCluster.DataNodeProperties;
import org.apache.hadoop.hdfs.protocol.HdfsConstants.StoragePolicySatisfierMode;
import org.apache.hadoop.hdfs.MiniDFSNNTopology;
import org.apache.hadoop.hdfs.server.balancer.NameNodeConnector;
import org.apache.hadoop.hdfs.server.common.HdfsServerConstants;
import org.apache.hadoop.hdfs.server.namenode.ha.HATestUtil;
import org.apache.hadoop.hdfs.server.namenode.sps.StoragePolicySatisfier;
import org.apache.hadoop.hdfs.server.sps.ExternalSPSContext;
import org.apache.hadoop.test.GenericTestUtils;
import org.junit.Test;

import java.util.function.Supplier;

import java.io.IOException;
import java.util.List;

import static org.apache.hadoop.hdfs.server.common.HdfsServerConstants.XATTR_SATISFY_STORAGE_POLICY;
import static org.junit.Assert.*;

/**
 * Test persistence of satisfying files/directories.
 */
public class TestPersistentStoragePolicySatisfier {
  private static Configuration conf;

  private static MiniDFSCluster cluster;
  private static DistributedFileSystem fs;
  private NameNodeConnector nnc;
  private StoragePolicySatisfier sps;
  private ExternalSPSContext ctxt;

  private static Path testFile =
      new Path("/testFile");
  private static String testFileName = testFile.toString();

  private static Path parentDir = new Path("/parentDir");
  private static Path parentFile = new Path(parentDir, "parentFile");
  private static String parentFileName = parentFile.toString();
  private static Path childDir = new Path(parentDir, "childDir");
  private static Path childFile = new Path(childDir, "childFile");
  private static String childFileName = childFile.toString();

  private static final String COLD = "COLD";
  private static final String WARM = "WARM";
  private static final String ONE_SSD = "ONE_SSD";

  private static StorageType[][] storageTypes = new StorageType[][] {
      {StorageType.DISK, StorageType.ARCHIVE, StorageType.SSD},
      {StorageType.DISK, StorageType.ARCHIVE, StorageType.SSD},
      {StorageType.DISK, StorageType.ARCHIVE, StorageType.SSD}
  };

  private final int timeout = 90000;

  /**
   * Setup environment for every test case.
   * @throws IOException
   */
  public void clusterSetUp() throws Exception {
    clusterSetUp(false, new HdfsConfiguration());
  }

  /**
   * Setup environment for every test case.
   * @param hdfsConf hdfs conf.
   * @throws Exception
   */
  public void clusterSetUp(Configuration hdfsConf) throws Exception {
    clusterSetUp(false, hdfsConf);
  }

  /**
   * Setup cluster environment.
   * @param isHAEnabled if true, enable simple HA.
   * @throws IOException
   */
  private void clusterSetUp(boolean isHAEnabled, Configuration newConf)
      throws Exception {
    conf = newConf;
    conf.set(
        DFSConfigKeys.DFS_STORAGE_POLICY_SATISFIER_RECHECK_TIMEOUT_MILLIS_KEY,
        "3000");
    conf.set(DFSConfigKeys.DFS_STORAGE_POLICY_SATISFIER_MODE_KEY,
        StoragePolicySatisfierMode.EXTERNAL.toString());
    // Reduced refresh cycle to update latest datanodes.
    conf.setLong(DFSConfigKeys.DFS_SPS_DATANODE_CACHE_REFRESH_INTERVAL_MS,
        1000);
    conf.setInt(
        DFSConfigKeys.DFS_STORAGE_POLICY_SATISFIER_MAX_RETRY_ATTEMPTS_KEY, 20);
    final int dnNumber = storageTypes.length;
    final short replication = 3;
    MiniDFSCluster.Builder clusterBuilder = new MiniDFSCluster.Builder(conf)
        .storageTypes(storageTypes).storagesPerDatanode(3)
        .numDataNodes(dnNumber);
    if (isHAEnabled) {
      clusterBuilder.nnTopology(MiniDFSNNTopology.simpleHATopology());
    }
    cluster = clusterBuilder.build();
    cluster.waitActive();
    if (isHAEnabled) {
      cluster.transitionToActive(0);
      fs = HATestUtil.configureFailoverFs(cluster, conf);
    } else {
      fs = cluster.getFileSystem();
    }
    nnc = DFSTestUtil.getNameNodeConnector(conf,
        HdfsServerConstants.MOVER_ID_PATH, 1, false);

    sps = new StoragePolicySatisfier(conf);
    ctxt = new ExternalSPSContext(sps, nnc);

    sps.init(ctxt);
    sps.start(StoragePolicySatisfierMode.EXTERNAL);

    createTestFiles(fs, replication);
  }

  /**
   * Setup test files for testing.
   * @param dfs
   * @param replication
   * @throws Exception
   */
  private void createTestFiles(DistributedFileSystem dfs,
      short replication) throws Exception {
    DFSTestUtil.createFile(dfs, testFile, 1024L, replication, 0L);
    DFSTestUtil.createFile(dfs, parentFile, 1024L, replication, 0L);
    DFSTestUtil.createFile(dfs, childFile, 1024L, replication, 0L);

    DFSTestUtil.waitReplication(dfs, testFile, replication);
    DFSTestUtil.waitReplication(dfs, parentFile, replication);
    DFSTestUtil.waitReplication(dfs, childFile, replication);
  }

  /**
   * Tear down environment for every test case.
   * @throws IOException
   */
  private void clusterShutdown() throws IOException{
    if(fs != null) {
      fs.close();
      fs = null;
    }
    if(cluster != null) {
      cluster.shutdown(true);
      cluster = null;
    }
    if (sps != null) {
      sps.stopGracefully();
    }
  }

  /**
   * While satisfying file/directory, trigger the cluster's checkpoint to
   * make sure satisfier persistence work as expected. This test case runs
   * as below:
   * 1. use satisfyStoragePolicy and add xAttr to the file.
   * 2. do the checkpoint by secondary NameNode.
   * 3. restart the cluster immediately.
   * 4. make sure all the storage policies are satisfied.
   * @throws Exception
   */
  @Test(timeout = 300000)
  public void testWithCheckpoint() throws Exception {
    SecondaryNameNode secondary = null;
    try {
      clusterSetUp();
      fs.setStoragePolicy(testFile, WARM);
      fs.satisfyStoragePolicy(testFile);

      // Start the checkpoint.
      conf.set(
          DFSConfigKeys.DFS_NAMENODE_SECONDARY_HTTP_ADDRESS_KEY, "0.0.0.0:0");
      secondary = new SecondaryNameNode(conf);
      secondary.doCheckpoint();
      restartCluster();

      DFSTestUtil.waitExpectedStorageType(
          testFileName, StorageType.DISK, 1, timeout, fs);
      DFSTestUtil.waitExpectedStorageType(
          testFileName, StorageType.ARCHIVE, 2, timeout, fs);

      fs.setStoragePolicy(parentDir, COLD);
      fs.satisfyStoragePolicy(parentDir);

      DFSTestUtil.waitExpectedStorageType(
          parentFileName, StorageType.ARCHIVE, 3, timeout, fs);
      DFSTestUtil.waitExpectedStorageType(
          childFileName, StorageType.ARCHIVE, 3, timeout, fs);

    } finally {
      if (secondary != null) {
        secondary.shutdown();
      }
      clusterShutdown();
    }
  }

  /**
   * Tests to verify satisfier persistence working well with multiple
   * restarts operations. This test case runs as below:
   * 1. satisfy the storage policy of file1.
   * 2. restart the cluster.
   * 3. check whether all the blocks are satisfied.
   * 4. satisfy the storage policy of file2.
   * 5. restart the cluster.
   * 6. check whether all the blocks are satisfied.
   * @throws Exception
   */
  @Test(timeout = 300000)
  public void testWithRestarts() throws Exception {
    try {
      clusterSetUp();
      fs.setStoragePolicy(testFile, ONE_SSD);
      fs.satisfyStoragePolicy(testFile);
      restartCluster();
      DFSTestUtil.waitExpectedStorageType(
          testFileName, StorageType.SSD, 1, timeout, fs);
      DFSTestUtil.waitExpectedStorageType(
          testFileName, StorageType.DISK, 2, timeout, fs);

      // test directory
      fs.setStoragePolicy(parentDir, COLD);
      fs.satisfyStoragePolicy(parentDir);
      restartCluster();
      DFSTestUtil.waitExpectedStorageType(
          parentFileName, StorageType.ARCHIVE, 3, timeout, fs);
      DFSTestUtil.waitExpectedStorageType(
          childFileName, StorageType.ARCHIVE, 3, timeout, fs);
    } finally {
      clusterShutdown();
    }
  }

  /**
   * Tests to verify SPS xattr will be removed if the satisfy work has
   * been finished, expect that the method satisfyStoragePolicy can be
   * invoked on the same file again after the block movement has been
   * finished:
   * 1. satisfy storage policy of file1.
   * 2. wait until storage policy is satisfied.
   * 3. satisfy storage policy of file1 again
   * 4. make sure step 3 works as expected.
   * @throws Exception
   */
  @Test(timeout = 300000)
  public void testMultipleSatisfyStoragePolicy() throws Exception {
    try {
      // Lower block movement check for testing.
      conf = new HdfsConfiguration();
      final long minCheckTimeout = 500; // minimum value
      conf.setLong(
          DFSConfigKeys.DFS_STORAGE_POLICY_SATISFIER_RECHECK_TIMEOUT_MILLIS_KEY,
          minCheckTimeout);
      clusterSetUp(conf);
      fs.setStoragePolicy(testFile, ONE_SSD);
      fs.satisfyStoragePolicy(testFile);
      DFSTestUtil.waitExpectedStorageType(
          testFileName, StorageType.SSD, 1, timeout, fs);
      DFSTestUtil.waitExpectedStorageType(
          testFileName, StorageType.DISK, 2, timeout, fs);

      // Make sure satisfy xattr has been removed.
      DFSTestUtil.waitForXattrRemoved(testFileName,
          XATTR_SATISFY_STORAGE_POLICY, cluster.getNamesystem(), 30000);

      fs.setStoragePolicy(testFile, COLD);
      fs.satisfyStoragePolicy(testFile);
      DFSTestUtil.waitExpectedStorageType(
          testFileName, StorageType.ARCHIVE, 3, timeout, fs);
    } finally {
      clusterShutdown();
    }
  }

  /**
   * Tests to verify SPS xattr is removed after SPS is dropped,
   * expect that if the SPS is disabled/dropped, the SPS
   * xattr should be removed accordingly:
   * 1. satisfy storage policy of file1.
   * 2. drop SPS thread in block manager.
   * 3. make sure sps xattr is removed.
   * @throws Exception
   */
  @Test(timeout = 300000000)
  public void testDropSPS() throws Exception {
    try {
      clusterSetUp();
      fs.setStoragePolicy(testFile, ONE_SSD);
      fs.satisfyStoragePolicy(testFile);

      cluster.getNamesystem().getBlockManager().getSPSManager()
          .changeModeEvent(StoragePolicySatisfierMode.NONE);

      // Make sure satisfy xattr has been removed.
      DFSTestUtil.waitForXattrRemoved(testFileName,
          XATTR_SATISFY_STORAGE_POLICY, cluster.getNamesystem(), 30000);

    } finally {
      clusterShutdown();
    }
  }

  /**
   * Tests that Xattrs should be cleaned if all blocks already satisfied.
   *
   * @throws Exception
   */
  @Test(timeout = 300000)
  public void testSPSShouldNotLeakXattrIfStorageAlreadySatisfied()
      throws Exception {
    try {
      clusterSetUp();
      DFSTestUtil.waitExpectedStorageType(testFileName, StorageType.DISK, 3,
          timeout, fs);
      fs.satisfyStoragePolicy(testFile);

      DFSTestUtil.waitExpectedStorageType(testFileName, StorageType.DISK, 3,
          timeout, fs);

      // Make sure satisfy xattr has been removed.
      DFSTestUtil.waitForXattrRemoved(testFileName,
          XATTR_SATISFY_STORAGE_POLICY, cluster.getNamesystem(), 30000);

    } finally {
      clusterShutdown();
    }
  }

  /**
   * Test loading of SPS xAttrs from the edits log when satisfyStoragePolicy
   * called on child file and parent directory.
   * 1. Create one directory and create one child file.
   * 2. Set storage policy for child file and call
   * satisfyStoragePolicy.
   * 3. wait for SPS to remove xAttr for file child file.
   * 4. Set storage policy for parent directory and call
   * satisfyStoragePolicy.
   * 5. restart the namenode.
   * NameNode should be started successfully.
   */
  @Test(timeout = 300000)
  public void testNameNodeRestartWhenSPSCalledOnChildFileAndParentDir()
      throws Exception {
    try {
      clusterSetUp();
      fs.setStoragePolicy(childFile, "COLD");
      fs.satisfyStoragePolicy(childFile);
      DFSTestUtil.waitExpectedStorageType(childFile.toUri().getPath(),
          StorageType.ARCHIVE, 3, 30000, cluster.getFileSystem());
      // wait for SPS to remove Xattr from file
      Thread.sleep(30000);
      fs.setStoragePolicy(childDir, "COLD");
      fs.satisfyStoragePolicy(childDir);
      try {
        cluster.restartNameNodes();
      } catch (Exception e) {
        assertFalse(e.getMessage().contains(
            "Cannot request to call satisfy storage policy"));
      }
    } finally {
      clusterShutdown();
    }
  }

  /**
   * Test SPS when satisfyStoragePolicy called on child file and
   * parent directory.
   * 1. Create one parent directory and child directory.
   * 2. Create some file in both the directory.
   * 3. Set storage policy for parent directory and call
   * satisfyStoragePolicy.
   * 4. Set storage policy for child directory and call
   * satisfyStoragePolicy.
   * 5. restart the namenode.
   * All the file blocks should satisfy the policy.
   */
  @Test(timeout = 300000)
  public void testSPSOnChildAndParentDirectory() throws Exception {
    try {
      clusterSetUp();
      fs.setStoragePolicy(parentDir, "COLD");
      fs.satisfyStoragePolicy(childDir);
      DFSTestUtil.waitExpectedStorageType(childFileName, StorageType.ARCHIVE,
          3, 30000, cluster.getFileSystem());
      fs.satisfyStoragePolicy(parentDir);
      DFSTestUtil.waitExpectedStorageType(parentFileName, StorageType.ARCHIVE,
          3, 30000, cluster.getFileSystem());
    } finally {
      clusterShutdown();
    }
  }

  /**
   * Test SPS xAttr on directory. xAttr should be removed from the directory
   * once all the files blocks moved to specific storage.
   */
  @Test(timeout = 300000)
  public void testSPSxAttrWhenSpsCalledForDir() throws Exception {
    try {
      clusterSetUp();
      Path parent = new Path("/parent");
      // create parent dir
      fs.mkdirs(parent);

      // create 10 child files
      for (int i = 0; i < 5; i++) {
        DFSTestUtil.createFile(fs, new Path(parent, "f" + i), 1024, (short) 3,
            0);
      }

      // Set storage policy for parent directory
      fs.setStoragePolicy(parent, "COLD");

      // Stop one DN so we can check the SPS xAttr for directory.
      DataNodeProperties stopDataNode = cluster.stopDataNode(0);

      fs.satisfyStoragePolicy(parent);

      // Check xAttr for parent directory
      FSNamesystem namesystem = cluster.getNamesystem();
      INode inode = namesystem.getFSDirectory().getINode("/parent");
      XAttrFeature f = inode.getXAttrFeature();
      assertTrue("SPS xAttr should be exist",
          f.getXAttr(XATTR_SATISFY_STORAGE_POLICY) != null);

      // check for the child, SPS xAttr should not be there
      for (int i = 0; i < 5; i++) {
        inode = namesystem.getFSDirectory().getINode("/parent/f" + i);
        f = inode.getXAttrFeature();
        assertTrue(f == null);
      }

      cluster.restartDataNode(stopDataNode, false);

      // wait and check all the file block moved in ARCHIVE
      for (int i = 0; i < 5; i++) {
        DFSTestUtil.waitExpectedStorageType("/parent/f" + i,
            StorageType.ARCHIVE, 3, 30000, cluster.getFileSystem());
      }
      DFSTestUtil.waitForXattrRemoved("/parent", XATTR_SATISFY_STORAGE_POLICY,
          namesystem, 10000);
    } finally {
      clusterShutdown();
    }

  }

  /**
   * Test SPS xAttr on file. xAttr should be removed from the file
   * once all the blocks moved to specific storage.
   */
  @Test(timeout = 300000)
  public void testSPSxAttrWhenSpsCalledForFile() throws Exception {
    try {
      clusterSetUp();
      Path file = new Path("/file");
      DFSTestUtil.createFile(fs, file, 1024, (short) 3, 0);

      // Set storage policy for file
      fs.setStoragePolicy(file, "COLD");

      // Stop one DN so we can check the SPS xAttr for file.
      DataNodeProperties stopDataNode = cluster.stopDataNode(0);

      fs.satisfyStoragePolicy(file);

      // Check xAttr for parent directory
      FSNamesystem namesystem = cluster.getNamesystem();
      INode inode = namesystem.getFSDirectory().getINode("/file");
      XAttrFeature f = inode.getXAttrFeature();
      assertTrue("SPS xAttr should be exist",
          f.getXAttr(XATTR_SATISFY_STORAGE_POLICY) != null);

      cluster.restartDataNode(stopDataNode, false);

      // wait and check all the file block moved in ARCHIVE
      DFSTestUtil.waitExpectedStorageType("/file", StorageType.ARCHIVE, 3,
          30000, cluster.getFileSystem());
      GenericTestUtils.waitFor(new Supplier<Boolean>() {
        @Override
        public Boolean get() {
          List<XAttr> existingXAttrs = XAttrStorage.readINodeXAttrs(inode);
          return !existingXAttrs.contains(XATTR_SATISFY_STORAGE_POLICY);
        }
      }, 100, 10000);
    } finally {
      clusterShutdown();
    }
  }

  /**
   * Restart the hole env and trigger the DataNode's heart beats.
   * @throws Exception
   */
  private void restartCluster() throws Exception {
    cluster.restartDataNodes();
    cluster.restartNameNodes();
    cluster.waitActive();
    cluster.triggerHeartbeats();
  }

}


text:
namespace boost {
namespace asio {
namespace ssl {
namespace detail {

struct stream_core
{
  // According to the OpenSSL documentation, this is the buffer size that is
  // sufficient to hold the largest possible TLS record.
  enum { max_tls_record_size = 17 * 1024 };

  template <typename Executor>
  stream_core(SSL_CTX* context, const Executor& ex)
    : engine_(context),
      pending_read_(ex),
      pending_write_(ex),
      output_buffer_space_(max_tls_record_size),
      output_buffer_(boost::asio::buffer(output_buffer_space_)),
      input_buffer_space_(max_tls_record_size),
      input_buffer_(boost::asio::buffer(input_buffer_space_))
  {
    pending_read_.expires_at(neg_infin());
    pending_write_.expires_at(neg_infin());
  }

#if defined(BOOST_ASIO_HAS_MOVE)
  stream_core(stream_core&& other)
    : engine_(BOOST_ASIO_MOVE_CAST(engine)(other.engine_)),
#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
      pending_read_(
         BOOST_ASIO_MOVE_CAST(boost::asio::deadline_timer)(
           other.pending_read_)),
      pending_write_(
         BOOST_ASIO_MOVE_CAST(boost::asio::deadline_timer)(
           other.pending_write_)),
#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
      pending_read_(
         BOOST_ASIO_MOVE_CAST(boost::asio::steady_timer)(
           other.pending_read_)),
      pending_write_(
         BOOST_ASIO_MOVE_CAST(boost::asio::steady_timer)(
           other.pending_write_)),
#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
      output_buffer_space_(
          BOOST_ASIO_MOVE_CAST(std::vector<unsigned char>)(
            other.output_buffer_space_)),
      output_buffer_(other.output_buffer_),
      input_buffer_space_(
          BOOST_ASIO_MOVE_CAST(std::vector<unsigned char>)(
            other.input_buffer_space_)),
      input_buffer_(other.input_buffer_),
      input_(other.input_)
  {
    other.output_buffer_ = boost::asio::mutable_buffer(0, 0);
    other.input_buffer_ = boost::asio::mutable_buffer(0, 0);
    other.input_ = boost::asio::const_buffer(0, 0);
  }
#endif // defined(BOOST_ASIO_HAS_MOVE)

  ~stream_core()
  {
  }

  // The SSL engine.
  engine engine_;

#if defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
  // Timer used for storing queued read operations.
  boost::asio::deadline_timer pending_read_;

  // Timer used for storing queued write operations.
  boost::asio::deadline_timer pending_write_;

  // Helper function for obtaining a time value that always fires.
  static boost::asio::deadline_timer::time_type neg_infin()
  {
    return boost::posix_time::neg_infin;
  }

  // Helper function for obtaining a time value that never fires.
  static boost::asio::deadline_timer::time_type pos_infin()
  {
    return boost::posix_time::pos_infin;
  }

  // Helper function to get a timer's expiry time.
  static boost::asio::deadline_timer::time_type expiry(
      const boost::asio::deadline_timer& timer)
  {
    return timer.expires_at();
  }
#else // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)
  // Timer used for storing queued read operations.
  boost::asio::steady_timer pending_read_;

  // Timer used for storing queued write operations.
  boost::asio::steady_timer pending_write_;

  // Helper function for obtaining a time value that always fires.
  static boost::asio::steady_timer::time_point neg_infin()
  {
    return (boost::asio::steady_timer::time_point::min)();
  }

  // Helper function for obtaining a time value that never fires.
  static boost::asio::steady_timer::time_point pos_infin()
  {
    return (boost::asio::steady_timer::time_point::max)();
  }

  // Helper function to get a timer's expiry time.
  static boost::asio::steady_timer::time_point expiry(
      const boost::asio::steady_timer& timer)
  {
    return timer.expiry();
  }
#endif // defined(BOOST_ASIO_HAS_BOOST_DATE_TIME)

  // Buffer space used to prepare output intended for the transport.
  std::vector<unsigned char> output_buffer_space_;

  // A buffer that may be used to prepare output intended for the transport.
  boost::asio::mutable_buffer output_buffer_;

  // Buffer space used to read input intended for the engine.
  std::vector<unsigned char> input_buffer_space_;

  // A buffer that may be used to read input intended for the engine.
  boost::asio::mutable_buffer input_buffer_;

  // The buffer pointing to the engine's unconsumed input.
  boost::asio::const_buffer input_;
};

} // namespace detail
} // namespace ssl
} // namespace asio
} // namespace boost

#include <boost/asio/detail/pop_options.hpp>

#endif // BOOST_ASIO_SSL_DETAIL_STREAM_CORE_HPP


text:
.. Deck of Cards documentation master file, created by
   sphinx-quickstart2 on Sat Jan  3 20:40:48 2015.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Welcome to Deck of Cards's documentation!
=========================================

Contents:

.. toctree::
   :maxdepth: 4

   deck_of_cards

Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`


text:
SourceRegistryWindow::SourceRegistryWindow(SourceRegistry *sourceRegistry, QWidget *parent)
	: QDialog(parent), ui(new Ui::SourceRegistryWindow), m_sourceRegistry(sourceRegistry)
{
	ui->setupUi(this);

	ui->labelName->setText(m_sourceRegistry->name());
	ui->labelJsonUrl->setText(QStringLiteral("%1").arg(m_sourceRegistry->jsonUrl()));
	ui->labelHome->setText(QStringLiteral("%1").arg(m_sourceRegistry->home()));
	ui->labelSources->setText(m_sourceRegistry->sources().keys().join(", "));
}

SourceRegistryWindow::~SourceRegistryWindow()
{
	delete ui;
}


text:
Lets get started with setting up your documentation, it will take less than 5 minutes to setup and then you can focus on your documentation.

Steps to follow:

Use command line interface(CLI) and go to your workspace

git clone git@github.com:colorgap/podium.git

cd podium

sudo npm install && bower install && gulp

gulp serve

            We have added amazing browser-sync which helps you make changes to your docs and view right away.
            "gulp serve" will start a server which can be accessed at http://localhost:3000.

Q: Where do I add my documentation pages and where to add left navigation links?

A: Configuration section has all your answers.


text:
Test for bug 44406:
Application Cache crash when a fallback document has a manifest URL.

Testing...

The frame below should display a Not Found error - the fallback entry is foreign, so it shouldn't be used for main resource.