text:
using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Drawing.Drawing2D;
using System.Windows.Forms;

namespace Allison.AlertWindow
{
    [DefaultEvent("Click")]
    public class AlertWindow : System.ComponentModel.Component
    {

        #region フィールド

        private LinkLabel _DummyLinkLable;

        /// <summary>
        /// AlertWindow本体
        /// </summary>
        private AlertWindowForm awf;

        /// <summary>
        /// AlertWindowを閉じたかどうか
        /// </summary>
        private bool isClosed;

        #endregion

        #region コンストラクタ

        public AlertWindow()
        {
            this.Animation = AnimationMode.Slide;
            this.Time = 4000;
            this.Margin = new Padding(10);
            this.MinimumSize = new Size(180, 140);

            this.BackColor = Color.White;
            this.BackColor2 = Color.FromArgb(229, 231, 240);
            this.GradientMode = LinearGradientMode.Vertical;
            this.BackgroundImage = null;
            this.BackgroundImageLayout = ImageLayout.None;
            this.Cursor = Cursors.Default;

            this.Icon = AlertIcons.None;
            this.IconSize = new Size(32, 32);
            this.CustomIcon = null;

            this.Title = string.Empty;
            this.TitleFont = new Font("MS UI Gothic", 9, FontStyle.Bold);
            this.TitleForeColor = Color.Black;

            this.Message = string.Empty;
            this.MessageFont = new Font("MS UI Gothic", 9, FontStyle.Regular);
            this.MessageForeColor = Color.Black;
            this._DummyLinkLable = new LinkLabel();
            this._MessageLinks = new LinkLabel.LinkCollection(this._DummyLinkLable);
            this._MessageLinks.Clear();
            this.MessageActiveLinkColor = Color.Red;
            this.MessageLinkColor = Color.Blue;
        }

        #endregion

        #region プロパティ

        /// <summary>
        /// アラートウィンドウの表示アニメーションを取得または設定します。
        /// </summary>
        [Category("動作")]
        [DefaultValue(typeof(AnimationMode), "Slide")]
        [Description("アラートウィンドウの表示アニメーションを取得または設定します。")]
        public AnimationMode Animation { get; set; }

        /// <summary>
        /// アラートウィンドウの表示時間 (ミリ秒単位) を取得または設定します。
        /// </summary>
        [Category("動作")]
        [DefaultValue(4000)]
        [Description("アラートウィンドウの表示時間 (ミリ秒単位) を取得または設定します。")]
        public int Time { get; set; }

        /// <summary>
        /// 閉じるボタンを表示するかどうかを示す値を取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(false)]
        [Description("閉じるボタンを表示するかどうかを示す値を取得または設定します。")]
        public bool ShowCloseButton { get; set; }

        /// <summary>
        /// アラートウィンドウと作業領域との余白間のスペースを指定します。
        /// </summary>
        [Category("配置")]
        [DefaultValue(typeof(Padding), "10,10,10,10")]
        [Description("アラートウィンドウと作業領域との余白間のスペースを指定します。")]
        public Padding Margin { get; set; }

        /// <summary>
        /// アラートウィンドウの最小サイズを取得または設定します。
        /// </summary>
        [Category("配置")]
        [DefaultValue(typeof(Size), "180,140")]
        [Description("アラートウィンドウの最小サイズを取得または設定します。")]
        public Size MinimumSize { get; set; }

        /// <summary>
        /// アラートウィンドウに表示される背景色を取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(Color), "White")]
        [Description("アラートウィンドウに表示される背景色を取得または設定します。")]
        public Color BackColor { get; set; }

        /// <summary>
        /// アラートウィンドウに表示される背景のグラデーションの終了色を取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(Color), "229, 231, 240")]
        [Description("アラートウィンドウに表示される背景のグラデーションの終了色を取得または設定します。")]
        public Color BackColor2 { get; set; }

        /// <summary>
        /// アラートウィンドウの背景色のグラデーションの方向です。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(LinearGradientMode), "Vertical")]
        [Description("アラートウィンドウの背景色のグラデーションの方向です。")]
        public LinearGradientMode GradientMode { get; set; }

        /// <summary>
        /// アラートウィンドウに表示される背景イメージを取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(Image), "")]
        [Description("アラートウィンドウに表示される背景イメージを取得または設定します。")]
        public Image BackgroundImage { get; set; }

        /// <summary>
        /// アラートウィンドウに表示される背景イメージ レイアウトを取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(ImageLayout), "None")]
        [Description("アラートウィンドウに表示される背景イメージ レイアウトを取得または設定します。")]
        public ImageLayout BackgroundImageLayout { get; set; }

        /// <summary>
        /// マウスカーソルがアラートウィンドウの上にあるときに表示されるカーソルを取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(Cursor), "Default")]
        [Description("マウスカーソルがアラートウィンドウの上にあるときに表示されるカーソルを取得または設定します。")]
        public Cursor Cursor { get; set; }

        /// <summary>
        /// アラートウィンドウに表示されるアイコンを取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(AlertIcons), "None")]
        [Description("アラートウィンドウに表示されるアイコンを取得または設定します。")]
        public AlertIcons Icon { get; set; }

        /// <summary>
        /// アラートウィンドウに表示されるアイコンのサイズを取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(Size), "32, 32")]
        [Description("アラートウィンドウに表示されるアイコンのサイズを取得または設定します。")]
        public Size IconSize { get; set; }

        /// <summary>
        /// アラートウィンドウに表示される独自のアイコンを取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(Image), "")]
        [Description("アラートウィンドウに表示される独自のアイコンを取得または設定します。")]
        public Image CustomIcon { get; set; }

