text:
<!DOCTYPE html>

  <title>router.js</title>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0; maximum-scale=1.0; user-scalable=0;">
  <link rel="stylesheet" media="all" href="docco.css" />

          Jump To …
          +

                app.js

                pushstate.js

                socketPipe.js

                conn_indicatorControl.js

                defaultControl.js

                layoutControl.js

                menuControl.js

                rootControl.js

                userControl.js

                userListControl.js

                main.js

                defaultModel.js

                userModel.js

                users.js

                router.js

                layoutView.js

                menuView.js

router.js

                ¶

/*global require, define, $, console */

/**
 * @module router
 */

define([
    "can",
    "controls/layoutControl",
    "controls/rootControl"
],
    /**
     * @name module:router
     * @description Main application router: route map & controls initialization
     * @see module:layoutControl
     * @see module:routerControl
     * @requires can {Object} canjs
     * @requires module:layoutControl {Function} Layout control
     * @requires module:routerControl {Function} Root control
     * @class can.Control
     * @extends can.Control
     * @constructor
     * @returns {Function} can.Control constructor
     */
        function (can, LayoutControl, RootControl) {
        "use strict";

        return can.Control({
            /**
             * @name module:router#init
             * @description Creates application route map
             * @function
             */
            init: function () {
                var self = this;

                ¶

Layout control instance

                self.controls.layoutControl = new LayoutControl($("body"));

                ¶

Main block. Controllers are attached here

                self.$main = $("main");

                ¶

Root view control

                self.controls.rootControl = new RootControl(self.$main);

                can.route("/");
                can.route("users");
                can.route("users/:id");
                can.route.ready();

            },
            /**
             * @name module:router#controls
             * @description Initialized controls
             * @type Object
             * @field
             */
            controls: {},
            activeControl: null,
            switchControl: function (control, data) {
                if (control && control !== this.activeControl) {
                    if (this.activeControl) {
                        this.activeControl.hide();
                    }
                    this.activeControl = control;
                    control.show(data);
                }
            },
            /**
             * @name module:router#loadControl
             * @description Load aggregated module (control)
             * @function
             * @param modulePath {String} Relative or absolute path
             * @param controlPath {String} Path
             * @param [fn] {Function} Optional callback
             * @param [data] {Function} Route data
             */
            loadControl: function (modulePath, controlPath, fn, data) {
                var Control = this.controls[controlPath],
                    self = this;

                ¶

Check if module is loaded

                if (!Control) {
                    require([modulePath], function () {
                        require([controlPath], function (Control) {

                ¶

Target control initialization

                            self.controls[controlPath] = Control = new Control(self.$main);

                            if ($.isFunction(fn)) {
                                fn(Control, data);
                            }
                        });
                    });
                } else if ($.isFunction(fn)) {
                    fn(Control, data);
                }
            },
            /**
             * @name module:router#root route
             * @description Root route handler
             * @function
             */
            "/ route": function () {
                var self = this;
                self.switchControl(self.controls.rootControl);
            },
            /**
             * @name module:router#users route
             * @description Users (list) route handler
             * @function
             * @param data {String} Query data params
             */
            "users route": function (data) {
                this.loadControl("modules/users", "controls/user/userListControl", $.proxy(this.switchControl, this), data);
            },
            /**
             * @name module:router#users/:id route
             * @description Users/id route handler
             * @function
             * @param data {String} Query data params
             */
            "users/:id route": function (data) {
                this.loadControl("modules/users", "controls/user/userControl", $.proxy(this.switchControl, this), data);
            }
        });
    });


text:
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

namespace NinjaTrader.Indicator
{
/// <summary>
	/// So if you use this indicator and it does not make money for you or you loose your house thats all on you.
	/// You are free to edit this and so on but don't expect anything from it. Its a tool to help you nothing more. You deside when to enter and exit the market
/// </summary>
	[Description("Poor Richsob's magic trading indicator.")]
    public class magicIndicator : Indicator
    {
        #region Variables
        // Wizard generated variables
            private int myInput0 = 1; // Default setting for MyInput0
        // User defined variables (add any user defined variables below)
        #endregion

        protected override void Initialize()
        {
        }
        protected override void OnBarUpdate()
        {
			if(CrossAbove(SMA(5), SMA(25), 1))
			{
				DrawArrowUp("GOShort" + CurrentBar, true, 0, Low[0] - TickSize, Color.Red);
			}
			else if (CrossBelow(SMA(5), SMA(25), 1))
			{
				DrawArrowDown("GOLong" + CurrentBar, true, 0, High[0] + TickSize, Color.Blue);
			}

			if(SMA(5)[0] > Close[0])
			{
				DrawDot("BellowSMA" + CurrentBar,true, 0,Low[0] - TickSize, Color.Yellow);
			}
			else if(SMA(5)[0] < Close[0])
			{
				DrawDot("AboveSMA" + CurrentBar,true, 0,High[0] + TickSize, Color.Green);
			}
        }

        #region Properties
        [Browsable(false)]	// this line prevents the data series from being displayed in the indicator properties dialog, do not remove
        [XmlIgnore()]		// this line ensures that the indicator can be saved/recovered as part of a chart template, do not remove
        public DataSeries Plot0
        {
            get { return Values[0]; }
        }

        [Description("")]
        [GridCategory("Parameters")]
        public int MyInput0
        {
            get { return myInput0; }
            set { myInput0 = Math.Max(1, value); }
        }
        #endregion
    }
}

#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
    public partial class Indicator : IndicatorBase
    {
        private magicIndicator[] cachemagicIndicator = null;

        private static magicIndicator checkmagicIndicator = new magicIndicator();

        /// <summary>
        /// Poor Richsob's magic trading indicator.
        /// </summary>
        /// <returns></returns>
        public magicIndicator magicIndicator(int myInput0)
        {
            return magicIndicator(Input, myInput0);
        }

        /// <summary>
        /// Poor Richsob's magic trading indicator.
        /// </summary>
        /// <returns></returns>
        public magicIndicator magicIndicator(Data.IDataSeries input, int myInput0)
        {
            if (cachemagicIndicator != null)
                for (int idx = 0; idx < cachemagicIndicator.Length; idx++)
                    if (cachemagicIndicator[idx].MyInput0 == myInput0 && cachemagicIndicator[idx].EqualsInput(input))
                        return cachemagicIndicator[idx];

            lock (checkmagicIndicator)
            {
                checkmagicIndicator.MyInput0 = myInput0;
                myInput0 = checkmagicIndicator.MyInput0;

                if (cachemagicIndicator != null)
                    for (int idx = 0; idx < cachemagicIndicator.Length; idx++)
                        if (cachemagicIndicator[idx].MyInput0 == myInput0 && cachemagicIndicator[idx].EqualsInput(input))
                            return cachemagicIndicator[idx];

                magicIndicator indicator = new magicIndicator();
                indicator.BarsRequired = BarsRequired;
                indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
                indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
                indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
                indicator.Input = input;
                indicator.MyInput0 = myInput0;
                Indicators.Add(indicator);
                indicator.SetUp();

                magicIndicator[] tmp = new magicIndicator[cachemagicIndicator == null ? 1 : cachemagicIndicator.Length + 1];
                if (cachemagicIndicator != null)
                    cachemagicIndicator.CopyTo(tmp, 0);
                tmp[tmp.Length - 1] = indicator;
                cachemagicIndicator = tmp;
                return indicator;
            }
        }
    }
}

// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
    public partial class Column : ColumnBase
    {
        /// <summary>
        /// Poor Richsob's magic trading indicator.
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.magicIndicator magicIndicator(int myInput0)
        {
            return _indicator.magicIndicator(Input, myInput0);
        }

        /// <summary>
        /// Poor Richsob's magic trading indicator.
        /// </summary>
        /// <returns></returns>
        public Indicator.magicIndicator magicIndicator(Data.IDataSeries input, int myInput0)
        {
            return _indicator.magicIndicator(input, myInput0);
        }
    }
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
    public partial class Strategy : StrategyBase
    {
        /// <summary>
        /// Poor Richsob's magic trading indicator.
        /// </summary>
        /// <returns></returns>
        [Gui.Design.WizardCondition("Indicator")]
        public Indicator.magicIndicator magicIndicator(int myInput0)
        {
            return _indicator.magicIndicator(Input, myInput0);
        }

        /// <summary>
        /// Poor Richsob's magic trading indicator.
        /// </summary>
        /// <returns></returns>
        public Indicator.magicIndicator magicIndicator(Data.IDataSeries input, int myInput0)
        {
            if (InInitialize && input == null)
                throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

            return _indicator.magicIndicator(input, myInput0);
        }
    }
}
#endregion

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Keboola\Syrup\Test\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\JsonResponse;

/**
 * Created by PhpStorm.
 * User: miroslavcillik
 * Date: 22/02/16
 * Time: 12:07
 */
class TestController extends Controller
{
    public function noticeAction()
    {
        $foo = ['a', 'b', 'c'];
        return new JsonResponse(['result' => $foo[3]]);
    }
}


text:
require_relative '../../../../lib/noteshare/interactors/editor/delete_ns_document'

module Editor::Controllers::Document
  class DeleteDocument
    include Editor::Action
    include Noteshare::Interactor::Document

    expose :active_item

    def call(params)
      @active_item = 'editor'
      result = DeleteNSDocument.new(params, current_user2).call
      redirect_to result.redirect_path
    end

  end
end


