text:
#ifndef SOCKETLITE_OBJECT_POOL_H
#define SOCKETLITE_OBJECT_POOL_H

#if defined(_MSC_VER) && (_MSC_VER >= 1200)
    #pragma once
#endif
#include <list>
#include "SL_DataType.h"

template <typename T, typename TSyncMutex>
class SL_ObjectPool
{
public:
    inline SL_ObjectPool()
    {
    }

    inline ~SL_ObjectPool()
    {
    }

    inline int init(unsigned int max_size=100000, unsigned int init_size=0, unsigned int grow_size=10)
    {
        return 0;
    }

    inline T* alloc_object()
    {
        T *object = new T();
        return object;
    }

    inline void free_object(T *object)
    {
        delete object;
    }
};

template <typename T, typename TSyncMutex>
class SL_ObjectPool_Simple
{
private:
    SL_ObjectPool_Simple(const SL_ObjectPool_Simple &);
    void operator= (const SL_ObjectPool_Simple &);

public:
    inline SL_ObjectPool_Simple()
        : max_size_(100000)
        , grow_size_(10)
        , free_size_(0)
    {
    }

    inline ~SL_ObjectPool_Simple()
    {
        clear();
    }

    inline int clear()
    {
        mutex_.lock();
        typename std::list<T *>::iterator iter = free_objects_.begin();
        typename std::list<T *>::iterator iter_end = free_objects_.end();
        for (; iter != iter_end; ++iter)
        {
            delete *iter;
        }
        free_objects_.clear();
        free_size_ = 0;
        mutex_.unlock();
        return 0;
    }

    inline int init(unsigned int max_size=100000, unsigned int init_size=0, unsigned int grow_size=10)
    {
        clear();
        if (grow_size < 1)
        {
            grow_size = 1;
        }
        if (init_size>max_size)
        {
            init_size = max_size;
        }
        if (grow_size>max_size)
        {
            grow_size = max_size;
        }

        mutex_.lock();
        max_size_   = max_size;
        grow_size_  = grow_size;
        alloc_i(init_size);
        mutex_.unlock();
        return 0;
    }

    inline T* alloc_object()
    {
        T *object;
        mutex_.lock();
        if (!free_objects_.empty())
        {
            object = free_objects_.back();
            free_objects_.pop_back();
            --free_size_;
        }
        else
        {
            object = new T();
            if (NULL == object)
            {
                mutex_.unlock();
                return NULL;
            }
            alloc_i(grow_size_);
        }
        mutex_.unlock();
        return object;
    }

    inline void free_object(T *object)
    {
        mutex_.lock();
        if (free_size_ < max_size_)
        {
            free_objects_.push_back(object);
            ++free_size_;
        }
        else
        {
            delete object;
        }
        mutex_.unlock();
    }

private:
    inline bool alloc_i(unsigned int size)
    {
        T *object;
        for (unsigned int i=0; i<size; ++i)
        {
            object = new T();
            if (NULL == object)
            {
                return false;
            }
            free_objects_.push_back(object);
            ++free_size_;
        }
        return true;
    }

private:
    unsigned int    max_size_;   //¶ÔÏó³Ø×î´óÈÝÁ¿
    unsigned int    grow_size_;  //Ôö³¤·ù¶È
    unsigned int    free_size_;

    TSyncMutex      mutex_;
    std::list<T* >  free_objects_;
};

template <typename T, typename TSyncMutex>
class SL_ObjectPool_SimpleEx
{
private:
    SL_ObjectPool_SimpleEx(const SL_ObjectPool_SimpleEx &);
    void operator= (const SL_ObjectPool_SimpleEx &);

public:
    inline SL_ObjectPool_SimpleEx()
        : max_chunk_size_(10000)
        , per_chunk_size_(10)
        , current_chunk_size_(0)
    {
    }

    inline ~SL_ObjectPool_SimpleEx()
    {
        clear();
    }

    inline int clear()
    {
        mutex_.lock();
        if (current_chunk_size_ > 0)
        {
            typename std::list<T *>::iterator iter = object_chunks_.begin();
            typename std::list<T *>::iterator iter_end = object_chunks_.end();
            for (; iter != iter_end; ++iter)
            {
                delete [](*iter);
            }
            object_chunks_.clear();
        }
        free_objects_.clear();
        current_chunk_size_ = 0;
        mutex_.unlock();
        return 0;
    }

    inline int init(unsigned int max_chunk_size=10000, unsigned int init_chunk_size=0, unsigned int per_chunk_size=10)
    {
        clear();
        if (init_chunk_size > max_chunk_size)
        {
            init_chunk_size = max_chunk_size;
        }

        mutex_.lock();
        max_chunk_size_ = max_chunk_size;
        per_chunk_size_ = per_chunk_size;
        for (unsigned int i=0; i<init_chunk_size; ++i)
        {
            alloc_i();
        }
        mutex_.unlock();
        return 0;
    }

    inline T* alloc_object()
    {
        T *object;
        mutex_.lock();
        if (!free_objects_.empty())
        {
            object = free_objects_.back();
            free_objects_.pop_back();
            mutex_.unlock();
            return object;
        }
        if (current_chunk_size_ >= max_chunk_size_)
        {
            mutex_.unlock();
            return NULL;
        }
        if (!alloc_i())
        {
            mutex_.unlock();
            return NULL;
        }
        if (!free_objects_.empty())
        {
            object = free_objects_.back();
            free_objects_.pop_back();
            mutex_.unlock();
            return object;
        }
        mutex_.unlock();
        return NULL;
    }

    inline void free_object(T *object)
    {
        mutex_.lock();
        free_objects_.push_back(object);
        mutex_.unlock();
    }

private:
    inline bool alloc_i()
    {
        T *chunk = new T[per_chunk_size_];
        if (NULL == chunk)
        {
            return false;
        }
        for(unsigned int i=0; i<per_chunk_size_; ++i)
        {
            free_objects_.push_back(&chunk[i]);
        }
        object_chunks_.push_back(chunk);
        ++current_chunk_size_;
        return true;
    }

    unsigned int    max_chunk_size_;      //¶ÔÏó³Ø×î´ó¿éÊý
    unsigned int    per_chunk_size_;      //ÿ¿éÖжÔÏóÊý
    unsigned int    current_chunk_size_;

    TSyncMutex      mutex_;
    std::list<T* >  free_objects_;
    std::list<T* >  object_chunks_;
};

#endif


text:
namespace REMulti
{
    partial class RELimit
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.lpOutput = new RE.RELinkPoint();
            this.lpInput = new RE.RELinkPoint();
            this.lpEcho = new RE.RELinkPoint();
            this.lpIndex = new RE.RELinkPoint();
            this.panItemClient.SuspendLayout();
            this.SuspendLayout();
            //
            // panItemClient
            //
            this.panItemClient.Controls.Add(this.lpOutput);
            this.panItemClient.Controls.Add(this.lpInput);
            this.panItemClient.Controls.Add(this.lpEcho);
            this.panItemClient.Controls.Add(this.lpIndex);
            this.panItemClient.Size = new System.Drawing.Size(110, 46);
            //
            // lpOutput
            //
            this.lpOutput.AllowDrop = true;
            this.lpOutput.Caption = "output";
            this.lpOutput.ConnectedTo = null;
            this.lpOutput.ConnectionColor = System.Drawing.Color.Transparent;
            this.lpOutput.Direction = RE.RELinkPointDirection.Output;
            this.lpOutput.Key = "output";
            this.lpOutput.Location = new System.Drawing.Point(58, 26);
            this.lpOutput.Name = "lpOutput";
            this.lpOutput.Size = new System.Drawing.Size(48, 16);
            this.lpOutput.TabIndex = 7;
            //
            // lpInput
            //
            this.lpInput.AllowDrop = true;
            this.lpInput.Caption = "input";
            this.lpInput.ConnectedTo = null;
            this.lpInput.ConnectionColor = System.Drawing.Color.Transparent;
            this.lpInput.Direction = RE.RELinkPointDirection.Input;
            this.lpInput.Key = "input";
            this.lpInput.Location = new System.Drawing.Point(4, 26);
            this.lpInput.Name = "lpInput";
            this.lpInput.Size = new System.Drawing.Size(48, 16);
            this.lpInput.TabIndex = 6;
            this.lpInput.Signal += new RE.RELinkPointSignal(this.lpInput_Signal);
            //
            // lpEcho
            //
            this.lpEcho.AllowDrop = true;
            this.lpEcho.Caption = "echo";
            this.lpEcho.ConnectedTo = null;
            this.lpEcho.ConnectionColor = System.Drawing.Color.Transparent;
            this.lpEcho.Direction = RE.RELinkPointDirection.Output;
            this.lpEcho.Key = "echo";
            this.lpEcho.Location = new System.Drawing.Point(58, 3);
            this.lpEcho.Name = "lpEcho";
            this.lpEcho.Size = new System.Drawing.Size(48, 16);
            this.lpEcho.TabIndex = 5;
            //
            // lpIndex
            //
            this.lpIndex.AllowDrop = true;
            this.lpIndex.Caption = "index";
            this.lpIndex.ConnectedTo = null;
            this.lpIndex.ConnectionColor = System.Drawing.Color.Transparent;
            this.lpIndex.Direction = RE.RELinkPointDirection.Input;
            this.lpIndex.Key = "index";
            this.lpIndex.Location = new System.Drawing.Point(4, 3);
            this.lpIndex.Name = "lpIndex";
            this.lpIndex.Size = new System.Drawing.Size(48, 16);
            this.lpIndex.TabIndex = 4;
            this.lpIndex.Signal += new RE.RELinkPointSignal(this.lpIndex_Signal);
            //
            // RELimit
            //
            this.Caption = "Limit";
            this.Name = "RELimit";
            this.Resizable = false;
            this.Size = new System.Drawing.Size(117, 71);
            this.panItemClient.ResumeLayout(false);
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private RE.RELinkPoint lpOutput;
        private RE.RELinkPoint lpInput;
        private RE.RELinkPoint lpEcho;
        private RE.RELinkPoint lpIndex;
    }
}

redpajama_set_name: RedPajamaGithub


text:
drop index ix_bar_foo_id;
alter table bar drop constraint fk_bar_foo_id;

drop index ix_o_address_country_code;
alter table o_address drop constraint fk_o_address_country_code;

drop index ix_animals_shelter_id;
alter table animals drop constraint fk_animals_shelter_id;

drop index ix_attribute_attribute_holder_id;
alter table attribute drop constraint fk_attribute_attribute_holder_id;

drop index ix_bbookmark_user_id;
alter table bbookmark drop constraint fk_bbookmark_user_id;

drop index ix_drel_booking_agent_invoice;
alter table drel_booking drop constraint fk_drel_booking_agent_invoice;

drop index ix_drel_booking_client_invoice;
alter table drel_booking drop constraint fk_drel_booking_client_invoice;

drop index ix_ckey_detail_one_key_two_key;
alter table ckey_detail drop constraint fk_ckey_detail_ckey_parent;

drop index ix_ckey_parent_assoc_id;
alter table ckey_parent drop constraint fk_ckey_parent_assoc_id;

drop index ix_calculation_result_product_configuration_id;
alter table calculation_result drop constraint fk_calculation_result_product_configuration_id;

drop index ix_calculation_result_group_configuration_id;
alter table calculation_result drop constraint fk_calculation_result_group_configuration_id;

drop index ix_sp_car_car_wheels_car;
alter table sp_car_car_wheels drop constraint fk_sp_car_car_wheels_sp_car_car;

drop index ix_sp_car_car_wheels_wheel;
alter table sp_car_car_wheels drop constraint fk_sp_car_car_wheels_sp_car_wheel;

