text:
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.

using System;
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
using System.Xml.Serialization;

namespace Microsoft.TestCommon
{
    /// <summary>
    /// MSTest utility for testing code operating against a stream.
    /// </summary>
    public class SerializerAssert
    {
        private static SerializerAssert singleton = new SerializerAssert();

        public static SerializerAssert Singleton { get { return singleton; } }

        /// <summary>
        /// Creates a <see cref="Stream"/>, serializes <paramref name="objectInstance"/> to it using
        /// <see cref="XmlSerializer"/>, rewinds the stream and calls <see cref="codeThatChecks"/>.
        /// </summary>
        /// <param name="type">The type to serialize.  It cannot be <c>null</c>.</param>
        /// <param name="objectInstance">The value to serialize.</param>
        /// <param name="codeThatChecks">Code to check the contents of the stream.</param>
        public void UsingXmlSerializer(Type type, object objectInstance, Action<Stream> codeThatChecks)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            if (codeThatChecks == null)
            {
                throw new ArgumentNullException("codeThatChecks");
            }

            XmlSerializer serializer = new XmlSerializer(type);

            using (MemoryStream stream = new MemoryStream())
            {
                serializer.Serialize(stream, objectInstance);

                stream.Flush();
                stream.Seek(0L, SeekOrigin.Begin);

                codeThatChecks(stream);
            }
        }

        /// <summary>
        /// Creates a <see cref="Stream"/>, serializes <paramref name="objectInstance"/> to it using
        /// <see cref="XmlSerializer"/>, rewinds the stream and calls <see cref="codeThatChecks"/>.
        /// </summary>
        /// <typeparam name="T">The type to serialize.</typeparam>
        /// <param name="objectInstance">The value to serialize.</param>
        /// <param name="codeThatChecks">Code to check the contents of the stream.</param>
        public void UsingXmlSerializer<T>(T objectInstance, Action<Stream> codeThatChecks)
        {
            UsingXmlSerializer(typeof(T), objectInstance, codeThatChecks);
        }

        /// <summary>
        /// Creates a <see cref="Stream"/>, serializes <paramref name="objectInstance"/> to it using
        /// <see cref="DataContractSerializer"/>, rewinds the stream and calls <see cref="codeThatChecks"/>.
        /// </summary>
        /// <param name="type">The type to serialize.  It cannot be <c>null</c>.</param>
        /// <param name="objectInstance">The value to serialize.</param>
        /// <param name="codeThatChecks">Code to check the contents of the stream.</param>
        public void UsingDataContractSerializer(Type type, object objectInstance, Action<Stream> codeThatChecks)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            if (codeThatChecks == null)
            {
                throw new ArgumentNullException("codeThatChecks");
            }

            DataContractSerializer serializer = new DataContractSerializer(type);

            using (MemoryStream stream = new MemoryStream())
            {
                serializer.WriteObject(stream, objectInstance);

                stream.Flush();
                stream.Seek(0L, SeekOrigin.Begin);

                codeThatChecks(stream);
            }
        }

        /// <summary>
        /// Creates a <see cref="Stream"/>, serializes <paramref name="objectInstance"/> to it using
        /// <see cref="DataContractSerializer"/>, rewinds the stream and calls <see cref="codeThatChecks"/>.
        /// </summary>
        /// <typeparam name="T">The type to serialize.</typeparam>
        /// <param name="objectInstance">The value to serialize.</param>
        /// <param name="codeThatChecks">Code to check the contents of the stream.</param>
        public void UsingDataContractSerializer<T>(T objectInstance, Action<Stream> codeThatChecks)
        {
            UsingDataContractSerializer(typeof(T), objectInstance, codeThatChecks);
        }

        /// <summary>
        /// Creates a <see cref="Stream"/>, serializes <paramref name="objectInstance"/> to it using
        /// <see cref="DataContractJsonSerializer"/>, rewinds the stream and calls <see cref="codeThatChecks"/>.
        /// </summary>
        /// <param name="type">The type to serialize.  It cannot be <c>null</c>.</param>
        /// <param name="objectInstance">The value to serialize.</param>
        /// <param name="codeThatChecks">Code to check the contents of the stream.</param>
        public static void UsingDataContractJsonSerializer(Type type, object objectInstance, Action<Stream> codeThatChecks)
        {
            if (type == null)
            {
                throw new ArgumentNullException("type");
            }

            if (codeThatChecks == null)
            {
                throw new ArgumentNullException("codeThatChecks");
            }

            DataContractJsonSerializer serializer = new DataContractJsonSerializer(type);

            using (MemoryStream stream = new MemoryStream())
            {
                serializer.WriteObject(stream, objectInstance);

                stream.Flush();
                stream.Seek(0L, SeekOrigin.Begin);

                codeThatChecks(stream);
            }
        }

        /// <summary>
        /// Creates a <see cref="Stream"/>, serializes <paramref name="objectInstance"/> to it using
        /// <see cref="DataContractJsonSerializer"/>, rewinds the stream and calls <see cref="codeThatChecks"/>.
        /// </summary>
        /// <typeparam name="T">The type to serialize.</typeparam>
        /// <param name="objectInstance">The value to serialize.</param>
        /// <param name="codeThatChecks">Code to check the contents of the stream.</param>
        public void UsingDataContractJsonSerializer<T>(T objectInstance, Action<Stream> codeThatChecks)
        {
            UsingDataContractJsonSerializer(typeof(T), objectInstance, codeThatChecks);
        }
    }
}


text:
FILE(REMOVE_RECURSE
  "CMakeFiles/conservative_resize_5.dir/conservative_resize.cpp.o"
  "conservative_resize_5.pdb"
  "conservative_resize_5"
)

# Per-language clean rules from dependency scanning.
FOREACH(lang CXX)
  INCLUDE(CMakeFiles/conservative_resize_5.dir/cmake_clean_${lang}.cmake OPTIONAL)
ENDFOREACH(lang)

redpajama_set_name: RedPajamaGithub


text:
<?php

/**
 * Performs requests on EchoNest API. API documentation should be self-explanatory.
 *
 * @author    Brent Shaffer <bshafs at gmail dot com>
 * @license   MIT License
 */
interface EchoNest_HttpClientInterface
{
    /**
     * Send a GET request
     *
     * @param  string   $path            Request path
     * @param  array    $parameters     GET Parameters
     * @param  string   $httpMethod     HTTP method to use
     * @param  array    $options        reconfigure the request for this call only
     *
     * @return array                    Data
     */
    public function get($path, array $parameters = array(), array $options = array());

    /**
     * Send a POST request
     *
     * @param  string   $path            Request path
     * @param  array    $parameters     POST Parameters
     * @param  string   $httpMethod     HTTP method to use
     * @param  array    $options        reconfigure the request for this call only
     *
     * @return array                    Data
     */
    public function post($path, array $parameters = array(), array $options = array());

    /**
     * Change an option value.
     *
     * @param string $name   The option name
     * @param mixed  $value  The value
     *
     * @return EchoNest_HttpClientInterface The current object instance
     */
    public function setOption($name, $value);
}


text:
<!DOCTYPE html>

    <title>Textarea test</title>

    <textarea spellcheck="false"></textarea>
    <input></input>

Plain div


text:
module RTAPI
  class TicketCreator
    def initialize(cli, config)
      @cli = cli
      @config = config
    end

    def create(notification)
      RTAPI.log.info("+++ OUTPUT +++ #{notification.to_s}")

      response = @cli.find_ticket(notification)

      if response.exist?
        unless notification.problem_id == "0"
          # ticket already existing
          RTAPI.log.info("Ticket exists: #{response.ticket_id}")

          {success: true, message: "Ticket exists: #{response.ticket_id}"}
        else
          res_comment = @cli.comment_ticket(response, notification)
          if res_comment.success?
            RTAPI.log.info("Ticket #{response.ticket_id} commented")
          else
            RTAPI.log.info("Unable to comment ticket: #{res_comment.message}")
          end

          if @config.autoresolve?
            if @cli.ticket_unowned?(response)
              # resolve this ticket if
              # the autoresolve config is set, and
              # the ticket is unowned
              res_resolve = @cli.resolve_ticket(response, notification)

              if res_resolve.success?
                RTAPI.log.info("Ticket #{res_resolve.ticket_id} resolved")

                {success: true, message: "Ticket #{res_resolve.ticket_id} resolved"}
              else
                RTAPI.log.info("Unable to resolve ticket: #{res_resolve.message}")

                error!({success: false, message: "Unable to resolve ticket: #{res_resolve.message}"}, 400)
              end
            else
              RTAPI.log.info("Ticket #{response.ticket_id} has an owner, not closing it")
            end
          else
            RTAPI.log.info("Autoresolve is disabled, leaving ticket #{response.ticket_id} open")
          end
        end
      else
        # no ticket existing, create it
        unless notification.ok_or_up?
          # do not create a ticket if state is UP or OK
          res = @cli.create_ticket(notification)

          if res.success?
            RTAPI.log.info("Ticket #{res.ticket_id} created")

            {success: true, message: "Ticket #{res.ticket_id} created"}
          else
            RTAPI.log.info("Unable to create ticket: #{res.message}")

            error!({success: false, message: "Unable to create ticket: #{res.message}"}, 400)
          end
        else
          RTAPI.log.info("Monitoring state 'OK' or 'UP' received, ignoring it.")
        end
      end
    end
  end
end


text:
///////////////////////////////////////////////
// MKGlowSystem								 //
//											 //
// Created by Michael Kremmel on 23.12.2014  //
// Copyright © 2015 All rights reserved.     //
///////////////////////////////////////////////

using UnityEngine;
using System.Collections;
using MKGlowSystem;

public class MK_DemoControl : MonoBehaviour
{
	private MKGlow mkGlow;
	private GUIStyle bStyle;
	private GUIStyle r2bStyle;
	public GUISkin skin;
	private int currentRoom = 0;
	private int currentRoom2Texture = 0;
	private int currentRoom1Object = 0;
	private int currentRoom1Texture = 0;
	private int currentRoom1GlowColor = 0;
	private int currentRoom1GlowTexColor = 2;
	private int currentRoom0GlowColor = 0;
	private int currentRoom1Shader = 0;
	public Shader[] room1Shaders = new Shader[3];
	public Cubemap cm;
	private float room1RimP = 3.0f;
	private int currentRimColor = 0;

	private float room1GlowIntensity = 0.75f;
	private float room1GlowTextureStrength = 1;
	private float room1GlowWidth = 0;

	public Texture[] room2Tex = new Texture[2];
	public GameObject[] room2Objects = new GameObject[10];
	public GameObject[] room1Objects = new GameObject[2];

	void Awake ()
	{
		mkGlow = this.GetComponent<MKGlow>();
		InitGlowSystem();
		skin.horizontalSlider.fixedHeight = 25f;
	}

	void Update ()
	{
		ManageRoom();
	}

	private void InitRoom1()
	{
		room1GlowTextureStrength = 1.0f;
		room1GlowIntensity = 1.0f;
		room1GlowWidth = 0.0f;
		currentRoom1GlowColor = 0;
		currentRoom1Object = 0;
		currentRoom1GlowTexColor = 0;
		currentRoom1Shader = 0;
		room1RimP = 3.0f;
		currentRimColor = 0;
	}

	private void InitRoom2()
	{
		currentRoom2Texture = 0;
	}

	private void InitGlowSystem()
	{
		mkGlow.BlurIterations = 5;
		mkGlow.BlurOffset = 0.25f;
		mkGlow.Samples = 4;
		mkGlow.GlowIntensity = 0.3f;
		mkGlow.BlurSpread = 0.25f;

		mkGlow.GlowType = MKGlowType.Selective;
		mkGlow.GlowQuality = MKGlowQuality.High;
		currentRoom0GlowColor = 0;
	}

	private void CreateMatrix(int depth, float nativeWidth, float nativeHeight)
	{
		float rx = Screen.width / nativeWidth;
		float ry = Screen.height / nativeHeight;

		GUI.matrix = Matrix4x4.TRS (new Vector3(0, 0, 1), Quaternion.identity, new Vector3 (rx, ry, depth));
	}

