text:
<page-title ng-if="layoutOptions.pageTitles" title="Bar Gauges" description="Data visualization widgets for your stats"></page-title>

How to Include Charts Library in Xenon Theme

The reason why you don't see charts in this page is because of license restrictions from DevExpress company. Click here to read license agreement.

We are not permitted to include the DevExtreme Web Charts JavaScript library in the default download file of Xenon theme, however you can include DevExpress Charts library manually and takes just few minutes:

Download DevExtreme Web JavaScript library by clicking here. If the link doesn't work, then click this one and choose DevExtreme Web package to download.

Extract the downloaded archive. There you will find Lib/ folder. Copy the folders inside.

Paste copied files to assets/js/devexpress-web-14.1/

You are all set!

Labels Customization

						–
						+

						×

					Randomize
					Restart

Palette

						–
						+

						×

Variable Number of Bars

						–
						+

						×


text:
<?php

namespace Google\Service\ContainerAnalysis;

class TestIamPermissionsRequest extends \Google\Collection
{
  protected $collection_key = 'permissions';
  /**
   * @var string[]
   */
  public $permissions;

  /**
   * @param string[]
   */
  public function setPermissions($permissions)
  {
    $this->permissions = $permissions;
  }
  /**
   * @return string[]
   */
  public function getPermissions()
  {
    return $this->permissions;
  }
}

// Adding a class alias for backwards compatibility with the previous class name.
class_alias(TestIamPermissionsRequest::class, 'Google_Service_ContainerAnalysis_TestIamPermissionsRequest');

redpajama_set_name: RedPajamaGithub


text:
"""
    Config(p"~/.playground/config.yml", root=p"~/.playground")

Stores various default playground environment settings including paths for
storing shared binaries and environments.
"""
type Config
    root::AbstractPath
    tmp::AbstractPath
    src::AbstractPath
    bin::AbstractPath
    share::AbstractPath
    default_playground_path::AbstractPath
    default_shell::AbstractString
    default_registry::AbstractString
    default_branch::AbstractString
    default_git_address::AbstractString
    default_git_revision::AbstractString
    isolated_shell_history::Bool
    isolated_julia_history::Bool

    function Config(kwargs::Dict)
        root = kwargs["root"]
        default_pg_path = abs(Path(kwargs["default_playground_path"]))

        new(
            root,
            join(root, p"tmp"),
            join(root, p"src"),
            join(root, p"bin"),
            join(root, p"share"),
            default_pg_path,
            get(kwargs, "default_shell", "/bin/bash"),
            get(kwargs, "default_registry", ""),
            get(kwargs, "default_branch", ""),
            kwargs["default_git_address"],
            kwargs["default_git_revision"],
            kwargs["isolated_shell_history"],
            kwargs["isolated_julia_history"],
        )
    end
end

function Config(config::AbstractString, root::AbstractPath)
    config_dict = configload(config)
    config_dict["root"] = root
    return Config(config_dict)
end

function Config{P<:AbstractPath}(file::P, root::P=configpath())
    Config(read(file), root)
end

function Config()
    config_file = join(configpath(), "config.yml")
    if exists(config_file)
        return Config(config_file)
    else
        return Config(Playground.DEFAULT_CONFIG, configpath())
    end
end

function init(config::Config)
    for p in (config.root, config.tmp, config.src, config.bin, config.share)
        mkdir(p; recursive=true, exist_ok=true)
    end
end

function configload(content)
    content_hash = hash(content)
    config_path = configpath()

    mkdir(config_path; recursive=true, exist_ok=true)
    config_cache_file = join(config_path, ".config-$(Base.VERSION_STRING).cache")

    if exists(config_cache_file)
        try
            cache = open(config_cache_file, "r") do f
                deserialize(f)
            end

            saved_hash = cache["hash"]
            debug(logger, "Checking hash: $content_hash == $saved_hash")
            if content_hash == saved_hash
                return cache
            end
        catch ex
            warn(logger, ex)
        end
    end

    new_cache = load(content)
    new_cache["hash"] = content_hash

    open(config_cache_file, "w") do f
        serialize(f, new_cache)
    end

    return new_cache
end

function configpath()
    default_path = join(home(), ".playground")
    alt_path = join(parent(parent(Path(@__FILE__))), p"deps", p"usr", p".playground")
    exists(default_path) ? default_path : alt_path
end

function envpath(config::Config)
    p = abs(join(cwd(), config.default_playground_path))
    debug(logger, "Using `default_playground_path`: $p")
    return p
end

envpath(config::Config, name::AbstractString) = abs(join(config.share, name))
envpath(config::Config, path::AbstractPath) = abs(path)

function envname(config::Config, path::AbstractPath)
    root_path = abs(path)
    name = ""

    for p in readdir(config.share)
        file_path = join(config.share, p)
        if islink(file_path)
            if abs(readlink(file_path)) == root_path
                name = basename(p)
                break
            end
        end
    end

    return name
end


text:
Browser Support of Libraries
============================

## angularJS
Version : 1.0.1


text:
var serve = require('koa-static');
var router = require('../mock/router.js');
var path = require('path');
var koa = require('koa');
var app = koa();

function getIPAdress() {
    var interfaces = require('os').networkInterfaces();
    for (var devName in interfaces) {
        var iface = interfaces[devName];
        for (var i = 0; i < iface.length; i++) {
            var alias = iface[i];
            if (alias.family === 'IPv4') {
                return alias.address;
            }
        }
    }
}

app.use(serve('.'));
app.use(router.routes());
app.use(router.allowedMethods());
var server = require('http').createServer(app.callback());
server.listen(8999, function () {
    console.log('Http server running on http://%s:%s', getIPAdress(), server.address().port);
});


text:
package org.gwtproject.event.dom.client;

import org.gwtproject.event.legacy.shared.EventHandler;

/** Handler interface for {@link GestureEndEvent} events. */
public interface GestureEndHandler extends EventHandler {

  /**
   * Called when GestureEndEvent is fired.
   *
   * @param event the {@link GestureEndEvent} that was fired
   */
  void onGestureEnd(GestureEndEvent event);
}


text:
/// <reference path="../_definitions.ts" />

/**
* Phaser - Vec2Utils
*
* A collection of methods useful for manipulating and performing operations on 2D vectors.
*
*/

module Phaser {

    export class Vec2Utils {

        /**
        * Adds two 2D vectors.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2 that is the sum of the two vectors.
        */
        static add(a: Vec2, b: Vec2, out: Vec2 = new Vec2): Vec2 {
            return out.setTo(a.x + b.x, a.y + b.y);
        }