drop index ix_car_accessory_car_id;
alter table car_accessory drop constraint fk_car_accessory_car_id;

drop index ix_configuration_configurations_id;
alter table configuration drop constraint fk_configuration_configurations_id;

drop index ix_contact_customer_id;
alter table contact drop constraint fk_contact_customer_id;

drop index ix_contact_group_id;
alter table contact drop constraint fk_contact_group_id;

drop index ix_contact_note_contact_id;
alter table contact_note drop constraint fk_contact_note_contact_id;

drop index ix_c_conversation_group_id;
alter table c_conversation drop constraint fk_c_conversation_group_id;

drop index ix_o_customer_billing_address_id;
alter table o_customer drop constraint fk_o_customer_billing_address_id;

drop index ix_o_customer_shipping_address_id;
alter table o_customer drop constraint fk_o_customer_shipping_address_id;

drop index ix_eemb_inner_outer_id;
alter table eemb_inner drop constraint fk_eemb_inner_outer_id;

drop index ix_einvoice_person_id;
alter table einvoice drop constraint fk_einvoice_person_id;

drop index ix_enull_collection_detail_enull_collection_id;
alter table enull_collection_detail drop constraint fk_enull_collection_detail_enull_collection_id;

drop index ix_eopt_one_a_b_id;
alter table eopt_one_a drop constraint fk_eopt_one_a_b_id;

drop index ix_eopt_one_b_c_id;
alter table eopt_one_b drop constraint fk_eopt_one_b_c_id;

drop index ix_evanilla_collection_detail_evanilla_collection_id;
alter table evanilla_collection_detail drop constraint fk_evanilla_collection_detail_evanilla_collection_id;

drop index ix_td_child_parent_id;
alter table td_child drop constraint fk_td_child_parent_id;

drop index ix_imrelated_owner_id;
alter table imrelated drop constraint fk_imrelated_owner_id;

drop index ix_info_contact_company_id;
alter table info_contact drop constraint fk_info_contact_company_id;

drop index ix_info_customer_company_id;
alter table info_customer drop constraint fk_info_customer_company_id;

drop index ix_inner_report_forecast_id;
alter table inner_report drop constraint fk_inner_report_forecast_id;

drop index ix_drel_invoice_booking;
alter table drel_invoice drop constraint fk_drel_invoice_booking;

drop index ix_item_customer_type;
alter table item drop constraint fk_item_type;

drop index ix_item_customer_region;
alter table item drop constraint fk_item_region;

drop index ix_level1_level4_level1_id;
alter table level1_level4 drop constraint fk_level1_level4_level1;

drop index ix_level1_level4_level4_id;
alter table level1_level4 drop constraint fk_level1_level4_level4;

drop index ix_level1_level2_level1_id;
alter table level1_level2 drop constraint fk_level1_level2_level1;

drop index ix_level1_level2_level2_id;
alter table level1_level2 drop constraint fk_level1_level2_level2;

drop index ix_level2_level3_level2_id;
alter table level2_level3 drop constraint fk_level2_level3_level2;

drop index ix_level2_level3_level3_id;
alter table level2_level3 drop constraint fk_level2_level3_level3;

drop index ix_la_attr_value_attribute_la_attr_value_id;
alter table la_attr_value_attribute drop constraint fk_la_attr_value_attribute_la_attr_value;

drop index ix_la_attr_value_attribute_attribute_id;
alter table la_attr_value_attribute drop constraint fk_la_attr_value_attribute_attribute;

drop index ix_mprinter_current_state_id;
alter table mprinter drop constraint fk_mprinter_current_state_id;

drop index ix_mprinter_last_swap_cyan_id;
alter table mprinter drop constraint fk_mprinter_last_swap_cyan_id;

drop index ix_mprinter_last_swap_magenta_id;
alter table mprinter drop constraint fk_mprinter_last_swap_magenta_id;

drop index ix_mprinter_last_swap_yellow_id;
alter table mprinter drop constraint fk_mprinter_last_swap_yellow_id;

drop index ix_mprinter_last_swap_black_id;
alter table mprinter drop constraint fk_mprinter_last_swap_black_id;

drop index ix_mprinter_state_printer_id;
alter table mprinter_state drop constraint fk_mprinter_state_printer_id;

drop index ix_mprofile_picture_id;
alter table mprofile drop constraint fk_mprofile_picture_id;

drop index ix_mrole_muser_mrole_roleid;
alter table mrole_muser drop constraint fk_mrole_muser_mrole;

drop index ix_mrole_muser_muser_userid;
alter table mrole_muser drop constraint fk_mrole_muser_muser;

drop index ix_muser_user_type_id;
alter table muser drop constraint fk_muser_user_type_id;

drop index ix_c_message_conversation_id;
alter table c_message drop constraint fk_c_message_conversation_id;

drop index ix_c_message_user_id;
alter table c_message drop constraint fk_c_message_user_id;

drop index ix_mnoc_user_mnoc_role_mnoc_user_user_id;
alter table mnoc_user_mnoc_role drop constraint fk_mnoc_user_mnoc_role_mnoc_user;

drop index ix_mnoc_user_mnoc_role_mnoc_role_role_id;
alter table mnoc_user_mnoc_role drop constraint fk_mnoc_user_mnoc_role_mnoc_role;

drop index ix_mp_role_mp_user_id;
alter table mp_role drop constraint fk_mp_role_mp_user_id;

drop index ix_my_lob_size_join_many_parent_id;
alter table my_lob_size_join_many drop constraint fk_my_lob_size_join_many_parent_id;

drop index ix_o_cached_bean_country_o_cached_bean_id;
alter table o_cached_bean_country drop constraint fk_o_cached_bean_country_o_cached_bean;

drop index ix_o_cached_bean_country_o_country_code;
alter table o_cached_bean_country drop constraint fk_o_cached_bean_country_o_country;

drop index ix_o_cached_bean_child_cached_bean_id;
alter table o_cached_bean_child drop constraint fk_o_cached_bean_child_cached_bean_id;

drop index ix_oengine_car_id;
alter table oengine drop constraint fk_oengine_car_id;

drop index ix_ogear_box_car_id;
alter table ogear_box drop constraint fk_ogear_box_car_id;

drop index ix_o_order_kcustomer_id;
alter table o_order drop constraint fk_o_order_kcustomer_id;

drop index ix_o_order_detail_order_id;
alter table o_order_detail drop constraint fk_o_order_detail_order_id;

drop index ix_o_order_detail_product_id;
alter table o_order_detail drop constraint fk_o_order_detail_product_id;

drop index ix_s_order_items_order_uuid;
alter table s_order_items drop constraint fk_s_order_items_order_uuid;

drop index ix_or_order_ship_order_id;
alter table or_order_ship drop constraint fk_or_order_ship_order_id;

drop index ix_oto_child_master_id;
alter table oto_child drop constraint fk_oto_child_master_id;

drop index ix_pfile_file_content_id;
alter table pfile drop constraint fk_pfile_file_content_id;

drop index ix_pfile_file_content2_id;
alter table pfile drop constraint fk_pfile_file_content2_id;

drop index ix_paggview_pview_id;
alter table paggview drop constraint fk_paggview_pview_id;

drop index ix_pallet_location_zone_sid;
alter table pallet_location drop constraint fk_pallet_location_zone_sid;

drop index ix_parcel_location_parcelid;
alter table parcel_location drop constraint fk_parcel_location_parcelid;

drop index ix_rawinherit_parent_rawinherit_dat_rawinherit_parent_id;
alter table rawinherit_parent_rawinherit_dat drop constraint fk_rawinherit_parent_rawinherit_dat_rawinherit_parent;

drop index ix_rawinherit_parent_rawinherit_dat_rawinherit_data_id;
alter table rawinherit_parent_rawinherit_dat drop constraint fk_rawinherit_parent_rawinherit_dat_rawinherit_data;

drop index ix_c_participation_conversation_id;
alter table c_participation drop constraint fk_c_participation_conversation_id;

drop index ix_c_participation_user_id;
alter table c_participation drop constraint fk_c_participation_user_id;

drop index ix_persistent_file_content_persistent_file_id;
alter table persistent_file_content drop constraint fk_persistent_file_content_persistent_file_id;

drop index ix_person_default_address_oid;
alter table person drop constraint fk_person_default_address_oid;

drop index ix_phones_person_id;
alter table PHONES drop constraint fk_phones_person_id;

drop index ix_pp_to_ww_pp_id;
alter table pp_to_ww drop constraint fk_pp_to_ww_pp;

drop index ix_pp_to_ww_ww_id;
alter table pp_to_ww drop constraint fk_pp_to_ww_wview;

drop index ix_r_orders_company_customerName;
alter table r_orders drop constraint fk_r_orders_rcustomer;

drop index ix_resourcefile_parentresourcefileid;
alter table ResourceFile drop constraint fk_resourcefile_parentresourcefileid;

drop index ix_mt_role_tenant_id;
alter table mt_role drop constraint fk_mt_role_tenant_id;

drop index ix_mt_role_permission_mt_role_id;
alter table mt_role_permission drop constraint fk_mt_role_permission_mt_role;

drop index ix_mt_role_permission_mt_permission_id;
alter table mt_role_permission drop constraint fk_mt_role_permission_mt_permission;

drop index ix_f_second_first;
alter table f_second drop constraint fk_f_second_first;

drop index ix_section_article_id;
alter table section drop constraint fk_section_article_id;

drop index ix_self_parent_parent_id;
alter table self_parent drop constraint fk_self_parent_parent_id;

drop index ix_self_ref_customer_referred_by_id;
alter table self_ref_customer drop constraint fk_self_ref_customer_referred_by_id;

drop index ix_self_ref_example_parent_id;
alter table self_ref_example drop constraint fk_self_ref_example_parent_id;

drop index ix_stockforecast_inner_report_id;
alter table stockforecast drop constraint fk_stockforecast_inner_report_id;

drop index ix_sub_section_section_id;
alter table sub_section drop constraint fk_sub_section_section_id;

drop index ix_t_detail_with_other_namexxxyy_master_id;
alter table t_detail_with_other_namexxxyy drop constraint fk_t_detail_with_other_namexxxyy_master_id;

drop index ix_ts_detail_two_master_id;
alter table ts_detail_two drop constraint fk_ts_detail_two_master_id;

drop index ix_twheel_owner_plate_no;
alter table twheel drop constraint fk_twheel_owner_plate_no;

drop index ix_tire_wheel;
alter table tire drop constraint fk_tire_wheel;

drop index ix_trip_vehicle_driver_id;
alter table trip drop constraint fk_trip_vehicle_driver_id;

drop index ix_trip_address_id;
alter table trip drop constraint fk_trip_address_id;

drop index ix_type_sub_type_id;
alter table type drop constraint fk_type_sub_type_id;

drop index ix_ut_detail_utmaster_id;
alter table ut_detail drop constraint fk_ut_detail_utmaster_id;

drop index ix_uutwo_master_id;
alter table uutwo drop constraint fk_uutwo_master_id;

drop index ix_c_user_group_id;
alter table c_user drop constraint fk_c_user_group_id;

drop index ix_oto_user_account_id;
alter table oto_user drop constraint fk_oto_user_account_id;

drop index ix_em_user_role_user_id;
alter table em_user_role drop constraint fk_em_user_role_user_id;

drop index ix_em_user_role_role_id;
alter table em_user_role drop constraint fk_em_user_role_role_id;

drop index ix_vehicle_truck_ref_id;
alter table vehicle drop constraint fk_vehicle_truck_ref_id;

drop index ix_vehicle_car_ref_id;
alter table vehicle drop constraint fk_vehicle_car_ref_id;

drop index ix_vehicle_driver_vehicle_id;
alter table vehicle_driver drop constraint fk_vehicle_driver_vehicle_id;