	private void OnGUI()
	{
		if(bStyle == null)
			bStyle = new GUIStyle (GUI.skin.button);

		if(r2bStyle == null)
			r2bStyle = new GUIStyle ();

		bStyle.fontSize = 40;
		r2bStyle.fontSize = 40;
		r2bStyle.normal.textColor = Color.white;
		CreateMatrix(1, 1920f, 1080f);
		SwitchRoom();

		if(currentRoom == 1)
			ManageRoom1();
		else if(currentRoom == 2)
			ManageRoom2();
		else
			ManageRoom0();
	}

	private void ManageRoom()
	{
		Quaternion quaternion = new Quaternion();

		if(currentRoom == 1)
			quaternion.eulerAngles = new Vector3(10,120,0);
		else if(currentRoom == 2)
			quaternion.eulerAngles = new Vector3(10,240,0);
		else
			quaternion.eulerAngles = new Vector3(10,0,0);

		this.transform.rotation = quaternion;
	}

	private void SwitchRoom()
	{
		if(GUI.Button(new Rect(835,950, 250,100), "Next Room", bStyle))
			currentRoom++;

		if(currentRoom > 2)
			currentRoom = 0;
	}

	private void ManageRoom0()
	{
		InitRoom1 ();
		InitRoom2 ();
		GUI.skin = skin;
		if(mkGlow.GlowType == MKGlowType.Selective)
		{
			if(GUI.Button(new Rect(25, 900, 400, 50), "Switch Glowmode", bStyle))
				mkGlow.GlowType = MKGlowType.Fullscreen;
		}
		else
		{
			if(GUI.Button(new Rect(25, 900, 400, 50), "Switch Glowmode", bStyle))
				mkGlow.GlowType = MKGlowType.Selective;
		}

		if(GUI.Button(new Rect(25, 800, 400, 50), "Switch Glowquality", bStyle))
		{
			if(mkGlow.GlowQuality == MKGlowQuality.High)
				mkGlow.GlowQuality = MKGlowQuality.Low;
			else
				mkGlow.GlowQuality = MKGlowQuality.High;
		}

		if(mkGlow.GlowQuality == MKGlowQuality.High)
			GUI.Label(new Rect(1500, 450, 410, 50), "Glowquality: High", r2bStyle);
		else
			GUI.Label(new Rect(1500, 450, 410, 50), "Glowquality: Low", r2bStyle);

		if(mkGlow.GlowType == MKGlowType.Selective)
			GUI.Label(new Rect(1500, 500, 410, 50), "GlowMode: Selective", r2bStyle);
		else
			GUI.Label(new Rect(1500, 500, 410, 50), "GlowMode: Fullscreen", r2bStyle);

		if(mkGlow.GlowType == MKGlowType.Fullscreen)
		{
			if(GUI.Button(new Rect(1500, 400, 400, 50), "Switch Color", bStyle))
			{
				currentRoom0GlowColor++;
				if(currentRoom0GlowColor > 4)
					currentRoom0GlowColor =0;
			}
			Color[] colors = new Color[5]{Color.white, Color.red,Color.cyan, Color.yellow, Color.green};
			colors[currentRoom0GlowColor].a = 0;
			mkGlow.FullScreenGlowTint = colors[currentRoom0GlowColor];
		}

		mkGlow.BlurSpread = GUI.HorizontalSlider(new Rect(1500, 650, 400, 100), mkGlow.BlurSpread, 0.2f, 1.0f);
		GUI.Label(new Rect(1500, 600, 300, 50), "Blur Spread", r2bStyle);
		mkGlow.BlurSpread = GUI.HorizontalSlider(new Rect(1500, 650, 400, 100), mkGlow.BlurSpread, 0.2f, 1.0f);
		GUI.Label(new Rect(1500, 700, 300, 50), "Blur Offset", r2bStyle);
		mkGlow.BlurOffset = GUI.HorizontalSlider(new Rect(1500, 750, 400, 100), mkGlow.BlurOffset, 0.0f, 1.0f);
		GUI.Label(new Rect(1500, 800, 300, 50), "Samples", r2bStyle);
		mkGlow.Samples = Mathf.RoundToInt(GUI.HorizontalSlider(new Rect(1500, 850, 400, 100), mkGlow.Samples, 1, 16));
		GUI.Label(new Rect(1500, 900, 300, 50), "Blur Iterations", r2bStyle);
		mkGlow.BlurIterations = Mathf.RoundToInt(GUI.HorizontalSlider(new Rect(1500, 950, 400, 100), mkGlow.BlurIterations, 0, 11));
		GUI.Label(new Rect(1500, 1000, 300, 50), "Glow Intensity", r2bStyle);
		mkGlow.GlowIntensity = GUI.HorizontalSlider(new Rect(1500, 1050, 400, 100), mkGlow.GlowIntensity, 0.0f, 1f);
	}
	private void ManageRoom1()
	{
		InitRoom2();
		InitGlowSystem ();
		Color[] colors = new Color[5]{Color.white, Color.red,Color.cyan, Color.yellow, Color.green};
		if(GUI.Button(new Rect(150, 860, 400, 50), "Switch Shader", bStyle))
		{
			currentRoom1Shader++;
			if(currentRoom1Shader >2)
				currentRoom1Shader =0;
		}
		if(GUI.Button(new Rect(150, 935, 400, 50), "Switch Texture", bStyle))
		{
			currentRoom1Texture++;
			if(currentRoom1Texture >1)
				currentRoom1Texture =0;
		}
		if(GUI.Button(new Rect(150, 1000, 400, 50), "Switch Object", bStyle))
		{
			currentRoom1Object++;
			if(currentRoom1Object >1)
				currentRoom1Object =0;
		}

		if(currentRoom1Object == 0)
		{
			room1Objects[0].SetActive(true);
			room1Objects[1].SetActive(false);
		}
		else
		{
			room1Objects[0].SetActive(false);
			room1Objects[1].SetActive(true);
		}

		GUI.skin = skin;
		if(currentRoom1Shader == 1)
		{
			GUI.Label(new Rect(1500, 500, 400, 50), "Rim", r2bStyle);
			room1RimP = GUI.HorizontalSlider(new Rect(1500, 550, 400, 100), room1RimP, 0.5f, 6.0f);
			if(GUI.Button(new Rect(1400, 900, 500, 50), "Switch Rim Color", bStyle))
			{
				currentRimColor++;
				if(currentRimColor > 4)
					currentRimColor =0;
			}
		}
		GUI.Label(new Rect(1500, 600, 400, 50), "Glow Power", r2bStyle);
		room1GlowIntensity = GUI.HorizontalSlider(new Rect(1500, 650, 400, 100), room1GlowIntensity, 0.0f, 2.5f);
		GUI.Label(new Rect(1500, 700, 400, 50), "Glow Texture Strength", r2bStyle);
		room1GlowTextureStrength = GUI.HorizontalSlider(new Rect(1500, 750, 400, 100), room1GlowTextureStrength, 0.0f, 10.0f);
		GUI.Label(new Rect(1500, 800, 400, 50), "Glow Width", r2bStyle);
		room1GlowWidth = GUI.HorizontalSlider(new Rect(1500, 850, 400, 100), room1GlowWidth, 0.0f, 0.075f);

		if(GUI.Button(new Rect(1400, 960, 500, 50), "Switch Glow Color", bStyle))
		{
			currentRoom1GlowColor++;
			if(currentRoom1GlowColor > 4)
				currentRoom1GlowColor =0;
		}
		if(GUI.Button(new Rect(1400, 1025, 500, 50), "Switch Glow Texture Color", bStyle))
		{
			currentRoom1GlowTexColor++;
			if(currentRoom1GlowTexColor > 4)
				currentRoom1GlowTexColor =0;
		}

		room1Objects [currentRoom1Object].GetComponent<Renderer>().material.shader = room1Shaders [currentRoom1Shader];

		if(currentRoom1Shader == 2)
			room1Objects [currentRoom1Object].GetComponent<Renderer>().material.SetTexture ("_ToonShade", cm);
		else if(currentRoom1Shader == 1)
		{
			room1Objects [currentRoom1Object].GetComponent<Renderer>().material.SetFloat ("_RimPower", room1RimP);
			room1Objects [currentRoom1Object].GetComponent<Renderer>().material.SetColor ("_RimColor", colors[currentRimColor]);
		}

		room1Objects [currentRoom1Object].GetComponent<Renderer>().material.SetColor ("_MKGlowColor", colors[currentRoom1GlowColor]);
		room1Objects [currentRoom1Object].GetComponent<Renderer>().material.SetColor ("_MKGlowTexColor", colors[currentRoom1GlowTexColor]);
		room1Objects [currentRoom1Object].GetComponent<Renderer>().material.SetTexture ("_MKGlowTex", room2Tex [currentRoom1Texture]);
		room1Objects [currentRoom1Object].GetComponent<Renderer>().material.SetFloat ("_MKGlowPower",room1GlowIntensity);
		room1Objects [currentRoom1Object].GetComponent<Renderer>().material.SetFloat ("_MKGlowTexStrength", room1GlowTextureStrength);
		room1Objects [currentRoom1Object].GetComponent<Renderer>().material.SetFloat ("_MKGlowOffSet", room1GlowWidth);

		string[] shaderName = new string[3] {"Diffuse", "Rim", "Toon"};
		GUI.Label (new Rect (900, 900, 300, 100), shaderName [currentRoom1Shader], r2bStyle);
	}
	private void ManageRoom2()
	{
		InitRoom1 ();
		InitGlowSystem ();
		GUI.Label(new Rect(150, 800, 500, 50), "DiffuseRim", r2bStyle);
		GUI.Label(new Rect(150, 850, 500, 50), "Diffuse", r2bStyle);

		GUI.Label(new Rect(450, 800, 500, 50), "DiffuseRim", r2bStyle);
		GUI.Label(new Rect(450, 850, 500, 50), "Diffuse", r2bStyle);

		GUI.Label(new Rect(800, 800, 500, 50), "ToonBasic", r2bStyle);
		GUI.Label(new Rect(800, 850, 500, 50), "Diffuse", r2bStyle);

		GUI.Label(new Rect(1150, 800, 500, 50), "Unlit", r2bStyle);
		GUI.Label(new Rect(1150, 850, 500, 50), "Diffuse", r2bStyle);

		GUI.Label(new Rect(1500, 800, 500, 50), "Transparent", r2bStyle);
		GUI.Label(new Rect(1500, 850, 500, 50), "Diffuse", r2bStyle);

		GUI.Label(new Rect(100, 950, 400, 50), "Some Variations ", r2bStyle);
		GUI.Label(new Rect(100, 1000, 500, 50), "Every Sphere has the same Textures", r2bStyle);

		if(GUI.Button(new Rect(1500, 950, 400, 50), "Switch Texture", bStyle))
		{
			currentRoom2Texture++;
			if(currentRoom2Texture > 1)
				currentRoom2Texture = 0;

			for(int i = 0; i < 10; i++)
			{
				room2Objects[i].GetComponent<Renderer>().material.SetTexture("_MKGlowTex",room2Tex[currentRoom2Texture]);
			}
		}
	}
}


text:
namespace crosapi {

// Implements the crosapi device settings interface. Lives in ash-chrome.
// Allows lacros-chrome to access device settings that live in ash.
class DeviceSettingsAsh : public mojom::DeviceSettingsService,
                          public ash::DeviceSettingsService::Observer {
 public:
  DeviceSettingsAsh();
  DeviceSettingsAsh(const DeviceSettingsAsh&) = delete;
  DeviceSettingsAsh& operator=(const DeviceSettingsAsh&) = delete;
  ~DeviceSettingsAsh() override;

  void BindReceiver(
      mojo::PendingReceiver<mojom::DeviceSettingsService> receiver);

  // ash::DeviceSettingsService::Observer
  void DeviceSettingsUpdated() override;

  // crosapi::mojom::DeviceSettingsService:
  void AddDeviceSettingsObserver(
      mojo::PendingRemote<mojom::DeviceSettingsObserver> observer) override;
  void GetDevicePolicy(GetDevicePolicyCallback callback) override;

 private:
  mojo::ReceiverSet<mojom::DeviceSettingsService> receivers_;

  // Support any number of device settings observers.
  mojo::RemoteSet<mojom::DeviceSettingsObserver> observers_;
};

}  // namespace crosapi

