text:
define("dojox/charting/action2d/TouchIndicator",["dojo/_base/lang","dojo/_base/declare","dojo/_base/event","dojo/has","dojo/touch","dojo/_base/connect","./ChartAction","./_IndicatorElement","dojox/lang/utils"],function(_1,_2,_3,_4,_5,_6,_7,_8,du){
return _2("dojox.charting.action2d.TouchIndicator",_7,{defaultParams:{series:"",dualIndicator:false,vertical:true,autoScroll:true,fixed:true,precision:0,lines:true,labels:true,markers:true},optionalParams:{lineStroke:{},outlineStroke:{},shadowStroke:{},lineFill:{},stroke:{},outline:{},shadow:{},fill:{},fillFunc:null,labelFunc:null,font:"",fontColor:"",markerStroke:{},markerOutline:{},markerShadow:{},markerFill:{},markerSymbol:"",offset:{},start:false},constructor:function(_9,_a,_b){
if(_4("touch-events")){
this._listeners=[{eventName:"touchstart",methodName:"onTouchStart"},{eventName:"touchmove",methodName:"onTouchMove"},{eventName:"touchend",methodName:"onTouchEnd"},{eventName:"touchcancel",methodName:"onTouchEnd"}];
}else{
this._listeners=[{eventName:_5.press,methodName:"onTouchStart"},{eventName:_5.move,methodName:"onTouchMove"},{eventName:_5.cancel,methodName:"onTouchEnd"}];
}
this.opt=_1.clone(this.defaultParams);
du.updateWithObject(this.opt,_b);
du.updateWithPattern(this.opt,_b,this.optionalParams);
this._uName="touchIndicator"+this.opt.series;
this.connect();
},connect:function(){
this.inherited(arguments);
this.chart.addPlot(this._uName,{type:_8,inter:this});
},disconnect:function(){
var _c=this.chart.getPlot(this._uName);
if(_c.pageCoord){
this.onTouchEnd();
}
this.chart.removePlot(this._uName);
this.inherited(arguments);
},onChange:function(_d){
},onTouchStart:function(_e){
if(!_e.touches||_e.touches.length==1){
this._onTouchSingle(_e,true);
}else{
if(this.opt.dualIndicator&&_e.touches.length==2){
this._onTouchDual(_e);
}
}
},onTouchMove:function(_f){
if(!_f.touches||_f.touches.length==1){
this._onTouchSingle(_f);
}else{
if(this.opt.dualIndicator&&_f.touches.length==2){
this._onTouchDual(_f);
}
}
},_onTouchSingle:function(_10,_11){
if(!_4("touch-events")&&!this._onTouchEndHandler){
this._onTouchEndHandler=_6.connect(this.chart.node.ownerDocument,_5.release,this,"onTouchEnd");
}
if(this.chart._delayedRenderHandle&&!_11){
this.chart.render();
}
var _12=this.chart.getPlot(this._uName);
_12.pageCoord={x:_10.touches?_10.touches[0].pageX:_10.pageX,y:_10.touches?_10.touches[0].pageY:_10.pageY};
_12.dirty=true;
if(_11){
this.chart.delayedRender();
}else{
this.chart.render();
}
_3.stop(_10);
},_onTouchDual:function(_13){
if(!_4("touch-events")&&!this._onTouchEndHandler){
this._onTouchEndHandler=_6.connect(this.chart.node.ownerDocument,_5.release,this,"onTouchEnd");
}
if(this.chart._delayedRenderHandle){
this.chart.render();
}
var _14=this.chart.getPlot(this._uName);
_14.pageCoord={x:_13.touches[0].pageX,y:_13.touches[0].pageY};
_14.secondCoord={x:_13.touches[1].pageX,y:_13.touches[1].pageY};
_14.dirty=true;
this.chart.render();
_3.stop(_13);
},onTouchEnd:function(_15){
if(!_4("touch-events")&&this._onTouchEndHandler){
_6.disconnect(this._onTouchEndHandler);
this._onTouchEndHandler=null;
}
var _16=this.chart.getPlot(this._uName);
_16.stopTrack();
_16.pageCoord=null;
_16.secondCoord=null;
_16.dirty=true;
this.chart.delayedRender();
}});
});


text:
namespace {

struct TestView : public arangodb::LogicalView {
  arangodb::Result _appendVelocyPackResult;
  arangodb::velocypack::Builder _properties;

  TestView(TRI_vocbase_t& vocbase, arangodb::velocypack::Slice const& definition)
      : arangodb::LogicalView(vocbase, definition) {}
  virtual arangodb::Result appendVelocyPackImpl(
      arangodb::velocypack::Builder& builder,
      Serialization) const override {
    builder.add("properties", _properties.slice());
    return _appendVelocyPackResult;
  }
  virtual arangodb::Result dropImpl() override { return arangodb::Result(); }
  virtual void open() override {}
  virtual arangodb::Result renameImpl(std::string const&) override {
    return arangodb::Result();
  }
  virtual arangodb::Result properties(arangodb::velocypack::Slice const& properties,
                                      bool partialUpdate) override {
    _properties = arangodb::velocypack::Builder(properties);
    return arangodb::Result();
  }
  virtual bool visitCollections(CollectionVisitor const& visitor) const override {
    return true;
  }
};

struct ViewFactory : public arangodb::ViewFactory {
  virtual arangodb::Result create(arangodb::LogicalView::ptr& view, TRI_vocbase_t& vocbase,
                                  arangodb::velocypack::Slice const& definition) const override {
    view = vocbase.createView(definition);

    return arangodb::Result();
  }

  virtual arangodb::Result instantiate(arangodb::LogicalView::ptr& view,
                                       TRI_vocbase_t& vocbase,
                                       arangodb::velocypack::Slice const& definition) const override {
    view = std::make_shared<TestView>(vocbase, definition);

    return arangodb::Result();
  }
};

}  // namespace

// -----------------------------------------------------------------------------
// --SECTION--                                                 setup / tear-down
// -----------------------------------------------------------------------------

class RestUsersHandlerTest
    : public ::testing::Test,
      public arangodb::tests::LogSuppressor<arangodb::Logger::AUTHENTICATION, arangodb::LogLevel::ERR> {
 protected:
  arangodb::tests::mocks::MockAqlServer server;
  arangodb::SystemDatabaseFeature::ptr system;
  ViewFactory viewFactory;

  RestUsersHandlerTest()
      : server(), system(server.getFeature<arangodb::SystemDatabaseFeature>().use()) {
    auto& viewTypesFeature = server.getFeature<arangodb::ViewTypesFeature>();
    viewTypesFeature.emplace(arangodb::LogicalDataSource::Type::emplace(arangodb::velocypack::StringRef(
                                 "testViewType")),
                             viewFactory);
  }
};

// -----------------------------------------------------------------------------
// --SECTION--                                                        test suite
// -----------------------------------------------------------------------------

