text:
<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../Backend/etc/system_file.xsd">
    <system>
        <tab id="general" translate="label" sortOrder="100">
            General
        </tab>
        <tab id="service" translate="label" sortOrder="99999">
            Services
        </tab>
        <tab id="advanced" translate="label" sortOrder="999999">
            Advanced
        </tab>

            Advanced
            <tab>advanced</tab>
            <resource>Magento_Adminhtml::advanced</resource>
            <group id="modules_disable_output" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                Disable Modules Output
                <frontend_model>Magento\Backend\Block\System\Config\Form\Fieldset\Modules\DisableOutput</frontend_model>
            </group>

            <class>separator-top</class>
            Store Email Addresses
            <tab>general</tab>
            <resource>Magento_Adminhtml::trans_email</resource>
            <group id="ident_custom1" translate="label" type="text" sortOrder="4" showInDefault="1" showInWebsite="1" showInStore="1">
                Custom Email 1
                <field id="email" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                    Sender Email
                    <validate>validate-email</validate>
                    <backend_model>Magento\Backend\Model\Config\Backend\Email\Address</backend_model>
                </field>
                <field id="name" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    Sender Name
                    <backend_model>Magento\Backend\Model\Config\Backend\Email\Sender</backend_model>
                    <validate>validate-emailSender</validate>
                </field>
            </group>
            <group id="ident_custom2" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
                Custom Email 2
                <field id="email" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                    Sender Email
                    <validate>validate-email</validate>
                    <backend_model>Magento\Backend\Model\Config\Backend\Email\Address</backend_model>
                </field>
                <field id="name" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    Sender Name
                    <backend_model>Magento\Backend\Model\Config\Backend\Email\Sender</backend_model>
                    <validate>validate-emailSender</validate>
                </field>
            </group>
            <group id="ident_general" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                General Contact
                <field id="email" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                    Sender Email
                    <validate>validate-email</validate>
                    <backend_model>Magento\Backend\Model\Config\Backend\Email\Address</backend_model>
                </field>
                <field id="name" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    Sender Name
                    <backend_model>Magento\Backend\Model\Config\Backend\Email\Sender</backend_model>
                    <validate>validate-emailSender</validate>
                </field>
            </group>
            <group id="ident_sales" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                Sales Representative
                <field id="email" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                    Sender Email
                    <validate>validate-email</validate>
                    <backend_model>Magento\Backend\Model\Config\Backend\Email\Address</backend_model>
                </field>
                <field id="name" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    Sender Name
                    <backend_model>Magento\Backend\Model\Config\Backend\Email\Sender</backend_model>
                    <validate>validate-emailSender</validate>
                </field>
            </group>
            <group id="ident_support" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1">
                Customer Support
                <field id="email" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                    Sender Email
                    <validate>validate-email</validate>
                    <backend_model>Magento\Backend\Model\Config\Backend\Email\Address</backend_model>
                </field>
                <field id="name" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    Sender Name
                    <backend_model>Magento\Backend\Model\Config\Backend\Email\Sender</backend_model>
                    <validate>validate-emailSender</validate>
                </field>
            </group>

            Design
            <tab>general</tab>
            <resource>Magento_Adminhtml::config_design</resource>
            <group id="theme" translate="label" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                Design Theme
                <field id="theme_id" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    Design Theme
                    <source_model>Magento\Framework\View\Design\Theme\Label::getLabelsCollectionForSystemConfiguration</source_model>
                    <backend_model>Magento\Core\Model\Design\Backend\Theme</backend_model>
                    <comment><![CDATA[If no value is specified, the system default will be used. The system default may be modified by third party extensions.]]></comment>
                </field>
                <field id="ua_regexp" translate="label comment tooltip" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="0">
                    User-Agent Exceptions
                    <frontend_model>Magento\Backend\Block\System\Config\Form\Field\Regexceptions</frontend_model>
                    <backend_model>Magento\Core\Model\Design\Backend\Exceptions</backend_model>
                    <comment>
                        <![CDATA[Search strings are either normal strings or regular exceptions (PCRE). They are matched in the same order as entered. Examples:
Firefox
/^mozilla/i]]>
                    </comment>
                    <tooltip>Find a string in client user-agent header and switch to specific design theme for that browser.</tooltip>
                </field>
            </group>
            <group id="pagination" translate="label" type="text" sortOrder="500" showInDefault="1" showInWebsite="1" showInStore="1">
                Pagination
                <field id="pagination_frame" translate="label comment" type="text" sortOrder="7" showInDefault="1" showInWebsite="1" showInStore="1">
                    Pagination Frame
                    <comment>How many links to display at once.</comment>
                </field>
                <field id="pagination_frame_skip" translate="label comment" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="1">
                    Pagination Frame Skip
                    <comment>If the current frame position does not cover utmost pages, will render link to current position plus/minus this value.</comment>
                </field>
                <field id="anchor_text_for_previous" translate="label comment" type="text" sortOrder="9" showInDefault="1" showInWebsite="1" showInStore="1">
                    Anchor Text for Previous
                    <comment>Alternative text for previous link in pagination menu. If empty, default arrow image will used.</comment>
                </field>
                <field id="anchor_text_for_next" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Anchor Text for Next
                    <comment>Alternative text for next link in pagination menu. If empty, default arrow image will used.</comment>
                </field>
            </group>
            <group id="email" translate="label" type="text" sortOrder="510" showInDefault="1" showInWebsite="1" showInStore="1">
                Transactional Emails
                <field id="logo" translate="label" type="image" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Logo Image
                    <comment>Allowed file types: jpg, jpeg, gif, png</comment>
                    <backend_model>Magento\Backend\Model\Config\Backend\Email\Logo</backend_model>
                    <base_url type="media" scope_info="1">email/logo</base_url>
                </field>
                <field id="logo_alt" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    Logo Image Alt
                </field>
            </group>

            Developer
            <tab>advanced</tab>
            <resource>Magento_Adminhtml::dev</resource>
            <group id="restrict" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                Developer Client Restrictions
                <field id="allow_ips" translate="label comment" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    Allowed IPs (comma separated)
                    <comment>Leave empty for access from any location.</comment>
                </field>
            </group>
            <group id="debug" translate="label" type="text" sortOrder="20" showInDefault="0" showInWebsite="1" showInStore="1">
                Debug
                <field id="template_hints" translate="label" type="select" sortOrder="20" showInDefault="0" showInWebsite="1" showInStore="1">
                    Template Path Hints
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="template_hints_blocks" translate="label" type="select" sortOrder="21" showInDefault="0" showInWebsite="1" showInStore="1">
                    Add Block Names to Hints
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
            <group id="template" translate="label" type="text" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="1">
                Template Settings
                <field id="allow_symlink" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Allow Symlinks
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                    <comment>Warning! Enabling this feature is not recommended on production environments because it represents a potential security risk.</comment>
                </field>
            </group>
            <group id="translate_inline" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                Translate Inline
                <field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Enabled for Frontend
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                    <backend_model>Magento\Backend\Model\Config\Backend\Translate</backend_model>
                </field>
                <field id="active_admin" translate="label comment" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
                    Enabled for Admin
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                    <backend_model>Magento\Backend\Model\Config\Backend\Translate</backend_model>
                    <comment>Translate, blocks and other output caches should be disabled for both frontend and admin inline translations.</comment>
                </field>
            </group>
            <group id="log" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
                Log Settings
                <field id="active" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    Enabled
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="file" translate="label comment" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                    System Log File Name
                    <backend_model>Magento\Backend\Model\Config\Backend\Filename</backend_model>
                    <comment>Logging from \Magento\Framework\Logger. File is located in {{base_dir}}/var/log</comment>
                </field>
                <field id="exception_file" translate="label comment" type="text" sortOrder="3" showInDefault="1" showInWebsite="1" showInStore="1">
                    Exceptions Log File Name
                    <backend_model>Magento\Backend\Model\Config\Backend\Filename</backend_model>
                    <comment>Logging from \Magento\Framework\Logger. File is located in {{base_dir}}/var/log</comment>
                </field>
            </group>
            <group id="js" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
                JavaScript Settings
                <field id="merge_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Merge JavaScript Files
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="minify_files" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    Minify JavaScript Files
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
            <group id="css" translate="label" type="text" sortOrder="110" showInDefault="1" showInWebsite="1" showInStore="1">
                CSS Settings
                <field id="merge_css_files" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Merge CSS Files
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
            <group id="image" translate="label" type="text" sortOrder="120" showInDefault="1" showInWebsite="0" showInStore="0">
                Image Processing Settings
                <field id="default_adapter" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                    Image Adapter
                    <source_model>Magento\Backend\Model\Config\Source\Image\Adapter</source_model>
                    <backend_model>Magento\Backend\Model\Config\Backend\Image\Adapter</backend_model>
                    <comment>When the adapter was changed, please, flush Catalog Images Cache.</comment>
                </field>
            </group>
            <group id="static" translate="label" type="text" sortOrder="130" showInDefault="1" showInWebsite="0" showInStore="0">
                Static Files Settings
                <field id="sign" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                    Sign Static Files
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
            </group>

            General
            <tab>general</tab>
            <resource>Magento_Adminhtml::config_general</resource>
            <group id="country" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                Country Options
                <field id="allow" translate="label" type="multiselect" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                    Allow Countries
                    <source_model>Magento\Directory\Model\Config\Source\Country</source_model>
                    <can_be_empty>1</can_be_empty>
                </field>
                <field id="default" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    Default Country
                    <source_model>Magento\Directory\Model\Config\Source\Country</source_model>
                </field>
                <field id="eu_countries" translate="label" type="multiselect" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
                    European Union Countries
                    <source_model>Magento\Directory\Model\Config\Source\Country</source_model>
                </field>
            </group>
            <group id="locale" translate="label" type="text" sortOrder="8" showInDefault="1" showInWebsite="1" showInStore="1">
                Locale Options
                <field id="timezone" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="0">
                    Timezone
                    <source_model>Magento\Backend\Model\Config\Source\Locale\Timezone</source_model>
                    <backend_model>Magento\Backend\Model\Config\Backend\Locale\Timezone</backend_model>
                </field>
                <field id="code" translate="label" type="select" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
                    Locale
                    <source_model>Magento\Backend\Model\Config\Source\Locale</source_model>
                </field>
                <field id="firstday" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    First Day of Week
                    <source_model>Magento\Backend\Model\Config\Source\Locale\Weekdays</source_model>
                </field>
                <field id="weekend" translate="label" type="multiselect" sortOrder="15" showInDefault="1" showInWebsite="1" showInStore="1">
                    Weekend Days
                    <source_model>Magento\Backend\Model\Config\Source\Locale\Weekdays</source_model>
                    <can_be_empty>1</can_be_empty>
                </field>
            </group>
            <group id="store_information" translate="label" type="text" sortOrder="100" showInDefault="1" showInWebsite="1" showInStore="1">
                Store Information
                <field id="name" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Store Name
                </field>
                <field id="phone" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    Store Phone Number
                </field>
                <field id="country_id" translate="label" type="select" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="0">
                    Country
                    <source_model>Magento\Directory\Model\Config\Source\Country</source_model>
                    <frontend_class>countries</frontend_class>
                    <can_be_empty>1</can_be_empty>
                </field>
                <field id="region_id" translate="label" type="text" sortOrder="27" showInDefault="1" showInWebsite="1" showInStore="0">
                    Region/State
                </field>
                <field id="postcode" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="0">
                    ZIP/Postal Code
                </field>
                <field id="city" translate="label" type="text" sortOrder="45" showInDefault="1" showInWebsite="1" showInStore="0">
                    City
                </field>
                <field id="street_line1" translate="label" type="text" sortOrder="55" showInDefault="1" showInWebsite="1" showInStore="0">
                    Street Address
                </field>
                <field id="street_line2" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0">
                    Street Address Line 2
                </field>
                <field id="merchant_vat_number" translate="label" type="text" sortOrder="61" showInDefault="1" showInWebsite="1" showInStore="0">
                    VAT Number
                    <can_be_empty>1</can_be_empty>
                </field>
            </group>
            <group id="single_store_mode" translate="label" type="text" sortOrder="150" showInDefault="1" showInWebsite="0" showInStore="0">
                Single-Store Mode
                <field id="enabled" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                    Enable Single-Store Mode
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                    <comment>This setting will not be taken into account if system has more than one store view.</comment>
                </field>
            </group>

            <class>separator-top</class>
            System
            <tab>advanced</tab>
            <resource>Magento_Adminhtml::config_system</resource>
            <group id="smtp" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                Mail Sending Settings
                <field id="disable" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Disable Email Communications
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="host" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    Host
                    <comment>For Windows server only.</comment>
                </field>
                <field id="port" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    Port (25)
                    <comment>For Windows server only.</comment>
                </field>
                <field id="set_return_path" translate="label" type="select" sortOrder="70" showInDefault="1" showInWebsite="0" showInStore="0">
                    Set Return-Path
                    <source_model>Magento\Backend\Model\Config\Source\Yesnocustom</source_model>
                </field>
                <field id="return_path_email" translate="label" type="text" sortOrder="80" showInDefault="1" showInWebsite="0" showInStore="0">
                    Return-Path Email
                    <validate>validate-email</validate>
                    <backend_model>Magento\Backend\Model\Config\Backend\Email\Address</backend_model>
                    <depends>
                        <field id="set_return_path">2</field>
                    </depends>
                </field>
            </group>
            <group id="media_storage_configuration" translate="label" type="text" sortOrder="900" showInDefault="1" showInWebsite="1" showInStore="1">
                Storage Configuration for Media
                <field id="media_storage" translate="label" type="select" sortOrder="100" showInDefault="1" showInWebsite="0" showInStore="0">
                    Media Storage
                    <source_model>Magento\Backend\Model\Config\Source\Storage\Media\Storage</source_model>
                </field>
                <field id="media_database" translate="label" type="select" sortOrder="200" showInDefault="1" showInWebsite="0" showInStore="0">
                    Select Media Database
                    <source_model>Magento\Backend\Model\Config\Source\Storage\Media\Database</source_model>
                    <backend_model>Magento\Backend\Model\Config\Backend\Storage\Media\Database</backend_model>
                    <depends>
                        <field id="media_storage">1</field>
                    </depends>
                </field>
                <field id="synchronize" translate="label comment" type="button" sortOrder="300" showInDefault="1" showInWebsite="0" showInStore="0">
                    <frontend_model>Magento\Backend\Block\System\Config\System\Storage\Media\Synchronize</frontend_model>
                    <comment>After selecting a new media storage location, press the Synchronize button to transfer all media to that location. Media will not be available in the new location until the synchronization process is complete.</comment>
                </field>
                <field id="configuration_update_time" translate="label" type="text" sortOrder="400" showInDefault="1" showInWebsite="0" showInStore="0">
                    Environment Update Time
                </field>
            </group>

            Admin
            <tab>advanced</tab>
            <resource>Magento_Adminhtml::config_admin</resource>
            <group id="emails" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                Admin User Emails
                <field id="forgot_email_template" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                    Forgot Password Email Template
                    <source_model>Magento\Backend\Model\Config\Source\Email\Template</source_model>
                </field>
                <field id="forgot_email_identity" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
                    Forgot and Reset Email Sender
                    <source_model>Magento\Backend\Model\Config\Source\Email\Identity</source_model>
                </field>
                <field id="password_reset_link_expiration_period" translate="label comment" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
                    Recovery Link Expiration Period (days)
                    <comment>Please enter a number 1 or greater in this field.</comment>
                    <validate>required-entry integer validate-greater-than-zero</validate>
                    <backend_model>Magento\Backend\Model\Config\Backend\Admin\Password\Link\Expirationperiod</backend_model>
                </field>
            </group>
            <group id="startup" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
                Startup Page
                <field id="menu_item_id" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
                    Startup Page
                    <source_model>Magento\Backend\Model\Config\Source\Admin\Page</source_model>
                </field>
            </group>
            <group id="url" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
                Admin Base URL
                <field id="use_custom" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
                    Use Custom Admin URL
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                    <backend_model>Magento\Backend\Model\Config\Backend\Admin\Usecustom</backend_model>
                </field>
                <field id="custom" translate="label comment" type="text" sortOrder="2" showInDefault="1" showInWebsite="0" showInStore="0">
                    Custom Admin URL
                    <backend_model>Magento\Backend\Model\Config\Backend\Admin\Custom</backend_model>
                    <depends>
                        <field id="use_custom">1</field>
                    </depends>
                    <comment>Make sure that base URL ends with '/' (slash), e.g. http://yourdomain/magento/</comment>
                </field>
                <field id="use_custom_path" translate="label" type="select" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0">
                    Use Custom Admin Path
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                    <backend_model>Magento\Backend\Model\Config\Backend\Admin\Custompath</backend_model>
                </field>
                <field id="custom_path" translate="label comment" type="text" sortOrder="4" showInDefault="1" showInWebsite="0" showInStore="0">
                    Custom Admin Path
                    <validate>required-entry validate-alphanum</validate>
                    <backend_model>Magento\Backend\Model\Config\Backend\Admin\Custompath</backend_model>
                    <depends>
                        <field id="use_custom_path">1</field>
                    </depends>
                    <comment>You will have to log in after you save your custom admin path.</comment>
                </field>
            </group>
            <group id="security" translate="label" type="text" sortOrder="35" showInDefault="1" showInWebsite="0" showInStore="0">
                Security
                <field id="use_form_key" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
                    Add Secret Key to URLs
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                    <backend_model>Magento\Backend\Model\Config\Backend\Admin\Usesecretkey</backend_model>
                </field>
                <field id="use_case_sensitive_login" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
                    Login is Case Sensitive
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="session_lifetime" translate="label comment" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0">
                    Admin Session Lifetime (seconds)
                    <comment>Values less than 60 are ignored.</comment>
                    <validate>validate-digits</validate>
                </field>
            </group>
            <group id="dashboard" translate="label" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
                Dashboard
                <field id="enable_charts" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
                    Enable Charts
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
            </group>

            Web
            <tab>general</tab>
            <resource>Magento_Adminhtml::web</resource>
            <group id="url" translate="label" type="text" sortOrder="3" showInDefault="1" showInWebsite="0" showInStore="0">
                Url Options
                <field id="use_store" translate="label comment" type="select" sortOrder="10" showInDefault="1" showInWebsite="0" showInStore="0">
                    Add Store Code to Urls
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                    <backend_model>Magento\Backend\Model\Config\Backend\Store</backend_model>
                    <comment>
                        <![CDATA[Warning! When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.).]]>
                    </comment>
                </field>
                <field id="redirect_to_base" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
                    Auto-redirect to Base URL
                    <source_model>Magento\Backend\Model\Config\Source\Web\Redirect</source_model>
                    <comment>I.e. redirect from http://example.com/store/ to http://www.example.com/store/</comment>
                </field>
            </group>
            <group id="seo" translate="label" type="text" sortOrder="5" showInDefault="1" showInWebsite="1" showInStore="1">
                Search Engine Optimization
                <field id="use_rewrites" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Use Web Server Rewrites
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
            </group>
            <group id="unsecure" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                Base URLs
                <comment>Any of the fields allow fully qualified URLs that end with '/' (slash) e.g. http://example.com/magento/</comment>
                <field id="base_url" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Base URL
                    <backend_model>Magento\Backend\Model\Config\Backend\Baseurl</backend_model>
                    <comment>Specify URL or {{base_url}} placeholder.</comment>
                </field>
                <field id="base_link_url" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    Base Link URL
                    <backend_model>Magento\Backend\Model\Config\Backend\Baseurl</backend_model>
                    <comment>May start with {{unsecure_base_url}} placeholder.</comment>
                </field>
                <field id="base_static_url" translate="label comment" type="text" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="1">
                    Base URL for Static View Files
                    <backend_model>Magento\Backend\Model\Config\Backend\Baseurl</backend_model>
                    <comment>May be empty or start with {{unsecure_base_url}} placeholder.</comment>
                </field>
                <field id="base_media_url" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
                    Base URL for User Media Files
                    <backend_model>Magento\Backend\Model\Config\Backend\Baseurl</backend_model>
                    <comment>May be empty or start with {{unsecure_base_url}} placeholder.</comment>
                </field>
            </group>
            <group id="secure" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                Base URLs (Secure)
                <comment>Any of the fields allow fully qualified URLs that end with '/' (slash) e.g. https://example.com/magento/</comment>
                <field id="base_url" translate="label comment" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Secure Base URL
                    <backend_model>Magento\Backend\Model\Config\Backend\Baseurl</backend_model>
                    <comment>Specify URL or {{base_url}}, or {{unsecure_base_url}} placeholder.</comment>
                </field>
                <field id="base_link_url" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    Secure Base Link URL
                    <backend_model>Magento\Backend\Model\Config\Backend\Baseurl</backend_model>
                    <comment>May start with {{secure_base_url}} or {{unsecure_base_url}} placeholder.</comment>
                </field>
                <field id="base_static_url" translate="label comment" type="text" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="1">
                    Secure Base URL for Static View Files
                    <backend_model>Magento\Backend\Model\Config\Backend\Baseurl</backend_model>
                    <comment>May be empty or start with {{secure_base_url}}, or {{unsecure_base_url}} placeholder.</comment>
                </field>
                <field id="base_media_url" translate="label" type="text" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
                    Secure Base URL for User Media Files
                    <backend_model>Magento\Backend\Model\Config\Backend\Baseurl</backend_model>
                    <comment>May be empty or start with {{secure_base_url}}, or {{unsecure_base_url}} placeholder.</comment>
                </field>
                <field id="use_in_frontend" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
                    Use Secure URLs in Frontend
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                    <backend_model>Magento\Backend\Model\Config\Backend\Secure</backend_model>
                    <comment>Enter https protocol to use Secure URLs in Frontend.</comment>
                </field>
                <field id="use_in_adminhtml" translate="label" type="select" sortOrder="60" showInDefault="1" showInWebsite="0" showInStore="0">
                    Use Secure URLs in Admin
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                    <backend_model>Magento\Backend\Model\Config\Backend\Secure</backend_model>
                    <comment>Enter https protocol to use Secure URLs in Admin.</comment>
                </field>
                <field id="offloader_header" translate="label" type="text" sortOrder="70" showInDefault="1" showInWebsite="0" showInStore="0">
                    Offloader header
                </field>
            </group>
            <group id="default" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                Default Pages
                <field id="front" translate="label" type="text" sortOrder="1" showInDefault="1" showInWebsite="1" showInStore="1">
                    Default Web URL
                </field>
                <field id="no_route" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
                    Default No-route URL
                </field>
            </group>
            <group id="cookie" translate="label" type="text" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="1">
                Default Cookie Settings
                <field id="cookie_lifetime" translate="label" type="text" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="1">
                    Cookie Lifetime
                    <backend_model>Magento\Backend\Model\Config\Backend\Cookie\Lifetime</backend_model>
                </field>
                <field id="cookie_path" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
                    Cookie Path
                    <backend_model>Magento\Backend\Model\Config\Backend\Cookie\Path</backend_model>
                </field>
                <field id="cookie_domain" translate="label" type="text" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
                    Cookie Domain
                    <backend_model>Magento\Backend\Model\Config\Backend\Cookie\Domain</backend_model>
                </field>
                <field id="cookie_httponly" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="1" showInStore="1">
                    Use HTTP Only
                    <comment>
                        <![CDATA[Warning:  Do not set to "No". User security could be compromised.]]>
                    </comment>
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="cookie_restriction" translate="label" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
                    Cookie Restriction Mode
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                    <backend_model>Magento\Backend\Model\Config\Backend\Cookie</backend_model>
                </field>
            </group>
            <group id="session" translate="label" type="text" sortOrder="60" showInDefault="1" showInWebsite="1" showInStore="0">
                Session Validation Settings
                <field id="use_remote_addr" translate="label" type="select" sortOrder="1" showInDefault="1" showInWebsite="0" showInStore="0">
                    Validate REMOTE_ADDR
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="use_http_via" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="0" showInStore="0">
                    Validate HTTP_VIA
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="use_http_x_forwarded_for" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="0" showInStore="0">
                    Validate HTTP_X_FORWARDED_FOR
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="use_http_user_agent" translate="label" type="select" sortOrder="40" showInDefault="1" showInWebsite="0" showInStore="0">
                    Validate HTTP_USER_AGENT
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
                <field id="use_frontend_sid" translate="label comment" type="select" sortOrder="50" showInDefault="1" showInWebsite="1" showInStore="0">
                    Use SID on Frontend
                    <comment>Allows customers to stay logged in when switching between different stores.</comment>
                    <source_model>Magento\Backend\Model\Config\Source\Yesno</source_model>
                </field>
            </group>

    </system>
