text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Sci. Rep. Tokyo Bunrika Daig. , Sect. B 5: 90 (1941)

#### Original name
Ophionectria cockerellii Ellis & Everh.

### Remarks
null


text:
    #pragma hdrstop
#endif

#if wxUSE_XRC && wxUSE_BANNERWINDOW

#include "wx/xrc/xh_bannerwindow.h"
#include "wx/bannerwindow.h"

wxIMPLEMENT_DYNAMIC_CLASS(wxBannerWindowXmlHandler, wxXmlResourceHandler);

wxBannerWindowXmlHandler::wxBannerWindowXmlHandler()
    : wxXmlResourceHandler()
{
    AddWindowStyles();
}

wxObject *wxBannerWindowXmlHandler::DoCreateResource()
{
    XRC_MAKE_INSTANCE(banner, wxBannerWindow)

    banner->Create(m_parentAsWindow,
                   GetID(),
                   GetDirection(wxS("direction")),
                   GetPosition(),
                   GetSize(),
                   GetStyle(wxS("style")),
                   GetName());

    SetupWindow(banner);

    const wxColour colStart = GetColour(wxS("gradient-start"));
    const wxColour colEnd = GetColour(wxS("gradient-end"));
    if ( colStart.IsOk() || colEnd.IsOk() )
    {
        if ( !colStart.IsOk() || !colEnd.IsOk() )
        {
            ReportError
            (
                "Both start and end gradient colours must be "
                "specified if either one is."
            );
        }
        else
        {
            banner->SetGradient(colStart, colEnd);
        }
    }

    wxBitmap bitmap = GetBitmap();
    if ( bitmap.IsOk() )
    {
        if ( colStart.IsOk() || colEnd.IsOk() )
        {
            ReportError
            (
                "Gradient colours are ignored by wxBannerWindow "
                "if the background bitmap is specified."
            );
        }

        banner->SetBitmap(bitmap);
    }

    banner->SetText(GetText(wxS("title")), GetText(wxS("message")));

    return banner;
}

bool wxBannerWindowXmlHandler::CanHandle(wxXmlNode *node)
{
    return IsOfClass(node, wxS("wxBannerWindow"));
}

#endif // wxUSE_XRC && wxUSE_BANNERWINDOW

redpajama_set_name: RedPajamaGithub


text:
#include "google/protobuf/text_format.h"
#include "gtest/gtest.h"
#include "include/istio/utils/attribute_names.h"
#include "src/istio/control/http/client_context.h"
#include "src/istio/control/http/controller_impl.h"
#include "src/istio/control/http/mock_check_data.h"
#include "src/istio/control/http/mock_report_data.h"
#include "src/istio/control/mock_mixer_client.h"

using ::google::protobuf::TextFormat;
using ::google::protobuf::util::Status;
using ::istio::mixer::v1::Attributes;
using ::istio::mixer::v1::config::client::HttpClientConfig;
using ::istio::mixer::v1::config::client::ServiceConfig;
using ::istio::mixerclient::CancelFunc;
using ::istio::mixerclient::CheckDoneFunc;
using ::istio::mixerclient::CheckResponseInfo;
using ::istio::mixerclient::DoneFunc;
using ::istio::mixerclient::MixerClient;
using ::istio::mixerclient::TransportCheckFunc;
using ::istio::quota_config::Requirement;
using ::istio::utils::LocalAttributes;

using ::testing::_;
using ::testing::Invoke;
using ::testing::ReturnRef;

namespace istio {
namespace control {
namespace http {

// local inbound
const char kLocalInbound[] = R"(
attributes {
  key: "destination.uid"
  value {
    string_value: "kubernetes://client-84469dc8d7-jbbxt.default"
  }
}
)";

const char kLocalOutbound[] = R"(
attributes {
  key: "source.uid"
  value {
    string_value: "kubernetes://client-84469dc8d7-jbbxt.default"
  }
}
)";

const char kLocalForward[] = R"(
attributes {
  key: "source.uid"
  value {
    string_value: "kubernetes://client-84469dc8d7-jbbxt.default"
  }
}
)";

// The default client config
const char kDefaultClientConfig[] = R"(
service_configs {
  key: ":default"
  value {
    mixer_attributes {
      attributes {
        key: "route0-key"
        value {
          string_value: "route0-value"
        }
      }
    }
    forward_attributes {
      attributes {
        key: "source-key-override"
        value {
          string_value: "service-value"
        }
      }
    }
  }
}
default_destination_service: ":default"
mixer_attributes {
  attributes {
    key: "global-key"
    value {
      string_value: "global-value"
    }
  }
}
forward_attributes {
  attributes {
    key: "source-key-override"
    value {
      string_value: "global-value"
    }
  }
}
)";

// The client config with empty service map.
const char kEmptyClientConfig[] = R"(
forward_attributes {
  attributes {
    key: "source-key"
    value {
      string_value: "source-value"
    }
  }
}
)";

class RequestHandlerImplTest : public ::testing::Test {
 public:
  void SetUp() { SetUpMockController(kDefaultClientConfig); }

  void SetUpMockController(const std::string &config_text) {
    SetUpMockController(config_text, kLocalInbound, kLocalOutbound,
                        kLocalForward);
  }

  void SetUpMockController(const std::string &config_text,
                           const std::string &local_inbound_attributes,
                           const std::string &local_outbound_attributes,
                           const std::string &local_forward_attributes) {
    ASSERT_TRUE(TextFormat::ParseFromString(config_text, &client_config_));

    LocalAttributes la;
    ASSERT_TRUE(
        TextFormat::ParseFromString(local_inbound_attributes, &la.inbound));
    ASSERT_TRUE(
        TextFormat::ParseFromString(local_outbound_attributes, &la.outbound));
    ASSERT_TRUE(
        TextFormat::ParseFromString(local_forward_attributes, &la.forward));

    mock_client_ = new ::testing::NiceMock<MockMixerClient>;
    // set LRU cache size is 3

    client_context_ = std::make_shared<ClientContext>(
        std::unique_ptr<MixerClient>(mock_client_), client_config_, 3, la,
        false);
    controller_ =
        std::unique_ptr<Controller>(new ControllerImpl(client_context_));
  }

  void SetServiceConfig(const std::string &name, const ServiceConfig &config) {
    (*client_config_.mutable_service_configs())[name] = config;
  }

  void ApplyPerRouteConfig(const ServiceConfig &service_config,
                           Controller::PerRouteConfig *per_route) {
    per_route->service_config_id = "1111";
    controller_->AddServiceConfig(per_route->service_config_id, service_config);
  }

  std::shared_ptr<ClientContext> client_context_;
  HttpClientConfig client_config_;
  ::testing::NiceMock<MockMixerClient> *mock_client_;
  std::unique_ptr<Controller> controller_;
};

TEST_F(RequestHandlerImplTest, TestServiceConfigManage) {
  EXPECT_FALSE(controller_->LookupServiceConfig("1111"));
  ServiceConfig config;
  controller_->AddServiceConfig("1111", config);
  EXPECT_TRUE(controller_->LookupServiceConfig("1111"));

  // LRU cache size is 3
  controller_->AddServiceConfig("2222", config);
  controller_->AddServiceConfig("3333", config);
  controller_->AddServiceConfig("4444", config);

  // 1111 should be purged
  EXPECT_FALSE(controller_->LookupServiceConfig("1111"));
  EXPECT_TRUE(controller_->LookupServiceConfig("2222"));
  EXPECT_TRUE(controller_->LookupServiceConfig("3333"));
  EXPECT_TRUE(controller_->LookupServiceConfig("4444"));
}

TEST_F(RequestHandlerImplTest, TestHandlerDisabledCheckReport) {
  ::testing::NiceMock<MockCheckData> mock_data;
  ::testing::NiceMock<MockHeaderUpdate> mock_header;
  // Not to extract attributes since both Check and Report are disabled.
  EXPECT_CALL(mock_data, GetSourceIpPort(_, _)).Times(0);
  EXPECT_CALL(mock_data, GetPrincipal(_, _)).Times(0);

  // Check should NOT be called.
  EXPECT_CALL(*mock_client_, Check(_, _, _, _)).Times(0);

  ServiceConfig config;
  config.set_disable_check_calls(true);
  config.set_disable_report_calls(true);
  Controller::PerRouteConfig per_route;
  ApplyPerRouteConfig(config, &per_route);

  auto handler = controller_->CreateRequestHandler(per_route);
  handler->Check(&mock_data, &mock_header, nullptr,
                 [](const CheckResponseInfo &info) {
                   EXPECT_TRUE(info.response_status.ok());
                 });
}

TEST_F(RequestHandlerImplTest, TestHandlerDisabledCheck) {
  ::testing::NiceMock<MockCheckData> mock_data;
  ::testing::NiceMock<MockHeaderUpdate> mock_header;
  // Report is enabled so Check Attributes are not extracted.
  EXPECT_CALL(mock_data, GetSourceIpPort(_, _)).Times(0);
  EXPECT_CALL(mock_data, GetPrincipal(_, _)).Times(0);

  // Check should NOT be called.
  EXPECT_CALL(*mock_client_, Check(_, _, _, _)).Times(0);

  ServiceConfig config;
  config.set_disable_check_calls(true);
  Controller::PerRouteConfig per_route;
  ApplyPerRouteConfig(config, &per_route);

  auto handler = controller_->CreateRequestHandler(per_route);
  handler->Check(&mock_data, &mock_header, nullptr,
                 [](const CheckResponseInfo &info) {
                   EXPECT_TRUE(info.response_status.ok());
                 });
}

TEST_F(RequestHandlerImplTest, TestPerRouteAttributes) {
  ::testing::NiceMock<MockCheckData> mock_data;
  ::testing::NiceMock<MockHeaderUpdate> mock_header;
  EXPECT_CALL(mock_data, GetSourceIpPort(_, _)).Times(1);
  EXPECT_CALL(mock_data, GetPrincipal(_, _)).Times(2);

  // Check should be called.
  EXPECT_CALL(*mock_client_, Check(_, _, _, _))
      .WillOnce(Invoke([](const Attributes &attributes,
                          const std::vector<Requirement> &quotas,
                          TransportCheckFunc transport,
                          CheckDoneFunc on_done) -> CancelFunc {
        auto map = attributes.attributes();
        EXPECT_EQ(map["global-key"].string_value(), "global-value");
        EXPECT_EQ(map["per-route-key"].string_value(), "per-route-value");
        return nullptr;
      }));

  ServiceConfig config;
  auto map2 = config.mutable_mixer_attributes()->mutable_attributes();
  (*map2)["per-route-key"].set_string_value("per-route-value");
  Controller::PerRouteConfig per_route;
  ApplyPerRouteConfig(config, &per_route);

  auto handler = controller_->CreateRequestHandler(per_route);
  handler->Check(&mock_data, &mock_header, nullptr, nullptr);
}