#endif  // CHROME_BROWSER_ASH_CROSAPI_DEVICE_SETTINGS_ASH_H_


text:
import nnabla.functions as F
import nnabla.parametric_functions as PF

from .graph_converter import FunctionModifier

class UnfusedBatchNormalizationModifier(FunctionModifier):
    """
    Unfuse `FusedBatchNormalization` to `BatchNormalization -> Add2 -> Non-Linear` block.

    If there is a `FusedBatchNormalization` pass, remove the fused batch normalization
    and replace it with the block `BatchNormalization -> Add2 -> Non-Linear`.

    Supported Non-Linear functions: `relu`

    Examples:

    .. code-block:: python

       pred = Model(...)

       import nnabla.experimental.graph_converters as GC

       modifiers = [GC.UnfusedBatchNormalizationModifier()]
       gc = GC.GraphConverter(modifiers)
       pred = gc.convert(pred)
    """

    def __init__(self):
        super(UnfusedBatchNormalizationModifier, self).__init__()
        self._fct_set = {
            'relu': F.relu
        }

    def modify(self, f, inputs):
        if f.info.type_name != 'FusedBatchNormalization':
            return

        # Prepare BN args from FBN args
        args = f.info.args
        f_non_linear = args['nonlinearity']
        del args['nonlinearity']

        # Replace FBN to "BN -> Add2 -> Non-linear"
        h = PF.batch_normalization(inputs[0], **args)
        return self._fct_set[f_non_linear](h) if len(inputs) == 5 else self._fct_set[f_non_linear](inputs[5] + h)


text:
## Context

> Common wisdom in software once held that architectural elements are "difficult to change later." An evolutionary architecture designs for incremental change in an architecture as a first principle. Evolutionary architectures are appealing because change has historically been difficult to anticipate and expensive to retrofit. If evolutionary change is built into the architecture, change becomes easier and cheaper, allowing changes to development practices, release practices, and overall agility.

Source: [Microservices as an Evolutionary Architecture](https://www.thoughtworks.com/insights/blog/microservices-evolutionary-architecture)

## A Comprehensive Presentation of Evolutionary Architecture, Presented by [Neal Ford](http://nealford.com/)

[![Evolutionary Software Architectures](http://img.youtube.com/vi/SzSZpZI02Jg/0.jpg)](https://www.youtube.com/watch?v=SzSZpZI02Jg)

## Motivation behind the choice
* The first architecture that designs for incremental change in an architecture as a first principle

## Alternatives that could have been chosen, but was not
* There are no real alternatives if the main objective is incremental, non-breaking change

## Further Reading
* [Microservices as an Evolutionary Architecture](https://www.thoughtworks.com/insights/blog/microservices-evolutionary-architecture)


text:
package us.vistacore.mocks.util;

public final class NullSafeStringComparer {

    private NullSafeStringComparer() { }

    public static boolean areEqual(String x, String y) {
        if (x == null) {
            return y == null;
        } else if (y == null) {
            return false;
        } else {
            return x.equals(y);
        }
    }

    public static boolean areNotEqual(String x, String y) {
        return !areEqual(x, y);
    }

}


text:
import presenter from '../../presenter/message';
import * as message from '../../services/message';

export async function list (req, res) {
  res
    .status(200)
    .send(
      presenter(
        await message.list(
          req.repositories
        )
      )
    );
}

export async function create (req, res) {
  res
    .status(201)
    .send(
      presenter(
        await message.create(
          req.repositories,
          req.body,
        )
      )
    );
}

export async function detail (req, res) {
  res
    .status(200)
    .send(
      presenter(
        await message.detail(
          req.repositories,
          req.params.id,
        )
      )
    );
}

export async function update (req, res) {
  req.body.id = req.params.id; // eslint-disable-line no-param-reassign

  res
    .status(200)
    .send(
      presenter(
        await message.update(
          req.repositories,
          req.body,
        )
      )
    );
}

export async function remove (req, res) {
  res
    .status(204)
    .send(
      await message.remove(
        req.repositories,
        req.params.id,
      )
    );
}


text:
            <form class="form-horizontal form-bordered " role="form" novalidate name="searchFeedForm">

                    Keyword:

                        <input type="text" class="form-control col-md-3" ng-model="keyword">

                    Source Type:

                            <input class="checkbox" pr-check type="checkbox" name="sourceType" ng-checked="st.checked"
                                   ng-model="st.checked" value="{{st.type}}"/>{{st.type}}

                    Date Range:

                        <select class="form-control col-md-3">
                            <option>Last 7 Days</option>
                            <option>Last month</option>
                        </select>
                        TimeFrame:    from
                        <input bs-datepicker class="form-control col-md-3" type="text" ng-model="feeds.startTime"
                               name="startTime" required="">
                        to
                        <input bs-datepicker class="form-control col-md-3" type="text" ng-model="feeds.endTime">

 {{ warning }}

                        <button title="Topic Not null" class="btn btn-primary" data-toggle="modal" ng-click=""
                                data-target="#saveTopicModal"
                                ng-disabled='searchFeedForm.$invalid||!!!keyword'>Add Topic
                        </button>
                        <button class="btn btn-primary" data-toggle="modal" ng-click="" data-target="#addGroupModal">Add
                            Group
                        </button>

            </form>

    <pr-box>

                Group Name
                Description
                Action

                {{group.Name }}
                {{group.Description }}

                    <button class="btn btn-primary"   ng-click="delGroup(group)" >Delete
                    </button>

    </pr-box>

                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Add Group

                <form class="form-horizontal">

                        GroupName:

                            <input type="text" class="form-control col-sm-9" ng-model="topicGroupName">

                        Description:

                            <textarea class="form-control col-sm-9" ng-model="topicGroupDescription"></textarea>

                </form>

                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" ng-disabled="!!!topicGroupName" class="btn btn-primary"
                        ng-click="saveTopicGroup()">Save
                    Group
                </button>

                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>

Are your sure save the topic?

                            Topic Name: <input type="text" ng-model="topicName">
                Group: <select ng-model="topicGroupName">
                <option ng-repeat="group in groups" value="{{group._id}}">{{group.Name}}</option>
            </select>
                {{topicGroupName}}

 {{ saveTopicWarning }}

                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                <button type="button" ng-disabled="!!!topicName" class="btn btn-primary" ng-click="saveTopic()">Save
                    Topic
                </button>


text:
#include "Edb.h"

CHAR16 *mBranchTypeStr[] = {
  L"(CALL)",
  L"(CALLEX)",
  L"(RET)",
  L"(JMP)",
  L"(JMP8)",
};

/**

  Comvert Branch Type to string.

  @param Type        Branch Type

  @retval String     string of Branch Type.

**/
CHAR16 *
EdbBranchTypeToStr (
  IN EFI_DEBUGGER_BRANCH_TYPE  Type
  )
{
  if (Type < 0 || Type >= EfiDebuggerBranchTypeEbcMax) {
    return L"(Unknown Type)";
  }

  return mBranchTypeStr [Type];
}

/**

  DebuggerCommand - CallStack.

  @param  CommandArg         The argument for this command
  @param  DebuggerPrivate    EBC Debugger private data structure
  @param  ExceptionType      Exception type.
  @param  SystemContext      EBC system context.

  @retval EFI_DEBUG_CONTINUE   formal return value

**/
EFI_DEBUG_STATUS
DebuggerCallStack (
  IN     CHAR16                    *CommandArg,
  IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
  IN     EFI_EXCEPTION_TYPE        ExceptionType,
  IN OUT EFI_SYSTEM_CONTEXT        SystemContext
  )
{
  INTN                           Index;
  UINTN                          SubIndex;
  CHAR8                          *FuncName;
  EFI_DEBUGGER_CALLSTACK_CONTEXT *CallStackEntry;
  BOOLEAN                        ShowParameter;
  UINTN                          ParameterNumber;

  ShowParameter = FALSE;
  ParameterNumber = EFI_DEBUGGER_CALL_DEFAULT_PARAMETER;

  //
  // Check argument
  //
  if (CommandArg != NULL) {
    if (StriCmp (CommandArg, L"c") == 0) {
      //
      // Clear Call-Stack
      //
      DebuggerPrivate->CallStackEntryCount = 0;
      ZeroMem (DebuggerPrivate->CallStackEntry, sizeof(DebuggerPrivate->CallStackEntry));
      EDBPrint (L"Call-Stack is cleared\n");
      return EFI_DEBUG_CONTINUE;
    } else if (StriCmp (CommandArg, L"p") == 0) {
      //
      // Print Call-Stack with parameter
      //
      ShowParameter = TRUE;
      CommandArg = StrGetNextTokenLine (L" ");
      if (CommandArg != NULL) {
        //
        // Try to get the parameter number
        //
        ParameterNumber = Atoi (CommandArg);
        if (ParameterNumber > 16) {
          EDBPrint (L"Call-Stack argument Invalid\n");
          return EFI_DEBUG_CONTINUE;
        }
      }
    } else {
      EDBPrint (L"Call-Stack argument Invalid\n");
      return EFI_DEBUG_CONTINUE;
    }
  }

  //
  // Check CallStack Entry Count
  //
  if (DebuggerPrivate->CallStackEntryCount == 0) {
    EDBPrint (L"No Call-Stack\n");
    return EFI_DEBUG_CONTINUE;
  } else if (DebuggerPrivate->CallStackEntryCount > EFI_DEBUGGER_CALLSTACK_MAX) {
    EDBPrint (L"Call-Stack Crash, re-initialize!\n");
    DebuggerPrivate->CallStackEntryCount = 0;
    return EFI_DEBUG_CONTINUE;
  }

  //
  // Go through each CallStack entry and print
  //
  EDBPrint (L"Call-Stack (TOP):\n");
  EDBPrint (L"         Caller             Callee        Name\n");
  EDBPrint (L"  ================== ================== ========\n");
//EDBPrint (L"  0x00000000FFFFFFFF 0xFFFFFFFF00000000 EfiMain\n");
  for (Index = (INTN)(DebuggerPrivate->CallStackEntryCount - 1); Index >= 0; Index--) {
    //
    // Get CallStack and print
    //
    CallStackEntry = &DebuggerPrivate->CallStackEntry[Index];
    EDBPrint (
      L"  0x%016lx 0x%016lx",
      CallStackEntry->SourceAddress,
      CallStackEntry->DestAddress
      );
    FuncName = FindSymbolStr ((UINTN)CallStackEntry->DestAddress);
    if (FuncName != NULL) {
      EDBPrint (L" %a()", FuncName);
    }
    EDBPrint (L"\n");

    if (ShowParameter) {
      //
      // Print parameter
      //
      if (sizeof(UINTN) == sizeof(UINT64)) {
        EDBPrint (
          L"    Parameter Address (0x%016lx) (\n",
          CallStackEntry->ParameterAddr
          );
        if (ParameterNumber == 0) {
          EDBPrint (L"        )\n");
          continue;
        }
        //
        // Print each parameter
        //
        for (SubIndex = 0; SubIndex < ParameterNumber - 1; SubIndex++) {
          if (SubIndex % 2 == 0) {
            EDBPrint (L"        ");
          }
          EDBPrint (
            L"0x%016lx, ",
            CallStackEntry->Parameter[SubIndex]
            );
          if (SubIndex % 2 == 1) {
            EDBPrint (L"\n");
          }
        }
        if (SubIndex % 2 == 0) {
          EDBPrint (L"        ");
        }
        EDBPrint (
          L"0x%016lx\n",
          CallStackEntry->Parameter[SubIndex]
          );
        EDBPrint (L"        )\n");
        //
        // break only for parameter
        //
        if ((((DebuggerPrivate->CallStackEntryCount - Index) % (16 / ParameterNumber)) == 0) &&
            (Index != 0)) {
          if (SetPageBreak ()) {
            break;
          }
        }
      } else {
        EDBPrint (
          L"    Parameter Address (0x%08x) (\n",
          CallStackEntry->ParameterAddr
          );
        if (ParameterNumber == 0) {
          EDBPrint (L"        )\n");
          continue;
        }
        //
        // Print each parameter
        //
        for (SubIndex = 0; SubIndex < ParameterNumber - 1; SubIndex++) {
          if (SubIndex % 4 == 0) {
            EDBPrint (L"        ");
          }
          EDBPrint (
            L"0x%08x, ",
            CallStackEntry->Parameter[SubIndex]
            );
          if (SubIndex % 4 == 3) {
            EDBPrint (L"\n");
          }
        }
        if (SubIndex % 4 == 0) {
          EDBPrint (L"        ");
        }
        EDBPrint (
          L"0x%08x\n",
          CallStackEntry->Parameter[SubIndex]
          );
        EDBPrint (L"        )\n");
        //
        // break only for parameter
        //
        if ((((DebuggerPrivate->CallStackEntryCount - Index) % (32 / ParameterNumber)) == 0) &&
            (Index != 0)) {
          if (SetPageBreak ()) {
            break;
          }
        }
      }
    }
  }

  //
  // Done
  //
  return EFI_DEBUG_CONTINUE;
}

/**

  DebuggerCommand - InstructionBranch.

  @param  CommandArg             The argument for this command
  @param  DebuggerPrivate        EBC Debugger private data structure
  @param  ExceptionType          Exception type.
  @param  SystemContext          EBC system context.

  @retval  EFI_DEBUG_CONTINUE    formal return value

**/
EFI_DEBUG_STATUS
DebuggerInstructionBranch (
  IN     CHAR16                    *CommandArg,
  IN     EFI_DEBUGGER_PRIVATE_DATA *DebuggerPrivate,
  IN     EFI_EXCEPTION_TYPE        ExceptionType,
  IN OUT EFI_SYSTEM_CONTEXT        SystemContext
  )
{
  UINTN  Index;

  //
  // Check argument
  //
  if (CommandArg != NULL) {
    if (StriCmp (CommandArg, L"c") == 0) {
      //
      // Clear Trace
      //
      DebuggerPrivate->TraceEntryCount = 0;
      ZeroMem (DebuggerPrivate->TraceEntry, sizeof(DebuggerPrivate->TraceEntry));
      EDBPrint (L"Instruction Trace is cleared\n");
    } else {
      EDBPrint (L"Trace argument Invalid\n");
    }
    return EFI_DEBUG_CONTINUE;
  }

  //
  // Check Trace Entry Count
  //
  if (DebuggerPrivate->TraceEntryCount == 0) {
    EDBPrint (L"No Instruction Trace\n");
    return EFI_DEBUG_CONTINUE;
  } else if (DebuggerPrivate->TraceEntryCount > EFI_DEBUGGER_TRACE_MAX) {
    EDBPrint (L"Instruction Trace Crash, re-initialize!\n");
    DebuggerPrivate->TraceEntryCount = 0;
    return EFI_DEBUG_CONTINUE;
  }

  //
  // Go through each Trace entry and print
  //
  EDBPrint (L"Instruction Trace (->Latest):\n");
  EDBPrint (L"    Source Addr        Destination Addr   Type\n");
  EDBPrint (L"  ================== ================== ========\n");
//EDBPrint (L"  0x00000000FFFFFFFF 0xFFFFFFFF00000000  (CALLEX)\n");
  for (Index = 0; Index < DebuggerPrivate->TraceEntryCount; Index++) {
    EDBPrint (
      L"  0x%016lx 0x%016lx  %s\n",
      DebuggerPrivate->TraceEntry[Index].SourceAddress,
      DebuggerPrivate->TraceEntry[Index].DestAddress,
      EdbBranchTypeToStr (DebuggerPrivate->TraceEntry[Index].Type)
      );
  }

  //
  // Done
  //
  return EFI_DEBUG_CONTINUE;
}


text:
set -ex

cd $(dirname $0)

CLOUD_PROJECT=grpc-testing
ZONE=us-east1-a  # canary gateway is reachable from this zone

INSTANCE_NAME="${1:-grpc-canary-interop2}"

gcloud compute instances create $INSTANCE_NAME \
    --project="$CLOUD_PROJECT" \
    --zone "$ZONE" \
    --machine-type n1-standard-16 \
    --image ubuntu-15-10 \
    --boot-disk-size 1000 \
    --scopes https://www.googleapis.com/auth/xapi.zoo

echo 'Created GCE instance, waiting 60 seconds for it to come online.'
sleep 60

gcloud compute copy-files \
    --project="$CLOUD_PROJECT" \
    --zone "$ZONE" \
    jenkins_master.pub linux_worker_init.sh ${INSTANCE_NAME}:~

gcloud compute ssh \
    --project="$CLOUD_PROJECT" \
    --zone "$ZONE" \
    $INSTANCE_NAME --command "./linux_worker_init.sh"


text:
/** monster_list */
.monster_list,
.race_list {
	display: inline-block;
	width: 200px;
	float:left;
	margin: 5px;
	padding: 5px;
}
.monster_list .monster,
.race_list .race {
	padding-left: 15px;
	cursor: pointer;
}
.monster_list .monster.selected,
.race_list .race.selected {
	font-weight: bold;
}

/** monster_edit */
.monster_edit {
	display: inline-block;
	float:left;
	padding: 5px;
}

.monster_edit .main div span {
	display: inline-block;
	vertical-align: top;
	width: 80px;
	text-align: right;
	margin-right: 5px;
}
.monster_edit .main div input {
	width: 120px;
}
.monster_edit .main div textarea {
	width: 120px !important;
	height: 150px !important;
	resize: none;
	font-size: 12px;
}

/** button */

.monster_edit .monster_upsert,
.monster_edit .monster_delete,
.monster_edit .monster_clear {
	float: left;
	width: 100px;
}


text:
package main.structural_design_patterns.facade;

import java.sql.Connection;

public class MySqlHelper {

	public static Connection getMySqlDBConnection() {
		return null;
		}
	public void generateMySqlPDFReports(String tableName, Connection con) {
		//get data from table and generate pdf report
	}
	public void generateMySqlHTMLReport(String tableName, Connection con) {
		//get data from table and generate html report
	}
}


text:
//
//  DlRumorListViewController.m
//  RumorBoard
//
//  Created by David Wu on 19/02/2014.
//  Copyright (c) 2014 David Wu. All rights reserved.
//

#import "DlRumorListViewController.h"
#import "DlRumorCell.h"
#import "DlRumor.h"
#import "DlAPIManager.h"
#import "DlConfig.h"
#import "DlLoginViewController.h"
#import "RNBlurModalView.h"
#import "SVProgressHUD.h"

@interface DlRumorListViewController ()

@property (nonatomic, strong) NSArray *rumorList;

@end

@implementation DlRumorListViewController

- (id)initWithStyle:(UITableViewStyle)style
{
    self = [super initWithStyle:style];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Generate fake rumors
    NSMutableArray *rumorList = [[NSMutableArray alloc] init];
//    for (int i=0; i<20; ++i) {
//        DlRumor *rumor = [[DlRumor alloc] init];
//        rumor.title = [@"Name " stringByAppendingFormat:@"%02d", i];
////        rumor.cellHeight = (rand() % 300) + 160;
//        [rumorList addObject:rumor];
//    }
    self.rumorList = rumorList;
}

- (void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];

    if ([DlConfig sharedConfig].authToken.length == 0) {
//        DlLoginViewController *vc = [[DlLoginViewController alloc] init];
        DlLoginViewController *vc = [self.storyboard instantiateViewControllerWithIdentifier:@"DlLoginViewController"];
        [self.navigationController pushViewController:vc animated:YES];
    }
//    else {
//        [SVProgressHUD show];
//
//        [DlAPIManager sharedManager]
//    }
}

- (void)viewDidAppear:(BOOL)animated {
    [super viewDidAppear:animated];
    [self refresh];
}

- (void)refresh {
    [[DlAPIManager sharedManager] getRumors:^(NSObject *payload, NSError *error) {
        if (![payload isKindOfClass:[NSArray class]]) {
            return;
        }

        NSArray *jsonArray = (NSArray *)payload;
        NSMutableArray *rumorList = [[NSMutableArray alloc] init];

        for (NSDictionary *dict in jsonArray) {
            NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict
                                                               options:NSJSONWritingPrettyPrinted
                                                                 error:nil];

            NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];

            DlRumor *rumor = [[DlRumor alloc] initWithString:jsonString error:nil];
            if (rumor != nil) {
                [rumorList addObject:rumor];
            }
        }

        self.rumorList = [rumorList sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
            DlRumor *rumor1 = obj1;
            DlRumor *rumor2 = obj2;
            return [rumor2.updated_at compare:rumor1.updated_at];
        }];

        [self.tableView reloadData];
    }];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark - Table view data source

//- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
//{
//#warning Potentially incomplete method implementation.
//    // Return the number of sections.
//    return 0;
//}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.rumorList.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"DlRumorCell";
    DlRumorCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];

    cell.rumor = [self.rumorList objectAtIndex:indexPath.row];