</config>


text:
<component name="ProjectDictionaryState">
  <dictionary name="bill" />
</component>

redpajama_set_name: RedPajamaGithub


text:
package edu.cmu.sv.ws.ssnoc.common.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;

import edu.cmu.sv.ws.ssnoc.common.logging.Log;
import edu.cmu.sv.ws.ssnoc.rest.SSNoCAppInitializer;

public class ReservedUserNamesUtils {

	/**
	 * List of invalid names
	 */
	public static Set<String> INVALID_NAMES = new HashSet<String>();

	static {
		Log.trace("Loading reserved usernames...");
		try (InputStream input = SSNoCAppInitializer.class.getClassLoader()
				.getResourceAsStream("/reservedUsernames.properties");) {
			if (input != null) {
				// Load a properties file
				Properties prop = new Properties();
				prop.load(input);

				// Load the list of invalid names into a Set
				String invalidNames = prop.getProperty("reservedNames");
				if (invalidNames != null) {
					String[] nameList = invalidNames.split(" ");

					for (int i = 0; i < nameList.length; i++) {
						INVALID_NAMES.add(nameList[i]);
					}
				} else {
					Log.warn("!!! Could not find banned user names in the properties files !!!");
				}
			} else {
				Log.warn("Could not load resevered usernames file.");
			}
		} catch (IOException ex) {
			Log.error("Error when loading reserved usernames file : ", ex);
		}
	}

}


