text:
package com.ericabraham.leapfrog.Adapter;

import android.app.Activity;
import android.content.Intent;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.ericabraham.leapfrog.Ui.ManageTask;
import com.ericabraham.leapfrog.R;

public class ReminderListAdapter extends RecyclerView.Adapter<ReminderListAdapter.ViewHolder> {
  private int[] taskID;
  private String[] task;
  private String[] pname;
  private String[] date;
  private String[] address;

  private final Activity context;

  public ReminderListAdapter(Activity context, int[] taskID, String[] task, String[] pname, String[] date,
      String[] address) {
    this.context = context;
    this.taskID = taskID;
    this.task = task;
    this.pname = pname;
    this.address = address;
    this.date = date;
  }

  @NonNull @Override
  public ReminderListAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) {
    // Inflate the custom layout
    View contactView = LayoutInflater.from(context).inflate(R.layout.item_single_reminder, viewGroup, false);

    // Return a new holder instance
    ViewHolder viewHolder = new ViewHolder(contactView);
    return viewHolder;
  }

  @Override
  public void onBindViewHolder(@NonNull ReminderListAdapter.ViewHolder viewHolder, final int position) {
    viewHolder.textViewTask.setText(task[position]);
    viewHolder.textViewName.setText(pname[position]);
    viewHolder.textViewDate.setText(date[position]);
    viewHolder.textViewAddress.setText(address[position]);
    viewHolder.itemView.setOnClickListener(new View.OnClickListener() {
      @Override public void onClick(View v) {
        Intent intent = new Intent(context, ManageTask.class);
        intent.putExtra("taskID", taskID[position]);
        context.startActivity(intent);
        context.finish();
      }
    });
  }

  @Override public int getItemCount() {
    return task.length;
  }

  public class ViewHolder extends RecyclerView.ViewHolder {
    @BindView(R.id.txttask)
    TextView textViewTask;
    @BindView(R.id.txtname)
    TextView textViewName;
    @BindView(R.id.txtdate)
    TextView textViewDate;
    @BindView(R.id.txtaddress)
    TextView textViewAddress;

    public ViewHolder(@NonNull View itemView) {
      super(itemView);
      ButterKnife.bind(this, itemView);
    }
  }
}


text:
namespace gameplay
{

void luaRegister_TextureSampler()
{
    const luaL_Reg lua_members[] =
    {
        {"addRef", lua_TextureSampler_addRef},
        {"bind", lua_TextureSampler_bind},
        {"getRefCount", lua_TextureSampler_getRefCount},
        {"getTexture", lua_TextureSampler_getTexture},
        {"release", lua_TextureSampler_release},
        {"setFilterMode", lua_TextureSampler_setFilterMode},
        {"setWrapMode", lua_TextureSampler_setWrapMode},
        {NULL, NULL}
    };
    const luaL_Reg lua_statics[] =
    {
        {"create", lua_TextureSampler_static_create},
        {NULL, NULL}
    };
    std::vector<std::string> scopePath;
    scopePath.push_back("Texture");

    gameplay::ScriptUtil::registerClass("TextureSampler", lua_members, NULL, lua_TextureSampler__gc, lua_statics, scopePath);
}

static Texture::Sampler* getInstance(lua_State* state)
{
    void* userdata = luaL_checkudata(state, 1, "TextureSampler");
    luaL_argcheck(state, userdata != NULL, 1, "'TextureSampler' expected.");
    return (Texture::Sampler*)((gameplay::ScriptUtil::LuaObject*)userdata)->instance;
}

int lua_TextureSampler__gc(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 1:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA))
            {
                void* userdata = luaL_checkudata(state, 1, "TextureSampler");
                luaL_argcheck(state, userdata != NULL, 1, "'TextureSampler' expected.");
                gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)userdata;
                if (object->owns)
                {
                    Texture::Sampler* instance = (Texture::Sampler*)object->instance;
                    SAFE_RELEASE(instance);
                }

                return 0;
            }

            lua_pushstring(state, "lua_TextureSampler__gc - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 1).");
            lua_error(state);
            break;
        }
    }
    return 0;
}

int lua_TextureSampler_addRef(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 1:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA))
            {
                Texture::Sampler* instance = getInstance(state);
                instance->addRef();

                return 0;
            }

            lua_pushstring(state, "lua_TextureSampler_addRef - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 1).");
            lua_error(state);
            break;
        }
    }
    return 0;
}

int lua_TextureSampler_bind(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 1:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA))
            {
                Texture::Sampler* instance = getInstance(state);
                instance->bind();

                return 0;
            }

            lua_pushstring(state, "lua_TextureSampler_bind - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 1).");
            lua_error(state);
            break;
        }
    }
    return 0;
}

int lua_TextureSampler_getRefCount(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 1:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA))
            {
                Texture::Sampler* instance = getInstance(state);
                unsigned int result = instance->getRefCount();

                // Push the return value onto the stack.
                lua_pushunsigned(state, result);

                return 1;
            }

            lua_pushstring(state, "lua_TextureSampler_getRefCount - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 1).");
            lua_error(state);
            break;
        }
    }
    return 0;
}

int lua_TextureSampler_getTexture(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 1:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA))
            {
                Texture::Sampler* instance = getInstance(state);
                void* returnPtr = ((void*)instance->getTexture());
                if (returnPtr)
                {
                    gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
                    object->instance = returnPtr;
                    object->owns = false;
                    luaL_getmetatable(state, "Texture");
                    lua_setmetatable(state, -2);
                }
                else
                {
                    lua_pushnil(state);
                }

                return 1;
            }

            lua_pushstring(state, "lua_TextureSampler_getTexture - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 1).");
            lua_error(state);
            break;
        }
    }
    return 0;
}

int lua_TextureSampler_release(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 1:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA))
            {
                Texture::Sampler* instance = getInstance(state);
                instance->release();

                return 0;
            }

            lua_pushstring(state, "lua_TextureSampler_release - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 1).");
            lua_error(state);
            break;
        }
    }
    return 0;
}

int lua_TextureSampler_setFilterMode(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 3:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
                lua_type(state, 2) == LUA_TNUMBER &&
                lua_type(state, 3) == LUA_TNUMBER)
            {
                // Get parameter 1 off the stack.
                Texture::Filter param1 = (Texture::Filter)luaL_checkint(state, 2);

                // Get parameter 2 off the stack.
                Texture::Filter param2 = (Texture::Filter)luaL_checkint(state, 3);

                Texture::Sampler* instance = getInstance(state);
                instance->setFilterMode(param1, param2);

                return 0;
            }

            lua_pushstring(state, "lua_TextureSampler_setFilterMode - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 3).");
            lua_error(state);
            break;
        }
    }
    return 0;
}