TEST_F(RequestHandlerImplTest, TestDefaultRouteAttributes) {
  ::testing::NiceMock<MockCheckData> mock_data;
  ::testing::NiceMock<MockHeaderUpdate> mock_header;
  EXPECT_CALL(mock_data, GetSourceIpPort(_, _)).Times(1);
  EXPECT_CALL(mock_data, GetPrincipal(_, _)).Times(2);

  // Check should be called.
  EXPECT_CALL(*mock_client_, Check(_, _, _, _))
      .WillOnce(Invoke([](const Attributes &attributes,
                          const std::vector<Requirement> &quotas,
                          TransportCheckFunc transport,
                          CheckDoneFunc on_done) -> CancelFunc {
        auto map = attributes.attributes();
        EXPECT_EQ(map["global-key"].string_value(), "global-value");
        EXPECT_EQ(map["route0-key"].string_value(), "route0-value");
        return nullptr;
      }));

  // Attribute is forwarded: route override
  EXPECT_CALL(mock_header, AddIstioAttributes(_))
      .WillOnce(Invoke([](const std::string &data) {
        Attributes forwarded_attr;
        EXPECT_TRUE(forwarded_attr.ParseFromString(data));
        auto map = forwarded_attr.attributes();
        EXPECT_EQ(map["source-key-override"].string_value(), "service-value");
      }));

  // destination.server is empty, will use default one
  Controller::PerRouteConfig config;
  auto handler = controller_->CreateRequestHandler(config);
  handler->Check(&mock_data, &mock_header, nullptr, nullptr);
}

TEST_F(RequestHandlerImplTest, TestRouteAttributes) {
  ::testing::NiceMock<MockCheckData> mock_data;
  ::testing::NiceMock<MockHeaderUpdate> mock_header;
  EXPECT_CALL(mock_data, GetSourceIpPort(_, _)).Times(1);
  EXPECT_CALL(mock_data, GetPrincipal(_, _)).Times(2);

  ServiceConfig route_config;
  auto map3 = route_config.mutable_mixer_attributes()->mutable_attributes();
  (*map3)["route1-key"].set_string_value("route1-value");
  (*map3)["global-key"].set_string_value("service-value");
  SetServiceConfig("route1", route_config);

  // Check should be called.
  EXPECT_CALL(*mock_client_, Check(_, _, _, _))
      .WillOnce(Invoke([](const Attributes &attributes,
                          const std::vector<Requirement> &quotas,
                          TransportCheckFunc transport,
                          CheckDoneFunc on_done) -> CancelFunc {
        auto map = attributes.attributes();
        EXPECT_EQ(map["global-key"].string_value(), "service-value");
        EXPECT_EQ(map["route1-key"].string_value(), "route1-value");
        return nullptr;
      }));

  // Attribute is forwarded: global
  EXPECT_CALL(mock_header, AddIstioAttributes(_))
      .WillOnce(Invoke([](const std::string &data) {
        Attributes forwarded_attr;
        EXPECT_TRUE(forwarded_attr.ParseFromString(data));
        auto map = forwarded_attr.attributes();
        EXPECT_EQ(map["source-key-override"].string_value(), "global-value");
      }));

  Controller::PerRouteConfig config;
  config.destination_service = "route1";
  auto handler = controller_->CreateRequestHandler(config);
  handler->Check(&mock_data, &mock_header, nullptr, nullptr);
}

TEST_F(RequestHandlerImplTest, TestPerRouteQuota) {
  ::testing::NiceMock<MockCheckData> mock_data;
  ::testing::NiceMock<MockHeaderUpdate> mock_header;

  // Check should be called.
  EXPECT_CALL(*mock_client_, Check(_, _, _, _))
      .WillOnce(Invoke([](const Attributes &attributes,
                          const std::vector<Requirement> &quotas,
                          TransportCheckFunc transport,
                          CheckDoneFunc on_done) -> CancelFunc {
        auto map = attributes.attributes();
        EXPECT_EQ(map["global-key"].string_value(), "global-value");
        EXPECT_EQ(quotas.size(), 1);
        EXPECT_EQ(quotas[0].quota, "route0-quota");
        EXPECT_EQ(quotas[0].charge, 10);
        return nullptr;
      }));

  ServiceConfig config;
  auto quota = config.add_quota_spec()->add_rules()->add_quotas();
  quota->set_quota("route0-quota");
  quota->set_charge(10);
  Controller::PerRouteConfig per_route;
  ApplyPerRouteConfig(config, &per_route);

  auto handler = controller_->CreateRequestHandler(per_route);
  handler->Check(&mock_data, &mock_header, nullptr, nullptr);
}

TEST_F(RequestHandlerImplTest, TestPerRouteApiSpec) {
  ::testing::NiceMock<MockCheckData> mock_data;
  ::testing::NiceMock<MockHeaderUpdate> mock_header;
  EXPECT_CALL(mock_data, FindHeaderByType(_, _))
      .WillRepeatedly(
          Invoke([](CheckData::HeaderType type, std::string *value) -> bool {
            if (type == CheckData::HEADER_PATH) {
              *value = "/books/120";
              return true;
            }
            if (type == CheckData::HEADER_METHOD) {
              *value = "GET";
              return true;
            }
            return false;
          }));

  // Check should be called.
  EXPECT_CALL(*mock_client_, Check(_, _, _, _))
      .WillOnce(Invoke([](const Attributes &attributes,
                          const std::vector<Requirement> &quotas,
                          TransportCheckFunc transport,
                          CheckDoneFunc on_done) -> CancelFunc {
        auto map = attributes.attributes();
        EXPECT_EQ(map["global-key"].string_value(), "global-value");
        EXPECT_EQ(map["api.name"].string_value(), "test-name");
        EXPECT_EQ(map["api.operation"].string_value(), "test-method");
        return nullptr;
      }));

  ServiceConfig config;
  auto api_spec = config.add_http_api_spec();
  auto map1 = api_spec->mutable_attributes()->mutable_attributes();
  (*map1)["api.name"].set_string_value("test-name");
  auto pattern = api_spec->add_patterns();
  auto map2 = pattern->mutable_attributes()->mutable_attributes();
  (*map2)["api.operation"].set_string_value("test-method");
  pattern->set_http_method("GET");
  pattern->set_uri_template("/books/*");

  Controller::PerRouteConfig per_route;
  ApplyPerRouteConfig(config, &per_route);

  auto handler = controller_->CreateRequestHandler(per_route);
  handler->Check(&mock_data, &mock_header, nullptr, nullptr);
}

TEST_F(RequestHandlerImplTest, TestHandlerCheck) {
  ::testing::NiceMock<MockCheckData> mock_data;
  ::testing::NiceMock<MockHeaderUpdate> mock_header;
  EXPECT_CALL(mock_data, GetSourceIpPort(_, _)).Times(1);
  EXPECT_CALL(mock_data, GetPrincipal(_, _)).Times(2);

  // Check should be called.
  EXPECT_CALL(*mock_client_, Check(_, _, _, _)).Times(1);

  ServiceConfig config;
  Controller::PerRouteConfig per_route;
  ApplyPerRouteConfig(config, &per_route);

  auto handler = controller_->CreateRequestHandler(per_route);
  handler->Check(&mock_data, &mock_header, nullptr, nullptr);
}

TEST_F(RequestHandlerImplTest, TestDefaultApiKey) {
  ::testing::NiceMock<MockCheckData> mock_data;
  ::testing::NiceMock<MockHeaderUpdate> mock_header;
  EXPECT_CALL(mock_data, FindQueryParameter(_, _))
      .WillRepeatedly(
          Invoke([](const std::string &name, std::string *value) -> bool {
            if (name == "key") {
              *value = "test-api-key";
              return true;
            }
            return false;
          }));

  // Check should be called.
  EXPECT_CALL(*mock_client_, Check(_, _, _, _))
      .WillOnce(Invoke([](const Attributes &attributes,
                          const std::vector<Requirement> &quotas,
                          TransportCheckFunc transport,
                          CheckDoneFunc on_done) -> CancelFunc {
        auto map = attributes.attributes();
        EXPECT_EQ(map[utils::AttributeName::kRequestApiKey].string_value(),
                  "test-api-key");
        return nullptr;
      }));

  // destionation.server is empty, will use default one
  Controller::PerRouteConfig config;
  auto handler = controller_->CreateRequestHandler(config);
  handler->Check(&mock_data, &mock_header, nullptr, nullptr);
}

TEST_F(RequestHandlerImplTest, TestHandlerReport) {
  ::testing::NiceMock<MockCheckData> mock_check;
  ::testing::NiceMock<MockReportData> mock_report;
  ::google::protobuf::Map<std::string, ::google::protobuf::Struct>
      filter_metadata;
  EXPECT_CALL(mock_check, GetSourceIpPort(_, _)).Times(1);
  EXPECT_CALL(mock_report, GetResponseHeaders()).Times(1);
  EXPECT_CALL(mock_report, GetReportInfo(_)).Times(1);
  EXPECT_CALL(mock_report, GetDynamicFilterState())
      .Times(1)
      .WillOnce(ReturnRef(filter_metadata));

  // Report should be called.
  EXPECT_CALL(*mock_client_, Report(_)).Times(1);

  ServiceConfig config;
  Controller::PerRouteConfig per_route;
  ApplyPerRouteConfig(config, &per_route);

  auto handler = controller_->CreateRequestHandler(per_route);
  handler->Report(&mock_check, &mock_report);
}

TEST_F(RequestHandlerImplTest, TestHandlerDisabledReport) {
  ::testing::NiceMock<MockCheckData> mock_check;
  ::testing::NiceMock<MockReportData> mock_report;
  EXPECT_CALL(mock_check, GetSourceIpPort(_, _)).Times(0);
  EXPECT_CALL(mock_report, GetResponseHeaders()).Times(0);
  EXPECT_CALL(mock_report, GetReportInfo(_)).Times(0);
  EXPECT_CALL(mock_report, GetDynamicFilterState()).Times(0);

  // Report should NOT be called.
  EXPECT_CALL(*mock_client_, Report(_)).Times(0);

  ServiceConfig config;
  config.set_disable_report_calls(true);
  Controller::PerRouteConfig per_route;
  ApplyPerRouteConfig(config, &per_route);

  auto handler = controller_->CreateRequestHandler(per_route);
  handler->Report(&mock_check, &mock_report);
}

TEST_F(RequestHandlerImplTest, TestEmptyConfig) {
  SetUpMockController(kEmptyClientConfig);

  ::testing::NiceMock<MockCheckData> mock_check;
  ::testing::NiceMock<MockHeaderUpdate> mock_header;
  // Not to extract attributes since both Check and Report are disabled.
  EXPECT_CALL(mock_check, GetSourceIpPort(_, _)).Times(0);
  EXPECT_CALL(mock_check, GetPrincipal(_, _)).Times(0);

  // Attributes is forwarded.
  EXPECT_CALL(mock_header, AddIstioAttributes(_))
      .WillOnce(Invoke([](const std::string &data) {
        Attributes forwarded_attr;
        EXPECT_TRUE(forwarded_attr.ParseFromString(data));
        auto map = forwarded_attr.attributes();
        EXPECT_EQ(map["source-key"].string_value(), "source-value");
      }));

  // Check should NOT be called.
  EXPECT_CALL(*mock_client_, Check(_, _, _, _)).Times(0);

  ::testing::NiceMock<MockReportData> mock_report;
  EXPECT_CALL(mock_report, GetResponseHeaders()).Times(0);
  EXPECT_CALL(mock_report, GetReportInfo(_)).Times(0);
  EXPECT_CALL(mock_report, GetDynamicFilterState()).Times(0);

  // Report should NOT be called.
  EXPECT_CALL(*mock_client_, Report(_)).Times(0);

  Controller::PerRouteConfig config;
  auto handler = controller_->CreateRequestHandler(config);
  handler->Check(&mock_check, &mock_header, nullptr,
                 [](const CheckResponseInfo &info) {
                   EXPECT_TRUE(info.response_status.ok());
                 });
  handler->Report(&mock_check, &mock_report);
}

}  // namespace http
}  // namespace control
}  // namespace istio