        /// <summary>
        /// アラートウィンドウのタイトルバーに表示されるテキストを取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue("")]
        [Description("アラートウィンドウのタイトルバーに表示されるテキストを取得または設定します。")]
        [Editor("System.ComponentModel.Design.MultilineStringEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
        public string Title { get; set; }

        /// <summary>
        /// アラートウィンドウのタイトルバーに表示されるテキストのフォントを取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(Font), "MS UI Gothic,9pt,style=Bold")]
        [Description("アラートウィンドウのタイトルバーに表示されるテキストのフォントを取得または設定します。")]
        public Font TitleFont { get; set; }

        /// <summary>
        /// アラートウィンドウのタイトルバーに表示されるテキストの前景色または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(Color), "Black")]
        [Description("アラートウィンドウのタイトルバーに表示されるテキストの前景色または設定します。")]
        public Color TitleForeColor { get; set; }

        /// <summary>
        /// アラートウィンドウに表示されるテキストを取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue("")]
        [Description("アラートウィンドウに表示されるテキストを取得または設定します。")]
        [Editor("System.ComponentModel.Design.MultilineStringEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
        public string Message { get; set; }

        /// <summary>
        /// アラートウィンドウに表示されるテキストのフォントを取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(Font), "MS UI Gothic,9pt,style=Regular")]
        [Description("アラートウィンドウに表示されるテキストのフォントを取得または設定します。")]
        public Font MessageFont { get; set; }

        /// <summary>
        /// アラートウィンドウに表示されるテキストの前景色を取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(Color), "Black")]
        [Description("アラートウィンドウに表示されるテキストの前景色を取得または設定します。")]
        public Color MessageForeColor { get; set; }

        private LinkArea _MessageLinkArea;
        /// <summary>
        /// メッセージ内でリンクとして処理される領域を取得または設定します。
        /// </summary>
        [Category("動作")]
        [DefaultValue(typeof(LinkArea), "0,0")]
        [Description("メッセージ内でリンクとして処理される領域を取得または設定します。")]
        public LinkArea MessageLinkArea
        {
            get { return this._MessageLinkArea; }
            set
            {
                this._MessageLinkArea = value;

                this._MessageLinks.Clear();
                this._MessageLinks.Add(value.Start, value.Length);
            }
        }

        private LinkLabel.LinkCollection _MessageLinks;
        /// <summary>
        /// メッセージ内でリンクとして処理される領域を取得または設定します。
        /// </summary>
        [Browsable(false)]
        [Category("動作")]
        [DefaultValue(typeof(LinkLabel.LinkCollection), "")]
        [Description("メッセージ内でリンクとして処理される領域を取得または設定します。")]
        public LinkLabel.LinkCollection MessageLiks
        {
            get { return this._MessageLinks; }
        }

        /// <summary>
        /// 通常のリンクを表示するために使用する色を取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(Color), "Blue")]
        [Description("通常のリンクを表示するために使用する色を取得または設定します。")]
        public Color MessageLinkColor { get; set; }

        /// <summary>
        /// アクティブなリンクを表示するために使用する色を取得または設定します。
        /// </summary>
        [Category("表示")]
        [DefaultValue(typeof(Color), "Red")]
        [Description("アクティブなリンクを表示するために使用する色を取得または設定します。")]
        public Color MessageActiveLinkColor { get; set; }

        #endregion

        #region イベント

        /// <summary>
        /// アラートウィンドウ内のハイパーリンクがクリックされたときに発生します。
        /// </summary>
        public event LinkLabelLinkClickedEventHandler LinkClicked;
        private void lblLinkMessage_LinkClicked(System.Object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            if (LinkClicked != null)
            {
                LinkClicked(this, e);
            }
            Console.WriteLine(e.Link.Name);
        }

        /// <summary>
        /// アラートウィンドウがクリックされたときに発生します。
        /// </summary>
        public event EventHandler Click;
        private void AlertWindow_Click(System.Object sender, System.EventArgs e)
        {
            if (Click != null)
            {
                Click(this, e);
            }
        }

        #endregion

        #region Public メソッド

        /// <summary>
        /// アラートウィンドウを表示する
        /// </summary>
        public void Show()
        {
            this.Show(this.Message, this.Title, this.Icon);
        }

        /// <summary>
        /// アラートウィンドウを表示する
        /// </summary>
        /// <param name="message">アラートウィンドウに表示するテキスト</param>
        public void Show(string message)
        {
            this.Show(message, this.Title, this.Icon);
        }

        /// <summary>
        /// アラートウィンドウを表示する
        /// </summary>
        /// <param name="message">アラートウィンドウに表示するテキスト</param>
        /// <param name="title">アラートウィンドウのタイトルバーに表示するテキスト</param>
        public void Show(string message, string title)
        {
            this.Show(message, title, this.Icon);
        }

        /// <summary>
        /// アラートウィンドウを表示する
        /// </summary>
        /// <param name="message">アラートウィンドウに表示するテキスト</param>
        /// <param name="title">アラートウィンドウのタイトルバーに表示するテキスト</param>
        /// <param name="icon">アラートウィンドウに表示するアイコン</param>
        public void Show(string message, string title, AlertIcons icon)
        {
            awf = new AlertWindowForm();
            isClosed = false;

            // アニメーション
            awf.Animation = this.Animation;
            awf.Time = this.Time;

            // 余白
            awf.MinimumSize = this.MinimumSize;
            awf.Margin = this.Margin;

            // 外観
            awf.ShowCloseButton = this.ShowCloseButton;
            awf.BackColor = this.BackColor;
            awf.BackColor2 = this.BackColor2;
            awf.GradientMode = this.GradientMode;
            awf.AlertWindowBackgroundImage = this.BackgroundImage;
            awf.AlertWindowBackgroundImageLayout = this.BackgroundImageLayout;
            awf.AlertCursor = this.Cursor;
            this.AddHandlerClick(awf);
            awf.btnClose.Click -= AlertWindow_Click;

            // アイコン設定
            switch (icon)
            {
                case AlertIcons.None:
                    break;
                case AlertIcons.Information:
                    awf.AlertIcon = SystemIcons.Information.ToBitmap();
                    break;
                case AlertIcons.Question:
                    awf.AlertIcon = SystemIcons.Question.ToBitmap();
                    break;
                case AlertIcons.Warning:
                    awf.AlertIcon = SystemIcons.Warning.ToBitmap();
                    break;
                case AlertIcons.Error:
                    awf.AlertIcon = SystemIcons.Error.ToBitmap();
                    break;
                case AlertIcons.Custom:
                    awf.AlertIcon = this.CustomIcon;
                    break;
            }
            // アイコンサイズを調整
            if (awf.AlertIcon != null)
            {
                Bitmap b = new Bitmap(this.IconSize.Width, this.IconSize.Height);
                using (Graphics g = Graphics.FromImage(b))
                {
                    g.DrawImage(awf.AlertIcon, 0, 0, this.IconSize.Width, this.IconSize.Height);
                }
                awf.AlertIcon = b;
            }

            // タイトル設定
            awf.Title = title;
            awf.TitleFont = this.TitleFont;
            awf.TitleForeColor = this.TitleForeColor;

            // メッセージ設定
            awf.Message = message;
            awf.MessageFont = this.MessageFont;
            awf.MessageForeColor = this.MessageForeColor;
            // リンク設定
            foreach (LinkLabel.Link l in this.MessageLiks)
            {
                awf.MessageLiks.Add(l);
            }
            awf.lblLinkMessage.LinkClicked += lblLinkMessage_LinkClicked;

            // アラートウィンドウを表示
            awf.Show();
        }

        /// <summary>
        /// アラートウィンドウを閉る
        /// </summary>
        public void Close()
        {
            if (awf != null && !isClosed && !awf.IsDisposed)
            {
                awf.CloseWindow();
                isClosed = true;
            }
        }

        /// <summary>
        /// アラートウィンドウを表示しているかどうかを表す
        /// </summary>
        /// <returns>true:表示、false:非表示</returns>
        public bool isShow()
        {
            if (awf != null)
            {
                return awf.isShow();
            }
            else
            {
                return false;
            }
        }

        #endregion

        #region Protected メソッド

        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing)
                {
                    this._DummyLinkLable.Dispose();
                    if (this.BackgroundImage != null)
                    {
                        this.BackgroundImage.Dispose();
                    }
                    if (this.CustomIcon != null)
                    {
                        this.CustomIcon.Dispose();
                    }
                    if (this.TitleFont != null)
                    {
                        this.TitleFont.Dispose();
                    }
                    if (this.MessageFont != null)
                    {
                        this.MessageFont.Dispose();
                    }
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }

        #endregion

        #region Private メソッド

        /// <summary>
        /// 指定されたコントロール配下の全てのクリックイベントを関連付けます。
        /// </summary>
        /// <param name="container">親コントロール</param>
        private void AddHandlerClick(Control container)
        {
            container.Click += AlertWindow_Click;

            if (container.HasChildren)
            {
                foreach (Control c in container.Controls)
                {
                    this.AddHandlerClick(c);
                }
            }
        }

        #endregion
    }
}


text:
using System;
using MongoDB.Driver;
using MongoDB.Driver.Builders;
using MongoDB.Driver.Linq;
using MongoDB;

namespace GA.Data.Clients
{
	public interface IMongoClient
	{
		MongoDatabase GetDatabase(string name);
	}
}

redpajama_set_name: RedPajamaGithub


text:
let set = new Set([NaN]);
console.log(set.size);
console.log(set.has(NaN));


text:
using System;

namespace FluentMigrator.Builders.Delete.Index
{
	public interface IDeleteIndexOnColumnSyntax
	{
		void OnColumn(string columnName);
		void OnColumns(params string[] columnNames);
	}
}


text:
//  Copyright (c) 2015 ServiceStack LLC. All rights reserved.
//  License: https://servicestack.net/bsd-license.txt

package net.servicestack.client;

/**
 * Created by mythz on 3/24/2015.
 */
public enum LogType {
    DEBUG,
    WARN,
    INFO,
    ERROR
}


text:
#ifndef CORE_VALIDATION_TYPES_H_
#define CORE_VALIDATION_TYPES_H_

// Check for noexcept support
#if defined(__clang__)
#if __has_feature(cxx_noexcept)
#define HAS_NOEXCEPT
#endif
#else
#if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46
#define HAS_NOEXCEPT
#else
#if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026 && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS
#define HAS_NOEXCEPT
#endif
#endif
#endif

#ifdef HAS_NOEXCEPT
#define NOEXCEPT noexcept
#else
#define NOEXCEPT
#endif

#include "vulkan/vulkan.h"
#include <atomic>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <functional>

// Fwd declarations
namespace cvdescriptorset {
class DescriptorSetLayout;
class DescriptorSet;
};

struct GLOBAL_CB_NODE;

class BASE_NODE {
  public:
    // Track when object is being used by an in-flight command buffer
    std::atomic_int in_use;
    // Track command buffers that this object is bound to
    //  binding initialized when cmd referencing object is bound to command buffer
    //  binding removed when command buffer is reset or destroyed
    // When an object is destroyed, any bound cbs are set to INVALID
    std::unordered_set<GLOBAL_CB_NODE *> cb_bindings;
};

// Generic wrapper for vulkan objects
struct VK_OBJECT {
    uint64_t handle;
    VkDebugReportObjectTypeEXT type;
};

inline bool operator==(VK_OBJECT a, VK_OBJECT b) NOEXCEPT { return a.handle == b.handle && a.type == b.type; }

namespace std {
template <> struct hash<VK_OBJECT> {
    size_t operator()(VK_OBJECT obj) const NOEXCEPT { return hash<uint64_t>()(obj.handle) ^ hash<uint32_t>()(obj.type); }
};
}

// Flags describing requirements imposed by the pipeline on a descriptor. These
// can't be checked at pipeline creation time as they depend on the Image or
// ImageView bound.
enum descriptor_req {
    DESCRIPTOR_REQ_VIEW_TYPE_1D = 1 << VK_IMAGE_VIEW_TYPE_1D,
    DESCRIPTOR_REQ_VIEW_TYPE_1D_ARRAY = 1 << VK_IMAGE_VIEW_TYPE_1D_ARRAY,
    DESCRIPTOR_REQ_VIEW_TYPE_2D = 1 << VK_IMAGE_VIEW_TYPE_2D,
    DESCRIPTOR_REQ_VIEW_TYPE_2D_ARRAY = 1 << VK_IMAGE_VIEW_TYPE_2D_ARRAY,
    DESCRIPTOR_REQ_VIEW_TYPE_3D = 1 << VK_IMAGE_VIEW_TYPE_3D,
    DESCRIPTOR_REQ_VIEW_TYPE_CUBE = 1 << VK_IMAGE_VIEW_TYPE_CUBE,
    DESCRIPTOR_REQ_VIEW_TYPE_CUBE_ARRAY = 1 << VK_IMAGE_VIEW_TYPE_CUBE_ARRAY,

    DESCRIPTOR_REQ_SINGLE_SAMPLE = 2 << VK_IMAGE_VIEW_TYPE_END_RANGE,
    DESCRIPTOR_REQ_MULTI_SAMPLE = DESCRIPTOR_REQ_SINGLE_SAMPLE << 1,
};

struct DESCRIPTOR_POOL_NODE {
    VkDescriptorPool pool;
    uint32_t maxSets;       // Max descriptor sets allowed in this pool
    uint32_t availableSets; // Available descriptor sets in this pool

    VkDescriptorPoolCreateInfo createInfo;
    std::unordered_set<cvdescriptorset::DescriptorSet *> sets; // Collection of all sets in this pool
    std::vector<uint32_t> maxDescriptorTypeCount;              // Max # of descriptors of each type in this pool
    std::vector<uint32_t> availableDescriptorTypeCount;        // Available # of descriptors of each type in this pool

    DESCRIPTOR_POOL_NODE(const VkDescriptorPool pool, const VkDescriptorPoolCreateInfo *pCreateInfo)
        : pool(pool), maxSets(pCreateInfo->maxSets), availableSets(pCreateInfo->maxSets), createInfo(*pCreateInfo),
          maxDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE, 0), availableDescriptorTypeCount(VK_DESCRIPTOR_TYPE_RANGE_SIZE, 0) {
        if (createInfo.poolSizeCount) { // Shadow type struct from ptr into local struct
            size_t poolSizeCountSize = createInfo.poolSizeCount * sizeof(VkDescriptorPoolSize);
            createInfo.pPoolSizes = new VkDescriptorPoolSize[poolSizeCountSize];
            memcpy((void *)createInfo.pPoolSizes, pCreateInfo->pPoolSizes, poolSizeCountSize);
            // Now set max counts for each descriptor type based on count of that type times maxSets
            uint32_t i = 0;
            for (i = 0; i < createInfo.poolSizeCount; ++i) {
                uint32_t typeIndex = static_cast<uint32_t>(createInfo.pPoolSizes[i].type);
                // Same descriptor types can appear several times
                maxDescriptorTypeCount[typeIndex] += createInfo.pPoolSizes[i].descriptorCount;
                availableDescriptorTypeCount[typeIndex] = maxDescriptorTypeCount[typeIndex];
            }
        } else {
            createInfo.pPoolSizes = NULL; // Make sure this is NULL so we don't try to clean it up
        }
    }
    ~DESCRIPTOR_POOL_NODE() {
        delete[] createInfo.pPoolSizes;
        // TODO : pSets are currently freed in deletePools function which uses freeShadowUpdateTree function
        //  need to migrate that struct to smart ptrs for auto-cleanup
    }
};

class BUFFER_NODE : public BASE_NODE {
  public:
    using BASE_NODE::in_use;
    VkBuffer buffer;
    VkDeviceMemory mem;
    VkDeviceSize memOffset;
    VkDeviceSize memSize; // Note: may differ from createInfo::size
    VkBufferCreateInfo createInfo;
    BUFFER_NODE() : buffer(VK_NULL_HANDLE), mem(VK_NULL_HANDLE), memOffset(0), memSize(0), createInfo{} { in_use.store(0); };
    BUFFER_NODE(VkBuffer buff, const VkBufferCreateInfo *pCreateInfo)
        : buffer(buff), mem(VK_NULL_HANDLE), memOffset(0), memSize(0), createInfo(*pCreateInfo) {
        in_use.store(0);
    };
    BUFFER_NODE(const BUFFER_NODE &rh_obj)
        : buffer(rh_obj.buffer), mem(rh_obj.mem), memOffset(rh_obj.memOffset),
          memSize(rh_obj.memSize), createInfo(rh_obj.createInfo) {
        in_use.store(0);
    };
};

struct SAMPLER_NODE {
    VkSampler sampler;
    VkSamplerCreateInfo createInfo;

    SAMPLER_NODE(const VkSampler *ps, const VkSamplerCreateInfo *pci) : sampler(*ps), createInfo(*pci){};
};

class IMAGE_NODE : public BASE_NODE {
  public:
    using BASE_NODE::in_use;
    VkImage image;
    VkImageCreateInfo createInfo;
    VkDeviceMemory mem;
    bool valid; // If this is a swapchain image backing memory track valid here as it doesn't have DEVICE_MEM_INFO
    VkDeviceSize memOffset;
    VkDeviceSize memSize;
    IMAGE_NODE() : image(VK_NULL_HANDLE), createInfo{}, mem(VK_NULL_HANDLE), valid(false), memOffset(0), memSize(0) { in_use.store(0); };
    IMAGE_NODE(VkImage img, const VkImageCreateInfo *pCreateInfo)
        : image(img), createInfo(*pCreateInfo), mem(VK_NULL_HANDLE), valid(false), memOffset(0), memSize(0) {
        in_use.store(0);
    };
    IMAGE_NODE(const IMAGE_NODE &rh_obj)
        : image(rh_obj.image), createInfo(rh_obj.createInfo), mem(rh_obj.mem), valid(rh_obj.valid), memOffset(rh_obj.memOffset),
          memSize(rh_obj.memSize) {
        in_use.store(rh_obj.in_use.load());
    };
};

// Simple struct to hold handle and type of object so they can be uniquely identified and looked up in appropriate map
// TODO : Unify this with VK_OBJECT above
struct MT_OBJ_HANDLE_TYPE {
    uint64_t handle;
    VkDebugReportObjectTypeEXT type;
};

inline bool operator==(MT_OBJ_HANDLE_TYPE a, MT_OBJ_HANDLE_TYPE b) NOEXCEPT { return a.handle == b.handle && a.type == b.type; }

namespace std {
template <> struct hash<MT_OBJ_HANDLE_TYPE> {
    size_t operator()(MT_OBJ_HANDLE_TYPE obj) const NOEXCEPT { return hash<uint64_t>()(obj.handle) ^ hash<uint32_t>()(obj.type); }
};
}

struct MemRange {
    VkDeviceSize offset;
    VkDeviceSize size;
};

struct MEMORY_RANGE {
    uint64_t handle;
    bool image; // True for image, false for buffer
    bool linear; // True for buffers and linear images
    bool valid;  // True if this range is know to be valid
    VkDeviceMemory memory;
    VkDeviceSize start;
    VkDeviceSize size;
    VkDeviceSize end; // Store this pre-computed for simplicity
    // Set of ptrs to every range aliased with this one
    std::unordered_set<MEMORY_RANGE *> aliases;
};

// Data struct for tracking memory object
struct DEVICE_MEM_INFO {
    void *object; // Dispatchable object used to create this memory (device of swapchain)
    bool global_valid; // If allocation is mapped, set to "true" to be picked up by subsequently bound ranges
    VkDeviceMemory mem;
    VkMemoryAllocateInfo alloc_info;
    std::unordered_set<MT_OBJ_HANDLE_TYPE> obj_bindings;         // objects bound to this memory
    std::unordered_set<VkCommandBuffer> command_buffer_bindings; // cmd buffers referencing this memory
    std::unordered_map<uint64_t, MEMORY_RANGE> bound_ranges;     // Map of object to its binding range
    // Convenience vectors image/buff handles to speed up iterating over images or buffers independently
    std::unordered_set<uint64_t> bound_images;
    std::unordered_set<uint64_t> bound_buffers;