drop index ix_vehicle_driver_address_id;
alter table vehicle_driver drop constraint fk_vehicle_driver_address_id;

drop index ix_warehouses_officezoneid;
alter table warehouses drop constraint fk_warehouses_officezoneid;

drop index ix_warehousesshippingzones_warehouseid;
alter table WarehousesShippingZones drop constraint fk_warehousesshippingzones_warehouses;

drop index ix_warehousesshippingzones_shippingzoneid;
alter table WarehousesShippingZones drop constraint fk_warehousesshippingzones_zones;

drop index ix_sa_wheel_tire;
alter table sa_wheel drop constraint fk_sa_wheel_tire;

drop index ix_sa_wheel_car;
alter table sa_wheel drop constraint fk_sa_wheel_car;

drop index ix_with_zero_parent_id;
alter table with_zero drop constraint fk_with_zero_parent_id;


text:
#ifndef ESRI_ARCGISRUNTIME_TOOLKIT_FLOORFITLERFLOORITEM_H
#define ESRI_ARCGISRUNTIME_TOOLKIT_FLOORFITLERFLOORITEM_H

// Qt headers
#include <QObject>

namespace Esri {
namespace ArcGISRuntime {
  class FloorLevel;

  namespace Toolkit {

    class FloorFilterLevelItem : public QObject
    {
      Q_OBJECT
      Q_PROPERTY(QString modelId READ modelId NOTIFY floorLevelChanged)
      Q_PROPERTY(QString shortName READ shortName NOTIFY floorLevelChanged)
      Q_PROPERTY(QString longName READ longName NOTIFY floorLevelChanged)
    public:
      Q_INVOKABLE explicit FloorFilterLevelItem(QObject* parent = nullptr);
      Q_INVOKABLE explicit FloorFilterLevelItem(FloorLevel* floorLevel, QObject* parent = nullptr);
      ~FloorFilterLevelItem() override;

      void setFloorLevel(FloorLevel* floorLevel);
      FloorLevel* floorLevel() const;

      QString modelId() const;
      QString shortName() const;
      QString longName() const;

    signals:
      void floorLevelChanged();

    private:
      FloorLevel* m_floorLevel = nullptr;
    };

  } // Toolkit
} // ArcGISRuntime
} // Esri

#endif // ESRI_ARCGISRUNTIME_TOOLKIT_FLOORFITLERFLOORITEM_H


text:
find_path(TESSERACT_INCLUDE_DIRS
    NAMES tesseract/capi.h
)

find_library(TESSERACT_LIBRARIES
    NAMES tesseract
)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LIBTESSERACT REQUIRED_VARS TESSERACT_INCLUDE_DIRS TESSERACT_LIBRARIES)

mark_as_advanced(TESSERACT_INCLUDE_DIRS TESSERACT_LIBRARIES)


text:
#ifndef _GEN6_MFC_H_
#define _GEN6_MFC_H_

#include <drm.h>
#include <i915_drm.h>
#include <intel_bufmgr.h>

#include "i965_gpe_utils.h"
#include "i965_encoder.h"

struct encode_state;

#define MAX_MFC_REFERENCE_SURFACES      16
#define NUM_MFC_DMV_BUFFERS             34

#define INTRA_MB_FLAG_MASK              0x00002000

/* The space required for slice header SLICE_STATE + header.
 * Is it enough? */
#define SLICE_HEADER			80

/* the space required for slice tail. */
#define SLICE_TAIL			16

#define __SOFTWARE__    0

#define MFC_BATCHBUFFER_AVC_INTRA       0
#define MFC_BATCHBUFFER_AVC_INTER       1
#define NUM_MFC_KERNEL                  2

#define BIND_IDX_VME_OUTPUT             0
#define BIND_IDX_MFC_SLICE_HEADER       1
#define BIND_IDX_MFC_BATCHBUFFER        2

#define CMD_LEN_IN_OWORD        4

#define BRC_CLIP(x, min, max)                                   \
    {                                                           \
        x = ((x > (max)) ? (max) : ((x < (min)) ? (min) : x));  \
    }

#define BRC_P_B_QP_DIFF 4
#define BRC_I_P_QP_DIFF 2
#define BRC_I_B_QP_DIFF (BRC_I_P_QP_DIFF + BRC_P_B_QP_DIFF)

#define BRC_PWEIGHT 0.6  /* weight if P slice with comparison to I slice */
#define BRC_BWEIGHT 0.25 /* weight if B slice with comparison to I slice */

#define BRC_QP_MAX_CHANGE 5 /* maximum qp modification */
#define BRC_CY 0.1 /* weight for */
#define BRC_CX_UNDERFLOW 5.
#define BRC_CX_OVERFLOW -4.

#define BRC_PI_0_5 1.5707963267948966192313216916398

typedef enum {
   VME_V_PRED = 0,
   VME_H_PRED = 1,
   VME_DC_PRED = 2,
   VME_PL_PRED = 3,

   VME_MB_INTRA_MODE_COUNT
} VME_MB_INTRA_PRED_MODE;

typedef enum {
   PAK_DC_PRED = 0,
   PAK_V_PRED = 1,
   PAK_H_PRED = 2,
   PAK_TM_PRED = 3,

   PAK_MB_INTRA_MODE_COUNT
} VP8_PAK_MB_INTRA_PRED_MODE;

typedef enum
{
    VME_B_V_PRED = 0,
    VME_B_H_PRED = 1,
    VME_B_DC_PRED = 2,
    VME_B_DL_PRED = 3,
    VME_B_DR_PRED = 4,
    VME_B_VR_PRED = 5,
    VME_B_HD_PRED = 6,
    VME_B_VL_PRED = 7,
    VME_B_HU_PRED = 8,

    VME_B_INTRA_MODE_COUNT
} VME_BLOCK_INTRA_PRED_MODE;

typedef enum
{
    PAK_B_DC_PRED = 0,
    PAK_B_TM_PRED = 1,
    PAK_B_VE_PRED = 2,
    PAK_B_HE_PRED = 3,
    PAK_B_LD_PRED = 4,
    PAK_B_RD_PRED = 5,
    PAK_B_VR_PRED = 6,
    PAK_B_VL_PRED = 7,
    PAK_B_HD_PRED = 8,
    PAK_B_HU_PRED = 9,

    PAK_B_INTRA_MODE_COUNT
} VP8_PAK_BLOCK_INTRA_PRED_MODE;

typedef struct
{
  int vme_intra_mb_mode;
  int vp8_pak_intra_mb_mode;
} vp8_intra_mb_mode_map_t;

typedef struct
{
  int vme_intra_block_mode;
  int vp8_pak_intra_block_mode;
} vp8_intra_block_mode_map_t;

typedef enum _gen6_brc_status
{
    BRC_NO_HRD_VIOLATION = 0,
    BRC_UNDERFLOW = 1,
    BRC_OVERFLOW = 2,
    BRC_UNDERFLOW_WITH_MAX_QP = 3,
    BRC_OVERFLOW_WITH_MIN_QP = 4,
} gen6_brc_status;

struct gen6_mfc_avc_surface_aux
{
    dri_bo *dmv_top;
    dri_bo *dmv_bottom;
};

struct gen6_mfc_context
{
    struct {
        unsigned int width;
        unsigned int height;
        unsigned int w_pitch;
        unsigned int h_pitch;
    } surface_state;

    //MFX_PIPE_BUF_ADDR_STATE
    struct {
        dri_bo *bo;
    } post_deblocking_output;           //OUTPUT: reconstructed picture

    struct {
        dri_bo *bo;
    } pre_deblocking_output;            //OUTPUT: reconstructed picture with deblocked

    struct {
        dri_bo *bo;
    } uncompressed_picture_source;      //INPUT: original compressed image

    struct {
        dri_bo *bo;
    } intra_row_store_scratch_buffer;   //INTERNAL:

    struct {
        dri_bo *bo;
    } macroblock_status_buffer;         //INTERNAL:

    struct {
        dri_bo *bo;
    } deblocking_filter_row_store_scratch_buffer;       //INTERNAL:

    struct {
        dri_bo *bo;
    } reference_surfaces[MAX_MFC_REFERENCE_SURFACES];   //INTERNAL: refrence surfaces

    //MFX_IND_OBJ_BASE_ADDR_STATE
    struct{
        dri_bo *bo;
    } mfc_indirect_mv_object;           //INPUT: the blocks' mv info

    struct {
        dri_bo *bo;
        int offset;
        int end_offset;
    } mfc_indirect_pak_bse_object;      //OUTPUT: the compressed bitstream

    //MFX_BSP_BUF_BASE_ADDR_STATE
    struct {
        dri_bo *bo;
    } bsd_mpc_row_store_scratch_buffer; //INTERNAL:

    //MFX_AVC_DIRECTMODE_STATE
    struct {
        dri_bo *bo;
    } direct_mv_buffers[NUM_MFC_DMV_BUFFERS];   //INTERNAL: 0-31 as input,32 and 33 as output

    //Bit rate tracking context
    struct {
        unsigned int QpPrimeY;
        unsigned int MaxQpNegModifier;
        unsigned int MaxQpPosModifier;
        unsigned char MaxSizeInWord;
        unsigned char TargetSizeInWord;
        unsigned char Correct[6];
        unsigned char GrowInit;
        unsigned char GrowResistance;
        unsigned char ShrinkInit;
        unsigned char ShrinkResistance;

        unsigned int target_mb_size;
        unsigned int target_frame_size;
    } bit_rate_control_context[3];      //INTERNAL: for I, P, B frames

    struct {
        int mode;
        int gop_nums[3];
        int target_frame_size[3]; // I,P,B
        double bits_per_frame;
        double qpf_rounding_accumulator;

        double saved_bps;
        double saved_fps;
        int saved_intra_period;
        int saved_ip_period;
        int saved_idr_period;
    } brc;

    struct {
        double current_buffer_fullness;
        double target_buffer_fullness;
        double buffer_capacity;
        unsigned int buffer_size;
        unsigned int violation_noted;
    } hrd;

    //HRD control context
    struct {
        int i_bit_rate_value;
        int i_cpb_size_value;

        int i_initial_cpb_removal_delay;
        int i_cpb_removal_delay;

        int i_frame_number;

        int i_initial_cpb_removal_delay_length;
        int i_cpb_removal_delay_length;
        int i_dpb_output_delay_length;
    }vui_hrd;

    struct {
        unsigned char *vp8_frame_header;
        unsigned int frame_header_bit_count;
        unsigned int frame_header_qindex_update_pos;
        unsigned int frame_header_lf_update_pos;
        unsigned int frame_header_token_update_pos;
        unsigned int frame_header_bin_mv_upate_pos;

        unsigned int intermediate_partition_offset[8];
        unsigned int intermediate_buffer_max_size;
        unsigned int final_frame_byte_offset;

        unsigned char mb_segment_tree_probs[3];
        unsigned char y_mode_probs[4];
        unsigned char uv_mode_probs[3];
        unsigned char mv_probs[2][19];

        unsigned char prob_skip_false;
        unsigned char prob_intra;
        unsigned char prob_last;
        unsigned char prob_gf;

        dri_bo *frame_header_bo;
        dri_bo *intermediate_bo;
        dri_bo *final_frame_bo;
        dri_bo *stream_out_bo;
        dri_bo *coeff_probs_stream_in_bo;
        dri_bo *token_statistics_bo;
        dri_bo *mpc_row_store_bo;
    }vp8_state;

    //"buffered_QMatrix" will be used to buffer the QMatrix if the app sends one.
    // Or else, we will load a default QMatrix from the driver for JPEG encode.
    VAQMatrixBufferJPEG buffered_qmatrix;
    struct i965_gpe_context gpe_context;
    struct i965_buffer_surface mfc_batchbuffer_surface;
    struct intel_batchbuffer *aux_batchbuffer;
    struct i965_buffer_surface aux_batchbuffer_surface;