int lua_TextureSampler_setWrapMode(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 3:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
                lua_type(state, 2) == LUA_TNUMBER &&
                lua_type(state, 3) == LUA_TNUMBER)
            {
                // Get parameter 1 off the stack.
                Texture::Wrap param1 = (Texture::Wrap)luaL_checkint(state, 2);

                // Get parameter 2 off the stack.
                Texture::Wrap param2 = (Texture::Wrap)luaL_checkint(state, 3);

                Texture::Sampler* instance = getInstance(state);
                instance->setWrapMode(param1, param2);

                return 0;
            }

            lua_pushstring(state, "lua_TextureSampler_setWrapMode - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        case 4:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA) &&
                lua_type(state, 2) == LUA_TNUMBER &&
                lua_type(state, 3) == LUA_TNUMBER &&
                lua_type(state, 4) == LUA_TNUMBER)
            {
                // Get parameter 1 off the stack.
                Texture::Wrap param1 = (Texture::Wrap)luaL_checkint(state, 2);

                // Get parameter 2 off the stack.
                Texture::Wrap param2 = (Texture::Wrap)luaL_checkint(state, 3);

                // Get parameter 3 off the stack.
                Texture::Wrap param3 = (Texture::Wrap)luaL_checkint(state, 4);

                Texture::Sampler* instance = getInstance(state);
                instance->setWrapMode(param1, param2, param3);

                return 0;
            }

            lua_pushstring(state, "lua_TextureSampler_setWrapMode - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 3 or 4).");
            lua_error(state);
            break;
        }
    }
    return 0;
}

int lua_TextureSampler_static_create(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 1:
        {
            do
            {
                if ((lua_type(state, 1) == LUA_TUSERDATA || lua_type(state, 1) == LUA_TTABLE || lua_type(state, 1) == LUA_TNIL))
                {
                    // Get parameter 1 off the stack.
                    bool param1Valid;
                    gameplay::ScriptUtil::LuaArray<Texture> param1 = gameplay::ScriptUtil::getObjectPointer<Texture>(1, "Texture", false, &param1Valid);
                    if (!param1Valid)
                        break;

                    void* returnPtr = ((void*)Texture::Sampler::create(param1));
                    if (returnPtr)
                    {
                        gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
                        object->instance = returnPtr;
                        object->owns = true;
                        luaL_getmetatable(state, "TextureSampler");
                        lua_setmetatable(state, -2);
                    }
                    else
                    {
                        lua_pushnil(state);
                    }

                    return 1;
                }
            } while (0);

            do
            {
                if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL))
                {
                    // Get parameter 1 off the stack.
                    const char* param1 = gameplay::ScriptUtil::getString(1, false);

                    void* returnPtr = ((void*)Texture::Sampler::create(param1));
                    if (returnPtr)
                    {
                        gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
                        object->instance = returnPtr;
                        object->owns = true;
                        luaL_getmetatable(state, "TextureSampler");
                        lua_setmetatable(state, -2);
                    }
                    else
                    {
                        lua_pushnil(state);
                    }

                    return 1;
                }
            } while (0);

            lua_pushstring(state, "lua_TextureSampler_static_create - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        case 2:
        {
            do
            {
                if ((lua_type(state, 1) == LUA_TSTRING || lua_type(state, 1) == LUA_TNIL) &&
                    lua_type(state, 2) == LUA_TBOOLEAN)
                {
                    // Get parameter 1 off the stack.
                    const char* param1 = gameplay::ScriptUtil::getString(1, false);

                    // Get parameter 2 off the stack.
                    bool param2 = gameplay::ScriptUtil::luaCheckBool(state, 2);

                    void* returnPtr = ((void*)Texture::Sampler::create(param1, param2));
                    if (returnPtr)
                    {
                        gameplay::ScriptUtil::LuaObject* object = (gameplay::ScriptUtil::LuaObject*)lua_newuserdata(state, sizeof(gameplay::ScriptUtil::LuaObject));
                        object->instance = returnPtr;
                        object->owns = true;
                        luaL_getmetatable(state, "TextureSampler");
                        lua_setmetatable(state, -2);
                    }
                    else
                    {
                        lua_pushnil(state);
                    }

                    return 1;
                }
            } while (0);

            lua_pushstring(state, "lua_TextureSampler_static_create - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 1 or 2).");
            lua_error(state);
            break;
        }
    }
    return 0;
}

}

redpajama_set_name: RedPajamaGithub


text:
from unittest import TestCase
import indexer.callnumber as CallNumber

class TestCallnumber(TestCase):
    def test_normalization(self):
        self.assertEqual('QL 073700C250G650 000 2012', CallNumber.normalize('QL737.C25 G65 2012'))
        self.assertEqual('HV 088100P725 000 000 2011', CallNumber.normalize('HV881 .P725 2011'))
        self.assertEqual('E  017300K870 000 000 2013', CallNumber.normalize('E173 .K87 2013'))


text:
/**
 * 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.
 */

package com.ksmpartners.ernie.model;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.ksmpartners.ernie.util.ISODateDeserializer;
import com.ksmpartners.ernie.util.ISODateSerializer;
import org.joda.time.DateTime;
import java.util.Date;
import java.util.List;

/**
 * A JSONable class used to serialize report definition parameter metadata
 */
public class ParameterEntity extends ModelObject {

    private String paramName;
    private String dataType;
    private Boolean allowNull;
    private String defaultValue;

    public ParameterEntity() {}

    public ParameterEntity(String paramName, String dataType, Boolean allowNull, String defaultValue) {
        this.paramName = paramName;
        this.dataType = dataType;
        this.allowNull = allowNull;
        this.defaultValue = defaultValue;
    }

    /**
     * Return the name of the parameter. For instance, testParameter below:
     * <parameters>
     *  <scalar-parameter name="testParameter">
     *  ...
     */
    public String getParamName() {
        return paramName;
    }

    /**
     * Set the name of the parameter.
     */
    public void setParamName(String paramName) {
        this.paramName = paramName;
    }

    /**
     * Return the default value for the parameter. For instance, 1000 below:
     *  <expression name="defaultValue">1000</expression>
     */
    public String getDefaultValue() {
        return defaultValue;
    }

