text:
/*
 * Legal Notice
 *
 * This document and associated source code (the "Work") is a preliminary
 * version of a benchmark specification being developed by the TPC. The
 * Work is being made available to the public for review and comment only.
 * The TPC reserves all right, title, and interest to the Work as provided
 * under U.S. and international laws, including without limitation all patent
 * and trademark rights therein.
 *
 * No Warranty
 *
 * 1.1 TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THE INFORMATION
 *     CONTAINED HEREIN IS PROVIDED "AS IS" AND WITH ALL FAULTS, AND THE
 *     AUTHORS AND DEVELOPERS OF THE WORK HEREBY DISCLAIM ALL OTHER
 *     WARRANTIES AND CONDITIONS, EITHER EXPRESS, IMPLIED OR STATUTORY,
 *     INCLUDING, BUT NOT LIMITED TO, ANY (IF ANY) IMPLIED WARRANTIES,
 *     DUTIES OR CONDITIONS OF MERCHANTABILITY, OF FITNESS FOR A PARTICULAR
 *     PURPOSE, OF ACCURACY OR COMPLETENESS OF RESPONSES, OF RESULTS, OF
 *     WORKMANLIKE EFFORT, OF LACK OF VIRUSES, AND OF LACK OF NEGLIGENCE.
 *     ALSO, THERE IS NO WARRANTY OR CONDITION OF TITLE, QUIET ENJOYMENT,
 *     QUIET POSSESSION, CORRESPONDENCE TO DESCRIPTION OR NON-INFRINGEMENT
 *     WITH REGARD TO THE WORK.
 * 1.2 IN NO EVENT WILL ANY AUTHOR OR DEVELOPER OF THE WORK BE LIABLE TO
 *     ANY OTHER PARTY FOR ANY DAMAGES, INCLUDING BUT NOT LIMITED TO THE
 *     COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST PROFITS, LOSS
 *     OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL, DIRECT,
 *     INDIRECT, OR SPECIAL DAMAGES WHETHER UNDER CONTRACT, TORT, WARRANTY,
 *     OR OTHERWISE, ARISING IN ANY WAY OUT OF THIS OR ANY OTHER AGREEMENT
 *     RELATING TO THE WORK, WHETHER OR NOT SUCH AUTHOR OR DEVELOPER HAD
 *     ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES.
 *
 * Contributors
 * - Christopher Chan-Nui
 */

#include <iostream>
#include <boost/test/auto_unit_test.hpp>
#include "../inc/DriverParamSettings.h"

using boost::unit_test::test_suite;

// These macros simplify the testing of the CheckValid/CheckCompliant tests in DriverParamSettings.h
// The parameters for each of the macros are
//     cls     - The class being tested (must be in the TPCE namespace)
//     num     - Id which makes the test unique for each class (otherwise we have namespace collisions)
//     expr    - An expression to evaluate before performing the tests.  This is used to set members
//               to particular values in order to force valid or invalid conditions.
//     err_loc - The expected ErrorLoc() return of a failing check exception
//     err_msg - The expected what() return of a failing check exception
//     member  - A particular member of class cls to test
//     dft     - Default value of specified member
//     val     - Value to set member to in order to force a failed compliance test

// Checks that the class is compliant.  If the class isn't compliant it will
// print out an appropriate test line to replace the test with.  This makes it
// much faster to generate the invalid test cases.
#define CHECK_COMPLIANT(cls, num, expr)                                                                                \
    BOOST_AUTO_TEST_CASE( test_##cls##_##num ) {                                                                                \
        TPCE::cls v;                                                                                \
        expr;                                                                                \
        try {                                                                                \
            v.CheckValid();                                                                                \
        } catch (TPCE::CCheckErr& e) {                                                                                \
            std::cout << "CHECK_INVALID( " #cls ", " #num ", " #expr ", \"" << e.ErrorLoc() << "\", \"" << e.what() << "\");" << std::endl;      \
            BOOST_FAIL("Unexpected Failure of CheckValid");                                                                                \
        }                                                                                \
        try {                                                                                \
            v.CheckCompliant();                                                                                \
        } catch (TPCE::CCheckErr& e) {                                                                                \
            std::cout << "CHECK_NONCOMPLIANT( " #cls ", " #num ", " #expr ", \"" << e.ErrorLoc() << "\", \"" << e.what() << "\");" << std::endl; \
            BOOST_FAIL("Unexpected Failure of CheckValid");                                                                                \
        }                                                                                \
        BOOST_CHECK_EQUAL(v.IsValid(), true);                                                                                \
        BOOST_CHECK_EQUAL(v.IsCompliant(), true);                                                                                \
    }

// Checks that the class is valid but not compliant.  This one also produces an
// invalid testcase if the check fails.
#define CHECK_VALID(cls, num, expr) \
    BOOST_AUTO_TEST_CASE( test_##cls##_##num ) {                                                                                \
        TPCE::cls v;                                                                                \
        expr;                                                                                \
        try {                                                                                \
            v.CheckValid();                                                                                \
        } catch (TPCE::CCheckErr& e) {                                                                                \
            std::cout << "CHECK_INVALID( " #cls ", " #num ", " #expr ", \"" << e.ErrorLoc() << "\", \"" << e.what() << "\");" << std::endl; \
            BOOST_FAIL("Unexpected Failure of CheckValid");                                                                                \
        }                                                                                \
        BOOST_CHECK_EQUAL(v.IsValid(), true);                                                                                \
        BOOST_CHECK_EQUAL(v.IsCompliant(), false);                                                                                \
    }

// Checks to make sure that the class reports that it is invalid.  It also
// verifies the Exception location and error message.
#define CHECK_INVALID(cls, num, expr, err_loc, err_msg)                                                                                \
    BOOST_AUTO_TEST_CASE( test_##cls##_##num ) {                                                                                \
        TPCE::cls v;                                                                                \
        expr;                                                                                \
        try {                                                                                \
            v.CheckValid();                                                                                \
            BOOST_FAIL("CHECK_INVALID tests should not pass CheckValid()");                                                                     \
        } catch (TPCE::CCheckErr& e) {                                                                                \
            BOOST_CHECK_EQUAL(e.ErrorLoc(), err_loc);                                                                                \
            BOOST_CHECK_EQUAL(e.what(), err_msg);                                                                                \
            if (strcmp(e.ErrorLoc(), err_loc) != 0 || strcmp(e.what(), err_msg) !=0) {                                                          \
                std::cout << "CHECK_INVALID( " #cls ", " #num ", " #expr ", \"" << e.ErrorLoc() << "\", \"" << e.what() << "\");" << std::endl; \
            }                                                                                \
        }                                                                                \
        BOOST_CHECK_EQUAL(v.IsValid(), false);                                                                                \
        BOOST_CHECK_EQUAL(v.IsCompliant(), false);                                                                                \
    }

// Checks to make sure that the class reports that it is valid but not compliant.  It also
// verifies the Exception location and error message.
#define CHECK_NONCOMPLIANT(cls, num, expr, err_loc, err_msg) \
    BOOST_AUTO_TEST_CASE( test_##cls##_##num ) { \
        TPCE::cls v; \
        expr; \
        try { \
            v.CheckCompliant(); \
            BOOST_FAIL("CHECK_NONCOMPLIANT tests should not pass CheckCompliant()"); \
        } catch (TPCE::CCheckErr& e) { \
            BOOST_CHECK_EQUAL(e.ErrorLoc(), err_loc); \
            BOOST_CHECK_EQUAL(e.what(), err_msg); \
            if (strcmp(e.ErrorLoc(), err_loc) != 0 || strcmp(e.what(), err_msg) !=0) { \
                std::cout << "CHECK_NONCOMPLIANT( " #cls ", " #num ", " #expr ", \"" << e.ErrorLoc() << "\", \"" << e.what() << "\");" << std::endl; \
            } \
        } \
        BOOST_CHECK_EQUAL(v.IsValid(), true);\
        BOOST_CHECK_EQUAL(v.IsCompliant(), false);\
    }

// Checks to make sure that a particular member of the class cls can only be
// set to valid percentage values
#define CHECK_PCT(cls, num, member, expr)        \
    BOOST_AUTO_TEST_CASE( test_##cls##_##num ) { \
        TPCE::cls v;                             \
        expr;                                    \
        v.cur.member = 0;                        \
        BOOST_CHECK_EQUAL(v.IsValid(), true);    \
        v.cur.member = 100;                      \
        BOOST_CHECK_EQUAL(v.IsValid(), true);    \
        v.cur.member = -1;                       \
        BOOST_CHECK_EQUAL(v.IsValid(), false);   \
        v.cur.member = 101;                      \
        BOOST_CHECK_EQUAL(v.IsValid(), false);   \
    }