text:
require 'spec_helper'

describe file('/etc/default/clagd') do
  it { should be_file }
end

describe service('clagd') do
  it { should be_running }
end

describe command('clagctl') do
  its(:stdout) { should match(/The peer is alive/) }
end


text:
package test.com.sagui.model.pages;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Locale;

import com.sagui.dataset.commons.dataset.IBookmark;
import com.sagui.dataset.commons.i18n.CurrentLanguageResolver;
import com.sagui.dataset.commons.i18n.I18n;
import com.sagui.model.FatuElement;
import com.sagui.model.action.IFatuActionEvent;
import com.sagui.model.action.IFatuActionListener;
import com.sagui.model.button.FatuButton;
import com.sagui.model.container.form.FatuForm;
import com.sagui.model.container.page.FatuPage;
import com.sagui.model.feature.FatuSize;
import com.sagui.model.label.FatuLabel;
import com.sagui.model.layout.auto.FatuAutoLayout;
import com.sagui.model.layout.auto.FatuAutoLayoutRule;
import com.sagui.model.list.combo.editable.FatuComboBox;
import com.sagui.model.list.editable.impl.FatuSimpleListModel;
import com.sagui.model.selection.FatuSimpleSelectionModel;
import com.sagui.model.selection.IFatuSelectionListener;

/**
 * test.com.jext.model.pages.ComboBoxTestPage
 *
 * @author F0FP250
 *
 */
public class ComboBoxTestPage extends FatuPage<FatuAutoLayout> {

    private FatuForm<FatuAutoLayout> form1;

    public ComboBoxTestPage() {
        super(FatuAutoLayout.AUTO_LAYOUT);
    }

    @Override
    protected void init() {

        this.form1 = new FatuForm<FatuAutoLayout>(FatuAutoLayout.AUTO_LAYOUT);
        this.form1.setName("form1");
        this.form1.setTitle("Form 1");
        this.form1.setSize(new FatuSize(350, 100));
        addChild(form1, FatuAutoLayoutRule.AUTO_LAYOUT_RULE);

        List<ComboItem> items = new ArrayList<ComboItem>();
        for (int i = 0; i < 10; i++) {
            items.add(new ComboItem("Item " + i));
        }

        final FatuSimpleListModel<ComboItem> model = new FatuSimpleListModel<ComboItem>();
        model.setItems(items);
        FatuSimpleSelectionModel<IBookmark<ComboItem>> selectionModel = new FatuSimpleSelectionModel<IBookmark<ComboItem>>();
        IBookmark<ComboItem> selected = model.getBookmark(5);
        selectionModel.select(selected);

        final FatuComboBox<ComboItem> combo = new FatuComboBox<ComboItem>(model, selectionModel);
        I18n i18 = new I18n(combo.getId());
        i18.setTranslation(CurrentLanguageResolver.getInstance().getCurrentLocale(), "Combo Box");
        i18.setTranslation(Locale.ENGLISH, "EN Combo Box");
        i18.setTranslation(Locale.GERMAN, "DE Combo Box");
        combo.setLabel(i18);

        this.form1.addChild(combo, FatuAutoLayoutRule.AUTO_LAYOUT_RULE);

        FatuButton btnAddItem = new FatuButton();
        I18n btnAddItemLbl = new I18n(btnAddItem.getId());
        btnAddItemLbl.setTranslation(CurrentLanguageResolver.getInstance().getCurrentLocale(), "Add Item");
        btnAddItemLbl.setTranslation(Locale.ENGLISH, "Add Item");
        btnAddItemLbl.setTranslation(Locale.GERMAN, "Add Item");
        btnAddItem.setLabel(btnAddItemLbl);

        this.form1.addChild(btnAddItem, FatuAutoLayoutRule.AUTO_LAYOUT_RULE);

        final FatuLabel selectedItem = new FatuLabel();
        I18n i18nSelectedItem = new I18n(selectedItem.getId());
        i18nSelectedItem.setTranslation(CurrentLanguageResolver.getInstance().getCurrentLocale(), "Selected Item:");
        selectedItem.setLabel(i18nSelectedItem);
        this.form1.addChild(selectedItem, FatuAutoLayoutRule.AUTO_LAYOUT_RULE);

        IFatuSelectionListener<IBookmark<ComboItem>> iSelectionListener = new IFatuSelectionListener<IBookmark<ComboItem>>() {

            @Override
            public void selectionChanged(Collection<IBookmark<ComboItem>> newItems, Collection<IBookmark<ComboItem>> oldItems) {
                StringBuilder sb = new StringBuilder();
                for (IBookmark<ComboItem> anSelected : newItems) {
                    int rowIndex = model.getRowIndex(anSelected);
                    String ID = model.getKey(rowIndex);
                    String label = model.getLabel(rowIndex);
                    sb.append(ID + "- " + label + ";");
                }
                I18n i18n = new I18n(selectedItem.getId());
                i18n.setTranslation(CurrentLanguageResolver.getInstance().getCurrentLocale(), sb.toString());
                selectedItem.setLabel(i18n);
            }

        };

        selectionModel.addSelectionListener(iSelectionListener);
        btnAddItem.addActionListener(new IFatuActionListener() {

            @Override
            public void actionPerformed(IFatuActionEvent evt) {
                model.insert(new ComboItem("Item " + combo.getListModel().getRowCount() + 1));
            }
        });

    }

    private class ComboItem extends FatuElement {

        private final String label;

        public ComboItem(String label) {
            this.label = label;
        }

        @Override
        public String toString() {
            return label;
        }

    }

    @Override
    public String getTitle() {
        return "Combo Box Test Page";
    }

}


text:
package org.apache.beam.sdk.transforms.reflect;

import static org.apache.beam.sdk.transforms.reflect.DoFnSignaturesTestUtils.analyzeProcessElementMethod;
import static org.apache.beam.sdk.transforms.reflect.DoFnSignaturesTestUtils.errors;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import com.google.common.base.Predicates;
import java.util.List;
import org.apache.beam.sdk.coders.KvCoder;
import org.apache.beam.sdk.coders.StructuredCoder;
import org.apache.beam.sdk.transforms.DoFn;
import org.apache.beam.sdk.transforms.DoFn.BoundedPerElement;
import org.apache.beam.sdk.transforms.DoFn.UnboundedPerElement;
import org.apache.beam.sdk.transforms.reflect.DoFnSignaturesTestUtils.AnonymousMethod;
import org.apache.beam.sdk.transforms.reflect.DoFnSignaturesTestUtils.FakeDoFn;
import org.apache.beam.sdk.transforms.splittabledofn.HasDefaultTracker;
import org.apache.beam.sdk.transforms.splittabledofn.RestrictionTracker;
import org.apache.beam.sdk.transforms.windowing.BoundedWindow;
import org.apache.beam.sdk.values.PCollection;
import org.apache.beam.sdk.values.TypeDescriptor;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
 * Tests for {@link DoFnSignatures} focused on methods related to <a
 * href="https://s.apache.org/splittable-do-fn">splittable</a> {@link DoFn}.
 */
@SuppressWarnings("unused")
@RunWith(JUnit4.class)
public class DoFnSignaturesSplittableDoFnTest {
  @Rule public ExpectedException thrown = ExpectedException.none();

  private abstract static class SomeRestriction
      implements HasDefaultTracker<SomeRestriction, SomeRestrictionTracker> {}

  private abstract static class SomeRestrictionTracker
      extends RestrictionTracker<SomeRestriction, Void> {}

  private abstract static class SomeRestrictionCoder extends StructuredCoder<SomeRestriction> {}

  @Test
  public void testReturnsProcessContinuation() throws Exception {
    DoFnSignature.ProcessElementMethod signature =
        analyzeProcessElementMethod(
            new AnonymousMethod() {
              private DoFn.ProcessContinuation method(
                  DoFn<Integer, String>.ProcessContext context) {
                return null;
              }
            });

    assertTrue(signature.hasReturnValue());
  }

  @Test
  public void testHasRestrictionTracker() throws Exception {
    DoFnSignature.ProcessElementMethod signature =
        analyzeProcessElementMethod(
            new AnonymousMethod() {
              private void method(
                  DoFn<Integer, String>.ProcessContext context, SomeRestrictionTracker tracker) {}
            });

    assertTrue(signature.isSplittable());
    assertTrue(
        signature
            .extraParameters()
            .stream()
            .anyMatch(
                Predicates.instanceOf(DoFnSignature.Parameter.RestrictionTrackerParameter.class)
                    ::apply));
    assertEquals(SomeRestrictionTracker.class, signature.trackerT().getRawType());
  }

  @Test
  public void testSplittableProcessElementMustNotHaveOtherParams() throws Exception {
    thrown.expect(IllegalArgumentException.class);
    thrown.expectMessage("Illegal parameter");
    thrown.expectMessage("BoundedWindow");

    DoFnSignature.ProcessElementMethod signature =
        analyzeProcessElementMethod(
            new AnonymousMethod() {
              private void method(
                  DoFn<Integer, String>.ProcessContext context,
                  SomeRestrictionTracker tracker,
                  BoundedWindow window) {}
            });
  }

  @Test
  public void testInfersBoundednessFromAnnotation() throws Exception {
    class BaseSplittableFn extends DoFn<Integer, String> {
      @ProcessElement
      public void processElement(ProcessContext context, SomeRestrictionTracker tracker) {}

      @GetInitialRestriction
      public SomeRestriction getInitialRestriction(Integer element) {
        return null;
      }
    }

    @BoundedPerElement
    class BoundedSplittableFn extends BaseSplittableFn {}

    @UnboundedPerElement
    class UnboundedSplittableFn extends BaseSplittableFn {}

    assertEquals(
        PCollection.IsBounded.BOUNDED,
        DoFnSignatures
            .getSignature(BaseSplittableFn.class)
            .isBoundedPerElement());
    assertEquals(
        PCollection.IsBounded.BOUNDED,
        DoFnSignatures
            .getSignature(BoundedSplittableFn.class)
            .isBoundedPerElement());
    assertEquals(
        PCollection.IsBounded.UNBOUNDED,
        DoFnSignatures
            .getSignature(UnboundedSplittableFn.class)
            .isBoundedPerElement());
  }

  private static class BaseFnWithoutContinuation extends DoFn<Integer, String> {
    @ProcessElement
    public void processElement(ProcessContext context, SomeRestrictionTracker tracker) {}

    @GetInitialRestriction
    public SomeRestriction getInitialRestriction(Integer element) {
      return null;
    }
  }

  private static class BaseFnWithContinuation extends DoFn<Integer, String> {
    @ProcessElement
    public ProcessContinuation processElement(
        ProcessContext context, SomeRestrictionTracker tracker) {
      return null;
    }

    @GetInitialRestriction
    public SomeRestriction getInitialRestriction(Integer element) {
      return null;
    }
  }