    MemRange mem_range;
    void *shadow_copy_base;     // Base of layer's allocation for guard band, data, and alignment space
    void *shadow_copy;          // Pointer to start of guard-band data before mapped region
    uint64_t shadow_pad_size;   // Size of the guard-band data before and after actual data. It MUST be a
                                // multiple of limits.minMemoryMapAlignment
    void *p_driver_data;        // Pointer to application's actual memory

    DEVICE_MEM_INFO(void *disp_object, const VkDeviceMemory in_mem, const VkMemoryAllocateInfo *p_alloc_info)
        : object(disp_object), global_valid(false), mem(in_mem), alloc_info(*p_alloc_info), mem_range{}, shadow_copy_base(0),
          shadow_copy(0), shadow_pad_size(0), p_driver_data(0){};
};

class SWAPCHAIN_NODE {
  public:
    VkSwapchainCreateInfoKHR createInfo;
    uint32_t *pQueueFamilyIndices;
    std::vector<VkImage> images;
    SWAPCHAIN_NODE(const VkSwapchainCreateInfoKHR *pCreateInfo) : createInfo(*pCreateInfo), pQueueFamilyIndices(NULL) {
        if (pCreateInfo->queueFamilyIndexCount && pCreateInfo->imageSharingMode == VK_SHARING_MODE_CONCURRENT) {
            pQueueFamilyIndices = new uint32_t[pCreateInfo->queueFamilyIndexCount];
            memcpy(pQueueFamilyIndices, pCreateInfo->pQueueFamilyIndices, pCreateInfo->queueFamilyIndexCount * sizeof(uint32_t));
            createInfo.pQueueFamilyIndices = pQueueFamilyIndices;
        }
    }
    ~SWAPCHAIN_NODE() { delete[] pQueueFamilyIndices; }
};

enum DRAW_TYPE {
    DRAW = 0,
    DRAW_INDEXED = 1,
    DRAW_INDIRECT = 2,
    DRAW_INDEXED_INDIRECT = 3,
    DRAW_BEGIN_RANGE = DRAW,
    DRAW_END_RANGE = DRAW_INDEXED_INDIRECT,
    NUM_DRAW_TYPES = (DRAW_END_RANGE - DRAW_BEGIN_RANGE + 1),
};

class IMAGE_CMD_BUF_LAYOUT_NODE {
  public:
    IMAGE_CMD_BUF_LAYOUT_NODE() {}
    IMAGE_CMD_BUF_LAYOUT_NODE(VkImageLayout initialLayoutInput, VkImageLayout layoutInput)
        : initialLayout(initialLayoutInput), layout(layoutInput) {}

    VkImageLayout initialLayout;
    VkImageLayout layout;
};

struct MT_PASS_ATTACHMENT_INFO {
    uint32_t attachment;
    VkAttachmentLoadOp load_op;
    VkAttachmentStoreOp store_op;
    VkAttachmentLoadOp stencil_load_op;
    VkAttachmentStoreOp stencil_store_op;
};

// Store the DAG.
struct DAGNode {
    uint32_t pass;
    std::vector<uint32_t> prev;
    std::vector<uint32_t> next;
};

struct RENDER_PASS_NODE {
    VkRenderPass renderPass;
    VkRenderPassCreateInfo const *pCreateInfo;
    std::vector<bool> hasSelfDependency;
    std::vector<DAGNode> subpassToNode;
    std::vector<std::vector<VkFormat>> subpassColorFormats;
    std::vector<MT_PASS_ATTACHMENT_INFO> attachments;
    std::unordered_map<uint32_t, bool> attachment_first_read;
    std::unordered_map<uint32_t, VkImageLayout> attachment_first_layout;

    RENDER_PASS_NODE(VkRenderPassCreateInfo const *pCreateInfo) : pCreateInfo(pCreateInfo) {
        uint32_t i;

        subpassColorFormats.reserve(pCreateInfo->subpassCount);
        for (i = 0; i < pCreateInfo->subpassCount; i++) {
            const VkSubpassDescription *subpass = &pCreateInfo->pSubpasses[i];
            std::vector<VkFormat> color_formats;
            uint32_t j;

            color_formats.reserve(subpass->colorAttachmentCount);
            for (j = 0; j < subpass->colorAttachmentCount; j++) {
                const uint32_t att = subpass->pColorAttachments[j].attachment;

                if (att != VK_ATTACHMENT_UNUSED) {
                    color_formats.push_back(pCreateInfo->pAttachments[att].format);
                }
                else {
                    color_formats.push_back(VK_FORMAT_UNDEFINED);
                }
            }

            subpassColorFormats.push_back(color_formats);
        }
    }
};

// Cmd Buffer Tracking
enum CMD_TYPE {
    CMD_BINDPIPELINE,
    CMD_BINDPIPELINEDELTA,
    CMD_SETVIEWPORTSTATE,
    CMD_SETSCISSORSTATE,
    CMD_SETLINEWIDTHSTATE,
    CMD_SETDEPTHBIASSTATE,
    CMD_SETBLENDSTATE,
    CMD_SETDEPTHBOUNDSSTATE,
    CMD_SETSTENCILREADMASKSTATE,
    CMD_SETSTENCILWRITEMASKSTATE,
    CMD_SETSTENCILREFERENCESTATE,
    CMD_BINDDESCRIPTORSETS,
    CMD_BINDINDEXBUFFER,
    CMD_BINDVERTEXBUFFER,
    CMD_DRAW,
    CMD_DRAWINDEXED,
    CMD_DRAWINDIRECT,
    CMD_DRAWINDEXEDINDIRECT,
    CMD_DISPATCH,
    CMD_DISPATCHINDIRECT,
    CMD_COPYBUFFER,
    CMD_COPYIMAGE,
    CMD_BLITIMAGE,
    CMD_COPYBUFFERTOIMAGE,
    CMD_COPYIMAGETOBUFFER,
    CMD_CLONEIMAGEDATA,
    CMD_UPDATEBUFFER,
    CMD_FILLBUFFER,
    CMD_CLEARCOLORIMAGE,
    CMD_CLEARATTACHMENTS,
    CMD_CLEARDEPTHSTENCILIMAGE,
    CMD_RESOLVEIMAGE,
    CMD_SETEVENT,
    CMD_RESETEVENT,
    CMD_WAITEVENTS,
    CMD_PIPELINEBARRIER,
    CMD_BEGINQUERY,
    CMD_ENDQUERY,
    CMD_RESETQUERYPOOL,
    CMD_COPYQUERYPOOLRESULTS,
    CMD_WRITETIMESTAMP,
    CMD_PUSHCONSTANTS,
    CMD_INITATOMICCOUNTERS,
    CMD_LOADATOMICCOUNTERS,
    CMD_SAVEATOMICCOUNTERS,
    CMD_BEGINRENDERPASS,
    CMD_NEXTSUBPASS,
    CMD_ENDRENDERPASS,
    CMD_EXECUTECOMMANDS,
    CMD_END, // Should be last command in any RECORDED cmd buffer
};

// Data structure for holding sequence of cmds in cmd buffer
struct CMD_NODE {
    CMD_TYPE type;
    uint64_t cmdNumber;
};

enum CB_STATE {
    CB_NEW,       // Newly created CB w/o any cmds
    CB_RECORDING, // BeginCB has been called on this CB
    CB_RECORDED,  // EndCB has been called on this CB
    CB_INVALID    // CB had a bound descriptor set destroyed or updated
};

// CB Status -- used to track status of various bindings on cmd buffer objects
typedef VkFlags CBStatusFlags;
enum CBStatusFlagBits {
    // clang-format off
    CBSTATUS_NONE                   = 0x00000000,   // No status is set
    CBSTATUS_VIEWPORT_SET           = 0x00000001,   // Viewport has been set
    CBSTATUS_LINE_WIDTH_SET         = 0x00000002,   // Line width has been set
    CBSTATUS_DEPTH_BIAS_SET         = 0x00000004,   // Depth bias has been set
    CBSTATUS_BLEND_CONSTANTS_SET    = 0x00000008,   // Blend constants state has been set
    CBSTATUS_DEPTH_BOUNDS_SET       = 0x00000010,   // Depth bounds state object has been set
    CBSTATUS_STENCIL_READ_MASK_SET  = 0x00000020,   // Stencil read mask has been set
    CBSTATUS_STENCIL_WRITE_MASK_SET = 0x00000040,   // Stencil write mask has been set
    CBSTATUS_STENCIL_REFERENCE_SET  = 0x00000080,   // Stencil reference has been set
    CBSTATUS_SCISSOR_SET            = 0x00000100,   // Scissor has been set
    CBSTATUS_INDEX_BUFFER_BOUND     = 0x00000200,   // Index buffer has been set
    CBSTATUS_ALL                    = 0x000001FF,   // All dynamic state set (intentionally exclude index buffer)
    // clang-format on
};

struct QueryObject {
    VkQueryPool pool;
    uint32_t index;
};

inline bool operator==(const QueryObject &query1, const QueryObject &query2) {
    return (query1.pool == query2.pool && query1.index == query2.index);
}

namespace std {
template <> struct hash<QueryObject> {
    size_t operator()(QueryObject query) const throw() {
        return hash<uint64_t>()((uint64_t)(query.pool)) ^ hash<uint32_t>()(query.index);
    }
};
}
struct DRAW_DATA { std::vector<VkBuffer> buffers; };

struct ImageSubresourcePair {
    VkImage image;
    bool hasSubresource;
    VkImageSubresource subresource;
};

inline bool operator==(const ImageSubresourcePair &img1, const ImageSubresourcePair &img2) {
    if (img1.image != img2.image || img1.hasSubresource != img2.hasSubresource)
        return false;
    return !img1.hasSubresource ||
           (img1.subresource.aspectMask == img2.subresource.aspectMask && img1.subresource.mipLevel == img2.subresource.mipLevel &&
            img1.subresource.arrayLayer == img2.subresource.arrayLayer);
}

namespace std {
template <> struct hash<ImageSubresourcePair> {
    size_t operator()(ImageSubresourcePair img) const throw() {
        size_t hashVal = hash<uint64_t>()(reinterpret_cast<uint64_t &>(img.image));
        hashVal ^= hash<bool>()(img.hasSubresource);
        if (img.hasSubresource) {
            hashVal ^= hash<uint32_t>()(reinterpret_cast<uint32_t &>(img.subresource.aspectMask));
            hashVal ^= hash<uint32_t>()(img.subresource.mipLevel);
            hashVal ^= hash<uint32_t>()(img.subresource.arrayLayer);
        }
        return hashVal;
    }
};
}

// Store layouts and pushconstants for PipelineLayout
struct PIPELINE_LAYOUT_NODE {
    VkPipelineLayout layout;
    std::vector<cvdescriptorset::DescriptorSetLayout const *> set_layouts;
    std::vector<VkPushConstantRange> push_constant_ranges;