// Checks to make sure that a particular member of the class cls can not be set
// set to values outside of 0-100.  Many percentage values tend to have
// relationships to others so we have to test those manually elsewhere.
#define CHECK_PCT_OUT(cls, num, member)                                      \
    BOOST_AUTO_TEST_CASE( test_##cls##_##num ) {                             \
        TPCE::cls v;                                                         \
        v.cur.member = -1;                                                   \
        try {                                                                \
            v.CheckValid();                                                  \
            BOOST_FAIL("CHECK_CPT_OUT tests should not pass CheckValid()");  \
        } catch (TPCE::CCheckErr& e) {                                       \
            BOOST_CHECK_EQUAL(e.ErrorLoc(), #member);                        \
            BOOST_CHECK_EQUAL(e.what(), "cur." #member "(-1) < 0(0)" );      \
        }                                                                    \
        BOOST_CHECK_EQUAL(v.IsValid(), false);                               \
        v.cur.member = 101;                                                  \
        try {                                                                \
            v.CheckValid();                                                  \
            BOOST_FAIL("CHECK_CPT_OUT tests should not pass CheckValid()");  \
        } catch (TPCE::CCheckErr& e) {                                       \
            BOOST_CHECK_EQUAL(e.ErrorLoc(), #member);                        \
            BOOST_CHECK_EQUAL(e.what(), "cur." #member "(101) > 100(100)" ); \
        }                                                                    \
        BOOST_CHECK_EQUAL(v.IsValid(), false);                               \
    }

// Checks that if a particular default value is changed that the class won't
// report itself as compliant.
#define CHECK_DEFAULT(cls, num, member, dft, val, expr) \
    CHECK_NONCOMPLIANT(cls, num, (v.cur.member = val, (expr)), #member, #member "(" #val ") != " #dft );

CHECK_COMPLIANT(CBrokerVolumeSettings, 1, true);

CHECK_COMPLIANT(  CCustomerPositionSettings, 1, true);
CHECK_INVALID(    CCustomerPositionSettings, 2, (v.cur.by_cust_id = 20), "by_*_id total", "cur.by_cust_id + cur.by_tax_id(70) != 100(100)");
CHECK_VALID(      CCustomerPositionSettings, 3, (v.cur.by_cust_id=0, v.cur.by_tax_id=100));
CHECK_VALID(      CCustomerPositionSettings, 4, (v.cur.by_cust_id=100, v.cur.by_tax_id=0));
CHECK_PCT_OUT(    CCustomerPositionSettings, 5, by_cust_id );
CHECK_PCT_OUT(    CCustomerPositionSettings, 6, by_tax_id );
CHECK_PCT(        CCustomerPositionSettings, 7, get_history, true );
CHECK_DEFAULT(    CCustomerPositionSettings, 8, by_cust_id,   50, 40, (v.cur.by_tax_id=60));
//CHECK_DEFAULT(    CCustomerPositionSettings, 9, by_tax_id,   50, 40, (v.cur.by_cust_id=60)); // Impossible to test
CHECK_DEFAULT(    CCustomerPositionSettings, 10, get_history, 50, 40, true );

CHECK_COMPLIANT(  CMarketWatchSettings, 1, true);
CHECK_VALID(      CMarketWatchSettings, 2, (v.cur.by_acct_id=45, v.cur.by_watch_list=55, v.cur.by_industry=0));
CHECK_PCT_OUT(    CMarketWatchSettings, 3, by_acct_id);
CHECK_PCT_OUT(    CMarketWatchSettings, 4, by_industry);
CHECK_PCT_OUT(    CMarketWatchSettings, 5, by_watch_list);
CHECK_INVALID(    CMarketWatchSettings, 6, (v.cur.by_acct_id = 40), "by_* total", "cur.by_acct_id + cur.by_industry + cur.by_watch_list(105) != 100(100)");
CHECK_DEFAULT(    CMarketWatchSettings, 7, by_acct_id, 35, 40, (v.cur.by_watch_list=55) );
CHECK_DEFAULT(    CMarketWatchSettings, 8, by_industry, 5, 10, (v.cur.by_watch_list=55) );
//CHECK_DEFAULT(    CMarketWatchSettings, 9, by_watch_list, 60, 65, (v.cur.by_acct_id=30) ); // Impossible to test

CHECK_COMPLIANT(  CSecurityDetailSettings, 1, true);
CHECK_PCT(        CSecurityDetailSettings, 2, LOBAccessPercentage, true);
CHECK_DEFAULT(    CSecurityDetailSettings, 3, LOBAccessPercentage, 1, 10, true);

CHECK_COMPLIANT(  CTradeLookupSettings, 1, true);
CHECK_VALID(      CTradeLookupSettings, 2, (v.cur.do_frame1=10, v.cur.do_frame2=10, v.cur.do_frame3=10, v.cur.do_frame4=70));
CHECK_PCT_OUT(    CTradeLookupSettings, 3, do_frame1);
CHECK_PCT_OUT(    CTradeLookupSettings, 4, do_frame2);
CHECK_PCT_OUT(    CTradeLookupSettings, 5, do_frame3);
CHECK_PCT_OUT(    CTradeLookupSettings, 6, do_frame4);
CHECK_INVALID(    CTradeLookupSettings, 7, (v.cur.do_frame1=10),      "do_frame* total", "cur.do_frame1 + cur.do_frame2 + cur.do_frame3 + cur.do_frame4(80) != 100(100)");
CHECK_INVALID(    CTradeLookupSettings, 8, (v.cur.MaxRowsFrame1=21),  "MaxRowsFrame1", "cur.MaxRowsFrame1(21) > TradeLookupFrame1MaxRows(20)");
CHECK_INVALID(    CTradeLookupSettings, 9, (v.cur.MaxRowsFrame2=21),  "MaxRowsFrame2", "cur.MaxRowsFrame2(21) > TradeLookupFrame2MaxRows(20)");
CHECK_INVALID(    CTradeLookupSettings, 10, (v.cur.MaxRowsFrame3=21), "MaxRowsFrame3", "cur.MaxRowsFrame3(21) > TradeLookupFrame3MaxRows(20)");
CHECK_INVALID(    CTradeLookupSettings, 11, (v.cur.MaxRowsFrame4=21), "MaxRowsFrame4", "cur.MaxRowsFrame4(21) > TradeLookupFrame4MaxRows(20)");
CHECK_DEFAULT(    CTradeLookupSettings, 12, do_frame1, 30, 10, (v.cur.do_frame4 = 30));
CHECK_DEFAULT(    CTradeLookupSettings, 13, do_frame2, 30, 10, (v.cur.do_frame4 = 30));
CHECK_DEFAULT(    CTradeLookupSettings, 14, do_frame3, 30, 10, (v.cur.do_frame4 = 30));
//CHECK_DEFAULT(    CTradeLookupSettings, 15, do_frame4, 10, 30, (v.cur.do_frame1 = 10));
CHECK_DEFAULT(    CTradeLookupSettings, 16, MaxRowsFrame1, 20, 10, true);
CHECK_DEFAULT(    CTradeLookupSettings, 17, MaxRowsFrame2, 20, 10, true);
CHECK_DEFAULT(    CTradeLookupSettings, 18, MaxRowsFrame3, 20, 10, true);
CHECK_DEFAULT(    CTradeLookupSettings, 19, MaxRowsFrame4, 20, 10, true);
CHECK_DEFAULT(    CTradeLookupSettings, 20, BackOffFromEndTimeFrame2, 115200, 10, true);
CHECK_DEFAULT(    CTradeLookupSettings, 21, BackOffFromEndTimeFrame3, 12000, 10, true);
CHECK_DEFAULT(    CTradeLookupSettings, 22, BackOffFromEndTimeFrame4, 30000, 10, true);

CHECK_COMPLIANT(    CTradeOrderSettings, 1, true);
CHECK_VALID(        CTradeOrderSettings, 2, (v.cur.market=40, v.cur.limit=60));
CHECK_VALID(        CTradeOrderSettings, 3, (v.cur.security_by_name=60, v.cur.security_by_symbol=40));
CHECK_VALID(        CTradeOrderSettings, 4, (v.cur.buy_orders=60, v.cur.sell_orders=40));
CHECK_INVALID(      CTradeOrderSettings, 5, (v.cur.market=40),           "market or limit total", "cur.market + cur.limit(80) != 100(100)");
CHECK_INVALID(      CTradeOrderSettings, 6, (v.cur.security_by_name=60), "security_by_* total", "cur.security_by_name + cur.security_by_symbol(120) != 100(100)");
CHECK_INVALID(      CTradeOrderSettings, 7, (v.cur.buy_orders=60),       "*_orders total", "cur.buy_orders + cur.sell_orders(110) != 100(100)");
CHECK_PCT_OUT(      CTradeOrderSettings, 8, market);
CHECK_PCT_OUT(      CTradeOrderSettings, 9, limit);
CHECK_PCT(          CTradeOrderSettings, 10, stop_loss, true);
CHECK_PCT_OUT(      CTradeOrderSettings, 11, security_by_name);
CHECK_PCT_OUT(      CTradeOrderSettings, 12, security_by_symbol);
CHECK_PCT_OUT(      CTradeOrderSettings, 13, buy_orders);
CHECK_PCT_OUT(      CTradeOrderSettings, 14, sell_orders);
CHECK_PCT(          CTradeOrderSettings, 15, lifo, true);
CHECK_PCT(          CTradeOrderSettings, 16, exec_is_owner, true);
CHECK_PCT(          CTradeOrderSettings, 17, rollback, true);
CHECK_PCT(          CTradeOrderSettings, 18, type_is_margin, true);
CHECK_NONCOMPLIANT( CTradeOrderSettings, 19, ( v.cur.exec_is_owner = 10), "exec_is_owner", "cur.exec_is_owner(10) < 60(60)");
CHECK_DEFAULT(      CTradeOrderSettings, 20, market,             60, 10, (v.cur.limit=90) );
//CHECK_DEFAULT(      CTradeOrderSettings, 21, limit,              60, 10, (v.cur.market=90) );
CHECK_DEFAULT(      CTradeOrderSettings, 22, stop_loss,          50, 10, true );
CHECK_DEFAULT(      CTradeOrderSettings, 23, security_by_name,   40, 50, (v.cur.security_by_symbol=50) );
//CHECK_DEFAULT(      CTradeOrderSettings, 24, security_by_symbol, 40, 50, (v.cur.security_by_name=50) );
CHECK_DEFAULT(      CTradeOrderSettings, 25, buy_orders,         50, 40, (v.cur.sell_orders=60) );
//CHECK_DEFAULT(      CTradeOrderSettings, 26, sell_orders,        50, 40, (v.cur.buy_orders=60) );
CHECK_DEFAULT(      CTradeOrderSettings, 27, lifo,               35, 10, true );
CHECK_DEFAULT(      CTradeOrderSettings, 28, exec_is_owner,      90, 60, true );
CHECK_DEFAULT(      CTradeOrderSettings, 29, rollback,           1,  10, true );
CHECK_DEFAULT(      CTradeOrderSettings, 30, type_is_margin,     8,  10, true );

CHECK_COMPLIANT(  CTradeUpdateSettings, 1, true);
CHECK_VALID(      CTradeUpdateSettings, 2, (v.cur.do_frame1=10, v.cur.do_frame2=10, v.cur.do_frame3=80));
CHECK_PCT_OUT(    CTradeUpdateSettings, 3, do_frame1);
CHECK_PCT_OUT(    CTradeUpdateSettings, 4, do_frame2);
CHECK_PCT_OUT(    CTradeUpdateSettings, 5, do_frame3);
CHECK_INVALID(    CTradeUpdateSettings, 6, (v.cur.do_frame1=10),     "do_frame* total", "cur.do_frame1 + cur.do_frame2 + cur.do_frame3(77) != 100(100)");
CHECK_INVALID(    CTradeUpdateSettings, 7, (v.cur.MaxRowsFrame1=21), "MaxRowsFrame1",   "cur.MaxRowsFrame1(21) > TradeUpdateFrame1MaxRows(20)");
CHECK_INVALID(    CTradeUpdateSettings, 8, (v.cur.MaxRowsFrame2=21), "MaxRowsFrame2",   "cur.MaxRowsFrame2(21) > TradeUpdateFrame2MaxRows(20)");
CHECK_INVALID(    CTradeUpdateSettings, 9, (v.cur.MaxRowsFrame3=21), "MaxRowsFrame3",   "cur.MaxRowsFrame3(21) > TradeUpdateFrame3MaxRows(20)");
CHECK_DEFAULT(    CTradeUpdateSettings, 10, do_frame1, 33, 10, (v.cur.do_frame3 = 57));
CHECK_DEFAULT(    CTradeUpdateSettings, 11, do_frame2, 33, 10, (v.cur.do_frame3 = 57));
//CHECK_DEFAULT(    CTradeUpdateSettings, 12, do_frame3, 34, 57, (v.cur.do_frame1 = 0));
CHECK_DEFAULT(    CTradeUpdateSettings, 13, MaxRowsFrame1, 20, 10, true);
CHECK_DEFAULT(    CTradeUpdateSettings, 14, MaxRowsFrame2, 20, 10, true);
CHECK_DEFAULT(    CTradeUpdateSettings, 15, MaxRowsFrame3, 20, 10, true);
CHECK_DEFAULT(    CTradeUpdateSettings, 16, BackOffFromEndTimeFrame2, 115200, 10, true);
CHECK_DEFAULT(    CTradeUpdateSettings, 17, BackOffFromEndTimeFrame3, 12000, 10, true);

CHECK_COMPLIANT(  CTxnMixGeneratorSettings, 1, true);
CHECK_INVALID(    CTxnMixGeneratorSettings, 2, (v.cur.BrokerVolumeMixLevel     = -1), "BrokerVolumeMixLevel",     "cur.BrokerVolumeMixLevel(-1) < 0(0)");
CHECK_INVALID(    CTxnMixGeneratorSettings, 3, (v.cur.CustomerPositionMixLevel = -1), "CustomerPositionMixLevel", "cur.CustomerPositionMixLevel(-1) < 0(0)");
CHECK_INVALID(    CTxnMixGeneratorSettings, 4, (v.cur.MarketWatchMixLevel      = -1), "MarketWatchMixLevel",      "cur.MarketWatchMixLevel(-1) < 0(0)");
CHECK_INVALID(    CTxnMixGeneratorSettings, 5, (v.cur.SecurityDetailMixLevel   = -1), "SecurityDetailMixLevel",   "cur.SecurityDetailMixLevel(-1) < 0(0)");
CHECK_INVALID(    CTxnMixGeneratorSettings, 6, (v.cur.TradeLookupMixLevel      = -1), "TradeLookupMixLevel",      "cur.TradeLookupMixLevel(-1) < 0(0)");
CHECK_INVALID(    CTxnMixGeneratorSettings, 7, (v.cur.TradeOrderMixLevel       = -1), "TradeOrderMixLevel",       "cur.TradeOrderMixLevel(-1) < 0(0)");
CHECK_INVALID(    CTxnMixGeneratorSettings, 8, (v.cur.TradeStatusMixLevel      = -1), "TradeStatusMixLevel",      "cur.TradeStatusMixLevel(-1) < 0(0)");
CHECK_INVALID(    CTxnMixGeneratorSettings, 9, (v.cur.TradeUpdateMixLevel      = -1), "TradeUpdateMixLevel",      "cur.TradeUpdateMixLevel(-1) < 0(0)");
CHECK_DEFAULT(    CTxnMixGeneratorSettings, 10, BrokerVolumeMixLevel,       49, 10, true);
CHECK_DEFAULT(    CTxnMixGeneratorSettings, 11, CustomerPositionMixLevel,  130, 10, true);
CHECK_DEFAULT(    CTxnMixGeneratorSettings, 12, MarketWatchMixLevel,       180, 10, true);
CHECK_DEFAULT(    CTxnMixGeneratorSettings, 13, SecurityDetailMixLevel,    140, 10, true);
CHECK_DEFAULT(    CTxnMixGeneratorSettings, 14, TradeLookupMixLevel,        80, 10, true);
CHECK_DEFAULT(    CTxnMixGeneratorSettings, 15, TradeOrderMixLevel,        101, 10, true);
CHECK_DEFAULT(    CTxnMixGeneratorSettings, 16, TradeStatusMixLevel,       190, 10, true);
CHECK_DEFAULT(    CTxnMixGeneratorSettings, 17, TradeUpdateMixLevel,        20, 10, true);

CHECK_COMPLIANT(    CLoaderSettings, 1, true);
CHECK_INVALID(      CLoaderSettings, 2, (v.cur.iConfiguredCustomerCount = 900, v.cur.iActiveCustomerCount = 900), "iConfiguredCustomerCount", "cur.iConfiguredCustomerCount(900) < 1000(1000)");
CHECK_INVALID(      CLoaderSettings, 3, (v.cur.iActiveCustomerCount = 900),      "iActiveCustomerCount", "cur.iActiveCustomerCount(900) < 1000(1000)");
CHECK_INVALID(      CLoaderSettings, 4, (v.cur.iActiveCustomerCount = 8000),     "iActiveCustomerCount", "cur.iActiveCustomerCount(8000) > cur.iConfiguredCustomerCount(5000)");
CHECK_INVALID(      CLoaderSettings, 5, (v.cur.iConfiguredCustomerCount = 5001), "iConfiguredCustomerCount", "cur.iConfiguredCustomerCount % 1000(1) != 0(0)");
CHECK_INVALID(      CLoaderSettings, 6, (v.cur.iStartingCustomer = 0),           "iStartingCustomer", "cur.iStartingCustomer(0) < 1(1)");
CHECK_INVALID(      CLoaderSettings, 7, (v.cur.iStartingCustomer = 1002, v.cur.iCustomerCount=1000), "iStartingCustomer", "cur.iStartingCustomer % 1000(2) != 1(1)");
CHECK_INVALID(      CLoaderSettings, 8, (v.cur.iCustomerCount = 1001),    "iCustomerCount", "cur.iCustomerCount % 1000(1) != 0(0)");
CHECK_INVALID(      CLoaderSettings, 9, (v.cur.iStartingCustomer = 1001), "iCustomerCount", "cur.iCustomerCount + cur.iStartingCustomer - 1(6000) > cur.iConfiguredCustomerCount(5000)");
CHECK_NONCOMPLIANT( CLoaderSettings, 10, (v.cur.iConfiguredCustomerCount = 4000, v.cur.iActiveCustomerCount = 4000, v.cur.iCustomerCount= 4000), "iConfiguredCustomerCount", "cur.iConfiguredCustomerCount(4000) < 5000(5000)");
CHECK_NONCOMPLIANT( CLoaderSettings, 11, (v.cur.iActiveCustomerCount = 4000),     "iActiveCustomerCount", "cur.iActiveCustomerCount(4000) < 5000(5000)");
CHECK_NONCOMPLIANT( CLoaderSettings, 12, (v.cur.iConfiguredCustomerCount = 6000), "iActiveCustomerCount", "cur.iActiveCustomerCount(5000) != cur.iConfiguredCustomerCount(6000)");
CHECK_DEFAULT(      CLoaderSettings, 13, iScaleFactor,         500, 400, true);
CHECK_DEFAULT(      CLoaderSettings, 14, iDaysOfInitialTrades, 300, 200, true );

CHECK_COMPLIANT(    CDriverGlobalSettings, 1, true);
CHECK_INVALID(      CDriverGlobalSettings, 2, (v.cur.iConfiguredCustomerCount = 900, v.cur.iActiveCustomerCount = 900), "iConfiguredCustomerCount", "cur.iConfiguredCustomerCount(900) < 1000(1000)");
CHECK_INVALID(      CDriverGlobalSettings, 3, (v.cur.iActiveCustomerCount = 900),      "iActiveCustomerCount",     "cur.iActiveCustomerCount(900) < 1000(1000)");
CHECK_INVALID(      CDriverGlobalSettings, 4, (v.cur.iActiveCustomerCount = 8000),     "iActiveCustomerCount",     "cur.iActiveCustomerCount(8000) > cur.iConfiguredCustomerCount(5000)");
CHECK_INVALID(      CDriverGlobalSettings, 5, (v.cur.iConfiguredCustomerCount = 5001), "iConfiguredCustomerCount", "cur.iConfiguredCustomerCount % 1000(1) != 0(0)");
CHECK_NONCOMPLIANT( CDriverGlobalSettings, 6, (v.cur.iConfiguredCustomerCount = 4000, v.cur.iActiveCustomerCount = 4000), "iConfiguredCustomerCount", "cur.iConfiguredCustomerCount(4000) < 5000(5000)");
CHECK_NONCOMPLIANT( CDriverGlobalSettings, 7, (v.cur.iActiveCustomerCount = 4000),     "iActiveCustomerCount", "cur.iActiveCustomerCount(4000) < 5000(5000)");
CHECK_NONCOMPLIANT( CDriverGlobalSettings, 8, (v.cur.iConfiguredCustomerCount = 6000), "iActiveCustomerCount", "cur.iActiveCustomerCount(5000) != cur.iConfiguredCustomerCount(6000)");
CHECK_DEFAULT(      CDriverGlobalSettings, 9,  iScaleFactor,         500, 400, true);
CHECK_DEFAULT(      CDriverGlobalSettings, 10, iDaysOfInitialTrades, 300, 200, true );

CHECK_COMPLIANT(    CDriverCESettings,  1, true);

CHECK_COMPLIANT( CDriverCEPartitionSettings, 1, true);
CHECK_COMPLIANT( CDriverCEPartitionSettings, 2, (v.cur.iMyStartingCustomerId = 0, v.cur.iMyCustomerCount = 0, v.cur.iPartitionPercent = 0));
CHECK_COMPLIANT( CDriverCEPartitionSettings, 3, (v.cur.iMyStartingCustomerId = 1, v.cur.iMyCustomerCount = 5000, v.cur.iPartitionPercent = 50));
CHECK_PCT(       CDriverCEPartitionSettings, 4, iPartitionPercent, (v.cur.iMyStartingCustomerId = 1, v.cur.iMyCustomerCount = 5000));
CHECK_INVALID(   CDriverCEPartitionSettings, 5, (v.cur.iMyStartingCustomerId = 2, v.cur.iMyCustomerCount = 5000, v.cur.iPartitionPercent = 50), "iMyStartingCustomerId", "cur.iMyStartingCustomerId % 1000(2) != 1(1)");
CHECK_INVALID(   CDriverCEPartitionSettings, 6, (v.cur.iMyStartingCustomerId = 1, v.cur.iMyCustomerCount = 900, v.cur.iPartitionPercent = 50), "iMyCustomerCount", "cur.iMyCustomerCount(900) < 1000(1000)");
CHECK_INVALID(   CDriverCEPartitionSettings, 7, (v.cur.iMyStartingCustomerId = 1, v.cur.iMyCustomerCount = 5001, v.cur.iPartitionPercent = 50), "iMyCustomerCount", "cur.iMyCustomerCount % 1000(1) != 0(0)");
CHECK_DEFAULT(   CDriverCEPartitionSettings, 8, iPartitionPercent, 50, 40, (v.cur.iMyStartingCustomerId = 1, v.cur.iMyCustomerCount = 5000));

CHECK_COMPLIANT(    CDriverMEESettings, 1, true);

CHECK_COMPLIANT(    CDriverDMSettings,  1, true);

// Define TDriverCETxnSettings as a type so that our macros will work on it.
namespace TPCE
{
    typedef struct TDriverCETxnSettings TDriverCETxnSettings;
}

CHECK_COMPLIANT(    TDriverCETxnSettings, 1,  true);
CHECK_INVALID(      TDriverCETxnSettings, 2,  (v.CP_settings.cur.by_cust_id=-1),          "by_cust_id",                     "cur.by_cust_id(-1) < 0(0)");
CHECK_INVALID(      TDriverCETxnSettings, 3,  (v.MW_settings.cur.by_watch_list=-1),       "by_watch_list",                  "cur.by_watch_list(-1) < 0(0)");
CHECK_INVALID(      TDriverCETxnSettings, 4,  (v.SD_settings.cur.LOBAccessPercentage=-1), "LOBAccessPercentage",            "cur.LOBAccessPercentage(-1) < 0(0)");
CHECK_INVALID(      TDriverCETxnSettings, 5,  (v.TL_settings.cur.do_frame1=-1),           "do_frame1",                      "cur.do_frame1(-1) < 0(0)");
CHECK_INVALID(      TDriverCETxnSettings, 6,  (v.TO_settings.cur.rollback=-1),            "rollback",                       "cur.rollback(-1) < 0(0)");
CHECK_INVALID(      TDriverCETxnSettings, 7,  (v.TU_settings.cur.do_frame1=-1),           "do_frame1",                      "cur.do_frame1(-1) < 0(0)");
CHECK_NONCOMPLIANT( TDriverCETxnSettings, 8,  (v.CP_settings.cur.get_history=10),         "get_history",                    "get_history(10) != 50");
CHECK_NONCOMPLIANT( TDriverCETxnSettings, 9,  (v.MW_settings.cur.by_watch_list=0, v.MW_settings.cur.by_acct_id=95), "by_acct_id", "by_acct_id(95) != 35");
CHECK_NONCOMPLIANT( TDriverCETxnSettings, 10, (v.SD_settings.cur.LOBAccessPercentage=10), "LOBAccessPercentage",            "LOBAccessPercentage(10) != 1");
CHECK_NONCOMPLIANT( TDriverCETxnSettings, 11, (v.TL_settings.cur.MaxRowsFrame1=10),       "MaxRowsFrame1",                  "MaxRowsFrame1(10) != 20");
CHECK_NONCOMPLIANT( TDriverCETxnSettings, 12, (v.TO_settings.cur.rollback=10),            "rollback",                       "rollback(10) != 1");
CHECK_NONCOMPLIANT( TDriverCETxnSettings, 13, (v.TU_settings.cur.MaxRowsFrame1=10),       "MaxRowsFrame1",                  "MaxRowsFrame1(10) != 20");


text:
package Mousetrap;

import java.awt.Color;

import repast.simphony.visualization.visualization3D.AppearanceFactory;
import repast.simphony.visualization.visualization3D.style.DefaultStyle3D;
import repast.simphony.visualization.visualization3D.style.TaggedAppearance;

/**
 * @author Nick Collier
 * @version $Revision: 1.3 $ $Date: 2006/01/06 22:54:29 $
 */
public class MouseTrapNodeStyle extends DefaultStyle3D<MouseTrap> {

	public TaggedAppearance getAppearance(MouseTrap agent, TaggedAppearance taggedAppearance, Object shapeID) {

		if (taggedAppearance == null) {
			taggedAppearance = new TaggedAppearance("R");
			AppearanceFactory.setMaterialAppearance(taggedAppearance.getAppearance(), Color.RED);
		}

		if (agent.isTriggered() && taggedAppearance.getTag().equals("R")) {
			taggedAppearance.setTag("G");
			AppearanceFactory.setMaterialAppearance(taggedAppearance.getAppearance(), Color.GREEN);
		}

		return taggedAppearance;
	}
}

redpajama_set_name: RedPajamaGithub


text:
package nl.tudelft.ewi.dea;

import nl.tudelft.ewi.dea.di.ServerStartupListener;

import com.fasterxml.jackson.databind.ObjectMapper;

public final class TestResources {

	public static final ServerConfig SERVER_CONFIG = serverConfig();

	private static ServerConfig serverConfig() {
		ObjectMapper mapper = new CommonModule().objectMapper();
		return ServerStartupListener.readServerConfig(mapper);
	}

}


text:
from textwrap import dedent

try:
    from pkgutil import resolve_name
except ImportError:
    from pkgutil_resolve_name import resolve_name

import click
import twisted.trial.reporter

from virtue.reporters import ComponentizedReporter
from virtue.runner import run

class _Reporter(click.ParamType):

    name = "reporter"

    _BUILT_IN = {
        "bwverbose": twisted.trial.reporter.VerboseTextReporter,
        "default": ComponentizedReporter,
        "subunit": twisted.trial.reporter.SubunitReporter,
        "summary": twisted.trial.reporter.MinimalReporter,
        "text": twisted.trial.reporter.TextReporter,
        "timing": twisted.trial.reporter.TimingTextReporter,
        "tree": twisted.trial.reporter.TreeReporter,
        "verbose": twisted.trial.reporter.VerboseTextReporter,
    }

    def convert(self, value, param, ctx):
        if not isinstance(value, str):
            return value

        Reporter = self._BUILT_IN.get(value)
        if Reporter is None:
            try:
                Reporter = resolve_name(value)
            except (ValueError, ImportError, AttributeError):
                raise click.BadParameter(f"{value!r} is not a known reporter")

        return Reporter()

@click.command(context_settings=dict(help_option_names=["-h", "--help"]))
@click.version_option(prog_name="virtue")
@click.option(
    "--reporter",
    default="default",
    help=dedent(
        """
        the name of a reporter to use for outputting test results.
        Can either be a fully qualified object name (e.g.
        mypackage.MyReporter) or one of the builtin reporter names:
        """,
    ) + ", ".join(_Reporter._BUILT_IN),
    type=_Reporter(),
)
@click.option(
    "-x", "--stop-after",
    default=None,
    count=True,
    help=(
        "stop the test run after unsuccessful results. May be "
        "repeated to stop after that many non-successes."
    ),
)
@click.argument("tests", nargs=-1)
@click.pass_context
def main(context, **kwargs):
    """
    virtue discovers and runs tests found in the given objects.

    Provide it with one or more tests (packages, modules or objects) to run.

    """

    result = run(**kwargs)
    context.exit(not result.testsRun or not result.wasSuccessful())


text:
data Person = Person
  { name :: String, -- comment
--                  ^^^^^^^^^^ comment.line.double-dash.haskell
    sons :: [Person] -- comment
--                   ^^^^^^^^^^ comment.line.double-dash.haskell
  }

{- comment1 -}
-- <------------- comment.block.haskell
  {- comment 2 -}
-- <~~------------- comment.block.haskell
data A where {- comment3 -}
--           ^^^^^^^^^^^^^^ comment.block.haskell
  {- comment4 -}
-- <~~------------- comment.block.haskell
{-  comment5 -}
-- <------------- comment.block.haskell


text:
package com.ibm.streamsx.health.prepare.uomconverter.services;

import java.io.ObjectStreamException;
import java.util.HashMap;
import java.util.Map;

import javax.measure.Unit;

import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;

import com.ibm.streams.operator.logging.TraceLevel;
import com.ibm.streamsx.health.ingest.types.connector.PublishConnector;
import com.ibm.streamsx.health.ingest.types.connector.SubscribeConnector;
import com.ibm.streamsx.health.ingest.types.model.Observation;
import com.ibm.streamsx.health.prepare.uomconverter.ConversionResult;
import com.ibm.streamsx.health.prepare.uomconverter.ConverterFactory;
import com.ibm.streamsx.health.prepare.uomconverter.converters.BPMToBPSConverter;
import com.ibm.streamsx.health.prepare.uomconverter.converters.BPSToBPMConverter;
import com.ibm.streamsx.health.prepare.uomconverter.converters.CelciusToFahrenheitConverter;
import com.ibm.streamsx.health.prepare.uomconverter.converters.FahrenheitToCelciusConverter;
import com.ibm.streamsx.health.prepare.uomconverter.converters.VoltageConverter;
import com.ibm.streamsx.topology.TStream;
import com.ibm.streamsx.topology.Topology;
import com.ibm.streamsx.topology.context.ContextProperties;
import com.ibm.streamsx.topology.context.StreamsContext.Type;
import com.ibm.streamsx.topology.context.StreamsContextFactory;
import com.ibm.streamsx.topology.function.Supplier;
import com.ibm.streamsx.topology.function.UnaryOperator;

import systems.uom.common.USCustomary;
import systems.uom.quantity.Information;
import tec.units.ri.spi.DefaultServiceProvider;
import tec.uom.lib.common.function.Parser;
import tec.uom.se.unit.Units;

public class UOMConverterService {

	public static final String UOM_TOPIC = "prepare-uom-converter";

	private Topology topo;
	private String subscribeTopic;
	private Supplier<String> uomMapFile;
	private Map<String, Object> config;
	private Map<String, Object> submissionParams;

	public UOMConverterService(String subscribeTopic) {
		this.subscribeTopic = subscribeTopic;
		topo = new Topology("UOMConverterService");
		topo.addClassDependency(Unit.class);
		topo.addClassDependency(Units.class);
		topo.addClassDependency(Parser.class);
		topo.addClassDependency(USCustomary.class);
		topo.addClassDependency(Information.class);
		topo.addClassDependency(DefaultServiceProvider.class);

		uomMapFile = topo.createSubmissionParameter("uom.map.file", String.class);
		config = new HashMap<String, Object>();
		submissionParams = new HashMap<String, Object>();

		config.put(ContextProperties.SUBMISSION_PARAMS, submissionParams);
	}

	public void setSubmissionParameter(String name, Object value) {
		submissionParams.put(name, value);
	}

	public void build() {
		/*
		 * You *MUST* register all available converters here. Otherwise,
		 * you will end up NoConverterFoundExceptions.
		 */
		ConverterFactory factory = new ConverterFactory();
		factory.registerConverterClass(VoltageConverter.class);
		factory.registerConverterClass(CelciusToFahrenheitConverter.class);
		factory.registerConverterClass(FahrenheitToCelciusConverter.class);
		factory.registerConverterClass(BPSToBPMConverter.class);
		factory.registerConverterClass(BPMToBPSConverter.class);

		/*
		 * Build topology
		 */
		TStream<Observation> obsStream = SubscribeConnector.subscribe(topo, this.subscribeTopic);
		TStream<Observation> updateObsStream = obsStream.modify(new UnitConverter(factory, uomMapFile));

		PublishConnector.publishObservation(updateObsStream, getPublishedTopic());
	}

	public void run(Type contextType) throws Exception {
		build();
		StreamsContextFactory.getStreamsContext(contextType).submit(topo, config).get();
	}

	public String getPublishedTopic() {
		return UOM_TOPIC;
	}

	/**
	 * This class is responsible for converting the value in the incoming
	 * Observation tuple from one unit to another. It takes a map file as
	 * an input and sends it to the ConverterFactory in order to generate
	 * the necessary converters.
	 *
	 *
	 * @author streamsadmin
	 *
	 */
	private static class UnitConverter implements UnaryOperator<Observation> {
		private static final long serialVersionUID = 1L;

		private Supplier<String> uomMapFile;
		private ConverterFactory factory;

		public UnitConverter(ConverterFactory factory, Supplier<String> uomMapFile) {
			this.factory = factory;
			this.uomMapFile = uomMapFile;
		}

		public Object readResolve() throws ObjectStreamException {
			try {
				factory.createConvertersFromMapFile(uomMapFile.get());
			} catch (Exception e) {
				e.printStackTrace();
				ObjectStreamException ose = new ObjectStreamException() {
					private static final long serialVersionUID = 1L;
				};
				ose.addSuppressed(e);
				throw ose;
			}
			return this;
		}

		@Override
		public Observation apply(Observation obs) {
			String uom = obs.getReading().getUom();

			if(factory.hasConverter(uom)) {
				ConversionResult result = factory.convert(obs.getReading().getValue(), uom);
				obs.getReading().setUom(result.getOutputUOM());
				obs.getReading().setValue(result.getConvertedValue());
			}

			return obs;
		}
	}

	public static void main(String[] args) throws Exception {
		Option mapFileOption = Option.builder("m")
								.longOpt("map-file")
								.hasArg()
								.argName("map file path")
								.required()
								.build();

		Option subscriptionOption = Option.builder("s")
										.longOpt("subscription-topic")
										.hasArg()
										.argName("subscription topic")
										.required()
										.build();

		Option debugOption = Option.builder("d")
								.longOpt("debug")
								.hasArg()
								.argName("isDebugEnabled")
								.required(false)
								.type(Boolean.class)
								.build();

		Options options = new Options();
		options.addOption(mapFileOption);
		options.addOption(debugOption);
		options.addOption(subscriptionOption);

		CommandLineParser parser = new DefaultParser();
		CommandLine cmd = null;

		try {
			cmd = parser.parse(options, args);
		} catch (ParseException e) {
			HelpFormatter formatter = new HelpFormatter();
			formatter.printHelp("help", options);

			throw(e);
		}

		boolean isDebug = cmd.getOptionValue("d", "false").equals("true");

		UOMConverterService svc = new UOMConverterService(cmd.getOptionValue("s"));
		svc.setSubmissionParameter("uom.map.file", cmd.getOptionValue("m"));

		if(isDebug) {
			svc.config.put(ContextProperties.TRACING_LEVEL, TraceLevel.TRACE);
		}
		svc.run(Type.DISTRIBUTED);

		if(isDebug) {
			Topology t = new Topology("UOMConverterPrintService");
			SubscribeConnector.subscribe(t, UOM_TOPIC).print();
			StreamsContextFactory.getStreamsContext(Type.DISTRIBUTED).submit(t).get();
		}
	}
}


text:
#include "StdAfx.h"
#include "DiffusedShadowStrategy.h"
#include "GDIPath.h"

using namespace TextDesigner;

DiffusedShadowStrategy::DiffusedShadowStrategy(void)
:
m_bOutlinetext(false),
m_pbrushText(NULL),
m_bClrText(true)
{
}

DiffusedShadowStrategy::~DiffusedShadowStrategy(void)
{
}

ITextStrategy* DiffusedShadowStrategy::Clone()
{
	DiffusedShadowStrategy* p = new DiffusedShadowStrategy();
	if(m_bClrText)
		p->Init(m_clrText, m_clrOutline, m_nThickness, m_bOutlinetext);
	else
		p->Init(m_pbrushText, m_clrOutline, m_nThickness, m_bOutlinetext);

	return static_cast<ITextStrategy*>(p);
}

void DiffusedShadowStrategy::Init(
	Gdiplus::Color clrText,
	Gdiplus::Color clrOutline,
	int nThickness,
	bool bOutlinetext)
{
	m_clrText = clrText;
	m_bClrText = true;
	m_clrOutline = clrOutline;
	m_nThickness = nThickness;
	m_bOutlinetext = bOutlinetext;
}

void DiffusedShadowStrategy::Init(
	Gdiplus::Brush* pbrushText,
	Gdiplus::Color clrOutline,
	int nThickness,
	bool bOutlinetext)
{
	m_pbrushText = pbrushText;
	m_bClrText = false;
	m_clrOutline = clrOutline;
	m_nThickness = nThickness;
	m_bOutlinetext = bOutlinetext;
}

bool DiffusedShadowStrategy::DrawString(
	Gdiplus::Graphics* pGraphics,
	Gdiplus::FontFamily* pFontFamily,
	Gdiplus::FontStyle fontStyle,
	int nfontSize,
	const wchar_t*pszText,
	Gdiplus::Point ptDraw,
	Gdiplus::StringFormat* pStrFormat)
{
	using namespace Gdiplus;
	GraphicsPath path;
	Status status = path.AddString(pszText,wcslen(pszText),pFontFamily,fontStyle,(REAL)nfontSize,ptDraw,pStrFormat);
	if(status!=Ok)
		return false;

	for(int i=1; i<=m_nThickness; ++i)
	{
		Pen pen(m_clrOutline, (REAL)i);
		pen.SetLineJoin(LineJoinRound);
		pGraphics->DrawPath(&pen, &path);
	}

	Status status2 = Ok;
	if(m_bOutlinetext==false)
	{
		for(int i=1; i<=m_nThickness; ++i)
		{
			SolidBrush brush(m_clrText);
			status2 = pGraphics->FillPath(&brush, &path);
		}
	}
	else
	{
		SolidBrush brush(m_clrText);
		status2 = pGraphics->FillPath(&brush, &path);
	}

	return status2 == Ok;
}

bool DiffusedShadowStrategy::DrawString(
	Gdiplus::Graphics* pGraphics,
	Gdiplus::FontFamily* pFontFamily,
	Gdiplus::FontStyle fontStyle,
	int nfontSize,
	const wchar_t*pszText,
	Gdiplus::Rect rtDraw,
	Gdiplus::StringFormat* pStrFormat)
{
	using namespace Gdiplus;
	GraphicsPath path;
	Status status = path.AddString(pszText,wcslen(pszText),pFontFamily,fontStyle,(REAL)nfontSize,rtDraw,pStrFormat);
	if(status!=Ok)
		return false;

	for(int i=1; i<=m_nThickness; ++i)
	{
		Pen pen(m_clrOutline, (REAL)i);
		pen.SetLineJoin(LineJoinRound);
		pGraphics->DrawPath(&pen, &path);
	}

	Status status2 = Ok;
	if(m_bOutlinetext==false)
	{
		for(int i=1; i<=m_nThickness; ++i)
		{
			SolidBrush brush(m_clrText);
			status2 = pGraphics->FillPath(&brush, &path);
		}
	}
	else
	{
		SolidBrush brush(m_clrText);
		status2 = pGraphics->FillPath(&brush, &path);
	}

	return status2 == Ok;
}

bool DiffusedShadowStrategy::GdiDrawString(
	Gdiplus::Graphics* pGraphics,
	LOGFONTW* pLogFont,
	const wchar_t*pszText,
	Gdiplus::Point ptDraw)
{
	using namespace Gdiplus;
	Gdiplus::GraphicsPath* pPath=NULL;
	bool b = GDIPath::GetStringPath(
		pGraphics,
		&pPath,
		pszText,
		pLogFont,
		ptDraw);

	if(false==b)
	{
		if(pPath)
		{
			delete pPath;
			pPath = NULL;
		}
		return false;
	}

	for(int i=1; i<=m_nThickness; ++i)
	{
		Pen pen(m_clrOutline, (REAL)i);
		pen.SetLineJoin(LineJoinRound);
		pGraphics->DrawPath(&pen, pPath);
	}

	Status status2 = Ok;
	if(m_bOutlinetext==false)
	{
		for(int i=1; i<=m_nThickness; ++i)
		{
			SolidBrush brush(m_clrText);
			status2 = pGraphics->FillPath(&brush, pPath);
		}
	}
	else
	{
		SolidBrush brush(m_clrText);
		status2 = pGraphics->FillPath(&brush, pPath);
	}

	if(pPath)
	{
		delete pPath;
		pPath = NULL;
	}
	return status2 == Ok;
}

bool DiffusedShadowStrategy::GdiDrawString(
	Gdiplus::Graphics* pGraphics,
	LOGFONTW* pLogFont,
	const wchar_t*pszText,
	Gdiplus::Rect rtDraw)
{
	using namespace Gdiplus;
	Gdiplus::GraphicsPath* pPath=NULL;
	bool b = GDIPath::GetStringPath(
		pGraphics,
		&pPath,
		pszText,
		pLogFont,
		rtDraw);

	if(false==b)
	{
		if(pPath)
		{
			delete pPath;
			pPath = NULL;
		}
		return false;
	}

	for(int i=1; i<=m_nThickness; ++i)
	{
		Pen pen(m_clrOutline, (REAL)i);
		pen.SetLineJoin(LineJoinRound);
		pGraphics->DrawPath(&pen, pPath);
	}

	Status status2 = Ok;
	if(m_bOutlinetext==false)
	{
		for(int i=1; i<=m_nThickness; ++i)
		{
			SolidBrush brush(m_clrText);
			status2 = pGraphics->FillPath(&brush, pPath);
		}
	}
	else
	{
		SolidBrush brush(m_clrText);
		status2 = pGraphics->FillPath(&brush, pPath);
	}

	if(pPath)
	{
		delete pPath;
		pPath = NULL;
	}
	return status2 == Ok;
}

inline UINT DiffusedShadowStrategy::Alphablend(UINT dest, UINT source, BYTE nAlpha)
{
	if( 0 == nAlpha )
		return dest;

	if( 255 == nAlpha )
		return source;

	BYTE nInvAlpha = ~nAlpha;

	BYTE nSrcRed   = (source & 0xff0000) >> 16;
	BYTE nSrcGreen = (source & 0xff00) >> 8;
	BYTE nSrcBlue  = (source & 0xff);

	BYTE nDestRed   = (dest & 0xff0000) >> 16;
	BYTE nDestGreen = (dest & 0xff00) >> 8;
	BYTE nDestBlue  = (dest & 0xff);

	BYTE nRed  = ( nSrcRed   * nAlpha + nDestRed * nInvAlpha   )>>8;
	BYTE nGreen= ( nSrcGreen * nAlpha + nDestGreen * nInvAlpha )>>8;
	BYTE nBlue = ( nSrcBlue  * nAlpha + nDestBlue * nInvAlpha  )>>8;

	return 0xff000000 | nRed << 16 | nGreen << 8 | nBlue;
}


text:
layout: page
title: Excellent Charm Foundation Party
date: 2016-05-24
author: Barbara Durham
tags: weekly links, java
status: published
summary: Donec rutrum turpis lacus, non vulputate odio pretium.
banner: images/banner/leisure-05.jpg
booking:
  startDate: 08/07/2018
  endDate: 08/09/2018
  ctyhocn: PVLNCHX
  groupCode: ECFP
published: true
---
Phasellus sed laoreet sem. Fusce molestie, arcu sed iaculis porta, augue leo rutrum arcu, id dapibus arcu nibh nec orci. Phasellus id ipsum ut sem bibendum blandit eget vel mauris. Quisque vulputate, leo sed gravida pellentesque, odio est vestibulum odio, ut iaculis lectus metus quis quam. Proin bibendum, urna a gravida congue, neque purus venenatis magna, eget ullamcorper est nisi eget sapien. Morbi vel enim viverra ante fringilla porttitor eget at est. Cras malesuada, eros vitae hendrerit varius, mauris metus mollis arcu, nec convallis purus justo ut arcu. Donec euismod leo nisi, ut aliquet diam sodales sit amet.

* Proin commodo ligula ut diam porttitor semper
* Nullam ullamcorper sapien eget ligula vulputate pretium
* Donec imperdiet est eget fringilla euismod
* Mauris at nulla faucibus, euismod massa ut, consectetur enim
* Praesent pretium mi eget dolor vulputate accumsan.

Sed rutrum ante nunc, eu aliquam mi cursus vel. Integer iaculis vel diam a molestie. Sed justo nibh, dapibus at libero a, bibendum volutpat elit. Integer id fringilla ante. Vivamus varius quam quis rhoncus facilisis. Ut faucibus dui turpis, nec malesuada sapien suscipit vitae. Etiam tincidunt finibus ex bibendum vulputate. Donec lobortis eleifend tempor. Aliquam nec diam quis felis suscipit pharetra. Aenean tincidunt velit diam, nec tincidunt quam semper vel. Morbi dapibus pretium sem ac consequat. Nulla libero ipsum, scelerisque non magna et, sagittis faucibus neque.


text:
package com.github.mauricio.async.db.util

import scala.util._
import scala.util.Success

object Version {

  private def tryParse( index : Int, pieces : Array[String] ) : Int = {

    Try {
      pieces(index).toInt
    } match {
      case Success(value) => value
      case Failure(e) => 0
    }

  }

  def apply( version : String ) : Version = {
    val pieces = version.split('.')
    new Version( tryParse(0, pieces), tryParse(1, pieces), tryParse(2, pieces) )
  }

}

case class Version( major : Int, minor : Int, maintenance : Int ) extends Ordered[Version] {
  override def compare( y: Version): Int = {

    if ( this == y ) {
      return 0
    }

    if ( this.major != y.major ) {
      return this.major.compare(y.major)
    }

    if ( this.minor != y.minor ) {
      return this.minor.compare(y.minor)
    }

    this.maintenance.compare(y.maintenance)
  }
}


text:
from decimal import Decimal

from stellar_sdk import Asset
from stellar_sdk.call_builder.call_builder_async import StrictSendPathsCallBuilder
from tests.call_builder.call_builder_async import client, horizon_url

class TestStrictSendPathsCallBuilder:
    def test_init_destination_account(self):
        builder = StrictSendPathsCallBuilder(
            horizon_url,
            client,
            source_asset=Asset(
                "EUR", "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN"
            ),
            source_amount="10.25",
            destination="GARSFJNXJIHO6ULUBK3DBYKVSIZE7SC72S5DYBCHU7DKL22UXKVD7MXP",
        )
        assert builder.endpoint == "paths/strict-send"
        assert builder.params == {
            "source_amount": "10.25",
            "source_asset_type": "credit_alphanum4",
            "source_asset_code": "EUR",
            "source_asset_issuer": "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN",
            "destination_account": "GARSFJNXJIHO6ULUBK3DBYKVSIZE7SC72S5DYBCHU7DKL22UXKVD7MXP",
        }

    def test_destination_source_assets(self):
        builder = StrictSendPathsCallBuilder(
            horizon_url,
            client,
            source_asset=Asset(
                "EUR", "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN"
            ),
            source_amount=Decimal("10.25"),
            destination=[
                Asset(
                    "USD", "GAYSHLG75RPSMXWJ5KX7O7STE6RSZTD6NE4CTWAXFZYYVYIFRUVJIBJH"
                ),
                Asset.native(),
                Asset(
                    "XCN", "GCNY5OXYSY4FKHOPT2SPOQZAOEIGXB5LBYW3HVU3OWSTQITS65M5RCNY"
                ),
            ],
        )
        assert builder.endpoint == "paths/strict-send"
        assert builder.params == {
            "source_amount": "10.25",
            "source_asset_type": "credit_alphanum4",
            "source_asset_code": "EUR",
            "source_asset_issuer": "GDSBCQO34HWPGUGQSP3QBFEXVTSR2PW46UIGTHVWGWJGQKH3AFNHXHXN",
            "destination_assets": "USD:GAYSHLG75RPSMXWJ5KX7O7STE6RSZTD6NE4CTWAXFZYYVYIFRUVJIBJH,native,XCN:GCNY5OXYSY4FKHOPT2SPOQZAOEIGXB5LBYW3HVU3OWSTQITS65M5RCNY",
        }


text:
using System;
class PrimeNumberCheck
{
    // Write an expression that checks if given positive integer number n (n <= 100) is prime
    // (i.e. it is divisible without remainder only to itself and 1).
    //Examples: n=1-> Prime? = falce;       n=2-> Prime? = true;      n=3-> Prime? = true;
    static void Main()
    {
        Console.Write("Please enter an positive integer number:");
        int number = int.Parse(Console.ReadLine());
        bool check = true;
        for (int divisor = 2; divisor <= Math.Sqrt(number); divisor++)
        {
            if (number % divisor == 0)
            {
                check = false;
            }
        }
        if (check)
        {
            Console.WriteLine(number + " is prime.");
        }
        else
        {
            Console.WriteLine(number + " is not prime.");
        }
    }
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
        "http://www.w3.org/TR/html4/loose.dtd">

    <title>FiniteStateMachine2</title>
    <meta name="date" content="2016-01-30">
    <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation
        links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.ftc.opmodes.statemachine

Class FiniteStateMachine2<STATE extends
        java.lang.Enum & FiniteStateMachine2.State,T
        extends com.qualcomm.robotcore.eventloop.opmode.OpMode>

java.lang.Object

org.ftc.opmodes.statemachine.FiniteStateMachine2<STATE,T>

public class FiniteStateMachine2<STATE extends java.lang.Enum & FiniteStateMachine2.State,T extends com.qualcomm.robotcore.eventloop.opmode.OpMode>
extends java.lang.Object

Nested Class Summary

Nested Classes

                                Modifier and Type
                                Class and Description

                                static interface
                                FiniteStateMachine2.State<STATE extends java.lang.Enum & FiniteStateMachine2.State>

The definition of a state for use by this
                                        FSM.

Constructor Summary

Constructors

                                Constructor and Description

                                FiniteStateMachine2(java.lang.Class<?
                                    extends STATE> enumeration,
                                    T opMode)

Creates an Finite State Machine with the
                                        states described in the class declaration of the
                                        enum.

                                FiniteStateMachine2(STATE[] states,
                                    T opMode)

Creates a Finite State Machine with the given
                                        FiniteStateMachine2.State
                                        array being the available states.

                                FiniteStateMachine2(STATE state,
                                    T opMode)

Creates a Finite State Machine with the given
                                        start FiniteStateMachine2.State.

Method Summary

All Methods Static Methods Instance Methods Concrete Methods

                                Modifier and Type
                                Method and Description

                                void
                                changeState(STATE state)

Changes the state to specified FiniteStateMachine2.State

                                static <E extends java.lang.Enum &
                                    FiniteStateMachine2.State,O
                                    extends com.qualcomm.robotcore.eventloop.opmode.OpMode>
FiniteStateMachine2<E,O>

                                create(E state,
                                    O opMode)

                                void
                                execute()

Executes the current state once by running
                                        the
                                        FiniteStateMachine2.State.execute(),
                                        then checks to see if
                                        the state needs to be changed by running the changeState(Enum)
                                        method of the
                                        currently running state

                                int
                                index()

The index of the current FiniteStateMachine2.State
                                        in the set of possible States

                                STATE

                                state()

Returns the currently running state

Methods inherited from class java.lang.Object

                                clone, equals, finalize, getClass, hashCode, notify,
                                    notifyAll, toString, wait, wait, wait

Constructor Detail

FiniteStateMachine2

public FiniteStateMachine2(java.lang.Class<? extends STATE> enumeration,
                           T opMode)
                    throws java.lang.NullPointerException

Creates an Finite State Machine with the states
                                    described in the class declaration of the
                                    enum. The OpMode is a reference to your OpMode to
                                    get the dependencies of state,
                                    and inject them into the state

Parameters:

enumeration - the class of the enum containing
                                        the states

opMode - the active OpMode to get
                                        dependencies from

Throws:

java.lang.NullPointerException

FiniteStateMachine2

public FiniteStateMachine2(STATE[] states,
                           T opMode)
                    throws java.lang.NullPointerException

Creates a Finite State Machine with the given FiniteStateMachine2.State
                                    array being the available states.
                                    The OpMode is a reference to your OpMode to get the dependencies
                                    of state, and inject them
                                    into the state

Parameters:

states - an array of states

opMode - the active OpMode to get
                                        dependencies from

Throws:

java.lang.NullPointerException - when either
                                        the states or opMode
                                        parameter is null

FiniteStateMachine2

public FiniteStateMachine2(STATE state,
                           T opMode)
                    throws java.lang.NullPointerException

Creates a Finite State Machine with the given
                                    start FiniteStateMachine2.State.
                                    The rest of the states are
                                    then inferred to be the other elements within the enum that the
                                    start state is. The OpMode is
                                    a reference to your OpMode to get the dependencies of state, and
                                    inject them into the state

Parameters:

state - the start state of the Finite State
                                        Machine

opMode - the active OpMode to get
                                        dependencies from

Throws:

java.lang.NullPointerException - when either
                                        the states or opMode
                                        parameter is null

Method Detail

create

public static <E extends java.lang.Enum & FiniteStateMachine2.State,O extends com.qualcomm.robotcore.eventloop.opmode.OpMode> FiniteStateMachine2<E,O> create(E state,
                                                                                O opMode)

execute

public void execute()

Executes the current state once by running the FiniteStateMachine2.State.execute(),
                                    then checks to see if
                                    the state needs to be changed by running the changeState(Enum)
                                    method of the
                                    currently running state

index

public int index()

The index of the current FiniteStateMachine2.State
                                    in the set of possible States

Returns:

the index of the current states

state

public STATE state()

Returns the currently running state

Returns:

the current state

changeState

public void changeState(STATE state)
                 throws java.lang.NullPointerException

Changes the state to specified FiniteStateMachine2.State

Parameters:

state - the new state to switch to

Throws:

java.lang.NullPointerException - if the given
                                        state is null

Skip navigation
        links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
namespace Tvl.VisualStudio.Shell
{
    using System;
    using Microsoft.VisualStudio.Shell;
    using Microsoft.VisualStudio.Shell.Interop;

    partial class VsServiceProviderExtensions11
    {
        /// <summary>
        /// Gets the global <see cref="IVsAppContainerDeveloperLicensing"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsAppContainerDeveloperLicensing"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsAppContainerDeveloperLicensing GetAppContainerDeveloperLicensing(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsAppContainerDeveloperLicensing, IVsAppContainerDeveloperLicensing>();
        }

        /// <summary>
        /// Gets the global <see cref="IVsAppContainerProjectDeploy"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsAppContainerProjectDeploy"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsAppContainerProjectDeploy GetAppContainerProjectDeploy(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsAppContainerProjectDeploy, IVsAppContainerProjectDeploy>();
        }

        /// <summary>
        /// Gets the global <see cref="IAppxManifestDesignerService"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IAppxManifestDesignerService"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IAppxManifestDesignerService GetAppxManifestDesignerService(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SAppxManifestDesignerService, IAppxManifestDesignerService>();
        }

        /// <summary>
        /// Gets the global <see cref="IVsDebugRemoteDiscoveryUI"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsDebugRemoteDiscoveryUI"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsDebugRemoteDiscoveryUI GetDebugRemoteDiscoveryUI(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsDebugRemoteDiscoveryUI, IVsDebugRemoteDiscoveryUI>();
        }

        /// <summary>
        /// Gets the global <see cref="IVsDebugTargetSelectionService"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsDebugTargetSelectionService"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsDebugTargetSelectionService GetDebugTargetSelectionService(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsDebugTargetSelectionService, IVsDebugTargetSelectionService>();
        }

        /// <summary>
        /// Gets the global <see cref="IVsDifferenceService"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsDifferenceService"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsDifferenceService GetDifferenceService(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsDifferenceService, IVsDifferenceService>();
        }

        /// <summary>
        /// Gets the global <see cref="IVsFileMergeService"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsFileMergeService"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsFileMergeService GetFileMergeService(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsFileMergeService, IVsFileMergeService>();
        }

        /// <summary>
        /// Gets the global <see cref="IVsGlobalSearch"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsGlobalSearch"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsGlobalSearch GetGlobalSearch(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsGlobalSearch, IVsGlobalSearch>();
        }

        /// <summary>
        /// Gets the global <see cref="IVsHierarchyManipulation"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsHierarchyManipulation"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsHierarchyManipulation GetHierarchyManipulation(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsHierarchyManipulation, IVsHierarchyManipulation>();
        }

        /// <summary>
        /// Gets the global <see cref="IVsImageService"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsImageService"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsImageService GetImageService(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsImageService, IVsImageService>();
        }

        /// <summary>
        /// Gets the global <see cref="IVsProfilerLauncher"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsProfilerLauncher"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsProfilerLauncher GetProfilerLauncher(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsProfilerLauncher, IVsProfilerLauncher>();
        }

        /// <summary>
        /// Gets the global <see cref="VsProjectCapabilityExpressionMatcher"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsBooleanSymbolExpressionEvaluator"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsBooleanSymbolExpressionEvaluator GetProjectCapabilityExpressionMatcher(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<VsProjectCapabilityExpressionMatcher, IVsBooleanSymbolExpressionEvaluator>();
        }

        /// <summary>
        /// Gets the global <see cref="IVsReferenceManager"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsReferenceManager"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsReferenceManager GetReferenceManager(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsReferenceManager, IVsReferenceManager>();
        }

        /// <summary>
        /// Gets the global <see cref="IVsTaskSchedulerService"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsTaskSchedulerService"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsTaskSchedulerService GetTaskSchedulerService(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsTaskSchedulerService, IVsTaskSchedulerService>();
        }

        /// <summary>
        /// Gets the global <see cref="IVsWindowSearchHostFactory"/> service.
        /// </summary>
        /// <param name="serviceProvider">The service provider.</param>
        /// <returns>The <see cref="IVsWindowSearchHostFactory"/> service provided by the service provider, or <see langword="null"/> if the service provider was not able to provide an instance of the service.</returns>
        /// <exception cref="ArgumentNullException">If <paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        [CLSCompliant(false)]
        public static IVsWindowSearchHostFactory GetWindowSearchHostFactory(this SVsServiceProvider serviceProvider)
        {
            if (serviceProvider == null)
                throw new ArgumentNullException(nameof(serviceProvider));

            return serviceProvider.GetService<SVsWindowSearchHostFactory, IVsWindowSearchHostFactory>();
        }
    }
}