        /**
        * Subtracts two 2D vectors.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2 that is the difference of the two vectors.
        */
        static subtract(a: Vec2, b: Vec2, out: Vec2 = new Vec2): Vec2 {
            return out.setTo(a.x - b.x, a.y - b.y);
        }

        /**
        * Multiplies two 2D vectors.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2 that is the sum of the two vectors multiplied.
        */
        static multiply(a: Vec2, b: Vec2, out: Vec2 = new Vec2): Vec2 {
            return out.setTo(a.x * b.x, a.y * b.y);
        }

        /**
        * Divides two 2D vectors.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2 that is the sum of the two vectors divided.
        */
        static divide(a: Vec2, b: Vec2, out: Vec2 = new Vec2): Vec2 {
            return out.setTo(a.x / b.x, a.y / b.y);
        }

        /**
        * Scales a 2D vector.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {number} s Scaling value.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2 that is the scaled vector.
        */
        static scale(a: Phaser.Vec2, s: number, out: Phaser.Vec2 = new Phaser.Vec2): Phaser.Vec2 {
            return out.setTo(a.x * s, a.y * s);
        }

        /**
        * Adds two 2D vectors together and multiplies the result by the given scalar.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @param {number} s Scaling value.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2 that is the sum of the two vectors added and multiplied.
        */
        static multiplyAdd(a: Vec2, b: Vec2, s: number, out: Vec2 = new Vec2): Vec2 {
            return out.setTo(a.x + b.x * s, a.y + b.y * s);
        }

        /**
        * Return a negative vector.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2 that is the negative vector.
        */
        static negative(a: Vec2, out: Vec2 = new Vec2): Vec2 {
            return out.setTo(-a.x, -a.y);
        }

        /**
        * Return a perpendicular vector (90 degrees rotation)
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2 that is the scaled vector.
        */
        static perp(a: Vec2, out: Vec2 = new Vec2): Vec2 {
            return out.setTo(-a.y, a.x);
        }

        /**
        * Return a perpendicular vector (-90 degrees rotation)
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2 that is the scaled vector.
        */
        static rperp(a: Vec2, out: Vec2 = new Vec2): Vec2 {
            return out.setTo(a.y, -a.x);
        }

        /**
        * Checks if two 2D vectors are equal.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @return {bool}
        */
        static equals(a: Vec2, b: Vec2): bool {
            return a.x == b.x && a.y == b.y;
        }

        /**
        *
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @param {Vec2} epsilon
        * @return {bool}
        */
        static epsilonEquals(a: Vec2, b: Vec2, epsilon: number): bool {
            return Math.abs(a.x - b.x) <= epsilon && Math.abs(a.y - b.y) <= epsilon;
        }

        /**
        * Get the distance between two 2D vectors.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @return {Number}
        */
        static distance(a: Vec2, b: Vec2): number {
            return Math.sqrt(Vec2Utils.distanceSq(a, b));
        }

        /**
        * Get the distance squared between two 2D vectors.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @return {Number}
        */
        static distanceSq(a: Vec2, b: Vec2): number {
            return ((a.x - b.x) * (a.x - b.x)) + ((a.y - b.y) * (a.y - b.y));
        }

        /**
        * Project two 2D vectors onto another vector.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2.
        */
        static project(a: Vec2, b: Vec2, out: Vec2 = new Vec2): Vec2 {

            var amt = a.dot(b) / b.lengthSq();

            if (amt != 0)
            {
                out.setTo(amt * b.x, amt * b.y);
            }

            return out;

        }

        /**
        * Project this vector onto a vector of unit length.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2.
        */
        static projectUnit(a: Vec2, b: Vec2, out: Vec2 = new Vec2): Vec2 {

            var amt = a.dot(b);

            if (amt != 0)
            {
                out.setTo(amt * b.x, amt * b.y);
            }

            return out;

        }

        /**
        * Right-hand normalize (make unit length) a 2D vector.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2.
        */
        static normalRightHand(a: Vec2, out: Vec2 = new Vec2): Vec2 {
            return out.setTo(a.y * -1, a.x);
        }

        /**
        * Normalize (make unit length) a 2D vector.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2.
        */
        static normalize(a: Vec2, out: Vec2 = new Vec2): Vec2 {

            var m = a.length();

            if (m != 0)
            {
                out.setTo(a.x / m, a.y / m);
            }

            return out;
        }

        /**
        * The dot product of two 2D vectors.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @return {Number}
        */
        static dot(a: Vec2, b: Vec2): number {
            return ((a.x * b.x) + (a.y * b.y));
        }

        /**
        * The cross product of two 2D vectors.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @return {Number}
        */
        static cross(a: Vec2, b: Vec2): number {
            return ((a.x * b.y) - (a.y * b.x));
        }

        /**
        * The angle between two 2D vectors.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @return {Number}
        */
        static angle(a: Vec2, b: Vec2): number {
            return Math.atan2(a.x * b.y - a.y * b.x, a.x * b.x + a.y * b.y);
        }

        /**
        * The angle squared between two 2D vectors.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @return {Number}
        */
        static angleSq(a: Vec2, b: Vec2): number {
            return a.subtract(b).angle(b.subtract(a));
        }

        /**
        * Rotate a 2D vector around the origin to the given angle (theta).
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @param {Number} theta The angle of rotation in radians.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2.
        */
        static rotateAroundOrigin(a: Vec2, b: Vec2, theta: number, out: Vec2 = new Vec2): Vec2 {
            var x = a.x - b.x;
            var y = a.y - b.y;
            return out.setTo(x * Math.cos(theta) - y * Math.sin(theta) + b.x, x * Math.sin(theta) + y * Math.cos(theta) + b.y);
        }

        /**
        * Rotate a 2D vector to the given angle (theta).
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} b Reference to a source Vec2 object.
        * @param {Number} theta The angle of rotation in radians.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2.
        */
        static rotate(a: Vec2, theta: number, out: Vec2 = new Vec2): Vec2 {

            var c = Math.cos(theta);
            var s = Math.sin(theta);

            return out.setTo(a.x * c - a.y * s, a.x * s + a.y * c);

        }

        /**
        * Clone a 2D vector.
        *
        * @param {Vec2} a Reference to a source Vec2 object.
        * @param {Vec2} out The output Vec2 that is the result of the operation.
        * @return {Vec2} A Vec2 that is a copy of the source Vec2.
        */
        static clone(a: Vec2, out: Vec2 = new Vec2): Vec2 {
            return out.setTo(a.x, a.y);
        }