TEST_F(RestUsersHandlerTest, test_collection_auth) {
  auto usersJson = arangodb::velocypack::Parser::fromJson(
      "{ \"name\": \"_users\", \"isSystem\": true }");
  static const std::string userName("testUser");
  auto& databaseFeature = server.getFeature<arangodb::DatabaseFeature>();
  TRI_vocbase_t* vocbase;  // will be owned by DatabaseFeature
  ASSERT_TRUE(databaseFeature.createDatabase(testDBInfo(server.server()), vocbase).ok());
  auto grantRequestPtr = std::make_unique<GeneralRequestMock>(*vocbase);
  auto& grantRequest = *grantRequestPtr;
  auto grantResponcePtr = std::make_unique<GeneralResponseMock>();
  auto& grantResponce = *grantResponcePtr;
  auto grantWildcardRequestPtr = std::make_unique<GeneralRequestMock>(*vocbase);
  auto& grantWildcardRequest = *grantWildcardRequestPtr;
  auto grantWildcardResponcePtr = std::make_unique<GeneralResponseMock>();
  auto& grantWildcardResponce = *grantWildcardResponcePtr;
  auto revokeRequestPtr = std::make_unique<GeneralRequestMock>(*vocbase);
  auto& revokeRequest = *revokeRequestPtr;
  auto revokeResponcePtr = std::make_unique<GeneralResponseMock>();
  auto& revokeResponce = *revokeResponcePtr;
  auto revokeWildcardRequestPtr = std::make_unique<GeneralRequestMock>(*vocbase);
  auto& revokeWildcardRequest = *revokeWildcardRequestPtr;
  auto revokeWildcardResponcePtr = std::make_unique<GeneralResponseMock>();
  auto& revokeWildcardResponce = *revokeWildcardResponcePtr;
  arangodb::RestUsersHandler grantHandler(server.server(), grantRequestPtr.release(),
                                          grantResponcePtr.release());
  arangodb::RestUsersHandler grantWildcardHandler(server.server(),
                                                  grantWildcardRequestPtr.release(),
                                                  grantWildcardResponcePtr.release());
  arangodb::RestUsersHandler revokeHandler(server.server(), revokeRequestPtr.release(),
                                           revokeResponcePtr.release());
  arangodb::RestUsersHandler revokeWildcardHandler(server.server(),
                                                   revokeWildcardRequestPtr.release(),
                                                   revokeWildcardResponcePtr.release());

  grantRequest.addSuffix("testUser");
  grantRequest.addSuffix("database");
  grantRequest.addSuffix(vocbase->name());
  grantRequest.addSuffix("testDataSource");
  grantRequest.setRequestType(arangodb::rest::RequestType::PUT);
  grantRequest._payload.openObject();
  grantRequest._payload.add("grant", arangodb::velocypack::Value(arangodb::auth::convertFromAuthLevel(
                                         arangodb::auth::Level::RW)));
  grantRequest._payload.close();

  grantWildcardRequest.addSuffix("testUser");
  grantWildcardRequest.addSuffix("database");
  grantWildcardRequest.addSuffix(vocbase->name());
  grantWildcardRequest.addSuffix("*");
  grantWildcardRequest.setRequestType(arangodb::rest::RequestType::PUT);
  grantWildcardRequest._payload.openObject();
  grantWildcardRequest._payload.add("grant", arangodb::velocypack::Value(arangodb::auth::convertFromAuthLevel(
                                                 arangodb::auth::Level::RW)));
  grantWildcardRequest._payload.close();

  revokeRequest.addSuffix("testUser");
  revokeRequest.addSuffix("database");
  revokeRequest.addSuffix(vocbase->name());
  revokeRequest.addSuffix("testDataSource");
  revokeRequest.setRequestType(arangodb::rest::RequestType::DELETE_REQ);

  revokeWildcardRequest.addSuffix("testUser");
  revokeWildcardRequest.addSuffix("database");
  revokeWildcardRequest.addSuffix(vocbase->name());
  revokeWildcardRequest.addSuffix("*");
  revokeWildcardRequest.setRequestType(arangodb::rest::RequestType::DELETE_REQ);

  struct ExecContext : public arangodb::ExecContext {
    ExecContext()
        : arangodb::ExecContext(arangodb::ExecContext::Type::Default, userName,
                                "", arangodb::auth::Level::RW,
                                arangodb::auth::Level::NONE, true) {
    }  // ExecContext::isAdminUser() == true
  } execContext;
  arangodb::ExecContextScope execContextScope(&execContext);
  auto* authFeature = arangodb::AuthenticationFeature::instance();
  auto* userManager = authFeature->userManager();
  userManager->setGlobalVersion(0);  // required for UserManager::loadFromDB()

  // test auth missing (grant)
  {
    auto scopedUsers = std::shared_ptr<arangodb::LogicalCollection>(
        system->createCollection(usersJson->slice()).get(),
        [this](arangodb::LogicalCollection* ptr) -> void {
          system->dropCollection(ptr->id(), true, 0.0);
        });
    arangodb::auth::UserMap userMap;
    arangodb::auth::User* userPtr = nullptr;
    userManager->setAuthInfo(userMap);  // insure an empty map is set before UserManager::storeUser(...)
    userManager->storeUser(false, userName, arangodb::StaticStrings::Empty,
                           true, arangodb::velocypack::Slice());
    userManager->accessUser(userName, [&userPtr](arangodb::auth::User const& user) -> arangodb::Result {
      userPtr = const_cast<arangodb::auth::User*>(&user);
      return arangodb::Result();
    });
    ASSERT_NE(nullptr, userPtr);

    EXPECT_TRUE(
        (arangodb::auth::Level::NONE ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
    auto status = grantHandler.execute();
    EXPECT_EQ(arangodb::RestStatus::DONE, status);
    EXPECT_EQ(arangodb::rest::ResponseCode::NOT_FOUND, grantResponce.responseCode());
    auto slice = grantResponce._payload.slice();
    EXPECT_TRUE(slice.isObject());
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::Code) &&
                 slice.get(arangodb::StaticStrings::Code).isNumber<size_t>() &&
                 size_t(arangodb::rest::ResponseCode::NOT_FOUND) ==
                     slice.get(arangodb::StaticStrings::Code).getNumber<size_t>()));
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::Error) &&
                 slice.get(arangodb::StaticStrings::Error).isBoolean() &&
                 true == slice.get(arangodb::StaticStrings::Error).getBoolean()));
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::ErrorNum) &&
                 slice.get(arangodb::StaticStrings::ErrorNum).isNumber<int>() &&
                 TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND ==
                     ErrorCode{slice.get(arangodb::StaticStrings::ErrorNum).getNumber<int>()}));
    EXPECT_TRUE(
        (arangodb::auth::Level::NONE ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
  }

  // test auth missing (revoke)
  {
    auto scopedUsers = std::shared_ptr<arangodb::LogicalCollection>(
        system->createCollection(usersJson->slice()).get(),
        [this](arangodb::LogicalCollection* ptr) -> void {
          system->dropCollection(ptr->id(), true, 0.0);
        });
    arangodb::auth::UserMap userMap;
    arangodb::auth::User* userPtr = nullptr;
    userManager->setAuthInfo(userMap);  // insure an empty map is set before UserManager::storeUser(...)
    userManager->storeUser(false, userName, arangodb::StaticStrings::Empty,
                           true, arangodb::velocypack::Slice());
    userManager->accessUser(userName, [&userPtr](arangodb::auth::User const& user) -> arangodb::Result {
      userPtr = const_cast<arangodb::auth::User*>(&user);
      return arangodb::Result();
    });
    ASSERT_NE(nullptr, userPtr);
    userPtr->grantCollection(vocbase->name(),
                             "testDataSource", arangodb::auth::Level::RO);  // for missing collections User::collectionAuthLevel(...) returns database auth::Level

    EXPECT_TRUE(
        (arangodb::auth::Level::RO ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
    auto status = revokeHandler.execute();
    EXPECT_EQ(arangodb::RestStatus::DONE, status);
    EXPECT_EQ(arangodb::rest::ResponseCode::NOT_FOUND, revokeResponce.responseCode());
    auto slice = revokeResponce._payload.slice();
    EXPECT_TRUE(slice.isObject());
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::Code) &&
                 slice.get(arangodb::StaticStrings::Code).isNumber<size_t>() &&
                 size_t(arangodb::rest::ResponseCode::NOT_FOUND) ==
                     slice.get(arangodb::StaticStrings::Code).getNumber<size_t>()));
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::Error) &&
                 slice.get(arangodb::StaticStrings::Error).isBoolean() &&
                 true == slice.get(arangodb::StaticStrings::Error).getBoolean()));
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::ErrorNum) &&
         slice.get(arangodb::StaticStrings::ErrorNum).isNumber<int>() &&
         TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND ==
             ErrorCode{slice.get(arangodb::StaticStrings::ErrorNum).getNumber<int>()}));
    EXPECT_TRUE(
        (arangodb::auth::Level::RO ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));  // not modified from above
  }

  // test auth collection (grant)
  {
    auto collectionJson = arangodb::velocypack::Parser::fromJson(
        "{ \"name\": \"testDataSource\" }");
    auto scopedUsers = std::shared_ptr<arangodb::LogicalCollection>(
        system->createCollection(usersJson->slice()).get(),
        [this](arangodb::LogicalCollection* ptr) -> void {
          system->dropCollection(ptr->id(), true, 0.0);
        });
    arangodb::auth::UserMap userMap;
    arangodb::auth::User* userPtr = nullptr;
    userManager->setAuthInfo(userMap);  // insure an empty map is set before UserManager::storeUser(...)
    userManager->storeUser(false, userName, arangodb::StaticStrings::Empty,
                           true, arangodb::velocypack::Slice());
    userManager->accessUser(userName, [&userPtr](arangodb::auth::User const& user) -> arangodb::Result {
      userPtr = const_cast<arangodb::auth::User*>(&user);
      return arangodb::Result();
    });
    ASSERT_NE(nullptr, userPtr);
    auto logicalCollection = std::shared_ptr<arangodb::LogicalCollection>(
        vocbase->createCollection(collectionJson->slice()).get(),
        [vocbase](arangodb::LogicalCollection* ptr) -> void {
          vocbase->dropCollection(ptr->id(), false, 0);
        });
    ASSERT_FALSE(!logicalCollection);

    EXPECT_TRUE(
        (arangodb::auth::Level::NONE ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
    auto status = grantHandler.execute();
    EXPECT_EQ(arangodb::RestStatus::DONE, status);
    EXPECT_EQ(arangodb::rest::ResponseCode::OK, grantResponce.responseCode());
    auto slice = grantResponce._payload.slice();
    EXPECT_TRUE(slice.isObject());
    EXPECT_TRUE((slice.hasKey(vocbase->name() + "/testDataSource") &&
                 slice.get(vocbase->name() + "/testDataSource").isString() &&
                 arangodb::auth::convertFromAuthLevel(arangodb::auth::Level::RW) ==
                     slice.get(vocbase->name() + "/testDataSource").copyString()));
    EXPECT_TRUE(
        (arangodb::auth::Level::RW ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
  }

  // test auth collection (revoke)
  {
    auto collectionJson = arangodb::velocypack::Parser::fromJson(
        "{ \"name\": \"testDataSource\" }");
    auto scopedUsers = std::shared_ptr<arangodb::LogicalCollection>(
        system->createCollection(usersJson->slice()).get(),
        [this](arangodb::LogicalCollection* ptr) -> void {
          system->dropCollection(ptr->id(), true, 0.0);
        });
    arangodb::auth::UserMap userMap;
    arangodb::auth::User* userPtr = nullptr;
    userManager->setAuthInfo(userMap);  // insure an empty map is set before UserManager::storeUser(...)
    userManager->storeUser(false, userName, arangodb::StaticStrings::Empty,
                           true, arangodb::velocypack::Slice());
    userManager->accessUser(userName, [&userPtr](arangodb::auth::User const& user) -> arangodb::Result {
      userPtr = const_cast<arangodb::auth::User*>(&user);
      return arangodb::Result();
    });
    ASSERT_NE(nullptr, userPtr);
    userPtr->grantCollection(vocbase->name(),
                             "testDataSource", arangodb::auth::Level::RO);  // for missing collections User::collectionAuthLevel(...) returns database auth::Level
    auto logicalCollection = std::shared_ptr<arangodb::LogicalCollection>(
        vocbase->createCollection(collectionJson->slice()).get(),
        [vocbase](arangodb::LogicalCollection* ptr) -> void {
          vocbase->dropCollection(ptr->id(), false, 0);
        });
    ASSERT_FALSE(!logicalCollection);

    EXPECT_TRUE(
        (arangodb::auth::Level::RO ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
    auto status = revokeHandler.execute();
    EXPECT_EQ(arangodb::RestStatus::DONE, status);
    EXPECT_EQ(arangodb::rest::ResponseCode::ACCEPTED, revokeResponce.responseCode());
    auto slice = revokeResponce._payload.slice();
    EXPECT_TRUE(slice.isObject());
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::Code) &&
                 slice.get(arangodb::StaticStrings::Code).isNumber<size_t>() &&
                 size_t(arangodb::rest::ResponseCode::ACCEPTED) ==
                     slice.get(arangodb::StaticStrings::Code).getNumber<size_t>()));
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::Error) &&
                 slice.get(arangodb::StaticStrings::Error).isBoolean() &&
                 false == slice.get(arangodb::StaticStrings::Error).getBoolean()));
    EXPECT_TRUE(
        (arangodb::auth::Level::NONE ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
  }

  // test auth view (grant)
  {
    auto viewJson = arangodb::velocypack::Parser::fromJson(
        "{ \"name\": \"testDataSource\", \"type\": \"testViewType\" }");
    auto scopedUsers = std::shared_ptr<arangodb::LogicalCollection>(
        system->createCollection(usersJson->slice()).get(),
        [this](arangodb::LogicalCollection* ptr) -> void {
          system->dropCollection(ptr->id(), true, 0.0);
        });
    arangodb::auth::UserMap userMap;
    arangodb::auth::User* userPtr = nullptr;
    userManager->setAuthInfo(userMap);  // insure an empty map is set before UserManager::storeUser(...)
    userManager->storeUser(false, userName, arangodb::StaticStrings::Empty,
                           true, arangodb::velocypack::Slice());
    userManager->accessUser(userName, [&userPtr](arangodb::auth::User const& user) -> arangodb::Result {
      userPtr = const_cast<arangodb::auth::User*>(&user);
      return arangodb::Result();
    });
    ASSERT_NE(nullptr, userPtr);
    auto logicalView = std::shared_ptr<arangodb::LogicalView>(
        vocbase->createView(viewJson->slice()).get(),
        [vocbase](arangodb::LogicalView* ptr) -> void {
          vocbase->dropView(ptr->id(), false);
        });
    ASSERT_FALSE(!logicalView);

    EXPECT_TRUE(
        (arangodb::auth::Level::NONE ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
    auto status = grantHandler.execute();
    EXPECT_EQ(arangodb::RestStatus::DONE, status);
    EXPECT_EQ(arangodb::rest::ResponseCode::NOT_FOUND, grantResponce.responseCode());
    auto slice = grantResponce._payload.slice();
    EXPECT_TRUE(slice.isObject());
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::Code) &&
                 slice.get(arangodb::StaticStrings::Code).isNumber<size_t>() &&
                 size_t(arangodb::rest::ResponseCode::NOT_FOUND) ==
                     slice.get(arangodb::StaticStrings::Code).getNumber<size_t>()));
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::Error) &&
                 slice.get(arangodb::StaticStrings::Error).isBoolean() &&
                 true == slice.get(arangodb::StaticStrings::Error).getBoolean()));
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::ErrorNum) &&
         slice.get(arangodb::StaticStrings::ErrorNum).isNumber<int>() &&
         TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND ==
             ErrorCode{slice.get(arangodb::StaticStrings::ErrorNum).getNumber<int>()}));
    EXPECT_TRUE(
        (arangodb::auth::Level::NONE ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
  }

  // test auth view (revoke)
  {
    auto viewJson = arangodb::velocypack::Parser::fromJson(
        "{ \"name\": \"testDataSource\", \"type\": \"testViewType\" }");
    auto scopedUsers = std::shared_ptr<arangodb::LogicalCollection>(
        system->createCollection(usersJson->slice()).get(),
        [this](arangodb::LogicalCollection* ptr) -> void {
          system->dropCollection(ptr->id(), true, 0.0);
        });
    arangodb::auth::UserMap userMap;
    arangodb::auth::User* userPtr = nullptr;
    userManager->setAuthInfo(userMap);  // insure an empty map is set before UserManager::storeUser(...)
    userManager->storeUser(false, userName, arangodb::StaticStrings::Empty,
                           true, arangodb::velocypack::Slice());
    userManager->accessUser(userName, [&userPtr](arangodb::auth::User const& user) -> arangodb::Result {
      userPtr = const_cast<arangodb::auth::User*>(&user);
      return arangodb::Result();
    });
    ASSERT_NE(nullptr, userPtr);
    userPtr->grantCollection(vocbase->name(),
                             "testDataSource", arangodb::auth::Level::RO);  // for missing collections User::collectionAuthLevel(...) returns database auth::Level
    auto logicalView = std::shared_ptr<arangodb::LogicalView>(
        vocbase->createView(viewJson->slice()).get(),
        [vocbase](arangodb::LogicalView* ptr) -> void {
          vocbase->dropView(ptr->id(), false);
        });
    ASSERT_FALSE(!logicalView);

    EXPECT_TRUE(
        (arangodb::auth::Level::RO ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
    auto status = revokeHandler.execute();
    EXPECT_EQ(arangodb::RestStatus::DONE, status);
    EXPECT_EQ(arangodb::rest::ResponseCode::NOT_FOUND, revokeResponce.responseCode());
    auto slice = revokeResponce._payload.slice();
    EXPECT_TRUE(slice.isObject());
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::Code) &&
                 slice.get(arangodb::StaticStrings::Code).isNumber<size_t>() &&
                 size_t(arangodb::rest::ResponseCode::NOT_FOUND) ==
                     slice.get(arangodb::StaticStrings::Code).getNumber<size_t>()));
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::Error) &&
                 slice.get(arangodb::StaticStrings::Error).isBoolean() &&
                 true == slice.get(arangodb::StaticStrings::Error).getBoolean()));
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::ErrorNum) &&
                 slice.get(arangodb::StaticStrings::ErrorNum).isNumber<int>() &&
                 TRI_ERROR_ARANGO_DATA_SOURCE_NOT_FOUND ==
                     ErrorCode{slice.get(arangodb::StaticStrings::ErrorNum).getNumber<int>()}));
    EXPECT_TRUE(
        (arangodb::auth::Level::RO ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));  // not modified from above
  }

  // test auth wildcard (grant)
  {
    auto collectionJson = arangodb::velocypack::Parser::fromJson(
        "{ \"name\": \"testDataSource\" }");
    auto scopedUsers = std::shared_ptr<arangodb::LogicalCollection>(
        system->createCollection(usersJson->slice()).get(),
        [this](arangodb::LogicalCollection* ptr) -> void {
          system->dropCollection(ptr->id(), true, 0.0);
        });
    arangodb::auth::UserMap userMap;
    arangodb::auth::User* userPtr = nullptr;
    userManager->setAuthInfo(userMap);  // insure an empty map is set before UserManager::storeUser(...)
    userManager->storeUser(false, userName, arangodb::StaticStrings::Empty,
                           true, arangodb::velocypack::Slice());
    userManager->accessUser(userName, [&userPtr](arangodb::auth::User const& user) -> arangodb::Result {
      userPtr = const_cast<arangodb::auth::User*>(&user);
      return arangodb::Result();
    });
    ASSERT_NE(nullptr, userPtr);
    auto logicalCollection = std::shared_ptr<arangodb::LogicalCollection>(
        vocbase->createCollection(collectionJson->slice()).get(),
        [vocbase](arangodb::LogicalCollection* ptr) -> void {
          vocbase->dropCollection(ptr->id(), false, 0);
        });
    ASSERT_FALSE(!logicalCollection);

    EXPECT_TRUE(
        (arangodb::auth::Level::NONE ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
    auto status = grantWildcardHandler.execute();
    EXPECT_EQ(arangodb::RestStatus::DONE, status);
    EXPECT_EQ(arangodb::rest::ResponseCode::OK, grantWildcardResponce.responseCode());
    auto slice = grantWildcardResponce._payload.slice();
    EXPECT_TRUE(slice.isObject());
    EXPECT_TRUE((slice.hasKey(vocbase->name() + "/*") &&
                 slice.get(vocbase->name() + "/*").isString() &&
                 arangodb::auth::convertFromAuthLevel(arangodb::auth::Level::RW) ==
                     slice.get(vocbase->name() + "/*").copyString()));
    EXPECT_TRUE(
        (arangodb::auth::Level::RW ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
  }

  // test auth wildcard (revoke)
  {
    auto collectionJson = arangodb::velocypack::Parser::fromJson(
        "{ \"name\": \"testDataSource\" }");
    auto scopedUsers = std::shared_ptr<arangodb::LogicalCollection>(
        system->createCollection(usersJson->slice()).get(),
        [this](arangodb::LogicalCollection* ptr) -> void {
          system->dropCollection(ptr->id(), true, 0.0);
        });
    arangodb::auth::UserMap userMap;
    arangodb::auth::User* userPtr = nullptr;
    userManager->setAuthInfo(userMap);  // insure an empty map is set before UserManager::storeUser(...)
    userManager->storeUser(false, userName, arangodb::StaticStrings::Empty,
                           true, arangodb::velocypack::Slice());
    userManager->accessUser(userName, [&userPtr](arangodb::auth::User const& user) -> arangodb::Result {
      userPtr = const_cast<arangodb::auth::User*>(&user);
      return arangodb::Result();
    });
    ASSERT_NE(nullptr, userPtr);
    userPtr->grantCollection(vocbase->name(),
                             "testDataSource", arangodb::auth::Level::RO);  // for missing collections User::collectionAuthLevel(...) returns database auth::Level
    auto logicalCollection = std::shared_ptr<arangodb::LogicalCollection>(
        vocbase->createCollection(collectionJson->slice()).get(),
        [vocbase](arangodb::LogicalCollection* ptr) -> void {
          vocbase->dropCollection(ptr->id(), false, 0);
        });
    ASSERT_FALSE(!logicalCollection);

    EXPECT_TRUE(
        (arangodb::auth::Level::RO ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));
    auto status = revokeWildcardHandler.execute();
    EXPECT_EQ(arangodb::RestStatus::DONE, status);
    EXPECT_TRUE((arangodb::rest::ResponseCode::ACCEPTED ==
                 revokeWildcardResponce.responseCode()));
    auto slice = revokeWildcardResponce._payload.slice();
    EXPECT_TRUE(slice.isObject());
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::Code) &&
                 slice.get(arangodb::StaticStrings::Code).isNumber<size_t>() &&
                 size_t(arangodb::rest::ResponseCode::ACCEPTED) ==
                     slice.get(arangodb::StaticStrings::Code).getNumber<size_t>()));
    EXPECT_TRUE((slice.hasKey(arangodb::StaticStrings::Error) &&
                 slice.get(arangodb::StaticStrings::Error).isBoolean() &&
                 false == slice.get(arangodb::StaticStrings::Error).getBoolean()));
    EXPECT_TRUE(
        (arangodb::auth::Level::RO ==
         execContext.collectionAuthLevel(vocbase->name(), "testDataSource")));  // unchanged since revocation is only for exactly matching collection names
  }
}