  @Test
  public void testSplittableBoundednessInferredFromReturnValue() throws Exception {
    assertEquals(
        PCollection.IsBounded.BOUNDED,
        DoFnSignatures.getSignature(BaseFnWithoutContinuation.class).isBoundedPerElement());
    assertEquals(
        PCollection.IsBounded.UNBOUNDED,
        DoFnSignatures.getSignature(BaseFnWithContinuation.class).isBoundedPerElement());
  }

  @Test
  public void testSplittableRespectsBoundednessAnnotation() throws Exception {
    @BoundedPerElement
    class BoundedFnWithContinuation extends BaseFnWithContinuation {}

    assertEquals(
        PCollection.IsBounded.BOUNDED,
        DoFnSignatures.getSignature(BoundedFnWithContinuation.class).isBoundedPerElement());

    @UnboundedPerElement
    class UnboundedFnWithContinuation extends BaseFnWithContinuation {}

    assertEquals(
        PCollection.IsBounded.UNBOUNDED,
        DoFnSignatures.getSignature(UnboundedFnWithContinuation.class).isBoundedPerElement());
  }
  @Test
  public void testUnsplittableIsBounded() throws Exception {
    class UnsplittableFn extends DoFn<Integer, String> {
      @ProcessElement
      public void process(ProcessContext context) {}
    }

    assertEquals(
        PCollection.IsBounded.BOUNDED,
        DoFnSignatures
            .getSignature(UnsplittableFn.class)
            .isBoundedPerElement());
  }

  @Test
  public void testUnsplittableButDeclaresBounded() throws Exception {
    @BoundedPerElement
    class SomeFn extends DoFn<Integer, String> {
      @ProcessElement
      public void process(ProcessContext context) {}
    }

    thrown.expectMessage("Non-splittable, but annotated as @Bounded");
    DoFnSignatures.getSignature(SomeFn.class);
  }

  @Test
  public void testUnsplittableButDeclaresUnbounded() throws Exception {
    @UnboundedPerElement
    class SomeFn extends DoFn<Integer, String> {
      @ProcessElement
      public void process(ProcessContext context) {}
    }

    thrown.expectMessage("Non-splittable, but annotated as @Unbounded");
    DoFnSignatures.getSignature(SomeFn.class);
  }

  /** Tests a splittable {@link DoFn} that defines all methods in their full form, correctly. */
  @Test
  public void testSplittableWithAllFunctions() throws Exception {
    class GoodSplittableDoFn extends DoFn<Integer, String> {
      @ProcessElement
      public ProcessContinuation processElement(
          ProcessContext context, SomeRestrictionTracker tracker) {
        return null;
      }

      @GetInitialRestriction
      public SomeRestriction getInitialRestriction(Integer element) {
        return null;
      }

      @SplitRestriction
      public void splitRestriction(
          Integer element, SomeRestriction restriction, OutputReceiver<SomeRestriction> receiver) {}

      @NewTracker
      public SomeRestrictionTracker newTracker(SomeRestriction restriction) {
        return null;
      }

      @GetRestrictionCoder
      public SomeRestrictionCoder getRestrictionCoder() {
        return null;
      }
    }

    DoFnSignature signature = DoFnSignatures.getSignature(GoodSplittableDoFn.class);
    assertEquals(SomeRestrictionTracker.class, signature.processElement().trackerT().getRawType());
    assertTrue(signature.processElement().isSplittable());
    assertTrue(signature.processElement().hasReturnValue());
    assertEquals(
        SomeRestriction.class, signature.getInitialRestriction().restrictionT().getRawType());
    assertEquals(SomeRestriction.class, signature.splitRestriction().restrictionT().getRawType());
    assertEquals(SomeRestrictionTracker.class, signature.newTracker().trackerT().getRawType());
    assertEquals(SomeRestriction.class, signature.newTracker().restrictionT().getRawType());
    assertEquals(SomeRestrictionCoder.class, signature.getRestrictionCoder().coderT().getRawType());
  }

  /**
   * Tests a splittable {@link DoFn} that defines all methods in their full form, correctly, using
   * generic types.
   */
  @Test
  public void testSplittableWithAllFunctionsGeneric() throws Exception {
    class GoodGenericSplittableDoFn<RestrictionT, TrackerT, CoderT> extends DoFn<Integer, String> {
      @ProcessElement
      public ProcessContinuation processElement(ProcessContext context, TrackerT tracker) {
        return null;
      }

      @GetInitialRestriction
      public RestrictionT getInitialRestriction(Integer element) {
        return null;
      }

      @SplitRestriction
      public void splitRestriction(
          Integer element, RestrictionT restriction, OutputReceiver<RestrictionT> receiver) {}

      @NewTracker
      public TrackerT newTracker(RestrictionT restriction) {
        return null;
      }

      @GetRestrictionCoder
      public CoderT getRestrictionCoder() {
        return null;
      }
    }

    DoFnSignature signature =
        DoFnSignatures.getSignature(
            new GoodGenericSplittableDoFn<
                SomeRestriction, SomeRestrictionTracker, SomeRestrictionCoder>() {}.getClass());
    assertEquals(SomeRestrictionTracker.class, signature.processElement().trackerT().getRawType());
    assertTrue(signature.processElement().isSplittable());
    assertTrue(signature.processElement().hasReturnValue());
    assertEquals(
        SomeRestriction.class, signature.getInitialRestriction().restrictionT().getRawType());
    assertEquals(SomeRestriction.class, signature.splitRestriction().restrictionT().getRawType());
    assertEquals(SomeRestrictionTracker.class, signature.newTracker().trackerT().getRawType());
    assertEquals(SomeRestriction.class, signature.newTracker().restrictionT().getRawType());
    assertEquals(SomeRestrictionCoder.class, signature.getRestrictionCoder().coderT().getRawType());
  }

  @Test
  public void testSplittableMissingRequiredMethods() throws Exception {
    class BadFn extends DoFn<Integer, String> {
      @ProcessElement
      public void process(ProcessContext context, SomeRestrictionTracker tracker) {}
    }

    thrown.expectMessage(
        "Splittable, but does not define the following required methods: "
            + "[@GetInitialRestriction, @NewTracker]");
    DoFnSignatures.getSignature(BadFn.class);
  }

  abstract static class SomeDefaultTracker
      extends RestrictionTracker<RestrictionWithDefaultTracker, Void> {}

  abstract static class RestrictionWithDefaultTracker
      implements HasDefaultTracker<RestrictionWithDefaultTracker, SomeDefaultTracker> {}

  @Test
  public void testHasDefaultTracker() throws Exception {
    class Fn extends DoFn<Integer, String> {
      @ProcessElement
      public void process(ProcessContext c, SomeDefaultTracker tracker) {}

      @GetInitialRestriction
      public RestrictionWithDefaultTracker getInitialRestriction(Integer element) {
        return null;
      }
    }

    DoFnSignature signature = DoFnSignatures.getSignature(Fn.class);
    assertEquals(
        SomeDefaultTracker.class, signature.processElement().trackerT().getRawType());
  }

  @Test
  public void testRestrictionHasDefaultTrackerProcessUsesWrongTracker() throws Exception {
    class Fn extends DoFn<Integer, String> {
      @ProcessElement
      public void process(ProcessContext c, SomeRestrictionTracker tracker) {}

      @GetInitialRestriction
      public RestrictionWithDefaultTracker getInitialRestriction(Integer element) {
        return null;
      }
    }

    thrown.expectMessage(
        "Has tracker type SomeRestrictionTracker, but the DoFn's tracker type was inferred as ");
    thrown.expectMessage("SomeDefaultTracker");
    thrown.expectMessage(
        "from restriction type RestrictionWithDefaultTracker "
            + "of @GetInitialRestriction method getInitialRestriction(Integer)");
    DoFnSignatures.getSignature(Fn.class);
  }

  @Test
  public void testNewTrackerReturnsWrongType() throws Exception {
    class BadFn extends DoFn<Integer, String> {
      @ProcessElement
      public void process(ProcessContext context, SomeRestrictionTracker tracker) {}

      @NewTracker
      public void newTracker(SomeRestriction restriction) {}

      @GetInitialRestriction
      public SomeRestriction getInitialRestriction(Integer element) {
        return null;
      }
    }

    thrown.expectMessage(
        "Returns void, but must return a subtype of RestrictionTracker<SomeRestriction, ?>");
    DoFnSignatures.getSignature(BadFn.class);
  }

  @Test
  public void testGetInitialRestrictionMismatchesNewTracker() throws Exception {
    class BadFn extends DoFn<Integer, String> {
      @ProcessElement
      public void process(ProcessContext context, SomeRestrictionTracker tracker) {}

      @NewTracker
      public SomeRestrictionTracker newTracker(SomeRestriction restriction) {
        return null;
      }

      @GetInitialRestriction
      public String getInitialRestriction(Integer element) {
        return null;
      }
    }

    thrown.expectMessage(
        "getInitialRestriction(Integer): Uses restriction type String, but @NewTracker method");
    thrown.expectMessage("newTracker(SomeRestriction) uses restriction type SomeRestriction");
    DoFnSignatures.getSignature(BadFn.class);
  }

  @Test
  public void testGetRestrictionCoderReturnsWrongType() throws Exception {
    class BadFn extends DoFn<Integer, String> {
      @ProcessElement
      public void process(ProcessContext context, SomeRestrictionTracker tracker) {}

      @NewTracker
      public SomeRestrictionTracker newTracker(SomeRestriction restriction) {
        return null;
      }

      @GetInitialRestriction
      public SomeRestriction getInitialRestriction(Integer element) {
        return null;
      }

      @GetRestrictionCoder
      public KvCoder getRestrictionCoder() {
        return null;
      }
    }

    thrown.expectMessage(
        "getRestrictionCoder() returns KvCoder which is not a subtype of Coder<SomeRestriction>");
    DoFnSignatures.getSignature(BadFn.class);
  }

  @Test
  public void testSplitRestrictionReturnsWrongType() throws Exception {
    thrown.expectMessage(
        "Third argument must be DoFn.OutputReceiver<SomeRestriction>, "
            + "but is DoFn.OutputReceiver<String>");
    DoFnSignatures.analyzeSplitRestrictionMethod(
        errors(),
        TypeDescriptor.of(FakeDoFn.class),
        new AnonymousMethod() {
          void method(
              Integer element, SomeRestriction restriction, DoFn.OutputReceiver<String> receiver) {}
        }.getMethod(),
        TypeDescriptor.of(Integer.class));
  }

  @Test
  public void testSplitRestrictionWrongElementArgument() throws Exception {
    class BadFn {
      private List<SomeRestriction> splitRestriction(String element, SomeRestriction restriction) {
        return null;
      }
    }

    thrown.expectMessage("First argument must be the element type Integer");
    DoFnSignatures.analyzeSplitRestrictionMethod(
        errors(),
        TypeDescriptor.of(FakeDoFn.class),
        new AnonymousMethod() {
          void method(
              String element,
              SomeRestriction restriction,
              DoFn.OutputReceiver<SomeRestriction> receiver) {}
        }.getMethod(),
        TypeDescriptor.of(Integer.class));
  }

  @Test
  public void testSplitRestrictionWrongNumArguments() throws Exception {
    thrown.expectMessage("Must have exactly 3 arguments");
    DoFnSignatures.analyzeSplitRestrictionMethod(
        errors(),
        TypeDescriptor.of(FakeDoFn.class),
        new AnonymousMethod() {
          private void method(
              Integer element,
              SomeRestriction restriction,
              DoFn.OutputReceiver<SomeRestriction> receiver,
              Object extra) {}
        }.getMethod(),
        TypeDescriptor.of(Integer.class));
  }