text:
<?xml version="1.0" encoding="utf-8"?>
<delete>
    <routing-instance name="test">
        <vrf-target>target:64512:1</vrf-target>
        <bgp-router name='bgpaas-server'>
            <router-type>bgpaas-server</router-type>
            <autonomous-system>64512</autonomous-system>
            <session to='vm1:0'>
                <family-attributes>
                    <address-family>inet</address-family>
                </family-attributes>
                <family-attributes>
                    <address-family>inet6</address-family>
                </family-attributes>
                <family-attributes>
                    <address-family>inet-vpn</address-family>
                </family-attributes>
            </session>
            <session to='vm2:0'>
                <family-attributes>
                    <address-family>inet</address-family>
                </family-attributes>
                <family-attributes>
                    <address-family>inet6</address-family>
                </family-attributes>
                <family-attributes>
                    <address-family>inet-vpn</address-family>
                </family-attributes>
            </session>
        </bgp-router>
        <bgp-router name='vm1'>
            <router-type>bgpaas-client</router-type>
            <autonomous-system>65001</autonomous-system>
            <address>10.0.0.1</address>
            <source-port>1024</source-port>
            <session to='bgpaas-server:0'>
                <family-attributes>
                    <address-family>inet</address-family>
                </family-attributes>
                <family-attributes>
                    <address-family>inet6</address-family>
                </family-attributes>
                <family-attributes>
                    <address-family>inet-vpn</address-family>
                </family-attributes>
            </session>
        </bgp-router>
        <bgp-router name='vm2'>
            <router-type>bgpaas-client</router-type>
            <autonomous-system>65002</autonomous-system>
            <address>10.0.0.2</address>
            <source-port>1025</source-port>
            <session to='bgpaas-server:0'>
                <family-attributes>
                    <address-family>inet</address-family>
                </family-attributes>
                <family-attributes>
                    <address-family>inet6</address-family>
                </family-attributes>
                <family-attributes>
                    <address-family>inet-vpn</address-family>
                </family-attributes>
            </session>
        </bgp-router>
    </routing-instance>