redpajama_set_name: RedPajamaGithub


text:
package org.hisp.dhis.android.trackercapture.fragments.selectprogram.dialogs;

import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.LoaderManager;
import android.support.v4.content.Loader;
import android.text.Editable;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import com.raizlabs.android.dbflow.structure.Model;
import com.squareup.otto.Subscribe;

import org.hisp.dhis.android.sdk.R;
import org.hisp.dhis.android.sdk.controllers.DhisController;
import org.hisp.dhis.android.sdk.controllers.tracker.TrackerController;
import org.hisp.dhis.android.sdk.events.UiEvent;
import org.hisp.dhis.android.sdk.job.JobExecutor;
import org.hisp.dhis.android.sdk.job.NetworkJob;
import org.hisp.dhis.android.sdk.network.APIException;
import org.hisp.dhis.android.sdk.persistence.Dhis2Application;
import org.hisp.dhis.android.sdk.persistence.loaders.DbLoader;
import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityAttributeValue;
import org.hisp.dhis.android.sdk.persistence.models.TrackedEntityInstance;
import org.hisp.dhis.android.sdk.ui.adapters.DataValueAdapter;
import org.hisp.dhis.android.sdk.ui.adapters.rows.AbsTextWatcher;
import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.CoordinatesRow;
import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.IndicatorRow;
import org.hisp.dhis.android.sdk.ui.adapters.rows.dataentry.StatusRow;
import org.hisp.dhis.android.sdk.ui.adapters.rows.events.OnDetailedInfoButtonClick;
import org.hisp.dhis.android.sdk.ui.dialogs.QueryTrackedEntityInstancesResultDialogFragment;
import org.hisp.dhis.android.sdk.ui.views.FloatingActionButton;
import org.hisp.dhis.android.sdk.utils.UiUtils;

import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;