    void (*pipe_mode_select)(VADriverContextP ctx,
                             int standard_select,
                             struct intel_encoder_context *encoder_context);
    void (*set_surface_state)(VADriverContextP ctx,
                              struct intel_encoder_context *encoder_context);
    void (*ind_obj_base_addr_state)(VADriverContextP ctx,
                                    struct intel_encoder_context *encoder_context);
    void (*avc_img_state)(VADriverContextP ctx,
                          struct encode_state *encode_state,
                          struct intel_encoder_context *encoder_context);
    void (*avc_qm_state)(VADriverContextP ctx,
                         struct intel_encoder_context *encoder_context);
    void (*avc_fqm_state)(VADriverContextP ctx,
                          struct intel_encoder_context *encoder_context);
    void (*insert_object)(VADriverContextP ctx,
                          struct intel_encoder_context *encoder_context,
                          unsigned int *insert_data,
                          int lenght_in_dws, int data_bits_in_last_dw,
                          int skip_emul_byte_count,
                          int is_last_header, int is_end_of_slice,
                          int emulation_flag,
                          struct intel_batchbuffer *batch);
    void (*buffer_suface_setup)(VADriverContextP ctx,
                                struct i965_gpe_context *gpe_context,
                                struct i965_buffer_surface *buffer_surface,
                                unsigned long binding_table_offset,
                                unsigned long surface_state_offset);
};

VAStatus gen6_mfc_pipeline(VADriverContextP ctx,
                           VAProfile profile,
                           struct encode_state *encode_state,
                           struct intel_encoder_context *encoder_context);
void gen6_mfc_context_destroy(void *context);

extern
Bool gen75_mfc_context_init(VADriverContextP ctx, struct intel_encoder_context *encoder_context);

extern int intel_mfc_update_hrd(struct encode_state *encode_state,
                                struct gen6_mfc_context *mfc_context,
                                int frame_bits);

extern int intel_mfc_brc_postpack(struct encode_state *encode_state,
                                  struct gen6_mfc_context *mfc_context,
                                  int frame_bits);

extern void intel_mfc_hrd_context_update(struct encode_state *encode_state,
                                         struct gen6_mfc_context *mfc_context);

extern int intel_mfc_interlace_check(VADriverContextP ctx,
                                     struct encode_state *encode_state,
                                     struct intel_encoder_context *encoder_context);

extern void intel_mfc_brc_prepare(struct encode_state *encode_state,
                                  struct intel_encoder_context *encoder_context);

extern void intel_mfc_avc_pipeline_header_programing(VADriverContextP ctx,
                                                     struct encode_state *encode_state,
                                                     struct intel_encoder_context *encoder_context,
                                                     struct intel_batchbuffer *slice_batch);

extern VAStatus intel_mfc_avc_prepare(VADriverContextP ctx,
                                      struct encode_state *encode_state,
                                      struct intel_encoder_context *encoder_context);

extern int intel_avc_enc_slice_type_fixup(int type);

extern void
intel_mfc_avc_ref_idx_state(VADriverContextP ctx,
                            struct encode_state *encode_state,
                            struct intel_encoder_context *encoder_context);

extern
Bool gen8_mfc_context_init(VADriverContextP ctx, struct intel_encoder_context *encoder_context);

extern void
intel_avc_slice_insert_packed_data(VADriverContextP ctx,
                             struct encode_state *encode_state,
                             struct intel_encoder_context *encoder_context,
                             int slice_index,
                             struct intel_batchbuffer *slice_batch);

extern
Bool gen9_mfc_context_init(VADriverContextP ctx, struct intel_encoder_context *encoder_context);

#endif	/* _GEN6_MFC_BCS_H_ */


text:
package org.apache.causeway.tooling.j2adoc.format;

import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.stream.Collectors;

import com.github.javaparser.ast.nodeTypes.NodeWithJavadoc;
import com.github.javaparser.javadoc.Javadoc;

import org.asciidoctor.ast.Block;
import org.asciidoctor.ast.Document;
import org.asciidoctor.ast.List;
import org.asciidoctor.ast.StructuralNode;

import org.apache.causeway.commons.collections.Can;
import org.apache.causeway.commons.internal.base._Strings;
import org.apache.causeway.tooling.j2adoc.J2AdocContext;
import org.apache.causeway.tooling.j2adoc.J2AdocUnit;
import org.apache.causeway.tooling.j2adoc.convert.J2AdocConverter;
import org.apache.causeway.tooling.j2adoc.convert.J2AdocConverterDefault;
import org.apache.causeway.tooling.javamodel.ast.Javadocs;
import org.apache.causeway.tooling.model4adoc.AsciiDocFactory;

import static org.apache.causeway.tooling.model4adoc.AsciiDocFactory.block;

import lombok.AccessLevel;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;
import lombok.val;

@RequiredArgsConstructor(access = AccessLevel.PROTECTED)
public abstract class UnitFormatterAbstract
implements UnitFormatter {

    protected final @NonNull J2AdocContext j2aContext;

    /**
     * Main algorithm for laying out a unit.
     *
     * @param unit - the containing java unit (java source code model)
     */
    @Override
    public Document apply(final J2AdocUnit unit, final File file) {

        val doc = AsciiDocFactory.doc();

        // -- title
        if(!j2aContext.isSkipTitleHeader()) {
            title(unit)
            .ifPresent(doc::setTitle);
        }

        // -- license

        _Strings.nonEmpty(j2aContext.getLicenseHeader())
        .ifPresent(notice->AsciiDocFactory.attrNotice(doc, notice));

        // -- intro

        intro(unit, doc);

        // == API
        val titleBlock = block(doc);
        titleBlock.setSource("== API");

        // -- java source

        javaSource(unit)
        .ifPresent(block(doc)::setSource);

        // -- member descriptions

        memberDescriptions(unit, doc);

        // -- inclusions

        inclusions(unit, file)
                .stream()
                .map(inclusion -> String.format("include::%s[]", inclusion))
                .forEach(inclusion -> {
                    final Block block = block(doc);
                    block.setSource(inclusion);
                });

        return doc;
    }

    /**
     * Mandatory hook method to return a representation of the java source (if any)
     *
     * @param unit - the containing java unit (java source code model)
     */
    protected abstract Optional<String> javaSource(final J2AdocUnit unit);

    /**
     * Mandatory hook method to append representation of the members of the unit.
     *
     * @param unit - the containing java unit (java source code model)
     * @param parent - target document node to which any generated blocks are added
     */
    protected abstract void memberDescriptions(final J2AdocUnit unit, final StructuralNode parent);

    protected Optional<String> title(final J2AdocUnit unit) {
        return Optional.of(Snippets.title(unit));
    }

    protected void intro(final J2AdocUnit unit, final StructuralNode parent) {
        J2AdocConverter converter = J2AdocConverterDefault.of(j2aContext);

        unit.getJavadoc()
                .filter(javadoc->!Javadocs.hasHidden(javadoc))
                .map(javadoc->converter.javadoc(javadoc, unit, J2AdocConverter.Mode.ALL))
                .ifPresent(doc->parent.getBlocks().addAll(doc.getBlocks()));
    }

    /**
     * Helper method for use by subclasses; calls
     * {@link #appendMemberToList(List, String, Document)}
     * for all provided {@link NodeWithJavadoc declarations}, using the
     * provided memberRepresenter and the provided strategy for converting the
     * javadoc into Asciidoc.
     *
     * @param ul - the List within the Asciidoc document to append to.
     * @param unit - the containing java unit (java source code model)
     * @param declarations - the collection of {@link NodeWithJavadoc declarations} to process
     * @param memberRepresenter - encodes which parts of the member are to be pulled out into a representation
     * @param javadoc2Asciidocker - strategy for converting each node's javadoc into some Asciidoc
     *
     * @param <T> - the specific subtype of {@link NodeWithJavadoc}
     */
    protected <T extends NodeWithJavadoc<?>> void appendMembersToList(
            final List ul,
            final J2AdocUnit unit,
            final Can<T> declarations,
            final Function<T, String> memberRepresenter,
            final BiFunction<Javadoc, J2AdocUnit, Document> javadoc2Asciidocker) {

        declarations.stream()
        .filter(Javadocs::presentAndNotHidden)
        .forEach(nwj->{
            nwj.getJavadoc()
                    .ifPresent(javadoc-> {
                        final String memberRepresentation = memberRepresenter.apply(nwj);
                        final Document asciidoc = javadoc2Asciidocker.apply(javadoc, unit);
                        appendMemberToList(ul,
                                memberRepresentation,
                                asciidoc);
                    });
        });
    }

    /**
     * Helper method called by {@link #appendMembersToList(List, J2AdocUnit, Can, Function, BiFunction)}.
     *
     * @param ul
     * @param listItemText
     * @param listItemParagraphs
     */
    private static void appendMemberToList(
            final List ul,
            final String listItemText,
            final Document listItemParagraphs) {

        val li = AsciiDocFactory.listItem(ul, listItemText);
        val openBlock = AsciiDocFactory.openBlock(li);
        val javaDocBlock = AsciiDocFactory.block(openBlock);
        javaDocBlock.getBlocks().addAll(listItemParagraphs.getBlocks());
    }

    /**
     * Hook method (with empty default implementation)
     * @param unit - the containing java unit (java source code model)
     * @param file - not to write to, but to determine if any include's of optional hook files are required.
     */
    protected java.util.List<String> inclusions(final J2AdocUnit unit, final File file) {
        final String fileNamex = file.getName();
        final String baseName = determineBaseName(fileNamex);
        final File hooks = file.toPath().getParent().resolve("hooks").toFile();
        if (!hooks.exists() || !hooks.isDirectory()) {
            return Collections.emptyList();
        }
        return Arrays.stream(
                    Objects.requireNonNull(hooks.list((dir, name) -> name.startsWith(baseName + "_")))
                )
                .map(hookFileName -> "hooks/" + hookFileName)
                .sorted()
                .collect(Collectors.toList());
    }

    static String determineBaseName(final String fileName) {
        return fileName.split("\\.adoc")[0];
    }

}


text:
#pragma once

#include <array>
#include <cstdint>
#include <iosfwd>
#include <random>
#include <type_traits>

namespace raz
{
	/*
	 * RandomGenerator is based on the xorshift128+ algorithm
	 * https://en.wikipedia.org/wiki/Xorshift
	 */
	class RandomGenerator
	{
	public:
		typedef uint64_t result_type;
		static constexpr result_type default_seed = 1;

		explicit RandomGenerator(result_type value = default_seed)
		{
			seed(value);
		}

		template<class Sseq>
		explicit RandomGenerator(Sseq& seq)
		{
			seed(seq);
		}

		RandomGenerator(const RandomGenerator& other) :
			m_state(other.m_state)
		{
		}

		RandomGenerator& operator=(const RandomGenerator& other)
		{
			m_state = other.m_state;
			return *this;
		}

		void seed(result_type value = default_seed)
		{
			m_state[0] = value;
			m_state[1] = 0;
		}

		template<class Sseq>
		void seed(Sseq& seq)
		{
			seq.generate(m_state.begin(), m_state.end());
		}

		result_type operator()()
		{
			uint64_t x = m_state[0];
			uint64_t const y = m_state[1];
			m_state[0] = y;
			x ^= x << 23; // a
			m_state[1] = x ^ y ^ (x >> 17) ^ (y >> 26); // b, c
			return (m_state[1] + y);
		}