</delete>


text:
package config

import (
	"flag"
	"fmt"
	"io/ioutil"
	"math/rand"
	"net"
	"net/url"
	"os"
	"path/filepath"
	"reflect"
	"strconv"
	"strings"
	"time"

	"github.com/coreos/etcd/third_party/github.com/BurntSushi/toml"

	"github.com/coreos/etcd/log"
	ustrings "github.com/coreos/etcd/pkg/strings"
	"github.com/coreos/etcd/server"
)

// The default location for the etcd configuration file.
const DefaultSystemConfigPath = "/etc/etcd/etcd.conf"

// A lookup of deprecated flags to their new flag name.
var newFlagNameLookup = map[string]string{
	"C":                      "peers",
	"CF":                     "peers-file",
	"n":                      "name",
	"c":                      "addr",
	"cl":                     "bind-addr",
	"s":                      "peer-addr",
	"sl":                     "peer-bind-addr",
	"d":                      "data-dir",
	"m":                      "max-result-buffer",
	"r":                      "max-retry-attempts",
	"maxsize":                "cluster-active-size",
	"clientCAFile":           "ca-file",
	"clientCert":             "cert-file",
	"clientKey":              "key-file",
	"serverCAFile":           "peer-ca-file",
	"serverCert":             "peer-cert-file",
	"serverKey":              "peer-key-file",
	"snapshotCount":          "snapshot-count",
	"peer-heartbeat-timeout": "peer-heartbeat-interval",
	"max-cluster-size":       "cluster-active-size",
}

// Config represents the server configuration.
type Config struct {
	SystemPath string

	Addr             string `toml:"addr" env:"ETCD_ADDR"`
	BindAddr         string `toml:"bind_addr" env:"ETCD_BIND_ADDR"`
	CAFile           string `toml:"ca_file" env:"ETCD_CA_FILE"`
	CertFile         string `toml:"cert_file" env:"ETCD_CERT_FILE"`
	CPUProfileFile   string
	CorsOrigins      []string `toml:"cors" env:"ETCD_CORS"`
	DataDir          string   `toml:"data_dir" env:"ETCD_DATA_DIR"`
	Discovery        string   `toml:"discovery" env:"ETCD_DISCOVERY"`
	Force            bool
	KeyFile          string   `toml:"key_file" env:"ETCD_KEY_FILE"`
	Peers            []string `toml:"peers" env:"ETCD_PEERS"`
	PeersFile        string   `toml:"peers_file" env:"ETCD_PEERS_FILE"`
	MaxResultBuffer  int      `toml:"max_result_buffer" env:"ETCD_MAX_RESULT_BUFFER"`
	MaxRetryAttempts int      `toml:"max_retry_attempts" env:"ETCD_MAX_RETRY_ATTEMPTS"`
	RetryInterval    float64  `toml:"retry_interval" env:"ETCD_RETRY_INTERVAL"`
	Name             string   `toml:"name" env:"ETCD_NAME"`
	Snapshot         bool     `toml:"snapshot" env:"ETCD_SNAPSHOT"`
	SnapshotCount    int      `toml:"snapshot_count" env:"ETCD_SNAPSHOTCOUNT"`
	ShowHelp         bool
	ShowVersion      bool
	Verbose          bool `toml:"verbose" env:"ETCD_VERBOSE"`
	VeryVerbose      bool `toml:"very_verbose" env:"ETCD_VERY_VERBOSE"`
	VeryVeryVerbose  bool `toml:"very_very_verbose" env:"ETCD_VERY_VERY_VERBOSE"`
	Peer             struct {
		Addr              string `toml:"addr" env:"ETCD_PEER_ADDR"`
		BindAddr          string `toml:"bind_addr" env:"ETCD_PEER_BIND_ADDR"`
		CAFile            string `toml:"ca_file" env:"ETCD_PEER_CA_FILE"`
		CertFile          string `toml:"cert_file" env:"ETCD_PEER_CERT_FILE"`
		KeyFile           string `toml:"key_file" env:"ETCD_PEER_KEY_FILE"`
		HeartbeatInterval int    `toml:"heartbeat_interval" env:"ETCD_PEER_HEARTBEAT_INTERVAL"`
		ElectionTimeout   int    `toml:"election_timeout" env:"ETCD_PEER_ELECTION_TIMEOUT"`
	}
	strTrace     string `toml:"trace" env:"ETCD_TRACE"`
	GraphiteHost string `toml:"graphite_host" env:"ETCD_GRAPHITE_HOST"`
	Cluster      struct {
		ActiveSize   int     `toml:"active_size" env:"ETCD_CLUSTER_ACTIVE_SIZE"`
		RemoveDelay  float64 `toml:"remove_delay" env:"ETCD_CLUSTER_REMOVE_DELAY"`
		SyncInterval float64 `toml:"sync_interval" env:"ETCD_CLUSTER_SYNC_INTERVAL"`
	}
}