    /**
     * Set the default parameter value.
     */
    public void setDefaultValue(String defaultValue) {
        this.defaultValue = defaultValue;
    }

    /**
     * Return the data type for the parameter. For instance, "decimal" below:
     * <property name="dataType">decimal</property>
     */
    public String getDataType() {
        return dataType;
    }

    /**
     * Set the data type for the parameter.
     */
    public void setDataType(String dataType) {
        this.dataType = dataType;
    }

    /**
     * Return a boolean indicated if null values are allowed for the parameter.
     */
    public Boolean getAllowNull() {
        return allowNull;
    }

    /**
     * Set the boolean indicated if null values are allowed for the parameter.
     */
    public void setAllowNull(Boolean allowNull) {
        this.allowNull = allowNull;
    }

}


text:
using System;
using System.Drawing;
using System.Collections.Generic;
using OKHOSTING.UI.Controls;
using OKHOSTING.UI.Controls.Layout;

namespace OKHOSTING.UI.Net4.WPF.Controls.Layout
{
	/// <summary>
	/// It is a container shaped pile where you can be stacked objects, which we can give you design through its properties
	/// <para xml:lang="es">Es un contenedor en forma de pila, donde puedes ir apilando objetos, al cual le podemos dar diseño por medio de sus propiedades</para>
	/// </summary>
	public class Stack : System.Windows.Controls.StackPanel, IStack
	{
		private readonly ControlCollection _Children;

		/// <summary>
		/// Initializes a new instance of the OKHOSTING.UI.Net4.Ajax.Controls.Layout.Stack class.
		/// <para xml:lang="es">Inicializa una nueva instancia de la clase OKHOSTING.UI.Net4.Ajax.Controls.Layout.Stack</para>
		/// </summary>
		public Stack()
		{
			_Children = new ControlCollection(this);
			base.Orientation = System.Windows.Controls.Orientation.Vertical;
		}

		#region IControl

		/// <summary>
		/// Unique Id
		/// </summary>
		Guid IControl.Id { get; set; }

		/// <summary>
		/// Gets or sets wether the control is visible or not
		/// <para xml:lang="es">
		/// Obtiene o establece si el control es visible o no.
		/// </para>
		/// </summary>
		bool IControl.Visible
		{
			get
			{
				return base.Visibility == System.Windows.Visibility.Visible;
			}
			set
			{
				if (value)
				{
					base.Visibility = System.Windows.Visibility.Visible;
				}
				else
				{
					base.Visibility = System.Windows.Visibility.Hidden;
				}
			}
		}

		/// <summary>
		/// Gets or sets wether the control is enabled or not
		/// <para xml:lang="es">
		/// Obtiene o establece si el control es habilitado o no.
		/// </para>
		/// </summary>
		bool IControl.Enabled
		{
			get
			{
				return base.IsEnabled;
			}
			set
			{
				base.IsEnabled = value;
			}
		}

		/// <summary>
		/// Width of the control, in density independent pixels
		/// <para xml:lang="es">
		/// Ancho del control, en dencidad de pixeles independientes.
		/// </para>
		/// </summary>
		double? IControl.Width
		{
			get
			{
				return base.Width;
			}
			set
			{
				if (value.HasValue)
				{
					base.Width = value.Value;
				}
			}
		}

		/// <summary>
		/// Height of the control, in density independent pixels.
		/// <para xml:lang="es">
		/// Altura del control, en dencididad de pixeles independiente
		/// </para>
		/// </summary>
		double? IControl.Height
		{
			get
			{
				return base.Height;
			}
			set
			{
				if (value.HasValue)
				{
					base.Height = value.Value;
				}
			}
		}

		/// <summary>
		/// Space that this control will set between itself and it's container
		/// <para xml:lang="es">
		/// Espacio que este control se establecerá entre si mismo y su contenedor.
		/// </para>
		/// </summary>
		Thickness IControl.Margin
		{
			get
			{
				return Platform.Parse(base.Margin);
			}
			set
			{
				base.Margin = Platform.Parse(value);
			}
		}

		/// <summary>
		/// Space that this control will set between its content and its border
		/// <para xml:lang="es">
		/// Espacio que este control se establecerá entre su contenido y su borde
		/// </para>
		/// </summary>
		Thickness IControl.Padding
		{
			get;
			set;
		}

		/// <summary>
		/// Gets or sets the background color
		/// <para xml:lang="es">
		/// Obtiene o establece el color de fondo del control.
		/// </para>
		/// </summary>
		Color IControl.BackgroundColor
		{
			get
			{
				return Platform.Parse(((System.Windows.Media.SolidColorBrush)base.Background).Color);
			}
			set
			{
				base.Background = new System.Windows.Media.SolidColorBrush(Platform.Parse(value));
			}
		}

		/// <summary>
		/// Gets or sets the border color
		/// <para xml:lang="es">
		/// Obtiene o establece el color del borde del control.
		/// </para>
		/// </summary>
		Color IControl.BorderColor
		{
			get; set;
		}

		/// <summary>
		/// Border width, in density independent pixels (DIP)
		/// <para xml:lang="es">
		/// Ancho del borde, en dencidad de pixeles independientes (DIP)
		/// </para>
		/// </summary>
		Thickness IControl.BorderWidth
		{
			get; set;
		}

		/// <summary>
		/// Horizontal alignment of the control with respect to it's container.
		/// <para xml:lang="es">
		/// Alineación horizontal del control con respecto a su contenedor.
		/// </para>
		/// </summary>
		HorizontalAlignment IControl.HorizontalAlignment
		{
			get
			{
				return Platform.Parse(base.HorizontalAlignment);
			}
			set
			{
				base.HorizontalAlignment = Platform.Parse(value);
			}
		}

		/// <summary>
		/// Vertical alignment of the control with respect to it's container
		/// <para xml:lang="es">
		/// Alineacion vertical del control con respecto a su contenedor.
		/// </para>
		/// </summary>
		VerticalAlignment IControl.VerticalAlignment
		{
			get
			{
				return Platform.Parse(base.VerticalAlignment);
			}
			set
			{
				base.VerticalAlignment = Platform.Parse(value);
			}
		}

		/// <summary>
		/// Gets or sets a list of classes that define a control's style.
		/// Exactly the same concept as in CSS.
		/// </summary>
		string IControl.CssClass { get; set; }

		/// <summary>
		/// Control that contains this control, like a grid, or stack
		/// </summary>
		IControl IControl.Parent
		{
			get
			{
				return (IControl) base.Parent;
			}
		}