		void discard(unsigned long long z)
		{
			for (unsigned long long i = 0; i < z; ++i)
			{
				uint64_t x = m_state[0];
				uint64_t const y = m_state[1];
				m_state[0] = y;
				x ^= x << 23; // a
				m_state[1] = x ^ y ^ (x >> 17) ^ (y >> 26); // b, c
			}
		}

		bool operator==(const RandomGenerator& other) const
		{
			return (m_state == other.m_state);
		}

		bool operator!=(const RandomGenerator& other) const
		{
			return (m_state != other.m_state);
		}

		template<class Serializer>
		void operator()(Serializer& serializer)
		{
			serializer(m_state[0])(m_state[1]);
		}

#pragma push_macro("__raz")
#undef min
#undef max
		static constexpr result_type min()
		{
			return (0);
		}

		static constexpr result_type max()
		{
			return ((result_type)-1);
		}
#pragma pop_macro("__raz")

		template<class CharT, class Traits>
		friend std::basic_ostream<CharT, Traits>&
			operator<<(std::basic_ostream<CharT, Traits>& ost, const RandomGenerator& gen)
		{
			return (ost << gen.m_state[0] << " " << gen.m_state[1]);
		}

		template<class CharT, class Traits>
		friend std::basic_istream<CharT, Traits>&
			operator>>(std::basic_istream<CharT, Traits>& ist, RandomGenerator& gen)
		{
			return (ist >> gen.m_state[0] >> gen.m_state[1]);
		}

	private:
		std::array<uint64_t, 2> m_state;
	};

	template<class Generator>
	class RandomDistributor
	{
	public:
		explicit RandomDistributor(Generator& generator) :
			m_generator(&generator)
		{
		}

		RandomDistributor(const RandomDistributor& other) :
			m_generator(other.m_generator)
		{
		}

		RandomDistributor& operator=(const RandomDistributor&) = delete;

		template<class IntType>
		std::enable_if_t<std::is_integral<IntType>::value, IntType>
			operator()(IntType min_value, IntType max_value)
		{
			std::uniform_int_distribution<IntType> dist(min_value, max_value);
			return dist(*m_generator);
		}

		template<class RealType>
		std::enable_if_t<std::is_floating_point<RealType>::value, RealType>
			operator()(RealType min_value, RealType max_value)
		{
			std::uniform_real_distribution<RealType> dist(min_value, max_value);
			return dist(*m_generator);
		}

	private:
		Generator* m_generator;
	};

	class Random : public RandomGenerator, public RandomDistributor<RandomGenerator>
	{
	public:
		explicit Random(result_type value = default_seed) :
			RandomGenerator(value),
			RandomDistributor<RandomGenerator>(*static_cast<RandomGenerator*>(this))
		{
		}

		template<class Sseq>
		explicit Random(Sseq& seq) :
			RandomGenerator(seq),
			RandomDistributor<RandomGenerator>(*static_cast<RandomGenerator*>(this))
		{
		}

		Random(const RandomGenerator& gen) :
			RandomGenerator(gen),
			RandomDistributor<RandomGenerator>(*static_cast<RandomGenerator*>(this))
		{
		}

		Random& operator=(const RandomGenerator& gen)
		{
			RandomGenerator::operator=(gen);
			return *this;
		}

		using RandomGenerator::operator();
		using RandomDistributor<RandomGenerator>::operator();
	};
}


text:
> Adapter for the [chai-subset](https://github.com/debitoor/chai-subset) plugin for [Chai Assertion Library](http://chaijs.com/).

## Installation

```bash
$ npm install chai chai-subset karma-chai-subset --save-dev
```

## Configuration

```js
// karma.config.js
module.exports = function (config) {
    config.set({
        // the order is important, chai-subset must come before chai
        frameworks: ['chai-subset', 'chai']
    })
}
```

## Usage

> adds the `containSubset` matcher to Chai

```js
var object = {
    foo: 'bar',
    inner: {
        value: 'orange'
    }
}

// PASS
expect(object).to.containSubset({
    inner: { value: 'orange' }
})

// PASS
expect(object).to.not.containSubset({
    inner: { value: 'apple' }
})

// FAIL
expect(object).to.containSubset({
    inner: { value: 'mandarine' }
})
```


text:
using System;

namespace Snowplow.Tracker.Logging
{
    public interface ILogger
    {
        void Info(string message);
        void Warn(string message, Exception e = null);
        void Error(string message, Exception e);
    }
}


text:
class Timer {
   public:
    void startTimer();
    void stopTimer();
    void printTime();

   private:
    struct timeb startTime, endTime;
};
#endif


text:
<template id="head">
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>Webduino Blockly Demo 08</title>
  <script src="/lib/jquery-1.9.1.min.js"></script>
  <script src="/lib/webduino-all.min.js"></script>
  <script src="/lib/webduino-blockly.js"></script>
  <script src="/lib/runtime.min.js"></script>
  <script src="/lib/tracking-min.js"></script>
  <script src="/lib/face-min.js"></script>
</template>
<template id="css">
#demo-area-08-content {
  position: relative;
  width: 100%;
  max-width: 300px;
  height: 200px;
  pointer-events: auto!important;
}

#demo-area-08-video {
  top: 0;
  left: 0;
  position: absolute;
  width: 100%;
  height: 100%;
}

#demo-area-08-canvas {
  top: 0;
  left: 0;
  position: absolute;
  width: 100%;
  height: 100%;
}
</template>
<template id="body">
  <div id="demo-area-08-content">
    <video id="demo-area-08-video" preload autoplay loop muted controls></video>
    <canvas id="demo-area-08-canvas"></canvas>
  </div>
</template>


text:
template<typename, typename, const unsigned int, typename = void, typename = void> class adjacency_matrix;

template<typename vertex_type, typename weight_type, const int N>
class adjacency_matrix<vertex_type, weight_type, std::enable_if<std::is_integral<vertex_type>::value>::type,
                       std::enable_if<std::is_integral<weight_type>::value>::type>
{
public:
    adjacency_matrix()
    : adj_matrix()
    {

    }

private:
    matrix<weight_type, N, N> adj_matrix;
};