// New returns a Config initialized with default values.
func New() *Config {
	c := new(Config)
	c.SystemPath = DefaultSystemConfigPath
	c.Addr = "127.0.0.1:4001"
	c.MaxResultBuffer = 1024
	c.MaxRetryAttempts = 3
	c.RetryInterval = 10.0
	c.Snapshot = true
	c.SnapshotCount = 10000
	c.Peer.Addr = "127.0.0.1:7001"
	c.Peer.HeartbeatInterval = defaultHeartbeatInterval
	c.Peer.ElectionTimeout = defaultElectionTimeout
	rand.Seed(time.Now().UTC().UnixNano())
	// Make maximum twice as minimum.
	c.RetryInterval = float64(50+rand.Int()%50) * defaultHeartbeatInterval / 1000
	c.Cluster.ActiveSize = server.DefaultActiveSize
	c.Cluster.RemoveDelay = server.DefaultRemoveDelay
	c.Cluster.SyncInterval = server.DefaultSyncInterval
	return c
}

// Loads the configuration from the system config, command line config,
// environment variables, and finally command line arguments.
func (c *Config) Load(arguments []string) error {
	var path string
	f := flag.NewFlagSet("etcd", -1)
	f.SetOutput(ioutil.Discard)
	f.StringVar(&path, "config", "", "path to config file")
	f.Parse(arguments)

	// Load from system file.
	if err := c.LoadSystemFile(); err != nil {
		return err
	}

	// Load from config file specified in arguments.
	if path != "" {
		if err := c.LoadFile(path); err != nil {
			return err
		}
	}

	// Load from the environment variables next.
	if err := c.LoadEnv(); err != nil {
		return err
	}

	// Load from command line flags.
	if err := c.LoadFlags(arguments); err != nil {
		return err
	}

	// Loads peers if a peer file was specified.
	if err := c.LoadPeersFile(); err != nil {
		return err
	}

	return nil
}

// Loads from the system etcd configuration file if it exists.
func (c *Config) LoadSystemFile() error {
	if _, err := os.Stat(c.SystemPath); os.IsNotExist(err) {
		return nil
	}
	return c.LoadFile(c.SystemPath)
}

// Loads configuration from a file.
func (c *Config) LoadFile(path string) error {
	_, err := toml.DecodeFile(path, &c)
	return err
}

// LoadEnv loads the configuration via environment variables.
func (c *Config) LoadEnv() error {
	if err := c.loadEnv(c); err != nil {
		return err
	}
	if err := c.loadEnv(&c.Peer); err != nil {
		return err
	}
	if err := c.loadEnv(&c.Cluster); err != nil {
		return err
	}
	return nil
}

func (c *Config) loadEnv(target interface{}) error {
	value := reflect.Indirect(reflect.ValueOf(target))
	typ := value.Type()
	for i := 0; i < typ.NumField(); i++ {
		field := typ.Field(i)

		// Retrieve environment variable.
		v := strings.TrimSpace(os.Getenv(field.Tag.Get("env")))
		if v == "" {
			continue
		}

		// Set the appropriate type.
		switch field.Type.Kind() {
		case reflect.Bool:
			value.Field(i).SetBool(v != "0" && v != "false")
		case reflect.Int:
			newValue, err := strconv.ParseInt(v, 10, 0)
			if err != nil {
				return fmt.Errorf("Parse error: %s: %s", field.Tag.Get("env"), err)
			}
			value.Field(i).SetInt(newValue)
		case reflect.String:
			value.Field(i).SetString(v)
		case reflect.Slice:
			value.Field(i).Set(reflect.ValueOf(ustrings.TrimSplit(v, ",")))
		case reflect.Float64:
			newValue, err := strconv.ParseFloat(v, 64)
			if err != nil {
				return fmt.Errorf("Parse error: %s: %s", field.Tag.Get("env"), err)
			}
			value.Field(i).SetFloat(newValue)
		}
	}
	return nil
}

// Loads configuration from command line flags.
func (c *Config) LoadFlags(arguments []string) error {
	var peers, cors, path string

	f := flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
	f.SetOutput(ioutil.Discard)

	f.BoolVar(&c.ShowHelp, "h", false, "")
	f.BoolVar(&c.ShowHelp, "help", false, "")
	f.BoolVar(&c.ShowVersion, "version", false, "")

	f.BoolVar(&c.Force, "f", false, "")
	f.BoolVar(&c.Force, "force", false, "")

	f.BoolVar(&c.Verbose, "v", c.Verbose, "")
	f.BoolVar(&c.VeryVerbose, "vv", c.VeryVerbose, "")
	f.BoolVar(&c.VeryVeryVerbose, "vvv", c.VeryVeryVerbose, "")

	f.StringVar(&peers, "peers", "", "")
	f.StringVar(&c.PeersFile, "peers-file", c.PeersFile, "")

	f.StringVar(&c.Name, "name", c.Name, "")
	f.StringVar(&c.Addr, "addr", c.Addr, "")
	f.StringVar(&c.Discovery, "discovery", c.Discovery, "")
	f.StringVar(&c.BindAddr, "bind-addr", c.BindAddr, "")
	f.StringVar(&c.Peer.Addr, "peer-addr", c.Peer.Addr, "")
	f.StringVar(&c.Peer.BindAddr, "peer-bind-addr", c.Peer.BindAddr, "")

	f.StringVar(&c.CAFile, "ca-file", c.CAFile, "")
	f.StringVar(&c.CertFile, "cert-file", c.CertFile, "")
	f.StringVar(&c.KeyFile, "key-file", c.KeyFile, "")

	f.StringVar(&c.Peer.CAFile, "peer-ca-file", c.Peer.CAFile, "")
	f.StringVar(&c.Peer.CertFile, "peer-cert-file", c.Peer.CertFile, "")
	f.StringVar(&c.Peer.KeyFile, "peer-key-file", c.Peer.KeyFile, "")

	f.StringVar(&c.DataDir, "data-dir", c.DataDir, "")
	f.IntVar(&c.MaxResultBuffer, "max-result-buffer", c.MaxResultBuffer, "")
	f.IntVar(&c.MaxRetryAttempts, "max-retry-attempts", c.MaxRetryAttempts, "")
	f.Float64Var(&c.RetryInterval, "retry-interval", c.RetryInterval, "")
	f.IntVar(&c.Peer.HeartbeatInterval, "peer-heartbeat-interval", c.Peer.HeartbeatInterval, "")
	f.IntVar(&c.Peer.ElectionTimeout, "peer-election-timeout", c.Peer.ElectionTimeout, "")

	f.StringVar(&cors, "cors", "", "")

	f.BoolVar(&c.Snapshot, "snapshot", c.Snapshot, "")
	f.IntVar(&c.SnapshotCount, "snapshot-count", c.SnapshotCount, "")
	f.StringVar(&c.CPUProfileFile, "cpuprofile", "", "")

	f.StringVar(&c.strTrace, "trace", "", "")
	f.StringVar(&c.GraphiteHost, "graphite-host", "", "")

	f.IntVar(&c.Cluster.ActiveSize, "cluster-active-size", c.Cluster.ActiveSize, "")
	f.Float64Var(&c.Cluster.RemoveDelay, "cluster-remove-delay", c.Cluster.RemoveDelay, "")
	f.Float64Var(&c.Cluster.SyncInterval, "cluster-sync-interval", c.Cluster.SyncInterval, "")

	// BEGIN IGNORED FLAGS
	f.StringVar(&path, "config", "", "")
	// BEGIN IGNORED FLAGS

	// BEGIN DEPRECATED FLAGS
	f.StringVar(&peers, "C", "", "(deprecated)")
	f.StringVar(&c.PeersFile, "CF", c.PeersFile, "(deprecated)")
	f.StringVar(&c.Name, "n", c.Name, "(deprecated)")
	f.StringVar(&c.Addr, "c", c.Addr, "(deprecated)")
	f.StringVar(&c.BindAddr, "cl", c.BindAddr, "(deprecated)")
	f.StringVar(&c.Peer.Addr, "s", c.Peer.Addr, "(deprecated)")
	f.StringVar(&c.Peer.BindAddr, "sl", c.Peer.BindAddr, "(deprecated)")
	f.StringVar(&c.Peer.CAFile, "serverCAFile", c.Peer.CAFile, "(deprecated)")
	f.StringVar(&c.Peer.CertFile, "serverCert", c.Peer.CertFile, "(deprecated)")
	f.StringVar(&c.Peer.KeyFile, "serverKey", c.Peer.KeyFile, "(deprecated)")
	f.StringVar(&c.CAFile, "clientCAFile", c.CAFile, "(deprecated)")
	f.StringVar(&c.CertFile, "clientCert", c.CertFile, "(deprecated)")
	f.StringVar(&c.KeyFile, "clientKey", c.KeyFile, "(deprecated)")
	f.StringVar(&c.DataDir, "d", c.DataDir, "(deprecated)")
	f.IntVar(&c.MaxResultBuffer, "m", c.MaxResultBuffer, "(deprecated)")
	f.IntVar(&c.MaxRetryAttempts, "r", c.MaxRetryAttempts, "(deprecated)")
	f.IntVar(&c.SnapshotCount, "snapshotCount", c.SnapshotCount, "(deprecated)")
	f.IntVar(&c.Peer.HeartbeatInterval, "peer-heartbeat-timeout", c.Peer.HeartbeatInterval, "(deprecated)")
	f.IntVar(&c.Cluster.ActiveSize, "max-cluster-size", c.Cluster.ActiveSize, "(deprecated)")
	f.IntVar(&c.Cluster.ActiveSize, "maxsize", c.Cluster.ActiveSize, "(deprecated)")
	// END DEPRECATED FLAGS

	if err := f.Parse(arguments); err != nil {
		return err
	}

	// Print deprecation warnings on STDERR.
	f.Visit(func(f *flag.Flag) {
		if len(newFlagNameLookup[f.Name]) > 0 {
			fmt.Fprintf(os.Stderr, "[deprecated] use -%s, not -%s\n", newFlagNameLookup[f.Name], f.Name)
		}
	})

	// Convert some parameters to lists.
	if peers != "" {
		c.Peers = ustrings.TrimSplit(peers, ",")
	}
	if cors != "" {
		c.CorsOrigins = ustrings.TrimSplit(cors, ",")
	}

	return nil
}