		object ICloneable.Clone()
		{
			return MemberwiseClone();
		}

		#endregion

		ICollection<IControl> IContainer.Children
		{
			get
			{
				return _Children;
			}
		}

		IImage IContainer.BackgroundImage
		{
			get;
			set;
		}

		/// <summary>
		/// The identifier dispose.
		/// <para xml:lang="es">
		/// El identificador Dispose.
		/// </para>
		/// </summary>
		void IDisposable.Dispose()
		{
		}

		protected override void OnRender(System.Windows.Media.DrawingContext dc)
		{
			Platform.SetBackgroundImage(this);
			base.OnRender(dc);
		}
	}
}


text:
<?php

namespace html;

class div extends tag
{
    protected $_tag = 'div';
    protected $_modifier_prefix = 'bg';
}


text:
#include <aws/inspector/model/AccessDeniedErrorCode.h>
#include <aws/core/utils/HashingUtils.h>
#include <aws/core/Globals.h>
#include <aws/core/utils/EnumParseOverflowContainer.h>

using namespace Aws::Utils;

namespace Aws
{
  namespace Inspector
  {
    namespace Model
    {
      namespace AccessDeniedErrorCodeMapper
      {

        static const int ACCESS_DENIED_TO_ASSESSMENT_TARGET_HASH = HashingUtils::HashString("ACCESS_DENIED_TO_ASSESSMENT_TARGET");
        static const int ACCESS_DENIED_TO_ASSESSMENT_TEMPLATE_HASH = HashingUtils::HashString("ACCESS_DENIED_TO_ASSESSMENT_TEMPLATE");
        static const int ACCESS_DENIED_TO_ASSESSMENT_RUN_HASH = HashingUtils::HashString("ACCESS_DENIED_TO_ASSESSMENT_RUN");
        static const int ACCESS_DENIED_TO_FINDING_HASH = HashingUtils::HashString("ACCESS_DENIED_TO_FINDING");
        static const int ACCESS_DENIED_TO_RESOURCE_GROUP_HASH = HashingUtils::HashString("ACCESS_DENIED_TO_RESOURCE_GROUP");
        static const int ACCESS_DENIED_TO_RULES_PACKAGE_HASH = HashingUtils::HashString("ACCESS_DENIED_TO_RULES_PACKAGE");
        static const int ACCESS_DENIED_TO_SNS_TOPIC_HASH = HashingUtils::HashString("ACCESS_DENIED_TO_SNS_TOPIC");
        static const int ACCESS_DENIED_TO_IAM_ROLE_HASH = HashingUtils::HashString("ACCESS_DENIED_TO_IAM_ROLE");

        AccessDeniedErrorCode GetAccessDeniedErrorCodeForName(const Aws::String& name)
        {
          int hashCode = HashingUtils::HashString(name.c_str());
          if (hashCode == ACCESS_DENIED_TO_ASSESSMENT_TARGET_HASH)
          {
            return AccessDeniedErrorCode::ACCESS_DENIED_TO_ASSESSMENT_TARGET;
          }
          else if (hashCode == ACCESS_DENIED_TO_ASSESSMENT_TEMPLATE_HASH)
          {
            return AccessDeniedErrorCode::ACCESS_DENIED_TO_ASSESSMENT_TEMPLATE;
          }
          else if (hashCode == ACCESS_DENIED_TO_ASSESSMENT_RUN_HASH)
          {
            return AccessDeniedErrorCode::ACCESS_DENIED_TO_ASSESSMENT_RUN;
          }
          else if (hashCode == ACCESS_DENIED_TO_FINDING_HASH)
          {
            return AccessDeniedErrorCode::ACCESS_DENIED_TO_FINDING;
          }
          else if (hashCode == ACCESS_DENIED_TO_RESOURCE_GROUP_HASH)
          {
            return AccessDeniedErrorCode::ACCESS_DENIED_TO_RESOURCE_GROUP;
          }
          else if (hashCode == ACCESS_DENIED_TO_RULES_PACKAGE_HASH)
          {
            return AccessDeniedErrorCode::ACCESS_DENIED_TO_RULES_PACKAGE;
          }
          else if (hashCode == ACCESS_DENIED_TO_SNS_TOPIC_HASH)
          {
            return AccessDeniedErrorCode::ACCESS_DENIED_TO_SNS_TOPIC;
          }
          else if (hashCode == ACCESS_DENIED_TO_IAM_ROLE_HASH)
          {
            return AccessDeniedErrorCode::ACCESS_DENIED_TO_IAM_ROLE;
          }
          EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
          if(overflowContainer)
          {
            overflowContainer->StoreOverflow(hashCode, name);
            return static_cast<AccessDeniedErrorCode>(hashCode);
          }

          return AccessDeniedErrorCode::NOT_SET;
        }

        Aws::String GetNameForAccessDeniedErrorCode(AccessDeniedErrorCode enumValue)
        {
          switch(enumValue)
          {
          case AccessDeniedErrorCode::ACCESS_DENIED_TO_ASSESSMENT_TARGET:
            return "ACCESS_DENIED_TO_ASSESSMENT_TARGET";
          case AccessDeniedErrorCode::ACCESS_DENIED_TO_ASSESSMENT_TEMPLATE:
            return "ACCESS_DENIED_TO_ASSESSMENT_TEMPLATE";
          case AccessDeniedErrorCode::ACCESS_DENIED_TO_ASSESSMENT_RUN:
            return "ACCESS_DENIED_TO_ASSESSMENT_RUN";
          case AccessDeniedErrorCode::ACCESS_DENIED_TO_FINDING:
            return "ACCESS_DENIED_TO_FINDING";
          case AccessDeniedErrorCode::ACCESS_DENIED_TO_RESOURCE_GROUP:
            return "ACCESS_DENIED_TO_RESOURCE_GROUP";
          case AccessDeniedErrorCode::ACCESS_DENIED_TO_RULES_PACKAGE:
            return "ACCESS_DENIED_TO_RULES_PACKAGE";
          case AccessDeniedErrorCode::ACCESS_DENIED_TO_SNS_TOPIC:
            return "ACCESS_DENIED_TO_SNS_TOPIC";
          case AccessDeniedErrorCode::ACCESS_DENIED_TO_IAM_ROLE:
            return "ACCESS_DENIED_TO_IAM_ROLE";
          default:
            EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer();
            if(overflowContainer)
            {
              return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue));
            }