        /**
        * Reflect this vector on an arbitrary axis.
        *
        * @param {Vec2} axis The vector representing the axis.
        * @return {Vec2} This for chaining.
        */
        /*
        static reflect(axis): Vec2 {

            var x = this.x;
            var y = this.y;
            this.project(axis).scale(2);
            this.x -= x;
            this.y -= y;

            return this;

        }
        */

        /**
        * Reflect this vector on an arbitrary axis (represented by a unit vector)
        *
        * @param {Vec2} axis The unit vector representing the axis.
        * @return {Vec2} This for chaining.
        */
        /*
        static reflectN(axis): Vec2 {

            var x = this.x;
            var y = this.y;
            this.projectN(axis).scale(2);
            this.x -= x;
            this.y -= y;

            return this;

        }

        static getMagnitude(): number {
            return Math.sqrt(Math.pow(this.x, 2) + Math.pow(this.y, 2));
        }
        */

    }

}


text:
var testController = angular.module('testController', ['testService']);

testController.controller('mainController', function mainController($scope, factoryName) {
  $scope.executeTestGet = function() {
    factoryName.method1("no data", function (error, data) {
      if (!error) {
        $scope.testData = data;
        console.log($scope.testData);
      }
    });
  }
  factoryName.method2();
});


text:
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu-framework/master/LICENCE

using System.Collections.Generic;
using osu.Framework.Graphics.OpenGL;
using osu.Framework.Graphics.OpenGL.Buffers;
using OpenTK;
using OpenTK.Graphics.ES30;
using OpenTK.Graphics;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Shaders;
using System;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.OpenGL.Vertices;
using System.Diagnostics;

namespace osu.Framework.Graphics.Containers
{
    public class BufferedContainerDrawNodeSharedData
    {
        /// <summary>
        /// The <see cref="Shader"/> to use when rendering blur effects.
        /// </summary>
        public Shader BlurShader;

        /// <summary>
        /// The <see cref="FrameBuffer"/>s to render to.
        /// These are used in a ping-pong manner to render effects <see cref="BufferedContainerDrawNode"/>.
        /// </summary>
        public readonly FrameBuffer[] FrameBuffers = new FrameBuffer[3];

        /// <summary>
        /// The version of drawn contents currently present in <see cref="FrameBuffers"/>.
        /// This should only be modified by <see cref="BufferedContainerDrawNode"/>.
        /// </summary>
        public long DrawVersion = -1;

        public BufferedContainerDrawNodeSharedData()
        {
            for (int i = 0; i < FrameBuffers.Length; i++)
                FrameBuffers[i] = new FrameBuffer();
        }
    }

    public class BufferedContainerDrawNode : CompositeDrawNode
    {
        public bool DrawOriginal;
        public Color4 BackgroundColour;
        public ColourInfo EffectColour;
        public BlendingParameters EffectBlending;
        public EffectPlacement EffectPlacement;

        public Vector2 BlurSigma;
        public Vector2I BlurRadius;
        public float BlurRotation;

        public long UpdateVersion;

        public RectangleF ScreenSpaceDrawRectangle;
        public All FilteringMode;

        /// <summary>
        /// The <see cref="RenderbufferInternalFormat"/>s to use when drawing children.
        /// </summary>
        public readonly List<RenderbufferInternalFormat> Formats = new List<RenderbufferInternalFormat>();

        public new BufferedContainerDrawNodeSharedData Shared;

        /// <summary>
        /// Whether this <see cref="BufferedContainerDrawNode"/> should have its children re-drawn.
        /// </summary>
        public bool RequiresRedraw => UpdateVersion > Shared.DrawVersion;

        private InvokeOnDisposal establishFrameBufferViewport(Vector2 roundedSize)
        {
            // Disable masking for generating the frame buffer since masking will be re-applied
            // when actually drawing later on anyways. This allows more information to be captured
            // in the frame buffer and helps with cached buffers being re-used.
            RectangleI screenSpaceMaskingRect = new RectangleI((int)Math.Floor(ScreenSpaceDrawRectangle.X), (int)Math.Floor(ScreenSpaceDrawRectangle.Y), (int)roundedSize.X + 1, (int)roundedSize.Y + 1);

            GLWrapper.PushMaskingInfo(new MaskingInfo
            {
                ScreenSpaceAABB = screenSpaceMaskingRect,
                MaskingRect = ScreenSpaceDrawRectangle,
                ToMaskingSpace = Matrix3.Identity,
                BlendRange = 1,
                AlphaExponent = 1,
            }, true);

            // Match viewport to FrameBuffer such that we don't draw unnecessary pixels.
            GLWrapper.PushViewport(new RectangleI(0, 0, (int)roundedSize.X, (int)roundedSize.Y));

            return new InvokeOnDisposal(delegate
            {
                GLWrapper.PopViewport();
                GLWrapper.PopMaskingInfo();
            });
        }

        private InvokeOnDisposal bindFrameBuffer(FrameBuffer frameBuffer, Vector2 requestedSize)
        {
            if (!frameBuffer.IsInitialized)
                frameBuffer.Initialize(true, FilteringMode);

            // These additional render buffers are only required if e.g. depth
            // or stencil information needs to also be stored somewhere.
            foreach (var f in Formats)
                frameBuffer.Attach(f);

            // This setter will also take care of allocating a texture of appropriate size within the framebuffer.
            frameBuffer.Size = requestedSize;

            frameBuffer.Bind();

            return new InvokeOnDisposal(frameBuffer.Unbind);
        }

        private void drawFrameBufferToBackBuffer(FrameBuffer frameBuffer, RectangleF drawRectangle, ColourInfo colourInfo)
        {
            // The strange Y coordinate and Height are a result of OpenGL coordinate systems having Y grow upwards and not downwards.
            RectangleF textureRect = new RectangleF(0, frameBuffer.Texture.Height, frameBuffer.Texture.Width, -frameBuffer.Texture.Height);
            if (frameBuffer.Texture.Bind())
                // Color was already applied by base.Draw(); no need to re-apply. Thus we use White here.
                frameBuffer.Texture.DrawQuad(drawRectangle, textureRect, colourInfo);
        }

        private void drawChildren(Action<TexturedVertex2D> vertexAction, Vector2 frameBufferSize)
        {
            // Fill the frame buffer with drawn children
            using (bindFrameBuffer(currentFrameBuffer, frameBufferSize))
            {
                // We need to draw children as if they were zero-based to the top-left of the texture.
                // We can do this by adding a translation component to our (orthogonal) projection matrix.
                GLWrapper.PushOrtho(ScreenSpaceDrawRectangle);

                GLWrapper.ClearColour(BackgroundColour);
                base.Draw(vertexAction);

                GLWrapper.PopOrtho();
            }
        }