    PIPELINE_LAYOUT_NODE() : layout(VK_NULL_HANDLE), set_layouts{}, push_constant_ranges{} {}

    void reset() {
        layout = VK_NULL_HANDLE;
        set_layouts.clear();
        push_constant_ranges.clear();
    }
};

// Track last states that are bound per pipeline bind point (Gfx & Compute)
struct LAST_BOUND_STATE {
    VkPipeline pipeline;
    PIPELINE_LAYOUT_NODE pipeline_layout;
    // Track each set that has been bound
    // TODO : can unique be global per CB? (do we care about Gfx vs. Compute?)
    std::unordered_set<cvdescriptorset::DescriptorSet *> uniqueBoundSets;
    // Ordered bound set tracking where index is set# that given set is bound to
    std::vector<cvdescriptorset::DescriptorSet *> boundDescriptorSets;
    // one dynamic offset per dynamic descriptor bound to this CB
    std::vector<std::vector<uint32_t>> dynamicOffsets;

    void reset() {
        pipeline = VK_NULL_HANDLE;
        pipeline_layout.reset();
        uniqueBoundSets.clear();
        boundDescriptorSets.clear();
        dynamicOffsets.clear();
    }
};
// Cmd Buffer Wrapper Struct - TODO : This desperately needs its own class
struct GLOBAL_CB_NODE : public BASE_NODE {
    VkCommandBuffer commandBuffer;
    VkCommandBufferAllocateInfo createInfo;
    VkCommandBufferBeginInfo beginInfo;
    VkCommandBufferInheritanceInfo inheritanceInfo;
    VkDevice device;                    // device this CB belongs to
    uint64_t numCmds;                   // number of cmds in this CB
    uint64_t drawCount[NUM_DRAW_TYPES]; // Count of each type of draw in this CB
    CB_STATE state;                     // Track cmd buffer update state
    uint64_t submitCount;               // Number of times CB has been submitted
    CBStatusFlags status;               // Track status of various bindings on cmd buffer
    std::vector<CMD_NODE> cmds;              // vector of commands bound to this command buffer
    // Currently storing "lastBound" objects on per-CB basis
    //  long-term may want to create caches of "lastBound" states and could have
    //  each individual CMD_NODE referencing its own "lastBound" state
    // Store last bound state for Gfx & Compute pipeline bind points
    LAST_BOUND_STATE lastBound[VK_PIPELINE_BIND_POINT_RANGE_SIZE];

    uint32_t viewportMask;
    uint32_t scissorMask;
    VkRenderPassBeginInfo activeRenderPassBeginInfo;
    RENDER_PASS_NODE *activeRenderPass;
    VkSubpassContents activeSubpassContents;
    uint32_t activeSubpass;
    VkFramebuffer activeFramebuffer;
    std::unordered_set<VkFramebuffer> framebuffers;
    // Unified data structs to track objects bound to this command buffer as well as object
    //  dependencies that have been broken : either destroyed objects, or updated descriptor sets
    std::unordered_set<VK_OBJECT> object_bindings;
    std::vector<VK_OBJECT> broken_bindings;

    std::unordered_set<VkEvent> waitedEvents;
    std::vector<VkEvent> writeEventsBeforeWait;
    std::vector<VkEvent> events;
    std::unordered_map<QueryObject, std::unordered_set<VkEvent>> waitedEventsBeforeQueryReset;
    std::unordered_map<QueryObject, bool> queryToStateMap; // 0 is unavailable, 1 is available
    std::unordered_set<QueryObject> activeQueries;
    std::unordered_set<QueryObject> startedQueries;
    std::unordered_map<ImageSubresourcePair, IMAGE_CMD_BUF_LAYOUT_NODE> imageLayoutMap;
    std::unordered_map<VkImage, std::vector<ImageSubresourcePair>> imageSubresourceMap;
    std::unordered_map<VkEvent, VkPipelineStageFlags> eventToStageMap;
    std::vector<DRAW_DATA> drawData;
    DRAW_DATA currentDrawData;
    VkCommandBuffer primaryCommandBuffer;
    // Track images and buffers that are updated by this CB at the point of a draw
    std::unordered_set<VkImageView> updateImages;
    std::unordered_set<VkBuffer> updateBuffers;
    // If cmd buffer is primary, track secondary command buffers pending
    // execution
    std::unordered_set<VkCommandBuffer> secondaryCommandBuffers;
    // MTMTODO : Scrub these data fields and merge active sets w/ lastBound as appropriate
    std::vector<std::function<bool()>> validate_functions;
    std::unordered_set<VkDeviceMemory> memObjs;
    std::vector<std::function<bool(VkQueue)>> eventUpdates;
    std::vector<std::function<bool(VkQueue)>> queryUpdates;

    ~GLOBAL_CB_NODE();
};

struct SEMAPHORE_WAIT {
    VkSemaphore semaphore;
    VkQueue queue;
    uint64_t seq;
};

struct CB_SUBMISSION {
    CB_SUBMISSION(std::vector<VkCommandBuffer> const &cbs, std::vector<SEMAPHORE_WAIT> const &waitSemaphores, std::vector<VkSemaphore> const &signalSemaphores, VkFence fence)
        : cbs(cbs), waitSemaphores(waitSemaphores), signalSemaphores(signalSemaphores), fence(fence) {}

    std::vector<VkCommandBuffer> cbs;
    std::vector<SEMAPHORE_WAIT> waitSemaphores;
    std::vector<VkSemaphore> signalSemaphores;
    VkFence fence;
};

// Fwd declarations of layer_data and helpers to look-up/validate state from layer_data maps
namespace core_validation {
struct layer_data;
cvdescriptorset::DescriptorSet *getSetNode(const layer_data *, VkDescriptorSet);
cvdescriptorset::DescriptorSetLayout const *getDescriptorSetLayout(layer_data const *, VkDescriptorSetLayout);
DESCRIPTOR_POOL_NODE *getPoolNode(const layer_data *, const VkDescriptorPool);
BUFFER_NODE *getBufferNode(const layer_data *, VkBuffer);
IMAGE_NODE *getImageNode(const layer_data *, VkImage);
DEVICE_MEM_INFO *getMemObjInfo(const layer_data *, VkDeviceMemory);
VkBufferViewCreateInfo *getBufferViewInfo(const layer_data *, VkBufferView);
SAMPLER_NODE *getSamplerNode(const layer_data *, VkSampler);
VkImageViewCreateInfo *getImageViewData(const layer_data *, VkImageView);
VkSwapchainKHR getSwapchainFromImage(const layer_data *, VkImage);
SWAPCHAIN_NODE *getSwapchainNode(const layer_data *, VkSwapchainKHR);
void invalidateCommandBuffers(std::unordered_set<GLOBAL_CB_NODE *>, VK_OBJECT);
bool ValidateMemoryIsBoundToBuffer(const layer_data *, const BUFFER_NODE *, const char *);
}

#endif // CORE_VALIDATION_TYPES_H_


text:
using System;
using System.Collections.Generic;
using Orchard.Core.Settings.Descriptor.Records;
using Orchard.Data;
using Orchard.Environment.Configuration;
using Orchard.Environment.Descriptor;
using Orchard.Environment.Descriptor.Models;
using Orchard.Environment.Extensions.Models;
using Orchard.Localization;

namespace Orchard.Core.Settings.Descriptor {
    public class ShellDescriptorManager : IShellDescriptorManager {
        private readonly IRepository<ShellDescriptorRecord> _shellDescriptorRepository;
        private readonly IShellDescriptorManagerEventHandler _events;
        private readonly ShellSettings _shellSettings;

        public ShellDescriptorManager(
            IRepository<ShellDescriptorRecord> shellDescriptorRepository,
            IShellDescriptorManagerEventHandler events,
            ShellSettings shellSettings) {
            _shellDescriptorRepository = shellDescriptorRepository;
            _events = events;
            _shellSettings = shellSettings;
            T = NullLocalizer.Instance;
        }

        public Localizer T { get; set; }

        public ShellDescriptor GetShellDescriptor() {
            ShellDescriptorRecord shellDescriptorRecord = GetDescriptorRecord();
            if (shellDescriptorRecord == null) return null;
            return GetShellDescriptorFromRecord(shellDescriptorRecord);
        }

        private static ShellDescriptor GetShellDescriptorFromRecord(ShellDescriptorRecord shellDescriptorRecord) {
            ShellDescriptor descriptor = new ShellDescriptor { SerialNumber = shellDescriptorRecord.SerialNumber };
            var descriptorFeatures = new List<ShellFeature>();
            foreach (var descriptorFeatureRecord in shellDescriptorRecord.Features) {
                descriptorFeatures.Add(new ShellFeature { Name = descriptorFeatureRecord.Name });
            }
            descriptor.Features = descriptorFeatures;
            var descriptorParameters = new List<ShellParameter>();
            foreach (var descriptorParameterRecord in shellDescriptorRecord.Parameters) {
                descriptorParameters.Add(
                    new ShellParameter {
                        Component = descriptorParameterRecord.Component,
                        Name = descriptorParameterRecord.Name,
                        Value = descriptorParameterRecord.Value
                    });
            }
            descriptor.Parameters = descriptorParameters;

            return descriptor;
        }

        private ShellDescriptorRecord GetDescriptorRecord() {
            return _shellDescriptorRepository.Get(x => true);
        }

        public void UpdateShellDescriptor(int priorSerialNumber, IEnumerable<ShellFeature> enabledFeatures, IEnumerable<ShellParameter> parameters) {
            ShellDescriptorRecord shellDescriptorRecord = GetDescriptorRecord();
            var serialNumber = shellDescriptorRecord == null ? 0 : shellDescriptorRecord.SerialNumber;
            if (priorSerialNumber != serialNumber)
                throw new InvalidOperationException(T("Invalid serial number for shell descriptor").ToString());

            if (shellDescriptorRecord == null) {
                shellDescriptorRecord = new ShellDescriptorRecord { SerialNumber = 1 };
                _shellDescriptorRepository.Create(shellDescriptorRecord);
            }
            else {
                shellDescriptorRecord.SerialNumber++;
            }

            shellDescriptorRecord.Features.Clear();
            foreach (var feature in enabledFeatures) {
                shellDescriptorRecord.Features.Add(new ShellFeatureRecord { Name = feature.Name, ShellDescriptorRecord = shellDescriptorRecord });
            }

            shellDescriptorRecord.Parameters.Clear();
            foreach (var parameter in parameters) {
                shellDescriptorRecord.Parameters.Add(new ShellParameterRecord {
                    Component = parameter.Component,
                    Name = parameter.Name,
                    Value = parameter.Value,
                    ShellDescriptorRecord = shellDescriptorRecord
                });
            }

            _events.Changed(GetShellDescriptorFromRecord(shellDescriptorRecord), _shellSettings.Name);
        }
    }
}


text:
define(["js/core/Base"], function(Base) {

    return Base.inherit('js.core.ExternalInterface', {

        ctor: function(stage) {

            if (!stage) {
                throw new Error("ExternalInterface needs to be injected");
            }

            this.$interface = {};

            // single instance
            if (stage && stage.$externalInterface) {
                return stage.$externalInterface;
            }

            this.$stage = stage;

        },

        addCallback: function(functionName, callback, scope) {
            var scopedCallback = function () {
                var args = Array.prototype.slice.call(arguments);
                return callback.apply(scope, args);
            };

            scopedCallback._async = callback._async;

            this.$interface[functionName] = scopedCallback;

            if (this.runsInBrowser() && this.$stage && this.$stage.$el) {
                // add callback to stage dom element
                this.$stage.$el[functionName] = scopedCallback;
            }
        },

        _stageRendered: function(el) {
            for (var key in this.$interface) {
                if(this.$interface.hasOwnProperty(key)) {
                    el[key] = this.$interface[key];
                }
            }
        }
    });
});


text:
<app-wrap>

Edit competition