            return {};
          }
        }

      } // namespace AccessDeniedErrorCodeMapper
    } // namespace Model
  } // namespace Inspector
} // namespace Aws


text:
module SolrMakr
  module LocalConfiguration
    extend ActiveSupport::Autoload

    eager_autoload do
      autoload :Cache
      autoload :ConfigDirectory
      autoload :Directory
      autoload :Helper
      autoload :Settings

      autoload :SaveSettings
    end

    class << self
      # @return [SolrMakr::Configsets::Directory]
      def default_configset
        configsets[SolrMakr.configuration.default_configset]
      end

      # @!attribute [r] cache
      attr_lazy_reader :cache do
        SolrMakr::LocalConfiguration::Cache.new
      end

      # @!attribute [r] configsets
      attr_lazy_reader :configsets do
        SolrMakr::LocalConfiguration::ConfigDirectory.new
      end

      # @!attribute [r] directory
      attr_lazy_reader :directory do
        SolrMakr::LocalConfiguration::Directory.new
      end

      # @!attribute [r] settings
      attr_lazy_reader :settings do
        SolrMakr::LocalConfiguration::Settings.new
      end
    end
  end
end


text:
from templates.text import TextTemplate

def process(input, data ,sender):
    help = '''Hi %s! I'm Espurr, your personal assistant.\nTell me things like the following:\n
  - define a superhero\n  - iron man 2 movie plot\n  - tell me a joke\n  - wiki html\n  - anything you want book\n  - random quote\n  - usd to eur rate\n
I'm always learning, so do come back and say hi from time to time!\nHave a nice day.''' % (sender)
    help += '\nTell me things like:'
    help += '\n  - define comfort'
    help += '\n  - iron man 2 movie plot'
    help += '\n  - tell me a joke/quote/fact'
    help += '\n  - wiki html'
    help += '\n  - anything you want book'
    help += '\n  - usd to eur rate'
    help += '\n  - death note anime'
    help += '\n  - time in seattle'
    help += '\n  - songs by linkin park'
    help += '\n  - shorten google.com'
    help += '\n  - weather in london'
    help += '\n  - videos of sia'
    output = {
        'input': input,
        'output': TextTemplate(help).get_message(),
        'success': True
    }
    return output


text:
<!doctype html>

	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0" />
	<title>Lesson – The Glad Tidings</title>
	<link rel="stylesheet" href="css/main.css" />

						The Glad Tidings

						Lukas Hermann

Menu

1

2

3

4

5

6

7

8

9

10

11

3.1 Judgment and the Books

When your poorest relatives are very sick, do they go to a bomoh for treatment? The use of magic workers has a long history, preceding Islam, Buddhism and Christianity. It was used extensively by the Babylonians. And today it is still in common use by the Malay both in Malaysia and Indonesia?

					 Download Script
					 Share

				 Unit Overview
				Continue

				Copyright 2015 The Glad Tidings, Inc.


text:
namespace MyTrattoria.Mongo
{
    using MongoDB.Driver;

    public class MongoDbContext
    {
        public static IMongoCollection<T> GetCollection<T>(string collectionName)
        {
            var client = new MongoClient("mongodb://localhost:27017/mongoTrattoria");
            var db = client.GetDatabase("mongoTrattoria");

            return db.GetCollection<T>(collectionName);
        }
    }
}