        private void drawBlurredFrameBuffer(int kernelRadius, float sigma, float blurRotation)
        {
            FrameBuffer source = currentFrameBuffer;
            FrameBuffer target = advanceFrameBuffer();

            GLWrapper.SetBlend(new BlendingInfo
            {
                Source = BlendingFactorSrc.One,
                Destination = BlendingFactorDest.Zero,
                SourceAlpha = BlendingFactorSrc.One,
                DestinationAlpha = BlendingFactorDest.Zero,
            });

            using (bindFrameBuffer(target, source.Size))
            {
                Shared.BlurShader.GetUniform<int>(@"g_Radius").Value = kernelRadius;
                Shared.BlurShader.GetUniform<float>(@"g_Sigma").Value = sigma;
                Shared.BlurShader.GetUniform<Vector2>(@"g_TexSize").Value = source.Size;

                float radians = -MathHelper.DegreesToRadians(blurRotation);
                Shared.BlurShader.GetUniform<Vector2>(@"g_BlurDirection").Value = new Vector2((float)Math.Cos(radians), (float)Math.Sin(radians));

                Shared.BlurShader.Bind();
                drawFrameBufferToBackBuffer(source, new RectangleF(0, 0, source.Texture.Width, source.Texture.Height), ColourInfo.SingleColour(Color4.White));
                Shared.BlurShader.Unbind();
            }
        }

        private int currentFrameBufferIndex;
        private FrameBuffer currentFrameBuffer => Shared.FrameBuffers[currentFrameBufferIndex];
        private FrameBuffer advanceFrameBuffer() => Shared.FrameBuffers[currentFrameBufferIndex = (currentFrameBufferIndex + 1) % 2];

        /// <summary>
        /// Makes sure the first frame buffer is always the one we want to draw from.
        /// This saves us the need to sync the draw indices across draw node trees
        /// since the Shared.FrameBuffers array is already shared.
        /// </summary>
        private void finalizeFrameBuffer()
        {
            if (currentFrameBufferIndex != 0)
            {
                Trace.Assert(currentFrameBufferIndex == 1,
                    $"Only the first two framebuffers should be the last to be written to at the end of {nameof(Draw)}.");

                FrameBuffer temp = Shared.FrameBuffers[0];
                Shared.FrameBuffers[0] = Shared.FrameBuffers[1];
                Shared.FrameBuffers[1] = temp;

                currentFrameBufferIndex = 0;
            }
        }

        // Our effects will be drawn into framebuffers 0 and 1. If we want to preserve the originally
        // drawn children we need to put them in a separate buffer; in this case buffer 2. Otherwise,
        // we do not want to allocate a third buffer for nothing and hence we start with 0.
        private int originalIndex => DrawOriginal && (BlurRadius.X > 0 || BlurRadius.Y > 0) ? 2 : 0;

        public override void Draw(Action<TexturedVertex2D> vertexAction)
        {
            currentFrameBufferIndex = originalIndex;

            Vector2 frameBufferSize = new Vector2((float)Math.Ceiling(ScreenSpaceDrawRectangle.Width), (float)Math.Ceiling(ScreenSpaceDrawRectangle.Height));
            if (RequiresRedraw)
            {
                Shared.DrawVersion = UpdateVersion;

                using (establishFrameBufferViewport(frameBufferSize))
                {
                    drawChildren(vertexAction, frameBufferSize);

                    // Blur post-processing in case a blur radius is defined.
                    if (BlurRadius.X > 0 || BlurRadius.Y > 0)
                    {
                        GL.Disable(EnableCap.ScissorTest);

                        if (BlurRadius.X > 0) drawBlurredFrameBuffer(BlurRadius.X, BlurSigma.X, BlurRotation);
                        if (BlurRadius.Y > 0) drawBlurredFrameBuffer(BlurRadius.Y, BlurSigma.Y, BlurRotation + 90);

                        GL.Enable(EnableCap.ScissorTest);
                    }
                }

                finalizeFrameBuffer();
            }

            RectangleF drawRectangle = FilteringMode == All.Nearest
                ? new RectangleF(ScreenSpaceDrawRectangle.X, ScreenSpaceDrawRectangle.Y, frameBufferSize.X, frameBufferSize.Y)
                : ScreenSpaceDrawRectangle;

            Shader.Bind();

            if (DrawOriginal && EffectPlacement == EffectPlacement.InFront)
            {
                GLWrapper.SetBlend(DrawInfo.Blending);
                drawFrameBufferToBackBuffer(Shared.FrameBuffers[originalIndex], drawRectangle, DrawInfo.Colour);
            }

            // Blit the final framebuffer to screen.
            GLWrapper.SetBlend(new BlendingInfo(EffectBlending));

            ColourInfo effectColour = DrawInfo.Colour;
            effectColour.ApplyChild(EffectColour);
            drawFrameBufferToBackBuffer(Shared.FrameBuffers[0], drawRectangle, effectColour);

            if (DrawOriginal && EffectPlacement == EffectPlacement.Behind)
            {
                GLWrapper.SetBlend(DrawInfo.Blending);
                drawFrameBufferToBackBuffer(Shared.FrameBuffers[originalIndex], drawRectangle, DrawInfo.Colour);
            }

            Shader.Unbind();
        }
    }
}


text:
<title>Status Manager Sliding Box Example</title>
<link rel="stylesheet" href="./css/style.css" />

Status Manager Sliding Box Example

Download Source Code from GitHub


text:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">

<title>404 Not Found</title>

Not Found

The requested URL /themes/jobhunt/img/favicon.ico was not found on this server.

Additionally, a 404 Not Found
error was encountered while trying to use an ErrorDocument to handle the request.