  <app-competition-form [doc]="competition" (OnUpdate)="submit($event)"></app-competition-form>
</app-wrap>


text:
// Copyright (c) Gurmit Teotia. Please see the LICENSE file in the project root for license information.
namespace Guflow
{
    public delegate ErrorAction HandleError(Error error);
}


text:
from django.db import migrations, models

from olympia.constants.promoted import RECOMMENDED

def add_promoted_approval_for_each_recommended(apps, schema_editor):
    Version = apps.get_model('versions', 'Version')
    PromotedApproval = apps.get_model('promoted', 'PromotedApproval')
    for version in Version.unfiltered.filter(recommendation_approved=True):
        PromotedApproval.objects.create(
            version=version, group_id=RECOMMENDED.id)

class Migration(migrations.Migration):

    dependencies = [
        ('versions', '0008_auto_20200625_1114'),
    ]

    operations = [
        migrations.RunPython(add_promoted_approval_for_each_recommended),
        migrations.AlterField(
            model_name='version',
            name='recommendation_approved',
            field=models.BooleanField(null=True),
        ),
    ]


text:
name: Error Handling
sort: 10
---

# Error Handling

In web development, we need to be able to redirect pages and handle errors. Beego uses `Redirect` for it:

```go
func (this *AddController) Get() {
	this.Redirect("/", 302)
}
```

If you want to stop this request and throw exception, you can do this in beego's controller:

```go
func (this *MainController) Get() {
	this.Abort("401")
	v := this.GetSession("asta")
	if v == nil {
		this.SetSession("asta", int(1))
		this.Data["Email"] = 0
	} else {
		this.SetSession("asta", v.(int)+1)
		this.Data["Email"] = v.(int)
	}
	this.TplNames = "index.tpl"
}
```

The `this.Abort("401")` won't execute any more and it will show this page:

![](../../images/401.png)

Beego supports 404, 401, 403, 500, 503 error handling by default. You can also define custom error handling page. For example redefined 404 page:

```go
func page_not_found(rw http.ResponseWriter, r *http.Request){
	t,_:= template.ParseFiles(beego.ViewsPath+"/404.html")
	data :=make(map[string]interface{})
	data["content"] = "page not found"
	t.Execute(rw, data)
}

func main() {
	beego.Errorhandler("404",page_not_found)
	beego.Router("/", &controllers.MainController{})
	beego.Run()
}
```

We can define our own `404.html` to handle 404 error.

Another cool feature of Beego is support of customized string error handling function, such as the code below which registers a database error page:

```go
func dbError(rw http.ResponseWriter, r *http.Request){
	t,_:= template.ParseFiles(beego.ViewsPath+"/dberror.html")
	data :=make(map[string]interface{})
	data["content"] = "database is now down"
	t.Execute(rw, data)
}

func main() {
	beego.Errorhandler("dbError",dbError)
	beego.Router("/", &controllers.MainController{})
	beego.Run()
}
```

After registering this error handling code, you can call `this.Abort("dbError")` in any place og your code to handle the database error.

# Controller define Error
Beego 1.4.3 added support for Controller defined Error handlers, so we can use the `beego.Controller` and `template.Render` context functions

```
package controllers

import (
	"github.com/astaxie/beego"
)

type ErrorController struct {
	beego.Controller
}

func (c *ErrorController) Error404() {
	c.Data["content"] = "page not found"
	c.TplNames = "404.tpl"
}

func (c *ErrorController) Error500() {
	c.Data["content"] = "internal server error"
	c.TplNames = "500.tpl"
}

func (c *ErrorController) ErrorDb() {
	c.Data["content"] = "database is now down"
	c.TplNames = "dberror.tpl"
}
```
From the example we can see, that all the error handle functions have prefix `Error`,the other string is the name of `Abort`,like `Error404` match `Abort("404")`

Use `beego.ErrorController` to register the error controller before `beego.Run`

```
package main

import (
	_ "btest/routers"
	"btest/controllers"

	"github.com/astaxie/beego"
)

func main() {
	beego.ErrorController(&controllers.ErrorController{})
	beego.Run()
}

```


text:
package com.facebook.buck.cxx;

import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertThat;

import com.facebook.buck.model.BuildTarget;
import com.facebook.buck.model.BuildTargetFactory;
import com.facebook.buck.rules.BuildContext;
import com.facebook.buck.rules.BuildRule;
import com.facebook.buck.rules.BuildRuleParams;
import com.facebook.buck.rules.BuildRuleResolver;
import com.facebook.buck.rules.BuildTargetSourcePath;
import com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer;
import com.facebook.buck.rules.FakeBuildContext;
import com.facebook.buck.rules.FakeBuildRule;
import com.facebook.buck.rules.FakeBuildRuleParamsBuilder;
import com.facebook.buck.rules.FakeBuildableContext;
import com.facebook.buck.rules.FakeSourcePath;
import com.facebook.buck.rules.HashedFileTool;
import com.facebook.buck.rules.RuleKey;
import com.facebook.buck.rules.SourcePath;
import com.facebook.buck.rules.SourcePathResolver;
import com.facebook.buck.rules.SourcePathRuleFinder;
import com.facebook.buck.rules.TargetGraph;
import com.facebook.buck.rules.Tool;
import com.facebook.buck.rules.keys.DefaultRuleKeyFactory;
import com.facebook.buck.shell.Genrule;
import com.facebook.buck.shell.GenruleBuilder;
import com.facebook.buck.step.Step;
import com.facebook.buck.step.TestExecutionContext;
import com.facebook.buck.testutil.FakeFileHashCache;
import com.google.common.base.Strings;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSortedSet;

import org.junit.Test;

import java.nio.file.Path;
import java.nio.file.Paths;

public class ArchiveTest {

  private static final Path AR = Paths.get("ar");
  private static final Archiver DEFAULT_ARCHIVER = new GnuArchiver(new HashedFileTool(AR));
  private static final Path RANLIB = Paths.get("ranlib");
  private static final Tool DEFAULT_RANLIB = new HashedFileTool(RANLIB);
  private static final Path DEFAULT_OUTPUT = Paths.get("foo/libblah.a");
  private static final ImmutableList<SourcePath> DEFAULT_INPUTS =
      ImmutableList.of(
          new FakeSourcePath("a.o"),
          new FakeSourcePath("b.o"),
          new FakeSourcePath("c.o"));

  @Test
  public void testThatInputChangesCauseRuleKeyChanges() {
    SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(
        new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())
    );
    SourcePathResolver pathResolver = new SourcePathResolver(ruleFinder);
    BuildTarget target = BuildTargetFactory.newInstance("//foo:bar");
    BuildRuleParams params = new FakeBuildRuleParamsBuilder(target).build();
    FakeFileHashCache hashCache = FakeFileHashCache.createFromStrings(
        ImmutableMap.<String, String>builder()
            .put(AR.toString(), Strings.repeat("0", 40))
            .put(RANLIB.toString(), Strings.repeat("1", 40))
            .put("a.o", Strings.repeat("a", 40))
            .put("b.o", Strings.repeat("b", 40))
            .put("c.o", Strings.repeat("c", 40))
            .put(Paths.get("different").toString(), Strings.repeat("d", 40))
            .build()
    );

    // Generate a rule key for the defaults.
    RuleKey defaultRuleKey =
        new DefaultRuleKeyFactory(0, hashCache, pathResolver, ruleFinder).build(
            Archive.from(
                target,
                params,
                pathResolver,
                ruleFinder,
                DEFAULT_ARCHIVER,
                ImmutableList.of(),
                DEFAULT_RANLIB,
                ImmutableList.of(),
                Archive.Contents.NORMAL,
                DEFAULT_OUTPUT,
                DEFAULT_INPUTS));

    // Verify that changing the archiver causes a rulekey change.
    RuleKey archiverChange =
        new DefaultRuleKeyFactory(0, hashCache, pathResolver, ruleFinder).build(
            Archive.from(
                target,
                params,
                pathResolver,
                ruleFinder,
                new GnuArchiver(new HashedFileTool(Paths.get("different"))),
                ImmutableList.of(),
                DEFAULT_RANLIB,
                ImmutableList.of(),
                Archive.Contents.NORMAL,
                DEFAULT_OUTPUT,
                DEFAULT_INPUTS));
        assertNotEquals(defaultRuleKey, archiverChange);

    // Verify that changing the output path causes a rulekey change.
    RuleKey outputChange =
        new DefaultRuleKeyFactory(0, hashCache, pathResolver, ruleFinder).build(
            Archive.from(
                target,
                params,
                pathResolver,
                ruleFinder,
                DEFAULT_ARCHIVER,
                ImmutableList.of(),
                DEFAULT_RANLIB,
                ImmutableList.of(),
                Archive.Contents.NORMAL,
                Paths.get("different"),
                DEFAULT_INPUTS));
    assertNotEquals(defaultRuleKey, outputChange);

    // Verify that changing the inputs causes a rulekey change.
    RuleKey inputChange =
        new DefaultRuleKeyFactory(0, hashCache, pathResolver, ruleFinder).build(
            Archive.from(
                target,
                params,
                pathResolver,
                ruleFinder,
                DEFAULT_ARCHIVER,
                ImmutableList.of(),
                DEFAULT_RANLIB,
                ImmutableList.of(),
                Archive.Contents.NORMAL,
                DEFAULT_OUTPUT,
                ImmutableList.of(new FakeSourcePath("different"))));
    assertNotEquals(defaultRuleKey, inputChange);

    // Verify that changing the type of archiver causes a rulekey change.
    RuleKey archiverTypeChange =
        new DefaultRuleKeyFactory(0, hashCache, pathResolver, ruleFinder).build(
            Archive.from(
                target,
                params,
                pathResolver,
                ruleFinder,
                new BsdArchiver(new HashedFileTool(AR)),
                ImmutableList.of(),
                DEFAULT_RANLIB,
                ImmutableList.of(),
                Archive.Contents.NORMAL,
                DEFAULT_OUTPUT,
                DEFAULT_INPUTS));
    assertNotEquals(defaultRuleKey, archiverTypeChange);
  }

  @Test
  public void flagsArePropagated() throws Exception {
    BuildRuleResolver resolver =
        new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
    BuildTarget target = BuildTargetFactory.newInstance("//foo:bar");
    BuildRuleParams params = new FakeBuildRuleParamsBuilder(target).build();
    SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(resolver);
    SourcePathResolver pathResolver = new SourcePathResolver(ruleFinder);
    Archive archive = Archive.from(
        target,
        params,
        pathResolver,
        ruleFinder,
        DEFAULT_ARCHIVER,
        ImmutableList.of("-foo"),
        DEFAULT_RANLIB,
        ImmutableList.of("-bar"),
        Archive.Contents.NORMAL,
        DEFAULT_OUTPUT,
        ImmutableList.of(new FakeSourcePath("simple.o")));

    BuildContext buildContext = BuildContext.builder()
        .from(FakeBuildContext.NOOP_CONTEXT)
        .setSourcePathResolver(pathResolver)
        .build();

    ImmutableList<Step> steps =
        archive.getBuildSteps(buildContext, new FakeBuildableContext());
    Step archiveStep = FluentIterable.from(steps).filter(ArchiveStep.class).first().get();
    assertThat(
        archiveStep.getDescription(TestExecutionContext.newInstance()),
        containsString("-foo"));

    Step ranlibStep = FluentIterable.from(steps).filter(RanlibStep.class).first().get();
    assertThat(
        ranlibStep.getDescription(TestExecutionContext.newInstance()),
        containsString("-bar"));
  }

  @Test
  public void testThatBuildTargetSourcePathDepsAndPathsArePropagated() throws Exception {
    BuildRuleResolver resolver =
        new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer());
    BuildTarget target = BuildTargetFactory.newInstance("//foo:bar");
    BuildRuleParams params = new FakeBuildRuleParamsBuilder(target).build();