text:
module MonospaceTextFormatter
  class Chunk

    def initialize(string=nil)
      @remaining_string = ""
        @atomic_chunks = []
        @display_length = 0

      concat(string) unless string.nil?
    end

    def duplicate
      duplicate = self.clone
      duplicate.instance_variable_set("@remaining_string", @remaining_string.clone)
      duplicate.instance_variable_set(   "@atomic_chunks",    @atomic_chunks.clone)
      duplicate
    end

    def multiline?
      atomic_chunks.any? { |atomic_chunk| atomic_chunk.newline? } or remaining_string.include?("\n")
    end

    def blank?
      to_s.strip.empty?
    end

    def empty?
      to_s.empty?
    end

    def display_length
      slice_whole_remaining_string unless remaining_string.empty?
      @display_length
    end

    def non_display_length
      slice_whole_remaining_string unless remaining_string.empty?
      to_s.length - display_length
    end

    def concat(string_or_chunk)

      if string_or_chunk.kind_of?(Chunk)
        slice_whole_remaining_string if string_or_chunk.atomic_chunks.any?

        string_or_chunk.atomic_chunks.each { |atomic_chunk| push_atomic_chunk(atomic_chunk) }
        remaining_string.concat(string_or_chunk.remaining_string)

      else
        remaining_string.concat(string_or_chunk)

      end
      self
    end

    def +(string_or_chunk)
      duplicate.concat(string_or_chunk)
    end

    def slice!(max_display_length=nil, smartly_split_too_long_words=true)
      sliced_chunk = self.class.new
      return sliced_chunk if max_display_length == 0

      while retrieve_first_atomic_chunk

        if atomic_chunks.first.blank? and sliced_chunk.blank?
          shift_atomic_chunk
          next

        elsif max_display_length && (atomic_chunks.first.display_length + sliced_chunk.display_length > max_display_length)
          break

        elsif atomic_chunks.first.newline?
          shift_atomic_chunk
          break

        else
          sliced_chunk.push_atomic_chunk(shift_atomic_chunk)
        end
      end

      sliced_chunk.pop_atomic_chunk while sliced_chunk.atomic_chunks.last && sliced_chunk.atomic_chunks.last.blank?

      if smartly_split_too_long_words &&
        max_display_length &&
        retrieve_first_atomic_chunk &&
        atomic_chunks.first.display_length > max_display_length

        smartly_split_too_long_word(max_display_length, sliced_chunk)
      end

      sliced_chunk
    end

    def slice(max_display_length)
      duplicate.slice!(max_display_length)
    end

    def to_s
      atomic_chunks.map { |atomic_chunk| atomic_chunk.to_s }.join + remaining_string
    end

    def inspect
      %Q(#<#{self.class} #{to_s.inspect}>)
    end

    def ==(other)
      to_s == other.to_s
    end

    protected

    def atomic_chunk_factory
      @atomic_chunk_factory ||= AtomicChunkFactory.new
    end

    attr_accessor :atomic_chunks, :remaining_string

    def push_atomic_chunk(atomic_chunk)
      atomic_chunks.push(atomic_chunk)
      @display_length += atomic_chunk.display_length
    end

    def pop_atomic_chunk
      atomic_chunk = atomic_chunks.pop
      @display_length -= atomic_chunk.display_length
      atomic_chunk
    end

    def unshift_atomic_chunk(atomic_chunk)
      atomic_chunks.unshift(atomic_chunk)
      @display_length += atomic_chunk.display_length
    end

    def shift_atomic_chunk
      atomic_chunk = atomic_chunks.shift
      @display_length -= atomic_chunk.display_length
      atomic_chunk
    end

    def delete_atomic_chunk_at(index)
      atomic_chunk = atomic_chunks.delete_at(index)
      @display_length -= atomic_chunk.display_length
      atomic_chunk
    end

    def retrieve_first_atomic_chunk
      !!(atomic_chunks.first or slice_atomic_chunk_from_remaining_string!)
    end

    def slice_whole_remaining_string
      slice_atomic_chunk_from_remaining_string! until remaining_string.empty?
    end

    def slice_atomic_chunk_from_remaining_string!
      if atomic_chunk = slice_from_remaining_string!
        push_atomic_chunk(atomic_chunk)
        atomic_chunk
      end
    end

    def slice_from_remaining_string!
      atomic_chunk_factory.slice_from!(remaining_string)
    end

    def smartly_split_too_long_word(max_display_length, sliced_chunk)
      length_needed = max_display_length - sliced_chunk.display_length - (sliced_chunk.blank? ? 0 : 1)
      return unless atomic_chunks.first.display_length % max_display_length <= length_needed

      atomic_chunk = shift_atomic_chunk
      atomic_chunk_1, atomic_chunk_2 = atomic_chunk_factory.split_string(atomic_chunk.to_s, length_needed)

      sliced_chunk.concat(" ") unless sliced_chunk.blank?
      sliced_chunk.concat(atomic_chunk_1.to_s)

      unshift_atomic_chunk(atomic_chunk_2)
    end
  end
end


text:
//-----------gallery big pics--------------------------------//
$(document).ready(function() {

	var $currproject = 1;
    	var $currproject_slide = 1;
	var $currslide_nums= 3;

    	//--------content---------------------------
    	var G_headings= new Array();
	G_headings[0] = "Leave this aside to eliminate confusion";
	G_headings[1] = "RAFTAR PROMO VIDEO";
	G_headings[2] = "3D ANIMATION";
	G_headings[3] = "SHAASTRA PROMO VIDEO";
	G_headings[4] = "VISITING CARD DESIGNS";
	G_headings[5] = "EXTRA MURAL LECTURES - POSTERS & BANNERS";
	G_headings[6] = "3D HOLOGRAM";
	G_headings[7] = "JERSEY DESIGNS";
	G_headings[8] = "SHAASTRA PROMO VIDEO";
	G_headings[9] = "EXTRA MURAL LECTURES  - PROMO VIDEO";
	G_headings[10] = "RAFTAR  LOGO & BROCHURE";
	G_headings[11] = "RAFTAR MAIN WEBSITE";
	G_headings[12] = "ROBBIN BAKERS";
	G_headings[13] = "SYNCWITS";
	G_headings[14] = "SYNCWITS";
	G_headings[15] = "WE THE CHANGE MISSION";
	G_headings[16] = "NATIONAL CENTER FOR SAFETY OF HERITAGE STRUCTURES";
	G_headings[17] = "PREPFACTOR";
	G_headings[18] = "SYNCWITS";
	G_headings[19] = "DHRUVA";
	G_headings[20] = "SHAASTRA";
	var G_desc= new Array();
	G_desc[0] = "Leave this aside to eliminate confusion";
	G_desc[1] = "Click here to watch this video";
	G_desc[2] = "Click here to watch this video";
	G_desc[3] = "Click here to watch this video";
	G_desc[4] = "";
	G_desc[5] = "Indian Institute of Technology - Madras";
	G_desc[6] =  "Click here to watch this video";
	G_desc[7] = "";
	G_desc[8] = "Click here to watch this video";
	G_desc[9] = "Click here to watch this video";
	G_desc[10] = "";
	G_desc[11] = "Official Formula SAE racing team of IIT madras";
	G_desc[12] = "Startup based in Guntur, Andhra Pradesh";
	G_desc[13] = "An online Education Portal";
	G_desc[14] = "Front End designer";
	G_desc[15] = "An NGO aimed at providing educaton to the unfortunate with more than 26 branches all over India";
	G_desc[16] = "National organisation that predicts and protects  Heritage structures from earthquakes, weather, soil sinkage";
	G_desc[17] = "Online Mock exam Portal";
	G_desc[18] = "Click here to watch this video";
	G_desc[19] = "Click here to watch this video";
	G_desc[20] = "Click here to watch this video";
	 var G_type= new Array();
	G_type[0] = "Leave this aside to eliminate confusion";
	G_type[1] =G_type[3] =G_type[8] = G_type[9] ="MOTION";
	G_type[4] =G_type[5] =G_type[7] = G_type[10] =G_type[16] ="PRINT";
	G_type[11] =G_type[12] =G_type[13] = G_type[14] =G_type[15] ="WEB";
	G_type[6]=G_type[18]=G_type[19] =G_type[20]  ="MOTION GRAPHICS";
	G_type[2]  ="3D DESIGN";
	//-------------on start scroll to page 1----------------------------
	 $('html, body').stop().animate({
            scrollTop: $("#mainpage-intro").offset().top -40    //offset to couteract overshoot
        }, 1500, 'easeInOutExpo');

  /*  	$('ul.pics-collection li').click(function(e) {
		//alert('show..!');
		//$(document).ready(gallery););
		$("#gallery_big").show();
    		e.preventDefault();
		$currproject = $(this).attr('data-value');
		var temp='img/projects/web'+$currproject+'_';
		temp+=$currproject_slide;
		$('#gallery_big1').attr('src','img/projects/web'+$currproject+'_'+ $currproject_slide+'.jpg');
		loadheadings(G_headings[$currproject],G_desc[$currproject],G_type[$currproject]);

    });
	$("#rightarrow").click(function(e) {
		$currproject_slide++;
		if($currproject_slide>3)
			$currproject_slide=1;			   //alert('wow');
		$('#gallery_big1').attr('src', "img/projects/web"+$currproject+"_"+$currproject_slide+".jpg");

    });
	$("#leftarrow").click(function(e) {
		$currproject_slide--;
		if($currproject_slide<1)
			$currproject_slide=3;			   //alert('wow');
		$('#gallery_big1').attr('src', "img/projects/web"+$currproject+"_"+$currproject_slide+".jpg");

    });*/
//---------main code-----------------//

	  $('#sidebar').affix({
	      offset: {
		// top: 235
		top: $('#superheader').height()-20	//minus 10 to eliminate flicker
	      }
	});
	  //var tid = setTimeout(headeranim(), 2000);

	 $('#test7').click(function(){
					mycode2();
    });
//jQuery for page scrolling feature - requires jQuery Easing plugin
	$(function() {
	    $('.page-scroll a').bind('click', function(event) {
		 var $anchor = $(this);
		 $('html, body').stop().animate({
		     scrollTop: $($anchor.attr('href')).offset().top-100//offset to couteract overshoot
		 }, 1500, 'easeInOutExpo');
		 event.preventDefault();
	    });
	});

	//-----gallery-------------------------
	$(".mix").click(function() {
			$currproject = $(this).attr('data-value');
			$currslide_nums = $(this).attr('data-num');
			$currproject_slide = 1;
			$("#gallery_big").show();
			$("#projects_clickdown").hide();
			scrolltobigpics( );
			var temp='img/projects/web'+$currproject+'_';
			temp+=$currproject_slide;
			$('#gallery_big1').attr('src','img/projects/web'+$currproject+'_'+ $currproject_slide+'.png');
			loadheadings(G_headings[$currproject],G_desc[$currproject],G_type[$currproject]);

    	});
	$("#rightarrow").click(function(e) {
			$currproject_slide++;
			if($currproject_slide>$currslide_nums)
				$currproject_slide=1;			   //alert('wow');
			$('#gallery_big1').attr('src', "img/projects/web"+$currproject+"_"+$currproject_slide+".png");
    	});
	$("#leftarrow").click(function(e) {
			$currproject_slide--;
			if($currproject_slide<1)
				$currproject_slide=$currslide_nums;			   //alert('wow');
			$('#gallery_big1').attr('src', "img/projects/web"+$currproject+"_"+$currproject_slide+".png");
    	});

 });//document.ready
 //---------------new gallery-----------------
 $(function(){
    $('#Grid').mixitup();
});
 $('#Grid').mixitup({
    targetSelector: '.mix',
    onMixLoad: null,
    onMixStart: null,
    onMixEnd: function(){
    }
});
 function loadheadings( temp, temp2,temp3){
	document.getElementById('Gheading').innerHTML=temp;
	document.getElementById('Gdesc').innerHTML=temp2;
	document.getElementById('Gtype').innerHTML=temp3;
}
 function scrolltobigpics( ){
		 $('html, body').stop().animate({
		     scrollTop: $("#gallery_big").offset().top-100//offset to couteract overshoot
		 }, 1500, 'easeInOutExpo');
}

$(function()  {   //header reload
	var cars = $('.header_list');
	var index = 0;
	var index2 = 1;
	var loop = function() {
		var car = $(cars[index]);//outgoing
		var car2 = $(cars[index2]);//incoming
		car.delay(1000).animate({ 'padding-top' : 50,'opacity':0}, 1000);
		car2.delay(1000).animate({ 'padding-top' : 0,'opacity':1}, 1000, function() {
	      			index = index + 1 < cars.length ? index + 1 : 0;
				index2 = index2 + 1 < cars.length ? index2 + 1 : 0;
				loop();
	  	});
	};
	loop();
});
$(window).scroll(function() {//--------------display scroll top icon after scrolling some down
    if ($(".navbar").offset().top > 700) {
        $("#go_to_top").show();
    } else {
        $("#go_to_top").hide();
    }
});

$( window ).resize(function() {
    $('#reel').css({
  	//	'background-position-x': '0'
	});
    //alert('asfag');
});
$(function()  {   //customers reel
 var cars = $('#reel');
	 var i=0;
	 var temp=0;
	 var temp2=0;
	var loop = function() {
			widthx=$('#reel').width()/3;
			temp=(widthx*i)+($('#reel').width()*temp2);
			cars.delay(1000).animate({ 'background-position-x': temp}, 500, function() {
				i++;
				if(i>2){
					   // $('#reel').css({'background-position-x': '0'	});
					i=0;
					temp2++;
					}
				loop();
	  		});
	};
	loop();
});
$(function ()  {
	     $("#test5").popover();  //enable popovers on myskills section
});
$(function ()  {
	     $("#pop1").popover();  //enable popovers on myskills section
	     $("#pop2").popover();
	     $("#pop3").popover();
	     $("#pop4").popover();
});


text:
package org.apereo.cas.configuration.loader;

import org.apereo.cas.util.crypto.CipherExecutor;

import lombok.RequiredArgsConstructor;
import lombok.val;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.env.Environment;
import org.springframework.core.io.Resource;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

/**
 * This is {@link ConfigurationPropertiesLoaderFactory}.
 *
 * @author Misagh Moayyed
 * @since 6.0.0
 */
@RequiredArgsConstructor
public class ConfigurationPropertiesLoaderFactory {
    /**
     * The Configuration cipher executor.
     */
    private final CipherExecutor<String, String> configurationCipherExecutor;

    private final Environment environment;

    /**
     * Gets loader based on the given resource.
     *
     * @param resource the resource
     * @param name     the name
     * @return the loader
     */
    public BaseConfigurationPropertiesLoader getLoader(final Resource resource,
                                                       final String name) {
        val filename = StringUtils.defaultString(resource.getFilename()).toLowerCase();

        if (filename.endsWith(".properties")) {
            return new SimpleConfigurationPropertiesLoader(this.configurationCipherExecutor, name, resource);
        }
        if (filename.endsWith(".groovy")) {
            return new GroovyConfigurationPropertiesLoader(this.configurationCipherExecutor, name,
                getApplicationProfiles(environment), resource);
        }
        if (filename.endsWith(".yaml") || filename.endsWith(".yml")) {
            return new YamlConfigurationPropertiesLoader(this.configurationCipherExecutor, name, resource);
        }
        throw new IllegalArgumentException("Unable to determine configuration loader for " + resource);
    }

    /**
     * Gets application profiles.
     *
     * @param environment the environment
     * @return the application profiles
     */
    public static List<String> getApplicationProfiles(final Environment environment) {
        return Arrays.stream(environment.getActiveProfiles()).collect(Collectors.toList());
    }
}


text:
package repo

import (
	"bytes"
	"encoding/json"
	"fmt"
	"path"
	"strings"
)

// The type of the callback called when versions age out of the repo.
type versionOnDelete func(versionName string)

// Index is the repository index for an application.
type Index struct {
	appName  string              // The name of the application in this index
	Canary   int                 `json:"canary"`       // Incremented each time the index is written out
	Versions map[string]*Version `json:"versions"`     // The set of versions uploaded; old entries fall off
	Envs     map[string]*Env     `json:"environments"` // The defined environments: prod, stage, etc.
}

// NewIndex returns a new instance of Index.
func NewIndex(appName string) *Index {

	ri := new(Index)

	ri.appName = strings.ToLower(appName)
	ri.Canary = 0
	ri.Versions = make(map[string]*Version)
	ri.Envs = make(map[string]*Env)

	return ri
}

// AddEnv initializes a new environment and adds it into the index.
func (ri *Index) AddEnv(envName string) error {
	if _, err := ri.GetEnv(envName); err == nil {
		return fmt.Errorf("environment %q already present", envName)
	}
	ri.SetEnv(envName, newEnv())
	return nil
}

// GetEnv retrieves an environment from the index.
func (ri *Index) GetEnv(envName string) (*Env, error) {
	if env, found := ri.Envs[envName]; found {
		// Provide private access to the Versions.
		env.versions = ri.Versions
		return env, nil
	}
	return nil, fmt.Errorf("environment %q not present", envName)
}

// SetEnv replaces an environment in the index.
func (ri *Index) SetEnv(envName string, env *Env) error {
	ri.Envs[envName] = env
	return nil
}

// RmEnv removes an environment from the index.
func (ri *Index) RmEnv(envName string) error {
	if _, err := ri.GetEnv(envName); err != nil {
		return err
	}
	delete(ri.Envs, envName)
	return nil
}

// AddVersion initializes a new version and adds it into the index.
func (ri *Index) AddVersion(versionName, fileName string, enabled bool, onDelete versionOnDelete) error {

	if _, err := ri.GetVersion(versionName); err == nil {
		return fmt.Errorf("version %q already present", versionName)
	}

	// Determine the minimum number of version entries that must be kept.
	minCount := 0
	for _, env := range ri.Envs {
		if env.Keep > minCount {
			minCount = env.Keep
		}
	}

	// Get versions, oldest first, and determine how many we currently have.
	versions := ri.VersionList("asc")
	curCount := len(versions)

	// Remove unreferenced versions until we reach the minimum count.
	for _, vers := range versions {
		if curCount < minCount {
			break
		}

		// Check for references in each environment.
		referenced := false
		for _, env := range ri.Envs {
			for _, histEvent := range env.Deployed {
				if vers.Name == histEvent.Version {
					referenced = true
					break
				}
			}
			if referenced {
				break
			}
		}

		// If unreferenced, remove it from the list.
		if !referenced {
			onDelete(vers.Name)
			delete(ri.Versions, vers.Name)
			curCount--
		}
	}

	// Now add the new version (which is of course unreferenced so far).
	ri.SetVersion(versionName, newVersion(versionName, fileName, enabled))

	return nil
}

// GetVersion retrieves a version from the index.
func (ri *Index) GetVersion(versionName string) (*Version, error) {
	if version, found := ri.Versions[versionName]; found {
		return version, nil
	}
	return nil, fmt.Errorf("version %q not present", versionName)
}

// SetVersion replaces a version in the index.
func (ri *Index) SetVersion(versionName string, version *Version) error {
	ri.Versions[versionName] = version
	return nil
}

// RmVersion removes a version from the index and from all environments.
func (ri *Index) RmVersion(versionName string) error {

	// The version must be present.
	if _, err := ri.GetVersion(versionName); err != nil {
		return err
	}

	// Query every environment to determine whether the version is in use.
	usedBy := make([]string, 0)
	for envName, env := range ri.Envs {
		if !env.isPurgable(versionName) {
			usedBy = append(usedBy, envName)
		}
	}
	if len(usedBy) > 0 {
		return fmt.Errorf("Version %q in use in %s", versionName, strings.Join(usedBy, ", "))
	}

	// Remove the version from all environments.
	errCount := 0
	for _, env := range ri.Envs {
		if err := env.purgeVersion(versionName); err != nil {
			errCount++
		}
	}

	// Remove the version from the versions list.
	if errCount == 0 {
		delete(ri.Versions, versionName)
	} else {
		return fmt.Errorf("Version %q not completely purged", versionName)
	}
	return nil
}

// VersionList returns an array of versions ordered by timestamp.
func (ri *Index) VersionList(order string) []Version {
	var versions []Version
	for _, v := range ri.Versions {
		versions = append(versions, *v)
	}
	ascending := func(v1, v2 *Version) bool {
		return v2.TS.After(v1.TS)
	}
	descending := func(v1, v2 *Version) bool {
		return v1.TS.After(v2.TS)
	}
	if order == "desc" {
		sortVersionsBy(descending).Sort(versions)
	} else {
		sortVersionsBy(ascending).Sort(versions)
	}
	return versions
}

// IndexPath returns the canonical path to the app's index in the repository.
func (ri *Index) IndexPath() string {
	return ri.appName + "/index.json"
}

// ArtifactPath returns the canonical path to the indicated artifact.
func (ri *Index) ArtifactPath(filename string) string {
	return path.Join(ri.appName, "versions", filename)
}

// HMACPath returns the canonical path to the HMAC for the indicated artifact.
func (ri *Index) HMACPath(filename string) string {
	return ri.ArtifactPath(filename) + ".hmac"
}

// ArtifactFilename returns the canonical filename of the indicated artifact.
func (ri *Index) ArtifactFilename(version, artifactType string) string {
	return ri.appName + "-" + version + "." + artifactType
}

// FromJSON materializes the index from a JSON byte array.
func (ri *Index) FromJSON(text []byte) error {
	decoder := json.NewDecoder(bytes.NewReader(text))
	return decoder.Decode(ri)
}

// ToJSON serializes the index to a JSON byte array.
func (ri *Index) ToJSON() ([]byte, error) {
	if text, err := json.MarshalIndent(*ri, "", "    "); err == nil {
		return text, nil
	} else {
		return []byte{}, err
	}
}


text:
import {bootstrap} from 'angular2/bootstrap';
import {ElementRef, Component, Directive, View, Injectable} from 'angular2/core';
import {Renderer} from 'angular2/render';

export function main() {
  // Bootstrapping only requires specifying a root component.
  // The boundary between the Angular application and the rest of the page is
  // the shadowDom of this root component.
  // The selector of the component passed in is used to find where to insert the
  // application.
  // You can use the light dom of the <hello-app> tag as temporary content (for
  // example 'Loading...') before the application is ready.
  bootstrap(HelloCmp);
}

// A service available to the Injector, used by the HelloCmp component.
@Injectable()
class GreetingService {
  greeting: string = 'hello';
}

// Directives are light-weight. They don't allow new
// expression contexts (use @Component for those needs).
@Directive({selector: '[red]'})
class RedDec {
  // ElementRef is always injectable and it wraps the element on which the
  // directive was found by the compiler.
  constructor(el: ElementRef, renderer: Renderer) { renderer.setElementStyle(el, 'color', 'red'); }
}

// Angular 2.0 supports 2 basic types of directives:
// - Component - the basic building blocks of Angular 2.0 apps. Backed by
//   ShadowDom.(http://www.html5rocks.com/en/tutorials/webcomponents/shadowdom/)
// - Directive - add behavior to existing elements.

// @Component is AtScript syntax to annotate the HelloCmp class as an Angular
// 2.0 component.
@Component({
  // The Selector prop tells Angular on which elements to instantiate this
  // class. The syntax supported is a basic subset of CSS selectors, for example
  // 'element', '[attr]', [attr=foo]', etc.
  selector: 'hello-app',
  // These are services that would be created if a class in the component's
  // template tries to inject them.
  viewBindings: [GreetingService]
})
// The template for the component.
@View({
  // Expressions in the template (like {{greeting}}) are evaluated in the
  // context of the HelloCmp class below.
  template: `
{{greeting}} world!

           <button class="changeButton" (click)="changeGreeting()">change greeting</button>`,
  // All directives used in the template need to be specified. This allows for
  // modularity (RedDec can only be used in this template)
  // and better tooling (the template can be invalidated if the attribute is
  // misspelled).
  directives: [RedDec]
})
export class HelloCmp {
  greeting: string;

  constructor(service: GreetingService) { this.greeting = service.greeting; }

  changeGreeting(): void { this.greeting = 'howdy'; }
}


text:
static CGFloat const kMQEvaluationVerticalSpacing = 16.0;
static CGFloat const kMQEvaluationHorizontalSpacing = 16.0;

@interface MQEvaluationView()<UITableViewDelegate, UITableViewDataSource, CustomIOSAlertViewDelegate, UITextFieldDelegate>

@end

@implementation MQEvaluationView {
    CustomIOSAlertView *evaluationAlertView;
    NSInteger selectedLevelRow;
    UITextField *commentTextField;
}

- (instancetype)init {
    self = [super init];
    if (self) {
        [self initCustomAlertView];
        selectedLevelRow = 0;
    }
    return self;
}

- (void)initCustomAlertView {
    evaluationAlertView = [[CustomIOSAlertView alloc] init];
    [evaluationAlertView setContainerView:[self getCustomAlertView]];
    [evaluationAlertView setButtonTitles:[NSMutableArray arrayWithObjects:@"取消", @"发送", nil]];
    [evaluationAlertView setDelegate:self];
    [evaluationAlertView setUseMotionEffects:true];
}

- (UIView *)getCustomAlertView {
    CGRect deviceFrame = [MQChatDeviceUtil getDeviceScreenRect];
    CGFloat originX = ceil(deviceFrame.size.width / 8);
    CGFloat originY = ceil(deviceFrame.size.height / 3);

    UIView *customView = [[UIView alloc] init];
    customView.frame = CGRectMake(originX, originY, deviceFrame.size.width - originX * 2, deviceFrame.size.height - originY * 2);

    //alertView 标题
    UILabel *alertViewTitle = [[UILabel alloc] initWithFrame:CGRectMake(0, kMQEvaluationVerticalSpacing, customView.frame.size.width, 24)];
    alertViewTitle.text = @"你对本次服务满意吗?";
    alertViewTitle.textColor = [UIColor colorWithWhite:0.22 alpha:1];
    alertViewTitle.textAlignment = NSTextAlignmentCenter;
    alertViewTitle.font = [UIFont systemFontOfSize:17.0];
    [customView addSubview:alertViewTitle];

    //tableView 上分割线
    UIView *tableTopLine = [[UIView alloc] initWithFrame:CGRectMake(0, alertViewTitle.frame.origin.y+alertViewTitle.frame.size.height+kMQEvaluationVerticalSpacing, customView.frame.size.width, 0.5)];
    tableTopLine.backgroundColor = [UIColor colorWithRed:198.0/255.0 green:198.0/255.0 blue:198.0/255.0 alpha:1.0f];
    [customView addSubview:tableTopLine];

    UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(kMQEvaluationHorizontalSpacing, tableTopLine.frame.origin.y+tableTopLine.frame.size.height, customView.frame.size.width-kMQEvaluationHorizontalSpacing, [MQEvaluationCell getCellHeight] * 3) style:UITableViewStylePlain];
    tableView.backgroundColor = [UIColor clearColor];
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    tableView.scrollEnabled = false;
    tableView.delegate = self;
    tableView.dataSource = self;
    [customView addSubview:tableView];

    //tableView 下分割线
    UIView *tableBottomLine = [[UIView alloc] initWithFrame:CGRectMake(0, tableView.frame.origin.y+tableView.frame.size.height, customView.frame.size.width, 0.5)];
    tableBottomLine.backgroundColor = [UIColor colorWithRed:198.0/255.0 green:198.0/255.0 blue:198.0/255.0 alpha:1.0f];
    [customView addSubview:tableBottomLine];

    //评价的输入文字框
    commentTextField = [[UITextField alloc] initWithFrame:CGRectMake(kMQEvaluationHorizontalSpacing, tableBottomLine.frame.origin.y+tableBottomLine.frame.size.height+kMQEvaluationVerticalSpacing, tableView.frame.size.width - kMQEvaluationHorizontalSpacing, 34)];
    commentTextField.placeholder = @"填写评价内容(选填)";
    commentTextField.delegate = self;
    commentTextField.returnKeyType = UIReturnKeyDone;
    commentTextField.font = [UIFont systemFontOfSize:15.0];
    commentTextField.textColor = [UIColor darkTextColor];
    commentTextField.backgroundColor = [UIColor whiteColor];
    commentTextField.textAlignment = NSTextAlignmentLeft;
    commentTextField.layer.borderColor = tableBottomLine.backgroundColor.CGColor;
    commentTextField.layer.borderWidth = 0.5;
    UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 5, commentTextField.frame.size.height)];
    commentTextField.leftView = paddingView;
    commentTextField.leftViewMode = UITextFieldViewModeAlways;
    [customView addSubview:commentTextField];

    //重新计算 frame
    customView.frame = CGRectMake(0, 0, customView.frame.size.width, commentTextField.frame.origin.y+commentTextField.frame.size.height+kMQEvaluationVerticalSpacing);

    return customView;
}