  @Test
  public void testSplitRestrictionConsistentButWrongType() throws Exception {
    class OtherRestriction {}

    class BadFn extends DoFn<Integer, String> {
      @ProcessElement
      public void process(ProcessContext context, SomeRestrictionTracker tracker) {}

      @NewTracker
      public SomeRestrictionTracker newTracker(SomeRestriction restriction) {
        return null;
      }

      @GetInitialRestriction
      public SomeRestriction getInitialRestriction(Integer element) {
        return null;
      }

      @DoFn.SplitRestriction
      public void splitRestriction(
          Integer element,
          OtherRestriction restriction,
          OutputReceiver<OtherRestriction> receiver) {}
    }

    thrown.expectMessage(
        "getInitialRestriction(Integer): Uses restriction type SomeRestriction, "
            + "but @SplitRestriction method ");
    thrown.expectMessage(
        "splitRestriction(Integer, OtherRestriction, OutputReceiver) "
            + "uses restriction type OtherRestriction");
    DoFnSignatures.getSignature(BadFn.class);
  }

  @Test
  public void testUnsplittableMustNotDefineExtraMethods() throws Exception {
    class BadFn extends DoFn<Integer, String> {
      @ProcessElement
      public void processElement(ProcessContext context) {}

      @GetInitialRestriction
      public SomeRestriction getInitialRestriction(Integer element) {
        return null;
      }

      @SplitRestriction
      public void splitRestriction(
          Integer element, SomeRestriction restriction, OutputReceiver<SomeRestriction> receiver) {}

      @NewTracker
      public SomeRestrictionTracker newTracker(SomeRestriction restriction) {
        return null;
      }

      @GetRestrictionCoder
      public SomeRestrictionCoder getRestrictionCoder() {
        return null;
      }
    }

    thrown.expectMessage(
        "Non-splittable, but defines methods: "
            + "[@GetInitialRestriction, @SplitRestriction, @NewTracker, @GetRestrictionCoder]");
    DoFnSignatures.getSignature(BadFn.class);
  }

  @Test
  public void testNewTrackerWrongNumArguments() throws Exception {
    thrown.expectMessage("Must have a single argument");
    DoFnSignatures.analyzeNewTrackerMethod(
        errors(),
        TypeDescriptor.of(FakeDoFn.class),
        new AnonymousMethod() {
          private SomeRestrictionTracker method(SomeRestriction restriction, Object extra) {
            return null;
          }
        }.getMethod());
  }

  @Test
  public void testNewTrackerInconsistent() throws Exception {
    thrown.expectMessage(
        "Returns SomeRestrictionTracker, "
            + "but must return a subtype of RestrictionTracker<String, ?>");
    DoFnSignatures.analyzeNewTrackerMethod(
        errors(),
        TypeDescriptor.of(FakeDoFn.class),
        new AnonymousMethod() {
          private SomeRestrictionTracker method(String restriction) {
            return null;
          }
        }.getMethod());
  }
}


text:
import {
it,
iit,
describe,
ddescribe,
expect,
inject,
injectAsync,
TestComponentBuilder,
beforeEachProviders
} from 'angular2/testing';
import {provide} from 'angular2/core';

import {RecipeIngredientFormComponent} from './recipe-ingredient-form.component';

describe('Recipe Ingredient Form Component', () => {

    beforeEachProviders(() => []);

    xit('should...', () => {

    });

});


text:
// Copyright 2008 The Closure Library Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS-IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

goog.provide('goog.net.MultiIframeLoadMonitorTest');
goog.setTestOnly('goog.net.MultiIframeLoadMonitorTest');

goog.require('goog.dom');
goog.require('goog.dom.TagName');
goog.require('goog.net.IframeLoadMonitor');
goog.require('goog.net.MultiIframeLoadMonitor');
goog.require('goog.testing.AsyncTestCase');
goog.require('goog.testing.jsunit');

var TEST_FRAME_SRCS = ['iframeloadmonitor_test_frame.html',
  'iframeloadmonitor_test_frame2.html',
  'iframeloadmonitor_test_frame3.html'];

// Create a new test case.
var iframeLoaderTestCase = new goog.testing.AsyncTestCase(document.title);
iframeLoaderTestCase.stepTimeout = 4 * 1000;

// How many multpile frames finished loading
iframeLoaderTestCase.multipleComplete_ = 0;

iframeLoaderTestCase.numMonitors = 0;
iframeLoaderTestCase.disposeCalled = 0;

/**
 * Sets up the test environment, adds tests and sets up the worker pools.
 * @this {goog.testing.AsyncTestCase}
 */
iframeLoaderTestCase.setUpPage = function() {
  this.log('Setting tests up');
  iframeLoaderTestCase.waitForAsync('loading iframes');

  var dom = goog.dom.getDomHelper();

  // Load multiple with callback
  var frame1 = dom.createDom(goog.dom.TagName.IFRAME);
  var frame2 = dom.createDom(goog.dom.TagName.IFRAME);
  var multiMonitor = new goog.net.MultiIframeLoadMonitor(
      [frame1, frame2], goog.bind(this.multipleCallback, this));
  this.log('Loading frames at: ' + TEST_FRAME_SRCS[0] + ' and ' +
      TEST_FRAME_SRCS[1]);
  // Make sure they don't look loaded yet.
  assertEquals(0, this.multipleComplete_);
  var frameParent = dom.getElement('frame_parent');
  dom.appendChild(frameParent, frame1);
  frame1.src = TEST_FRAME_SRCS[0];
  dom.appendChild(frameParent, frame2);
  frame2.src = TEST_FRAME_SRCS[1];

  // Load multiple with callback and content check
  var frame3 = dom.createDom(goog.dom.TagName.IFRAME);
  var frame4 = dom.createDom(goog.dom.TagName.IFRAME);
  var multiMonitor = new goog.net.MultiIframeLoadMonitor(
      [frame3, frame4], goog.bind(this.multipleContentCallback, this), true);
  this.log('Loading frames with content check at: ' + TEST_FRAME_SRCS[1] +
      ' and ' + TEST_FRAME_SRCS[2]);
  dom.appendChild(frameParent, frame3);
  frame3.src = TEST_FRAME_SRCS[1];
  dom.appendChild(frameParent, frame4);
  frame4.src = TEST_FRAME_SRCS[2];

};

/**
 * Callback for the multiple frame load test case
 * @this {goog.testing.AsyncTestCase}
 */
iframeLoaderTestCase.multipleCallback = function() {
  this.log('multiple frames finished loading');
  this.multipleComplete_++;
  this.multipleCompleteNoContent_ = true;
  this.callbacksComplete();
};

/**
 * Callback for the multiple frame with content load test case
 * @this {goog.testing.AsyncTestCase}
 */
iframeLoaderTestCase.multipleContentCallback = function() {
  this.log('multiple frames with content finished loading');
  this.multipleComplete_++;
  this.multipleCompleteContent_ = true;
  this.callbacksComplete();
};

/**
 * Checks if all the load callbacks are done
 * @this {goog.testing.AsyncTestCase}
 */
iframeLoaderTestCase.callbacksComplete = function() {
  if (this.multipleComplete_ == 2) {
    iframeLoaderTestCase.continueTesting();
  }
};

/** Tests the results. */
iframeLoaderTestCase.addNewTest('testResults', function() {
  this.log('getting test results');
  assertTrue(this.multipleCompleteNoContent_);
  assertTrue(this.multipleCompleteContent_);
});

iframeLoaderTestCase.fakeLoadMonitor = function() {
  // Replaces IframeLoadMonitor with a fake version that just tracks
  // instantiations/disposals
  this.loadMonitorConstructor = goog.net.IframeLoadMonitor;
  var that = this;
  goog.net.IframeLoadMonitor = function() {
    that.numMonitors++;
    return {
      isLoaded: function() { return false; },
      dispose: function() { that.disposeCalled++; },
      attachEvent: function() {}
    };
  };
  goog.net.IframeLoadMonitor.LOAD_EVENT = 'ifload';
};

iframeLoaderTestCase.unfakeLoadMonitor = function() {
  goog.net.IframeLoadMonitor = this.loadMonitorConstructor;
};

iframeLoaderTestCase.addNewTest('stopMonitoring', function() {
  // create two unloaded frames, make sure that load monitors are loaded
  // behind the scenes, then make sure they are disposed properly.
  this.fakeLoadMonitor();
  var dom = goog.dom.getDomHelper();
  var frames = [dom.createDom(goog.dom.TagName.IFRAME),
                dom.createDom(goog.dom.TagName.IFRAME)];
  var multiMonitor = new goog.net.MultiIframeLoadMonitor(
      frames,
      function() {
        fail('should not invoke callback for unloaded rames');
      });
  assertEquals(frames.length, this.numMonitors);
  assertEquals(0, this.disposeCalled);
  multiMonitor.stopMonitoring();
  assertEquals(frames.length, this.disposeCalled);
  this.unfakeLoadMonitor();
});

/** Standalone Closure Test Runner. */
G_testRunner.initialize(iframeLoaderTestCase);


text:
'use strict';

angular.module("angular-s3-upload-tpls", ["templates/angular-s3-upload-button.html"]);


text:
caRuby bug fix procedure
========================
This SOP describes how a caRuby git committer applies source code changes to fix
a bug. The examples refer to the `caruby-tissue` gem, but the procedure
applies to any caRuby gem.

* Make a topic branch as described in the general caRuby change procedure, e.g.:

        git checkout -b fix-gleason-score v1.5.4

* Isolate the problem to a test case, e.g.:

        test/lib/catissue/domain/specimen_test.rb
        def test_save_gleason_score
          ...
        end

    The test case should be as focused as possible to reproduce the problem.

* Create a new bug report which describes the problem and references the test case in
  [Lighthouse](caruby.lighthouseapp.com), e.g.:

        Prostate specimen annotation Gleason score is not saved when an owner specimen is
        created. Reproduced in specimen_test.rb test_save_gleason_score.

* Document the bug in the test case, e.g.:

        # Verifies the fix to Bug #42 - Prostate specimen annotation Gleason score is not saved.
        def test_save_gleason_score
          ...
        end

* Fix the bug on on the branch and add it to git. The commit message references the bug number, e.g:

        git commit -a -- lib/domain/specimen.rb test/lib/catissue/domain/specimen_test.rb
        Fixed bug #42 - Prostate specimen annotation Gleason score is not saved. Added the
        Gleason score properties as caRuby attributes.

* Merge, test and push your changes to GitHub, as described in the general caRuby change procedure.

* If the bug is a hotfix, then roll a new gem as described in the caRuby gem SOP. The


text: record Foo(<selection>int a, int<caret> b</selection>) {}


text:
.ihWeatherList .ihListItem.ihWeatherListItem {
	padding: 10px;
	border: none;
	/*border-bottom: 1px solid #A70109;*/
}
.ihWeatherList li:last-child .ihWeatherListItem {
	border-bottom: none;
}