#endif //GRAPHS_ADJACENCY_MATRIX_H


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	default-init-method="init"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:context="http://www.springframework.org/schema/context"
	xmlns:util="http://www.springframework.org/schema/util"
	xmlns:p="http://www.springframework.org/schema/p"
	xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
		http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
		http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

	<context:annotation-config/>

	<bean id="propertyConfigurer"
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="locations">
			<list>
				<value>WEB-INF/jdbc.properties</value>
			</list>
		</property>
	</bean>

 	<!-- bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
		<property name="driverClass" value="${jdbc.driverClassName}" />
		<property name="url" value="${jdbc.url}" />
	</bean -->

	<!-- DataSource -->
	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
		<property name="driverClass" value="${jdbc.driverClassName}" />
		<property name="jdbcUrl" value="${jdbc.url}" />
		<property name="acquireIncrement" value="1" />
		<property name="minPoolSize" value="1" />
		<property name="maxPoolSize" value="5" />
		<property name="maxIdleTime" value="5000" />
		<property name="numHelperThreads" value="1" />

		<property name="idleConnectionTestPeriod" value="100" />
		<property name="autoCommitOnClose" value="false" />
		<property name="preferredTestQuery" value="select port from proxy" />
		<property name="testConnectionOnCheckin" value="true" />

		<property name="checkoutTimeout" value="60000" />
	</bean>

     <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
      <property name="dataSource" ref="dataSource"/>

	  <property name="jpaDialect">
        <bean class="org.springframework.orm.jpa.vendor.HibernateJpaDialect"/>
     </property>
     <property name="jpaVendorAdapter">
       <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
         <property name="databasePlatform" value="dialect.SQLiteDialect"/>
       </bean>
     </property>
    </bean>

    <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
      <property name="entityManagerFactory" ref="entityManagerFactory"/>
      <property name="dataSource" ref="dataSource"/>
    </bean>

  <!-- bean post-processor for JPA annotations -->
  <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>

   <!-- Simple Dao -->
   <bean id="simpleDao" class="info.joseluismartin.dao.jpa.JpaDao" />

   <bean id="proxyDao" class="info.joseluismartin.dao.jpa.JpaDao" >
   		<constructor-arg value="info.joseluismartin.gtc.model.ProxyConfig" />
   </bean>

   <bean id="daoFactory" class="info.joseluismartin.dao.jpa.JpaDaoFactory" />

   <!-- Persistent Services -->
   <bean id="persistentServiceFactory" class="info.joseluismartin.service.PersistentServiceFactory" />

	<!-- Simple PersistentService -->
	<bean id="persistentService" class="info.joseluismartin.logic.PersistentManager">
		<property name="dao" ref="simpleDao" />
	</bean>

	<bean id="cacheService" class="info.joseluismartin.logic.PersistentManager">
		<property name="dao" ref="cacheDao" />
	</bean>

	<bean id="proxyService" class="info.joseluismartin.logic.PersistentManager">
		<property name="dao" ref="proxyDao" />
	</bean>

	<bean id="typeService" class="info.joseluismartin.logic.PersistentManager">
		<property name="dao" ref="typeDao" />
	</bean>

	<bean id="cacheDao" class="info.joseluismartin.dao.jpa.JpaDao">
		<constructor-arg value="info.joseluismartin.gtc.model.CacheConfig" />
	</bean>

	<bean id="configService" class="info.joseluismartin.logic.PersistentManager">
		<property name="dao" ref="configDao" />
	</bean>

	<bean id="configDao" class="info.joseluismartin.dao.jpa.JpaDao">
		<constructor-arg value="info.joseluismartin.gtc.model.ConfigProperty" />
	</bean>

	<bean id="typeDao" class="info.joseluismartin.dao.jpa.JpaDao">
		<constructor-arg value="info.joseluismartin.gtc.model.CacheType" />
	</bean>

	<!-- Caches -->
	<bean id="cacheManager" class="info.joseluismartin.gtc.CacheManager" />

	<bean id="googleMapsCache" class="info.joseluismartin.gtc.GoogleCache" scope="prototype" />

	<bean id="mapnikCache" class="info.joseluismartin.gtc.MapnikCache" scope="prototype"/>

	<bean id="tmsCache" class="info.joseluismartin.gtc.TmsCache" scope="prototype"/>

	<bean id="wmsCache" class="info.joseluismartin.gtc.WmsCache" scope="prototype" />

	<bean id="veCache" class="info.joseluismartin.gtc.VeCache" scope="prototype" />

	<bean id="systemConfig" class="info.joseluismartin.gtc.model.SystemConfig" />

	<!-- UI Widgets -->
   <bean id="guiFactory" class="info.joseluismartin.gtc.admin.TilaGuiFactory" />

   <bean id="comboBoxFieldBuilder" class="info.joseluismartin.vaadin.ui.form.ComboBoxFieldBuilder">
  		<property name="persistentServiceFactory" ref="persistentServiceFactory"/>
   </bean>

   <!-- Create and configure Fields by means of JPA annotations -->
   <bean id="formFieldFactory" class="info.joseluismartin.vaadin.ui.form.AnnotationFieldFactory" >
		<property name="fieldProcessors">
			<list>
			<!-- size type combo to 150px width, is to large by default -->
				<bean class="info.joseluismartin.vaadin.ui.form.SizeFieldProcessor">
					<property name="widths">
						<map>
							<entry key="type" value="150px"/>
						</map>
					</property>
				</bean>
			</list>
		</property>
   </bean>

	<!--  Action List for table buttons -->
	<util:list id="actionList" scope="prototype">
		<bean class="info.joseluismartin.vaadin.ui.table.AddAction"  p:icon="images/table/filenew.png"
			p:description="Add new item" />
		<bean class="info.joseluismartin.vaadin.ui.table.RemoveAction" p:icon="images/table/edit-delete.png"
			p:description="Delete selected items" />
		<bean class="info.joseluismartin.vaadin.ui.table.RefreshAction" p:icon="images/table/reload.png"
			p:description="Refresh current page" />
	</util:list>

	<bean id="cacheTable" class="info.joseluismartin.vaadin.ui.table.ConfigurableTable"
		 scope="session">

		<aop:scoped-proxy/>
		<property name="selectable" value="true" />
		<property name="multiSelect" value="false" />

		<property name="columns">
			<list value-type="info.joseluismartin.vaadin.ui.table.Column">
				<!-- <bean class="info.joseluismartin.vaadin.ui.table.Column">
					<property name="name" value="id" />
					<property name="displayName" value="ID" />
					<property name="align" value="c" />
					<property name="sortable" value="true" />
				</bean> -->
				<bean class="info.joseluismartin.vaadin.ui.table.Column">
					<property name="name" value="name" />
					<property name="displayName" value="Name" />
					<property name="align" value="b" />
					<property name="sortable" value="true" />
					<property name="width" value="100" />
				</bean>
				<bean class="info.joseluismartin.vaadin.ui.table.Column">
					<property name="name" value="path" />
					<property name="displayName" value="Path" />
					<property name="align" value="b" />
					<property name="sortable" value="true" />
					<property name="width" value="100" />
				</bean>
				<bean class="info.joseluismartin.vaadin.ui.table.Column">
					<property name="name" value="url" />
					<property name="displayName" value="Url" />
					<property name="align" value="b" />
					<property name="sortable" value="true" />
					<property name="width" value="250" />
				</bean>
				<bean class="info.joseluismartin.vaadin.ui.table.Column">
					<property name="name" value="type" />
					<property name="displayName" value="Type" />
					<property name="align" value="b" />
					<property name="sortable" value="true" />
					<property name="sortPropertyName" value="name" />
					<property name="width" value="150" />
				</bean>
				<bean class="info.joseluismartin.vaadin.ui.table.Column">
					<property name="name" value="age" />
					<property name="displayName" value="Age" />
					<property name="align" value="c" />
					<property name="sortable" value="true" />
				</bean>
				<bean class="info.joseluismartin.vaadin.ui.table.Column">
					<property name="name" value="active" />
					<property name="displayName" value="Active" />
					<property name="align" value="b" />
					<property name="sortable" value="true" />
				</bean>
			</list>
		</property>
	</bean>

	<bean id="pageableTable" class="info.joseluismartin.vaadin.ui.table.PageableTable" scope="session">
		<aop:scoped-proxy/>
		<property name="service" ref="cacheService" />
		<property name="table" ref="cacheTable" />
		<property name="paginator" ref="paginator" />
		<property name="actions" ref="actionList" />
		<property name="entityClass" value="info.joseluismartin.gtc.model.CacheConfig" />
		<property name="formFieldFactory" ref="formFieldFactory" />
		<property name="editor" value="cacheEditor" />
	</bean>

	<!-- CacheManager Aware SaveAction list -->
	<util:list id="cacheFormActions" scope="prototype">
		<bean class="info.joseluismartin.gtc.admin.CacheSaveAction"
			p:caption="Save" p:icon="images/ok.png" />

		<bean class="info.joseluismartin.vaadin.ui.form.CancelAction"
					p:caption="Cancel" p:icon="images/cancel.png" />

	</util:list>

	<!-- Cache Form Editor -->
	<bean id="cacheEditor" class="info.joseluismartin.vaadin.ui.form.FormEditor" scope="prototype">
		<property name="visibleItemProperties" value="#{ { 'name', 'type', 'path','url','active', 'size', 'age' } }" />
		<property name="actions" ref="cacheFormActions" />
		<property name="formFieldFactory" ref="defaultFieldFactory" />
		<property name="persistentService" ref="cacheService" />
	</bean>

	<!-- Proxy Form Editor -->
	<bean id="proxyEditor" class="info.joseluismartin.gtc.admin.ProxyForm" scope="prototype">
		<property name="proxyService" ref="proxyService" />
		<property name="formFieldFactory" ref="defaultFieldFactory" />
	</bean>

	<bean id="systemItem" class="com.vaadin.data.util.BeanItem">
		<constructor-arg ref="systemConfig" />
	</bean>

	<!-- System Config Editor -->
	<bean id="configEditor" class="info.joseluismartin.vaadin.ui.form.FormEditor" scope="prototype">
		<property name="persistentService" ref="persistentService" />
		<property name="actions">
			<list>
				<bean class="info.joseluismartin.gtc.admin.ConfigSaveAction"
					p:caption="Save" p:icon="images/ok.png" />

				<bean class="info.joseluismartin.vaadin.ui.form.CancelAction"
					p:caption="Cancel" p:icon="images/cancel.png" />
			</list>
		</property>
		<property name="formFieldFactory" ref="defaultFieldFactory" />
		<property name="itemDataSource" ref="systemItem" />
	</bean>

	<!-- Type Editor -->
	<bean id="typeEditor" class="info.joseluismartin.vaadin.ui.form.FormEditor" scope="prototype">
		<property name="visibleItemProperties" value="#{ { 'name', 'beanName' } }" />
		<property name="actions" ref="cacheFormActions" />
		<property name="formFieldFactory" ref="defaultFieldFactory" />
	</bean>

	<!-- Default FormFieldFactory -->
	<bean id="defaultFieldFactory"
		class="info.joseluismartin.vaadin.ui.form.AnnotationFieldFactory">
		<property name="idClassMap">
			<map>
				<entry key="password" value="com.vaadin.ui.PasswordField" />
			</map>
		</property>
		<property name="fieldProcessors">
			<list>
				<bean class="info.joseluismartin.vaadin.ui.form.SizeFieldProcessor">
					<property name="defaultWidth" value="400px" />
					<property name="widths">
						<map>
							<entry key="type" value="150px" />
						</map>
					</property>
				</bean>
			</list>
		</property>
	</bean>

	<bean id="mapViewer" class="info.joseluismartin.gtc.admin.MapViewer" scope="session">
		<aop:scoped-proxy/>
		<constructor-arg value="map" />
	</bean>

	<!-- Paginator for Pageable Tables -->
	<bean id="paginator" class="info.joseluismartin.vaadin.ui.table.VaadinPaginator"
		scope="prototype">
		<property name="first" ref="paginatorFirstButton" />
		<property name="last" ref="paginatorLastButton" />
		<property name="next" ref="paginatorNextButton" />
		<property name="previous" ref="paginatorPreviousButton" />
		<property name="pageSizes" value="10,20,30,40,50,100,200,All" />
	</bean>

	<bean id="paginatorFirstButton" class="com.vaadin.ui.Button" scope="prototype">
		<property name="icon" value="images/table/go-first.png" />
	</bean>

	<bean id="paginatorLastButton" class="com.vaadin.ui.Button" scope="prototype">
		<property name="icon" value="images/table/go-last.png" />
	</bean>

	<bean id="paginatorNextButton" class="com.vaadin.ui.Button" scope="prototype">
		<property name="icon" value="images/table/go-next.png" />
	</bean>

	<bean id="paginatorPreviousButton" class="com.vaadin.ui.Button" scope="prototype">
		<property name="icon" value="images/table/go-previous.png" />
	</bean>

	<bean id="buttonPanel" class="com.vaadin.ui.HorizontalLayout"
		scope="prototype" />

	<bean id="typeTable" class="info.joseluismartin.vaadin.ui.table.PageableTable" scope="prototype">
		<property name="table" ref="typeConfigurableTable" />
		<property name="service" ref="typeService" />
		<property name="paginator" ref="paginator" />
		<property name="actions" ref="actionList" />
		<property name="entityClass" value="info.joseluismartin.gtc.model.CacheType" />
		<property name="formFieldFactory" ref="defaultFieldFactory" />
		<property name="editor" value="typeEditor" />
	</bean>

	<bean id="typeConfigurableTable" class="info.joseluismartin.vaadin.ui.table.ConfigurableTable" scope="prototype">
		<property name="selectable" value="true" />
		<property name="multiSelect" value="false" />
		<property name="columns">
			<list>
				<bean class="info.joseluismartin.vaadin.ui.table.Column"
				p:name="id" p:displayName="ID" p:width="50" />

				<bean class="info.joseluismartin.vaadin.ui.table.Column"
				p:name="name" p:displayName="Name" p:width="200" />

				<bean class="info.joseluismartin.vaadin.ui.table.Column"
				p:name="beanName" p:displayName="Bean" p:width="200" />
			</list>
		</property>
	</bean>

	<bean id="main" class="info.joseluismartin.vaadin.ui.ListPane" scope="prototype" >
		<property name="components">
			<list>
				<bean class="info.joseluismartin.vaadin.ui.VaadinComponentHolder"
					p:icon="images/table/table.png"
					p:name="Caches"
					p:component-ref="pageableTable" />

				<bean class="info.joseluismartin.vaadin.ui.VaadinComponentHolder"
					p:icon="images/proxy.png"
					p:name="Proxy"
					p:component-ref="proxyEditor" />

				<bean class="info.joseluismartin.vaadin.ui.VaadinComponentHolder"
					p:icon="images/system.png"
					p:name="System"
					p:component-ref="configEditor"/>

				<bean class="info.joseluismartin.vaadin.ui.VaadinComponentHolder"
					p:icon="images/types.png"
					p:name="Cache Types"
					p:component-ref="typeTable" />

				<bean class="info.joseluismartin.vaadin.ui.VaadinComponentHolder"
					p:icon="images/map.png"
					p:name="Map Viewer"
					p:component-ref="mapViewer"/>
			</list>
		</property>
	</bean>

	<!-- <bean id="mapControl" class="info.joseluismartin.gtc.admin.MapControl" /> -->

	<!-- Property Editors -->
	<bean id="customEditorConfigurer"
		class="org.springframework.beans.factory.config.CustomEditorConfigurer">
		<property name="customEditors">
			<map>
				<entry key="com.vaadin.terminal.Resource">
					<bean class="info.joseluismartin.vaadin.beans.VaadinResourcePropertyEditor" />
				</entry>
			</map>
		</property>
	</bean>

	<!-- Message Source -->
	<bean id="messageSource"
		class="org.springframework.context.support.ResourceBundleMessageSource">
		<property name="basenames" value="i18n/jdal,i18n/tila" />
	</bean>

	<bean id="staticMessageSource" class="info.joseluismartin.beans.StaticMessageSource">
		<constructor-arg ref="messageSource" />
	</bean>

<!-- 	<bean id="derbyShutdown" class="info.joseluismartin.gtc.EmbeddedDerbyShutdown">
		<property name="databaseUrl" value="${jdbc.url}" />
	</bean>
	 -->

	<!-- Tx Advice -->
    <tx:advice id="txAdvice" transaction-manager="transactionManager">
    <!-- the transactional semantics... -->
    <tx:attributes>
      <!-- all methods starting with 'get' and 'load' are read-only -->
      <tx:method name="get*" read-only="true"/>
      <tx:method name="load*" read-only="true"/>
      <!-- other methods use the default transaction settings -->
      <tx:method name="*"/>
    </tx:attributes>
  </tx:advice>

   <aop:config>
    <!-- Make all methods on package service transactional  -->
     <aop:pointcut id="serviceOperation"
     	expression="execution(* info.joseluismartin.service.PersistentService.*(..))"/>
     <aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation"/>
  </aop:config>

</beans>


text:
Reference

https://algospot.com/judge/problem/read/NTHLON


text:
/**
 * Group View Controller
 */
Y.namespace('LIMS.Controller');