    // Create a couple of genrules to generate inputs for an archive rule.
    Genrule genrule1 = (Genrule) GenruleBuilder
        .newGenruleBuilder(BuildTargetFactory.newInstance("//:genrule"))
        .setOut("foo/bar.o")
        .build(resolver);
    Genrule genrule2 = (Genrule) GenruleBuilder
        .newGenruleBuilder(BuildTargetFactory.newInstance("//:genrule2"))
        .setOut("foo/test.o")
        .build(resolver);

    // Build the archive using a normal input the outputs of the genrules above.
    SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(resolver);
    Archive archive =
        Archive.from(
            target,
            params,
            new SourcePathResolver(ruleFinder),
            ruleFinder,
            DEFAULT_ARCHIVER,
            ImmutableList.of(),
            DEFAULT_RANLIB,
            ImmutableList.of(),
            Archive.Contents.NORMAL,
            DEFAULT_OUTPUT,
            ImmutableList.of(
                new FakeSourcePath("simple.o"),
                new BuildTargetSourcePath(genrule1.getBuildTarget()),
                new BuildTargetSourcePath(genrule2.getBuildTarget())));

    // Verify that the archive dependencies include the genrules providing the
    // SourcePath inputs.
    assertEquals(
        ImmutableSortedSet.<BuildRule>of(genrule1, genrule2),
        archive.getDeps());
  }

  @Test
  public void testThatOriginalBuildParamsDepsDoNotPropagateToArchive() {
    SourcePathRuleFinder ruleFinder = new SourcePathRuleFinder(
        new BuildRuleResolver(TargetGraph.EMPTY, new DefaultTargetNodeToBuildRuleTransformer())
    );
    SourcePathResolver pathResolver = new SourcePathResolver(ruleFinder);

    // Create an `Archive` rule using build params with an existing dependency,
    // as if coming from a `TargetNode` which had declared deps.  These should *not*
    // propagate to the `Archive` rule, since it only cares about dependencies generating
    // it's immediate inputs.
    BuildRule dep = new FakeBuildRule(
        new FakeBuildRuleParamsBuilder("//:fake").build(),
        pathResolver);
    BuildTarget target = BuildTargetFactory.newInstance("//:archive");
    BuildRuleParams params =
        new FakeBuildRuleParamsBuilder(BuildTargetFactory.newInstance("//:dummy"))
            .setDeclaredDeps(ImmutableSortedSet.of(dep))
            .build();
    Archive archive =
        Archive.from(
            target,
            params,
            pathResolver,
            ruleFinder,
            DEFAULT_ARCHIVER,
            ImmutableList.of(),
            DEFAULT_RANLIB,
            ImmutableList.of(),
            Archive.Contents.NORMAL,
            DEFAULT_OUTPUT,
            DEFAULT_INPUTS);

    // Verify that the archive rules dependencies are empty.
    assertEquals(archive.getDeps(), ImmutableSortedSet.<BuildRule>of());
  }

}


text:
package algorithm.countsearch;

/**
 * 清理数据文件同时,需要清理test文件 和 索引文件
 */
public class TestRun {

    public static void main(String[] args) throws Exception{
        DataGenerator dataGenerator = new DataGenerator();
        if(!dataGenerator.isDataGerated()){
            dataGenerator.generate();
        }
        long  start = System.nanoTime();
        HybridIndex index = new HybridIndex();
        try{
            boolean pass = true;
            for(DataGenerator.KCounter k: dataGenerator.getTestNums()){
                int fc = index.find(k.number);
                if(fc!=k.count){
                    pass=false;
                    break;
                }
            }
            System.out.println("test is passed : "+pass);
        }catch (Exception e){
            e.printStackTrace();
        }
        System.out.print("查找100个数据耗时:"+ (System.nanoTime() - start)/1000000+"ms");
    }

}


text:
@interface PersistanceManager : NSObject

+ (void)saveObject:(id)object identifier:(NSString *)identifier;
+ (void)removeObjectWithIdentifier:(NSString *)identifier;
+ (id)fetchObjectWithIdentifier:(NSString *)identifier;

@end


text:
SYNONYM

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

#### Published in
null

#### Original name
Sphaeria entomorrhiza Dicks., 1785

### Remarks
null


text:
import React from 'react'
import { Placeholder } from 'semantic-ui-react'

const PlaceholderExampleLineLengthWithHeader = () => (
  <Placeholder>
    <Placeholder.Header image>
      <Placeholder.Line length='medium' />
      <Placeholder.Line length='full' />
    </Placeholder.Header>
    <Placeholder.Paragraph>
      <Placeholder.Line length='full' />
      <Placeholder.Line length='medium' />
    </Placeholder.Paragraph>
  </Placeholder>
)

export default PlaceholderExampleLineLengthWithHeader


text:
from config import RANGE_MIN

"""
Verifies if a number is divisible by a divisor,
Arguments:
    num - int
    divisor - int
Returns:
    boolean
"""
def is_divisible(num, divisor):
    return num % divisor == 0

"""
Gets all numbers between RANGE_MIN and n that are divisible by x and not divisible by y.
Arguments:
    n - int
    x - int
    y - int
Returns:
    list of ints
"""
def get_divisible(n, x, y):
    numbers = []
    """
    This operation could be done in a more pythonic way with list comprehension, but to
    assure maintainability, this way seems more self explanatory.
    """
    for num in range(RANGE_MIN,n):
        if(is_divisible(num, x) and not is_divisible(num, y)):
            numbers.append(num)
    return numbers


text:
<?php

use yii\helpers\Html;

/* @var $this yii\web\View */
/* @var $model app\models\ElaporanPelaksanaanKerjasama */

$this->title = 'Update Elaporan Pelaksanaan Kerjasama: ' . ' ' . $model->elaporan_pelaksanaan_kerjasama_id;
$this->params['breadcrumbs'][] = ['label' => 'Elaporan Pelaksanaan Kerjasamas', 'url' => ['index']];
$this->params['breadcrumbs'][] = ['label' => $model->elaporan_pelaksanaan_kerjasama_id, 'url' => ['view', 'id' => $model->elaporan_pelaksanaan_kerjasama_id]];
$this->params['breadcrumbs'][] = 'Update';
?>

    <?= $this->render('_form', [
        'model' => $model,
        'readonly' => $readonly,
    ]) ?>


text:
import ClassNameGenerator from '../ClassNameGenerator';

export type GlobalStateSlot =
  | 'active'
  | 'checked'
  | 'completed'
  | 'disabled'
  | 'error'
  | 'expanded'
  | 'focused'
  | 'focusVisible'
  | 'required'
  | 'selected';

const globalStateClassesMapping: Record<GlobalStateSlot, string> = {
  active: 'Mui-active',
  checked: 'Mui-checked',
  completed: 'Mui-completed',
  disabled: 'Mui-disabled',
  error: 'Mui-error',
  expanded: 'Mui-expanded',
  focused: 'Mui-focused',
  focusVisible: 'Mui-focusVisible',
  required: 'Mui-required',
  selected: 'Mui-selected',
};

export default function generateUtilityClass(componentName: string, slot: string): string {
  const globalStateClass = globalStateClassesMapping[slot as GlobalStateSlot];
  return globalStateClass || `${ClassNameGenerator.generate(componentName)}-${slot}`;
}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
          "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-mapping default-cascade="none">
    <class name="com.communote.server.model.config.LdapSearchConfigurationImpl" table="configuration_ldap_search" dynamic-insert="false" dynamic-update="false">
        <id name="id" type="java.lang.Long" unsaved-value="null">
            <column name="ID"/>
                        <generator class="native">
                    <param name="sequence">configuration_ldap_search_seq</param>
                                                           </generator>
        </id>
        <property name="searchFilter" type="java.lang.String">
            <column name="search_filter"
                     not-null="false" unique="false"/>
        </property>
        <property name="propertyMapping" type="java.lang.String">
            <column name="property_mapping"
                     not-null="true" unique="false"/>
        </property>
        <list name="searchBases" lazy="false" fetch="select" inverse="false" cascade="all">
            <key foreign-key="configuration_ldap_sbase_LDAPC" not-null="true">
                <column name="LDAP_SEARCH_CONFIGURATION_FK"/>
            </key>
            <list-index column="sbase_idx"/>
            <one-to-many class="com.communote.server.model.config.LdapSearchBaseDefinitionImpl"/>
        </list>
    </class>
</hibernate-mapping>


text:
using System.Text;
using System.Web.Mvc;
using JsonConfig;

namespace JsonConfigWebTest.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            var sb = new StringBuilder();
            sb.Append("name: " + JsonConfigManager.DefaultConfig.name + "
");
            sb.Append("host: " + JsonConfigManager.DefaultConfig.host + "
");
            sb.Append("port: " + JsonConfigManager.DefaultConfig.port + "
");

            return Content(sb.ToString());
        }

    }
}


text:
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

using NDepend.Helpers;

namespace NDepend.Path {

   partial class PathHelpers {

      private abstract class VariablePathBase : PathBase, IVariablePath {

         protected VariablePathBase(string pathString) :
            base(pathString) {
            Debug.Assert(pathString != null);
            Debug.Assert(pathString.Length > 0);
            Debug.Assert(pathString.IsNormalized());

            Debug.Assert(m_PathString != null);
            Debug.Assert(m_PathString.Length > 0);
            Debug.Assert(m_PathString.IsNormalized());

            // It is important to use m_PathString and not pathString in IsAVariablePath() !
            // Indeed, since InnerSpecialDir have been resolved, some variable might have disappeared
            // like if pathString was "$(v1)\$(v2)\.." and m_PathString became "$(v1)"
            IReadOnlyList<string> variables;
            string failureReasonUnused;
            var b = VariablePathHelpers.IsAVariablePath(m_PathString, out variables, out failureReasonUnused);
            Debug.Assert(b);
            Debug.Assert(variables != null);
            Debug.Assert(variables.Count > 0);
            Debug.Assert(variables.All(v => v != null));
            Debug.Assert(variables.All(v => v.Length > 0));
            m_Variables = variables;
         }

         public override bool IsAbsolutePath { get { return false; } }
         public override bool IsRelativePath { get { return false; } }
         public override bool IsEnvVarPath { get { return false; } }
         public override bool IsVariablePath { get { return true; } }
         public override PathMode PathMode { get { return PathMode.Variable; } }

         //
         // Resolving op
         //
         public string PrefixVariable { get { return m_Variables[0]; } }

         private readonly IReadOnlyList<string> m_Variables;
         public IReadOnlyList<string> AllVariables { get { return m_Variables; } }

         // This methods are implemented in VariableFilePath and VariableDirectoryPath.
         public abstract VariablePathResolvingStatus TryResolve(IEnumerable<KeyValuePair<string, string>> variablesValues, out IAbsolutePath pathResolved);
         public abstract VariablePathResolvingStatus TryResolve(IEnumerable<KeyValuePair<string, string>> variablesValues, out IAbsolutePath pathResolved, out IReadOnlyList<string> unresolvedVariables);
         public abstract bool TryResolve(IEnumerable<KeyValuePair<string, string>> variablesValues, out IAbsolutePath pathResolved, out string failureReason);

         protected bool TryResolve(IEnumerable<KeyValuePair<string, string>> variablesValues, out string pathStringResolved, out IReadOnlyList<string> unresolvedVariables) {
            Debug.Assert(variablesValues != null);

            var pathString = m_PathString;

            var unresolvedVariablesList = new List<string>();
            var nbVariablesToResolve = m_Variables.Count;
            Debug.Assert(nbVariablesToResolve > 0);
            for (var i = 0; i < nbVariablesToResolve; i++) {
               var variableNameToResolve = m_Variables[i];
               Debug.Assert(variableNameToResolve != null);
               Debug.Assert(variableNameToResolve.Length > 0);
               bool resolved = false;
               foreach (var pair in variablesValues) {
                  var pairVariableName = pair.Key;
                  // Support these two cases!
                  if (pairVariableName == null) { continue; }
                  if (pairVariableName.Length == 0) { continue; } //
                  if(String.Compare(pairVariableName, variableNameToResolve, true) != 0) { continue; } // true for ignore case! variable names are case insensitive
                  resolved = true;
                  var variableValue = pair.Value;
                  if (variableValue == null) {
                     // Treat null variableValue as empty string.
                     variableValue = "";
                  }
                  pathString = VariablePathHelpers.ReplaceVariableWithValue(pathString, variableNameToResolve, variableValue);
               }
               if (!resolved) {
                  unresolvedVariablesList.Add(variableNameToResolve);
               }
            }

            if (unresolvedVariablesList.Count > 0) {
               unresolvedVariables = unresolvedVariablesList.ToReadOnlyWrappedList();
               pathStringResolved = null;
               return false;
            }

            unresolvedVariables = null;
            pathStringResolved = pathString;
            return true;
         }