.ihWeatherListItem .ihWeatherCity {
	font-size: 24px;
	padding-bottom: 18px;
}
.ihWeatherListItem .ihWeatherDegreeSign {
	font-size: 50px;
	line-height: 54px;
	padding: 6px 0px 0px 0px;
}
.ihWeatherListItem .ihWeatherDescr {
	font-size: 30px;
	line-height: 34px;
}
.ihWeatherListItem p {
	padding-top: 0px;
}
.ihWeatherListItem .item-thumbnail-right {
	text-decoration: none;
	display: block;
	border: none;
	height: 100px;
	padding: 0px 130px 0px 0px;
}
.ihWeatherListItem .item-thumbnail-right:hover, .ihWeatherListItem .item-thumbnail-right:active {
	background-color: transparent;
}
.ihWeatherListItem .item-thumbnail-right .ihArticleImg {
	position: absolute;
	top: 10px;
	right: 10px;
	max-width: 100px;
	max-height: 100px;
	border: 1px solid;
	background-color: #A70109;
	border-color: #707070;
	border-radius: 50%;
}
.ihWeatherBGSunny {
	background-color: #BDBD00 !important;
	border-color: #818102 !important;
}
.ihWeatherBGWarm {
	background-color: #CF8600 !important;
	border-color: #818102 !important;
}
.ihWeatherBGWarmDry {
	background-color: #A60 !important;
	border-color: #754601 !important;
}
.ihWeatherBGPartCloud {
	background-color: #C7C7C7 !important;
	border-color: #8F8F8F !important;
}
.ihWeatherBGCloud {
	background-color: #838383 !important;
	border-color: #464646 !important;
}
.ihWeatherBGCloudRain {
	background-color: #8CB9C7 !important;
	border-color: #6E8F99 !important;
}
.ihWeatherBGRain {
	background-color: #4491B6 !important;
	border-color: #255166 !important;
}

.ihWeeklyWeatherListItemContainer > ul > li {
	float: left;
	width: 33.3333333333333%;
	padding: 10px 5px;
	border-right: 1px solid #A70109;
	border-bottom: 1px solid #A70109;
}
.ihWeeklyWeatherListItemContainer > ul > li:nth-child(3n) {
	width: 33.3333333333334%;
	border-right: none;
}
.ihWeeklyWeatherListItemContainer > ul > li:nth-child(4), .ihWeeklyWeatherListItemContainer > ul > li:nth-child(5), .ihWeeklyWeatherListItemContainer > ul > li:nth-child(6) {
	border-bottom: none;
}

.ihWeeklyWeatherListItem {
	text-align: center;
}
.ihWeeklyWeatherListItem .ihWeeklyImg {
	max-width: 100px;
	max-height: 100px;
	margin-top: 5px;
	border: 1px solid;
	background-color: #A70109;
	border-color: #707070;
	border-radius: 50%;
}
.ihWeeklyWeatherListItem .ihWeatherDegreeSign {
	font-size: 28px;
	line-height: 32px;
	padding: 0;
}
.ihWeeklyWeatherListItem .ihWeatherDescr {
	font-size: 20px;
	line-height: 24px;
	padding: 0;
}
.ihWeeklyWeatherListItem .ihWeatherCity {
	padding-bottom: 15px;
	margin-top: 7px;
}

.ihWeatherList .ihListItem.ihWeatherListItem.ihWeeklyWeatherListItemContainer {
	padding: 0px;
	border: none;
	border-bottom: 1px solid #A70109;
}


text:
layout: post
title: Week 4 Photo - Milanesa
summary:
author: Josh
---

A pile of milanesa (flat, breaded beef) ready to be fried up on the stove in
some oil. It is a delicious Argentine dish that is sometimes made more
irresistible by smothering it in tomato sauce and cheese.


text:
@extends('layouts.front.app')
@section('title', trans('admin/users.title'))

@section('content')

                    {{ trans('admin/users.title') }}
                    {!! link_to_route('admin.users.create', trans('admin/users.add'), [], ['class' => 'btn light-blue lighten-2 waves-effect waves-light right' . (!auth()->user()->can('create_users') ? ' disabled' : '')]) !!}

                            {{ trans('admin/users.col.username') }}
							{{ trans('admin/users.col.name') }}
							{{ trans('admin/users.col.email') }}
							{{ trans('admin/users.col.activated') }}
                            {{ trans('common.action') }}

                            @if(! $users->isEmpty())
                            @foreach($users as $user)

                                {{ $user->username }}
								{{ $user->name }}
								{{ $user->email }}
								{{ $user->activated_at }}

                                     $user->id]) }}" class="green-text text-lighten-1{{ ! auth()->user()->can('edit_users') ? ' disabled' : '' }}" title="{{ trans('common.edit') }}">
                                        create

                                     $user->id]) }}" class="delete red-text text-lighten-2 {{ ! auth()->user()->can('delete_users') ? ' disabled' : '' }}" title="{{ trans('common.delete') }}">
                                       delete

                            @endforeach
                            @else

                                {{ trans('admin/users.not-found') }}

                            @endif

                @include('admin.common.paginate', ['records' => $users])

@include('admin.common.confirm', [
    'body' => trans('common.destroy', ['type' => 'user'])
])
@endsection


text:
/*!
 * \file exec_utils.h
 * \brief Common utility functions for executors.
 */
#ifndef MXNET_COMMON_EXEC_UTILS_H_
#define MXNET_COMMON_EXEC_UTILS_H_

#include <vector>
#include <string>
#include <utility>
#include "../common/utils.h"