Y.LIMS.Controller.GroupViewController = Y.Base.create('groupViewController', Y.LIMS.Core.ViewController, [], {

    // Template for list button
    listButtonTemplate: '<button class="panel-button list">',

    /**
     *  The initializer runs when a Group View Controller instance is created.
     */
    initializer: function () {
        // This needs to be called in each view controller
        this.setup(this.get('container'), this.get('controllerId'));
    },

    /**
     * Panel Did Load is called when the panel is attached to the controller
     */
    onPanelDidLoad: function () {
        // Events
        this._attachEvents();
    },

    /**
     * Panel Did Appear is called when the panel did appear on the screen
     */
    onPanelDidAppear: function () {
        // Start poller
        this._startPolling();
        // Subscribe to key up event
        this._subscribeKeyUp();
    },

    /**
     * Panel Did Disappear is called when the panel disappeared from the screen
     */
    onPanelDidDisappear: function () {
        // Stop poller
        this._stopPolling();
        // Detach the key up event
        this._detachKeyUp();
    },

    /**
     * Session Expired is called whenever the user session has expired. Provide all necessary cleaning like
     * invalidation of timer, etc. At the end of the method the controller will be automatically hidden from
     * the screen.
     */
    onSessionExpired: function () {
        this._stopPolling();
    },

    /**
     * Attaches events to DOM elements from container
     *
     * @private
     */
    _attachEvents: function () {

        // Vars
        var searchButton = this.get('searchButton'),
            listButton = this.get('listButton');

        // Local events
        searchButton.on('click', this._onSearchClicked, this);
        listButton.on('click', this._onSearchClosed, this);

        // Global events
        Y.on('buddySelected', this._onBuddySelected, this);
    },

    /**
     * Subscribes to the global key up event
     *
     * @private
     */
    _subscribeKeyUp: function () {
        if (Y.one('doc')) {
            // Save the subscription to the key up event
            this.set('keyUpSubscription', Y.one('doc').on('keyup', this._onKeyPress, this));
        }
    },

    /**
     * Detaches the subscription to the global key up event
     *
     * @private
     */
    _detachKeyUp: function () {
        // Vars
        var keyUpSubscription = this.get('keyUpSubscription');

        if (keyUpSubscription) {
            keyUpSubscription.detach();
        }
    },

    /**
     * Starts poller that periodically refreshes the group list
     *
     * @private
     */
    _startPolling: function () {

        // Vars
        var model = this.get('model'),
            poller = this.get('poller'),
            properties = this.get('properties');

        // Start only if the chat is enabled
        if (properties.isChatEnabled()) {

            // Register model to the poller
            poller.register('groupViewController:model', new Y.LIMS.Core.PollerEntry({
                model: model,       // Model that will be periodically refreshed
                interval: 10000     // 10 seconds period
            }));
        }
    },

    /**
     * Stops poller that periodically refreshes the group list
     *
     * @private
     */
    _stopPolling: function () {
        // Vars
        var poller = this.get('poller');
        // Pause
        poller.unregister('groupViewController:model');
    },

    /**
     * Shows the search panel
     *
     * @private
     */
    _showSearchPanel: function () {

        // Vars
        var panelTitle = this.get('panelTitle'),
            searchPanelView = this.get('searchPanelView'),
            searchPanelModel = this.get('searchPanelModel'),
            searchPanelContainer = searchPanelView.get('container'),
            animation,
            instance = this;

        // Only show the search panel if not in document already
        if (!searchPanelContainer.inDoc()) {

            // Create an instance of animation
            animation = new Y.Anim({
                node: searchPanelContainer,
                duration: 0.5,
                from: {opacity: 0},
                to: {opacity: 1}
            });

            // Search button will no longer be needed so hide it at the end of the animation
            animation.on('end', function () {
                instance._hideSearchButton();
                instance._showListButton();
            }, this);

            // Opacity needs to be set to zero otherwise there will
            // be a weird blink effect
            searchPanelContainer.setStyle('opacity', 0);

            // Add search panel to the container
            panelTitle.insert(searchPanelContainer, 'after');

            // Reset the previous search
            searchPanelModel.reset();
            searchPanelView.reset();

            // Run the animation
            animation.run();
        }
    },

    /**
     * Hides the search panel
     *
     * @private
     */
    _hideSearchPanel: function () {

        // Vars
        var searchPanelView = this.get('searchPanelView'),
            searchPanelContainer = searchPanelView.get('container'),
            animation,
            instance = this;

        // Only hide the search panel if it's in the document
        if (searchPanelContainer.inDoc()) {

            // Create an instance of animation
            animation = new Y.Anim({
                node: searchPanelContainer,
                duration: 0.5,
                from: {opacity: 1},
                to: {opacity: 0}
            });

            // Listen to the end of the animation
            animation.on('end', function () {
                // Remove the search panel from DOM
                animation.get('node').remove();
                instance._hideListButton();
                // We will need the search button in the panel title again
                instance._showSearchButton();
            }, this);

            // Run the animation
            animation.run();
        }
    },

    /**
     * Shows the search button in panel title
     *
     * @private
     */
    _showSearchButton: function () {
        // Vars
        var searchButton = this.get('searchButton');
        // Show the button
        Y.LIMS.Core.Util.show(searchButton);
    },

    /**
     * Hides the search button in panel title
     *
     * @private
     */
    _hideSearchButton: function () {
        // Vars
        var searchButton = this.get('searchButton');
        // Hide the button
        Y.LIMS.Core.Util.hide(searchButton);
    },

    /**
     * Shows the list button in panel title
     *
     * @private
     */
    _showListButton: function () {
        // Vars
        var listButton = this.get('listButton'),
            minimizeButton = this.get('minimizeButton');

        if (!listButton.inDoc()) {
            minimizeButton.insert(listButton, 'after');
        }

        // Show the button
        Y.LIMS.Core.Util.show(listButton);
    },

    /**
     * Hides the list button in panel title
     *
     * @private
     */
    _hideListButton: function () {
        // Vars
        var listButton = this.get('listButton');
        // Hide the button
        Y.LIMS.Core.Util.hide(listButton);
    },

    /**
     * Buddy selected event. Called whenever the user selects one of the buddies from
     * the group list
     *
     * @private
     */
    _onBuddySelected: function () {
        // Hide the controller
        this.dismissViewController();
        // If the buddy was selected from search panel, hide it
        this._hideSearchPanel();
    },

    /**
     * Called when a search button in panel title is pressed
     *
     * @private
     */
    _onSearchClicked: function () {
        // Show the search panel
        this._showSearchPanel();
    },

    /**
     * Called when the search panel is closed
     *
     * @private
     */
    _onSearchClosed: function () {
        // Hide the search panel
        this._hideSearchPanel();
    },

    /**
     * Called whenever the user presses any kay in the browser
     *
     * @param event
     * @private
     */
    _onKeyPress: function (event) {
        // User pressed ESC key
        if (event.keyCode === 27) {
            // Hide the search panel
            this._hideSearchPanel();
        }
    }

}, {

    // Specify attributes and static properties for your View here.
    ATTRS: {

        /**
         * Each controller must have an id
         *
         * {string}
         */
        controllerId: {
            value: "groups"
        },

        /**
         * Controller main container
         *
         * {Node}
         */
        container: {
            value: null // to be set
        },

        /**
         * Controller model
         *
         * {Y.LIMS.Model.GroupModelList}
         */
        model: {
            valueFn: function () {
                return new Y.LIMS.Model.GroupModelList();
            }
        },

        /**
         * Activity indicator spinner node
         *
         * {Node}
         */
        activityIndicator: {
            valueFn: function () {
                return this.get('container').one(".panel-content .preloader");
            }
        },

        /**
         * Group list container node
         *
         * {Node}
         */
        panelContentContainer: {
            valueFn: function () {
                return this.get('container').one('.panel-content');
            }
        },

        /**
         * Panel title node
         *
         * {Node}
         */
        panelTitle: {
            valueFn: function () {
                return this.get('container').one('.panel-title');
            }
        },

        /**
         * View that takes care of the search panel
         *
         * {Y.LIMS.View.GroupSearchView}
         */
        searchPanelView: {
            valueFn: function () {
                // Vars
                var model = this.get('searchPanelModel');
                // Create new instance of the view
                return new Y.LIMS.View.GroupSearchView({
                    model: model
                });
            }
        },

        /**
         * Model related to the search panel
         *
         * {Y.LIMS.Model.BuddySearchListModel}
         */
        searchPanelModel: {
            valueFn: function () {
                return new Y.LIMS.Model.BuddySearchListModel();
            }
        },

        /**
         * Search button in panel title node
         *
         * {Node}
         */
        searchButton: {
            valueFn: function () {
                return this.get('container').one('.panel-title .panel-button.search');
            }
        },

        /**
         * Minimize button in panel title node
         *
         * {Node}
         */
        minimizeButton: {
            valueFn: function () {
                return this.get('container').one('.panel-title .panel-button.minimize');
            }
        },

        /**
         * Search button in panel title node
         *
         * {Node}
         */
        listButton: {
            valueFn: function () {
                return Y.Node.create(this.listButtonTemplate);
            }
        },

        /**
         * View for the group list
         *
         * {Y.LIMS.View.GroupViewList}
         */
        groupViewList: {
            valueFn: function () {
                // Vars
                var container = this.get('panelContentContainer'),
                    model = this.get('model'),
                    activityIndicator = this.get('activityIndicator');

                // Create view
                return new Y.LIMS.View.GroupViewList({
                    container: container,
                    model: model,
                    activityIndicator: activityIndicator
                });
            }
        },

        /**
         * Properties object
         *
         * {Y.LIMS.Core.Properties}
         */
        properties: {
            value: null // to be set
        },

        /**
         * Cached global key up subscription
         *
         * {event}
         */
        keyUpSubscription: {
            value: null // to be set
        },

        /**
         * An instance of poller that periodically refreshes models that are subscribed
         *
         * {Y.LIMS.Core.Poller}
         */
        poller: {
            value: null // to be set
        }
    }
});


text:
import os
import datetime

class FileManager:
    """Create directories and file names for storing photos"""
    # One photo per minute is 1,440 photos per day, so use one dir per day:
    # year/month/day

    def __init__(self, root_dir="."):
        self.root_dir = root_dir

    def _get_datetime(self):
        # Get the current year, month, day, hour, minute, second
        now = datetime.datetime.now()
        return (now.year, now.month, now.day, now.hour, now.minute, now.second)

    def _create_directories(self, root, year, month, day):
        # Create root/year/month/day directories (if needed)

        # On Raspberry Pi, it seems os.makedirs ignores the mode parameter,
        # so the umask has to be changed to control permissions.  I want
        # world rwx access to allow different users from different hosts
        # to read/edit/delete files and directories (I don't have things
        # set up to access the NFS server as a specific user).  Set the
        # umask to 0 to make the directories world rwx.
        # TODO: Make umask a parameter or class attribute.
        UMASK = 0
        os.umask(UMASK)

        # TODO Could be a generic routine that joins an arbitrary
        # number of args to create a directory.
        # TODO Handle errors
        dir = os.path.join(root, year, month, day)
        if not os.path.isdir(dir):
            os.makedirs(dir)
        return

    def get_file_path(self):
        # Create root/year/month/day sub-directories, as needed.
        # Return the path + the file name to create
        # Use a filename of year-month-day_hour-min-sec
        # Assume two photos will not be taken in the same second

        year, month, day, hour, minute, second = self._get_datetime()
        year_str = "{:04d}".format(year)
        month_str = "{:02d}".format(month)
        day_str = "{:02d}".format(day)

        self._create_directories(self.root_dir, year_str, month_str, day_str)

        self.file_name = (
            year_str + "-" + month_str + "-" + day_str + "_"
            + "{:02d}-{:02d}-{:02d}.jpg".format(hour, minute, second))

        return os.path.join(self.root_dir, year_str, month_str, day_str,
            self.file_name)


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