- (void)showEvaluationAlertView {
    if (evaluationAlertView) {
        if (![evaluationAlertView didShowAlertView]) {
            [evaluationAlertView show];
        }
    }
}

#pragma CustomIOSAlertViewDelegate
- (void)customIOS7dialogButtonTouchUpInside: (CustomIOSAlertView *)alertView clickedButtonAtIndex: (NSInteger)buttonIndex
{
    if (buttonIndex == 1) {
        if (!self.delegate) {
            return;
        }
        if (![self.delegate respondsToSelector:@selector(didSelectLevel:comment:)]) {
            return;
        }
        //发送评价
        NSInteger level = 2;
        NSString *comment = commentTextField.text.length > 0 ? commentTextField.text : @"";
        switch (selectedLevelRow) {
            case 0:
                level = 2;
                break;
            case 1:
                level = 1;
                break;
            case 2:
                level = 0;
                break;
            default:
                break;
        }
        [self.delegate didSelectLevel:level comment:comment];
    }
    commentTextField.text = nil;
    [alertView close];
}

#pragma UITextFieldDelegate
- (BOOL)textFieldShouldReturn:(UITextField *)textField {
    [commentTextField resignFirstResponder];
    return false;
}

#pragma UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return [MQEvaluationCell getCellHeight];
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    selectedLevelRow = indexPath.row;
    [tableView reloadData];
}