namespace mxnet {
namespace common {

/*
 * \brief setup default-storage tblobs from source NDArrays. If any source NDArray has non-default
 *        storage, it creates a temp NDArray with default storage and uses the temp tblob. The
 *        function also records the indices of non-default source NDArrays and the indices of
 *        their corresponding temporary NDArrays in the temp array.
 * \param src list of source NDArray
 * \param blobs list of tblobs to return
 * \param temp_src list of source NDArrays which requires temporary default storage representation
 * \param temp_dst list of temporary destination NDArrays for default storage representation
 * \param idx_map mapping from indices in source NDArrays to indices in temp_dst. When not set,
          indices are not recorded
 * \return true if any source NDArray need to cast storage
 */
inline bool SetupDefaultBlobsIn(const std::vector<NDArray>& src,
                                const std::vector<NDArray> *bufs,
                                std::vector<TBlob> *blobs,
                                std::vector<NDArray> *temp_src,
                                std::vector<NDArray> *temp_dst,
                                std::unordered_map<uint32_t, uint32_t> *idx_map) {
  bool require_cast = false;
  for (size_t i = 0; i < src.size(); i++) {
    auto& nd = src[i];
    bool is_default = nd.storage_type() == kDefaultStorage;
#if MXNET_USE_MKLDNN == 1
    // We have to make sure it's default storage and default layout.
    is_default = nd.IsDefaultData();
#endif
    if (!is_default) {
      (*idx_map)[i] = temp_dst->size();
      NDArray temp = bufs != nullptr ? bufs->at(i) : NDArray(nd.shape(), nd.ctx(),
                                                             true, nd.dtype());
#if MXNET_USE_MKLDNN == 1
      CHECK(temp.IsDefaultData());
#endif
      temp_src->emplace_back(nd);
      temp_dst->emplace_back(temp);
      blobs->emplace_back(temp.data());
      require_cast = true;
    } else {
      blobs->push_back(nd.data());
    }
  }
  return require_cast;
}

inline bool SetupDefaultBlobsOut(const std::vector<NDArray>& src,
                                 const std::vector<NDArray> *bufs,
                                 std::vector<OpReqType> *req,
                                 std::vector<TBlob> *blobs,
                                 std::vector<NDArray> *temp_src,
                                 std::vector<NDArray> *temp_dst) {
  bool require_cast = false;
  for (size_t i = 0; i < src.size(); i++) {
    auto& nd = src[i];
    bool is_default = nd.storage_type() == kDefaultStorage;
#if MXNET_USE_MKLDNN == 1
    if (req->at(i) == kWriteInplace && nd.IsMKLDNNData())
      // If it's write inplace and the output array doesn't use the default
      // layout, we'll generate a temporary output array below, which means
      // the input array and the output array are no longer the same array.
      // we should change the request type.
      req->at(i) = kWriteTo;
    // We have to make sure it's default storage and default layout.
    is_default = nd.IsDefaultData();
#endif
    if (!is_default) {
#if MXNET_USE_MKLDNN == 1
      NDArray temp;
      if (bufs != nullptr) {
        temp = bufs->at(i);
      } else if (kAddTo == req->at(i) && nd.IsMKLDNNData()) {
        temp = nd.Reorder2Default();
      } else if (kAddTo == req->at(i)) {
        temp = nd;
      } else {
        temp = NDArray(nd.shape(), nd.ctx(), true, nd.dtype());
      }
      CHECK(temp.IsDefaultData());
#else
      NDArray temp = bufs != nullptr ? bufs->at(i) : NDArray(nd.shape(), nd.ctx(),
          true, nd.dtype());
#endif
      temp_src->emplace_back(nd);
      temp_dst->emplace_back(temp);
      blobs->emplace_back(temp.data());
      require_cast = true;
    } else {
      blobs->push_back(nd.data());
    }
  }
  return require_cast;
}

/*
 * \brief setup default-storage tblobs for input and output NDArrays.
 *        If any NDArray has non-default storage,
 *        it creates a temp NDArray with default storage and uses the temp tblob. The
 *        function also records the indices of non-default source NDArrays and the indices of
 *        their corresponding temporary NDArrays in the temp array.
 */
inline void SetupDefaultBlobsInOut(const std::vector<NDArray> &ndinputs,
                                   const std::vector<NDArray> &ndoutputs,
                                   const std::vector<NDArray> *in_bufs,
                                   const std::vector<NDArray> *out_bufs,
                                   std::vector<OpReqType> *req,
                                   std::vector<TBlob> *input_blobs,
                                   std::vector<TBlob> *output_blobs,
                                   std::vector<NDArray> *pre_temp_src,
                                   std::vector<NDArray> *pre_temp_dst,
                                   std::vector<NDArray> *post_temp_src,
                                   std::vector<NDArray> *post_temp_dst,
                                   std::unordered_map<uint32_t, uint32_t> *in_temp_idx_map,
                                   const std::vector<uint32_t> &mutate_idx) {
  // populate input blobs
  SetupDefaultBlobsIn(ndinputs, in_bufs, input_blobs, pre_temp_src, pre_temp_dst,
                      in_temp_idx_map);
  // populate output blobs
  SetupDefaultBlobsOut(ndoutputs, out_bufs, req, output_blobs, post_temp_dst,
                       post_temp_src);
  // add mutable inputs to post temp list
  for (const auto idx : mutate_idx) {
    auto map_iter = in_temp_idx_map->find(idx);
    if (map_iter != in_temp_idx_map->end()) {
      post_temp_src->push_back(pre_temp_dst->at(map_iter->second));
      post_temp_dst->push_back(ndinputs[idx]);
    }
  }
}

/*
 * \brief cast the NDArrays in `src` and store the result in NDArrays in `dst`.
 *        This is only used for storage fallback in executor.
 * \param src list of source NDArray to cast
 * \param dst list of destionation NDArray which hold the result of cast_storage operation
 * \param ctx operator context for cast_storage operation
 */
inline void CastNonDefaultStorage(const std::vector<NDArray>& src,
                                  const std::vector<NDArray>& dst,
                                  const OpContext& ctx,
                                  const bool is_gpu) {
  CHECK_EQ(dst.size(), src.size());
  for (size_t i = 0; i < src.size(); i++) {
    if (is_gpu) {
#if MXNET_USE_CUDA
      CastStorageDispatch<gpu>(ctx, src[i], dst[i]);
#else
      LOG(FATAL) << MXNET_GPU_NOT_ENABLED_ERROR;
#endif
    } else {
      CastStorageDispatch<cpu>(ctx, src[i], dst[i]);
    }
  }
}

/*! \brief The default type inference function, which assigns all undefined
 *         types to the same type of one of the inputs or outputs.
 */
inline bool SameType(const nnvm::NodeAttrs& attrs,
                     std::vector<int> *iattr,
                     std::vector<int> *oattr) {
  int def_v = -1;
  for (int v : *oattr) {
    if (v != -1) {
      def_v = v; break;
    }
  }
  if (def_v == -1) {
    for (int v : *iattr) {
      if (v != -1) {
        def_v = v; break;
      }
    }
  }
  if (def_v == -1) return false;
  for (int& v : *oattr) {
    v = def_v;
  }
  for (int& v : *iattr) {
    v = def_v;
  }
  return true;
}

/*! \brief The default storage type inference function, which assigns all undefined
 *         storage types to kDefaultStorage. If all of input and output storage types
 *         are kDefaultStorage, DispatchMode::kFCompute is assigned to dispatch_mode. Otherwise,
 *         DispatchMode::kFComputeFallback is assigned to dispatch_mode.
 */
inline bool DefaultStorageType(const nnvm::NodeAttrs& attrs,
                               const int dev_mask,
                               DispatchMode* dispatch_mode,
                               std::vector<int> *iattr,
                               std::vector<int> *oattr) {
  bool fallback = false;
  for (int& v : *oattr) {
    if (v == -1) v = kDefaultStorage;
    if (v != kDefaultStorage) fallback = true;
  }
  for (int& v : *iattr) {
    if (v == -1) v = kDefaultStorage;
    if (v != kDefaultStorage) fallback = true;
  }
  if (*dispatch_mode == DispatchMode::kUndefined) {
    if (fallback) {
      *dispatch_mode = DispatchMode::kFComputeFallback;
    } else {
      *dispatch_mode = DispatchMode::kFCompute;
    }
  }
  return true;
}

// string representation of storage id
inline std::string storage_str(int storage_id) {
  std::string str;
  if (storage_id == -1) {
    str = "var (-1)";
  } else if (storage_id == -2) {
    str = "external storage (-2)";
  } else {
    str = "group " + std::to_string(storage_id);
  }
  return str;
}

/* log the static memory plan of the graph. Example:
   node 0 var
   node 1 _copy
            input 0: [80,3,224,224] (47040 KB) -> var storage (-1)
            output 1: [80,3,224,224] (47040 KB) -> group 0
   node 2 var
   node 3 var
   node 4 var
   node 5 var
   node 6 BatchNorm
            input 1: [80,3,224,224] (47040 KB) -> group 0
            input 2: [3] (0 KB) -> var storage (-1)
            input 3: [3] (0 KB) -> var storage (-1)
            input 4: [3] (0 KB) -> var storage (-1)
            input 5: [3] (0 KB) -> var storage (-1)
            output 6: [80,3,224,224] (47040 KB) -> group 1
            output 7: [3] (0 KB) -> group 3
            output 8: [3] (0 KB) -> group 2
   ...
 */
inline void LogMemoryPlan(const nnvm::Graph& g) {
  const auto &idx = g.indexed_graph();
  const auto& vshape = g.GetAttr<nnvm::ShapeVector>("shape");
  const auto& vtype = g.GetAttr<nnvm::DTypeVector>("dtype");
  const auto& vstorage = g.GetAttr<nnvm::StorageVector>("storage_id");
  // find node range
  uint32_t node_start = 0, node_end = idx.num_nodes();
  if (g.attrs.count("node_range")) {
    const auto& range = g.GetAttr<std::pair<uint32_t, uint32_t> >("node_range");
    node_start = range.first;
    node_end = range.second;
  }
  for (uint32_t nid = node_start; nid < node_end; ++nid) {
    const auto& inode = idx[nid];
    if (inode.source->is_variable()) {
      LOG(INFO) << "node " << nid << " var";
    } else {
      LOG(INFO) << "node " << nid << " " << inode.source->attrs.op->name;
      for (const auto& e : inode.inputs) {
        auto eid = idx.entry_id(e);
        size_t kilo_bytes = vshape[eid].Size() * mshadow::mshadow_sizeof(vtype[eid]) / 1024;
        LOG(INFO) << "\t\tinput " << eid << ": " << vshape[eid] << " ("
                  << kilo_bytes << " KB) -> " << storage_str(vstorage[eid]);
      }
      for (uint32_t index = 0; index < inode.source->num_outputs(); ++index) {
        uint32_t eid = idx.entry_id(nid, index);
        size_t kilo_bytes = vshape[eid].Size() * mshadow::mshadow_sizeof(vtype[eid]) / 1024;
        LOG(INFO) << "\t\toutput " << eid << ": " << vshape[eid] << " ("
                  << kilo_bytes << " KB) -> " << storage_str(vstorage[eid]);
      }
    }
  }
}

/* log the static memory plan of the graph. Example:
    node 0 var
    node 1 _copy: fcompute
                input 0: default
                output 1: default
    node 2 var
    node 3 Convolution: fcompute
                input 1: default
                input 2: default
                output 3: default
    node 4 var
    node 5 var
    node 6 var
    node 7 var
    node 8 BatchNorm: fcompute
                input 3: default
                input 4: default
                input 5: default
                input 6: default
                input 7: default
                output 8: default
                output 9: default
                output 10: default
    ...
 */
inline void LogInferStorage(const nnvm::Graph& g) {
  const auto &idx = g.indexed_graph();
  const auto& vstorage_type = g.GetAttr<StorageTypeVector>("storage_type");
  const auto& dispatch_modes = g.GetAttr<DispatchModeVector>("dispatch_mode");
  uint32_t node_start = 0, node_end = idx.num_nodes();
  if (g.attrs.count("node_range")) {
    const auto& range = g.GetAttr<std::pair<uint32_t, uint32_t> >("node_range");
    node_start = range.first;
    node_end = range.second;
  }
  for (uint32_t nid = node_start; nid < node_end; ++nid) {
    const auto& inode = idx[nid];
    if (inode.source->is_variable()) {
      LOG(INFO) << "node " << nid << " var";
    } else {
      LOG(INFO) << "node " << nid << " " << inode.source->attrs.op->name
                << ": " << dispatch_mode_string(dispatch_modes[nid]);
      for (const auto& e : inode.inputs) {
        auto eid = idx.entry_id(e);
        LOG(INFO) << "\t\tinput " << eid << ": " << stype_string(vstorage_type[eid]);
      }
      for (uint32_t index = 0; index < inode.source->num_outputs(); ++index) {
        uint32_t eid = idx.entry_id(nid, index);
        LOG(INFO) << "\t\toutput " << eid << ": " << stype_string(vstorage_type[eid]);
      }
    }
  }
}

}  // namespace common
}  // namespace mxnet
#endif  // MXNET_COMMON_EXEC_UTILS_H_


text:
{% extends "layout.html" %}
{% block content %}

ClayPlay API

    <form method="POST" action="">

        <input class="form-control input-lg" type="email" name ="email" placeholder="Email" >

        <input class="form-control input-lg" type="password" name ="pass" placeholder="Password">

        <input type="submit" class="btn btn-success btn-lg" name="adminlogin" value="Log in">

    </form>

{% endblock %}


text: export const modal = (state) => state.modal.modal


text:
"""GAX/GAPIC module for managing Speech API requests."""

from google.cloud.gapic.speech.v1beta1.speech_client import SpeechClient
from google.cloud.grpc.speech.v1beta1.cloud_speech_pb2 import RecognitionAudio
from google.cloud.grpc.speech.v1beta1.cloud_speech_pb2 import RecognitionConfig
from google.cloud.grpc.speech.v1beta1.cloud_speech_pb2 import SpeechContext
from google.cloud.grpc.speech.v1beta1.cloud_speech_pb2 import (
    StreamingRecognitionConfig)
from google.cloud.grpc.speech.v1beta1.cloud_speech_pb2 import (
    StreamingRecognizeRequest)
from google.longrunning import operations_grpc

from google.cloud._helpers import make_secure_channel
from google.cloud._helpers import make_secure_stub
from google.cloud._http import DEFAULT_USER_AGENT

from google.cloud.speech.alternative import Alternative
from google.cloud.speech.operation import Operation

OPERATIONS_API_HOST = 'speech.googleapis.com'