//    [cell.commentsButton bk_addEventHandler:^(id sender) {
//        cell.rumor.expended = !cell.rumor.expended;
//
//        [self.tableView beginUpdates];
//        [self.tableView reloadRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
//        [self.tableView endUpdates];
//                            }
//                           forControlEvents:UIControlEventTouchUpInside];

    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
//    return [(DlRumor *)[self.rumorList objectAtIndex:indexPath.row] cellHeight];
    DlRumor *rumor = [self.rumorList objectAtIndex:indexPath.row];
//    DlRumorCell *cell = (DlRumorCell *)[tableView cellForRowAtIndexPath:indexPath];
//    return [rumor cellHeightWithFont:cell.rumorFont maxLines:cell.maxRumorLines width:cell.rumorWidth];
    return [rumor cellHeight];
}

/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the specified item to be editable.
    return YES;
}
*/

/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete) {
        // Delete the row from the data source
        [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade];
    }
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
    }
}
*/

/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
}
*/

/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
{
    // Return NO if you do not want the item to be re-orderable.
    return YES;
}
*/

/*
#pragma mark - Navigation

// In a story board-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}

 */

- (IBAction)onSettings:(id)sender {
//    // Testing
//    [[DlAPIManager sharedManager] getRumors:^(NSArray *jsonArray, NSError *error) {
//        int a = 0;
//    }];
    [self refresh];
}

- (IBAction)onAddRumor:(id)sender {
//    self.tableView.scrollEnabled = FALSE;
//    RNBlurModalView *modal = [[RNBlurModalView alloc] initWithViewController:self title:@"Hello world!" message:@"Pur your message here."];
//    [modal show];
}

@end


text:
package com.linkedin.pinot.core.operator.transform.transformer.timeunit;

import com.linkedin.pinot.core.operator.transform.transformer.DataTransformer;

/**
 * Interface for time unit transformer to transform time from one time unit to another.
 */
public interface TimeUnitTransformer extends DataTransformer<long[], long[]> {
}


text:
layout: page
title:  "JSON Parser"
categories: tools
---

<link rel="stylesheet" type="text/css" href="http://duyetdev.github.io/json-tools/css/jsoneditor.min.css">


text:
<!DOCTYPE HTML>

    <title>Next Binary</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="./widget.css">

 	    Click Next Number to advance the binary odometer by 1.

	    Binary Odometer

	    decimal
	    0
	    00000
	    binary

	    <input class="button" type="button" value="Next Number" onclick='advance()'>


text:
package com.fireflysource.net.http.common.v2.encoder;

import com.fireflysource.net.http.common.v2.frame.Frame;

import java.nio.ByteBuffer;
import java.util.List;

public class FrameBytes {

    public static final FrameBytes EMPTY = new FrameBytes();

    private int length;
    private List<ByteBuffer> byteBuffers;

    public int getLength() {
        return length;
    }

    public void setLength(int length) {
        this.length = length;
    }

    public List<ByteBuffer> getByteBuffers() {
        return byteBuffers;
    }

    public void setByteBuffers(List<ByteBuffer> byteBuffers) {
        this.byteBuffers = byteBuffers;
    }

    public int getDataLength() {
        if (length > 0)
            return length - Frame.HEADER_LENGTH;
        else
            return 0;
    }
}


text:
<?php

/** Zend_Oauth */
require_once 'Zend/Oauth.php';

/** Zend_Uri */
require_once 'Zend/Uri.php';