text:
If you want to authenticate users using the iframe integration, go to `Administration > Accounts > Iframe` and enable it:

- [How to use iframe integration for authentication](authentication/)

## Use Rocket.Chat in your site/app inside an iframe

If you need listen to events, go to `Administration > General > Iframe Integration` and enable send (events) or receive (commands), depending on your needs:

- [How to use iframe integration events](events/)
- [How to use iframe integration commands](commands/)
- [Using embedded layout mode](../embedded-layout)


text:
package sterling.lang.compiler.syntax;

import static sterling.lang.util.StringUtil.stringify;

import java.util.Objects;
import sterling.lang.SterlingException;

public class FalsyCondition extends SyntaxNode {

    private final SyntaxNode condition;
    private final SyntaxNode expression;

    public FalsyCondition(SyntaxNode condition, SyntaxNode expression) {
        this.condition = condition;
        this.expression = expression;
    }

    @Override
    public <R, S> R accept(SyntaxVisitor<R, S> visitor, S state) throws SterlingException {
        return visitor.visitFalsyCondition(this, state);
    }

    @Override
    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (o instanceof FalsyCondition) {
            FalsyCondition other = (FalsyCondition) o;
            return Objects.equals(condition, other.condition)
                && Objects.equals(expression, other.expression);
        } else {
            return false;
        }
    }

    public SyntaxNode getCondition() {
        return condition;
    }

    public SyntaxNode getExpression() {
        return expression;
    }

    @Override
    public int hashCode() {
        return Objects.hash(condition, expression);
    }

    @Override
    public String toString() {
        return stringify(this, condition, expression);
    }
}