// LoadPeersFile loads the peers listed in the peers file.
func (c *Config) LoadPeersFile() error {
	if c.PeersFile == "" {
		return nil
	}

	b, err := ioutil.ReadFile(c.PeersFile)
	if err != nil {
		return fmt.Errorf("Peers file error: %s", err)
	}
	c.Peers = ustrings.TrimSplit(string(b), ",")

	return nil
}

// DataDirFromName sets the data dir from a machine name and issue a warning
// that etcd is guessing.
func (c *Config) DataDirFromName() {
	c.DataDir = c.Name + ".etcd"
	log.Warnf("Using the directory %s as the etcd curation directory because a directory was not specified. ", c.DataDir)

	return
}

// NameFromHostname sets the machine name from the hostname. This is to help
// people get started without thinking up a name.
func (c *Config) NameFromHostname() {
	host, err := os.Hostname()
	if err != nil && host == "" {
		log.Fatal("Node name required and hostname not set. e.g. '-name=name'")
	}
	c.Name = host
}

// Reset removes all server configuration files.
func (c *Config) Reset() error {
	if err := os.RemoveAll(filepath.Join(c.DataDir, "log")); err != nil {
		return err
	}
	if err := os.RemoveAll(filepath.Join(c.DataDir, "conf")); err != nil {
		return err
	}
	if err := os.RemoveAll(filepath.Join(c.DataDir, "snapshot")); err != nil {
		return err
	}
	if err := os.RemoveAll(filepath.Join(c.DataDir, "standby_info")); err != nil {
		return err
	}

	return nil
}

// Sanitize cleans the input fields.
func (c *Config) Sanitize() error {
	var err error
	var url *url.URL

	// Sanitize the URLs first.
	if c.Addr, url, err = sanitizeURL(c.Addr, c.EtcdTLSInfo().Scheme()); err != nil {
		return fmt.Errorf("Advertised URL: %s", err)
	}
	if c.BindAddr, err = sanitizeBindAddr(c.BindAddr, url); err != nil {
		return fmt.Errorf("Listen Host: %s", err)
	}
	if c.Peer.Addr, url, err = sanitizeURL(c.Peer.Addr, c.PeerTLSInfo().Scheme()); err != nil {
		return fmt.Errorf("Peer Advertised URL: %s", err)
	}
	if c.Peer.BindAddr, err = sanitizeBindAddr(c.Peer.BindAddr, url); err != nil {
		return fmt.Errorf("Peer Listen Host: %s", err)
	}

	// Only guess the machine name if there is no data dir specified
	// because the info file should have our name
	if c.Name == "" && c.DataDir == "" {
		c.NameFromHostname()
	}

	if c.DataDir == "" && c.Name != "" && !c.ShowVersion && !c.ShowHelp {
		c.DataDirFromName()
	}

	return nil
}

// EtcdTLSInfo retrieves a TLSInfo object for the etcd server
func (c *Config) EtcdTLSInfo() *server.TLSInfo {
	return &server.TLSInfo{
		CAFile:   c.CAFile,
		CertFile: c.CertFile,
		KeyFile:  c.KeyFile,
	}
}

// PeerRaftInfo retrieves a TLSInfo object for the peer server.
func (c *Config) PeerTLSInfo() *server.TLSInfo {
	return &server.TLSInfo{
		CAFile:   c.Peer.CAFile,
		CertFile: c.Peer.CertFile,
		KeyFile:  c.Peer.KeyFile,
	}
}

// MetricsBucketName generates the name that should be used for a
// corresponding MetricsBucket object
func (c *Config) MetricsBucketName() string {
	return fmt.Sprintf("etcd.%s", c.Name)
}

// Trace determines if any trace-level information should be emitted
func (c *Config) Trace() bool {
	return c.strTrace == "*"
}

func (c *Config) ClusterConfig() *server.ClusterConfig {
	return &server.ClusterConfig{
		ActiveSize:   c.Cluster.ActiveSize,
		RemoveDelay:  c.Cluster.RemoveDelay,
		SyncInterval: c.Cluster.SyncInterval,
	}
}

// sanitizeURL will cleanup a host string in the format hostname[:port] and
// attach a schema.
func sanitizeURL(host string, defaultScheme string) (string, *url.URL, error) {
	// Blank URLs are fine input, just return it
	if len(host) == 0 {
		return host, &url.URL{}, nil
	}

	p, err := url.Parse(host)
	if err != nil {
		return "", nil, err
	}

	// Make sure the host is in Host:Port format
	_, _, err = net.SplitHostPort(host)
	if err != nil {
		return "", nil, err
	}

	p = &url.URL{Host: host, Scheme: defaultScheme}
	return p.String(), p, nil
}

// sanitizeBindAddr cleans up the BindAddr parameter and appends a port
// if necessary based on the advertised port.
func sanitizeBindAddr(bindAddr string, aurl *url.URL) (string, error) {
	// If it is a valid host:port simply return with no further checks.
	bhost, bport, err := net.SplitHostPort(bindAddr)
	if err == nil && bhost != "" {
		return bindAddr, nil
	}

	// SplitHostPort makes the host optional, but we don't want that.
	if bhost == "" && bport != "" {
		return "", fmt.Errorf("IP required can't use a port only")
	}

	// bindAddr doesn't have a port if we reach here so take the port from the
	// advertised URL.
	_, aport, err := net.SplitHostPort(aurl.Host)
	if err != nil {
		return "", err
	}

	return net.JoinHostPort(bindAddr, aport), nil
}


text:
<link rel="import" href="../../behaviors/taaabs-stylesheet.html">

<dom-module id="taaabs-display-model">
<link rel="import" type="css" href="../../bower_components/samotracesjs/dist/samotraces.css"/>
  <template>

 Show Model

  </template>

</dom-module>


text:
Block groups are designed for quickly creating gridded content, such as a tile pattern or image gallery. Block groups are percentage based, so they can subdivide columns. Block groups have the ability to break the regular grid system, and thus should be used sparingly and with thought.

Block

Block

Block

```
<div class="block-group block-group-3-up">
  <div class="block"><div class="panel">Block</div></div>
  <div class="block"><div class="panel">Block</div></div>
  <div class="block"><div class="panel">Block</div></div>
</div>
```

[View the example]({{relativePath}}/examples/grid/#block-groups)


text:
// JavaScript Document
@charset "utf-8";

html{
	margin-top:0;
}

body{
	font: 13px/23px Tahoma, Arial, Helvetica, sans-serif;
	background-color:#e1e1e1;
	color:#2c2c2c;
}

h1{
	margin-bottom:35px;
}

h1, h2{
	font-weight:normal;
}

#content_wrapper{
	width:980px;
	margin:0 auto;
	text-align:center;
}