#pragma UITableViewDataSource
- (NSInteger)tableView:(UITableView *)tableView
 numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    MQEvaluationCell *cell = [tableView dequeueReusableCellWithIdentifier:@"alertViewTableView"];
    if (!cell){
        cell = [[MQEvaluationCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"alertViewTableView"];
        [cell setFrame:CGRectMake(0, 0, tableView.frame.size.width, [MQEvaluationCell getCellHeight])];
    }
    [cell setLevel:2 - indexPath.row];
    if (selectedLevelRow == indexPath.row) {
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
    } else {
        cell.accessoryType = UITableViewCellAccessoryNone;
    }
    if (indexPath.row == 2) {
        [cell hideBottomLine];
    }

    return cell;
}

@end


text:
package edu.galileo.android.facebookrecipes.recipemain;

import org.junit.Test;
import org.mockito.Mock;

import edu.galileo.android.facebookrecipes.BaseTest;
import edu.galileo.android.facebookrecipes.entities.Recipe;
import edu.galileo.android.facebookrecipes.libs.base.EventBus;
import edu.galileo.android.facebookrecipes.recipemain.events.RecipeMainEvent;
import edu.galileo.android.facebookrecipes.recipemain.ui.RecipeMainView;

import static junit.framework.Assert.assertEquals;
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNull;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

/**
 * Created by ykro.
 */
public class RecipeMainPresenterImplTest extends BaseTest {
    @Mock
    private EventBus eventBus;
    @Mock
    private RecipeMainView view;
    @Mock
    private SaveRecipeInteractor saveInteractor;
    @Mock
    private GetNextRecipeInteractor getNextInteractor;
    @Mock
    Recipe recipe;
    @Mock
    RecipeMainEvent event;

    private RecipeMainPresenterImpl presenter;

    @Override
    public void setUp() throws Exception {
        super.setUp();
        presenter = new RecipeMainPresenterImpl(eventBus, view, saveInteractor, getNextInteractor);
    }

    @Test
    public void testOnCreate_subscribedToEventBus() throws Exception {
        presenter.onCreate();
        verify(eventBus).register(presenter);
    }

    @Test
    public void testOnDestroy_UnsubscribedToEventBus() throws Exception {
        presenter.onDestroy();
        verify(eventBus).unregister(presenter);
        assertNull(presenter.getView());
    }

    @Test
    public void testSaveRecipe_executeSaveInteractor() throws Exception {
        presenter.saveRecipe(recipe);

        assertNotNull(presenter.getView());
        verify(view).saveAnimation();
        verify(view).hideUIElements();
        verify(view).showProgress();
        verify(saveInteractor).execute(recipe);
    }

    @Test
    public void testDismissRecipe_executeGetNextRecipeInteractor() throws Exception {
        presenter.dismissRecipe();

        assertNotNull(presenter.getView());
        verify(view).dismissAnimation();
    }

    @Test
    public void testGetNextRecipe_executeGetNextRecipeInteractor() throws Exception {
        presenter.getNextRecipe();

        assertNotNull(presenter.getView());
        verify(view).hideUIElements();
        verify(view).showProgress();
        verify(getNextInteractor).execute();

    }

    @Test
    public void testOnEvent_hasError() throws Exception {
        String errorMsg = "error";

        when(event.getError()).thenReturn(errorMsg);
        presenter.onEventMainThread(event);

        assertNotNull(presenter.getView());
        verify(view).hideProgress();
        verify(view).onGetRecipeError(event.getError());
    }

    @Test
    public void testOnNextEvent_setRecipeOnView() throws Exception {
        when(event.getType()).thenReturn(RecipeMainEvent.NEXT_EVENT);
        when(event.getRecipe()).thenReturn(recipe);

        presenter.onEventMainThread(event);

        assertNotNull(presenter.getView());
        verify(view).setRecipe(event.getRecipe());
    }

    @Test
    public void testOnSaveEvent_notifyViewAndCallGetNextRecipe() throws Exception {
        when(event.getType()).thenReturn(RecipeMainEvent.SAVE_EVENT);

        presenter.onEventMainThread(event);

        assertNotNull(presenter.getView());
        verify(view).onRecipeSaved();
        verify(getNextInteractor).execute();
    }

    @Test
    public void testImageReady_updateUI() throws Exception {
        presenter.imageReady();

        assertNotNull(presenter.getView());
        verify(view).hideProgress();
        verify(view).showUIElements();
    }

    @Test
    public void testImageError_updateUI() throws Exception {
        String error = "error";
        presenter.imageError(error);

        assertNotNull(presenter.getView());
        verify(view).onGetRecipeError(error);
    }

    @Test
    public void testGetView_returnsView() throws Exception {
        assertEquals(view, presenter.getView());
    }
}


text:
"""This module, pre_process_constant.py, provides an abstraction for JS constants to pre-process."""

class PreProcessConstant(object):
	"""Represents a constant to pre-process."""

	def __init__(self, raw_line):
		self._raw      = raw_line
		self._variable = None
		self._value    = None
		self._initialize()

	def _initialize(self):
		"""Gets the constant name."""
		r = self._raw.lstrip().rstrip()
		r = r[r.index('const ') + len('const '):]
		r = r[:r.index(';')]

		self._variable = r[:r.index('=')].lstrip().rstrip()
		self._value    = r[r.index('=') + 1:].lstrip().rstrip()

	@property
	def variable(self) -> str:
		"""Returns the name of this constant/variable."""
		return self._variable

	@property
	def value(self) -> str:
		"""Returns the value of this constant/variable."""
		return self._value