text:
<!DOCTYPE html>

        <meta charset="utf-8" />
        <title>YUI Tag</title>

Calendar

        <ycalendar></ycalendar>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;

namespace Cheer.JsonVisualizer.CoreServices.Interop
{
    public class User32
    {
        [DllImport("user32.dll")]
        public static extern IntPtr GetDC(IntPtr hWnd);
        [DllImport("user32.dll")]
        public static extern bool ReleaseDC(IntPtr hWnd, IntPtr dc);

        [DllImport("user32.dll")]
        public static extern IntPtr GetDesktopWindow();

        [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
        public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr w, IntPtr l);
    }
}


text:
#ifndef STROMX_CVSUPPORT_SENDRECEIVETEST_H
#define STROMX_CVSUPPORT_SENDRECEIVETEST_H

#include <cppunit/extensions/HelperMacros.h>

namespace stromx
{
    namespace runtime
    {
        class Factory;
        class OperatorTester;
    }

    namespace cvsupport
    {

        class SendReceiveTest : public CPPUNIT_NS :: TestFixture
        {
            CPPUNIT_TEST_SUITE (SendReceiveTest);
            CPPUNIT_TEST (testSendImage);
            CPPUNIT_TEST (testSendGrayImage);
            CPPUNIT_TEST (testSendDoubleMatrix);
            CPPUNIT_TEST_SUITE_END ();