/** Zend_Oauth_Config_Interface */
require_once 'Zend/Oauth/Config/ConfigInterface.php';

/**
 * @category   Zend
 * @package    Zend_Oauth
 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
 * @license    http://framework.zend.com/license/new-bsd     New BSD License
 */
class Zend_Oauth_Config implements Zend_Oauth_Config_ConfigInterface
{
    /**
     * Signature method used when signing all parameters for an HTTP request
     *
     * @var string
     */
    protected $_signatureMethod = 'HMAC-SHA1';

    /**
     * Three request schemes are defined by OAuth, of which passing
     * all OAuth parameters by Header is preferred. The other two are
     * POST Body and Query String.
     *
     * @var string
     */
    protected $_requestScheme = Zend_Oauth::REQUEST_SCHEME_HEADER;

    /**
     * Preferred request Method - one of GET or POST - which Zend_Oauth
     * will enforce as standard throughout the library. Generally a default
     * of POST works fine unless a Provider specifically requires otherwise.
     *
     * @var string
     */
    protected $_requestMethod = Zend_Oauth::POST;

    /**
     * OAuth Version; This defaults to 1.0 - Must not be changed!
     *
     * @var string
     */
    protected $_version = '1.0';

    /**
     * This optional value is used to define where the user is redirected to
     * after authorizing a Request Token from an OAuth Providers website.
     * It's optional since a Provider may ask for this to be defined in advance
     * when registering a new application for a Consumer Key.
     *
     * @var string
     */
    protected $_callbackUrl = null;

    /**
     * The URL root to append default OAuth endpoint paths.
     *
     * @var string
     */
    protected $_siteUrl = null;

    /**
     * The URL to which requests for a Request Token should be directed.
     * When absent, assumed siteUrl+'/request_token'
     *
     * @var string
     */
    protected $_requestTokenUrl = null;

    /**
     * The URL to which requests for an Access Token should be directed.
     * When absent, assumed siteUrl+'/access_token'
     *
     * @var string
     */
    protected $_accessTokenUrl = null;

    /**
     * The URL to which users should be redirected to authorize a Request Token.
     * When absent, assumed siteUrl+'/authorize'
     *
     * @var string
     */
    protected $_authorizeUrl = null;

    /**
     * An OAuth application's Consumer Key.
     *
     * @var string
     */
    protected $_consumerKey = null;

    /**
     * Every Consumer Key has a Consumer Secret unless you're in RSA-land.
     *
     * @var string
     */
    protected $_consumerSecret = null;

    /**
     * If relevant, a PEM encoded RSA private key encapsulated as a
     * Zend_Crypt_Rsa Key
     *
     * @var Zend_Crypt_Rsa_Key_Private
     */
    protected $_rsaPrivateKey = null;

    /**
     * If relevant, a PEM encoded RSA public key encapsulated as a
     * Zend_Crypt_Rsa Key
     *
     * @var Zend_Crypt_Rsa_Key_Public
     */
    protected $_rsaPublicKey = null;

    /**
     * Generally this will nearly always be an Access Token represented as a
     * Zend_Oauth_Token_Access object.
     *
     * @var Zend_Oauth_Token
     */
    protected $_token = null;

    /**
     * Define the OAuth realm
     *
     * @var string
     */
    protected $_realm = null;

    /**
     * Constructor; create a new object with an optional array|Zend_Config
     * instance containing initialising options.
     *
     * @param  array|Zend_Config $options
     * @return void
     */
    public function __construct($options = null)
    {
        if ($options !== null) {
            if ($options instanceof Zend_Config) {
                $options = $options->toArray();
            }
            $this->setOptions($options);
        }
    }

    /**
     * Parse option array or Zend_Config instance and setup options using their
     * relevant mutators.
     *
     * @param  array|Zend_Config $options
     * @return Zend_Oauth_Config
     */
    public function setOptions(array $options)
    {
        foreach ($options as $key => $value) {
            switch ($key) {
                case 'consumerKey':
                    $this->setConsumerKey($value);
                    break;
                case 'consumerSecret':
                    $this->setConsumerSecret($value);
                    break;
                case 'signatureMethod':
                    $this->setSignatureMethod($value);
                    break;
                case 'version':
                    $this->setVersion($value);
                    break;
                case 'callbackUrl':
                    $this->setCallbackUrl($value);
                    break;
                case 'siteUrl':
                    $this->setSiteUrl($value);
                    break;
                case 'requestTokenUrl':
                    $this->setRequestTokenUrl($value);
                    break;
                case 'accessTokenUrl':
                    $this->setAccessTokenUrl($value);
                    break;
                case 'userAuthorizationUrl':
                    $this->setUserAuthorizationUrl($value);
                    break;
                case 'authorizeUrl':
                    $this->setAuthorizeUrl($value);
                    break;
                case 'requestMethod':
                    $this->setRequestMethod($value);
                    break;
                case 'rsaPrivateKey':
                    $this->setRsaPrivateKey($value);
                    break;
                case 'rsaPublicKey':
                    $this->setRsaPublicKey($value);
                    break;
                case 'realm':
                    $this->setRealm($value);
                    break;
            }
        }
        if (isset($options['requestScheme'])) {
            $this->setRequestScheme($options['requestScheme']);
        }

        return $this;
    }

    /**
     * Set consumer key
     *
     * @param  string $key
     * @return Zend_Oauth_Config
     */
    public function setConsumerKey($key)
    {
        $this->_consumerKey = $key;
        return $this;
    }

    /**
     * Get consumer key
     *
     * @return string
     */
    public function getConsumerKey()
    {
        return $this->_consumerKey;
    }

    /**
     * Set consumer secret
     *
     * @param  string $secret
     * @return Zend_Oauth_Config
     */
    public function setConsumerSecret($secret)
    {
        $this->_consumerSecret = $secret;
        return $this;
    }

    /**
     * Get consumer secret
     *
     * Returns RSA private key if set; otherwise, returns any previously set
     * consumer secret.
     *
     * @return string
     */
    public function getConsumerSecret()
    {
        if ($this->_rsaPrivateKey !== null) {
            return $this->_rsaPrivateKey;
        }
        return $this->_consumerSecret;
    }

    /**
     * Set signature method
     *
     * @param  string $method
     * @return Zend_Oauth_Config
     * @throws Zend_Oauth_Exception if unsupported signature method specified
     */
    public function setSignatureMethod($method)
    {
        $method = strtoupper($method);
        if (!in_array($method, array(
                'HMAC-SHA1', 'HMAC-SHA256', 'RSA-SHA1', 'PLAINTEXT'
            ))
        ) {
            require_once 'Zend/Oauth/Exception.php';
            throw new Zend_Oauth_Exception('Unsupported signature method: '
                . $method
                . '. Supported are HMAC-SHA1, RSA-SHA1, PLAINTEXT and HMAC-SHA256');
        }
        $this->_signatureMethod = $method;;
        return $this;
    }

    /**
     * Get signature method
     *
     * @return string
     */
    public function getSignatureMethod()
    {
        return $this->_signatureMethod;
    }

    /**
     * Set request scheme
     *
     * @param  string $scheme
     * @return Zend_Oauth_Config
     * @throws Zend_Oauth_Exception if invalid scheme specified, or if POSTBODY set when request method of GET is specified
     */
    public function setRequestScheme($scheme)
    {
        $scheme = strtolower($scheme);
        if (!in_array($scheme, array(
                Zend_Oauth::REQUEST_SCHEME_HEADER,
                Zend_Oauth::REQUEST_SCHEME_POSTBODY,
                Zend_Oauth::REQUEST_SCHEME_QUERYSTRING,
            ))
        ) {
            require_once 'Zend/Oauth/Exception.php';
            throw new Zend_Oauth_Exception(
                '\'' . $scheme . '\' is an unsupported request scheme'
            );
        }
        if ($scheme == Zend_Oauth::REQUEST_SCHEME_POSTBODY
            && $this->getRequestMethod() == Zend_Oauth::GET
        ) {
            require_once 'Zend/Oauth/Exception.php';
            throw new Zend_Oauth_Exception(
                'Cannot set POSTBODY request method if HTTP method set to GET'
            );
        }
        $this->_requestScheme = $scheme;
        return $this;
    }

    /**
     * Get request scheme
     *
     * @return string
     */
    public function getRequestScheme()
    {
        return $this->_requestScheme;
    }

    /**
     * Set version
     *
     * @param  string $version
     * @return Zend_Oauth_Config
     */
    public function setVersion($version)
    {
        $this->_version = $version;
        return $this;
    }

    /**
     * Get version
     *
     * @return string
     */
    public function getVersion()
    {
        return $this->_version;
    }

    /**
     * Set callback URL
     *
     * @param  string $url
     * @return Zend_Oauth_Config
     * @throws Zend_Oauth_Exception for invalid URLs
     */
    public function setCallbackUrl($url)
    {
        if (!Zend_Uri::check($url) && $url !== 'oob') {
            require_once 'Zend/Oauth/Exception.php';
            throw new Zend_Oauth_Exception(
                '\'' . $url . '\' is not a valid URI'
            );
        }
        $this->_callbackUrl = $url;
        return $this;
    }

    /**
     * Get callback URL
     *
     * @return string
     */
    public function getCallbackUrl()
    {
        return $this->_callbackUrl;
    }

    /**
     * Set site URL
     *
     * @param  string $url
     * @return Zend_Oauth_Config
     * @throws Zend_Oauth_Exception for invalid URLs
     */
    public function setSiteUrl($url)
    {
        if (!Zend_Uri::check($url)) {
            require_once 'Zend/Oauth/Exception.php';
            throw new Zend_Oauth_Exception(
                '\'' . $url . '\' is not a valid URI'
            );
        }
        $this->_siteUrl = $url;
        return $this;
    }

    /**
     * Get site URL
     *
     * @return string
     */
    public function getSiteUrl()
    {
        return $this->_siteUrl;
    }

    /**
     * Set request token URL
     *
     * @param  string $url
     * @return Zend_Oauth_Config
     * @throws Zend_Oauth_Exception for invalid URLs
     */
    public function setRequestTokenUrl($url)
    {
        if (!Zend_Uri::check($url)) {
            require_once 'Zend/Oauth/Exception.php';
            throw new Zend_Oauth_Exception(
                '\'' . $url . '\' is not a valid URI'
            );
        }
        $this->_requestTokenUrl = rtrim($url, '/');
        return $this;
    }

    /**
     * Get request token URL
     *
     * If no request token URL has been set, but a site URL has, returns the
     * site URL with the string "/request_token" appended.
     *
     * @return string
     */
    public function getRequestTokenUrl()
    {
        if (!$this->_requestTokenUrl && $this->_siteUrl) {
            return $this->_siteUrl . '/request_token';
        }
        return $this->_requestTokenUrl;
    }

    /**
     * Set access token URL
     *
     * @param  string $url
     * @return Zend_Oauth_Config
     * @throws Zend_Oauth_Exception for invalid URLs
     */
    public function setAccessTokenUrl($url)
    {
        if (!Zend_Uri::check($url)) {
            require_once 'Zend/Oauth/Exception.php';
            throw new Zend_Oauth_Exception(
                '\'' . $url . '\' is not a valid URI'
            );
        }
        $this->_accessTokenUrl = rtrim($url, '/');
        return $this;
    }

    /**
     * Get access token URL
     *
     * If no access token URL has been set, but a site URL has, returns the
     * site URL with the string "/access_token" appended.
     *
     * @return string
     */
    public function getAccessTokenUrl()
    {
        if (!$this->_accessTokenUrl && $this->_siteUrl) {
            return $this->_siteUrl . '/access_token';
        }
        return $this->_accessTokenUrl;
    }

    /**
     * Set user authorization URL
     *
     * @param  string $url
     * @return Zend_Oauth_Config
     * @throws Zend_Oauth_Exception for invalid URLs
     */
    public function setUserAuthorizationUrl($url)
    {
        return $this->setAuthorizeUrl($url);
    }

    /**
     * Set authorization URL
     *
     * @param  string $url
     * @return Zend_Oauth_Config
     * @throws Zend_Oauth_Exception for invalid URLs
     */
    public function setAuthorizeUrl($url)
    {
        if (!Zend_Uri::check($url)) {
            require_once 'Zend/Oauth/Exception.php';
            throw new Zend_Oauth_Exception(
                '\'' . $url . '\' is not a valid URI'
            );
        }
        $this->_authorizeUrl = rtrim($url, '/');
        return $this;
    }