public class QueryTrackedEntityInstancesDialogFragment extends DialogFragment
        implements View.OnClickListener, LoaderManager.LoaderCallbacks<QueryTrackedEntityInstancesDialogFragmentForm> {
    private static final String TAG = QueryTrackedEntityInstancesDialogFragment.class.getSimpleName();

    private static final int LOADER_ID = 956401;

    private QueryTrackedEntityInstancesDialogFragmentForm mForm;
    private EditText mFilter;
    private TextView mDialogLabel;
    private DataValueAdapter mAdapter;
    private ListView mListView;
    private int mDialogId;
    //@Arthur:Declare checkbox

    private FragmentActivity activity = null;

    private static final String EXTRA_PROGRAM = "extra:trackedEntityAttributes";
    private static final String EXTRA_ORGUNIT = "extra:orgUnit";
    private static final String EXTRA_DETAILED = "extra:detailed";
    private static final String EXTRA_ARGUMENTS = "extra:Arguments";
    private static final String EXTRA_SAVED_INSTANCE_STATE = "extra:savedInstanceState";

    public static QueryTrackedEntityInstancesDialogFragment newInstance(String program, String orgUnit) {
        QueryTrackedEntityInstancesDialogFragment dialogFragment = new QueryTrackedEntityInstancesDialogFragment();
        Bundle args = new Bundle();

        args.putString(EXTRA_ORGUNIT, orgUnit);
        args.putString(EXTRA_PROGRAM, program);
        args.putBoolean(EXTRA_DETAILED, false);
        dialogFragment.setArguments(args);
        return dialogFragment;
    }

    private String getOrgUnit() {
        return getArguments().getString(EXTRA_ORGUNIT);
    }

    private String getProgram() {
        return getArguments().getString(EXTRA_PROGRAM);
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setStyle(DialogFragment.STYLE_NO_TITLE,
                R.style.Theme_AppCompat_Light_Dialog);

    }

    @Override
    public void onPause() {
        super.onPause();
        Dhis2Application.getEventBus().unregister(this);
    }

    @Override
    public void onResume() {
        super.onResume();
        Dhis2Application.getEventBus().register(this);
    }

    @Override
    public View onCreateView(LayoutInflater inflater,
                             ViewGroup container, Bundle savedInstanceState) {
        getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

        return inflater.inflate(R.layout.dialog_fragment_teiqueryresult, container, false);
    }

    @Override
    public void onViewCreated(View view, Bundle savedInstanceState) {

        mListView = (ListView) view
                .findViewById(R.id.simple_listview);

        View header = getLayoutInflater(savedInstanceState).inflate(
                org.hisp.dhis.android.trackercapture.R.layout.fragmentdialog_querytei_header, mListView, false
        );
        FloatingActionButton detailedSearchButton = (FloatingActionButton) header.findViewById(org.hisp.dhis.android.trackercapture.R.id.detailed_search_button);
        detailedSearchButton.setOnClickListener(this);
        mListView.addHeaderView(header, TAG, false);

        ImageView loadDialogButton = (ImageView) view
                .findViewById(R.id.load_dialog_button);
        ImageView closeDialogButton = (ImageView) view
                .findViewById(R.id.close_dialog_button);
        mFilter = (EditText) view
                .findViewById(R.id.filter_options);
        mDialogLabel = (TextView) view
                .findViewById(R.id.dialog_label);
        InputMethodManager imm = (InputMethodManager)
                getActivity().getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.hideSoftInputFromWindow(mFilter.getWindowToken(), 0);

        mAdapter = new DataValueAdapter(getChildFragmentManager(), getActivity().getLayoutInflater());
        mListView.setAdapter(mAdapter);

        mFilter.addTextChangedListener(new AbsTextWatcher() {
            @Override
            public void afterTextChanged(Editable s) {
                mForm.setQueryString(s.toString());
            }
        });

        closeDialogButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });

        loadDialogButton.setOnClickListener(this);

        setDialogLabel(R.string.query_tracked_entity_instances);

    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        Bundle argumentsBundle = new Bundle();
        argumentsBundle.putBundle(EXTRA_ARGUMENTS, getArguments());
        argumentsBundle.putBundle(EXTRA_SAVED_INSTANCE_STATE, savedInstanceState);
        getLoaderManager().initLoader(LOADER_ID, argumentsBundle, this);
    }

    @Override
    public Loader<QueryTrackedEntityInstancesDialogFragmentForm> onCreateLoader(int id, Bundle args) {
        if (LOADER_ID == id && isAdded()) {
            // Adding Tables for tracking here is dangerous (since MetaData updates in background
            // can trigger reload of values from db which will reset all fields).
            // Hence, it would be more safe not to track any changes in any tables
            List<Class<? extends Model>> modelsToTrack = new ArrayList<>();
            Bundle fragmentArguments = args.getBundle(EXTRA_ARGUMENTS);
            String programId = fragmentArguments.getString(EXTRA_PROGRAM);
            String orgUnitId = fragmentArguments.getString(EXTRA_ORGUNIT);

            return new DbLoader<>(
                    getActivity().getBaseContext(), modelsToTrack, new QueryTrackedEntityInstancesDialogFragmentQuery(
                    orgUnitId, programId)
            );
        }
        return null;
    }

    @Override
    public void onLoadFinished(Loader<QueryTrackedEntityInstancesDialogFragmentForm> loader, QueryTrackedEntityInstancesDialogFragmentForm data) {

        Log.d(TAG, "load finished");
        if (loader.getId() == LOADER_ID && isAdded()) {
            mListView.setVisibility(View.VISIBLE);

            mForm = data;

            if (mForm.getDataEntryRows() != null) {
                //setEditableDataEntryRows(false);
                if (getArguments().getBoolean(EXTRA_DETAILED)) {
                    mAdapter.swapData(mForm.getDataEntryRows());
                }
            }
        }

    }

    @Override
    public void onLoaderReset(Loader<QueryTrackedEntityInstancesDialogFragmentForm> loader) {

    }

    @Subscribe
    public void onShowDetailedInfo(OnDetailedInfoButtonClick eventClick) // may re-use code from DataEntryFragment
    {
        String message = "";

        if (eventClick.getRow() instanceof CoordinatesRow)
            message = getResources().getString(R.string.detailed_info_coordinate_row);
        else if (eventClick.getRow() instanceof StatusRow)
            message = getResources().getString(R.string.detailed_info_status_row);
        else if (eventClick.getRow() instanceof IndicatorRow)
            message = ""; // need to change ProgramIndicator to extend BaseValue for this to work
        else         // rest of the rows can either be of data element or tracked entity instance attribute
            message = eventClick.getRow().getDescription();

        UiUtils.showConfirmDialog(getActivity(),
                getResources().getString(R.string.detailed_info_dataelement),
                message, getResources().getString(R.string.ok_option),
                new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int i) {
                        dialog.dismiss();
                    }
                });
    }

    public void toggleDetailedSearch(View v) {
        FloatingActionButton button = (FloatingActionButton) v;
        boolean current = getArguments().getBoolean(EXTRA_DETAILED);
        if (current) {
            button.setImageResource(R.drawable.ic_new);
            mAdapter.swapData(null);
        } else {
            button.setImageResource(R.drawable.ic_delete);
            mAdapter.swapData(mForm.getDataEntryRows());
        }
        getArguments().putBoolean(EXTRA_DETAILED, !current);
    }

    /* This method must be called only after onViewCreated() */
    public void setDialogLabel(int resourceId) {
        if (mDialogLabel != null) {
            mDialogLabel.setText(resourceId);
        }
    }

    /* This method must be called only after onViewCreated() */
    public void setDialogLabel(CharSequence sequence) {
        if (mDialogLabel != null) {
            mDialogLabel.setText(sequence);
        }
    }

    public void setDialogId(int dialogId) {
        mDialogId = dialogId;
    }

    public int getDialogId() {
        return mDialogId;
    }

    /* This method must be called only after onViewCreated() */
    public CharSequence getDialogLabel() {
        if (mDialogLabel != null) {
            return mDialogLabel.getText();
        } else {
            return null;
        }
    }

    public DataValueAdapter getAdapter() {
        return mAdapter;
    }

    public void show(FragmentManager fragmentManager) {
        show(fragmentManager, TAG);
    }

    @Override
    public void onClick(View v) {
        if (v.getId() == R.id.load_dialog_button) {
            dismiss();
            runQuery();
        } else if (v.getId() == org.hisp.dhis.android.trackercapture.R.id.detailed_search_button) {
            toggleDetailedSearch(v);
        }
    }

    public void runQuery() {
        final List<TrackedEntityAttributeValue> searchValues = new ArrayList<>();
        if (mForm != null && mForm.getTrackedEntityAttributeValues() != null &&
                mForm.getOrganisationUnit() != null && mForm.getProgram() != null) {
            for (TrackedEntityAttributeValue value : mForm.getTrackedEntityAttributeValues()) {
                searchValues.add(value);
            }
        }
        new Thread() {
            @Override
            public void run() {
                queryTrackedEntityInstances(getChildFragmentManager(),
                        mForm.getOrganisationUnit(), mForm.getProgram(),
                        mForm.getQueryString(), searchValues.toArray(new TrackedEntityAttributeValue[]{}));
            }
        }.start();
    }

    /**
     * Queries the server for TrackedEntityInstances and shows a Dialog containing the results
     *
     * @param orgUnit
     * @param program can be null
     * @param params  can be null
     */
    public void queryTrackedEntityInstances(final FragmentManager fragmentManager, final String orgUnit, final String program, final String queryString, final TrackedEntityAttributeValue... params)
            throws APIException {
        JobExecutor.enqueueJob(new NetworkJob<Object>(1,
                null) {

            @Override
            public Object execute() throws APIException {
                Dhis2Application.getEventBus().post(new UiEvent(UiEvent.UiEventType.SYNCING_START));
                List<TrackedEntityInstance> trackedEntityInstancesQueryResult = TrackerController.queryTrackedEntityInstancesDataFromServer(DhisController.getInstance().getDhisApi(), orgUnit, program, queryString, params);
                Dhis2Application.getEventBus().post(new UiEvent(UiEvent.UiEventType.SYNCING_END));
                showTrackedEntityInstanceQueryResultDialog(fragmentManager, trackedEntityInstancesQueryResult, orgUnit);
                return new Object();
            }
        });
    }

    public void showTrackedEntityInstanceQueryResultDialog(FragmentManager fragmentManager, final List<TrackedEntityInstance> trackedEntityInstances, final String orgUnit) {
        Handler handler = new Handler(Looper.getMainLooper());
        handler.post(new Runnable() {
            @Override
            public void run() {
                QueryTrackedEntityInstancesResultDialogFragment dialog = QueryTrackedEntityInstancesResultDialogFragment.newInstance(trackedEntityInstances, orgUnit);
                if (activity != null) {
                    dialog.show(activity.getSupportFragmentManager());

                }
            }
        });

    }

    @Override
    public void onAttach(Activity activity) {
        super.onAttach(activity);
        if(activity!=null) {
            if(activity instanceof FragmentActivity) {
                this.activity = (FragmentActivity) activity;

            }

        }
    }
}


text:
package org.apache.crunch.types.avro;

import java.util.Iterator;

import org.apache.avro.mapred.AvroKey;
import org.apache.avro.mapred.AvroValue;

import org.apache.crunch.Pair;
import org.apache.crunch.types.Converter;

public class AvroPairConverter<K, V> implements Converter<AvroKey<K>, AvroValue<V>, Pair<K, V>, Pair<K, Iterable<V>>> {

  private transient AvroKey<K> keyWrapper = null;
  private transient AvroValue<V> valueWrapper = null;

  @Override
  public Pair<K, V> convertInput(AvroKey<K> key, AvroValue<V> value) {
    return Pair.of(key.datum(), value.datum());
  }

  public Pair<K, Iterable<V>> convertIterableInput(AvroKey<K> key, Iterable<AvroValue<V>> iter) {
    Iterable<V> it = new AvroWrappedIterable<V>(iter);
    return Pair.of(key.datum(), it);
  }

  @Override
  public AvroKey<K> outputKey(Pair<K, V> value) {
    getKeyWrapper().datum(value.first());
    return keyWrapper;
  }

  @Override
  public AvroValue<V> outputValue(Pair<K, V> value) {
    getValueWrapper().datum(value.second());
    return valueWrapper;
  }

  @Override
  public Class<AvroKey<K>> getKeyClass() {
    return (Class<AvroKey<K>>) getKeyWrapper().getClass();
  }

  @Override
  public Class<AvroValue<V>> getValueClass() {
    return (Class<AvroValue<V>>) getValueWrapper().getClass();
  }

  private AvroKey<K> getKeyWrapper() {
    if (keyWrapper == null) {
      keyWrapper = new AvroKey<K>();
    }
    return keyWrapper;
  }

  private AvroValue<V> getValueWrapper() {
    if (valueWrapper == null) {
      valueWrapper = new AvroValue<V>();
    }
    return valueWrapper;
  }

  private static class AvroWrappedIterable<V> implements Iterable<V> {

    private final Iterable<AvroValue<V>> iters;

    public AvroWrappedIterable(Iterable<AvroValue<V>> iters) {
      this.iters = iters;
    }

    @Override
    public Iterator<V> iterator() {
      return new Iterator<V>() {
        private final Iterator<AvroValue<V>> it = iters.iterator();

        @Override
        public boolean hasNext() {
          return it.hasNext();
        }

        @Override
        public V next() {
          return it.next().datum();
        }

        @Override
        public void remove() {
          it.remove();
        }
      };
    }
  }
}


text:
import * as dat from "exdat";

export default class UI {
    constructor() {
        this.DatGui = new dat.GUI();
    }

    static updateDropdown(features, currentSelection) {
        features.sort();

        for (let feature of features) {
            if (feature === currentSelection.x) {
                $(".feature-x, .sort-by").append(`<option selected>${feature}</option>`);
            } else {
                $(".feature-x, .sort-by").append(`<option>${feature}</option>`);
            }

            if (feature === currentSelection.y) {
                $(".feature-y").append(`<option selected>${feature}</option>`);
            } else {
                $(".feature-y").append(`<option>${feature}</option>`);
            }
        }
    }

    static toggleFeatureDropdowns() {
        let chosenVisualization = $("select.visualization option:selected")[0].innerHTML;

        switch ($("select.visualization").val()) {
            case "barChart":
                $("select.feature-y").attr("disabled", true);
                $("select.feature-x").attr("disabled", false);
                break;

            case "scatterPlot":
                $("select.feature").attr("disabled", false);
                $("select.sort-by").attr("disabled", true);
                break;

            default:
                $("select.feature").attr("disabled", true);
                $("select.sort-by").attr("disabled", true);
                break;
        }
    }
}


text:
@implementation MMTextInputDelegateProxy

+ (instancetype)proxyForTextInput:(id<UITextInput>)textInput delegate:(id<UITextInputDelegate>)delegate
{
    NSParameterAssert(delegate);

    MMTextInputDelegateProxy *proxy = [[MMTextInputDelegateProxy alloc] init];
    proxy->_delegate = delegate;
    proxy->_previousTextInputDelegate = textInput.inputDelegate;

    return proxy;
}

#pragma mark - Forwarding.

- (NSArray *)delegates
{
    NSMutableArray *delegates = [NSMutableArray array];

    id <UITextInputDelegate> previousTextInputDelegate = self.previousTextInputDelegate;
    if (previousTextInputDelegate) {
        [delegates addObject:previousTextInputDelegate];
    }

    id <UITextInputDelegate> delegate = self.delegate;
    if (delegate) {
        [delegates addObject:delegate];
    }

    return [delegates copy];
}

- (BOOL)respondsToSelector:(SEL)aSelector
{
    if ([super respondsToSelector:aSelector]) {
        return YES;
    }

    for (id delegate in self.delegates) {
        if ([delegate respondsToSelector:aSelector]) {
            return YES;
        }
    }
    return NO;
}

- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector
{
    NSMethodSignature *signature = [super methodSignatureForSelector:aSelector];

    if (!signature) {
        for (id delegate in self.delegates) {
            if ([delegate respondsToSelector:aSelector]) {
                return [delegate methodSignatureForSelector:aSelector];
            }
        }
    }

    return signature;
}

- (void)forwardInvocation:(NSInvocation *)anInvocation
{
    for (id delegate in self.delegates) {
        if ([delegate respondsToSelector:anInvocation.selector]) {
            [anInvocation invokeWithTarget:delegate];
        }
    }
}

@end


text:
package ericminio.robot;

import org.junit.Ignore;
import org.junit.Test;

import java.awt.*;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;

@Ignore
public class GraphicsEnvironmentTest {