         protected string GetVariableResolvedButCannotConvertToAbsolutePathFailureReason(IEnumerable<KeyValuePair<string, string>> variablesValues, string fileOrDirectory) {
            Debug.Assert(variablesValues != null);
            Debug.Assert(fileOrDirectory != null);
            Debug.Assert(fileOrDirectory.Length > 0);

            // Need to obtain again pathStringResolved to include it into the failureReason!
            string pathStringResolved;
            IReadOnlyList<string> unresolvedVariablesUnused;
            var b = TryResolve(variablesValues, out pathStringResolved, out unresolvedVariablesUnused);
            Debug.Assert(b);
            return @"All variable(s) have been resolved, but the resulting string {" + pathStringResolved + "} cannot be converted to an absolute " + fileOrDirectory + " path.";
         }

         //
         // ParentDirectoryPath
         // Special impls in VariablePathHelpers !
         //
         IVariableDirectoryPath IVariablePath.ParentDirectoryPath {
            get {
               string parentPath = VariablePathHelpers.GetParentDirectory(m_PathString);
               return parentPath.ToVariableDirectoryPath();
            }
         }
         public override IDirectoryPath ParentDirectoryPath {
            get {
               string parentPath = VariablePathHelpers.GetParentDirectory(m_PathString);
               return parentPath.ToVariableDirectoryPath();
            }
         }

         public override bool HasParentDirectory {
            get {
               return VariablePathHelpers.HasParentDirectory(m_PathString);
            }
         }
      }
   }
}


text:
@import Foundation;
@import UIKit;
#import "Container.h"

@interface ImageContainer : Container

-(id) initWithImage: (UIImage *)initImage renderView: (UIView *) initRenderView;

@end


text:
package org.javace.controller;

import br.com.caelum.vraptor.Path;
import br.com.caelum.vraptor.Resource;

@Resource
@Path("/user")
public class UserController {

	@Path("/inicio")
	public void index() {

	}

}


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace SolrNetLight.Facet
{
    [DataContract]
    public class FacetCounts
    {
        [DataMember(Name = "facet_queries")]
        public FacetQueries FacetQueries { get; set; }
        [DataMember(Name = "facet_fields")]
        public IDictionary<string, ICollection<KeyValuePair<string, int>>> FacetFields { get; set; }
        [DataMember(Name = "facet_ranges")]
        public FacetRanges FacetRanges { get; set; }
    }
}


text:
Google Analytics plugin for the Brightcove player.

*Note this is not compatible with the Brightcove Smart Player which uses a different plugin architecture and API.*