text:
{-# LANGUAGE FlexibleInstances, OverlappingInstances, UndecidableInstances, ScopedTypeVariables #-}

module Data.Bitmap.Searchable
    ( BitmapSearchable(..)
    , areColorsSimilar
    , colorDifferenceCIE94
    , defaultTransparentPixel
    , matchPixelAny
    , matchPixelSame
    , matchPixelSameThreshold
    , matchPixelDif
    , matchPixelDifThreshold
    ) where

import Control.Monad.Record
import Data.Bitmap.Class
import Data.Bitmap.Pixel
import Data.Bitmap.Types
import Data.List (nub)

-- | Class for searchable bitmaps
--
-- Using the functions of the 'Bitmap' class,
-- default functions are be defined for each of
-- these; of course, implementations are free
-- to define more efficient versions.
class (Bitmap bmp) => BitmapSearchable bmp where
    -- | Recursively call a function with the coordinates, row by row from the left, from
    -- the minimum, upper-left coordinates to the maximum, lower-right coordinates
    foldrCoords ::
        (Coordinates (BIndexType bmp) -> a -> a)
     -> a                             -- ^ Starting value
     -> Coordinates (BIndexType bmp)  -- ^ Minimum, upper-left coordinates
     -> Coordinates (BIndexType bmp)  -- ^ Maximum, lower-right coordinates
     -> bmp                           -- ^ The bitmap in which to scan coordinates
     -> a

    -- | Scan each pixel until a match is found in no particular order
    --
    -- Implementations are free to choose an efficient implementation that
    -- searches in a different direction from that of 'findPixelOrder'.
    -- This function is often, but not necessarily always, the same as
    -- 'findPixelOrder'.
    findPixel ::
        (BPixelType bmp -> Bool)
     -> bmp
     -> Maybe (Coordinates (BIndexType bmp))
    -- | Scan each pixel, row by row from the left, starting at the given offset, until a match is found
    findPixelOrder ::
        (BPixelType bmp -> Bool)
     -> bmp
     -> Coordinates (BIndexType bmp)
     -> Maybe (Coordinates (BIndexType bmp))
    -- | A more restricted version of 'findPixelEqual' that is usually more efficient when exact equality is desired
    findPixelEqual ::
        BPixelType bmp
     -> bmp
     -> Coordinates (BIndexType bmp)
     -> Maybe (Coordinates (BIndexType bmp))
    findPixels ::
        (BPixelType bmp -> Bool)
     -> bmp
     -> Coordinates (BIndexType bmp)
     -> [Coordinates (BIndexType bmp)]
    findPixelsEqual ::
        BPixelType bmp
     -> bmp
     -> Coordinates (BIndexType bmp)
     -> [Coordinates (BIndexType bmp)]

    -- | Search for coordinates where a sub-bitmap would match
    --
    -- Each coordinate, representing the upper-left-most corner,
    -- for which the sub-bitmap would fit is tried for a match until
    -- the function returns 'True' for every pixel that is compared.
    -- The function is passed the pixel of the super bitmap which is searched
    -- as the first parameter, and the pixel of the sub bitmap is passed
    -- as the second parameter.  Likewise, the super bitmap is then given
    -- to this function as the second parameter, and then the sub bitmap.
    -- Normally, the order in which the bitmap is checked in the same order
    -- as 'findPixelOrder', but implementation are free to implement this
    -- in whatever order is convenient or efficient; implementation should,
    -- however, assume that callers usually expect this order to be the most
    -- efficient one.
    findSubBitmap ::
        (BPixelType bmp -> BPixelType bmp -> Bool)
     -> bmp  -- ^ Super bitmap
     -> bmp  -- ^ Sub bitmap
     -> Maybe (Coordinates (BIndexType bmp))
    findSubBitmapOrder ::
        (BPixelType bmp -> BPixelType bmp -> Bool)
     -> bmp  -- ^ Super bitmap
     -> bmp  -- ^ Sub bitmap
     -> Coordinates (BIndexType bmp)
     -> Maybe (Coordinates (BIndexType bmp))

    -- | A more restricted version of 'findSubBitmapEqual' that is usually more efficient when exact equality is desired
    findSubBitmapEqual ::
        bmp  -- ^ Super bitmap
     -> bmp  -- ^ Sub bitmap
     -> Coordinates (BIndexType bmp)
     -> Maybe (Coordinates (BIndexType bmp))
    findSubBitmaps ::
        (BPixelType bmp -> BPixelType bmp -> Bool)
     -> bmp  -- ^ Super bitmap
     -> bmp  -- ^ Sub bitmap
     -> Coordinates (BIndexType bmp)
     -> [(Coordinates (BIndexType bmp))]
    findSubBitmapsEqual ::
        bmp  -- ^ Super bitmap
     -> bmp  -- ^ Sub bitmap
     -> Coordinates (BIndexType bmp)
     -> [(Coordinates (BIndexType bmp))]

    -- | Find the first bitmap from the list that matches with
    -- the area of the same size from the given coordinate in
    -- the "super" bitmap (passed as the second argument)
    -- down-right (the coordinate is the first pixel which is
    -- the top-left most of the area to check).  The match
    -- sub-bitmap and its index in the list are passed in
    -- the opposite order given in this description to the
    -- function, and the result is returned; if one is found.
    -- If no match is found, 'Nothing' is returned.
    --
    -- The "sub" bitmaps are tested in order until a match is
    -- found, and if one is, its index in the list is
    -- returned.  Each pixel in every "sub" bitmap is specially
    -- colored to represent a particular function.  These
    -- colors are recognized:
    --
    -- - black / greatest intensity: the corresponding pixel in
    -- the "super" bitmap based on position can be any color.
    -- - white / least intensity: the corresponding pixel in the
    -- super bitmap must be the same color as every other pixel
    -- in the super bitmap that also corresponds to a white pixel.
    --
    -- - red / FF0000 / completely red: if there are white
    -- pixels in the sub bitmap, the corresponding pixel of the
    -- red pixel should be different from the color that
    -- corresponds to the white pixels.
    --
    -- - green / 00FF00 / complete green: if there are white pixels
    -- in the sub bitmap, the corresponding pixel of the
    -- green pixel should not be similar from the color
    -- that corresponds to the white pixels.  See
    --
    -- - yellow / FFFF00 / complete yellow: if there are white pixels,
    -- this matches iff the color is similar to the colors that
    -- correspond to the white pixels.
    --
    -- 'areColorsSimilar' to see whether two colors are
    -- considered to be "similar".
    --
    -- The behaviour when any other pixel is encountered is
    -- undefined.
    --
    -- When the dimensions of a sub bitmap are too large for the
    -- super bitmap offset by the coordinates, where otherwise
    -- some pixels of the sub bitmap would not have any
    -- corresponding pixels in the super bitmap; then the sub
    -- bitmap simply does not match.
    --
    -- This function makes OCR with a known and static font
    -- more convenient to implement.
    findEmbeddedBitmap ::
     (Integral i)
     => [bmp]
     -> bmp  -- ^ Super bitmap
     -> Coordinates (BIndexType bmp)  -- ^ Coordinates relative to super bitmap
     -> Maybe (i, bmp)

    -- | 'foldr' equivalent of 'findEmbeddedBitmap' for a horizontal string of embedded bitmaps
    --
    -- This is particularly convenient for OCR with a static and known font with multiple characters.
    findEmbeddedBitmapString ::
     (Integral i)
     => ((i, bmp) -> a -> a)
     -> a
     -> [bmp]
     -> bmp  -- ^ Super bitmap
     -> Coordinates (BIndexType bmp)
     -> a

    -- | Scan for the given string of horizontally embedded bitmaps as in 'findEmbeddedBitmap'
    --
    -- As with 'findEmbeddedBitmapString', each bitmap must be adjacent to match.
    -- If the integer is passed for a dimension ("(width, height)"), then
    -- no more than "the value" extra rows or columns will be checked.
    -- For example, if 'Just' @0@ is passed for the row value, then no
    -- additional rows will be checked.
    findFixedEmbeddedBitmapString ::
        Dimensions (Maybe (BIndexType bmp))
     -> [bmp]
     -> bmp  -- ^ Super bitmap
     -> Coordinates (BIndexType bmp)
     -> Maybe (Coordinates (BIndexType bmp))

    foldrCoords f z base_i@(baseRow, _) (maxRow, maxColumn) bmp = go base_i
        where maxRow'    = min maxRow    $ pred (bitmapHeight bmp)
              maxColumn' = min maxColumn $ pred (bitmapWidth  bmp)
              go i@(row, column)
                  | column > maxColumn'
                      = go (succ row, baseRow)
                  | row    > maxRow'
                      = z
                  | otherwise
                      = i `f` go (row, succ column)

    findPixel f b = findPixelOrder f b (0, 0)

    findPixelOrder f bmp startCoords = foldrCoords step Nothing startCoords (dimensions bmp) bmp
        where step coords
                  | f $ getPixel bmp coords
                      = const $ Just coords
                  | otherwise
                      = id

    findPixelEqual p = findPixelOrder (== p)

    findPixels f b = r'
        where (width, height) = dimensions b
              maxColumn = abs . pred $ width
              maxRow    = abs . pred $ height
              nextCoordinate (row, column)
                  | column >= maxColumn = (succ row, 0)
                  | otherwise           = (row, succ column)
              r' i      =
                  case findPixelOrder f b i of
                      (Just i'@(row, column)) ->
                          if row < maxRow || column < maxColumn
                              then i' : findPixels f b (nextCoordinate i')
                              else i' : []
                      (Nothing)               ->
                          []

    findPixelsEqual p b = r'
        where (width, height) = dimensions b
              maxColumn = abs . pred $ width
              maxRow    = abs . pred $ height
              nextCoordinate (row, column)
                  | column >= maxColumn = (succ row, 0)
                  | otherwise           = (row, succ column)
              r' i      =
                  case findPixelEqual p b i of
                      (Just i'@(row, column)) ->
                          if row < maxRow || column < maxColumn
                              then i' : findPixelsEqual p b (nextCoordinate i')
                              else i' : []
                      (Nothing)               ->
                          []

    findSubBitmap f super sub = findSubBitmapOrder f super sub (0, 0)

    findSubBitmapOrder f super sub = r'
        where r' i@(row, column)
                  | column > maxColumn =
                      r' (succ row, 0)
                  | row    > maxRow    =
                      Nothing
                  | matches (0, 0)     =
                      Just i
                  | otherwise          =
                      r' (row, succ column)
                  where matches offi@(offRow, offColumn)
                            | offColumn > maxOffColumn                                                        =
                                matches (succ offRow, 0)
                            | offRow    > maxOffRow                                                           =
                                True
                            | not $ f (getPixel super (row + offRow, column + offColumn)) (getPixel sub offi) =
                                False
                            | otherwise                                                                       =
                                matches (offRow, succ offColumn)

              (widthSuper, heightSuper)  = dimensions super
              (widthSub,   heightSub)    = dimensions sub
              (maxRow,     maxColumn)    = (heightSuper - heightSub, widthSuper - widthSub)
              (maxOffRow,  maxOffColumn) = (abs . pred $ heightSub, abs . pred $ widthSub)

    findSubBitmapEqual = findSubBitmapOrder (==)

    findSubBitmaps f super sub = r'
        where (widthSuper, heightSuper) = dimensions super
              (widthSub,   heightSub)   = dimensions sub
              (maxRow,     maxColumn)   = (heightSuper - heightSub, widthSuper - widthSub)
              nextCoordinate (row, column)
                  | column >= maxColumn = (succ row, 0)
                  | otherwise           = (row, succ column)
              r' i =
                  case findSubBitmapOrder f super sub i of
                      (Just i'@(row, column)) ->
                          if row < maxRow || column < maxColumn
                              then i' : findSubBitmaps f super sub (nextCoordinate i')
                              else i' : []
                      (Nothing)               ->
                          []

    findSubBitmapsEqual super sub = r'
        where (widthSuper, heightSuper) = dimensions super
              (widthSub,   heightSub)   = dimensions sub
              (maxRow,     maxColumn)   = (heightSuper - heightSub, widthSuper - widthSub)
              nextCoordinate (row, column)
                  | column >= maxColumn = (succ row, 0)
                  | otherwise           = (row, succ column)
              r' i =
                  case findSubBitmapEqual super sub i of
                      (Just i'@(row, column)) ->
                          if row < maxRow || column < maxColumn
                              then i' : findSubBitmapsEqual super sub (nextCoordinate i')
                              else i' : []
                      (Nothing)               ->
                          []

    findEmbeddedBitmap allEmbs super (row, column) = r' 0 allEmbs
        where pixAny  = matchPixelAny
              pixSame = matchPixelSame
              pixThrs = matchPixelSameThreshold
              pixDif  = matchPixelDif
              pixDft  = matchPixelDifThreshold
              dimensionsSuper = dimensions super
              r' _ []     = Nothing
              r' n (e:es)
                  | True <- dimensionsFit dimensionsSuper (widthSub + column, heightSub + row)
                  , True <- matches Nothing [] [] [] (0, 0)
                      = Just $ (n, e)
                  | otherwise
                      = r' (succ n) es
                  -- difColors is necessary because red pixels could be encountered first, so we keep track of every color of every red pixel until we encounter a white pixel, and then we can empty the list after we check whether the first color is part of the list; for efficiency we always eliminate duplicates
                  where matches matchColor difColors dftColors thrsColors offi@(offRow, offColumn)
                            | offColumn > maxOffColumn
                                = matches matchColor difColors dftColors thrsColors (succ offRow, 0)
                            | offRow    > maxOffRow
                                = True
                            | (False, _,           _,          _,          _)           <- posCondition
                                = False
                            | (_,     matchColor', difColors', dftColors', thrsColors') <- posCondition
                                = matches matchColor' difColors' dftColors' thrsColors' (offRow, succ offColumn)
                            where posCondition
                                      | subPixel == pixAny
                                          -- Any pixel (black in sub)
                                          = (True, matchColor, difColors, dftColors, thrsColors)
                                      | True               <- subPixel == pixSame
                                      , (Just matchColor') <- matchColor
                                          -- Match pixel (white in sub); matching color already set
                                          = (superPixel == matchColor', matchColor, difColors, dftColors, thrsColors)  -- difColors + dftColors should already be empty
                                      | True               <- subPixel == pixSame
                                          -- First match pixel (white in sub); record matching color
                                          = ((not $ superPixel `elem` difColors) && (not $ any (`areColorsSimilar` superPixel) dftColors) && (all (`areColorsSimilar` superPixel) thrsColors), Just superPixel, [], [], [])
                                      | True               <- subPixel == pixDif
                                      , (Just matchColor') <- matchColor
                                          -- Dif pixel (completely red in sub); matching color found
                                          = (superPixel /= matchColor', matchColor, difColors, dftColors, thrsColors)  -- difColors + dftColors should already be empty
                                      | True               <- subPixel == pixDif
                                          -- Dif pixel (completely red in sub); matching color not yet found
                                          = (True, matchColor, nub $ superPixel : difColors, dftColors, thrsColors)
                                      | True               <- subPixel == pixDft
                                      , (Just matchColor') <- matchColor
                                          -- Dft pixel (completely green in sub); matching color found
                                          = (not $ superPixel `areColorsSimilar` matchColor', matchColor, difColors, dftColors, thrsColors)  -- difColors + dftColors should already be empty
                                      | True               <- subPixel == pixDft
                                          -- Dft pixel (completely green in sub); matching color not yet found
                                          = (True, matchColor, difColors, nub $ superPixel : dftColors, thrsColors)
                                      | True               <- subPixel == pixThrs
                                      , (Just matchColor') <- matchColor
                                          -- Thrs pixel (completely yellow in sub); matching color found
                                          = (superPixel `areColorsSimilar` matchColor', matchColor, difColors, dftColors, thrsColors)  -- difColors + dftColors should already be empty
                                      | True               <- subPixel == pixThrs
                                          -- Thrs pixel (completely yellow in sub); matching color not yet found
                                          = (True, matchColor, difColors, dftColors, nub $ superPixel : thrsColors)
                                      | otherwise
                                          -- undefined pixel in sub bitmap
                                          = (False, matchColor, difColors, dftColors, thrsColors)
                                      where superPixel = getPixel super (row + offRow, column + offColumn)
                                            subPixel   = getPixel e     offi

                        (widthSub,   heightSub)    = dimensions e
                        (maxOffRow,  maxOffColumn) = (abs . pred $ heightSub, abs . pred $ widthSub)

    findEmbeddedBitmapString f z allEmbs super = go
        where go pos@(row, column) =
                  case findEmbeddedBitmap allEmbs super pos of
                      (Nothing)         -> z
                      (Just r@(_, bmp)) -> r `f` go (row, column + (max 1 $ bitmapWidth bmp))

    findFixedEmbeddedBitmapString (extraRowsW, extraColumnsW) allEmbs super base_i@(base_row, base_column) =
        foldrCoords step zero base_i (base_row + extraRows, base_column + extraColumns) super
        where maxRow    = abs . pred $ bitmapHeight super
              maxColumn = abs . pred $ bitmapWidth  super
              maxExtraRows    = maxRow    - base_row
              maxExtraColumns = maxColumn - base_column
              extraRows    = maybe maxExtraRows    (max 0 . min maxExtraRows)    extraRowsW
              extraColumns = maybe maxExtraColumns (max 0 . min maxExtraColumns) extraColumnsW
              zero = Nothing
              step i a
                  | textFound i = Just i
                  | otherwise   = a
              textFound = go allEmbs
              go []     _               = True
              go (e:es) i@(row, column)
                  | (Just (_ :: Int, _)) <- findEmbeddedBitmap [e] super i
                      = go es (row, column + bitmapWidth e)
                  | otherwise
                      = False

instance (Bitmap a) => BitmapSearchable a

-- | Binary similarity comparison
--
-- This function considers two colors to be "similar" if their difference
-- according to the CIE94 algorithm (see 'colorDifferenceCIE94') is less than
-- 23.
areColorsSimilar :: (Pixel p) => p -> p -> Bool
areColorsSimilar a b =
    let d :: Double
        d = colorDifferenceCIE94 a b
    in  d <= 23

-- | Approximate difference in color according to the CIE94 algorithm
colorDifferenceCIE94 :: (Pixel p, RealFloat n, Ord n) => p -> p -> n
colorDifferenceCIE94 pa pb =
    let sq x = x * x

        rgb_ra = (fromIntegral $ red   <: pa) / 255.0
        rgb_rb = (fromIntegral $ red   <: pb) / 255.0
        rgb_ga = (fromIntegral $ green <: pa) / 255.0
        rgb_gb = (fromIntegral $ green <: pb) / 255.0
        rgb_ba = (fromIntegral $ blue  <: pa) / 255.0
        rgb_bb = (fromIntegral $ blue  <: pb) / 255.0

        f x
            | x > 0.04045 = 100 * ((x + 0.055) / 1.055) ** 2.4
            | otherwise   = 100 * x / 12.92

        rgb_ra' = f rgb_ra
        rgb_rb' = f rgb_rb
        rgb_ga' = f rgb_ga
        rgb_gb' = f rgb_gb
        rgb_ba' = f rgb_ba
        rgb_bb' = f rgb_bb

        xa = 0.4124 * rgb_ra' + 0.3576 * rgb_ga' + 0.1805 * rgb_ba'
        xb = 0.4124 * rgb_rb' + 0.3576 * rgb_gb' + 0.1805 * rgb_bb'
        ya = 0.2126 * rgb_ra' + 0.7152 * rgb_ga' + 0.0722 * rgb_ba'
        yb = 0.2126 * rgb_rb' + 0.7152 * rgb_gb' + 0.0722 * rgb_bb'
        za = 0.0193 * rgb_ra' + 0.1192 * rgb_ga' + 0.9505 * rgb_ba'
        zb = 0.0193 * rgb_rb' + 0.1192 * rgb_gb' + 0.9505 * rgb_bb'

        g x
            | x > 0.008856 = x ** (1/3)
            | otherwise    = 7.787 * x + 16 / 116

        xa' = g $ xa / 95.047
        xb' = g $ xb / 95.047
        ya' = g $ ya / 100
        yb' = g $ yb / 100
        za' = g $ za / 108.883
        zb' = g $ zb / 108.883

        la = (116 * ya') - 16
        lb = (116 * yb') - 16
        aa = 500 * (xa' - ya')
        ab = 500 * (xb' - yb')
        ba = 200 * (ya' - za')
        bb = 200 * (yb' - zb')

        kl = 1
        k1 = 0.045
        k2 = 0.015

        h r
            | r >= 0 = r
            | otherwise = 2 * pi - (min 0 $ abs r)

        ca = sqrt (sq aa + sq ba)
        cb = sqrt (sq ab + sq bb)
        ha = h $ atan2 ba aa
        hb = h $ atan2 bb ab
    in  sqrt $ (sq $ (lb - la) / kl) + (sq $ (cb - ca) / (1 + k1 * ca)) + (sq $ (ha - hb) / (1 + k2 * ca))

-- | Default transparent pixel value; FF007E
defaultTransparentPixel :: (Pixel p) => p
defaultTransparentPixel =
    (red   =: 0xFF)
  . (green =: 0x00)
  . (blue  =: 0x7E)
  $ leastIntensity

matchPixelAny :: (Pixel p) => p
matchPixelAny = leastIntensity

matchPixelSame :: (Pixel p) => p
matchPixelSame = greatestIntensity

matchPixelSameThreshold :: (Pixel p) => p
matchPixelSameThreshold =
      (red   =: 0xFF)
    . (green =: 0xFF)
    . (blue  =: 0x00)
    $ leastIntensity

matchPixelDif :: (Pixel p) => p
matchPixelDif =
      (red   =: 0xFF)
    . (green =: 0x00)
    . (blue  =: 0x00)
    $ leastIntensity

matchPixelDifThreshold :: (Pixel p) => p
matchPixelDifThreshold =
      (red   =: 0x00)
    . (green =: 0xFF)
    . (blue  =: 0x00)
    $ leastIntensity


text:
<!DOCTYPE html>

[]