    /**
     * Get user authorization URL
     *
     * @return string
     */
    public function getUserAuthorizationUrl()
    {
        return $this->getAuthorizeUrl();
    }

    /**
     * Get authorization URL
     *
     * If no authorization URL has been set, but a site URL has, returns the
     * site URL with the string "/authorize" appended.
     *
     * @return string
     */
    public function getAuthorizeUrl()
    {
        if (!$this->_authorizeUrl && $this->_siteUrl) {
            return $this->_siteUrl . '/authorize';
        }
        return $this->_authorizeUrl;
    }

    /**
     * Set request method
     *
     * @param  string $method
     * @return Zend_Oauth_Config
     * @throws Zend_Oauth_Exception for invalid request methods
     */
    public function setRequestMethod($method)
    {
        $method = strtoupper($method);
        if (!in_array($method, array(
                Zend_Oauth::GET,
                Zend_Oauth::POST,
                Zend_Oauth::PUT,
                Zend_Oauth::DELETE,
            ))
        ) {
            require_once 'Zend/Oauth/Exception.php';
            throw new Zend_Oauth_Exception('Invalid method: ' . $method);
        }
        $this->_requestMethod = $method;
        return $this;
    }

    /**
     * Get request method
     *
     * @return string
     */
    public function getRequestMethod()
    {
        return $this->_requestMethod;
    }

    /**
     * Set RSA public key
     *
     * @param  Zend_Crypt_Rsa_Key_Public $key
     * @return Zend_Oauth_Config
     */
    public function setRsaPublicKey(Zend_Crypt_Rsa_Key_Public $key)
    {
        $this->_rsaPublicKey = $key;
        return $this;
    }

    /**
     * Get RSA public key
     *
     * @return Zend_Crypt_Rsa_Key_Public
     */
    public function getRsaPublicKey()
    {
        return $this->_rsaPublicKey;
    }

    /**
     * Set RSA private key
     *
     * @param  Zend_Crypt_Rsa_Key_Private $key
     * @return Zend_Oauth_Config
     */
    public function setRsaPrivateKey(Zend_Crypt_Rsa_Key_Private $key)
    {
        $this->_rsaPrivateKey = $key;
        return $this;
    }

    /**
     * Get RSA private key
     *
     * @return Zend_Crypt_Rsa_Key_Private
     */
    public function getRsaPrivateKey()
    {
        return $this->_rsaPrivateKey;
    }

    /**
     * Set OAuth token
     *
     * @param  Zend_Oauth_Token $token
     * @return Zend_Oauth_Config
     */
    public function setToken(Zend_Oauth_Token $token)
    {
        $this->_token = $token;
        return $this;
    }

    /**
     * Get OAuth token
     *
     * @return Zend_Oauth_Token
     */
    public function getToken()
    {
        return $this->_token;
    }

    /**
     * Set OAuth realm
     *
     * @param  string $realm
     * @return Zend_Oauth_Config
     */
    public function setRealm($realm)
    {
        $this->_realm = $realm;
        return $this;
    }

    /**
     * Get OAuth realm
     *
     * @return string
     */
    public function getRealm()
    {
        return $this->_realm;
    }
}


text:
namespace hpp {
namespace core {

void KinodynamicOrientedPath::orienteInitAndGoal(const DevicePtr_t& device) {
  // adjust initial and end configs, with correct orientation  (aligned with the
  // velocity):
  size_type configSize =
      device->configSize() - device->extraConfigSpace().dimension();
  Eigen::Vector3d vi(initial_[configSize], initial_[configSize + 1],
                     initial_[configSize + 2]);
  Eigen::Vector3d ve(end_[configSize], end_[configSize + 1],
                     end_[configSize + 2]);
  hppDout(notice, "OrienteInitAndGoal: ignoreZValue = " << ignoreZValue_);
  if (ignoreZValue_) {
    vi[2] = 0.;
    ve[2] = 0.;
  }
  if (vi.norm() > 0) {  // if velocity in the state
    Eigen::Quaterniond quat =
        Eigen::Quaterniond::FromTwoVectors(Eigen::Vector3d::UnitX(), vi);
    initial_[6] = quat.w();
    initial_[3] = quat.x();
    initial_[4] = quat.y();
    initial_[5] = quat.z();
  }
  if (ve.norm() > 0) {  // if velocity in the state
    Eigen::Quaterniond quat =
        Eigen::Quaterniond::FromTwoVectors(Eigen::Vector3d::UnitX(), ve);
    end_[6] = quat.w();
    end_[3] = quat.x();
    end_[4] = quat.y();
    end_[5] = quat.z();
  }
}

KinodynamicOrientedPath::KinodynamicOrientedPath(
    const DevicePtr_t& device, ConfigurationIn_t init, ConfigurationIn_t end,
    value_type length, ConfigurationIn_t a1, ConfigurationIn_t t0,
    ConfigurationIn_t t1, ConfigurationIn_t tv, ConfigurationIn_t t2,
    ConfigurationIn_t vLim, bool ignoreZValue)
    : parent_t(device, init, end, length, a1, t0, t1, tv, t2, vLim),
      ignoreZValue_(ignoreZValue) {
  orienteInitAndGoal(device);
}

KinodynamicOrientedPath::KinodynamicOrientedPath(
    const DevicePtr_t& device, ConfigurationIn_t init, ConfigurationIn_t end,
    value_type length, ConfigurationIn_t a1, ConfigurationIn_t t0,
    ConfigurationIn_t t1, ConfigurationIn_t tv, ConfigurationIn_t t2,
    ConfigurationIn_t vLim, ConstraintSetPtr_t constraints, bool ignoreZValue)
    : parent_t(device, init, end, length, a1, t0, t1, tv, t2, vLim,
               constraints),
      ignoreZValue_(ignoreZValue)

{
  orienteInitAndGoal(device);
}

KinodynamicOrientedPath::KinodynamicOrientedPath(
    const KinodynamicOrientedPath& path)
    : parent_t(path), ignoreZValue_(path.ignoreZValue()) {
  hppDout(notice, "Create copy called, ignoreZValue = " << ignoreZValue_);
  orienteInitAndGoal(path.device());
}

KinodynamicOrientedPath::KinodynamicOrientedPath(const KinodynamicPath& path,
                                                 bool ignoreZValue)
    : parent_t(path), ignoreZValue_(ignoreZValue) {
  orienteInitAndGoal(device());
}

KinodynamicOrientedPath::KinodynamicOrientedPath(
    const KinodynamicOrientedPath& path, const ConstraintSetPtr_t& constraints)
    : parent_t(path, constraints), ignoreZValue_(path.ignoreZValue()) {
  orienteInitAndGoal(device());
}

bool KinodynamicOrientedPath::impl_compute(ConfigurationOut_t result,
                                           value_type t) const {
  parent_t::impl_compute(result, t);
  // Re oriente the robot such that he always face the velocity vector
  // FIX ME : assume first joint is freeflyer
  size_type configSize =
      device()->configSize() - device()->extraConfigSpace().dimension();
  Eigen::Vector3d v(result[configSize], result[configSize + 1],
                    result[configSize + 2]);
  if (ignoreZValue_) v[2] = 0;
  if (v.norm() > 0) {  // if velocity in the state
    Eigen::Quaterniond quat =
        Eigen::Quaterniond::FromTwoVectors(Eigen::Vector3d::UnitX(), v);
    result[6] = quat.w();
    result[3] = quat.x();
    result[4] = quat.y();
    result[5] = quat.z();
  }

  return true;
}

PathPtr_t KinodynamicOrientedPath::impl_extract(
    const interval_t& subInterval) const {
  PathPtr_t path = parent_t::impl_extract(subInterval);
  KinodynamicPathPtr_t kinoPath = dynamic_pointer_cast<KinodynamicPath>(path);
  if (kinoPath)
    return KinodynamicOrientedPath::create(kinoPath, ignoreZValue_);
  else {
    hppDout(error,
            "Error while casting path in KinodynamicOrientedPath::extract");
    return PathPtr_t();
  }
}

}  // namespace core
}  // namespace hpp


text:
// move_legal.h

#ifndef MOVE_LEGAL_H
#define MOVE_LEGAL_H

// includes

#include "board.h"
#include "list.h"
#include "util.h"

// functions

extern bool move_is_pseudo  (int move, const board_t * board);
extern bool pseudo_is_legal (int move, const board_t * board);
extern bool move_is_legal   (int move, const board_t * board);

extern void filter_legal    (list_t * list, const board_t * board);

#endif // !defined MOVE_LEGAL_H

// end of move_legal.h


text:
package org.shu4j.utils.util;

import java.util.Collection;
import java.util.Date;
import java.util.List;

public class ValidityUtil {

  public static <T extends IValidityOwner> T lookup(Collection<T> list, Date date) {
    if (list == null || list.isEmpty() || date == null)
      return null;

    for (T i : list) {
      if (contains(i.getValidity(), date))
        return i;
    }

    return null;
  }

  private static boolean contains(IValidity v, Date date) {
    return (v.getTimeFrom().before(date) || v.getTimeFrom().equals(date)) && (v.getTimeTo().after(date));
  }

  public enum CUT {
    NONE,
    ERASE,
    CUT
  };

  public static CUT checkCut(Date validFrom, Date validTo, Date date) {
    if (date == null)
      throw new IllegalArgumentException("date must not be null");

    if (date.before(validTo) || date.equals(validTo)) {
      if (date.before(validFrom) || date.equals(validFrom))
        return CUT.ERASE;
      else
        return CUT.CUT;
    }
    else
      return CUT.NONE;
  }

  public static <T extends IValidityOwner> void calculateConsequences(List<T> recents, List<T> deletes, List<T> changes, IValidity add) {
    for (T i : recents) {
      IValidity vali = i.getValidity();
      switch (checkCut(vali.getTimeFrom(), vali.getTimeTo(), add.getTimeFrom())) {
      case CUT:
        vali.setTimeTo(add.getTimeFrom());
        break;
      case ERASE:
        deletes.add(i);
        break;
      case NONE:
        break;
      default:
        throw new IllegalStateException("Unexpected cut");
      }
    }
  }

}


text:
package com.paleblue.persistence.milkha;

import static com.paleblue.persistence.milkha.util.Preconditions.checkNotNull;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.amazonaws.AmazonWebServiceRequest;
import com.paleblue.persistence.milkha.dto.TransactionLogItem;
import com.paleblue.persistence.milkha.dto.TransactionStatus;
import com.paleblue.persistence.milkha.mapper.TransactionLogItemMapper;
import com.amazonaws.services.dynamodbv2.model.AttributeValue;
import com.amazonaws.services.dynamodbv2.model.DeleteItemRequest;
import com.amazonaws.services.dynamodbv2.model.PutItemRequest;
import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest;
import com.amazonaws.util.ImmutableMapParameter;
import com.amazonaws.util.StringUtils;

final class TransactionRequestsFactory {

    private TransactionLogItem txLogItem;
    private TransactionLogItemMapper txLogItemMapper;

    protected TransactionRequestsFactory(TransactionLogItem txLogItem) {
        this.txLogItem = txLogItem;
        this.txLogItemMapper = new TransactionLogItemMapper();
    }

    protected List<AmazonWebServiceRequest> generatePostRollbackUnlockRequestsFromCommitSets() {
        List<AmazonWebServiceRequest> unlockRequests = new ArrayList<>();
        txLogItem.getCreateSet().forEach((tableName, keys) -> keys.stream().forEach(key -> unlockRequests.add(generatePostRollbackUnlockRequestForAdd(tableName, key))));
        txLogItem.getDeleteSet().forEach((tableName, keys) -> keys.stream().forEach(key -> unlockRequests.add(generatePostRollbackUnlockRequestForDelete(tableName, key))));
        return unlockRequests;
    }