text:
<!DOCTYPE html>
<html>
<head>
    <title>TaskEstimates</title>

    <script type="text/javascript" src="/apps/2.0/sdk.js"></script>

    <script type="text/javascript">
        Rally.onReady(function () {
                var app = null;
var skillSet = [];

Ext.define('TaskEstimates', {

    extend: 'Rally.app.TimeboxScopedApp',

    scopeType: 'iteration',

    componentCls: 'app',

    onScopeChange: function(scope) {
    	console.log("IN scope change");
    	app = this;
    	skillSet = [{name:'.net', sum: 0}, {name: 'test', sum: 0}, {name:'ontwerp', sum:0}, {name: 'meetingpoint', sum: 0}];
		var qFilter = app.buildTagFilter(skillSet);
		console.log("Final filter: ", qFilter.toString());
		var iterationStore = Ext.create('Rally.data.wsapi.Store', {
		    model: 'Task',
		    fetch: ['Name', 'Tags', 'Estimate'],
		    filters: qFilter,
		    autoLoad: true,
		    listeners: {
		    	load: function(store, records) {

		    		_.each(records, function(record){

		    			var tagName = record.data.Tags._tagsNameArray[0].Name;
		    			var estimate = record.data.Estimate;

		    			estimate = estimate === null ? 0 : estimate;

		    			_.each(skillSet, function(skill){
		    				console.log(tagName, ":", skill.name);
		    				if (skill.name == tagName) {
		    					skill.sum = skill.sum + estimate;
		    				}
		    			});
		    		});

		    		app.addCustomGrid();
		    	}
		    }
		});
    },

    buildTagFilter: function(skillSet) {
    	var iterationFilter = app.getContext().getTimeboxScope().getQueryFilter();
    	var tagFilter = Ext.create('Rally.data.wsapi.Filter', {
    			property: 'Name',
			    operator: '=',
			    value: 'Name'
			});
    	console.log("Skills: ", skillSet);
    	_.each(skillSet, function (skill){
    		console.log("skill", skill);
    		tagFilter = tagFilter.or(Ext.create('Rally.data.wsapi.Filter', {
			    property: 'tags.Name',
			    operator: '=',
			    value: skill['name']
			}));
    	});
    	console.log("filter: ", tagFilter.toString());
    	return iterationFilter.and(tagFilter);
    },

    addCustomGrid: function() {
    	var grid = this.down("rallygrid");
    	if (grid) {
    		grid.destroy();
    	}

    	app.add({
			xtype: 'rallygrid',
            showPagingToolbar: false,
            showRowActionsColumn: false,
            editable: false,
            store: Ext.create('Rally.data.custom.Store', {
            	data: skillSet
        	}),
           	columnCfgs: [
                {
                    text: 'Name',
                    dataIndex: 'name',
                    flex: 1
                },
                {
                    text: 'Total Estimate',
                    dataIndex: 'sum'
                }
            ]

    	});
    }
});

            Rally.launchApp('TaskEstimates', {
                name:"TaskEstimates",
	            parentRepos:""
            });

        });
    </script>

    <style type="text/css">
        .app {
  /* Add app styles here */
}

    </style>
</head>
<body>
</body>
</html>


text:
using System;
using System.Threading.Tasks;
using NuKeeper.Abstractions;
using NuKeeper.Abstractions.CollaborationPlatform;
using NuKeeper.Abstractions.Configuration;

namespace NuKeeper.AzureDevOps
{
    public abstract class BaseSettingsReader : ISettingsReader
    {
        private readonly IEnvironmentVariablesProvider _environmentVariablesProvider;

        public BaseSettingsReader(IEnvironmentVariablesProvider environmentVariablesProvider)
        {
            _environmentVariablesProvider = environmentVariablesProvider;
        }

        public Platform Platform => Platform.AzureDevOps;

        public abstract Task<bool> CanRead(Uri repositoryUri);

        public void UpdateCollaborationPlatformSettings(CollaborationPlatformSettings settings)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            var envToken = _environmentVariablesProvider.GetEnvironmentVariable("NuKeeper_azure_devops_token");

            settings.Token = Concat.FirstValue(envToken, settings.Token);
            settings.ForkMode = settings.ForkMode ?? ForkMode.SingleRepositoryOnly;
        }

        public abstract Task<RepositorySettings> RepositorySettings(Uri repositoryUri, bool setAutoMerge, string targetBranch = null);
    }
}


text:
#include <postgres.h>
#include "storage/shmem.h"
#include "utils/atomic.h"
#include "cdb/cdbvars.h"
#include "utils/workfile_mgr.h"
#include "miscadmin.h"

/*
 * This is set when a backend fails to write to a workfile,
 * presumably because of an out-of-diskspace error (logical or physical)
 */
static bool workfile_diskfull = false;

/*
 * Initialize shared memory area for the WorkfileDiskspace module
 */
void
WorkfileDiskspace_Init(void)
{
	WorkfileQueryspace_Init();
	WorkfileSegspace_Init();
	WorkfileDiskspace_SetFull(false /* isFull*/);
}

/*
 * Returns the amount of shared memory needed for the WorkfileDiskspace module
 */
Size
WorkfileDiskspace_ShMemSize(void)
{
	return add_size(WorkfileQueryspace_ShMemSize(), WorkfileSegspace_ShMemSize());
}

/*
 * Reserve 'bytes' bytes to write to disk
 *   This should be called before actually writing to disk
 *
 *   If enough disk space is available, increments the global counter and returns true
 *   Otherwise, returns false
 *
 *   When either the query limit or the segment limit are hit, the
 *   workfile_diskfull flag is set to true by the respective subsystem to
 *   prevent further writes.
 */
bool
WorkfileDiskspace_Reserve(int64 bytes_to_reserve)
{
	if (bytes_to_reserve == 0)
	{
		return true;
	}

	bool queryspace_reserved = true;
	bool segspace_reserved = true;

	/* Try the per-query limit first, then the per-segment */
	if (gp_workfile_limit_per_query > 0)
	{
		queryspace_reserved =  WorkfileQueryspace_Reserve(bytes_to_reserve);
	}

	if (queryspace_reserved && gp_workfile_limit_per_segment > 0)
	{
		segspace_reserved = WorkfileSegspace_Reserve(bytes_to_reserve);
	}

	return (queryspace_reserved && segspace_reserved);
}

/*
 * Notify of how many bytes were actually written to disk
 *
 * This should be called after writing to disk, with the actual number
 * of bytes written. This must be less or equal than the amount we reserved
 *
 * update_query_space is true if commit should also be applied to the queryspace
 *
 * Returns the current used_diskspace after the commit
 */
void
WorkfileDiskspace_Commit(int64 commit_bytes, int64 reserved_bytes, bool update_query_space)
{
	Assert(reserved_bytes >= commit_bytes);
	if (reserved_bytes == commit_bytes)
	{
		/* Nothing to do, save some work and just return */
		return;
	}

	if ((gp_workfile_limit_per_query > 0) && update_query_space)
	{
		WorkfileQueryspace_Commit(commit_bytes, reserved_bytes);
	}

	if (gp_workfile_limit_per_segment > 0)
	{
		WorkfileSegspace_Commit(commit_bytes, reserved_bytes);
	}
}