    @Test
    public void headlessFlag() {
        assertThat(GraphicsEnvironment.isHeadless(), equalTo(false));
    }

    @Test
    public void instance() {
        assertThat(GraphicsEnvironment.getLocalGraphicsEnvironment(), not(equalTo(null)));
    }

    @Test
    public void defaultDevice() {
        assertThat(GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice(), notNullValue());
    }

    @Test
    public void screen() {
        GraphicsDevice screenDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();

        assertThat(screenDevice.getType(), equalTo(GraphicsDevice.TYPE_RASTER_SCREEN));
    }

    @Test
    public void bounds() {
        GraphicsDevice screenDevice = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice();
        GraphicsConfiguration defaultConfiguration = screenDevice.getDefaultConfiguration();
        Rectangle bounds = defaultConfiguration.getBounds();

        assertThat(bounds.getX(), equalTo(0.0));
        assertThat(bounds.getY(), equalTo(0.0));
    }
}


text:
<?php

namespace App\Http\Requests;

class BanUserRequest extends Request
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'user_id'   => 'required|integer|exists:users,id',
            'until'     => 'date',
        ];
    }
}


text:
This is a memcached plugin for node-cache-manager.

See `example.js` for a usage example.

Note: because of memcached protocol limitations this does not support listing keys or changing TTL after an item is already created.


text:
/*************************************************************************/
/*  dialogs.cpp                                                          */
/*************************************************************************/
/*                       This file is part of:                           */
/*                           GODOT ENGINE                                */
/*                    http://www.godotengine.org                         */
/*************************************************************************/
/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur.                 */
/*                                                                       */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the       */
/* "Software"), to deal in the Software without restriction, including   */
/* without limitation the rights to use, copy, modify, merge, publish,   */
/* distribute, sublicense, and/or sell copies of the Software, and to    */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions:                                             */
/*                                                                       */
/* The above copyright notice and this permission notice shall be        */
/* included in all copies or substantial portions of the Software.       */
/*                                                                       */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,       */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF    */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY  */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                */
/*************************************************************************/
#include "dialogs.h"
#include "print_string.h"
#include "line_edit.h"
#include "translation.h"

void WindowDialog::_post_popup() {

	dragging=false; //just in case
}

bool WindowDialog::has_point(const Point2& p_point) const {

	int extra = get_constant("titlebar_height","WindowDialog");
	Rect2 r( Point2(), get_size() );
	r.pos.y-=extra;
	r.size.y+=extra;
	return r.has_point(p_point);

}

void WindowDialog::_input_event(const InputEvent& p_event) {

	if (p_event.type == InputEvent::MOUSE_BUTTON && p_event.mouse_button.button_index==BUTTON_LEFT) {

		if (p_event.mouse_button.pressed && p_event.mouse_button.y < 0)
			dragging=true;
		else if (dragging && !p_event.mouse_button.pressed)
			dragging=false;
	}

	if (p_event.type == InputEvent::MOUSE_MOTION && dragging) {

		Point2 rel( p_event.mouse_motion.relative_x, p_event.mouse_motion.relative_y );
		Point2 pos = get_pos();

		pos+=rel;

		if (pos.y<0)
			pos.y=0;

		set_pos(pos);
	}
}

void WindowDialog::_notification(int p_what) {

	switch(p_what) {

		case NOTIFICATION_DRAW: {

			RID ci = get_canvas_item();
			Size2 s = get_size();
			Ref<StyleBox> st = get_stylebox("panel","WindowDialog");
			st->draw(ci,Rect2(Point2(),s));
			int th = get_constant("title_height","WindowDialog");
			Color tc = get_color("title_color","WindowDialog");
			Ref<Font> font = get_font("title_font","WindowDialog");
			int ofs = (s.width-font->get_string_size(title).width)/2;
			//int ofs = st->get_margin(MARGIN_LEFT);
			draw_string(font,Point2(ofs,-th+font->get_ascent()),title,tc,s.width - st->get_minimum_size().width);

		} break;
		case NOTIFICATION_THEME_CHANGED:
		case NOTIFICATION_ENTER_TREE: {

			close_button->set_normal_texture( get_icon("close","WindowDialog"));
			close_button->set_pressed_texture( get_icon("close","WindowDialog"));
			close_button->set_hover_texture( get_icon("close_hilite","WindowDialog"));
			close_button->set_anchor(MARGIN_LEFT,ANCHOR_END);
			close_button->set_begin( Point2( get_constant("close_h_ofs","WindowDialog"), -get_constant("close_v_ofs","WindowDialog") ));

		} break;
	}

}

void WindowDialog::_closed() {

	_close_pressed();
	hide();
}

void WindowDialog::set_title(const String& p_title) {

	title=XL_MESSAGE(p_title);
	update();
}

Size2 WindowDialog::get_minimum_size() const {

	Ref<Font> font = get_font("title_font","WindowDialog");
	int msx=close_button->get_combined_minimum_size().x;
	msx+=font->get_string_size(title).x;

	return Size2(msx,1);
}

String WindowDialog::get_title() const {

	return title;
}

TextureButton *WindowDialog::get_close_button() {

	return close_button;
}

void WindowDialog::_bind_methods() {

	ObjectTypeDB::bind_method( _MD("_input_event"),&WindowDialog::_input_event);
	ObjectTypeDB::bind_method( _MD("set_title","title"),&WindowDialog::set_title);
	ObjectTypeDB::bind_method( _MD("get_title"),&WindowDialog::get_title);
	ObjectTypeDB::bind_method( _MD("_closed"),&WindowDialog::_closed);
	ObjectTypeDB::bind_method( _MD("get_close_button:TextureButton"),&WindowDialog::get_close_button);

	ADD_PROPERTY( PropertyInfo(Variant::STRING,"window/title",PROPERTY_HINT_NONE,"",PROPERTY_USAGE_DEFAULT_INTL),_SCS("set_title"),_SCS("get_title"));
}

WindowDialog::WindowDialog() {

	//title="Hello!";
	dragging=false;
	close_button = memnew( TextureButton );
	add_child(close_button);
	close_button->connect("pressed",this,"_closed");

}

WindowDialog::~WindowDialog(){

}

void PopupDialog::_notification(int p_what) {

	if (p_what==NOTIFICATION_DRAW) {

		RID ci = get_canvas_item();
		get_stylebox("panel","PopupMenu")->draw(ci,Rect2(Point2(),get_size()));
	}
}

PopupDialog::PopupDialog() {

}

PopupDialog::~PopupDialog() {

}

//

void AcceptDialog::_post_popup() {

	WindowDialog::_post_popup();
	get_ok()->grab_focus();

}

void AcceptDialog::_notification(int p_what) {

	if (p_what==NOTIFICATION_MODAL_CLOSE) {

		cancel_pressed();
	} if (p_what==NOTIFICATION_RESIZED) {

		_update_child_rect();
	}
}

void AcceptDialog::_builtin_text_entered(const String& p_text) {

	_ok_pressed();
}

void AcceptDialog::_ok_pressed() {

	if (hide_on_ok)
		hide();
	ok_pressed();
	emit_signal("confirmed");

}
void AcceptDialog::_close_pressed() {

	cancel_pressed();
}

String AcceptDialog::get_text() const {

	return label->get_text();
}
void AcceptDialog::set_text(String p_text) {

	label->set_text(p_text);
}

void AcceptDialog::set_hide_on_ok(bool p_hide) {

	hide_on_ok=p_hide;
}

bool AcceptDialog::get_hide_on_ok() const {

	return hide_on_ok;
}

void AcceptDialog::register_text_enter(Node *p_line_edit) {

	ERR_FAIL_NULL(p_line_edit);
	p_line_edit->connect("text_entered", this,"_builtin_text_entered");
}

void AcceptDialog::_update_child_rect() {

	int margin = get_constant("margin","Dialogs");
	Size2 size = get_size();
	Size2 hminsize = hbc->get_combined_minimum_size();

	Vector2 cpos(margin,margin);
	Vector2 csize(size.x-margin*2,size.y-margin*3-hminsize.y);
	label->set_pos(cpos);
	label->set_size(csize);

	if (child) {

		child->set_pos(cpos);
		child->set_size(csize);
	}

	cpos.y+=csize.y+margin;
	csize.y=hminsize.y;

	hbc->set_pos(cpos);
	hbc->set_size(csize);

}

Size2 AcceptDialog::get_minimum_size() const {

	int margin = get_constant("margin","Dialogs");
	Size2 minsize = label->get_combined_minimum_size();
	if (child) {

		Size2 cminsize = child->get_combined_minimum_size();
		minsize.x=MAX(cminsize.x,minsize.x);
		minsize.y=MAX(cminsize.y,minsize.y);
	}

	Size2 hminsize = hbc->get_combined_minimum_size();
	minsize.x = MAX(hminsize.x,minsize.x);
	minsize.y+=hminsize.y;
	minsize.x+=margin*2;
	minsize.y+=margin*3; //one as separation between hbc and child

	Size2 wmsize = WindowDialog::get_minimum_size();
	minsize.x=MAX(wmsize.x,minsize.x);
	return minsize;
}

void AcceptDialog::set_child_rect(Control *p_child) {

	ERR_FAIL_COND(p_child->get_parent()!=this);

	//p_child->set_area_as_parent_rect(get_constant("margin","Dialogs"));
	child=p_child;
	minimum_size_changed();
	_update_child_rect();
}

void AcceptDialog::remove_child_notify(Node *p_child) {

	if (p_child==child) {
		child=NULL;
	}
}

void AcceptDialog::_custom_action(const String& p_action) {

	emit_signal("custom_action",p_action);
	custom_action(p_action);
}

Button* AcceptDialog::add_button(const String& p_text,bool p_right,const String& p_action) {

	Button *button = memnew( Button );
	button->set_text(p_text);
	if (p_right) {
		hbc->add_child(button);
		hbc->add_spacer();
	} else {

		hbc->add_child(button);
		hbc->move_child(button,0);
		hbc->add_spacer(true);
	}

	if (p_action!="") {
		button->connect("pressed",this,"_custom_action",varray(p_action));
	}

	return button;
}

Button* AcceptDialog::add_cancel(const String &p_cancel) {

	String c = p_cancel;
	if (p_cancel=="")
		c=RTR("Cancel");
	Button *b = swap_ok_cancel ? add_button(c,true) : add_button(c);
	b->connect("pressed",this,"_closed");
	return b;
}

void AcceptDialog::_bind_methods() {

	ObjectTypeDB::bind_method(_MD("_ok"),&AcceptDialog::_ok_pressed);
	ObjectTypeDB::bind_method(_MD("get_ok"),&AcceptDialog::get_ok);
	ObjectTypeDB::bind_method(_MD("get_label"),&AcceptDialog::get_label);
	ObjectTypeDB::bind_method(_MD("set_hide_on_ok","enabled"),&AcceptDialog::set_hide_on_ok);
	ObjectTypeDB::bind_method(_MD("get_hide_on_ok"),&AcceptDialog::get_hide_on_ok);
	ObjectTypeDB::bind_method(_MD("add_button:Button","text","right","action"),&AcceptDialog::add_button,DEFVAL(false),DEFVAL(""));
	ObjectTypeDB::bind_method(_MD("add_cancel:Button","name"),&AcceptDialog::add_cancel);
	ObjectTypeDB::bind_method(_MD("_builtin_text_entered"),&AcceptDialog::_builtin_text_entered);
	ObjectTypeDB::bind_method(_MD("register_text_enter:LineEdit","line_edit"),&AcceptDialog::register_text_enter);
	ObjectTypeDB::bind_method(_MD("_custom_action"),&AcceptDialog::_custom_action);
	ObjectTypeDB::bind_method(_MD("set_text","text"),&AcceptDialog::set_text);
	ObjectTypeDB::bind_method(_MD("get_text"),&AcceptDialog::get_text);

	ADD_SIGNAL( MethodInfo("confirmed") );
	ADD_SIGNAL( MethodInfo("custom_action",PropertyInfo(Variant::STRING,"action")) );

	ADD_PROPERTYNZ( PropertyInfo(Variant::STRING,"dialog/text",PROPERTY_HINT_MULTILINE_TEXT,"",PROPERTY_USAGE_DEFAULT_INTL),_SCS("set_text"),_SCS("get_text"));
	ADD_PROPERTY( PropertyInfo(Variant::BOOL, "dialog/hide_on_ok"),_SCS("set_hide_on_ok"),_SCS("get_hide_on_ok") );

}