This plugin was forked from the open source plugin written for video.js [videojs.ga](https://github.com/mickey/videojs-ga) to add changes specific to the Brightcove Player. Main changes from the original:

- The video ID and name are read from the player and tracked as the event label.
- Works with the standard (iframe) embed and direct player links: If a tracker is set in the plugin options, the Google universal analytics script will be loaded.
- Event names tracked are those used by the Smart Player plugins, where applicable. Event names can be customised / localised with plugin options.
- The plugin will not track events when the player is viewed in the Video Cloud Studio.

## Getting Started
* Download the plugin and place on your server.

### Studio configuration
* Edit the player configuration in the [Players Module of Video Cloud Studio](https://studio.brightcove.com/products/videocloud/players).
* Under _Plugins>JavaScript_, add the URL to the plugin to the player configuration and click +.
* Under _Plugins>Name, Options (JSON)_, enter `ga` as the name and click `+`.

If you want use the standard (iframe) embed, you need to also add the tracker to the plugin configuration under _Plugins>Name, Options (JSON)_:

```json
{
    "tracker": "UA-1234567-8"
}
```

### Configuration with the Player Management API

You can configure the plugin with the [player management API](http://docs.brightcove.com/en/video-cloud/player-management/index.html) instead of the GUI studio. For example, to add the plugin to an existing player:

```bash
curl --header "Content-Type: application/json" --user $EMAIL --request PATCH --data '{"scripts":["http://example.com/videojs.ga.videocloud.js"],"plugins":[{"name":"ga","options":{"tracker":"UA-1234567-8","eventNames":{"play":"Wiedergabe"}}}]}' https://players.api.brightcove.com/v1/accounts/$ACCOUNT_ID/players/$PLAYER_ID/configuration
```

### Standard vs Advanced Embed

If you use the standard (iframe) embed, make sure you include the tracker in the player configuration.

If you use the advanced (in-page) embed, the player will track events to the GA tracker on the page. That tracker must load before the player.

By using the embed the events are tracked in context with the rest of the visitor's interactions with the page.

### Classic and Universal Analytics

If the in-page embed is used, this plugin supports the "classic" ga.js and "universal" analytics.js Google Analytics libraries. It autodetects the library you use.

If the iframe embed or direct player URL is used, and a tracker is provided, the "universal" analytics.js is used.

## Options

Provide options to the plugin in the player configuraiton using `ga` as the name.

```json
{
  "tracker": "UA-1234567-8",
  "eventNames": {
    "play": "Wiedergabe"
  }
}
```

The following options are supported:

#### tracker

- If set, this tracker code will be used for iframe embeds and the direct player URL.
- If set and `trackerName` is not set on an in-page embed, this is not used.
- If set and `trackerName` is set on an in-page embed, this is used for the named tracker.

**default:** Not set

### trackerName

If set, use this as the [tracker name](https://developers.google.com/analytics/devguides/collection/analyticsjs/creating-trackers).

#### eventNames

Override or localise the names of the event actions.

**default:**
```
{
  "video_load": "Video Load",
  "percent_played": "Percent played",
  "start": "Media Begin",
  "seek_start": "Seek start",
  "seek_end": "Seek end",
  "play": "Media Play",
  "pause": "Media Pause",
  "error": "Error",
  "fullscreen_exit": "Fullscreen Entered",
  "fullscreen_exit": "Fullscreen Exited",
  "resize": "Resize",
  "volume_change": "Volume Change",
  "player_load": "Player Load",
  "end": "Media Complete"
}
```

#### eventCategory

This is the ```category``` sent to GA. If you don't know what it is please check [GA's doc](https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide)

**default:** ```'Brightcove Player'```

#### eventLabel

This is the ```label``` sent to GA. If you don't know what it is please check [GA's doc](https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide)

**default:** `VIDEO_ID | VIDEO_NAME`.

#### eventsToTrack

The events you want to track. For example `start` (playback started for the first time) and `end` are probably more interesting than `play` and `pause`.

**default:**
```
[ 'player_load', 'video_load', 'percent_played', 'start', 'end', 'seek', 'play', 'pause', 'resize', 'volume_change', 'error', 'fullscreen']
```

* `player_load` Player has loaded.
* `video_load` Video has loaded. Will fire again when a new video is loaded.
* `percent_played` Every *x*% of the video, with the percentage as a value, where *x* is defined by `percentsPlayedInterval`. Default is 10.
* `start` Playback has started. Once per video load.
* `end` Playback has completed. Once per video load.

#### percentsPlayedInterval

This options goes with the ```percents_played``` event. Every ```percentsPlayedInterval``` percents an event will be sent to GA.

**default:** 10

### debug

If set to false, console logs will be omited
**default:** ```false```

#### sendbeaconOverride
In the event you want to do something custom for all tracked events, use this option to pass a callback function to the plugin. The callback will have access to the following variables and will **override the plugin's native tracking methods**:
* `eventCategorty`
* `action`
* `eventLabel`
* `value`
* `nonInteraction`

## TODO

- [ ] Support ad events


text:
JavaScript lang Plugin for Elasticsearch
==================================

The JavaScript language plugin allows to have `javascript` (or `js`) as the language of scripts to execute.

In order to install the plugin, simply run:

```sh
bin/plugin install elasticsearch/elasticsearch-lang-javascript/2.5.0
```

You need to install a version matching your Elasticsearch version:

| elasticsearch |   JavaScript Plugin   |   Docs     |
|---------------|-----------------------|------------|
| master        |  Build from source    | See below  |
| es-1.x        |  Build from source    | [2.6.0-SNAPSHOT](https://github.com/elasticsearch/elasticsearch-transport-thrift/tree/es-1.x/#version-260-snapshot-for-elasticsearch-1x)  |
|    es-1.5              |     2.5.0         | [2.5.0](https://github.com/elastic/elasticsearch-lang-javascript/tree/v2.5.0/#version-250-for-elasticsearch-15)                  |
|    es-1.4              |     2.4.1         | [2.4.1](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/v2.4.1/#version-241-for-elasticsearch-14)                  |
|    es-1.3              |     2.3.1         | [2.3.1](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/v2.3.1/#version-231-for-elasticsearch-13)                  |
| es-1.2        |  2.2.0                | [2.2.0](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/v2.2.0/#javascript-lang-plugin-for-elasticsearch)  |
| es-1.1        |  2.1.0                | [2.1.0](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/v2.1.0/#javascript-lang-plugin-for-elasticsearch)  |
| es-1.0        |  2.0.0                | [2.0.0](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/v2.0.0/#javascript-lang-plugin-for-elasticsearch)  |
| es-0.90       |  1.4.0                | [1.4.0](https://github.com/elasticsearch/elasticsearch-lang-javascript/tree/v1.4.0/#javascript-lang-plugin-for-elasticsearch)  |

To build a `SNAPSHOT` version, you need to build it with Maven:

```bash
mvn clean install
plugin --install lang-javascript \
       --url file:target/releases/elasticsearch-lang-javascript-X.X.X-SNAPSHOT.zip
```

Using javascript with function_score
------------------------------------

Let's say you want to use `function_score` API using `javascript`. Here is
a way of doing it:

```sh
curl -XDELETE "http://localhost:9200/test"

curl -XPUT "http://localhost:9200/test/doc/1" -d '{
  "num": 1.0
}'

curl -XPUT "http://localhost:9200/test/doc/2?refresh" -d '{
  "num": 2.0
}'

curl -XGET "http://localhost:9200/test/_search?pretty" -d '
{
  "query": {
    "function_score": {
      "script_score": {
        "script": "doc[\"num\"].value",
        "lang": "javascript"
      }
    }
  }
}'
```

gives

```javascript
{
   // ...
   "hits": {
      "total": 2,
      "max_score": 4,
      "hits": [
         {
            // ...
            "_score": 4
         },
         {
            // ...
            "_score": 1
         }
      ]
   }
}
```

Using javascript with script_fields
-----------------------------------

```sh
curl -XDELETE "http://localhost:9200/test"

curl -XPUT "http://localhost:9200/test/doc/1?refresh" -d'
{
  "obj1": {
   "test": "something"
  },
  "obj2": {
    "arr2": [ "arr_value1", "arr_value2" ]
  }
}'

curl -XGET "http://localhost:9200/test/_search" -d'
{
  "script_fields": {
    "s_obj1": {
      "script": "_source.obj1", "lang": "js"
    },
    "s_obj1_test": {
      "script": "_source.obj1.test", "lang": "js"
    },
    "s_obj2": {
      "script": "_source.obj2", "lang": "js"
    },
    "s_obj2_arr2": {
      "script": "_source.obj2.arr2", "lang": "js"
    }
  }
}'
```

gives

```javascript
{
  // ...
  "hits": [
     {
        // ...
        "fields": {
           "s_obj2_arr2": [
              [
                 "arr_value1",
                 "arr_value2"
              ]
           ],
           "s_obj1_test": [
              "something"
           ],
           "s_obj2": [
              {
                 "arr2": [
                    "arr_value1",
                    "arr_value2"
                 ]
              }
           ],
           "s_obj1": [
              {
                 "test": "something"
              }
           ]
        }
     }
  ]
}
```

License
-------

    This software is licensed under the Apache 2 license, quoted below.

    Copyright 2009-2014 Elasticsearch <http://www.elasticsearch.org>

    Licensed under the Apache License, Version 2.0 (the "License"); you may not
    use this file except in compliance with the License. You may obtain a copy of
    the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
    License for the specific language governing permissions and limitations under
    the License.


text:
using System;
using Newtonsoft.Json.Linq;

namespace DevZH.AspNetCore.Authentication.XiaoMi
{
    /// <summary>
    /// Contains static methods that allow to extract user's information from a <see cref="JObject"/>
    /// instance retrieved from Xiao MI after a successful authentication process.
    /// </summary>
    internal static class XiaoMiHelper
    {
        /// <summary>
        ///  获取米聊用户 OpenId
        /// </summary>
        // 因为有了 Id 所以就不用 OpenId 来指代了。
        internal static string GetOpenId(JObject payload)
        {
            if (payload == null)
            {
                throw new ArgumentNullException(nameof(payload));
            }

            return payload.Value<string>("openId");
        }

        /// <summary>
        ///  获取米聊 ID
        /// </summary>
        internal static string GetId(JObject payload)
        {
            if (payload == null)
            {
                throw new ArgumentNullException(nameof(payload));
            }

            return payload["data"].Value<string>("userId");
        }

        /// <summary>
        ///  获取米聊昵称
        /// </summary>
        internal static string GetName(JObject payload)
        {
            if (payload == null)
            {
                throw new ArgumentNullException(nameof(payload));
            }

            return payload["data"].Value<string>("miliaoNick");
        }

        /// <summary>
        ///  获取米聊头像
        /// </summary>
        internal static string GetIcon(JObject payload)
        {
            if (payload == null)
            {
                throw new ArgumentNullException(nameof(payload));
            }

            return payload["data"].Value<string>("miliaoIcon");
        }
    }
}


text:
Switch Controller
=================

The *Switch Controller* is responsible for receiving all hardware switch state
changes and translating them into MPF events which are broadcast out to all the
other game modules. In other words, the switch controller is the only part of
the game that actually receives notification of the physical switches-—it's the
only thing that "talks to" the switch hardware. Everything else in the game just
waits for the switch controller to tell it that a switch action happened, rather
than all different parts of the game all talking to hardware.

Why do we force everything to talk to the switch controller instead of letting
individual modules talk to the switches directly? Lots of reasons:

+ The switch controller has the intelligence to know whether a switch is
  normally open (NO) or normally closed (NC), based on how each switch is
  configured in the machine configuration files. This means that all the game
  modules only have to listen for the *switch active* and *switch inactive*
  events, rather than each module needing the intelligence to transpose
  the switch states as needed.
+ The switch controller can change the timing of switches, even applying
  software delays and debouncing to switches, and this is all hidden from the
  other MPF modules.
+ The switch controller can "hide" physical switch activities from the
  game. This is most useful for broken switches that are firing like
  crazy. If the switch controller notices that a switch is going nuts,
  it can suppress those events, slow them down, or just ignore them
  altogether. That way you can just write your game code to say
  something like "when this switch is active, assign these points" and
  you don't have to worry about a bad switch giving all your players
  high scores! (This functionality is not yet complete)
+ The switch controller can also reprogram the game logic around
  broken switches. So if it knows that a switch is broken, it can send
  the game switch events for the broken switch when some alternate
  switch is hit. This means that each of your game modules can
  automatically get the benefit of this intelligent switch substitution
  without you having to write anything special. (Again, how this
  substitution takes place and which switches can be substituted for
  others is all configurable in your config files.)
+ Since the switch controller is the only interface into the game for
  switches, it can "inject" switch events from any source. For example,
  MPF includes functionality to simulate switch events with a computer
  keyboard (for testing and debugging), as well as switch events from a
  mobile phone or table. We also have a plug-in to
  read and playback switch events from log files from games that already
  ran, as well as the ability to write scripts that simulate games. All
  this is done by interfacing to the switch controller—-your actual game
  code doesn't know (or care) where the original switch events came
  from.


text:
(function($) {

    /*
      ======== A Handy Little QUnit Reference ========
      http://api.qunitjs.com/

      Test methods:
        module(name, {[setup][ ,teardown]})
        test(name, callback)
        expect(numberOfAssertions)
        stop(increment)
        start(decrement)
      Test assertions:
        ok(value, [message])
        equal(actual, expected, [message])
        notEqual(actual, expected, [message])
        deepEqual(actual, expected, [message])
        notDeepEqual(actual, expected, [message])
        strictEqual(actual, expected, [message])
        notStrictEqual(actual, expected, [message])
        throws(block, [expected], [message])
    */

    function matches(item, searchString) {
        return item.indexOf(searchString) >= 0 ? true : false;
    }

    var pInstance = 'Flexcomplete.instance';

    module('jQuery#flexcomplete', {
        // This will run before each test in this module.
        setup: function() {
            this.elems = $('[flexcomplete]');
            this.data = [
                'sujeito único',
                'antonio braga',
                'bruno henrique',
                'bruno braga',
                'walmor cesar',
                'breno nunes',
                'd\'alia',
                'toto-tata',
                'jogo#velha',
                'email@email.com',
                'carlos leite',
                'paulo amorim',
                'raphael praxedes',
                'thiago andrade',
                'thiago amaral',
                'thiago souza',
                'thiago leite',
                'thiago cavalcanti',
                'thiago ferreira',
                'thiago braga',
                'thiago castro',
                'thiago lima',
                'thiago aragão',
                'thiago alencar',
                'thiago assis',
                'hugo fernando',
                'danilo lima',
                'ronaldo nobrega',
                'kleber xavier',
                'andré barros',
                'roberta almeida'
            ];
        }
    });

    test('is chainable', function() {
        //expect(1);

        var flexcompletes = this.elems.flexcomplete({
            data: this.data
        });

        strictEqual(flexcompletes, this.elems, 'should be chainable');

        this.elems.get().forEach(function(item) {
            var flexcomplete = $(item).data(pInstance);
            notEqual(flexcomplete, undefined);
        });

        this.elems.unflexcomplete();

        this.elems.get().forEach(function(item) {
            var flexcomplete = $(item).data(pInstance);
            equal(flexcomplete, undefined);
        });
    });

    function test_by_input_val(elems, searchString, count) {

        elems.get().forEach(function(item) {

            item = $(item);
            item.val(searchString).focus();

            var instance = item.data(pInstance);

            asyncTest('are children being filled correctly one by one', function(assert) {

                setTimeout(function() {

                    ok(typeof instance.parentEl !== 'undefined', "The parent div should be present at the body");

                    var children = instance.parentEl.find('.flexcomplete-line');

                    if (typeof count !== 'undefined') {
                        equal(children.length, count, "There should be at least one result");
                    }

                    children.get().forEach(function(child) {
                        ok(matches($(child).text(), searchString) === true);
                    });

                    start();

                }, 5);
            });
        });
    }

    function test_search_function(elems, searchString, count) {

        elems.get().forEach(function(item) {

            var instance = $(item).data(pInstance);

            asyncTest('are children being filled correctly one by one', function(assert) {

                $(item).flexcomplete('search', searchString)
                    .then(function() {

                        notEqual(instance.parentEl, undefined, "The parent div should be present at the body");

                        var children = instance.parentEl.find('.flexcomplete-line');

                        if (typeof count !== 'undefined') {
                            equal(children.length, count, "There should be at least one result");
                        }

                        children.get().forEach(function(child) {
                            ok(matches($(child).text(), searchString) === true);
                        });

                        start();
                    });
            });
        });
    }

    function test_select_function(elems, searchString) {

        elems.get().forEach(function(item) {

            var instance = $(item).data(pInstance);

            asyncTest('are children being filled correctly one by one', function(assert) {

                $(item).flexcomplete('search', searchString)
                    .then(function() {

                        var arr = [].slice.call(instance.children);

                        for (var i = 0; i < arr.length; i++) {

                            $(item).flexcomplete('select', i);

                            equal(instance.$input.val(), arr[i], "The input value should be " + arr[i] + " but is " + instance.$input.val());
                        }

                        start();
                    });
            });
        });
    }

    test('STATIC DATA - are children being filled correctly (input value) [unique element]', function() {

        var searchString = 'único',
            flexcompletes = this.elems.flexcomplete({
                data: this.data,
                matches: matches,
                delay: 1
            }),
            count = this.data.reduce(function(previous, current, index, array) {
                return previous + (matches(array[index], searchString) ? 1 : 0);
            }, 0);

        test_by_input_val(this.elems, searchString, count);

        strictEqual(flexcompletes, this.elems, 'should be chainable');
    });

    test('STATIC DATA - are children being filled correctly (input value) [many elements]', function() {

        var searchString = 'thiago',
            flexcompletes = this.elems.flexcomplete({
                data: this.data,
                matches: matches,
                delay: 1
            }),
            count = this.data.reduce(function(previous, current, index, array) {
                return previous + (matches(array[index], searchString) ? 1 : 0);
            }, 0);

        test_by_input_val(this.elems, searchString, count);

        strictEqual(flexcompletes, this.elems, 'should be chainable');
    });

    test('STATIC DATA - are children being filled correctly search function [unique element]', function() {

        var searchString = 'único',
            flexcompletes = this.elems.flexcomplete({
                data: this.data,
                matches: matches,
                delay: 1
            }),
            count = this.data.reduce(function(previous, current, index, array) {
                return previous + (matches(array[index], searchString) ? 1 : 0);
            }, 0);

        test_search_function(this.elems, searchString, count);

        strictEqual(flexcompletes, this.elems, 'should be chainable');
    });

    test('STATIC DATA - are children being filled correctly search function [many elements]', function() {

        var searchString = 'thiago',
            flexcompletes = this.elems.flexcomplete({
                data: this.data,
                matches: matches,
                delay: 1
            }),
            count = this.data.reduce(function(previous, current, index, array) {
                return previous + (matches(array[index], searchString) ? 1 : 0);
            }, 0);

        test_search_function(this.elems, searchString, count);

        strictEqual(flexcompletes, this.elems, 'should be chainable');
    });

    test('STATIC DATA - are children being filled correctly select function [many elements]', function() {

        var searchString = "an",
            flexcompletes = this.elems.flexcomplete({
                data: this.data,
                matches: matches,
                delay: 1
            }),
            count = this.data.reduce(function(previous, current, index, array) {
                return previous + (matches(array[index], searchString) ? 1 : 0);
            }, 0);

        test_select_function(this.elems, searchString, count);
        strictEqual(flexcompletes, this.elems, 'should be chainable');
    });

    test('DYNAMIC DATA - are children being filled correctly select function [many elements]', function() {

        var searchString = "an",
            flexcompletes = this.elems.flexcomplete({
                url: 'http://localhost:3000/data/super-heroes'
            });

        test_select_function(this.elems, searchString);
        strictEqual(flexcompletes, this.elems, 'should be chainable');
    });

    // test('is awesome', function() {
    //     expect(1);
    //     strictEqual(this.elems.flexcomplete().text(), 'awesome0awesome1awesome2', 'should be awesome');
    // });

    // module('jQuery.flexcomplete');

    // test('is awesome', function() {
    //     expect(2);
    //     strictEqual($.flexcomplete(), 'awesome.', 'should be awesome');
    //     strictEqual($.flexcomplete({
    //         punctuation: '!'
    //     }), 'awesome!', 'should be thoroughly awesome');
    // });

    // module(':flexcomplete selector', {
    //     // This will run before each test in this module.
    //     setup: function() {
    //         this.elems = $('#qunit-fixture').children();
    //     }
    // });

    // test('is awesome', function() {
    //     expect(1);
    //     // Use deepEqual & .get() when comparing jQuery objects.
    //     deepEqual(this.elems.filter(':flexcomplete').get(), this.elems.last().get(), 'knows awesome when it sees it');
    // });

}(jQuery));