/*
 * Sets the flag that marks if on a segment we reached the allowed amount of
 * diskspace to use for workfiles (physical or logical).
 */
void
WorkfileDiskspace_SetFull(bool isFull)
{
	workfile_diskfull = isFull;
}

/*
 * Returns true if we hit the amount of diskspace allowed for workfiles on this
 * segment (physical or logical)
 */
bool
WorkfileDiskspace_IsFull(void)
{
	return workfile_diskfull;
}

/* EOF */


text:
/*
 * Changes for GemFireXD distributed data platform (some marked by "GemStone changes")
 *
 * Portions Copyright (c) 2010-2015 Pivotal Software, Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License. You
 * may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * permissions and limitations under the License. See accompanying
 * LICENSE file.
 */

package	com.pivotal.gemfirexd.internal.impl.sql.compile;

import com.pivotal.gemfirexd.internal.engine.distributed.metadata.OrderByQueryInfo;
import com.pivotal.gemfirexd.internal.engine.distributed.metadata.QueryInfo;
import com.pivotal.gemfirexd.internal.engine.distributed.metadata.QueryInfoContext;
import com.pivotal.gemfirexd.internal.engine.distributed.metadata.TableQueryInfo;
import com.pivotal.gemfirexd.internal.iapi.error.StandardException;
import com.pivotal.gemfirexd.internal.iapi.services.compiler.MethodBuilder;
import com.pivotal.gemfirexd.internal.iapi.services.sanity.SanityManager;
import com.pivotal.gemfirexd.internal.iapi.sql.ResultColumnDescriptor;

/**
 * An OrderByNode represents a result set for a sort operation
 * for an order by list.  It is expected to only be generated at
 * the end of optimization, once we have determined that a sort
 * is required.
 *
 */
public class OrderByNode extends SingleChildResultSetNode
{

	OrderByList		orderByList;

	/**
	 * Initializer for a OrderByNode.
	 *
	 * @param childResult	The child ResultSetNode
	 * @param orderByList	The order by list.
 	 * @param tableProperties	Properties list associated with the table
    *
	 * @exception StandardException		Thrown on error
	 */
	public void init(
						Object childResult,
						Object orderByList,
						Object tableProperties)
		throws StandardException
	{
		ResultSetNode child = (ResultSetNode) childResult;

		super.init(childResult, tableProperties);

		this.orderByList = (OrderByList) orderByList;

		ResultColumnList prRCList;

		/*
			We want our own resultColumns, which are virtual columns
			pointing to the child result's columns.

			We have to have the original object in the distinct node,
			and give the underlying project the copy.
		 */

		/* We get a shallow copy of the ResultColumnList and its
		 * ResultColumns.  (Copy maintains ResultColumn.expression for now.)
		 */
		prRCList = child.getResultColumns().copyListAndObjects();
		resultColumns = child.getResultColumns();
		child.setResultColumns(prRCList);

		/* Replace ResultColumn.expression with new VirtualColumnNodes
		 * in the DistinctNode's RCL.  (VirtualColumnNodes include
		 * pointers to source ResultSetNode, this, and source ResultColumn.)
		 */
		resultColumns.genVirtualColumnNodes(this, prRCList);
	}

	/**
	 * Convert this object to a String.  See comments in QueryTreeNode.java
	 * for how this should be done for tree printing.
	 *
	 * @return	This object as a String
	 */

	public String toString()
	{
		if (SanityManager.DEBUG)
		{
			return childResult.toString() + "\n" +
				"orderByList: " +
				(orderByList != null ? orderByList.toString() : "null") + "\n" +
				super.toString();
		}
		else
		{
			return "";
		}
	}

	ResultColumnDescriptor[] makeResultDescriptors()
	{
	    return childResult.makeResultDescriptors();
	}

    /**
     * generate the distinct result set operating over the source
	 * resultset.
     *
	 * @exception StandardException		Thrown on error
     */
	public void generate(ActivationClassBuilder acb,
								MethodBuilder mb)
							throws StandardException
	{
		// Get the cost estimate for the child
		if (costEstimate == null)
		{
			costEstimate = childResult.getFinalCostEstimate();
		}

	    orderByList.generate(acb, mb, childResult);
	}

//GemStone changes BEGIN
  /**
   * Returns the QueryInfo object reprsenting the queries order by
   * list.
   */

  @Override
  public QueryInfo computeQueryInfo(QueryInfoContext qic) throws StandardException {
    return new OrderByQueryInfo(qic, orderByList, resultColumns,
                                                 (qic.getParentPRN() != null ?
                                                    qic.getParentPRN().getResultColumns()
                                                     : null) );
  }

  @Override
  public ResultSetNode getInnerMostPRN() {
    return childResult.getInnerMostPRN();
  }

//TODO :Asif : Check if this can be optimized for offheap
  @Override
  protected void optimizeForOffHeap( boolean shouldOptimize) {
    shouldOptimize = shouldOptimize && !this.orderByList.getSortNeeded();
    this.childResult.optimizeForOffHeap(shouldOptimize);
  }
//GemStone changes END

}


text:
package org.apache.hadoop.hbase.master.handler;

import java.io.IOException;
import java.io.InterruptedIOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.locks.Lock;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.HRegionInfo;
import org.apache.hadoop.hbase.Server;
import org.apache.hadoop.hbase.ServerName;
import org.apache.hadoop.hbase.catalog.CatalogTracker;
import org.apache.hadoop.hbase.catalog.MetaReader;
import org.apache.hadoop.hbase.executor.EventHandler;
import org.apache.hadoop.hbase.executor.EventType;
import org.apache.hadoop.hbase.master.AssignmentManager;
import org.apache.hadoop.hbase.master.DeadServer;
import org.apache.hadoop.hbase.master.MasterFileSystem;
import org.apache.hadoop.hbase.master.MasterServices;
import org.apache.hadoop.hbase.master.RegionState;
import org.apache.hadoop.hbase.master.RegionState.State;
import org.apache.hadoop.hbase.master.RegionStates;
import org.apache.hadoop.hbase.master.ServerManager;
import org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos;
import org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.SplitLogTask.RecoveryMode;
import org.apache.hadoop.hbase.zookeeper.ZKAssign;
import org.apache.zookeeper.KeeperException;

/**
 * Process server shutdown.
 * Server-to-handle must be already in the deadservers lists.  See
 * {@link ServerManager#expireServer(ServerName)}
 */