bool AcceptDialog::swap_ok_cancel=false;
void AcceptDialog::set_swap_ok_cancel(bool p_swap) {

	swap_ok_cancel=p_swap;
}

AcceptDialog::AcceptDialog() {

	int margin = get_constant("margin","Dialogs");
	int button_margin = get_constant("button_margin","Dialogs");

	label = memnew( Label );
	label->set_anchor(MARGIN_RIGHT,ANCHOR_END);
	label->set_anchor(MARGIN_BOTTOM,ANCHOR_END);
	label->set_begin( Point2( margin, margin) );
	label->set_end( Point2( margin, button_margin+10) );
	//label->set_autowrap(true);
	add_child(label);

	hbc = memnew( HBoxContainer );
	hbc->set_area_as_parent_rect(margin);
	hbc->set_anchor_and_margin(MARGIN_TOP,ANCHOR_END,button_margin);
	add_child(hbc);

	hbc->add_spacer();
	ok = memnew( Button );
	ok->set_text(RTR("OK"));
	hbc->add_child(ok);
	hbc->add_spacer();

	ok->connect("pressed", this,"_ok");
	set_as_toplevel(true);

	hide_on_ok=true;
	set_title(RTR("Alert!"));

	child=NULL;
}

AcceptDialog::~AcceptDialog()
{
}

void ConfirmationDialog::_bind_methods() {

	ObjectTypeDB::bind_method(_MD("get_cancel:Button"),&ConfirmationDialog::get_cancel);
}

Button *ConfirmationDialog::get_cancel() {

	return cancel;
}

ConfirmationDialog::ConfirmationDialog() {

	set_title(RTR("Please Confirm..."));
	cancel = add_cancel();
}


text:
Update one or more individual resources with the same metadata.

#### Arguments

1. `options` *(Object)*: An object that defines how to update the metadata. The
  options are as follows:

  * `resources` *(Array|Object)*: An array of the resources, or resource IDs, to update
  with the new meta.

  * `newMeta` *(Object)*: The meta to set on each of the resources.

  * `meta` *(Object)*: The current resource meta object from this resource's
    store slice. Optional when `mergeMeta` is `false`, required otherwise.

  * [`initialResourceMeta`] *(Object)*: Additional metadata to add to any resource
    that previously did not have meta.

  * [`mergeMeta`] *(Boolean)*: Whether or not to merge a resource's old metadata
    with the new metadata. Defaults to `true`.

#### Returns

(*`Object`*): The new resource meta object.

#### Example

```js
import { setResourceMeta } from 'redux-resource';
import actionTypes from './my-action-types';

export default function reducer(state, action) {
  switch (action.type) {
    case (actionTypes.SELECT_MANY_RESOURCES): {
      const meta = setResourceMeta({
        resources: action.resources,
        meta: state.meta,
        newMeta: {
          selected: true
        }
      });

      return {
        ...state,
        meta
      };
    }
  }
}
```

#### Tips

- This is used internally within the reducer returned by
  [`resourceReducer`](./resource-reducer.md) to update the resource meta in your
  state tree. You will typically only need to use this method if you're writing
  a [plugin](../other-guides/custom-action-types.md).


text:
title: OnEntryRemoved
page_title: OnEntryRemoved | RadDropDownTree for ASP.NET AJAX Documentation
description: OnEntryRemoved
slug: dropdowntree/server-side-programming/events/onentryremoved
tags: onentryremoved
published: True
position: 3
---

# OnEntryRemoved

##

The server-side **OnEntryRemoved** event occurs when an entry is removed from the entry area, causing a postback.

The event handler receives two parameters:

1. The instance of the **DropDownTree** firing the event

2. An event argument parameter that contains the following property:

	* **Entry** - returns the entry that has just being removed from the input.


text:
<?php
	include_once('conn.php');
	$data = json_decode(file_get_contents("php://input"));
	$token = $data->token;
	$sql = " UPDATE users SET remember_token = '' WHERE remember_token = ".$token." ";
    $query = mysqli_query($conn,$sql);
?>


text:
/*
 * TODO:
 *
 * 1) PROBE (CPU) TIME AS WELL
 *
 * 2) FAIL EARLIER WHEN "MAX-SIZE" IS EXCEEDED:
 *    - CURRENTLY NECESSARY IN:
 *      - fetchTextureData() WHEN CALLING PVRHelper::decompressGZ() OR PVRHelper::decompressCCZ
 *        - TRIVIAL: THE INFO LIES IN THE "PVR HEADER"
 *      - fetchTranslucentTextureData() AND fetchPowerOfTwoTextureData()
 *        - NON TRIVIAL:
 *          - CINDER'S IMAGE-IO PROTOCOL DOES NOT SEEM TO BE ADAPTED:
 *            - I.E. THERE SHOULD BE SOME USER-DEFINABLE CALLBACK, INVOKED AS-SOON-AS THE IMAGE-HEADER IS PARSED
 *              - OBVIOUSLY: MOST OF THE IMAGE-LOADING SOLUTIONS (E.G. stb_image) ALLOW TO "GUESS" IMAGE-SIZE BEFORE FULLY LOADING IT
 */

#pragma once

#include "chronotext/texture/Texture.h"
#include "chronotext/system/MemoryInfo.h"

namespace chr
{
    class TextureHelper
    {
    public:
        struct Record
        {
            int64_t memoryUsage;
            MemoryInfo memoryInfo[2];
        };

        static MemoryInfo memoryInfo[2];
        static std::map<ci::gl::Texture*, Record> records;

        // ---

        static Texture::Ref loadTexture(const Texture::Request &textureRequest);

        static ci::gl::Texture* loadTarget(const Texture::Request &textureRequest);
        static Texture::Data fetchTextureData(const Texture::Request &textureRequest);
        static ci::gl::Texture* uploadTextureData(const Texture::Data &textureData);

        static ci::Vec2i getTextureSize(const Texture::Data &textureData);
        static int64_t getTextureMemoryUsage(const Texture::Data &textureData);

    protected:
        static bool isOverSized(const Texture::Request &textureRequest, const ci::Vec2i &size);

        static Texture::Data fetchTranslucentTextureData(const Texture::Request &textureRequest);
        static Texture::Data fetchPowerOfTwoTextureData(const Texture::Request &textureRequest);
    };
}


text:
<?php

/*
 * This file is part of PHP CS Fixer.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *     Dariusz Rumiński <dariusz.ruminski@gmail.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace Symfony\CS\Fixer\Contrib;

use Symfony\CS\AbstractFixer;
use Symfony\CS\Tokenizer\Token;
use Symfony\CS\Tokenizer\Tokens;

/**
 * @author Gregor Harlan <gharlan@web.de>
 */
class LongArraySyntaxFixer extends AbstractFixer
{
    /**
     * {@inheritdoc}
     */
    public function fix(\SplFileInfo $file, $content)
    {
        $tokens = Tokens::fromCode($content);

        for ($index = $tokens->count() - 1; 0 <= $index; --$index) {
            if (!$tokens->isShortArray($index)) {
                continue;
            }

            $closeIndex = $tokens->findBlockEnd(Tokens::BLOCK_TYPE_SQUARE_BRACE, $index);

            $tokens->overrideAt($index, '(');
            $tokens->overrideAt($closeIndex, ')');

            $tokens->insertAt($index, new Token(array(T_ARRAY, 'array')));
        }

        return $tokens->generateCode();
    }

    /**
     * {@inheritdoc}
     */
    public function getDescription()
    {
        return 'Arrays should use the long syntax.';
    }
}


text:
#ifndef _LINUX_ALPHA_SYSDEP_H
#define _LINUX_ALPHA_SYSDEP_H 1

#ifdef __ASSEMBLER__
#include <asm/pal.h>
#include <alpha/regdef.h>
#endif

/* There is some commonality.  */
#include <sysdeps/unix/alpha/sysdep.h>

#include <tls.h>

/* For Linux we can use the system call table in the header file
	/usr/include/asm/unistd.h
   of the kernel.  But these symbols do not follow the SYS_* syntax
   so we have to redefine the `SYS_ify' macro here.  */
#undef SYS_ify
#ifdef __STDC__
# define SYS_ify(syscall_name)	__NR_##syscall_name
#else
# define SYS_ify(syscall_name)	__NR_/**/syscall_name
#endif

/* Define some aliases to make automatic syscall generation work
   properly.  The SYS_* variants are for the benefit of the files in
   sysdeps/unix.  */
#define __NR_getpid	__NR_getxpid
#define __NR_getuid	__NR_getxuid
#define __NR_getgid	__NR_getxgid
#define SYS_getpid	__NR_getxpid
#define SYS_getuid	__NR_getxuid
#define SYS_getgid	__NR_getxgid

/*
 * Some syscalls no Linux program should know about:
 */
#define __NR_osf_sigprocmask	 48
#define __NR_osf_shmat		209
#define __NR_osf_getsysinfo	256
#define __NR_osf_setsysinfo	257

/* Help old kernel headers where particular syscalls are not available.  */
#ifndef __NR_semtimedop
# define __NR_semtimedop	423
#endif

/* This is a kludge to make syscalls.list find these under the names
   pread and pwrite, since some kernel headers define those names
   and some define the *64 names for the same system calls.  */
#if !defined __NR_pread && defined __NR_pread64
# define __NR_pread __NR_pread64
#endif
#if !defined __NR_pwrite && defined __NR_pwrite64
# define __NR_pwrite __NR_pwrite64
#endif

/*
 * In order to get the hidden arguments for rt_sigaction set up
 * properly, we need to call the assembly version.  This shouldn't
 * happen except for inside sigaction.c, where we handle this
 * specially.  Catch other uses and error.
 */