def parse_out_constants(lines_to_parse):
	"""Returns the lines with certain constants parsed out."""
	constants  = []
	first_pass = []
	final_pass = []

	for line in lines_to_parse:
		if 'const' in line and '#pre-process_global_constant' in line:
			constants.append(PreProcessConstant(line))
		else:
			first_pass.append(line)

	for l in first_pass:
		line = l
		for c in constants:
			if c.variable in line:
				line = line.replace(c.variable, c.value)

		final_pass.append(line)

	return final_pass


text:
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

#ifndef MESSAGE_SENDER_H
#define MESSAGE_SENDER_H

#include <stdbool.h>
#include "azure_uamqp_c/link.h"
#include "azure_uamqp_c/message.h"
#include "azure_c_shared_utility/xlogging.h"

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include "azure_c_shared_utility/umock_c_prod.h"

    typedef enum MESSAGE_SEND_RESULT_TAG
    {
        MESSAGE_SEND_OK,
        MESSAGE_SEND_ERROR
    } MESSAGE_SEND_RESULT;

    typedef enum MESSAGE_SENDER_STATE_TAG
    {
        MESSAGE_SENDER_STATE_IDLE,
        MESSAGE_SENDER_STATE_OPENING,
        MESSAGE_SENDER_STATE_OPEN,
        MESSAGE_SENDER_STATE_CLOSING,
        MESSAGE_SENDER_STATE_ERROR
    } MESSAGE_SENDER_STATE;

    typedef struct MESSAGE_SENDER_INSTANCE_TAG* MESSAGE_SENDER_HANDLE;
    typedef void(*ON_MESSAGE_SEND_COMPLETE)(void* context, MESSAGE_SEND_RESULT send_result);
    typedef void(*ON_MESSAGE_SENDER_STATE_CHANGED)(void* context, MESSAGE_SENDER_STATE new_state, MESSAGE_SENDER_STATE previous_state);

    MOCKABLE_FUNCTION(, MESSAGE_SENDER_HANDLE, messagesender_create, LINK_HANDLE, link, ON_MESSAGE_SENDER_STATE_CHANGED, on_message_sender_state_changed, void*, context);
    MOCKABLE_FUNCTION(, void, messagesender_destroy, MESSAGE_SENDER_HANDLE, message_sender);
    MOCKABLE_FUNCTION(, int, messagesender_open, MESSAGE_SENDER_HANDLE, message_sender);
    MOCKABLE_FUNCTION(, int, messagesender_close, MESSAGE_SENDER_HANDLE, message_sender);
    MOCKABLE_FUNCTION(, int, messagesender_send, MESSAGE_SENDER_HANDLE, message_sender, MESSAGE_HANDLE, message, ON_MESSAGE_SEND_COMPLETE, on_message_send_complete, void*, callback_context);
    MOCKABLE_FUNCTION(, void, messagesender_set_trace, MESSAGE_SENDER_HANDLE, message_sender, bool, traceOn);

#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* MESSAGE_SENDER_H */


text:
using namespace Telegram;

CallbackQuery::CallbackQuery(QJsonObject callbackquery) : empty(false)
{
    id = callbackquery.value("id").toString();
    from = User(callbackquery.value("from").toObject());
    if (callbackquery.contains("message")) {
        message = Message(callbackquery.value("message").toObject());
    }
    if (callbackquery.contains("inline_message_id")) {
        inline_message_id = callbackquery.value("inline_message_id").toString();
    }
    if (callbackquery.contains("chat_instance")) {
        chat_instance = callbackquery.value("chat_instance").toString();
    }
    if (callbackquery.contains("data")) {
        data = callbackquery.value("data").toString();
    }
    if (callbackquery.contains("game_short_name")) {
        game_short_name = callbackquery.value("game_short_name").toString();
    }
}


text:
using System.Runtime.InteropServices;

internal partial class Interop
{
    internal partial class Kernel32
    {
        [DllImport(Libraries.Kernel32, EntryPoint = "ExpandEnvironmentStringsW", CharSet = CharSet.Unicode, SetLastError = true)]
        internal static extern uint ExpandEnvironmentStrings(string lpSrc, ref char lpDst, uint nSize);
    }
}


text:
// Header for CIdentityPopup class

#ifndef __CIDENTITYPOPUP__MULBERRY__
#define __CIDENTITYPOPUP__MULBERRY__

#include <LPopupButton.h>

// Consts

enum
{
	eIdentityPopup_New = 1,
	eIdentityPopup_Edit,
	eIdentityPopup_Delete,
	eIdentityPopup_Custom,
	eIdentityPopup_FirstWithoutCustom = 5,
	eIdentityPopup_FirstWithCustom = 6
};

// Classes
class CIdentity;
class CPreferences;
class LCommander;
class CIdentityList;
class cdstring;

class CIdentityPopup : public LPopupButton
{

public:
	enum { class_ID = 'IDop' };

					CIdentityPopup(LStream *inStream);
	virtual 		~CIdentityPopup();

	unsigned long	FirstIndex() const
	{
		return mHasCustom ? eIdentityPopup_FirstWithCustom : eIdentityPopup_FirstWithoutCustom;
	}
	virtual void	SetValue(long value);					// Handle special cases
			void	SetIdentity(CPreferences* prefs, const CIdentity* id);
			void	SetIdentity(CPreferences* prefs, const cdstring& name);
			const CIdentity& GetIdentity(CPreferences* prefs) const;
			const CIdentity* GetCustomIdentity() const
			{
				return mCustomIdentity;
			}

			void	Reset(const CIdentityList& ids, bool custom = false);			// Reset items
			void	DoNewIdentity(CPreferences* prefs);			// Add new identity
			bool	DoEditIdentity(CPreferences* prefs);		// Edit identity
			void	DoDeleteIdentity(CPreferences* prefs);		// Delete existing identities

			bool	EditCustomIdentity();

			unsigned long	GetCount() const;

private:
	long			mOldValue;
	bool			mHasCustom;
	CIdentity*		mCustomIdentity;

};

#endif


text:
System Options
==============

System configuration is handled at two stages:

- In the ``sentry_options`` table.
- In Sentry configuration (Django settings via SENTRY_OPTIONS).

The options package should be the primary point of configuration outside of
critical systems (such as database connection information).

:mod:`sentry.options`
---------------------

The options manager is exported as ``sentry.options.default_manager`` and
the public API is also exposed at options module level:

.. code:: python

    from sentry import options

    if options.get('foo') == 'bar':
       print('foo is set to bar')

.. autoclass:: sentry.options.manager.OptionsManager
   :members:


text:
This is a Terraform module to manage a list of Availability Zones in the current account which
can be used to explicitly control access to a desired list of Availability Zones in a consistent
and predictable manner.

By default, this module returns all currently known Availability Zones in the current region,
unless an Availability Zone is explicitly excluded from the results using the `exclude` variable.

## Requirements

- Terraform 0.10.x or higher.

## Dependencies

None.

## Usage

#### Example of fetching Availability Zones in the "us-east-1" region with "us-east-1b" excluded using a single letter only:

```ruby
module "availability_zones" {
  source = "./availability-zones"

  region = "us-east-1"
  exclude = ["b"]
}
```

#### Example of fetching Availability Zones in the "us-east-1" region with "us-east-1b" excluded using full name of the zone:

```ruby
module "availability_zones" {
  source = "./availability-zones"

  region = "us-east-1"
  exclude = ["us-east-1b"]
}
```

#### Example of fetching Availability Zones in current region with all the zones shuffled around randomly:

```ruby
module "availability_zones" {
  source = "./availability-zones"

  shuffle = true
}
```

## Variables

| Name | Description | Type | Default | Required |
|------|-------------|:-----:|:-----:|:-----:|
| region | The name of the region for which to return the list of Availability Zones. | String | | No |
| exclude | A list of Availability Zones to exclude from the results. Can be either a single letter or a full name of the zone (e.g. "b" or "us-east-1b"). | List | | No |
| shuffle | | Boolean | false | No |

## Outputs

| Name | Description | Type |
|------|-------------|:----:|
| region | The current region for which to return relevant Availability Zones. | String |
| count | The number of all Availability Zones in the current region. | Integer |
| all | The list of all Availability Zones in the current region. | List |
| available | The list of Availability Zones in the current region without zones excluded using the `exclude` attribute. | List |
| available_count | The number of Availability Zones in the current region without zones excluded using the `exclude` attribute. | Integer |

## Notes