            public:
                SendReceiveTest() : m_send(0), m_receive(0), m_factory(0) {}

                void setUp();
                void tearDown();

            protected:
                void testSendImage();
                void testSendGrayImage();
                void testSendDoubleMatrix();

            private:
                runtime::OperatorTester* m_send;
                runtime::OperatorTester* m_receive;
                runtime::Factory* m_factory;
        };
    }
}

#endif // STROMX_CVSUPPORT_SENDRECEIVETEST_H


text:
class InotifyTools < Formula
  desc "C library and command-line programs providing a simple interface to inotify"
  homepage "https://github.com/inotify-tools/inotify-tools"
  url "https://github.com/inotify-tools/inotify-tools/archive/refs/tags/3.22.6.0.tar.gz"
  sha256 "c6b7e70f1df09e386217102a1fe041cfc15fa4f3d683d2970140b6814cf2ed12"
  license "GPL-2.0-or-later"

  bottle do
    sha256 cellar: :any_skip_relocation, x86_64_linux: "217cb8bbe5f6fb2a15b73e8f9edb670b2a639a5781ef922d4b85a5e0061d4857"
  end

  depends_on "autoconf" => :build
  depends_on "automake" => :build
  depends_on "libtool" => :build
  depends_on :linux

  def install
    system "./autogen.sh"
    system "./configure", "--prefix=#{prefix}",
                          "--mandir=#{man}",
                          "--disable-dependency-tracking"
    system "make", "install"
  end

  test do
    touch "test.txt"
    stdin, stdout, stderr, = Open3.popen3("#{bin}/inotifywatch test.txt --timeout 2")
    stdin.close
    assert_match "Establishing watches", stderr.read
    stdout.close
    stderr.close
  end