namespace HangMan
{

	// bolime glavata. vcera pih egati gadnoto vino. nikoga poveche vino i vodka, obeshtavammmmmmm@@$#$%#&^#
    class besenka
    {
        static ScoreBoardPosition[] scoreBoard = new ScoreBoardPosition[5];
        static private Random random = new Random();
        static private string[] words = {"computer", "programmer", "software", "debugger", "compiler",
                                            "developer", "algorithm", "array", "method", "variable"};
        private string currentWord;
        private char[] PlayersWord;
        private bool cheated;
        int mistakes;
        int lettersLeft;

        public besenka()
        {
            int wordNumber = random.Next(0, 10);
            this.currentWord = words[wordNumber];
            this.PlayersWord = new char[currentWord.Length];
            for (int i = 0; i < PlayersWord.Length; i++)
            {
                PlayersWord[i] = '_';
            }
            this.cheated = false;
            this.mistakes = 0;
            this.lettersLeft = PlayersWord.Length;
            for (int i = 0; i < 5; i++)
            {
                scoreBoard[i] = new ScoreBoardPosition(string.Empty, 999);
            }
        }

        public void printWord()
        {
            Console.WriteLine();
            Console.Write("The secret word is:");
            foreach (var letter in PlayersWord)
            {
                Console.Write(letter+" ");
            }
            Console.WriteLine();
        }
        public void help ()
        {
            int toBeRevealed;
            toBeRevealed=Array.IndexOf(PlayersWord, '_');
            PlayersWord[toBeRevealed] = currentWord[toBeRevealed];
            this.cheated = true;
        }
        public bool Guess(char letter)
        {
            int guessed = 0;
            for (int i = 0; i < currentWord.Length; i++)
            {
                if (currentWord[i] == letter && PlayersWord[i]=='_')
                {
                    guessed++;
                    PlayersWord[i] = letter;
                }
            }
            if (guessed > 0)
            {
                this.lettersLeft = this.lettersLeft - guessed;
                Console.WriteLine("you guessed {0} letters", guessed);
                if (this.lettersLeft == 0)
                {
                    return true;
                }
            }
            else
            {
                Console.WriteLine("letter not found");
                this.mistakes++;
            }
            return false;
        }
        public void End()
        {
            Console.WriteLine("Congratulations! You guessed the word");
            if (this.cheated == false)
            {
                for (int i = 0; i < 5; i++)
                {
                    if (scoreBoard[i].Name==string.Empty || this.mistakes < scoreBoard[i].Mistakes)
                    {
                        Console.WriteLine("Congratulations! You made the scoreboard");
                        Console.Write("Enter your name: ");
                        string playersName = Console.ReadLine();
                        if (scoreBoard[i].Name == string.Empty)
                        {
                            scoreBoard[i].Name = playersName;
                            scoreBoard[i].Mistakes = this.mistakes;

                        }
                        else
                        {
                            scoreBoard[4].Name = playersName;
                            scoreBoard[4].Mistakes = this.mistakes;
                        }
                        Array.Sort(scoreBoard);
                        return;
                    }
                }
            }
            else
            {
                Console.WriteLine("You cheated");
            }
        }

        public void ShowScoreboard()
        {
            Console.WriteLine();
            for (int i = 0; i < scoreBoard.Length; i++)
            {
                if (scoreBoard[i] != default(ScoreBoardPosition))
                {

                    Console.WriteLine("{0} --> {1} - {2} mistakes", i+1, scoreBoard[i].Name, scoreBoard[i].Mistakes);
                }
            }
            Console.WriteLine();
        }

        public void restart()
        {
            int wordNumber = random.Next(0, 11);
            this.currentWord = words[wordNumber];
            this.PlayersWord = new char[currentWord.Length];
            for (int i = 0; i < PlayersWord.Length; i++)
            {
                PlayersWord[i] = '_';
            }
            this.cheated = false;
            this.mistakes = 0;
            this.lettersLeft = PlayersWord.Length;
        }
    }
}


text:
<?php
    require_once('helpers.php');
    /**
     * Set a cookie for tracking the last visit.
     *
     * @return None
     */
    function lastVisit($name, $expire) {
        $value = getDateDMY()." - ".getTimeHM();
        setcookie($name, $value, time() + $expire, '/', $_SERVER['SERVER_NAME'], true, true);
    }
?>


text:
{% extends "manage/manage_base.html" %}
{% load i18n %}

{% block help_link %}user/management/shop/customer_taxes.html{% endblock %}

{% block sextion %}add-tax{% endblock %}
{% block left-slot-wrapper %}{% endblock %}

{% block content %}

{% trans 'Add customer tax' %}

{% trans "Data" %}

            <form action="{% url lfs_add_customer_tax %}"
                  method="post">

                {% csrf_token %}
                {% include "manage/lfs_form.html" %}

                    <input type="submit"
                           class="button"
                           value="{% trans 'Add Customer Tax' %}">

                    <input type="button"
                           class="button"
                           onclick="window.location='{{ next }}'"
                           value="{% trans 'Cancel' %}" />

                    <input type="hidden"
                           name="next"
                           value="{{ next }}" />

            </form>

{% endblock %}


text:
define(['jquery', 'oae.core', 'jquery.oembed'], function($, oae) {

    return function(uid, showSettings, widgetData) {

        // Cache the widget container
        var $rootel = $('#' + uid);

        /**
         * Whitelist the supported oEmbed providers
         *
         * @see http://oembed.com
         */
        var oEmbedProviders = {
            'blip': RegExp('blip\\.tv/.+'),
            'dailymotion': RegExp('dailymotion\\.com/.+'),
            'deviantart': RegExp('deviantart\\.com/.+'),
            'dribble': RegExp('dribbble\\.com/shots/.+'),
            'flickr': RegExp('flickr\\.com/photos/.+'),
            'flickrshort': RegExp('flic\\.kr/p/.+'),
            'hulu': RegExp('hulu\\.com/watch/.*'),
            'ifixit': RegExp('ifixit\\.com/.+'),
            'imgly': RegExp('img\\.ly/.+'),
            'instagram': RegExp('instagr\\.?am(\\.com)?/.+'),
            'pastebin': RegExp('pastebin\\.com/[\\S]{8}'),
            'pinterest': RegExp('pinterest.com/pin/.+'),
            'prezi': RegExp('prezi\\.com/.*'),
            'scribd': RegExp('scribd\\.com/.+'),
            'slideshare': RegExp('slideshare\\.net'),
            'soundcloud': RegExp('soundcloud\\.com/.+'),
            'speakerdeck': RegExp('speakerdeck\\.com/.+'),
            'ted': RegExp('ted\\.com/talks/.+'),
            'twitgoocom': RegExp('twitgoo\\.com/.+'),
            'twitpic': RegExp('twitpic\\.com/.+'),
            'vimeo': RegExp('vimeo\\.com/.+'),
            'youtube': RegExp('youtube\\.com/watch.+v=[\\w-]+&?'),
            'youtubeshort': RegExp('youtu\\.be\/.+')
        };

        /**
         * Override the default embed behavior for some of the supported oEmbed providers
         */
        var setUpCustomOEmbedProviders = function() {
            // Dribble
            $.fn.updateOEmbedProvider('dribbble', null, null, null, {
                'templateData' : function(data) {
                    return oae.api.util.template().render($('#linkpreview-image-template', $rootel), {
                        'img': data.image_url,
                        'linkProfile': widgetData
                    });
                }
            });

            // Img.ly
            $.fn.updateOEmbedProvider('img.ly', 'photo', ['img\\.ly/.+'],'//img.ly/show/large/$1', {
                'embedtag': {tag: 'img'}
            });

            // Twitgoo
            $.fn.updateOEmbedProvider('twitgoo.com', 'photo', ['twitgoo\\.com/.+'],'http://twitgoo.com/show/img/$1', {
                embedtag: {tag:'img'}
            });

            // TED, Twitpic
            $.fn.updateOEmbedProvider('opengraph', null, null, null, {
                yql: {
                    xpath: '//meta|//title|//link',
                    from: 'html',
                    datareturn: function(results) {
                        var embed = $('<p/>');
                        if (results['og:url'].match(oEmbedProviders.ted)) {
                            var url = results['og:url'].replace('www.', 'embed.');
                            embed.append(oae.api.util.template().render($('#linkpreview-iframe-template', $rootel), {'link': url}));
                        } else if (results['og:image']) {
                            // If we're looking at TwitPic, get the large picture instead of the thumbnail
                            if (results['og:site_name'] === 'TwitPic') {
                                results['og:image'] = results['og:image'].replace('thumb', 'large');
                            }
                            embed.append(oae.api.util.template().render($('#linkpreview-image-template', $rootel), {
                                'img': results['og:image'],
                                'linkProfile': widgetData
                            }));
                        }
                        return embed;
                    }
                }
            });
        };

        /**
         * Render the default link preview. This will use a screenshot of the link when available.
         */
        var renderDefaultPreview = function() {
            oae.api.util.template().render($('#linkpreview-default-template', $rootel), {
                'linkProfile': widgetData,
                'displayOptions': {
                    'addLink': false,
                    'addVisibilityIcon': false,
                    'size': 'large'
                }
            }, $('#linkpreview-container'), $rootel);
        };

        /**
         * Embed the link using an iframe. If the preview processor has marked the link
         * as non-embeddable because of cross-domain embedding policies, we resort to
         * default rendering. If the link's protocol is `http` but the user is accessing
         * OAE over `https`, the link is converted to `https` if it is accessible over
         * `https` to avoid browser security issues/warnings.
         */
        var renderIframePreview = function() {
            var link = widgetData.link;
            var embeddable = widgetData.previews.embeddable;
            // If there is a protocol mismatch, the link is converted to `https` if it is
            // accessible over `https`
            if (window.location.protocol === 'https:' && link.indexOf('http:' === 0)) {
                if (widgetData.previews.httpsAccessible) {
                    link = link.replace('http:', 'https:');
                // If the link is not accessible over `https`, it can't be embedded
                } else {
                    embeddable = false;
                }
            }
            // The link can be embedded as an iFrame
            if (embeddable) {
                oae.api.util.template().render($('#linkpreview-iframe-template', $rootel), {'link': link}, $('#linkpreview-container'), $rootel);
            // The link can not be embedded
            } else {
                renderDefaultPreview();
            }
        };

        /**
         * Render the link preview using the oEmbed library.
         */
        var renderOEmbedPreview = function() {
            $('#linkpreview-container', $rootel).oembed(widgetData.link, {
                // Delete the arrow that collapses the container
                'includeHandle': false,
                // Place the content into the container instead of creating a new div
                'embedMethod': 'fill',
                // If oEmbed fails, revert to the default preview
                'onError': renderDefaultPreview,
                // Use our own API to expand long URLs, as the default does not work over https
                'longUrlAjaxOptions': {
                    'url': '/api/longurl/expand',
                    'dataType': 'json'
                }
            });
        };

        /**
         * Decide whether or not to render the link preview using oEmbed or using the standard
         * iFrame embedding method.
         */
        var initPreview = function() {
            // Check the current link against the supported oEmbed providers
            var useOEmbed = false;
            $.each(oEmbedProviders, function(provider, regex) {
                if (regex.test(widgetData.link)) {
                    useOEmbed = true;
                    return false;
                }
            });

            if (useOEmbed) {
                renderOEmbedPreview();
            } else {
                renderIframePreview();
            }
        };

        setUpCustomOEmbedProviders();
        initPreview();

    };
});


text:
module ClassSupport
  def undefine_class(name)
    if Object.constants.include?(name.to_sym)
      Object.send(:remove_const, name.to_sym)
    end
  end
end