/* The Form*/

#autocompleteForm{
	height:500px;
	width:980px;
	text-align:center;
	display:table-cell;
	vertical-align:middle;
	background:transparent url(../images/glow.png) center center no-repeat;
}

#s{
	font:17px Tahoma, Arial, Helvetica, sans-serif;
	padding:4px 7px;
	border:1px solid #dcdcdc;
	background-color:#efefef;
	width:350px;
	vertical-align:middle;
	color:#3c3c3c;
}

input:focus {
    outline: none;
}

#submitSearch{
	font:16px Tahoma, Arial, Helvetica, sans-serif;
	padding:4px 10px;
	border:1px solid #dcdcdc;
	vertical-align:middle;
	color:#3c3c3c;
	background-color:#efefef;
}

/* Styling for Autocomplete */

/* CSS Document */
.ac_results{overflow:hidden;z-index:99999;margin:0;padding:0;}
.ac_results ul{list-style-position:outside;list-style:none;background:#f5f5f5;margin:0;padding:5px 10px 10px}
.ac_results li{cursor:pointer;display:block;overflow:auto;margin:0;padding:0;border-top:1px solid #e1e1e1;}
.ac_results li:first-child{border:0;}
.ac_loading{background-image:url(../images/loading.gif);background-position:97% center;background-repeat:no-repeat;}
.ac_over{background-color:#FFFFF0;color:#fb0}
.ac_over a:hover{color:#000}
.ac_results li a{display:block; overflow:auto; padding:10px; color:#2c2c2c;}
.ac_results li a img{width:80px; height:auto; max-height:80px;float:left; margin-right:15px;}


text:
<?php
/**
 * Created by PhpStorm.
 * User: petrov
 * Date: 07.07.16
 * Time: 11:43
 */

namespace app\modules\publicities\controllers;

use app\modules\likes\models\Like;
use yii;
use yii\filters\AccessControl;
use yii\filters\VerbFilter;
use yii\web\Controller;
use yii\web\NotFoundHttpException;
use app\modules\publicities\models\Publicity;
use app\modules\publicities\models\PublicityPhoto;

class PublicityController extends Controller
{
    protected $currentPublicityType;

    /**
     * @return array
     */
    public function behaviors()
    {
        return [
            'verbs' => [
                'class' => VerbFilter::className(),
                'actions' => [
                    'delete' => ['POST'],
                ],
            ],
            'access' => [
                'class' => AccessControl::className(),
                'only' => ['create', 'update', 'delete', 'view'],
                'rules' => [
                    [
                        'allow' => true,
                        'actions' => ['view',],
                        'matchCallback' => function () {
                            if ($publicity = Publicity::findOne(Yii::$app->request->get('id'))) {
                                if ($publicity->is_active != false || $publicity->user_id == Yii::$app->user->id) {
                                    return ($publicity->publicity_type == $this->currentPublicityType);
                                }
                            }
                            return false;
                        },
                    ],
                    [
                        'allow' => true,
                        'actions' => ['create',],
                        'roles' => ['@'],
                    ],
                    [
                        'actions' => ['update', 'delete'],
                        'allow' => true,
                        'matchCallback' => function () {
                            if (Yii::$app->user->can('admin')) {
                                return true;
                            }
                            if ($publicity = Publicity::findOne(Yii::$app->request->get('id'))) {
                                return ($publicity->user_id == Yii::$app->user->id);
                            }
                            return false;
                        }
                    ],
                ],
                'denyCallback' => function () {
                    throw new NotFoundHttpException('This page doesen\'t exists');
                }
            ],
        ];
    }

    /**
     * @return string
     */
    public function actionIndex()
    {
        $publicity = new Publicity();

        $query = $publicity->getQueryByPublicityType($this->currentPublicityType);
        $sort = $publicity->getSorting();
        $pagination = $publicity->getPagination($query);

        $publicities = $query->orderBy($sort->orders)
            ->offset($pagination->offset)
            ->limit($pagination->limit)
            ->all();

        return $this->render('index', [
            'publicities' => $publicities,
            'pagination' => $pagination,
            'sort' => $sort,
        ]);
    }

    /**
     * @param $id
     * @return string
     * @throws NotFoundHttpException
     */
    public function actionView($id)
    {
        $publicity = $this->findModel($id);

        $like = new Like();

        $like->publicity_id = $id;
        $like->getLike();

        return $this->render('view',
            [
                'publicity' => $publicity,
                'like' => $like
            ]
        );
    }

    /**
     * @return string|yii\web\Response
     */
    public function actionCreate()
    {
        $publicity = new Publicity();
        $photo = new PublicityPhoto();

        if ($publicity->load(Yii::$app->request->post()) && $publicity->validate()) {

            $publicity->user_id = Yii::$app->getUser()->id;
            $publicity->publicity_type = $this->currentPublicityType;

            $publicity->save(false);

            $photo->publicity_id = $publicity->id;
            $photo->savePhotos();

            return $this->redirect(['view', ['id' => $publicity->id]]);

        }
        return $this->render('create', [
            'photo' => $photo,
            'publicity' => $publicity,
        ]);
    }

    /**
     * @param $id
     * @return string|yii\web\Response
     * @throws NotFoundHttpException
     */
    public function actionUpdate($id)
    {
        $publicity = $this->findModel($id);
        $photo = new PublicityPhoto();

        if ($publicity->load(Yii::$app->request->post()) && $publicity->save()) {

            $photo->publicity_id = $publicity->id;
            $photo->savePhotos();

            return $this->redirect(['view', ['id' => $publicity->id]]);
        }

        return $this->render('update', [
            'photo' => $photo,
            'publicity' => $publicity,
        ]);
    }

    /**
     * @param $id
     * @return yii\web\Response
     * @throws NotFoundHttpException
     */
    public function actionDelete($id)
    {
        $publicity = $this->findModel($id);
        $publicity->deletePublicity();

        return $this->redirect(['index']);
    }

    /**
     * Finds the Item model based on its primary key value.
     * If the model is not found, a 404 HTTP exception will be thrown.
     * @param integer $id
     * @return Publicity the loaded model
     * @throws NotFoundHttpException if the model cannot be found
     */
    public static function findModel($id)
    {
        $model = new Publicity();
        $publicity = $model->getQuery()->where(['id' => $id])->one();

        if ($publicity !== null) {
            return $publicity;
        } else {
            throw new NotFoundHttpException('Requested page doesn\'t exist.');
        }

    }
}


text:
package org.apache.asterix.om.pointables.cast;

import java.io.DataOutput;
import java.io.DataOutputStream;
import java.util.List;

import org.apache.asterix.builders.OrderedListBuilder;
import org.apache.asterix.builders.UnorderedListBuilder;
import org.apache.asterix.om.pointables.AListVisitablePointable;
import org.apache.asterix.om.pointables.PointableAllocator;
import org.apache.asterix.om.pointables.base.DefaultOpenFieldType;
import org.apache.asterix.om.pointables.base.IVisitablePointable;
import org.apache.asterix.om.types.ATypeTag;
import org.apache.asterix.om.types.AbstractCollectionType;
import org.apache.asterix.om.types.EnumDeserializer;
import org.apache.asterix.om.types.IAType;
import org.apache.asterix.om.utils.ResettableByteArrayOutputStream;
import org.apache.hyracks.algebricks.common.utils.Triple;
import org.apache.hyracks.api.exceptions.HyracksDataException;

/**
 * This class is to do the runtime type cast for a list. It is ONLY visible to
 * ACastVisitor.
 */
class AListCaster {

    // for storing the cast result
    private final IVisitablePointable itemTempReference = PointableAllocator.allocateUnrestableEmpty();
    private final Triple<IVisitablePointable, IAType, Boolean> itemVisitorArg =
            new Triple<>(itemTempReference, null, null);

    private final UnorderedListBuilder unOrderedListBuilder = new UnorderedListBuilder();
    private final OrderedListBuilder orderedListBuilder = new OrderedListBuilder();

    private final ResettableByteArrayOutputStream dataBos = new ResettableByteArrayOutputStream();
    private final DataOutput dataDos = new DataOutputStream(dataBos);
    private IAType reqItemType;

    public void castList(AListVisitablePointable listAccessor, IVisitablePointable resultAccessor,
            AbstractCollectionType reqType, ACastVisitor visitor) throws HyracksDataException {
        if (reqType.getTypeTag().equals(ATypeTag.MULTISET)) {
            unOrderedListBuilder.reset(reqType);
            reqItemType = reqType.getItemType();
        }
        if (reqType.getTypeTag().equals(ATypeTag.ARRAY)) {
            orderedListBuilder.reset(reqType);
            reqItemType = reqType.getItemType();
        }
        dataBos.reset();

        List<IVisitablePointable> itemTags = listAccessor.getItemTags();
        List<IVisitablePointable> items = listAccessor.getItems();

        int start = dataBos.size();
        for (int i = 0; i < items.size(); i++) {
            IVisitablePointable itemTypeTag = itemTags.get(i);
            IVisitablePointable item = items.get(i);
            ATypeTag typeTag = EnumDeserializer.ATYPETAGDESERIALIZER
                    .deserialize(itemTypeTag.getByteArray()[itemTypeTag.getStartOffset()]);
            if (reqItemType == null || reqItemType.getTypeTag().equals(ATypeTag.ANY)) {
                itemVisitorArg.second = DefaultOpenFieldType.getDefaultOpenFieldType(typeTag);
            } else {
                itemVisitorArg.second = reqItemType;
            }
            item.accept(visitor, itemVisitorArg);
            if (reqType.getTypeTag().equals(ATypeTag.ARRAY)) {
                orderedListBuilder.addItem(itemVisitorArg.first);
            }
            if (reqType.getTypeTag().equals(ATypeTag.MULTISET)) {
                unOrderedListBuilder.addItem(itemVisitorArg.first);
            }
        }
        if (reqType.getTypeTag().equals(ATypeTag.ARRAY)) {
            orderedListBuilder.write(dataDos, true);
        }
        if (reqType.getTypeTag().equals(ATypeTag.MULTISET)) {
            unOrderedListBuilder.write(dataDos, true);
        }
        int end = dataBos.size();
        resultAccessor.set(dataBos.getByteArray(), start, end - start);
    }
}


text:
import 'babel-core/polyfill';
import jQuery from 'jquery';
import Handlebars from 'hbsfy/runtime';
import moment from 'moment';

window.jQuery = jQuery;
window.$ = jQuery;

import 'devbridge-autocomplete';

Handlebars.registerHelper('parseDate', unixTime => {
  return moment.unix(unixTime).format('DD/MM/YYYY');
});

// helper function to round floats before drawing
window.f = function(v){
  return Math.floor(v);
};


text:
@interface Person : NSManagedObject

@property (nonatomic, retain) NSString * firstName;
@property (nonatomic, retain) NSDate * birthDate;
@property (nonatomic, retain) NSString * surname;

@end


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

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

  <title>FindZLIB — CMake 3.8.1 Documentation</title>

    <link rel="stylesheet" href="../_static/cmake.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/cmake-favicon.ico"/>
    <link rel="index" title="Index" href="../genindex.html" />
    <link rel="search" title="Search" href="../search.html" />
    <link rel="next" title="FortranCInterface" href="FortranCInterface.html" />
    <link rel="prev" title="FindXMLRPC" href="FindXMLRPC.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.8.1 Documentation »

cmake-modules(7) »

FindZLIB¶

Find the native ZLIB includes and library.

IMPORTED Targets¶

This module defines IMPORTED target ZLIB::ZLIB, if
ZLIB has been found.

Result Variables¶

This module defines the following variables:

ZLIB_INCLUDE_DIRS   - where to find zlib.h, etc.
ZLIB_LIBRARIES      - List of libraries when using zlib.
ZLIB_FOUND          - True if zlib found.

ZLIB_VERSION_STRING - The version of zlib found (x.y.z)
ZLIB_VERSION_MAJOR  - The major version of zlib
ZLIB_VERSION_MINOR  - The minor version of zlib
ZLIB_VERSION_PATCH  - The patch version of zlib
ZLIB_VERSION_TWEAK  - The tweak version of zlib

Backward Compatibility¶

The following variable are provided for backward compatibility

ZLIB_MAJOR_VERSION  - The major version of zlib
ZLIB_MINOR_VERSION  - The minor version of zlib
ZLIB_PATCH_VERSION  - The patch version of zlib

Hints¶

A user may set ZLIB_ROOT to a zlib installation root to tell this
module where to look.

Table Of Contents

FindZLIB

IMPORTED Targets

Result Variables

Backward Compatibility

Hints

Previous topic

FindXMLRPC

Next topic

FortranCInterface

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">

<input type="text" name="q" />

<input type="submit" value="Go" />

      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

Navigation

          index

          next |

          previous |

    CMake »

    3.8.1 Documentation »

cmake-modules(7) »

        © Copyright 2000-2017 Kitware, Inc. and Contributors.
      Created using Sphinx 1.5.2.


text:
   alias pubkey="xclip -sel clip < ~/.ssh/id_rsa.pub | echo '=> Public key copied to pasteboard.'"
#fi


text:
import {FormsModule} from '@angular/forms';
import {By} from '@angular/platform-browser';
import {SpinnerComponent} from './../../core/directives/spinner/spinner.component';
import {LeagueServiceStub} from './../../testing/league-stubs';
import {LeagueService} from './../shared/league.service';
import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';

import {LeagueEditComponent} from './league-edit.component';
import {ActivatedRoute} from '@angular/router';
import {ActivatedRouteStub} from 'app/testing/routing-stubs';
import {NgbModule} from '@ng-bootstrap/ng-bootstrap';

describe('LeagueEditComponent', () => {
  let component: LeagueEditComponent;
  let fixture: ComponentFixture<LeagueEditComponent>;
  let activatedRoute: ActivatedRouteStub;

  beforeEach(async(() => {
    activatedRoute = new ActivatedRouteStub();
    TestBed.configureTestingModule({
      declarations: [ LeagueEditComponent, SpinnerComponent ],
      imports: [ FormsModule, NgbModule.forRoot() ],
      providers: [
        { provide: ActivatedRoute, useValue: activatedRoute },
        { provide: LeagueService, useClass: LeagueServiceStub }
      ]
    })
    .compileComponents();
  }));

  function createComponent () {
    fixture = TestBed.createComponent(LeagueEditComponent);
    component = fixture.componentInstance;
    activatedRoute.testParams = { league_id: '789' }
    fixture.detectChanges();
    tick();
  }

  it('should create', fakeAsync(() => {
    createComponent();
    expect(component).toBeTruthy();
  }));

  it('should display warning alert if league does not exists', fakeAsync(() => {
    createComponent();
    component.league = null;
    fixture.detectChanges();
    let debugElement = fixture.debugElement.query(By.css('div.alert.alert-warning'));
    expect(debugElement).toBeTruthy();
  }));

  it('should have league', fakeAsync(() => {
    createComponent();
    expect(component.league).toBeTruthy();
  }));

  it('should display league data in form', fakeAsync(() => {
    createComponent();
    fixture.detectChanges();
    fixture.whenStable().then(() => {
      let form = fixture.debugElement.query(By.css('form[name=leagueEdit]'));
      let name = form.query(By.css('input[name=name]'));
      let maxScore = form.query(By.css('div.btn-group'));
      let allowDraws = form.query(By.css('label.form-check-label input[name=allowDraws]'));
      expect(name.nativeElement.value).toEqual(component.league.name);
      expect(+maxScore.attributes['ng-reflect-model']).toEqual(component.league.settings.maxScore);
      expect(allowDraws.attributes['ng-reflect-model']).toEqual('false');
    });
  }));

  it('should update league data', fakeAsync(() => {
    createComponent();
    fixture.detectChanges();
    fixture.whenStable().then(() => {
      let form = fixture.debugElement.query(By.css('form[name=leagueEdit]'));
      let name = form.query(By.css('input[name=name]'));
      name.nativeElement.value = 'Updated name';
      name.nativeElement.dispatchEvent(new Event('input'));
      tick();
      let submit = form.query(By.css('button'));
      submit.triggerEventHandler('click', null);
      tick();
      expect(component.league.name).toEqual('Updated name');
    });
  }));

  it('should display success alert after changes has been saved', fakeAsync(() => {
    createComponent();
    fixture.detectChanges();
    let submit = fixture.debugElement.query(By.css('form button'));
    submit.triggerEventHandler('click', null);
    tick();
    fixture.detectChanges();
    let alert = fixture.debugElement.query(By.css('div.alert.alert-success'));
    expect(alert).toBeTruthy();
  }));
});