#undef INLINE_SYSCALL
#define INLINE_SYSCALL(name, nr, args...)				\
({									\
	extern char ChEcK[__NR_##name == __NR_rt_sigaction ? -1 : 1]	\
	  __attribute__((unused));					\
	INLINE_SYSCALL1(name, nr, args);				\
})

#undef INTERNAL_SYSCALL
#define INTERNAL_SYSCALL(name, err_out, nr, args...)			\
({									\
	extern char ChEcK[__NR_##name == __NR_rt_sigaction ? -1 : 1]	\
	  __attribute__((unused));					\
	INTERNAL_SYSCALL1(name, err_out, nr, args);			\
})

#endif /* _LINUX_ALPHA_SYSDEP_H */


text:
package jwk

import (
	"net/http"

	"github.com/lestrrat-go/jwx/internal/option"
)

type Option = option.Interface

const (
	optkeyHTTPClient = `http-client`
)

type HTTPClient interface {
	Get(string) (*http.Response, error)
}

func WithHTTPClient(cl HTTPClient) Option {
	return option.New(optkeyHTTPClient, cl)
}


text:
'use strict';

const webdriver = require('./lib');

chrome.runtime.onInstalled.addListener(function (details) {
  console.log('previousVersion', details.previousVersion);
});

chrome.browserAction.onClicked.addListener(runSpecs);

function runSpecs() {
  chrome.tabs.create({
    url: chrome.extension.getURL('test/index.html')
  });
}


text:
<!DOCTYPE html>

    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="theme-color" content="#92C7BC" />

    <title>Amy Rogers</title>

    <link href="css/bootstrap.min.css" rel="stylesheet">

    <link href="css/parallax.css" rel="stylesheet">
    <link href="css/landing-page.css" rel="stylesheet">

    <link href="font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css">

      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        Toggle navigation

      </button>

About

          Experience

UX Internship

Warwick University

          Projects

Homepage Configurator

Final Year Project

Coursework

Gallery

About Me

Hello! I'm Amy, a fresh Computer Science graduate turned user experience enthusiast. I love creating experiences that users not only find easy, but also enjoy and remember. I am skilled at all aspects of designing a system from start to finish, and use my abilities to take products from humble beginnings to powerful endings.

I was given my first computer when I was four, and I've been painting and drawing for as long as I can remember. I've always been interested in both science and art, and my passion is to do things that involve both.

If you want to know more, feel free to contact me!

        <button class="btn btn-primary btn-lg btn-padding"> Download CV as PDF</button>
        <button class="btn btn-primary btn-lg btn-padding"> Download CV as Word</button>

 Education

Warwick University

October 2012-July 2016

Bachelor's Degree in Computer Science

The degree material covered a variety of theories and practices. I particularly enjoyed the more practical courses, and my final year project.

The Hong Kong University of Science and Technology

September 2014-June 2015

Intercalated Year

As part of my Bachelor's, I spent a year in a forgein university's Computer Science department. Here, I predominantly took courses out of my discipline. I learnt about the fundamentals of electronics, game programming techniques, and a variety of web-based technologies.

Haybridge High School and Sixth Form

September 2006-July 2012

GCSEs and A-Levels

During high school, I found an interest in maths, science, art, and graphic design. I achieved 8 A* and 4 A grade GCSEs. I also achieved A levels in Maths, Further Maths, Physics, Chemistry, and Art and Design.

 Experience

Warwick University

June 2015-August 2015

UX Internship

I worked for 8 weeks within Warwick IT Services. I worked on a large variety of tasks, from Photoshop to copywriting. The main focus of the internship was an evaluation of the university's academic administration system.

Warwick University

September 2015-September 2016

UX Designer and Developer

Continuing on from my internship, I worked part-time during my degree. My roles included designing and implementing changes to our customer's websites, and contributing to the redesign of university systems.

Copyright © Amy Rogers 2016. All Rights Reserved


text:
using System;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.Text;
using Xunit;

public static class Tcp_ClientCredentialTypeTests
{
    // Simple echo of a string using NetTcpBinding on both client and server with all default settings.
    // Default settings are:
    //                         - SecurityMode = Transport
    //                         - ClientCredentialType = Windows
    [Fact]
    [ActiveIssue(300)]
    [OuterLoop]
    public static void SameBinding_DefaultSettings_EchoString()
    {
        string testString = "Hello";
        ChannelFactory<IWcfService> factory = null;

        try
        {
            NetTcpBinding binding = new NetTcpBinding();

            factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.Tcp_DefaultBinding_Address));
            IWcfService serviceProxy = factory.CreateChannel();

            string result = serviceProxy.Echo(testString);
            Assert.Equal(testString, result);

            factory.Close();
        }
        finally
        {
            ScenarioTestHelpers.CloseCommunicationObjects(factory);
        }
    }

    // Simple echo of a string using NetTcpBinding on both client and server with SecurityMode=None
    [Fact]
    [OuterLoop]
    public static void SameBinding_SecurityModeNone_EchoString()
    {
        string testString = "Hello";
        ChannelFactory<IWcfService> factory = null;

        try
        {
            NetTcpBinding binding = new NetTcpBinding(SecurityMode.None);
            factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.Tcp_NoSecurity_Address));
            IWcfService serviceProxy = factory.CreateChannel();

            string result = serviceProxy.Echo(testString);
            Assert.Equal(testString, result);

            factory.Close();
        }
        finally
        {
            ScenarioTestHelpers.CloseCommunicationObjects(factory);
        }
    }

    // Simple echo of a string using NetTcpBinding on both client and server with SecurityMode=Transport
    // By default ClientCredentialType will be 'Windows'
    [Fact]
    [ActiveIssue(300)]
    [OuterLoop]
    public static void SameBinding_SecurityModeTransport_EchoString()
    {
        string testString = "Hello";
        ChannelFactory<IWcfService> factory = null;

        try
        {
            NetTcpBinding binding = new NetTcpBinding(SecurityMode.Transport);
            factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.Tcp_NoSecurity_Address));
            IWcfService serviceProxy = factory.CreateChannel();

            string result = serviceProxy.Echo(testString);
            Assert.Equal(testString, result);

            factory.Close();
        }
        finally
        {
            ScenarioTestHelpers.CloseCommunicationObjects(factory);
        }
    }

    // Simple echo of a string using a CustomBinding to mimic a NetTcpBinding with Security.Mode = TransportWithMessageCredentials
    // This does not exactly match the binding elements in a NetTcpBinding which also includes a TransportSecurityBindingElement
    [Fact]
    [ActiveIssue(310)]
    [OuterLoop]
    public static void SameBinding_SecurityModeTransport_ClientCredentialTypeCertificate_EchoString()
    {
        string testString = "Hello";
        ChannelFactory<IWcfService> factory = null;

        try
        {
            CustomBinding binding = new CustomBinding(
                new SslStreamSecurityBindingElement(), // This is the binding element used when Security.Mode  = TransportWithMessageCredentials
                new BinaryMessageEncodingBindingElement(),
                new TcpTransportBindingElement());

            factory = new ChannelFactory<IWcfService>(binding, new EndpointAddress(Endpoints.Tcp_CustomBinding_SslStreamSecurity_Address));

            IWcfService serviceProxy = factory.CreateChannel();

            string result = serviceProxy.Echo(testString);
            Assert.Equal(testString, result);

            factory.Close();
        }
        finally
        {
            ScenarioTestHelpers.CloseCommunicationObjects(factory);
        }
    }
}


text:
(function(){
	'use strict';

	/**
	* FUNCTION: unmarshal( data )
	*	Unmarshals TCP transmitted boolean data.
	*
	* @param {String} data - streamed data
	*/
	function unmarshal( data ) {
		if ( data === '1' ) {
			return true;
		}
		return false;
	} // end FUNCTION unmarshal()

	// EXPORTS //

	module.exports = unmarshal;

})();


text:
package com.twitter.finagle.mux

import com.twitter.conversions.time._
import com.twitter.finagle.context.Contexts
import com.twitter.finagle.mux.exp.FailureDetector
import com.twitter.finagle.netty3.{BufChannelBuffer, ChannelBufferBuf}
import com.twitter.finagle.stats.StatsReceiver
import com.twitter.finagle.tracing.Trace
import com.twitter.finagle.transport.Transport
import com.twitter.finagle.util.DefaultTimer
import com.twitter.finagle.{Dtab, Failure, NoStacktrace, Service, Status, WriteException}
import com.twitter.util.{Duration, Future, Promise, Return, Throw, Time, Try, Updatable}

import java.util.concurrent.atomic.AtomicReference
import java.util.concurrent.locks.ReentrantReadWriteLock
import java.util.logging.{Level, Logger}
import org.jboss.netty.buffer.{ChannelBuffer, ReadOnlyChannelBuffer}

/**
 * Indicates that the server failed to interpret or act on the request. This
 * could mean that the client sent a [[com.twitter.finagle.mux]] message type
 * that the server is unable to process.
 */
case class ServerError(what: String)
  extends Exception(what)
  with NoStacktrace

/**
 * Indicates that the server encountered an error whilst processing the client's
 * request. In contrast to [[com.twitter.finagle.mux.ServerError]], a
 * ServerApplicationError relates to server application failure rather than
 * failure to interpret the request.
 */
case class ServerApplicationError(what: String)
  extends Exception(what)
  with NoStacktrace

private object Cap extends Enumeration {
  type State = Value
  val Unknown, Yes, No = Value
}

private[twitter] object ClientDispatcher {

  /**
   * The client dispatcher can be in one of 4 states,
   * independent from its transport.
   *
   *  - [[Dispatching]] is the stable operating state of a Dispatcher.
   *    Requests are dispatched, and the dispatcher's status is
   *    [[com.twitter.finagle.Status.Open]].
   *  - A dispatcher is [[Draining]] when it has received a `Tdrain`
   *    message from its peer, but still has outstanding requests.
   *    In this state, we have promised our peer not to send any more
   *    requests, thus the dispatcher's status is
   *    [[com.twitter.finagle.Status.Busy]], and requests for service are
   *    denied.
   *  - When a dispatcher is fully drained; that is, it has received a
   *    `Tdrain` and there are no more pending requests, the dispatcher's
   *    state is set to [[Drained]]. In this state, no more requests are
   *    admitted, and they never will be. The dispatcher is useless. It is
   *    dead. Its status is set to [[com.twitter.finagle.Status.Closed]].
   *  - Finally, if a server has issued the client a lease, its state is
   *    set to [[Leasing]] which composes the lease expiry time. This state
   *    is equivalent to [[Dispatching]] except if the lease has expired.
   *    At this time, the dispatcher's status is set to
   *    [[com.twitter.finagle.Status.Busy]]; however, leases are advisory
   *    and requests are still admitted.
   */
  sealed trait State
  case object Dispatching extends State
  case object Draining extends State
  case object Drained extends State
  case class Leasing(end: Time) extends State {
    def remaining: Duration = end.sinceNow
    def expired: Boolean = end < Time.now
  }

  // We reserve a tag for a default ping message to that we
  // can cache a full ping message and avoid encoding it
  // every time.
  val PingTag = Message.MinTag
  val MinTag = PingTag+1
  val MaxTag = Message.MaxTag

  val NackFailure = Failure.rejected("The request was Nacked by the server")

  val Empty: Updatable[Try[Response]] = Updatable.empty()
}

/**
 * A ClientDispatcher for the mux protocol.
 */