class GAPICSpeechAPI(object):
    """Manage calls through GAPIC wrappers to the Speech API."""
    def __init__(self, client=None):
        self._client = client
        credentials = self._client._connection.credentials
        channel = make_secure_channel(
            credentials, DEFAULT_USER_AGENT,
            SpeechClient.SERVICE_ADDRESS)
        self._gapic_api = SpeechClient(channel=channel)
        self._operations_stub = make_secure_stub(
            credentials,
            DEFAULT_USER_AGENT,
            operations_grpc.OperationsStub,
            OPERATIONS_API_HOST)

    def async_recognize(self, sample, language_code=None,
                        max_alternatives=None, profanity_filter=None,
                        speech_context=None):
        """Asychronous Recognize request to Google Speech API.

        .. _async_recognize: https://cloud.google.com/speech/reference/\
                             rest/v1beta1/speech/asyncrecognize

        See `async_recognize`_.

        :type sample: :class:`~google.cloud.speech.sample.Sample`
        :param sample: Instance of ``Sample`` containing audio information.

        :type language_code: str
        :param language_code: (Optional) The language of the supplied audio as
                              BCP-47 language tag. Example: ``'en-GB'``.
                              If omitted, defaults to ``'en-US'``.

        :type max_alternatives: int
        :param max_alternatives: (Optional) Maximum number of recognition
                                 hypotheses to be returned. The server may
                                 return fewer than maxAlternatives.
                                 Valid values are 0-30. A value of 0 or 1
                                 will return a maximum of 1. Defaults to 1

        :type profanity_filter: bool
        :param profanity_filter: If True, the server will attempt to filter
                                 out profanities, replacing all but the
                                 initial character in each filtered word with
                                 asterisks, e.g. ``'f***'``. If False or
                                 omitted, profanities won't be filtered out.

        :type speech_context: list
        :param speech_context: A list of strings (max 50) containing words and
                               phrases "hints" so that the speech recognition
                               is more likely to recognize them. This can be
                               used to improve the accuracy for specific words
                               and phrases. This can also be used to add new
                               words to the vocabulary of the recognizer.

        :rtype: :class:`~google.cloud.speech.operation.Operation`
        :returns: Instance of ``Operation`` to poll for results.
        """
        config = RecognitionConfig(
            encoding=sample.encoding, sample_rate=sample.sample_rate,
            language_code=language_code, max_alternatives=max_alternatives,
            profanity_filter=profanity_filter,
            speech_context=SpeechContext(phrases=speech_context))

        audio = RecognitionAudio(content=sample.content,
                                 uri=sample.source_uri)
        api = self._gapic_api
        response = api.async_recognize(config=config, audio=audio)

        return Operation.from_pb(response, self)

    def streaming_recognize(self, sample, language_code=None,
                            max_alternatives=None, profanity_filter=None,
                            speech_context=None, single_utterance=False,
                            interim_results=False):
        """Streaming speech recognition.

        .. note::

            Streaming recognition requests are limited to 1 minute of audio.
            See: https://cloud.google.com/speech/limits#content

        Yields :class:`~streaming_response.StreamingSpeechResponse` containing
        results and metadata from the streaming request.

        :type sample: :class:`~google.cloud.speech.sample.Sample`
        :param sample: Instance of ``Sample`` containing audio information.

        :type language_code: str
        :param language_code: (Optional) The language of the supplied audio as
                              BCP-47 language tag. Example: ``'en-GB'``.
                              If omitted, defaults to ``'en-US'``.

        :type max_alternatives: int
        :param max_alternatives: (Optional) Maximum number of recognition
                                 hypotheses to be returned. The server may
                                 return fewer than maxAlternatives.
                                 Valid values are 0-30. A value of 0 or 1
                                 will return a maximum of 1. Defaults to 1

        :type profanity_filter: bool
        :param profanity_filter: If True, the server will attempt to filter
                                 out profanities, replacing all but the
                                 initial character in each filtered word with
                                 asterisks, e.g. ``'f***'``. If False or
                                 omitted, profanities won't be filtered out.

        :type speech_context: list
        :param speech_context: A list of strings (max 50) containing words and
                               phrases "hints" so that the speech recognition
                               is more likely to recognize them. This can be
                               used to improve the accuracy for specific words
                               and phrases. This can also be used to add new
                               words to the vocabulary of the recognizer.

        :type single_utterance: bool
        :param single_utterance: (Optional) If false or omitted, the recognizer
                                 will perform continuous recognition
                                 (continuing to process audio even if the user
                                 pauses speaking) until the client closes the
                                 output stream (gRPC API) or when the maximum
                                 time limit has been reached. Multiple
                                 SpeechRecognitionResults with the is_final
                                 flag set to true may be returned.
                                 If true, the recognizer will detect a single
                                 spoken utterance. When it detects that the
                                 user has paused or stopped speaking, it will
                                 return an END_OF_UTTERANCE event and cease
                                 recognition. It will return no more than one
                                 SpeechRecognitionResult with the is_final flag
                                 set to true.

        :type interim_results: bool
        :param interim_results: (Optional) If true, interim results (tentative
                                hypotheses) may be returned as they become
                                available (these interim results are indicated
                                with the is_final=false flag). If false or
                                omitted, only is_final=true result(s) are
                                returned.

        :raises: :class:`ValueError` if sample.content is not a file-like
                 object. :class:`ValueError` if stream has closed.

        :rtype: :class:`~google.cloud.grpc.speech.v1beta1\
                       .cloud_speech_pb2.StreamingRecognizeResponse`
        :returns: ``StreamingRecognizeResponse`` instances.
        """
        if getattr(sample.content, 'closed', None) is None:
            raise ValueError('Please use file-like object for data stream.')
        if sample.content.closed:
            raise ValueError('Stream is closed.')

        requests = _stream_requests(sample, language_code=language_code,
                                    max_alternatives=max_alternatives,
                                    profanity_filter=profanity_filter,
                                    speech_context=speech_context,
                                    single_utterance=single_utterance,
                                    interim_results=interim_results)
        api = self._gapic_api
        responses = api.streaming_recognize(requests)
        return responses

    def sync_recognize(self, sample, language_code=None, max_alternatives=None,
                       profanity_filter=None, speech_context=None):
        """Synchronous Speech Recognition.

        .. _sync_recognize: https://cloud.google.com/speech/reference/\
                            rest/v1beta1/speech/syncrecognize

        See `sync_recognize`_.

        :type sample: :class:`~google.cloud.speech.sample.Sample`
        :param sample: Instance of ``Sample`` containing audio information.

        :type language_code: str
        :param language_code: (Optional) The language of the supplied audio as
                              BCP-47 language tag. Example: ``'en-GB'``.
                              If omitted, defaults to ``'en-US'``.

        :type max_alternatives: int
        :param max_alternatives: (Optional) Maximum number of recognition
                                 hypotheses to be returned. The server may
                                 return fewer than maxAlternatives.
                                 Valid values are 0-30. A value of 0 or 1
                                 will return a maximum of 1. Defaults to 1

        :type profanity_filter: bool
        :param profanity_filter: If True, the server will attempt to filter
                                 out profanities, replacing all but the
                                 initial character in each filtered word with
                                 asterisks, e.g. ``'f***'``. If False or
                                 omitted, profanities won't be filtered out.

        :type speech_context: list
        :param speech_context: A list of strings (max 50) containing words and
                               phrases "hints" so that the speech recognition
                               is more likely to recognize them. This can be
                               used to improve the accuracy for specific words
                               and phrases. This can also be used to add new
                               words to the vocabulary of the recognizer.

        :rtype: list
        :returns: A list of dictionaries. One dict for each alternative. Each
                  dictionary typically contains two keys (though not
                  all will be present in all cases)

                  * ``transcript``: The detected text from the audio recording.
                  * ``confidence``: The confidence in language detection, float
                    between 0 and 1.

        :raises: ValueError if more than one result is returned or no results.
        """
        config = RecognitionConfig(
            encoding=sample.encoding, sample_rate=sample.sample_rate,
            language_code=language_code, max_alternatives=max_alternatives,
            profanity_filter=profanity_filter,
            speech_context=SpeechContext(phrases=speech_context))

        audio = RecognitionAudio(content=sample.content,
                                 uri=sample.source_uri)
        api = self._gapic_api
        api_response = api.sync_recognize(config=config, audio=audio)
        if len(api_response.results) == 1:
            results = api_response.results.pop()
            alternatives = results.alternatives
            return [Alternative.from_pb(alternative)
                    for alternative in alternatives]
        else:
            raise ValueError('More than one result or none returned from API.')

def _stream_requests(sample, language_code=None, max_alternatives=None,
                     profanity_filter=None, speech_context=None,
                     single_utterance=None, interim_results=None):
    """Generate stream of requests from sample.

    :type sample: :class:`~google.cloud.speech.sample.Sample`
    :param sample: Instance of ``Sample`` containing audio information.

    :type language_code: str
    :param language_code: (Optional) The language of the supplied audio as
                          BCP-47 language tag. Example: ``'en-GB'``.
                          If omitted, defaults to ``'en-US'``.

    :type max_alternatives: int
    :param max_alternatives: (Optional) Maximum number of recognition
                             hypotheses to be returned. The server may
                             return fewer than maxAlternatives.
                             Valid values are 0-30. A value of 0 or 1
                             will return a maximum of 1. Defaults to 1

    :type profanity_filter: bool
    :param profanity_filter: (Optional) If True, the server will attempt to
                             filter out profanities, replacing all but the
                             initial character in each filtered word with
                             asterisks, e.g. ``'f***'``. If False or
                             omitted, profanities won't be filtered out.

    :type speech_context: list
    :param speech_context: (Optional) A list of strings (max 50) containing
                           words and phrases "hints" so that the speech
                           recognition is more likely to recognize them.
                           This can be used to improve the accuracy for
                           specific words and phrases. This can also be used to
                           add new words to the vocabulary of the recognizer.

    :type single_utterance: bool
    :param single_utterance: (Optional) If false or omitted, the recognizer
                             will perform continuous recognition
                             (continuing to process audio even if the user
                             pauses speaking) until the client closes the
                             output stream (gRPC API) or when the maximum
                             time limit has been reached. Multiple
                             SpeechRecognitionResults with the is_final
                             flag set to true may be returned.

                             If true, the recognizer will detect a single
                             spoken utterance. When it detects that the
                             user has paused or stopped speaking, it will
                             return an END_OF_UTTERANCE event and cease
                             recognition. It will return no more than one
                             SpeechRecognitionResult with the is_final flag
                             set to true.

    :type interim_results: bool
    :param interim_results: (Optional) If true, interim results (tentative
                            hypotheses) may be returned as they become
                            available (these interim results are indicated
                            with the is_final=false flag). If false or
                            omitted, only is_final=true result(s) are
                            returned.
    """
    config_request = _make_streaming_request(
        sample, language_code=language_code, max_alternatives=max_alternatives,
        profanity_filter=profanity_filter,
        speech_context=SpeechContext(phrases=speech_context),
        single_utterance=single_utterance, interim_results=interim_results)

    # The config request MUST go first and not contain any audio data.
    yield config_request

    while True:
        data = sample.content.read(sample.chunk_size)
        if not data:
            break
        yield StreamingRecognizeRequest(audio_content=data)

def _make_streaming_request(sample, language_code,
                            max_alternatives, profanity_filter,
                            speech_context, single_utterance,
                            interim_results):
    """Build streaming request.

    :type sample: :class:`~google.cloud.speech.sample.Sample`
    :param sample: Instance of ``Sample`` containing audio information.

    :type language_code: str
    :param language_code: The language of the supplied audio as
                          BCP-47 language tag. Example: ``'en-GB'``.
                          If omitted, defaults to ``'en-US'``.

    :type max_alternatives: int
    :param max_alternatives: Maximum number of recognition
                             hypotheses to be returned. The server may
                             return fewer than maxAlternatives.
                             Valid values are 0-30. A value of 0 or 1
                             will return a maximum of 1. Defaults to 1

    :type profanity_filter: bool
    :param profanity_filter: If True, the server will attempt to filter
                             out profanities, replacing all but the
                             initial character in each filtered word with
                             asterisks, e.g. ``'f***'``. If False or
                             omitted, profanities won't be filtered out.

    :type speech_context: list
    :param speech_context: A list of strings (max 50) containing words and
                           phrases "hints" so that the speech recognition
                           is more likely to recognize them. This can be
                           used to improve the accuracy for specific words
                           and phrases. This can also be used to add new
                           words to the vocabulary of the recognizer.

    :type single_utterance: bool
    :param single_utterance: If false or omitted, the recognizer
                             will perform continuous recognition
                             (continuing to process audio even if the user
                             pauses speaking) until the client closes the
                             output stream (gRPC API) or when the maximum
                             time limit has been reached. Multiple
                             SpeechRecognitionResults with the is_final
                             flag set to true may be returned.

                             If true, the recognizer will detect a single
                             spoken utterance. When it detects that the
                             user has paused or stopped speaking, it will
                             return an END_OF_UTTERANCE event and cease
                             recognition. It will return no more than one
                             SpeechRecognitionResult with the is_final flag
                             set to true.

    :type interim_results: bool
    :param interim_results: If true, interim results (tentative
                            hypotheses) may be returned as they become
                            available (these interim results are indicated
                            with the is_final=false flag). If false or
                            omitted, only is_final=true result(s) are
                            returned.

    :rtype:
        :class:`~grpc.speech.v1beta1.cloud_speech_pb2.StreamingRecognizeRequest`
    :returns: Instance of ``StreamingRecognizeRequest``.
    """
    config = RecognitionConfig(
        encoding=sample.encoding, sample_rate=sample.sample_rate,
        language_code=language_code, max_alternatives=max_alternatives,
        profanity_filter=profanity_filter, speech_context=speech_context)

    streaming_config = StreamingRecognitionConfig(
        config=config, single_utterance=single_utterance,
        interim_results=interim_results)

    config_request = StreamingRecognizeRequest(
        streaming_config=streaming_config)

    return config_request