end


text:
import { CodeWithSourceMap } from './metadata';
export interface StyleTransformer {
    (code: string, url?: string): CodeWithSourceMap;
}
export interface TemplateTransformer {
    (code: string, url?: string): CodeWithSourceMap;
}
export interface UrlResolver {
    (url: string | null): string | null;
}
export declare const LogLevel: {
    Debug: number;
    Error: number;
    Info: number;
    None: number;
};
declare type ValueOf<T> = T[keyof T];
export interface Config {
    interpolation: [string, string];
    logLevel: ValueOf<typeof LogLevel>;
    predefinedDirectives: DirectiveDeclaration[];
    resolveUrl: UrlResolver;
    transformStyle: StyleTransformer;
    transformTemplate: TemplateTransformer;
}
export interface DirectiveDeclaration {
    exportAs?: string;
    hostAttributes?: string[];
    hostListeners?: string[];
    hostProperties?: string[];
    inputs?: string[];
    outputs?: string[];
    selector: string;
}
export declare const Config: Config;
export {};


text:
#ifndef __OPENCV_VIZCORE_HPP__
#define __OPENCV_VIZCORE_HPP__

#include <opencv2/viz/types.hpp>
#include <opencv2/viz/widgets.hpp>
#include <opencv2/viz/viz3d.hpp>