private[twitter] class ClientDispatcher (
  name: String,
  trans: Transport[ChannelBuffer, ChannelBuffer],
  sr: StatsReceiver,
  failureDetectorConfig: FailureDetector.Config
) extends Service[Request, Response] {
  import ClientDispatcher._
  import Message.{MaxTag => _, MinTag => _, _}

  private[this] implicit val timer = DefaultTimer.twitter
  // Maintain the dispatcher's state, whose access is mediated
  // by the readLk and writeLk.
  @volatile private[this] var state: State = Dispatching
  private[this] val (readLk, writeLk) = {
    val lk = new ReentrantReadWriteLock
    (lk.readLock, lk.writeLock)
  }

  @volatile private[this] var canDispatch: Cap.State = Cap.Unknown

  private[this] val futureNackedException = Future.exception(NackFailure)

  // We pre-encode a ping message with the reserved ping tag
  // (PingTag) in order to avoid re-encoding this frequently sent
  // message. Since it uses ChannelBuffers, it maintains a read
  // cursor, and thus it is important that it is not used
  // concurrently. This happens to agree with the natural way you'd
  // use it, since a client can only have one outstanding ping per
  // tag.
  private[this] val pingMessage = {
    val buf = new ReadOnlyChannelBuffer(encode(Tping(PingTag)))
    buf.markReaderIndex()
    buf
  }
  private[this] val pingPromise = new AtomicReference[Promise[Unit]](null)

  private[this] val tags = TagSet(MinTag to MaxTag)
  private[this] val reqs = TagMap[Updatable[Try[Response]]](tags)
  private[this] val log = Logger.getLogger(getClass.getName)

  private[this] val gauge = sr.addGauge("current_lease_ms") {
    state match {
      case l: Leasing => l.remaining.inMilliseconds
      case _ => (Time.Top - Time.now).inMilliseconds
    }
  }
  private[this] val leaseCounter = sr.counter("leased")
  private[this] val drainingCounter = sr.counter("draining")
  private[this] val drainedCounter = sr.counter("drained")

  // We're extra paranoid about logging. The log handler is,
  // after all, outside of our control.
  private[this] def safeLog(msg: String, level: Level = Level.INFO): Unit =
    try {
      log.log(level, msg)
    } catch {
      case _: Throwable =>
    }

  private[this] def releaseTag(tag: Int): Option[Updatable[Try[Response]]] =
    reqs.unmap(tag) match {
      case None => None
      case some =>
        readLk.lock()
        if (state == Draining && tags.isEmpty) {
          drainedCounter.incr()
          safeLog(s"Finished draining a connection to $name", Level.FINE)
          readLk.unlock()

          writeLk.lock()
          state = Drained
          writeLk.unlock()
        } else {
          readLk.unlock()
        }

        if (some eq Empty) None else some
    }

  private[this] val receive: Message => Unit = {
    case RreqOk(tag, rep) =>
      for (p <- releaseTag(tag))
        p() = Return(Response(ChannelBufferBuf.Owned(rep)))
    case RreqError(tag, error) =>
      for (p <- releaseTag(tag))
        p() = Throw(ServerApplicationError(error))
    case RreqNack(tag) =>
      for (p <- releaseTag(tag))
        p() = Throw(NackFailure)

    case RdispatchOk(tag, _, rep) =>
      for (p <- releaseTag(tag))
        p() = Return(Response(ChannelBufferBuf.Owned(rep)))
    case RdispatchError(tag, _, error) =>
      for (p <- releaseTag(tag))
        p() = Throw(ServerApplicationError(error))
    case RdispatchNack(tag, _) =>
      for (p <- releaseTag(tag))
        p() = Throw(NackFailure)

    case Rerr(tag, error) =>
      for (p <- releaseTag(tag))
        p() = Throw(ServerError(error))

    case Rping(PingTag) =>
      val p = pingPromise.getAndSet(null)
      if (p != null)
        p.setDone()

    case Rping(tag) =>
      for (p <- releaseTag(tag))
        p() = Return(Response.empty)
    case Tping(tag) =>
      trans.write(encode(Rping(tag)))
    case Tdrain(tag) =>
      safeLog(s"Started draining a connection to $name", Level.FINE)
      drainingCounter.incr()
      // must be synchronized to avoid writing after Rdrain has been sent
      writeLk.lockInterruptibly()
      try {
        state = if (tags.nonEmpty) Draining else {
          safeLog(s"Finished draining a connection to $name", Level.FINE)
          drainedCounter.incr()
          Drained
        }
        trans.write(encode(Rdrain(tag)))
      } finally {
        writeLk.unlock()
      }

    case Tlease(Message.Tlease.MillisDuration, millis) =>
      writeLk.lock()

      try {
        state match {
          case Leasing(_) | Dispatching =>
            state = Leasing(Time.now + millis.milliseconds)
            log.fine(s"leased for ${millis.milliseconds} to ${trans.remoteAddress}")
            leaseCounter.incr()
         case Drained | Draining =>
           // Ignore the lease if we're in the process of draining, since
           // these are anyway irrecoverable states.
       }
     } finally {
       writeLk.unlock()
     }

    // Ignore lease types we don't understand. (They are advisory.)
    case Tlease(_, _) =>

    case m@Tmessage(tag) =>
      log.warning("Did not understand Tmessage[tag=%d] %s".format(tag, m))
      trans.write(encode(Rerr(tag, "badmessage")))
    case m@Rmessage(tag) =>
      val what = "Did not understand Rmessage[tag=%d] %s".format(tag, m)
      log.warning(what)
      for (p <- releaseTag(tag))
        p() = Throw(BadMessageException(what))
  }

  private[this] val readAndAct: ChannelBuffer => Future[Nothing] =
    buf => try {
      val m = decode(buf)
      receive(m)
      loop()
    } catch {
      case exc: BadMessageException =>
        Future.exception(exc)
    }

  private[this] def loop(): Future[Nothing] =
    trans.read() flatMap readAndAct

  loop() onFailure { case exc =>
    trans.close()
    val result = Throw(exc)
    for (tag <- tags) {
      /*
       * unmap the `tag` here to prevent the associated promise from
       * being fetched from the tag map again, and setting a value twice.
       */
      for (p <- reqs.unmap(tag)) p() = result
    }
  }

  def ping(): Future[Unit] = {
    val done = new Promise[Unit]
    if (pingPromise.compareAndSet(null, done)) {
      pingMessage.resetReaderIndex()
      // Note that we ignore any errors here. In practice this is fine
      // as (1) this will only happen when the session has anyway
      // died; (2) subsequent pings will use freshly allocated tags.
      trans.write(pingMessage) before done
    } else {
      val p = new Promise[Response]
      reqs.map(p) match {
        case None =>
          Future.exception(WriteException(new Exception("Exhausted tags")))
        case Some(tag) =>
          trans.write(encode(Tping(tag))) transform {
            case Return(()) =>
              p.unit
            case t@Throw(_) =>
              releaseTag(tag)
              Future.const(t)

          }
      }
    }
  }

  def apply(req: Request): Future[Response] = {
    readLk.lock()
    try state match {
      case Dispatching | Leasing(_) => dispatch(req)
      case Draining | Drained => futureNackedException
    } finally readLk.unlock()
  }

  /**
   * Dispatch a request.
   *
   * @param req the buffer representation of the request to be dispatched
   */
  private def dispatch(req: Request): Future[Response] = {
    val p = new Promise[Response]
    val couldDispatch = canDispatch

    val tag = reqs.map(p) getOrElse {
      return Future.exception(WriteException(new Exception("Exhausted tags")))
    }

    val msg =
      if (couldDispatch == Cap.No)
        Treq(tag, Some(Trace.id), BufChannelBuffer(req.body))
      else {
        val contexts = Contexts.broadcast.marshal() map { case (k, v) =>
          (BufChannelBuffer(k), BufChannelBuffer(v))
        }
        Tdispatch(tag, contexts.toSeq, req.destination, Dtab.local,
          BufChannelBuffer(req.body))
      }

    trans.write(encode(msg)) onFailure { case exc =>
      releaseTag(tag)
    } before {
      p.setInterruptHandler { case cause =>
        // We replace the current Updatable, if any, with a stand-in to reserve
        // the tag of discarded requests until Tdiscarded is acknowledged by the
        // peer.
        for (reqP <- reqs.maybeRemap(tag, Empty)) {
          trans.write(encode(Tdiscarded(tag, cause.toString)))
          reqP() = Throw(cause)
        }
      }
      p
    }

    if (couldDispatch == Cap.Unknown) {
      p onSuccess { _ =>
        canDispatch = Cap.Yes
      } rescue {
        case ServerError(_) =>
          // We've determined that the server cannot handle Tdispatch messages,
          // so we fall back to a Treq and disable tracing in order to not
          // double-count the request.
          canDispatch = Cap.No
          dispatch(req)
      }
    } else p
  }

  private[this] val detector = {
    val close = () => trans.close(Time.now)
    val dsr = sr.scope("failuredetector")
    FailureDetector(failureDetectorConfig, ping, close, dsr)
  }

  override def status: Status =
    Status.worst(detector.status,
      trans.status match {
        case Status.Closed => Status.Closed
        case Status.Busy => Status.Busy
        case Status.Open =>
          readLk.lock()
          try state match {
            case Draining => Status.Busy
            case Drained => Status.Closed
            case leased@Leasing(_) if leased.expired => Status.Busy
            case Leasing(_) | Dispatching => Status.Open
          } finally readLk.unlock()
      }
    )

  override def close(deadline: Time): Future[Unit] = trans.close(deadline)
}


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

<title>Index</title>
<meta name="date" content="2014-02-08">
<link rel="stylesheet" type="text/css" href="./stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Package

Class

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes

A C D E F G I J L P R S T V

A

AdventureRick - Class in edu.wpi.first.wpilibj.paradigm

The VM is configured to automatically run this class, and to call the
 functions corresponding to each mode, as described in the
 IterativeAdventureRick documentation.

AdventureRick() - Constructor for class edu.wpi.first.wpilibj.paradigm.AdventureRick

autonomousPeriodic() - Method in class edu.wpi.first.wpilibj.paradigm.AdventureRick

This function is called periodically (every 20-25 ms) during autonomous

C

calibrate() - Method in class edu.wpi.first.wpilibj.paradigm.Shooter

checkToKick() - Method in class edu.wpi.first.wpilibj.paradigm.Shooter

compareEncoders() - Method in class edu.wpi.first.wpilibj.paradigm.DriveTrain

D

DriverControls - Class in edu.wpi.first.wpilibj.paradigm

DriverControls() - Constructor for class edu.wpi.first.wpilibj.paradigm.DriverControls

DriveTrain - Class in edu.wpi.first.wpilibj.paradigm

DriveTrain(DriverControls) - Constructor for class edu.wpi.first.wpilibj.paradigm.DriveTrain

E

edu.wpi.first.wpilibj.paradigm - package edu.wpi.first.wpilibj.paradigm

F

fix(double) - Method in class edu.wpi.first.wpilibj.paradigm.DriveTrain

G

getKickerAngle() - Method in class edu.wpi.first.wpilibj.paradigm.Shooter

I

isKickerStopped() - Method in class edu.wpi.first.wpilibj.paradigm.Shooter

J

joystickTriggerPressed() - Method in class edu.wpi.first.wpilibj.paradigm.DriverControls

joystickTriggerPressedAgain() - Method in class edu.wpi.first.wpilibj.paradigm.DriverControls

joystickX() - Method in class edu.wpi.first.wpilibj.paradigm.DriverControls

joystickY() - Method in class edu.wpi.first.wpilibj.paradigm.DriverControls

joystickZ() - Method in class edu.wpi.first.wpilibj.paradigm.DriverControls

L

LeftMotor() - Method in class edu.wpi.first.wpilibj.paradigm.DriveTrain

P

Picker - Class in edu.wpi.first.wpilibj.paradigm

Picker(DriverControls) - Constructor for class edu.wpi.first.wpilibj.paradigm.Picker

R

RightMotor() - Method in class edu.wpi.first.wpilibj.paradigm.DriveTrain

robotInit() - Method in class edu.wpi.first.wpilibj.paradigm.AdventureRick

Initializes when the robot first starts, (only once at power-up).

S

setKickingPosition() - Method in class edu.wpi.first.wpilibj.paradigm.Shooter

setPower() - Method in class edu.wpi.first.wpilibj.paradigm.DriveTrain

shift() - Method in class edu.wpi.first.wpilibj.paradigm.DriveTrain

shifter() - Method in class edu.wpi.first.wpilibj.paradigm.DriverControls

shiftHigh() - Method in class edu.wpi.first.wpilibj.paradigm.DriverControls

shiftHigh() - Method in class edu.wpi.first.wpilibj.paradigm.DriveTrain

shiftLow() - Method in class edu.wpi.first.wpilibj.paradigm.DriverControls

shiftLow() - Method in class edu.wpi.first.wpilibj.paradigm.DriveTrain

Shooter - Class in edu.wpi.first.wpilibj.paradigm

Shooter(DriverControls) - Constructor for class edu.wpi.first.wpilibj.paradigm.Shooter

spinGrabber() - Method in class edu.wpi.first.wpilibj.paradigm.Picker

spinPooter() - Method in class edu.wpi.first.wpilibj.paradigm.Picker

T

teleopPeriodic() - Method in class edu.wpi.first.wpilibj.paradigm.AdventureRick

This function is called periodically during operator control

testPeriodic() - Method in class edu.wpi.first.wpilibj.paradigm.AdventureRick

f
 This function is called periodically during test mode

V

Vision - Class in edu.wpi.first.wpilibj.paradigm

Vision() - Constructor for class edu.wpi.first.wpilibj.paradigm.Vision

A C D E F G I J L P R S T V

Package

Class

Tree

Deprecated

Index

Help

Prev

Next

Frames

No Frames

All Classes


text:
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @fileoverview A helper object used from the languages section
 * to interact with the browser.
 */

// clang-format off
import {sendWithPromise} from 'chrome://resources/js/cr.m.js';
// clang-format on

/** @interface */
export class LanguagesBrowserProxy {
  /**
   * Sets the prospective UI language to the chosen language. This won't
   * affect the actual UI language until a restart.
   * @param {string} languageCode
   */
  setProspectiveUILanguage(languageCode) {}

  /** @return {!Promise<string>} */
  getProspectiveUILanguage() {}

  /** @return {!LanguageSettingsPrivate} */
  getLanguageSettingsPrivate() {}

  /** @return {!InputMethodPrivate} */
  getInputMethodPrivate() {}
}

/**
 * @implements {LanguagesBrowserProxy}
 */
export class LanguagesBrowserProxyImpl {
  /** @override */
  setProspectiveUILanguage(languageCode) {
    chrome.send('setProspectiveUILanguage', [languageCode]);
  }

  /** @override */
  getProspectiveUILanguage() {
    return sendWithPromise('getProspectiveUILanguage');
  }

  /** @override */
  getLanguageSettingsPrivate() {
    return /** @type {!LanguageSettingsPrivate} */ (
        chrome.languageSettingsPrivate);
  }

  /** @override */
  getInputMethodPrivate() {
    return /** @type {!InputMethodPrivate} */ (chrome.inputMethodPrivate);
  }

  /** @return {!LanguagesBrowserProxy} */
  static getInstance() {
    return instance || (instance = new LanguagesBrowserProxyImpl());
  }

  /** @param {!LanguagesBrowserProxy} obj */
  static setInstance(obj) {
    instance = obj;
  }
}

/** @type {?LanguagesBrowserProxy} */
let instance = null;