    protected List<AmazonWebServiceRequest> generatePostCommitUnlockRequestsFromCommitSets() {
        List<AmazonWebServiceRequest> unlockRequests = new ArrayList<>();
        txLogItem.getCreateSet().forEach((tableName, keys) -> keys.stream().forEach(key -> unlockRequests.add(generatePostCommitUnlockRequestForAdd(tableName, key))));
        txLogItem.getDeleteSet().forEach((tableName, keys) -> keys.stream().forEach(key -> unlockRequests.add(generatePostCommitUnlockRequestForDelete(tableName, key))));
        return unlockRequests;
    }

    protected DeleteItemRequest generatePostCommitUnlockRequestForDelete(UpdateItemRequest updateItemRequest) {
        return generatePostCommitUnlockRequestForDelete(updateItemRequest.getTableName(), updateItemRequest.getKey());
    }

    private DeleteItemRequest generatePostCommitUnlockRequestForDelete(String tableName, Map<String, AttributeValue> key) {
        Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
        expressionAttributeValues.put(":txId", new AttributeValue(txLogItem.getTransactionId()));
        Map<String, String> expressionAttributeNames = new HashMap<>();
        expressionAttributeNames.put("#txId", TransactionCoordinator.TRANSACTION_ID_CONTROL_FIELD);
        return new DeleteItemRequest().
                withTableName(tableName).
                withExpressionAttributeNames(expressionAttributeNames).
                withExpressionAttributeValues(expressionAttributeValues).
                withConditionExpression("#txId = :txId").
                withKey(key);
    }

    private DeleteItemRequest generatePostRollbackUnlockRequestForAdd(String tableName, Map<String, AttributeValue> key) {
        return generatePostCommitUnlockRequestForDelete(tableName, key); // The underlying request is the same
    }

    protected DeleteItemRequest generatePostRollbackUnlockRequestForAdd(UpdateItemRequest updateItemRequest) {
        return generatePostCommitUnlockRequestForDelete(updateItemRequest); // The underlying request is the same
    }

    private UpdateItemRequest generatePostCommitUnlockRequestForAdd(String tableName, Map<String, AttributeValue> key) {
        return generateRequestToClearTransactionIdAndOperation(tableName, key);
    }

    protected UpdateItemRequest generatePostCommitUnlockRequestForAdd(UpdateItemRequest updateItemRequest) {
        return generateRequestToClearTransactionIdAndOperation(updateItemRequest);
    }

    private UpdateItemRequest generatePostRollbackUnlockRequestForDelete(String tableName, Map<String, AttributeValue> key) {
        return generateRequestToClearTransactionIdAndOperation(tableName, key);
    }

    protected UpdateItemRequest generatePostRollbackUnlockRequestForDelete(UpdateItemRequest updateItemRequest) {
        return generateRequestToClearTransactionIdAndOperation(updateItemRequest);
    }

    private UpdateItemRequest generateRequestToClearTransactionIdAndOperation(UpdateItemRequest updateItemRequest) {
        return generateRequestToClearTransactionIdAndOperation(updateItemRequest.getTableName(), updateItemRequest.getKey());
    }

    private UpdateItemRequest generateRequestToClearTransactionIdAndOperation(String tableName, Map<String, AttributeValue> key) {
        Map<String, String> expressionAttributeNames = new HashMap<>();
        expressionAttributeNames.put("#txId", TransactionCoordinator.TRANSACTION_ID_CONTROL_FIELD);
        expressionAttributeNames.put("#txOp", TransactionCoordinator.TRANSACTION_OPERATION_CONTROL_FIELD);
        Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
        expressionAttributeValues.put(":txId", new AttributeValue(txLogItem.getTransactionId()));
        String conditionExpression = "#txId = :txId";
        String updateExpression = "REMOVE #txId, #txOp";
        return new UpdateItemRequest().
                withTableName(tableName).
                withExpressionAttributeNames(expressionAttributeNames).
                withExpressionAttributeValues(expressionAttributeValues).
                withKey(key).
                withConditionExpression(conditionExpression).
                withUpdateExpression(updateExpression);
    }

    protected UpdateItemRequest generateCommitRequestForAdd(UpdateItemRequest updateItemRequest) {
        if (updateItemRequest.getConditionExpression() != null) {
            throw new IllegalArgumentException("ConditionExpression is not applicable to immutable item puts");
        }
        Map<String, String> expressionAttributeNames = new HashMap<>(updateItemRequest.getExpressionAttributeNames());
        expressionAttributeNames.put("#txId", TransactionCoordinator.TRANSACTION_ID_CONTROL_FIELD);
        expressionAttributeNames.put("#txOp", TransactionCoordinator.TRANSACTION_OPERATION_CONTROL_FIELD);
        Map<String, AttributeValue> expressionAttributeValues = new HashMap<>(updateItemRequest.getExpressionAttributeValues());
        expressionAttributeValues.put(":txId", new AttributeValue(txLogItem.getTransactionId()));
        expressionAttributeValues.put(":txOp", new AttributeValue(TransactionCoordinator.TRANSACTION_OPERATION_ADD_VALUE));
        String controlFieldUpdates = "#txId = :txId, #txOp = :txOp";
        String updateExpression;
        if (StringUtils.isNullOrEmpty(updateItemRequest.getUpdateExpression())) {
            updateExpression = "SET " + controlFieldUpdates;
        } else {
            updateExpression = updateItemRequest.getUpdateExpression() + ", " + controlFieldUpdates;
        }
        String conditionExpression = getKeyNotExistsConditionExpression(updateItemRequest.getKey());
        return new UpdateItemRequest().
                withTableName(updateItemRequest.getTableName()).
                withExpressionAttributeValues(expressionAttributeValues).
                withExpressionAttributeNames(expressionAttributeNames).
                withConditionExpression(conditionExpression).
                withKey(new HashMap<>(updateItemRequest.getKey())).
                withUpdateExpression(updateExpression);
    }

    private String getKeyNotExistsConditionExpression(Map<String, AttributeValue> keyMap) {
        String[] keyAttributeNames = keyMap.keySet().toArray(new String[]{});
        String conditionExpression = String.format("attribute_not_exists (%s)", keyAttributeNames[0]);
        if (keyAttributeNames.length == 2) {
            conditionExpression += String.format(" AND attribute_not_exists (%s)", keyAttributeNames[1]);
        }
        return conditionExpression;
    }

    private String getKeyExistsConditionExpression(Map<String, AttributeValue> keyMap) {
        String[] keyAttributeNames = keyMap.keySet().toArray(new String[]{});
        String conditionExpression = String.format("attribute_exists (%s)", keyAttributeNames[0]);
        if (keyAttributeNames.length == 2) {
            conditionExpression += String.format(" AND attribute_exists (%s)", keyAttributeNames[1]);
        }
        return conditionExpression;
    }

    protected UpdateItemRequest generateCommitRequestForDelete(DeleteItemRequest deleteItemRequest) {
        if (deleteItemRequest.getConditionExpression() != null) {
            throw new IllegalArgumentException("Setting ConditionExpression is not allowed because they cannot be distinguished from contention");
        }
        Map<String, AttributeValue> itemKey = deleteItemRequest.getKey();
        Map<String, String> expressionAttributeNames = new HashMap<>();
        expressionAttributeNames.put("#txId", TransactionCoordinator.TRANSACTION_ID_CONTROL_FIELD);
        expressionAttributeNames.put("#txOp", TransactionCoordinator.TRANSACTION_OPERATION_CONTROL_FIELD);
        Map<String, AttributeValue> expressionAttributeValues = new HashMap<>();
        expressionAttributeValues.put(":txId", new AttributeValue(txLogItem.getTransactionId()));
        expressionAttributeValues.put(":txOp", new AttributeValue(TransactionCoordinator.TRANSACTION_OPERATION_DELETE_VALUE));
        String keyExistsConditionExpression = getKeyExistsConditionExpression(deleteItemRequest.getKey());
        String conditionExpression = "attribute_not_exists (#txId) AND attribute_not_exists (#txOp) AND " + keyExistsConditionExpression;
        String updateExpression = "SET #txId = :txId, #txOp = :txOp";
        return new UpdateItemRequest().
                withTableName(deleteItemRequest.getTableName()).
                withExpressionAttributeNames(expressionAttributeNames).
                withExpressionAttributeValues(expressionAttributeValues).
                withKey(itemKey).
                withConditionExpression(conditionExpression).
                withUpdateExpression(updateExpression);
    }

    protected PutItemRequest generatePutRequestForTransactionLogItem() {
        checkNotNull(txLogItem.getPreviousTransactionStatus());
        if (txLogItem.getPreviousTransactionStatus() == TransactionStatus.NOT_PERSISTED) {
            return txLogItemMapper.generatePutItemRequest(txLogItem).
                    withExpressionAttributeNames(ImmutableMapParameter.of("#txId", TransactionLogItemMapper.TRANSACTION_ID_KEY_NAME)).
                    withConditionExpression("attribute_not_exists(#txId)");
        } else {
            return txLogItemMapper.generatePutItemRequest(txLogItem).
                    withExpressionAttributeNames(ImmutableMapParameter.of("#txStatus", TransactionLogItemMapper.TRANSACTION_STATUS_KEY_NAME)).
                    withExpressionAttributeValues(ImmutableMapParameter.of(":txStatus", new AttributeValue(txLogItem.getPreviousTransactionStatus().name()))).
                    withConditionExpression("#txStatus = :txStatus");
        }
    }
}


text:
package fc.imagefilters;

public class Point2 {
	public int x,y;
	public Point2(int x, int y) { this.x = x; this.y = y; }
}


text:
<?php

namespace ProophTest\ProophessorDo\Model\Todo;

use Prooph\ProophessorDo\Model\Todo\Event\TodoWasPosted;
use Prooph\ProophessorDo\Model\Todo\Event\TodoWasMarkedAsDone;
use Prooph\ProophessorDo\Model\Todo\Todo;
use Prooph\ProophessorDo\Model\Todo\TodoId;
use Prooph\ProophessorDo\Model\User\UserId;
use ProophTest\ProophessorDo\TestCase;

/**
 * Class TodoTest
 *
 * @package ProophTest\ProophessorDo\Model\Todo
 */
final class TodoTest extends TestCase
{
    /**
     * @test
     */
    public function it_creates_a_new_todo_when_posting_a_text()
    {
        $assigneeId = UserId::generate();
        $todoId = TodoId::generate();

        $todo = Todo::post('This is test todo', $assigneeId, $todoId);

        $this->assertInstanceOf(Todo::class, $todo);

        $events = $this->popRecordedEvent($todo);

        $this->assertEquals(1, count($events));

        $this->assertInstanceOf(TodoWasPosted::class, $events[0]);

        $expectedPayload = [
            'text' => 'This is test todo',
            'assignee_id' => $assigneeId->toString(),
            'status' => 'open'
        ];

        $this->assertEquals($expectedPayload, $events[0]->payload());
    }

    /**
     * @test
     */
    public function it_marks_an_open_todo_as_done()
    {
        $todoId = TodoId::generate();
        $todo = Todo::post('This is an unit test todo', UserId::generate(), $todoId);
        $todo->markAsDone();

        $this->assertTrue($todo->status()->isDone());

        $events = $this->popRecordedEvent($todo);

        $this->assertEquals(2, count($events));

        $this->assertInstanceOf(TodoWasMarkedAsDone::class, $events[1]);

        $expectedPayload = [
            'old_status' => 'open',
            'new_status' => 'done'
        ];

        $this->assertEquals($expectedPayload, $events[1]->payload());

        return $todo;
    }

    /**
     * @test
     * @depends it_marks_an_open_todo_as_done
     * @expectedException \Prooph\ProophessorDo\Model\Todo\Exception\TodoNotOpen
     */
    public function it_throws_an_exception_when_marking_a_todo_already_done_as_done(Todo $todo)
    {
        $todo->markAsDone();
    }
}


text:
const jsprocess = require("zero-process");
const handler = require("./renderer");

module.exports = (pageData, buildInfo) => {
  return jsprocess(handler, pageData, buildInfo);
};


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>ArUco: arucofidmarkers.h Source File</title>

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

ArUco
    1.2.5

Main Page

Namespaces

Classes

Files

File List

File Members

arucofidmarkers.h

Go to the documentation of this file.