namespace cv
{
    namespace viz
    {
        //! takes coordiante frame data and builds transfrom to global coordinate frame
        CV_EXPORTS Affine3d makeTransformToGlobal(const Vec3d& axis_x, const Vec3d& axis_y, const Vec3d& axis_z, const Vec3d& origin = Vec3d::all(0));

        //! constructs camera pose from position, focal_point and up_vector (see gluLookAt() for more infromation)
        CV_EXPORTS Affine3d makeCameraPose(const Vec3d& position, const Vec3d& focal_point, const Vec3d& y_dir);

        //! retrieves a window by its name. If no window with such name, then it creates new.
        CV_EXPORTS Viz3d getWindowByName(const String &window_name);

        //! Unregisters all Viz windows from internal database. After it 'getWindowByName()' will create new windows instead getting existing from the database.
        CV_EXPORTS void unregisterAllWindows();

        //! Displays image in specified window
        CV_EXPORTS Viz3d imshow(const String& window_name, InputArray image, const Size& window_size = Size(-1, -1));

        //! checks float value for Nan
        inline bool isNan(float x)
        {
            unsigned int *u = reinterpret_cast<unsigned int *>(&x);
            return ((u[0] & 0x7f800000) == 0x7f800000) && (u[0] & 0x007fffff);
        }