@InterfaceAudience.Private
public class ServerShutdownHandler extends EventHandler {
  private static final Log LOG = LogFactory.getLog(ServerShutdownHandler.class);
  protected final ServerName serverName;
  protected final MasterServices services;
  protected final DeadServer deadServers;
  protected final boolean shouldSplitHlog; // whether to split HLog or not
  protected final int regionAssignmentWaitTimeout;

  public ServerShutdownHandler(final Server server, final MasterServices services,
      final DeadServer deadServers, final ServerName serverName,
      final boolean shouldSplitHlog) {
    this(server, services, deadServers, serverName, EventType.M_SERVER_SHUTDOWN,
        shouldSplitHlog);
  }

  ServerShutdownHandler(final Server server, final MasterServices services,
      final DeadServer deadServers, final ServerName serverName, EventType type,
      final boolean shouldSplitHlog) {
    super(server, type);
    this.serverName = serverName;
    this.server = server;
    this.services = services;
    this.deadServers = deadServers;
    if (!this.deadServers.isDeadServer(this.serverName)) {
      LOG.warn(this.serverName + " is NOT in deadservers; it should be!");
    }
    this.shouldSplitHlog = shouldSplitHlog;
    this.regionAssignmentWaitTimeout = server.getConfiguration().getInt(
      HConstants.LOG_REPLAY_WAIT_REGION_TIMEOUT, 15000);
  }

  @Override
  public String getInformativeName() {
    if (serverName != null) {
      return this.getClass().getSimpleName() + " for " + serverName;
    } else {
      return super.getInformativeName();
    }
  }

  /**
   * @return True if the server we are processing was carrying hbase:meta
   */
  boolean isCarryingMeta() {
    return false;
  }

  @Override
  public String toString() {
    return getClass().getSimpleName() + "-" + serverName + "-" + getSeqid();
  }

  @Override
  public void process() throws IOException {
    boolean hasLogReplayWork = false;
    final ServerName serverName = this.serverName;
    try {

      // We don't want worker thread in the MetaServerShutdownHandler
      // executor pool to block by waiting availability of hbase:meta
      // Otherwise, it could run into the following issue:
      // 1. The current MetaServerShutdownHandler instance For RS1 waits for the hbase:meta
      //    to come online.
      // 2. The newly assigned hbase:meta region server RS2 was shutdown right after
      //    it opens the hbase:meta region. So the MetaServerShutdownHandler
      //    instance For RS1 will still be blocked.
      // 3. The new instance of MetaServerShutdownHandler for RS2 is queued.
      // 4. The newly assigned hbase:meta region server RS3 was shutdown right after
      //    it opens the hbase:meta region. So the MetaServerShutdownHandler
      //    instance For RS1 and RS2 will still be blocked.
      // 5. The new instance of MetaServerShutdownHandler for RS3 is queued.
      // 6. Repeat until we run out of MetaServerShutdownHandler worker threads
      // The solution here is to resubmit a ServerShutdownHandler request to process
      // user regions on that server so that MetaServerShutdownHandler
      // executor pool is always available.
      //
      // If AssignmentManager hasn't finished rebuilding user regions,
      // we are not ready to assign dead regions either. So we re-queue up
      // the dead server for further processing too.
      AssignmentManager am = services.getAssignmentManager();
      if (isCarryingMeta() // hbase:meta
          || !am.isFailoverCleanupDone()) {
        this.services.getServerManager().processDeadServer(serverName, this.shouldSplitHlog);
        return;
      }

      // Wait on meta to come online; we need it to progress.
      // TODO: Best way to hold strictly here?  We should build this retry logic
      // into the MetaReader operations themselves.
      // TODO: Is the reading of hbase:meta necessary when the Master has state of
      // cluster in its head?  It should be possible to do without reading hbase:meta
      // in all but one case. On split, the RS updates the hbase:meta
      // table and THEN informs the master of the split via zk nodes in
      // 'unassigned' dir.  Currently the RS puts ephemeral nodes into zk so if
      // the regionserver dies, these nodes do not stick around and this server
      // shutdown processing does fixup (see the fixupDaughters method below).
      // If we wanted to skip the hbase:meta scan, we'd have to change at least the
      // final SPLIT message to be permanent in zk so in here we'd know a SPLIT
      // completed (zk is updated after edits to hbase:meta have gone in).  See
      // {@link SplitTransaction}.  We'd also have to be figure another way for
      // doing the below hbase:meta daughters fixup.
      Set<HRegionInfo> hris = null;
      while (!this.server.isStopped()) {
        try {
          this.server.getCatalogTracker().waitForMeta();
          // Skip getting user regions if the server is stopped.
          if (!this.server.isStopped()) {
            hris = MetaReader.getServerUserRegions(this.server.getCatalogTracker(),
              this.serverName).keySet();
          }
          break;
        } catch (InterruptedException e) {
          Thread.currentThread().interrupt();
          throw (InterruptedIOException)new InterruptedIOException().initCause(e);
        } catch (IOException ioe) {
          LOG.info("Received exception accessing hbase:meta during server shutdown of " +
            serverName + ", retrying hbase:meta read", ioe);
        }
      }
      if (this.server.isStopped()) {
        throw new IOException("Server is stopped");
      }

      // delayed to set recovery mode based on configuration only after all outstanding splitlogtask
      // drained
      this.services.getMasterFileSystem().setLogRecoveryMode();
      boolean distributedLogReplay =
        (this.services.getMasterFileSystem().getLogRecoveryMode() == RecoveryMode.LOG_REPLAY);

      try {
        if (this.shouldSplitHlog) {
          LOG.info("Splitting logs for " + serverName + " before assignment.");
          if (distributedLogReplay) {
            LOG.info("Mark regions in recovery before assignment.");
            MasterFileSystem mfs = this.services.getMasterFileSystem();
            mfs.prepareLogReplay(serverName, hris);
          } else {
            this.services.getMasterFileSystem().splitLog(serverName);
          }
          am.getRegionStates().logSplit(serverName);
        } else {
          LOG.info("Skipping log splitting for " + serverName);
        }
      } catch (IOException ioe) {
        resubmit(serverName, ioe);
      }

      // Clean out anything in regions in transition.  Being conservative and
      // doing after log splitting.  Could do some states before -- OPENING?
      // OFFLINE? -- and then others after like CLOSING that depend on log
      // splitting.
      List<HRegionInfo> regionsInTransition = am.processServerShutdown(serverName);
      LOG.info("Reassigning " + ((hris == null)? 0: hris.size()) +
        " region(s) that " + (serverName == null? "null": serverName)  +
        " was carrying (and " + regionsInTransition.size() +
        " regions(s) that were opening on this server)");

      List<HRegionInfo> toAssignRegions = new ArrayList<HRegionInfo>();
      toAssignRegions.addAll(regionsInTransition);

      // Iterate regions that were on this server and assign them
      if (hris != null && !hris.isEmpty()) {
        RegionStates regionStates = am.getRegionStates();
        for (HRegionInfo hri: hris) {
          if (regionsInTransition.contains(hri)) {
            continue;
          }
          String encodedName = hri.getEncodedName();
          Lock lock = am.acquireRegionLock(encodedName);
          try {
            RegionState rit = regionStates.getRegionTransitionState(hri);
            if (processDeadRegion(hri, am, server.getCatalogTracker())) {
              ServerName addressFromAM = regionStates.getRegionServerOfRegion(hri);
              if (addressFromAM != null && !addressFromAM.equals(this.serverName)) {
                // If this region is in transition on the dead server, it must be
                // opening or pending_open, which should have been covered by AM#processServerShutdown
                LOG.info("Skip assigning region " + hri.getRegionNameAsString()
                  + " because it has been opened in " + addressFromAM.getServerName());
                continue;
              }
              if (rit != null) {
                if (rit.getServerName() != null && !rit.isOnServer(serverName)) {
                  // Skip regions that are in transition on other server
                  LOG.info("Skip assigning region in transition on other server" + rit);
                  continue;
                }
                try{
                  //clean zk node
                  LOG.info("Reassigning region with rs = " + rit + " and deleting zk node if exists");
                  ZKAssign.deleteNodeFailSilent(services.getZooKeeper(), hri);
                  regionStates.updateRegionState(hri, State.OFFLINE);
                } catch (KeeperException ke) {
                  this.server.abort("Unexpected ZK exception deleting unassigned node " + hri, ke);
                  return;
                }
              } else if (regionStates.isRegionInState(
                  hri, State.SPLITTING_NEW, State.MERGING_NEW)) {
                regionStates.updateRegionState(hri, State.OFFLINE);
              }
              toAssignRegions.add(hri);
            } else if (rit != null) {
              if (rit.isPendingCloseOrClosing()
                  && am.getTableStateManager().isTableState(hri.getTable(),
                  ZooKeeperProtos.Table.State.DISABLED, ZooKeeperProtos.Table.State.DISABLING)) {
                // If the table was partially disabled and the RS went down, we should clear the RIT
                // and remove the node for the region.
                // The rit that we use may be stale in case the table was in DISABLING state
                // but though we did assign we will not be clearing the znode in CLOSING state.
                // Doing this will have no harm. See HBASE-5927
                regionStates.updateRegionState(hri, State.OFFLINE);
                am.deleteClosingOrClosedNode(hri, rit.getServerName());
                am.offlineDisabledRegion(hri);
              } else {
                LOG.warn("THIS SHOULD NOT HAPPEN: unexpected region in transition "
                  + rit + " not to be assigned by SSH of server " + serverName);
              }
            }
          } finally {
            lock.unlock();
          }
        }
      }

      try {
        am.assign(toAssignRegions);
      } catch (InterruptedException ie) {
        LOG.error("Caught " + ie + " during round-robin assignment");
        throw (InterruptedIOException)new InterruptedIOException().initCause(ie);
      }

      if (this.shouldSplitHlog && distributedLogReplay) {
        // wait for region assignment completes
        for (HRegionInfo hri : toAssignRegions) {
          try {
            if (!am.waitOnRegionToClearRegionsInTransition(hri, regionAssignmentWaitTimeout)) {
              // Wait here is to avoid log replay hits current dead server and incur a RPC timeout
              // when replay happens before region assignment completes.
              LOG.warn("Region " + hri.getEncodedName()
                  + " didn't complete assignment in time");
            }
          } catch (InterruptedException ie) {
            throw new InterruptedIOException("Caught " + ie
                + " during waitOnRegionToClearRegionsInTransition");
          }
        }
        // submit logReplay work
        this.services.getExecutorService().submit(
          new LogReplayHandler(this.server, this.services, this.deadServers, this.serverName));
        hasLogReplayWork = true;
      }
    } finally {
      this.deadServers.finish(serverName);
    }

    if (!hasLogReplayWork) {
      LOG.info("Finished processing of shutdown of " + serverName);
    }
  }