This module provides a static list of Regions and Availability Zones, and does not rely on the
Terraform [aws_availability_zones](https://www.terraform.io/docs/providers/aws/d/availability_zones.html)
data source. Since Terraform data sources are dynamic and always refresh to present up-to-date values,
such behaviour can result in an undesirable change that might be introduced to the existing infrastructure
due to either a new Availability Zone becoming available or retired in the current region.

Additionally, this module outputs contain a static values such as e.g. number of Availability Zones, etc.,
which would alleviate an issue with dynamic resources interpolation and the `count` attribute.

## Known issues

None.

## References

A Pull Request against Terraform which contains implementation details regarding issues with reliable
detection of Availability Zones:

- [Add state filter to aws_availability_zones data source.](https://github.com/hashicorp/terraform/pull/7965)

An issue which contains a discussion about a side effect of changes in the Terraform plan following
an addition of a new Availability Zone:

- [AWS Added an additional AZ to us-east-1 and now `terraform plan` causes a state change](https://github.com/hashicorp/terraform/issues/11928)

## Development

Please see the [CONTRIBUTING.md](CONTRIBUTING.md) file for instructions regarding
the contribution to this repository.


text:
<?php

class YdLookupController extends YdWebController
{

    /**
     * Access Control
     * @return array
     */
    public function accessRules()
    {
        return array(
            array('allow',
                'actions' => array('index', 'view', 'log', 'create', 'update', 'delete', 'order', 'type'),
                'roles' => array('admin'),
            ),
            array('deny', 'users' => array('*')),
        );
    }

    /**
     * @param string $view the view to be rendered
     * @return bool
     */
    public function beforeRender($view)
    {
        $this->addBreadcrumb(Yii::t('dressing', 'Tools'), array('/tool/index'));
        if (in_array($view, array('view', 'update', 'log'))) {
            $this->addBreadcrumb(Yii::t('dressing', 'Lookups'), Yii::app()->user->getState('index.lookup', array('/lookup/index')));
        }
        return parent::beforeRender($view);
    }

    /**
     * Index
     */
    public function actionIndex()
    {
        $lookup = new YdLookup('search');
        if (!empty($_GET['YdLookup']))
            $lookup->attributes = $_GET['YdLookup'];

        $this->render('index', array(
            'lookup' => $lookup,
        ));
    }

    /**
     * View
     * @param $id
     */
    public function actionView($id)
    {
        /** @var $lookup YdLookup */
        $lookup = $this->loadModel($id, 'YdLookup');

        // check for deleted YdLookup
        if ($lookup->deleted) {
            Yii::app()->user->addFlash('THIS RECORD IS DELETED', 'error');
        }

        $this->render('view', array(
            'lookup' => $lookup,
        ));
    }

    /**
     * Log
     * @param $id
     */
    public function actionLog($id)
    {
        /** @var $lookup YdLookup */
        $lookup = $this->loadModel($id, 'YdLookup');

        $this->render('log', array(
            'lookup' => $lookup,
        ));
    }

    /**
     * Create
     */
    public function actionCreate()
    {
        $lookup = new YdLookup('create');

        if (isset($_POST['YdLookup'])) {
            $lookup->attributes = $_POST['YdLookup'];
            if ($lookup->save()) {
                Yii::app()->user->addFlash('Lookup has been created.', 'success');
                $this->redirect(Yii::app()->returnUrl->getUrl($lookup->getUrl()));
            }
        }
        else {
            if (isset($_GET['YdLookup'])) {
                $lookup->attributes = $_GET['YdLookup'];
            }
        }

        $this->render('create', array(
            'lookup' => $lookup,
        ));
    }

    /**
     * Update
     * @param $id
     */
    public function actionUpdate($id)
    {
        /** @var $lookup YdLookup */
        $lookup = $this->loadModel($id, 'YdLookup');

        if (isset($_POST['YdLookup'])) {
            $lookup->attributes = $_POST['YdLookup'];
            if ($lookup->save()) {
                Yii::app()->user->addFlash(Yii::t('dressing', 'Lookup has been updated'), 'success');
                $this->redirect(Yii::app()->returnUrl->getUrl($lookup->getUrl()));
            }
        }

        $this->render('update', array(
            'lookup' => $lookup,
        ));
    }

    /**
     * Delete
     * @param $id
     */
    public function actionDelete($id = null)
    {
        $task = YdHelper::getSubmittedField('task', 'YdLookup') == 'undelete' ? 'undelete' : 'delete';
        if (YdHelper::getSubmittedField('confirm', 'YdLookup')) {
            foreach (YdHelper::getGridIds($id) as $_id) {
                $lookup = YdLookup::model()->findByPk($_id);
                if (!$lookup) {
                    continue;
                }
                call_user_func(array($lookup, $task));
                Yii::app()->user->addFlash(strtr('Lookup :name has been :tasked.', array(
                    ':name' => $lookup->getName(),
                    ':tasked' => $task . 'd',
                )), 'success');
            }
            $this->redirect(Yii::app()->returnUrl->getUrl(Yii::app()->user->getState('index.lookup', array('/lookup/index'))));
        }

        $this->render('delete', array(
            'id' => $id,
            'task' => $task,
        ));
    }

    /**
     * Handles the ordering of lookups.
     */
    public function actionOrder()
    {
        if (isset($_POST['Order'])) {
            $lookups = explode(',', $_POST['Order']);
            foreach ($lookups as $k => $lookup_id) {
                if ($lookup = YdLookup::model()->findbyPk($lookup_id)) {
                    $lookup->position = $k;
                    $lookup->save(false);
                }
            }
        }
    }

    /**
     * Displays a particular group of lookups.
     * @param $type
     * @param integer $id the ID of the lookup to be displayed
     */
    public function actionType($type, $id = null)
    {
        // get types
        $types = YdLookup::model()->types;

        // get lookups for sortable
        $lookups = YdLookup::model()->findAll(array(
            'condition' => 'type=:type AND deleted IS NULL',
            'params' => array(
                ':type' => $type,
            ),
            'order' => 't.position',
        ));

        // get lookup for form
        $lookup = $id ? $this->loadModel($id, 'YdLookup') : new YdLookup;

        if (isset($_POST['YdLookup'])) {
            if (!$id) {
                $lookup->type = $type;
            }
            $lookup->attributes = $_POST['YdLookup'];
            if ($lookup->save()) {
                Yii::app()->user->addFlash(Yii::t('dressing', 'Lookup has been saved.'), 'success');
                $this->redirect(array('lookup/view', 'type' => $type));
            }
        }

        // render view
        $this->render('view', array(
            'types' => $types,
            'type' => $type,
            'lookups' => $lookups,
            'lookup' => $lookup,
        ));
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.fcrepo</groupId>
    <artifactId>fcrepo</artifactId>
    <version>3.6.3-SNAPSHOT</version>
  </parent>

  <artifactId>fcrepo-server</artifactId>
  <packaging>jar</packaging>
  <name>Fedora Server Library</name>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.fcrepo</groupId>
        <artifactId>mptstore</artifactId>
        <version>0.9.5</version>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <properties>
    <demo.src.dir>${basedir}/src/main/resources/demo</demo.src.dir>
    <fedora.home.build.dir>${basedir}/build/home</fedora.home.build.dir>

    <fedora.hostname>localhost</fedora.hostname>
    <fedora.port>8080</fedora.port>
    <fedora.appServerContext>fedora</fedora.appServerContext>
  </properties>

  <build>

    <!-- This 'resource' directory should be migrated to default location -->
    <resources>
      <resource>
        <directory>../resources/server</directory>
        <filtering>true</filtering>
      </resource>
      <resource>
        <directory>src/main/resources/properties</directory>
      </resource>
      <resource>
        <directory>src/main/resources/dbspec/server</directory>
      </resource>
      <resource>
        <directory>src/main/resources/utilities/server</directory>
      </resource>
    </resources>

    <plugins>
      <!-- Note: This plugin was defined as required by: client, integrationtest,
        & server.test. It is certainly required by fedorahome.zip (integrationtest)
        & server.test. The other two dependencies listed above are questionable. -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>demo-convert-mets</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>java</goal>
            </goals>
            <configuration>
              <mainClass>org.fcrepo.server.storage.translation.ConvertObjectSerialization</mainClass>
              <arguments>
                <argument>${basedir}/src/main/resources/demo/demo-objects/foxml</argument>
                <argument>${project.build.directory}/client/demo/mets</argument>
                <argument>org.fcrepo.server.storage.translation.FOXML1_1DODeserializer</argument>
                <argument>org.fcrepo.server.storage.translation.METSFedoraExt1_1DOSerializer</argument>
                <argument>true</argument>
                <argument>xml</argument>
                <argument>xml</argument>
              </arguments>
              <classpathScope>runtime</classpathScope>
            </configuration>
          </execution>
          <execution>
            <id>demo-convert-atom</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>java</goal>
            </goals>
            <configuration>
              <mainClass>org.fcrepo.server.storage.translation.ConvertObjectSerialization</mainClass>
              <arguments>
                <argument>${basedir}/src/main/resources/demo/demo-objects/foxml</argument>
                <argument>${project.build.directory}/client/demo/atom</argument>
                <argument>org.fcrepo.server.storage.translation.FOXML1_1DODeserializer</argument>
                <argument>org.fcrepo.server.storage.translation.Atom1_1DOSerializer</argument>
                <argument>true</argument>
                <argument>xml</argument>
                <argument>xml</argument>
              </arguments>
              <classpathScope>runtime</classpathScope>
            </configuration>
          </execution>
          <execution>
            <id>demo-convert-atomzip</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>java</goal>
            </goals>
            <configuration>
              <mainClass>org.fcrepo.server.storage.translation.ConvertObjectSerialization</mainClass>
              <arguments>
                <argument>${basedir}/src/main/resources/demo/demo-objects/foxml</argument>
                <argument>${project.build.directory}/client/demo/atom-zip</argument>
                <argument>org.fcrepo.server.storage.translation.FOXML1_1DODeserializer</argument>
                <argument>org.fcrepo.server.storage.translation.AtomZip1_1DOSerializer</argument>
                <argument>false</argument>
                <argument>xml</argument>
                <argument>zip</argument>
              </arguments>
              <classpathScope>runtime</classpathScope>
            </configuration>
          </execution>

          <execution>
            <id>gen-vocab</id>
            <phase>process-classes</phase>
            <goals>
              <goal>java</goal>
            </goals>
            <configuration>
              <mainClass>org.fcrepo.common.policy.Release2_1Namespace</mainClass>
              <arguments>
                <argument>${project.build.directory}/vocabulary.txt</argument>
              </arguments>
              <!-- Note: this execution has the following dependencies: openrdf-sesame-2.2.1-onejar.jar
                mulgara-core-2.1.4.jar fedora-common.jar -->
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- ** This plugin needs to be removed when ANT is gone. The unit/integration
        test regex's should be defined at root/pom.xml ** -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>

        <configuration>
          <!--<forkMode>never</forkMode> -->

          <systemProperties>

            <property>
              <name>fedora.hostname</name>
              <value>${fedora.hostname}</value>
            </property>
            <property>
              <name>fedora.port</name>
              <value>${fedora.port}</value>
            </property>
            <property>
              <name>fedora.appServerContext</name>
              <value>${fedora.appServerContext}</value>
            </property>

          </systemProperties>
          <includes>
            <include>**/Test*</include>
            <include>**/*Test.class</include>
          </includes>
          <excludes>
            <exclude>${integrationTests}</exclude>
            <exclude>${nestedClassTests}</exclude>
          </excludes>
        </configuration>
        <executions>
          <execution>
            <id>int-test</id>
            <phase>integration-test</phase>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              <skip>${integration.test.skip}</skip>
              <systemProperties>

                <property>
                  <name>fedora.hostname</name>
                  <value>${fedora.hostname}</value>
                </property>
                <property>
                  <name>fedora.port</name>
                  <value>${fedora.port}</value>
                </property>
                <property>
                  <name>fedora.appServerContext</name>
                  <value>${fedora.appServerContext}</value>
                </property>

              </systemProperties>
              <excludes>
                <exclude>${instrumentedTests}</exclude>
                <exclude>${nestedClassTests}</exclude>
                <exclude>**/All*</exclude>
              </excludes>
              <includes>
                <include>${integrationTests}</include>
              </includes>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Some of the server test classes are needed by /integrationtest -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>

          <execution>
            <id>jar-tests</id>
            <phase>package</phase>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>

          <execution>
            <id>rmi-journal-recv-main</id>
            <phase>package</phase>
            <goals>
              <goal>jar</goal>
            </goals>

            <configuration>
              <classifier>rmi-journal-recv-main</classifier>

              <archive>
                <manifest>
                  <mainClass>org.fcrepo.server.journal.readerwriter.multicast.rmi.RmiJournalReceiver
                  </mainClass>
                </manifest>
              </archive>

              <includes>
                <include>org/fcrepo/server/journal/readerwriter/multicast/**</include>
                <include>org/fcrepo/server/journal/JournalException.class</include>
              </includes>
            </configuration>
          </execution>

        </executions>

      </plugin>

      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>

        <executions>
          <execution>
            <id>rmi-journal-recv-jar-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>

            <configuration>
              <descriptors>
                <descriptor>${basedir}/src/main/resources/assemblies/rmi-journal-recv-jar.xml
                </descriptor>
              </descriptors>

              <archive>
                <manifest>
                  <mainClass>com.simontuffs.onejar.Boot</mainClass>
                  <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                </manifest>
                <manifestEntries>
                  <Version>${project.version}</Version>
                  <Build>${timestamp}</Build>
                </manifestEntries>
              </archive>
            </configuration>
          </execution>

          <execution>
            <id>rmi-journal-recv-zip-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>

            <configuration>
              <descriptors>
                <descriptor>${basedir}/src/main/resources/assemblies/rmi-journal-recv-zip.xml
                </descriptor>
              </descriptors>
            </configuration>
          </execution>

        </executions>

      </plugin>

    </plugins>

  </build>

  <dependencies>
    <dependency>
      <groupId>asm</groupId>
      <artifactId>asm</artifactId>
      <version>3.1</version>
    </dependency>

    <dependency>
      <groupId>com.google.collections</groupId>
      <artifactId>google-collections</artifactId>
      <version>1.0</version>
    </dependency>

    <dependency>
      <groupId>com.sun.xml.stream</groupId>
      <artifactId>sjsxp</artifactId>
      <version>1.0.1</version>
      <exclusions>
        <exclusion>
          <groupId>javax.xml.stream</groupId>
          <artifactId>stax-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>commons-beanutils</groupId>
      <artifactId>commons-beanutils</artifactId>
    </dependency>

    <dependency>
      <groupId>commons-betwixt</groupId>
      <artifactId>commons-betwixt</artifactId>
    </dependency>

    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
    </dependency>

    <dependency>
      <groupId>commons-collections</groupId>
      <artifactId>commons-collections</artifactId>
    </dependency>

    <dependency>
      <groupId>commons-dbcp</groupId>
      <artifactId>commons-dbcp</artifactId>
      <version>1.2.2</version>
    </dependency>

    <dependency>
      <groupId>commons-discovery</groupId>
      <artifactId>commons-discovery</artifactId>
    </dependency>

    <dependency>
      <groupId>commons-httpclient</groupId>
      <artifactId>commons-httpclient</artifactId>
    </dependency>

    <dependency>
      <groupId>commons-fileupload</groupId>
      <artifactId>commons-fileupload</artifactId>
      <version>1.2.2</version>
    </dependency>

    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.3</version>
    </dependency>

    <dependency>
      <groupId>dom4j</groupId>
      <artifactId>dom4j</artifactId>
      <version>1.6.1</version>
    </dependency>

    <dependency>
      <groupId>fast-md5</groupId>
      <artifactId>fast-md5</artifactId>
      <version>2.5</version>
    </dependency>

    <dependency>
      <groupId>gnu.getopt</groupId>
      <artifactId>java-getopt</artifactId>
      <version>1.0.13</version>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>persistence-api</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.resource</groupId>
      <artifactId>connector-api</artifactId>
      <version>1.5</version>
    </dependency>

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
    </dependency>

    <dependency>
      <groupId>javax.ws.rs</groupId>
      <artifactId>jsr311-api</artifactId>
      <version>1.0</version>
    </dependency>

    <dependency>
      <groupId>javax.xml</groupId>
      <artifactId>jsr173</artifactId>
      <version>1.0</version>
    </dependency>

    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-impl</artifactId>
      <version>2.1.3</version>
    </dependency>

    <dependency>
      <groupId>javax.xml</groupId>
      <artifactId>jaxrpc-api</artifactId>
      <version>1.1</version>
    </dependency>

    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jaxb-api</artifactId>
      <exclusions>
        <exclusion>
          <groupId>javax.xml.stream</groupId>
          <artifactId>stax-api</artifactId>
        </exclusion>
        <exclusion>
          <groupId>javax.activation</groupId>
          <artifactId>activation</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>jaxen</groupId>
      <artifactId>jaxen</artifactId>
      <version>1.1.3</version>
      <exclusions>
        <exclusion>
          <groupId>xom</groupId>
          <artifactId>xom</artifactId>
        </exclusion>
        <exclusion>
          <artifactId>maven-cobertura-plugin</artifactId>
          <groupId>maven-plugins</groupId>
        </exclusion>
        <exclusion>
          <artifactId>maven-findbugs-plugin</artifactId>
          <groupId>maven-plugins</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>jdom</groupId>
      <artifactId>jdom</artifactId>
      <version>1.0</version>
    </dependency>

    <dependency>
      <groupId>org.apache.abdera</groupId>
      <artifactId>abdera-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.abdera</groupId>
      <artifactId>abdera-extensions-main</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.abdera</groupId>
      <artifactId>abdera-i18n</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.abdera</groupId>
      <artifactId>abdera-parser</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-core</artifactId>
      <exclusions>
        <exclusion>
          <artifactId>fusemq-leveldb</artifactId>
          <groupId>org.fusesource.fuse-extra</groupId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.activemq</groupId>
      <artifactId>activemq-pool</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxws</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-frontend-jaxrs</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.cxf</groupId>
      <artifactId>cxf-rt-transports-http</artifactId>
    </dependency>

    <!-- xstream is an optional activemq dependency, required for Stomp -->
    <dependency>
      <groupId>com.thoughtworks.xstream</groupId>
      <artifactId>xstream</artifactId>
      <version>1.4.2</version>
    </dependency>

    <dependency>
      <groupId>org.apache.xbean</groupId>
      <artifactId>xbean-spring</artifactId>
      <version>3.11.1</version>
      <exclusions>
        <exclusion>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.ws.commons.axiom</groupId>
      <artifactId>axiom-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.ws.commons.axiom</groupId>
      <artifactId>axiom-impl</artifactId>
    </dependency>

    <dependency>
      <groupId>org.codehaus.jackson</groupId>
      <artifactId>jackson-mapper-asl</artifactId>
    </dependency>

    <dependency>
      <groupId>org.codehaus.jettison</groupId>
      <artifactId>jettison</artifactId>
      <version>1.3.1</version>
    </dependency>

    <dependency>
      <groupId>org.akubraproject</groupId>
      <artifactId>akubra-core</artifactId>
      <version>${akubra.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.akubraproject</groupId>
      <artifactId>akubra-fs</artifactId>
      <version>${akubra.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.akubraproject</groupId>
      <artifactId>akubra-map</artifactId>
      <version>${akubra.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.akubraproject</groupId>
      <artifactId>akubra-mem</artifactId>
      <version>${akubra.version}</version>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>GroboTestingJUnit-core</artifactId>
      <version>1.2.1</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-web</artifactId>
    </dependency>
    <dependency>
      <groupId>com.sun.xml.ws</groupId>
      <artifactId>jaxws-rt</artifactId>
      <version>2.1.4</version>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>mptstore</artifactId>
    </dependency>

    <!-- This is needed only to trigger the rmi-journal-rcv.jar assembly. -->
    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>one-jar-boot</artifactId>
      <version>0.96</version>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>saxon</artifactId>
      <version>9.0</version>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>saxon-dom</artifactId>
      <version>9.0</version>
    </dependency>

    <dependency>
      <groupId>org.trippi</groupId>
      <artifactId>trippi-core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.trippi</groupId>
      <artifactId>trippi-mptstore</artifactId>
    </dependency>

    <dependency>
      <groupId>org.trippi</groupId>
      <artifactId>trippi-mulgara</artifactId>
    </dependency>

    <!--Fix of the FCREPO-819 Bug -->
    <dependency>
      <groupId>jotm</groupId>
      <artifactId>jotm_iiop_stubs</artifactId>
      <version>2.0.10</version>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>fcrepo-common</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>fcrepo-common</artifactId>
      <classifier>tests</classifier>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>net.java.dev.stax-utils</groupId>
      <artifactId>stax-utils</artifactId>
      <version>20060502</version>
      <exclusions>
        <exclusion>
          <groupId>com.bea.xml</groupId>
          <artifactId>jsr173-ri</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>sunxacml</artifactId>
      <classifier>melcoe</classifier>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>openrdf-sesame-onejar</artifactId>
    </dependency>

    <dependency>
      <groupId>org.fcrepo</groupId>
      <artifactId>Tidy</artifactId>
      <version>1.0</version>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>log4j-over-slf4j</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jcl-over-slf4j</artifactId>
    </dependency>

    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
    </dependency>

    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
    </dependency>

    <dependency>
      <groupId>xerces</groupId>
      <artifactId>xercesImpl</artifactId>
    </dependency>

    <dependency>
      <groupId>xml-apis</groupId>
      <artifactId>xml-apis</artifactId>
      <version>1.3.04</version>
    </dependency>

    <dependency>
      <groupId>xmlunit</groupId>
      <artifactId>xmlunit</artifactId>
    </dependency>

    <dependency>
      <groupId>owlapi</groupId>
      <artifactId>owlapi</artifactId>
      <version>3.0.0-patched</version>
    </dependency>

    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
    </dependency>
  </dependencies>
</project>


text:
package pq

import (
	"database/sql"
	"testing"
	"time"

	"github.com/skygeario/skygear-server/pkg/server/skydb"
	. "github.com/smartystreets/goconvey/convey"
)

func TestAuthCRUD(t *testing.T) {
	var c *conn

	Convey("Conn", t, func() {
		c = getTestConn(t)
		defer cleanupConn(t, c)

		authinfo := skydb.AuthInfo{
			ID:             "userid",
			HashedPassword: []byte("$2a$10$RbmNb3Rw.PONA2QTcpjBg.1E00zdSI6dWTUwZi.XC0wZm9OhOEvKO"),
			Roles:          []string{},
			ProviderInfo: skydb.ProviderInfo{
				"com.example:johndoe": map[string]interface{}{
					"string": "string",
					"bool":   true,
					"number": float64(1),
				},
			},
		}

		Convey("default admin role", func() {
			var exists bool
			c.QueryRowx(`
				SELECT EXISTS (
					SELECT 1
					FROM _role
					WHERE is_admin = TRUE
				)`).Scan(&exists)
			So(exists, ShouldBeTrue)
		})

		Convey("creates user", func() {
			err := c.CreateAuth(&authinfo)
			So(err, ShouldBeNil)

			password := []byte{}
			providerInfo := providerInfoValue{}
			err = c.QueryRowx("SELECT password, provider_info FROM _auth WHERE id = 'userid'").
				Scan(&password, &providerInfo)
			So(err, ShouldBeNil)
			So(password, ShouldResemble, []byte("$2a$10$RbmNb3Rw.PONA2QTcpjBg.1E00zdSI6dWTUwZi.XC0wZm9OhOEvKO"))
			So(providerInfo.ProviderInfo, ShouldResemble, skydb.ProviderInfo{
				"com.example:johndoe": map[string]interface{}{
					"string": "string",
					"bool":   true,
					"number": float64(1),
				},
			})
		})

		Convey("returns ErrUserDuplicated when user to create already exists", func() {
			So(c.CreateAuth(&authinfo), ShouldBeNil)
			So(c.CreateAuth(&authinfo), ShouldEqual, skydb.ErrUserDuplicated)
		})

		Convey("gets an existing User", func() {
			err := c.CreateAuth(&authinfo)
			So(err, ShouldBeNil)

			fetchedauthinfo := skydb.AuthInfo{}
			err = c.GetAuth("userid", &fetchedauthinfo)
			So(err, ShouldBeNil)

			So(fetchedauthinfo, ShouldResemble, authinfo)
		})

		Convey("gets an existing User token valid since", func() {
			tokenValidSince := time.Date(2006, 1, 2, 15, 4, 5, 0, time.UTC)
			authinfo.TokenValidSince = &tokenValidSince

			err := c.CreateAuth(&authinfo)
			So(err, ShouldBeNil)

			fetchedauthinfo := skydb.AuthInfo{}
			err = c.GetAuth("userid", &fetchedauthinfo)
			So(err, ShouldBeNil)

			So(tokenValidSince.Equal(fetchedauthinfo.TokenValidSince.UTC()), ShouldBeTrue)
		})

		Convey("gets an existing User last seen at", func() {
			lastSeenAt := time.Date(2006, 1, 2, 15, 4, 5, 0, time.UTC)
			authinfo.LastSeenAt = &lastSeenAt

			err := c.CreateAuth(&authinfo)
			So(err, ShouldBeNil)

			fetchedauthinfo := skydb.AuthInfo{}
			err = c.GetAuth("userid", &fetchedauthinfo)
			So(err, ShouldBeNil)

			So(
				lastSeenAt.Equal(fetchedauthinfo.LastSeenAt.UTC()),
				ShouldBeTrue,
			)
		})

		Convey("gets an existing User by principal", func() {
			err := c.CreateAuth(&authinfo)
			So(err, ShouldBeNil)

			fetchedauthinfo := skydb.AuthInfo{}
			err = c.GetAuthByPrincipalID("com.example:johndoe", &fetchedauthinfo)
			So(err, ShouldBeNil)

			So(fetchedauthinfo, ShouldResemble, authinfo)
		})

		Convey("returns ErrUserNotFound when the user does not exist", func() {
			err := c.GetAuth("userid", (*skydb.AuthInfo)(nil))
			So(err, ShouldEqual, skydb.ErrUserNotFound)
		})

		Convey("returns ErrUserNotFound when the user does not exist by principal", func() {
			err := c.GetAuthByPrincipalID("com.example:janedoe", (*skydb.AuthInfo)(nil))
			So(err, ShouldEqual, skydb.ErrUserNotFound)
		})

		Convey("updates a user", func() {
			err := c.CreateAuth(&authinfo)
			So(err, ShouldBeNil)

			authinfo.HashedPassword = []byte("newsecret")

			err = c.UpdateAuth(&authinfo)
			So(err, ShouldBeNil)

			hashedPassword := []byte("")
			err = c.QueryRowx("SELECT password FROM _auth WHERE id = 'userid'").
				Scan(&hashedPassword)
			So(err, ShouldBeNil)
			So(hashedPassword, ShouldResemble, []byte("newsecret"))
		})

		Convey("returns ErrUserNotFound when the user to update does not exist", func() {
			err := c.UpdateAuth(&authinfo)
			So(err, ShouldEqual, skydb.ErrUserNotFound)
		})

		Convey("deletes an existing user", func() {
			So(c.CreateAuth(&authinfo), ShouldBeNil)
			So(c.DeleteAuth("userid"), ShouldBeNil)

			placeholder := []byte{}
			err := c.QueryRowx("SELECT false FROM _auth WHERE id = $1", "userid").Scan(&placeholder)
			So(err, ShouldEqual, sql.ErrNoRows)
			So(placeholder, ShouldBeEmpty)

			err = c.QueryRowx(`SELECT false FROM "user" WHERE _id = $1`, "userid").Scan(&placeholder)
			So(err, ShouldEqual, sql.ErrNoRows)
			So(placeholder, ShouldBeEmpty)
		})

		Convey("returns ErrUserNotFound when the user to delete does not exist", func() {
			So(c.DeleteAuth("notexistid"), ShouldEqual, skydb.ErrUserNotFound)
		})

		Convey("deletes only the desired user", func() {
			authinfo.ID = "1"
			So(c.CreateAuth(&authinfo), ShouldBeNil)

			authinfo.ID = "2"
			So(c.CreateAuth(&authinfo), ShouldBeNil)

			count := 0
			c.QueryRowx("SELECT COUNT(*) FROM _auth").Scan(&count)
			So(count, ShouldEqual, 2) // including default admin user

			err := c.DeleteAuth("2")
			So(err, ShouldBeNil)

			c.QueryRowx("SELECT COUNT(*) FROM _auth").Scan(&count)
			So(count, ShouldEqual, 1) // including default admin user
		})
	})
}

func TestAuthEagerLoadRole(t *testing.T) {
	var c *conn

	Convey("User eager load roles", t, func() {
		c = getTestConn(t)
		defer cleanupConn(t, c)

		authinfo := skydb.AuthInfo{
			ID:             "userid",
			Roles:          []string{"user"},
			HashedPassword: []byte(""),
		}
		c.CreateAuth(&authinfo)

		Convey("with GetUser", func() {
			fetchedAuthinfo := skydb.AuthInfo{}
			So(c.GetAuth("userid", &fetchedAuthinfo), ShouldBeNil)
			So(fetchedAuthinfo, ShouldResemble, authinfo)
		})
	})
}

func TestAuthRecordKeys(t *testing.T) {
	Convey("EnsureUserAuthRecordKeys", t, func() {
		c := getTestConn(t)
		defer cleanupConn(t, c)

		Convey("canMigrate is true", func() {
			c.canMigrate = true

			Convey("no error for default user record", func() {
				err := c.EnsureAuthRecordKeysExist([][]string{[]string{"username"}, []string{"email"}})
				So(err, ShouldBeNil)
			})

			Convey("no error for non existing column, new column created", func() {
				err := c.EnsureAuthRecordKeysExist([][]string{[]string{"iamyourfather"}})
				So(err, ShouldBeNil)

				var exists bool
				c.QueryRowx(`
				SELECT EXISTS (
					SELECT 1
					FROM information_schema.columns
					WHERE table_name = 'user' AND column_name = 'iamyourfather'
				)`).Scan(&exists)
				So(exists, ShouldBeTrue)
			})

			Convey("no error for existing column with non string type", func() {
				_, err := c.PublicDB().Extend("user", skydb.RecordSchema{
					"iamyourfather": skydb.FieldType{Type: skydb.TypeJSON},
				})
				So(err, ShouldBeNil)

				err = c.EnsureAuthRecordKeysExist([][]string{[]string{"iamyourfather"}})
				So(err, ShouldBeNil)
			})

			Convey("create unique constraints for existing non unique fields", func() {
				_, err := c.PublicDB().Extend("user", skydb.RecordSchema{
					"iamyourfather": skydb.FieldType{Type: skydb.TypeString},
					"iamyourmother": skydb.FieldType{Type: skydb.TypeString},
				})
				So(err, ShouldBeNil)

				err = c.EnsureAuthRecordKeysIndexesMatch([][]string{[]string{"iamyourfather", "iamyourmother"}})
				So(err, ShouldBeNil)

				So(c.PublicDB().Save(&skydb.Record{
					ID:        skydb.NewRecordID("user", "johndoe"),
					OwnerID:   "johndoe",
					CreatedAt: time.Date(2006, 1, 2, 15, 4, 5, 0, time.UTC),
					CreatorID: "johndoe",
					UpdatedAt: time.Date(2006, 1, 2, 15, 4, 5, 0, time.UTC),
					UpdaterID: "johndoe",
					Data: map[string]interface{}{
						"iamyourfather": "father",
						"iamyourmother": "mother",
					},
				}), ShouldBeNil)

				So(c.PublicDB().Save(&skydb.Record{
					ID:        skydb.NewRecordID("user", "john.doe"),
					OwnerID:   "john.doe",
					CreatedAt: time.Date(2006, 1, 2, 15, 4, 5, 0, time.UTC),
					CreatorID: "john.doe",
					UpdatedAt: time.Date(2006, 1, 2, 15, 4, 5, 0, time.UTC),
					UpdaterID: "john.doe",
					Data: map[string]interface{}{
						"iamyourfather": "father",
						"iamyourmother": "Mother",
					},
				}), ShouldBeNil)

				So(c.PublicDB().Save(&skydb.Record{
					ID:        skydb.NewRecordID("user", "john.do.e"),
					OwnerID:   "john.do.e",
					CreatedAt: time.Date(2006, 1, 2, 15, 4, 5, 0, time.UTC),
					CreatorID: "john.do.e",
					UpdatedAt: time.Date(2006, 1, 2, 15, 4, 5, 0, time.UTC),
					UpdaterID: "john.do.e",
					Data: map[string]interface{}{
						"iamyourfather": "father",
						"iamyourmother": "Mother",
					},
				}), ShouldNotBeNil)
			})

			Convey("remove managed unique constraints for fields no longer auth record keys", func() {
				_, err := c.PublicDB().Extend("user", skydb.RecordSchema{
					"iamyourfather": skydb.FieldType{Type: skydb.TypeString},
					"iamyourmother": skydb.FieldType{Type: skydb.TypeString},
				})
				So(err, ShouldBeNil)

				db := c.PublicDB().(*database)
				err = c.EnsureAuthRecordKeysIndexesMatch([][]string{[]string{"iamyourfather"}, []string{"iamyourmother"}})
				So(err, ShouldBeNil)
				indexes, err := db.GetIndexesByRecordType("user")
				So(err, ShouldBeNil)
				So(indexes, ShouldContainKey, "auth_record_keys_user_iamyourfather_key")
				So(indexes, ShouldContainKey, "auth_record_keys_user_iamyourmother_key")

				err = c.EnsureAuthRecordKeysIndexesMatch([][]string{[]string{"iamyourfather"}})
				So(err, ShouldBeNil)
				indexes, err = db.GetIndexesByRecordType("user")
				So(err, ShouldBeNil)
				So(indexes, ShouldContainKey, "auth_record_keys_user_iamyourfather_key")
				So(indexes, ShouldNotContainKey, "auth_record_keys_user_iamyourmother_key")
			})
		})

		Convey("canMigrate is false", func() {
			c.canMigrate = false

			Convey("no error for default user record", func() {
				err := c.EnsureAuthRecordKeysExist([][]string{[]string{"username"}, []string{"email"}})
				So(err, ShouldBeNil)
			})

			Convey("error for non existing column", func() {
				err := c.EnsureAuthRecordKeysExist([][]string{[]string{"iamyourfather"}})
				So(err, ShouldNotBeNil)
			})

			Convey("no error for existing column with non string type", func() {
				c.canMigrate = true
				_, err := c.PublicDB().Extend("user", skydb.RecordSchema{
					"iamyourfather": skydb.FieldType{Type: skydb.TypeJSON},
				})
				So(err, ShouldBeNil)
				c.canMigrate = false

				err = c.EnsureAuthRecordKeysExist([][]string{[]string{"iamyourfather"}})
				So(err, ShouldBeNil)
			})

			Convey("error for existing column without unique constraint", func() {
				c.canMigrate = true
				_, err := c.PublicDB().Extend("user", skydb.RecordSchema{
					"iamyourfather": skydb.FieldType{Type: skydb.TypeString},
				})
				So(err, ShouldBeNil)
				c.canMigrate = false

				err = c.EnsureAuthRecordKeysIndexesMatch([][]string{[]string{"iamyourfather"}})
				So(err, ShouldNotBeNil)
			})
		})
	})
}


text:
<?php

use DTS\eBaySDK\Types\StringType;

class StringTypeTest extends \PHPUnit_Framework_TestCase
{
    protected function setUp()
    {
        $this->obj = new StringType();
    }

    public function testCanBeCreated()
    {
        $this->assertInstanceOf('\DTS\eBaySDK\Types\StringType', $this->obj);
    }

    public function testExtendsBaseType()
    {
        $this->assertInstanceOf('\DTS\eBaySDK\Types\BaseType', $this->obj);
    }

    public function testHasValueProperty()
    {
        $this->obj->value = 'foo';
        $this->assertEquals('foo', $this->obj->value);
        $this->assertInternalType('string', $this->obj->value);
    }
}