        //! checks double value for Nan
        inline bool isNan(double x)
        {
            unsigned int *u = reinterpret_cast<unsigned int *>(&x);
            return (u[1] & 0x7ff00000) == 0x7ff00000 && (u[0] != 0 || (u[1] & 0x000fffff) != 0);
        }

        //! checks vectors for Nans
        template<typename _Tp, int cn> inline bool isNan(const Vec<_Tp, cn>& v)
        { return isNan(v.val[0]) || isNan(v.val[1]) || isNan(v.val[2]); }

        //! checks point for Nans
        template<typename _Tp> inline bool isNan(const Point3_<_Tp>& p)
        { return isNan(p.x) || isNan(p.y) || isNan(p.z); }

        ///////////////////////////////////////////////////////////////////////////////////////////////
        /// Read/write clouds. Supported formats: ply, xyz, obj and stl (readonly)

        CV_EXPORTS void writeCloud(const String& file, InputArray cloud, InputArray colors = noArray(), InputArray normals = noArray(), bool binary = false);
        CV_EXPORTS Mat  readCloud (const String& file, OutputArray colors = noArray(), OutputArray normals = noArray());

        ///////////////////////////////////////////////////////////////////////////////////////////////
        /// Reads mesh. Only ply format is supported now and no texture load support

        CV_EXPORTS Mesh readMesh(const String& file);

        ///////////////////////////////////////////////////////////////////////////////////////////////
        /// Read/write poses and trajectories

        CV_EXPORTS bool readPose(const String& file, Affine3d& pose, const String& tag = "pose");
        CV_EXPORTS void writePose(const String& file, const Affine3d& pose, const String& tag = "pose");

        //! takes vector<Affine3<T>> with T = float/dobule and writes to a sequence of files with given filename format
        CV_EXPORTS void writeTrajectory(InputArray traj, const String& files_format = "pose%05d.xml", int start = 0, const String& tag = "pose");

        //! takes vector<Affine3<T>> with T = float/dobule and loads poses from sequence of files
        CV_EXPORTS void readTrajectory(OutputArray traj, const String& files_format = "pose%05d.xml", int start = 0, int end = INT_MAX, const String& tag = "pose");

        ///////////////////////////////////////////////////////////////////////////////////////////////
        /// Computing normals for mesh

        CV_EXPORTS void computeNormals(const Mesh& mesh, OutputArray normals);

    } /* namespace viz */
} /* namespace cv */

#endif /* __OPENCV_VIZCORE_HPP__ */


text:
title: "CAROL BOLD ART EXHIBIT"
date: "2000-01-01 18:04:27 -06:00"
categories:
- exhibit
- spring
subtitle: ""
layout: "free-events"
event-image: "carol-bold-exhibit.jpg"
event-dates: "APRIL 27 - MAY 20, 2018"
event-location: "Red Butte Garden Visitor Center"
button-type: "register"
tickets-link: ""
registration-info: "Questions?
Please call 801-585-0556"
instructor-info: "N/A"
member-cost: "Free"
public-cost: "Garden Admission"
event-notes: ""
tickets-button: "hide"
refund-policy: "hide"
published: false
---

Since moving to Southern Utah in 2010, Carol Bold has not only embodied the spirit of the Southwest, she has lived it. She has traveled its winding trails, explored its rough terrain, traversed vast plateaus and broad basins, gazed up towering canyon walls, climbed through deserts of painted rocks, and looked down on the world from the clouds above. Through her vivid use of color, her iconic imagery and her eye for the dramatic, she sets out to capture the beauty of the southwest in way its never been seen.

For more, please visit: www.carolbold.com