  private void resubmit(final ServerName serverName, IOException ex) throws IOException {
    // typecast to SSH so that we make sure that it is the SSH instance that
    // gets submitted as opposed to MSSH or some other derived instance of SSH
    this.services.getExecutorService().submit((ServerShutdownHandler) this);
    this.deadServers.add(serverName);
    throw new IOException("failed log splitting for " + serverName + ", will retry", ex);
  }

  /**
   * Process a dead region from a dead RS. Checks if the region is disabled or
   * disabling or if the region has a partially completed split.
   * @param hri
   * @param assignmentManager
   * @param catalogTracker
   * @return Returns true if specified region should be assigned, false if not.
   * @throws IOException
   */
  public static boolean processDeadRegion(HRegionInfo hri,
      AssignmentManager assignmentManager, CatalogTracker catalogTracker)
  throws IOException {
    boolean tablePresent = assignmentManager.getTableStateManager().isTablePresent(hri.getTable());
    if (!tablePresent) {
      LOG.info("The table " + hri.getTable()
          + " was deleted.  Hence not proceeding.");
      return false;
    }
    // If table is not disabled but the region is offlined,
    boolean disabled = assignmentManager.getTableStateManager().isTableState(hri.getTable(),
      ZooKeeperProtos.Table.State.DISABLED);
    if (disabled){
      LOG.info("The table " + hri.getTable()
          + " was disabled.  Hence not proceeding.");
      return false;
    }
    if (hri.isOffline() && hri.isSplit()) {
      //HBASE-7721: Split parent and daughters are inserted into hbase:meta as an atomic operation.
      //If the meta scanner saw the parent split, then it should see the daughters as assigned
      //to the dead server. We don't have to do anything.
      return false;
    }
    boolean disabling = assignmentManager.getTableStateManager().isTableState(hri.getTable(),
      ZooKeeperProtos.Table.State.DISABLING);
    if (disabling) {
      LOG.info("The table " + hri.getTable()
          + " is disabled.  Hence not assigning region" + hri.getEncodedName());
      return false;
    }
    return true;
  }
}