00001
00028
00029 #ifndef ArucoFiducicalMarkerDetector_H
00030 #define ArucoFiducicalMarkerDetector_H
00031 #include <opencv2/core/core.hpp>
00032 #include "exports.h"
00033 #include "marker.h"
00034 #include "board.h"
00035 namespace aruco {
00036
00037 class ARUCO_EXPORTS FiducidalMarkers {
00038 public:
00066     static cv::Mat createMarkerImage(int id,int size,bool writeIdWaterMark=true) throw (cv::Exception);
00067
00073     static int detect(const cv::Mat &in,int &nRotations);
00074
00077     static cv::Mat getMarkerMat(int id) throw (cv::Exception);
00078
00079
00087     static  cv::Mat createBoardImage( cv::Size  gridSize,int MarkerSize,int MarkerDistance,  BoardConfiguration& TInfo ,vector<int> *excludedIds=NULL ) throw (cv::Exception);
00088
00089
00097     static  cv::Mat  createBoardImage_ChessBoard( cv::Size gridSize,int MarkerSize, BoardConfiguration& TInfo ,bool setDataCentered=true ,vector<int> *excludedIds=NULL) throw (cv::Exception);
00098
00107     static  cv::Mat  createBoardImage_Frame( cv::Size gridSize,int MarkerSize,int MarkerDistance,  BoardConfiguration& TInfo ,bool setDataCentered=true,vector<int> *excludedIds=NULL ) throw (cv::Exception);
00108
00109 private:
00110
00111     static vector<int> getListOfValidMarkersIds_random(int nMarkers,vector<int> *excluded) throw (cv::Exception);
00112     static  cv::Mat rotate(const cv::Mat & in);
00113     static  int hammDistMarker(cv::Mat  bits);
00114     static  int analyzeMarkerImage(cv::Mat &grey,int &nRotations);
00115     static  bool correctHammMarker(cv::Mat &bits);
00116 };
00117
00118 }
00119
00120 #endif

<address class="footer">
Generated on Wed Aug 6 2014 16:08:52 for ArUco by

 1.7.6.1
</address>


text:
package org.wso2.carbon.esb.rest.test.security;

import org.apache.axis2.AxisFault;
import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.authenticator.stub.LoginAuthenticationExceptionException;
import org.wso2.carbon.automation.engine.FrameworkConstants;
import org.wso2.carbon.automation.engine.context.AutomationContext;
import org.wso2.carbon.automation.engine.context.TestUserMode;
import org.wso2.carbon.automation.test.utils.http.client.HttpsResponse;
import org.wso2.carbon.automation.test.utils.http.client.HttpsURLConnectionClient;
import org.wso2.carbon.endpoint.stub.types.EndpointAdminEndpointAdminException;
import org.wso2.carbon.esb.rest.test.security.util.RestEndpointSetter;
import org.wso2.carbon.integration.common.admin.client.SecurityAdminServiceClient;
import org.wso2.carbon.integration.common.admin.client.UserManagementClient;
import org.wso2.carbon.integration.common.extensions.utils.AutomationXpathConstants;
import org.wso2.carbon.user.mgt.stub.UserAdminUserAdminException;
import org.wso2.esb.integration.common.clients.registry.ResourceAdminServiceClient;
import org.wso2.esb.integration.common.utils.ESBIntegrationTest;
import org.wso2.esb.integration.common.utils.common.TestConfigurationProvider;

import javax.xml.stream.XMLStreamException;
import java.io.File;
import java.io.IOException;
import java.rmi.RemoteException;

import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;

/**
 * Verifying GET, PUT, POST and DELETE http methods with pox security with invalid user group.
 */
public class ESBPOXSecurityWithInvalidGroupTestCase extends ESBIntegrationTest {
    private static String USER_GROUP = "admin";
    private static final String SERVICE_NAME = "StudentServiceProxy";
    private static final String studentName = "automationStudent";
    private SecurityAdminServiceClient securityAdminServiceClient;

    @BeforeClass(alwaysRun = true)
    public void init() throws Exception {
        super.init(TestUserMode.SUPER_TENANT_ADMIN);

        updateESBConfiguration(RestEndpointSetter.setEndpoint(File.separator + "artifacts" + File.separator + "ESB" +
                                                              File.separator + "synapseconfig" + File.separator + "rest" +
                                                              File.separator + "student-service-synapse.xml"));
        applySecurity("1", "StudentServiceProxy", USER_GROUP);

    }

    @Test(groups = {"wso2.esb"}, description = "POST request  by user belongs to unauthorized group")
    public void testAddNewStudent() throws IOException, EndpointAdminEndpointAdminException,
                                           LoginAuthenticationExceptionException,
                                           XMLStreamException {
        //user  doesn't belong to admin group, so he doesn't have access permission for resources.

        String addStudentData = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" +
                                "   <p:addStudent xmlns:p=\"http://axis2.apache.org\">\n" +
                                "      <!--0 to 1 occurrence-->\n" +
                                "      <ns:student xmlns:ns=\"http://axis2.apache.org\">\n" +
                                "         <!--0 to 1 occurrence-->\n" +
                                "         <xs:age xmlns:xs=\"http://axis2.apache.org\">100</xs:age>\n" +
                                "         <!--0 to 1 occurrence-->\n" +
                                "         <xs:name xmlns:xs=\"http://axis2.apache.org\">" + studentName + "</xs:name>\n" +
                                "         <!--0 or more occurrences-->\n" +
                                "         <xs:subjects xmlns:xs=\"http://axis2.apache.org\">testAutomation</xs:subjects>\n" +
                                "      </ns:student>\n" +
                                "   </p:addStudent>";

        String securedRestURL = getProxyServiceURLHttps(SERVICE_NAME) + "/students";
        boolean status = false;
        HttpsResponse response = null;
        try {
            response = HttpsURLConnectionClient.postWithBasicAuth(securedRestURL, addStudentData,
                                                                  "application/xml", NonAdminUserCreationTestCase.getUser().getUserName(),
                                                                  NonAdminUserCreationTestCase.getUser().getPassword());
        } catch (IOException ignored) {
            status = true; // invalid users cannot post to the resource
        }

        assertTrue(status, "User belongs to invalid group was able to post to the resource");
        assertNull(response, "Response should be null");

        String studentGetUri = getProxyServiceURLHttps(SERVICE_NAME) + "/student/" + studentName;

        boolean getStatus = false;
        HttpsResponse getResponse = null;
        try {
            getResponse =
                    HttpsURLConnectionClient.getWithBasicAuth(studentGetUri, null, NonAdminUserCreationTestCase.getUser().getPassword(),
                                                              NonAdminUserCreationTestCase.getUser().getPassword());
        } catch (IOException ignored) {
            getStatus = true; // invalid users cannot read the resource
        }
        assertTrue(getStatus, "User belongs to invalid group was able to get the resource");
        assertNull(getResponse, "Response cannot be null");

    }

    @Test(groups = {"wso2.esb"}, description = "PUT request by user belongs to unauthorized group",
          dependsOnMethods = "testAddNewStudent")
    public void testUpdateStudent() throws IOException, EndpointAdminEndpointAdminException,
                                           LoginAuthenticationExceptionException,
                                           XMLStreamException {

        String updateStudentData = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\n" +
                                   "<p:updateStudent xmlns:p=\"http://axis2.apache.org\">\n" +
                                   "      <!--0 to 1 occurrence-->\n" +
                                   "      <ns:student xmlns:ns=\"http://axis2.apache.org\">\n" +
                                   "         <!--0 to 1 occurrence-->\n" +
                                   "         <xs:age xmlns:xs=\"http://axis2.apache.org\">999</xs:age>\n" +
                                   "         <!--0 to 1 occurrence-->\n" +
                                   "         <xs:name xmlns:xs=\"http://axis2.apache.org\">" + studentName + "</xs:name>\n" +
                                   "         <!--0 or more occurrences-->\n" +
                                   "         <xs:subjects xmlns:xs=\"http://axis2.apache.org\">testAutomationUpdated</xs:subjects>\n" +
                                   "      </ns:student>\n" +
                                   "</p:updateStudent>";

        String securedRestURL = getProxyServiceURLHttps(SERVICE_NAME) + "/student/" + studentName;

        boolean status = false;
        HttpsResponse response = null;
        try {
            response = HttpsURLConnectionClient.putWithBasicAuth(securedRestURL, updateStudentData,
                                                                 "application/xml", NonAdminUserCreationTestCase.getUser().getUserName(),
                                                                 NonAdminUserCreationTestCase.getUser().getPassword());
        } catch (IOException ignored) {
            status = true; // invalid users cannot put to the resource
        }

        assertTrue(status, "User belongs to invalid group was able to update the resource");
        assertNull(response, "Response should be null");

        //check whether the student updated.
        String studentGetUri = getProxyServiceURLHttps(SERVICE_NAME) + "/student/" + studentName;
        boolean getStatus = false;
        HttpsResponse getResponse = null;
        try {
            getResponse =
                    HttpsURLConnectionClient.getWithBasicAuth(studentGetUri, null, NonAdminUserCreationTestCase.getUser().getPassword(),
                                                              NonAdminUserCreationTestCase.getUser().getPassword());
        } catch (IOException ignored) {
            getStatus = true; // invalid users cannot get to the resource
        }

        assertTrue(getStatus, "User belongs to invalid group was able to get the resource");
        assertNull(getResponse, "Response should be null");

    }

    @Test(groups = {"wso2.esb"}, description = "DELETE request by user belongs to unauthorized group",
          dependsOnMethods = "testUpdateStudent")
    public void testDeleteStudent() throws IOException, EndpointAdminEndpointAdminException,
                                           LoginAuthenticationExceptionException,
                                           XMLStreamException {

        String securedRestURL = getProxyServiceURLHttps(SERVICE_NAME) + "/student/" + studentName;
        boolean status = false;
        HttpsResponse response = null;
        try {
            response =
                    HttpsURLConnectionClient.deleteWithBasicAuth(securedRestURL, null, NonAdminUserCreationTestCase.getUser().getUserName(),
                                                                 NonAdminUserCreationTestCase.getUser().getPassword());
        } catch (IOException ignored) {
            status = true; // invalid users cannot delete to the resource
        }

        assertTrue(status, "User belongs to invalid group was able to delete the resource");
        assertNull(response, "Response should be null");
    }

    @Test(groups = {"wso2.esb"}, description = "GET resource after delete by user belongs to unauthorized group",
          dependsOnMethods = "testDeleteStudent")
    public void testGetResourceAfterDelete()
            throws IOException, EndpointAdminEndpointAdminException,
                   LoginAuthenticationExceptionException,
                   XMLStreamException {

        //check whether the student is deleted
        String studentGetUri = getProxyServiceURLHttps(SERVICE_NAME) + "/student/" + studentName;
        boolean getStatus = false;
        HttpsResponse getResponse = null;
        try {
            getResponse =
                    HttpsURLConnectionClient.getWithBasicAuth(studentGetUri, null, NonAdminUserCreationTestCase.getUser().getPassword(),
                                                              NonAdminUserCreationTestCase.getUser().getPassword());
        } catch (IOException ignored) {
            getStatus = true; // invalid users cannot get the resource
        }

        assertTrue(getStatus, "User belongs to invalid group was able to get the resource");
        assertNull(getResponse, "Response should be null");
    }

    private void applySecurity(String scenarioNumber, String serviceName, String userGroup)
            throws Exception {

        securityAdminServiceClient = new SecurityAdminServiceClient
                (contextUrls.getBackEndUrl(), userInfo.getUserName(), userInfo.getPassword());

        String path = TestConfigurationProvider.getKeyStoreLocation();
        String KeyStoreName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
        if (userGroup != null) {
            USER_GROUP = userGroup;
        }
        securityAdminServiceClient.applySecurity(serviceName, scenarioNumber, new String[]{USER_GROUP},
                                                 new String[]{KeyStoreName}, KeyStoreName);
        Thread.sleep(2000);

    }

    @AfterClass(alwaysRun = true)
    public void destroy() throws Exception {
        securityAdminServiceClient.disableSecurity(SERVICE_NAME);
        super.cleanup();
    }

}


text:
    Loading...

    {{pie.year}} {{pie.title}} ()

Total by land use type

    Get the data
    {{dataDownloadMessage}}

  Total: {{pie.sum | number}}&nbsp&nbsp