text:
Int_t AddRsnDaughterCutsKStarNsigma_Syst(AliPID::EParticleType type1,AliPID::EParticleType type2,TString opt,Bool_t isRsnMini=kFALSE,AliRsnInputHandler *rsnIH=0,AliAnalysisTaskSE *task=0)
{

   if (!rsnIH) return 0;

   Bool_t valid = kTRUE;
   Int_t isRsnMini = AliRsnTrainManager::GetGlobalInt("IsRsnMini",valid);
   Int_t collisionType = AliRsnTrainManager::GetGlobalInt("IsCollisionType",valid);
   Int_t isPP = AliAnalysisManager::GetGlobalInt("rsnIsPP",valid);
   Int_t useCommonQualityCut = AliAnalysisManager::GetGlobalInt("rsnCommonQualityCut",valid);
   Int_t isMixing = AliRsnTrainManager::GetGlobalInt("IsMixing",valid);

   Bool_t usePPCut = kFALSE;

   if (isPP && (opt.Contains("usePP"))) usePPCut = kTRUE;

   // === USER HAS TO SET CORRECT NUMBER OF CUTS SETS =====
   Int_t numberOfCuts = 2;

   //---------------------------------------------
   //  Define single cutsP
   //---------------------------------------------

   Printf("AddRsnDaughterCutsKStarNsigma_Syst Option : %s",opt.Data());

   // default values
   Double_t nSigmaTPC_Pi=3.0;
   Double_t nSigmaTPC_K=3.0;
   Double_t nSigmaTOF_Pi=3.0;
   Double_t nSigmaTOF_K=3.0;
   Double_t etaRange=0.8;

   //Use single track Pt Cuts
   Double_t trackPtMin = 0.15;
   Double_t trackPtMax = 1.e20;
   Bool_t useTrackPtCut = kTRUE;

   if(opt.Contains("minPt02")) trackPtMin=0.2;
   if(opt.Contains("minPt03")) trackPtMin=0.3;
   if(opt.Contains("minPt04")) trackPtMin=0.4;
   if(opt.Contains("minPt05")) trackPtMin=0.5;
   if(opt.Contains("minPt06")) trackPtMin=0.6;
   if(opt.Contains("minPt10")) trackPtMin=1.0;
   if(opt.Contains("minPt15")) trackPtMin=1.5;

   //Use min TPC cluster Cut
   Int_t minclsK,maxclsK;
   Int_t minclsPi,maxclsPi;

   Bool_t useTPC_Pi=kFALSE;
   Bool_t useTOF_Pi=kFALSE;
   Bool_t useTPC_K=kFALSE;
   Bool_t useTOF_K=kFALSE;

   if (opt.Contains("qualityonly")) {
      useTPC_Pi=kFALSE;
      useTOF_Pi=kFALSE;
      useTPC_K=kFALSE;
      useTOF_K=kFALSE;
   } else if (!opt.Contains("nsig")) {
      useTPC_Pi=kTRUE;
      useTOF_Pi=kTRUE;
      useTPC_K=kTRUE;
      useTOF_K=kTRUE;
   }

   if (opt.Contains("PiTPCnsig")) useTPC_Pi=kTRUE;
   if (opt.Contains("PiTOFnsig")) useTOF_Pi=kTRUE;
   if (opt.Contains("KTPCnsig"))  useTPC_K=kTRUE;
   if (opt.Contains("KTOFnsig"))  useTOF_K=kTRUE;

   if (opt.Contains("PiTPCnsig10")) nSigmaTPC_Pi = 1.0;
   if (opt.Contains("PiTPCnsig15")) nSigmaTPC_Pi = 1.5;
   if (opt.Contains("PiTPCnsig20")) nSigmaTPC_Pi = 2.0;
   if (opt.Contains("PiTPCnsig25")) nSigmaTPC_Pi = 2.5;
   if (opt.Contains("PiTPCnsig30")) nSigmaTPC_Pi = 3.0;

   if (opt.Contains("KTPCnsig10")) nSigmaTPC_K = 1.0;
   if (opt.Contains("KTPCnsig15")) nSigmaTPC_K = 1.5;
   if (opt.Contains("KTPCnsig20")) nSigmaTPC_K = 2.0;
   if (opt.Contains("KTPCnsig25")) nSigmaTPC_K = 2.5;
   if (opt.Contains("KTPCnsig30")) nSigmaTPC_K = 3.0;

   if (opt.Contains("PiTOFnsig10")) nSigmaTOF_Pi = 1.0;
   if (opt.Contains("PiTOFnsig15")) nSigmaTOF_Pi = 1.5;
   if (opt.Contains("PiTOFnsig20")) nSigmaTOF_Pi = 2.0;
   if (opt.Contains("PiTOFnsig25")) nSigmaTOF_Pi = 2.5;
   if (opt.Contains("PiTOFnsig30")) nSigmaTOF_Pi = 3.0;

   if (opt.Contains("KTOFnsig10")) nSigmaTOF_K = 1.0;
   if (opt.Contains("KTOFnsig15")) nSigmaTOF_K = 1.5;
   if (opt.Contains("KTOFnsig20")) nSigmaTOF_K = 2.0;
   if (opt.Contains("KTOFnsig25")) nSigmaTOF_K = 2.5;
   if (opt.Contains("KTOFnsig30")) nSigmaTOF_K = 3.0;

   Bool_t usePDG=kFALSE;
   if (opt.Contains("pdg")) {
      Printf("Using PDG");
      usePDG = kTRUE;
   }

   Bool_t useEta = kFALSE;
   if (opt.Contains("eta")) {
      Printf("Using ETA range (%.2f,%.2f)",-etaRange,etaRange);
      useEta = kTRUE;
   }

   // KAON SETTINGS =======================================
   TString scheme="";
   TString cutname = "K_Kstar";
   if (!opt.IsNull()) cutname += Form("_%s",opt.Data());
   AliRsnCutSet *cutsK = new AliRsnCutSet(cutname.Data(), AliRsnTarget::kDaughter);

   AliRsnCutTrackQuality *qualityCutK = new AliRsnCutTrackQuality("cutQuatityK");
   if (useCommonQualityCut>=0) {
      qualityCutK->SetAODTestFilterBit(useCommonQualityCut);

   } else {
      qualityCutK->SetDefaults2010();

   }

   //No filter bit
   if(opt.Contains("NOfb")) qualityCutK->SetAODTestFilterBit(-1);

   cutsK->AddCut(qualityCutK);
   if (!scheme.IsNull()) scheme += "&";
   scheme += qualityCutK->GetName();

   if (useTPC_K) {
      AliRsnCutPIDNSigma *cutKTPC = new AliRsnCutPIDNSigma("cutNSigmaTPCK",AliPID::kKaon,AliRsnCutPIDNSigma::kTPC);
      cutKTPC->SinglePIDRange(nSigmaTPC_K);
      cutsK->AddCut(cutKTPC);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cutKTPC->GetName();
   }

   if (useTOF_K) {
      AliRsnCutPIDNSigma *cutKTOF = new AliRsnCutPIDNSigma("cutNSigmaTOFK",AliPID::kKaon,AliRsnCutPIDNSigma::kTOF);
      cutKTOF->SinglePIDRange(nSigmaTOF_K);
      cutsK->AddCut(cutKTOF);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cutKTOF->GetName();
   }
   if (useEta) {
      AliRsnValueDaughter *valEtaK = new AliRsnValueDaughter(Form("val%sETA%s",AliPID::ParticleName(type2),opt.Data()),AliRsnValueDaughter::kEta);
      AliRsnCutValue *cutEtaK = new AliRsnCutValue(Form("cut%sETA%s",AliPID::ParticleName(type2),opt.Data()),-etaRange,etaRange);
      cutEtaK->SetTargetType(AliRsnTarget::kDaughter);
      cutEtaK->SetValueObj(valEtaK);
      cutsK->AddCut(cutEtaK);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cutEtaK->GetName();
   }
   if (usePDG) {
      AliRsnCutPID *cutPDGK = new AliRsnCutPID(Form("cut%sPDG%s",AliPID::ParticleName(type2),opt.Data()),type2,0.0,kTRUE);
      cutsK->AddCut(cutPDGK);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cutPDGK->GetName();
   }

   //MinPt cut kaon
   if (useTrackPtCut) {
      Printf("Adding Pt min=%.3f max=%.3f ...",trackPtMin,trackPtMax);
      AliRsnValueDaughter *valTrackPtK = new AliRsnValueDaughter(Form("val%sTrackPt%s",AliPID::ParticleName(type2),opt.Data()),AliRsnValueDaughter::kPt);

      AliRsnCutValue *cutTrackPtK = new AliRsnCutValue(Form("cut%sTrackPt%s",AliPID::ParticleName(type2),opt.Data()),trackPtMin,trackPtMax);
      cutTrackPtK->SetTargetType(AliRsnTarget::kDaughter);
      cutTrackPtK->SetValueObj(valTrackPtK);
      cutsK->AddCut(cutTrackPtK);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cutTrackPtK->GetName();
   }

   //Ncluster cut kaon
   if(opt.Contains("tpcncl80K")) {
      Printf("***** adding 80 TPCNCL cut Kaon");
      AliRsnValueDaughter *val_tpcnclK = new AliRsnValueDaughter(Form("val%s_tpcncl_%s",AliPID::ParticleName(type2),opt.Data()),AliRsnValueDaughter::kNTPCclusters);
      AliRsnCutValue *cut_tpcnclK = new AliRsnCutValue(Form("cut%s_tpcncl_%s",AliPID::ParticleName(type2),opt.Data()),80,10000);
      cut_tpcnclK->SetTargetType(AliRsnTarget::kDaughter);
      cut_tpcnclK->SetValueObj(val_tpcnclK);
      cutsK->AddCut(cut_tpcnclK);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cut_tpcnclK->GetName();
   }

   if(opt.Contains("tpcncl90K")) {
      Printf("***** adding 90 TPCNCL cut Kaon");
      AliRsnValueDaughter *val_tpcnclK = new AliRsnValueDaughter(Form("val%s_tpcncl_%s",AliPID::ParticleName(type2),opt.Data()),AliRsnValueDaughter::kNTPCclusters);
      AliRsnCutValue *cut_tpcnclK = new AliRsnCutValue(Form("cut%s_tpcncl_%s",AliPID::ParticleName(type2),opt.Data()),90,10000);
      cut_tpcnclK->SetTargetType(AliRsnTarget::kDaughter);
      cut_tpcnclK->SetValueObj(val_tpcnclK);
      cutsK->AddCut(cut_tpcnclK);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cut_tpcnclK->GetName();
   }

   if(opt.Contains("tpcncl100K")) {
      Printf("***** adding 100 TPCNCL cut Kaon");
      AliRsnValueDaughter *val_tpcnclK = new AliRsnValueDaughter(Form("val%s_tpcncl_%s",AliPID::ParticleName(type2),opt.Data()),AliRsnValueDaughter::kNTPCclusters);
      AliRsnCutValue *cut_tpcnclK = new AliRsnCutValue(Form("cut%s_tpcncl_%s",AliPID::ParticleName(type2),opt.Data()),100,10000);
      cut_tpcnclK->SetTargetType(AliRsnTarget::kDaughter);
      cut_tpcnclK->SetValueObj(val_tpcnclK);
      cutsK->AddCut(cut_tpcnclK);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cut_tpcnclK->GetName();
   }

   //Ncluster cut kaon through AliRsnCutTrackQuality
   if(opt.Contains("QTPCnclK")) {
      AliRsnCutTrackQuality *QTPCNclsCutK = new AliRsnCutTrackQuality("QTPCnclK");
      QTPCNclsCutK->DisableAll();//disable all cuts, filter bit, pT, eta, and DCAxy cuts will be reset later
      QTPCNclsCutK->SetAODTestFilterBit(5);//reset the filter bit cut
      QTPCNclsCutK->SetCheckOnlyFilterBit(kFALSE);//tells the cut object to check all other cuts individually, not just the filter bit
      QTPCNclsCutK->SetPtRange(0.15,1.e20);//reset the pT cut
      QTPCNclsCutK->SetEtaRange(-0.8,0.8);//reset the eta cut

      if(opt.Contains("nclK70")) minclsK=70;
      if(opt.Contains("nclK75")) minclsK=75;
      if(opt.Contains("nclK80")) minclsK=80;
      if(opt.Contains("nclK85")) minclsK=85;
      if(opt.Contains("nclK90")) minclsK=90;
      if(opt.Contains("nclK100")) minclsK=100;

      Printf(Form("++++++++ Adding Cut: NclustersTPC Kaon >= %d",minclsK));
      QTPCNclsCutK->SetTPCminNClusters(minclsK);

      cutsK->AddCut(QTPCNclsCutK);
      if (!scheme.IsNull()) scheme += "&";
      scheme += QTPCNclsCutK->GetName();
   }

   //pt dep dcaxy cut on kaon
   if(opt.Contains("PtDCAK")) {
      AliRsnCutTrackQuality *dcaxyCutK = new AliRsnCutTrackQuality("ptdcaK");
      dcaxyCutK->DisableAll();//disable all cuts, filter bit, pT, eta, and DCAxy cuts will be reset later
      dcaxyCutK->SetAODTestFilterBit(5);//reset the filter bit cut
      dcaxyCutK->SetCheckOnlyFilterBit(kFALSE);//tells the cut object to check all other cuts individually, not just the filter bit
      dcaxyCutK->SetPtRange(0.15,1.e20);//reset the pT cut
      dcaxyCutK->SetEtaRange(-0.8,0.8);//reset the eta cut
      if(opt.Contains("DCAK7s")) {dcaxyCutK->SetDCARPtFormula("0.0182+0.0350/pt^1.01");}
      if(opt.Contains("DCAK6s")) {dcaxyCutK->SetDCARPtFormula("0.0156+0.03/pt^1.01");}
      if(opt.Contains("DCAK5s")) {dcaxyCutK->SetDCARPtFormula("0.013+0.025/pt^1.01");}
      if(opt.Contains("DCAK4s")) {dcaxyCutK->SetDCARPtFormula("0.0104+0.02/pt^1.01");}
      if(opt.Contains("DCAK3s")) {dcaxyCutK->SetDCARPtFormula("0.0078+0.015/pt^1.01");}
      if(opt.Contains("DCAK2s")) {dcaxyCutK->SetDCARPtFormula("0.0052+0.01/pt^1.01");}
      if(opt.Contains("DCAK1s")) {dcaxyCutK->SetDCARPtFormula("0.0026+0.005/pt^1.01");}
      cutsK->AddCut(dcaxyCutK);
      if (!scheme.IsNull()) scheme += "&";
      scheme += dcaxyCutK->GetName();
   }

   Printf ("CUT Scheme for KAON is '%s'",scheme.Data());
   cutsK->SetCutScheme(scheme.Data());

   // END KAON =======================================

   // Pion SETTINGS ===========================================

   scheme="";
   cutname = "Pi_Kstar";
   if (!opt.IsNull()) cutname += Form("_%s",opt.Data());
   AliRsnCutSet *cutsP = new AliRsnCutSet(cutname.Data(), AliRsnTarget::kDaughter);

   AliRsnCutTrackQuality *qualityCutPi = new AliRsnCutTrackQuality("cutQuatityPi");
   if (useCommonQualityCut>=0) {
      qualityCutPi->SetAODTestFilterBit(useCommonQualityCut);

   } else {
      qualityCutPi->SetDefaults2010();
   }
   //No filter bit
   if(opt.Contains("NOfb")) qualityCutPi->SetAODTestFilterBit(-1);

   cutsP->AddCut(qualityCutPi);
   if (!scheme.IsNull()) scheme += "&";
   scheme += qualityCutPi->GetName();
   if (useTPC_Pi) {
      AliRsnCutPIDNSigma *cutPiTPC = new AliRsnCutPIDNSigma("cutNSigmaTPCPi",AliPID::kPion,AliRsnCutPIDNSigma::kTPC);
      cutPiTPC->SinglePIDRange(nSigmaTPC_Pi);
      cutsP->AddCut(cutPiTPC);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cutPiTPC->GetName();
   }
   if (useTOF_Pi) {
      AliRsnCutPIDNSigma *cutPiTOF = new AliRsnCutPIDNSigma("cutNSigmaTOFPi",AliPID::kPion,AliRsnCutPIDNSigma::kTOF);
      cutPiTOF->SinglePIDRange(nSigmaTOF_Pi);
      cutsP->AddCut(cutPiTOF);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cutPiTOF->GetName();
   }
   if (useEta) {
      AliRsnValueDaughter *valEtaP = new AliRsnValueDaughter(Form("val%sETA%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kEta);
      AliRsnCutValue *cutEtaP = new AliRsnCutValue(Form("cut%sETA%s",AliPID::ParticleName(type1),opt.Data()),-etaRange,etaRange);
      cutEtaP->SetTargetType(AliRsnTarget::kDaughter);
      cutEtaP->SetValueObj(valEtaP);
      cutsP->AddCut(cutEtaP);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cutEtaP->GetName();
   }
   if (usePDG) {
      AliRsnCutPID *cutPDGP = new AliRsnCutPID(Form("cut%sPDG%s",AliPID::ParticleName(type1),opt.Data()),type1,0.0,kTRUE);
      cutsP->AddCut(cutPDGP);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cutPDGP->GetName();
   }

   //MinPt cut pion
   if (useTrackPtCut) {
      Printf("Adding Pt min=%.3f max=%.3f ...",trackPtMin,trackPtMax);
      AliRsnValueDaughter *valTrackPtP = new AliRsnValueDaughter(Form("val%sTrackPt%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kPt);

      AliRsnCutValue *cutTrackPtP = new AliRsnCutValue(Form("cut%sTrackPt%s",AliPID::ParticleName(type1),opt.Data()),trackPtMin,trackPtMax);
      cutTrackPtP->SetTargetType(AliRsnTarget::kDaughter);
      cutTrackPtP->SetValueObj(valTrackPtP);
      cutsP->AddCut(cutTrackPtP);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cutTrackPtP->GetName();
   }

   //Ncluster cut pion
   if(opt.Contains("tpcncl80Pi")) {
      Printf("***** adding 80 TPCNCL cut Pion");
      AliRsnValueDaughter *val_tpcnclP = new AliRsnValueDaughter(Form("val%s_tpcncl_%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kNTPCclusters);
      AliRsnCutValue *cut_tpcnclP = new AliRsnCutValue(Form("cut%s_tpcncl_%s",AliPID::ParticleName(type1),opt.Data()),80,10000);
      cut_tpcnclP->SetTargetType(AliRsnTarget::kDaughter);
      cut_tpcnclP->SetValueObj(val_tpcnclP);
      cutsP->AddCut(cut_tpcnclP);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cut_tpcnclP->GetName();
   }

   if(opt.Contains("tpcncl90Pi")) {
      Printf("***** adding 90 TPCNCL cut Pion");
      AliRsnValueDaughter *val_tpcnclP = new AliRsnValueDaughter(Form("val%s_tpcncl_%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kNTPCclusters);
      AliRsnCutValue *cut_tpcnclP = new AliRsnCutValue(Form("cut%s_tpcncl_%s",AliPID::ParticleName(type1),opt.Data()),90,10000);
      cut_tpcnclP->SetTargetType(AliRsnTarget::kDaughter);
      cut_tpcnclP->SetValueObj(val_tpcnclP);
      cutsP->AddCut(cut_tpcnclP);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cut_tpcnclP->GetName();
   }

   if(opt.Contains("tpcncl100Pi")) {
      Printf("***** adding 100 TPCNCL cut Pion");
      AliRsnValueDaughter *val_tpcnclP = new AliRsnValueDaughter(Form("val%s_tpcncl_%s",AliPID::ParticleName(type1),opt.Data()),AliRsnValueDaughter::kNTPCclusters);
      AliRsnCutValue *cut_tpcnclP = new AliRsnCutValue(Form("cut%s_tpcncl_%s",AliPID::ParticleName(type1),opt.Data()),100,10000);
      cut_tpcnclP->SetTargetType(AliRsnTarget::kDaughter);
      cut_tpcnclP->SetValueObj(val_tpcnclP);
      cutsP->AddCut(cut_tpcnclP);
      if (!scheme.IsNull()) scheme += "&";
      scheme += cut_tpcnclP->GetName();
   }

   //Ncluster cut on pion through AliRsnCutTrackQuality
   if(opt.Contains("QTPCnclPi")) {
      AliRsnCutTrackQuality *QTPCNclsCutPi = new AliRsnCutTrackQuality("QTPCnclPi");
      QTPCNclsCutPi->DisableAll();//disable all cuts, filter bit, pT, eta, and DCAxy cuts will be reset later
      QTPCNclsCutPi->SetAODTestFilterBit(5);//reset the filter bit cut
      QTPCNclsCutPi->SetCheckOnlyFilterBit(kFALSE);//tells the cut object to check all other cuts individually, not just the filter bit
      QTPCNclsCutPi->SetPtRange(0.15,1.e20);//reset the pT cut
      QTPCNclsCutPi->SetEtaRange(-0.8,0.8);//reset the eta cut

      if(opt.Contains("nclPi70")) minclsPi=70;
      if(opt.Contains("nclPi75")) minclsPi=75;
      if(opt.Contains("nclPi80")) minclsPi=80;
      if(opt.Contains("nclPi85")) minclsPi=85;
      if(opt.Contains("nclPi90")) minclsPi=90;
      if(opt.Contains("nclPi100")) minclsPi=100;

      Printf(Form("+++++++++ Adding Cut: NclustersTPC Pion >= %d",minclsPi));
      QTPCNclsCutPi->SetTPCminNClusters(minclsPi);

      cutsP->AddCut(QTPCNclsCutPi);
      if (!scheme.IsNull()) scheme += "&";
      scheme += QTPCNclsCutPi->GetName();

   }

   //pt dep dcaxy cut pion
   if(opt.Contains("PtDCAP")) {
      AliRsnCutTrackQuality *dcaxyCutP = new AliRsnCutTrackQuality("ptdcaP6s");
      dcaxyCutP->DisableAll();//disable all cuts, filter bit, pT, eta, and DCAxy cuts will be reset later
      dcaxyCutP->SetAODTestFilterBit(5);//reset the filter bit cut
      dcaxyCutP->SetCheckOnlyFilterBit(kFALSE);//tells the cut object to check all other cuts individually, not just the filter bit
      dcaxyCutP->SetPtRange(0.15,1.e20);//reset the pT cut
      dcaxyCutP->SetEtaRange(-0.8,0.8);//reset the eta cut
      if(opt.Contains("DCAP7s")) {dcaxyCutP->SetDCARPtFormula("0.0182+0.0350/pt^1.01");}
      if(opt.Contains("DCAP6s")) {dcaxyCutP->SetDCARPtFormula("0.0156+0.03/pt^1.01");}
      if(opt.Contains("DCAP5s")) {dcaxyCutP->SetDCARPtFormula("0.013+0.025/pt^1.01");}
      if(opt.Contains("DCAP4s")) {dcaxyCutP->SetDCARPtFormula("0.0104+0.02/pt^1.01");}
      if(opt.Contains("DCAP3s")) {dcaxyCutP->SetDCARPtFormula("0.0078+0.015/pt^1.01");}
      if(opt.Contains("DCAP2s")) {dcaxyCutP->SetDCARPtFormula("0.0052+0.01/pt^1.01");}
      if(opt.Contains("DCAP1s")) {dcaxyCutP->SetDCARPtFormula("0.0026+0.005/pt^1.01");}
      cutsP->AddCut(dcaxyCutP);
      if (!scheme.IsNull()) scheme += "&";
      scheme += dcaxyCutP->GetName();
   }

   Printf ("CUT Scheme for PION is '%s'",scheme.Data());
   cutsP->SetCutScheme(scheme.Data());

   // END PION =======================================

   if (opt.Contains("mon")) {
      AddMonitorOutput(cutsP->GetMonitorOutput(),opt);
      AddMonitorOutput(cutsK->GetMonitorOutput(),opt);
   }
   if (isRsnMini) {
      AliRsnMiniAnalysisTask *taskRsnMini = dynamic_cast<AliRsnMiniAnalysisTask *>(task);
      if (taskRsnMini) {
         taskRsnMini->AddTrackCuts(cutsK);
         taskRsnMini->AddTrackCuts(cutsP);

      }
   } else {
      AliRsnDaughterSelector *sel = rsnIH->GetSelector();
//       sel->SetLabelCheck(kFALSE);
      sel->Add(cutsP, kTRUE);
      sel->Add(cutsK, kTRUE);
   }
   return numberOfCuts;

}


text:
For more information on the 1&1 Cloud Driver for Docker Machine see the [1&1 Community Portal](https://www.1and1.com/cloud-community/).

## Table of Contents
* [Overview](#overview)
* [Requirements](#requirements)
* [Installation](#installation)
  * [From a Release](#from-a-release)
  * [From Source](#from-source)
* [Usage](#usage)
  * [Available Options](#available-options)
  * [Example](#example)
* [License](#license)

## Overview

The 1&1 Cloud Driver is a plugin for Docker Machine which allows you to automate the provisioning of Docker hosts on 1&1 Cloud Servers. The plugin is based on the [1&1 CloudServer Go SDK](https://github.com/1and1/oneandone-cloudserver-sdk-go) and [Cloud API](https://cloudpanel-api.1and1.com/documentation/1and1/).

To acquire 1&1 Cloud API credentials visit https://www.1and1.com.

## Requirements

  * [Docker Machine](https://docs.docker.com/machine/install-machine/) 0.5.1 or a newer version

Windows and Mac OS X users may install [Docker Toolbox](https://www.docker.com/products/docker-toolbox) package that includes the latest version of the Docker Machine.

## Installation

### From a Release

The latest version of the `docker-machine-driver-oneandone` binary is available on the [GithHub Releases](https://github.com/1and1/docker-machine-driver-oneandone/releases) page.
Download the `tar` archive and extract it into a directory residing in your PATH. Select the binary that corresponds to your OS and according to the file name prefix:

* Linux: docker-machine-driver-oneandone-linux
* Mac OS X: docker-machine-driver-oneandone-darwin
* Windows: docker-machine-driver-oneandone-windows

To extract and install the binary, Linux and Mac users can use the Terminal and the following commands:

```bash
sudo tar -C /usr/local/bin -xvzf docker-machine-driver-oneandone*.tar.gz
```

If required, modify the permissions to make the plugin executable:

```bash
sudo chmod +x /usr/local/bin/docker-machine-driver-oneandone
```

Windows users may run the above commands without `sudo` in Docker Quickstart Terminal that is installed with [Docker Toolbox](https://www.docker.com/products/docker-toolbox).

### From Source

Make sure you have installed [Go](http://www.golang.org) and configured [GOPATH](http://golang.org/doc/code.html#GOPATH) properly.

To download the repository and build the driver run the following:

```bash
go get -d -u github.com/1and1/docker-machine-driver-oneandone
cd $GOPATH/src/github.com/1and1/docker-machine-driver-oneandone
make build
```

To use the driver run:

```bash
make install
```

This command will install the driver into `/usr/local/bin`.

Otherwise, set your PATH environment variable correctly. For example:

```bash
export PATH=$GOPATH/src/github.com/1and1/docker-machine-driver-oneandone/bin:$PATH
```

If you are running Windows, you may also need to install GNU Make, Bash shell and a few other Bash utilities available with [Cygwin](https://www.cygwin.com).

## Usage

You may want to refer to the Docker Machine [official documentation](https://docs.docker.com/machine/) before using the driver.

Verify that Docker Machine can see the 1&1 driver:

```bash
docker-machine create -d oneandone --help
```

To create a Docker host, provide your API access token and a firewall policy ID.
Make sure that the policy has opened [the ports required by Docker](https://docs.docker.com/swarm/plan-for-production/).

If you do not supply a firewall policy ID, the driver will create a new firewall policy with a prefix of `Docker-Driver-Required-Policy_`. The policy will open the following TCP ports:

* 22
* 80
* 2375-2376
* 3375-3376

You may further customize the policy according to your needs and Docker's requirements.
Before creating a new policy, the plugin will search for an existing policy with the `Docker-Driver-Required-Policy_` prefix and the required ports.

```bash
docker-machine create -d oneandone \
--oneandone-api-key [API-TOKEN-KEY] \
--oneandone-firewall-id [FIREWALL-POLICY-ID] \
MyHostName
```

### Available Options

  * `--oneandone-api-key`:  1&1 Cloud API key.
  * `--oneandone-datacenter`: 1&1 data center location.
  * `--oneandone-firewall-id`: 1&1 firewall policy ID.
  * `--oneandone-size`: 1&1 Cloud Server size.
  * `--oneandone-ip-address`: Unassigned 1&1 public IP address.
  * `--oneandone-loadbalancer-id`: 1&1 load balancer ID.
  * `--oneandone-monitor-policy-id`: 1&1 monitoring policy ID.
  * `--oneandone-os`: 1&1 server appliance OS.
  * `--oneandone-server-description`: 1&1 Cloud Server description.
  * `--oneandone-ssh-pass`: SSH password.

|          CLI Option              |   Default Value    | Environment Variable           | Required |
| -------------------------------- | ------------------ | ------------------------------ | -------- |
| `--oneandone-api-key`            |                    | `ONEANDONE_API_KEY`            | yes      |
| `--oneandone-datacenter`         | `US`               | `ONEANDONE_DATACENTER`         | yes      |
| `--oneandone-firewall-id`        |                    | `ONEANDONE_FIREWALL`           | no       |
| `--oneandone-size`               | `M`                | `ONEANDONE_SIZE`               | yes      |
| `--oneandone-ip-address`         |                    | `ONEANDONE_IP_ADDRESS`         | no       |
| `--oneandone-loadbalancer-id`    |                    | `ONEANDONE_LOADBALANCER`       | no       |
| `--oneandone-monitor-policy-id`  |                    | `ONEANDONE_MONITOR_POLICY`     | no       |
| `--oneandone-os`                 | `ubuntu1404-64std` | `ONEANDONE_OS`                 | yes      |
| `--oneandone-server-description` |                    | `ONEANDONE_SERVER_DESCRIPTION` | no       |
| `--oneandone-ssh-pass`           |                    | `ONEANDONE_SSH_PASSWORD`       | no       |

Valid values for `--oneandone-size` are `M`, `L`, `XL`, `XXL`, `3XL`, `4XL` and `5XL`.

Available parameters for `--oneandone-datacenter` are shown in the next table.

| Parameter |                 Data Center Location                 |
|-----------|------------------------------------------------------|
| `DE`      | Germany                                              |
| `ES`      | Spain                                                |
| `GB`      | United Kingdom of Great Britain and Northern Ireland |
| `US`      | United States of America                             |

Supported values for `--oneandone-os` are listed below.

|              Parameter                |
|---------------------------------------|
| `centos7-64min`                       |
| `centos7-64std`                       |
| `centos7-64std+cpanel`                |
| `centos7-64std+plesk12unlimited`      |
| `centos7-64std+plesk12.5unlimited`    |
| `debian8-64min`                       |
| `debian8-64std`                       |
| `debian8-64std+plesk12.5unlimited`    |
| `ubuntu1204-64min`                    |
| `ubuntu1204-64std`                    |
| `ubuntu1204-64std+plesk12unlimited`   |
| `ubuntu1204-64std+plesk12.5unlimited` |
| `ubuntu1404-64min`                    |
| `ubuntu1404-64std`                    |
| `ubuntu1404-64std+plesk12unlimited`   |
| `ubuntu1604-64min`                    |
| `ubuntu1604-64std`                    |

### Example

```
docker-machine --debug create --driver oneandone \
 --oneandone-api-key              b92bd5bb3dc909cfd48b6370d3bf560c \
 --oneandone-datacenter           GB \
 --oneandone-firewall-id          D8D6964A24D9A709941064AFD5FA83BC \
 --oneandone-size                 XXL \
 --oneandone-ip-address           109.228.51.239 \
 --oneandone-loadbalancer-id      F78677C1364BE21973E530FB7E7D805E \
 --oneandone-monitor-policy-id    6027B730256C9585B269DAA8B1788DEC \
 --oneandone-os                   centos7-64std \
 --oneandone-server-description   My-Docker-host-description \
 --oneandone-ssh-pass             MyPassSecret.170 \
MyDockerHostName
```

**Note:** When creating a new machine, if you provide an IP address and a load balancer ID make sure that they belong to the same data center as the machine being created.
Also, all OS appliances may not be available in all data centers.

## License

This code is released under the Apache 2.0 License.

Copyright (c) 2016 1&1 Internet SE

redpajama_set_name: RedPajamaGithub


text:
import { Cache } from '../caching/cache';
import { CacheKey } from '../caching/cacheKey';
import { KeepOldResolver } from "./keepOldResolver";
import { spy, SinonSpy } from 'sinon';
import { expect } from 'chai';

describe('KeepOldResolver', () => {
  it('should not add the new object', () => {
    const key: CacheKey = { key: 'some key' };
    const obj = {};

    const cache = new Cache();
    const addSpy: SinonSpy = spy(cache, 'add');

    const resolver = new KeepOldResolver();

    return resolver.resolve(cache, key, obj).then(() => {
      expect(addSpy.callCount).to.be.equal(0)
    });
  });

  it('should not remove the old object', () => {
    const key: CacheKey = { key: 'some key' };
    const obj = {};

    const cache = new Cache();
    const removeSpy: SinonSpy = spy(cache, 'remove');

    const resolver = new KeepOldResolver();

    return resolver.resolve(cache, key, obj).then(() => {
      expect(removeSpy.callCount).to.be.equal(0);
    });
  });

  it('should reeturn false', () => {
    const key: CacheKey = { key: 'some key' };
    const obj = {};

    const cache = new Cache();

    const resolver = new KeepOldResolver();

    const result = resolver.resolve(cache, key, obj);

    expect(result).to.eventually.be.false;
  });
});


text:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<language alias="en" intName="English (US)" localName="English (US)" lcid="" culture="en-US">
  <area alias="dashboardTabs">
    <key alias="Skybrud.BorgerDk.Dashboard">Borger.dk</key>
  </area>
</language>


text:
define(['three', 'jQuery', 'keyboard'], function(THREE, $, KeyboardJS)
{
	graphics =
	{
		renderer: new THREE.WebGLRenderer(),

		/* Initialize graphical container */
		init: function(element)
		{
			this.renderer.setSize(window.innerWidth, window.innerHeight);
			jQuery(element).append(this.renderer.domElement);

			// keymage('realm', 'w', alert("Moving forward Wade"));
	  //   	keymage.pushScope('realm');
		},

		/* Display graphics */
		display: function(scene, cameras)
		{
			// Create animation loop
			function animate()
			{
			  graphics.renderer.render(scene, cameras);
			  // cameras.lookAt(scene.position);
			  graphics.debug(cameras.position);

			  requestAnimationFrame(animate);
			};
			animate();
		},

		/* Show details of environment in debugging window */
		debug: function(position)
		{
			var x = parseInt(position.x),
				y = parseInt(position.y),
				z = parseInt(position.z);

			$('#x_pos').html(x);
			$('#y_pos').html(y);
			$('#z_pos').html(z);
		}
	};

	return graphics;
});


text:
package net.runelite.client.chat;

import com.google.common.base.MoreObjects;
import com.google.common.base.Strings;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.google.common.eventbus.Subscribe;
import java.awt.Color;
import java.util.Arrays;
import java.util.Collection;
import java.util.Objects;
import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.atomic.AtomicReference;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatLineBuffer;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.MessageNode;
import net.runelite.api.Varbits;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.ResizeableChanged;
import net.runelite.api.events.SetMessage;
import net.runelite.api.events.VarbitChanged;
import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.util.ColorUtil;

@Slf4j
@Singleton
public class ChatMessageManager
{
	private final Multimap<ChatMessageType, ChatColor> colorCache = HashMultimap.create();
	private final Client client;
	private final ScheduledExecutorService executor;
	private final ChatColorConfig chatColorConfig;
	private int transparencyVarbit = -1;
	private final Queue<QueuedMessage> queuedMessages = new ConcurrentLinkedQueue<>();

	@Inject
	private ChatMessageManager(Client client, ScheduledExecutorService executor,
		ChatColorConfig chatColorConfig)
	{
		this.client = client;
		this.executor = executor;
		this.chatColorConfig = chatColorConfig;
	}

	@Subscribe
	public void onVarbitChanged(VarbitChanged event)
	{
		int setting = client.getVar(Varbits.TRANSPARENT_CHATBOX);

		if (transparencyVarbit != setting)
		{
			transparencyVarbit = setting;
			refreshAll();
		}
	}

	@Subscribe
	public void onResizableChanged(ResizeableChanged event)
	{
		refreshAll();
	}

	@Subscribe
	public void onConfigChanged(ConfigChanged event)
	{
		if (event.getGroup().equals("textrecolor"))
		{
			loadColors();
			refreshAll();
		}
	}

	@Subscribe
	public void onSetMessage(SetMessage setMessage)
	{
		MessageNode messageNode = setMessage.getMessageNode();
		ChatMessageType chatMessageType = setMessage.getType();

		boolean isChatboxTransparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1;
		Color usernameColor = null;
		Color senderColor = null;

		switch (chatMessageType)
		{
			case PRIVATE_MESSAGE_RECEIVED_MOD:
			case PRIVATE_MESSAGE_RECEIVED:
			case PRIVATE_MESSAGE_SENT:
				usernameColor = isChatboxTransparent ? chatColorConfig.transparentPrivateUsernames() : chatColorConfig.opaquePrivateUsernames();
				break;

			case TRADE:
			case AUTOCHAT:
			case PUBLIC:
			case PUBLIC_MOD:
			{
				boolean isFriend = client.isFriended(setMessage.getName(), true) && !client.getLocalPlayer().getName().equals(setMessage.getName());

				if (isFriend)
				{
					usernameColor = isChatboxTransparent ? chatColorConfig.transparentPublicFriendUsernames() : chatColorConfig.opaquePublicFriendUsernames();
				}
				if (usernameColor == null)
				{
					usernameColor = isChatboxTransparent ? chatColorConfig.transparentUsername() : chatColorConfig.opaqueUsername();
				}
				break;
			}
			case CLANCHAT:
				usernameColor = isChatboxTransparent ? chatColorConfig.transparentClanUsernames() : chatColorConfig.opaqueClanUsernames();
				break;
		}

		senderColor = isChatboxTransparent ? chatColorConfig.transparentClanChannelName() : chatColorConfig.opaqueClanChannelName();

		if (usernameColor != null)
		{
			messageNode.setName(ColorUtil.wrapWithColorTag(messageNode.getName(), usernameColor));
		}

		String sender = setMessage.getSender();
		if (senderColor != null && !Strings.isNullOrEmpty(sender))
		{
			messageNode.setSender(ColorUtil.wrapWithColorTag(sender, senderColor));
		}

		final Collection<ChatColor> chatColors = colorCache.get(chatMessageType);
		for (ChatColor chatColor : chatColors)
		{
			if (chatColor.isTransparent() != isChatboxTransparent || chatColor.getType() != ChatColorType.NORMAL || chatColor.isDefault())
			{
				continue;
			}

			messageNode.setValue(ColorUtil.wrapWithColorTag(messageNode.getValue(), chatColor.getColor()));
			break;
		}
	}

	private static Color getDefaultColor(ChatMessageType type, boolean transparent)
	{
		if (!transparent)
		{
			switch (type)
			{
				case PUBLIC:
				case PUBLIC_MOD:
					return Color.decode("#0000FF");
				case PRIVATE_MESSAGE_SENT:
				case PRIVATE_MESSAGE_RECEIVED:
					return Color.decode("#00FFFF");
				case CLANCHAT:
					return Color.decode("#7F0000");
				case EXAMINE_ITEM:
				case EXAMINE_OBJECT:
				case EXAMINE_NPC:
				case GAME:
					return Color.decode("#000000");
			}
		}
		else
		{
			switch (type)
			{
				case PUBLIC:
				case PUBLIC_MOD:
					return Color.decode("#9090FF");
				case PRIVATE_MESSAGE_SENT:
				case PRIVATE_MESSAGE_RECEIVED:
					return Color.decode("#00FFFF");
				case CLANCHAT:
					return Color.decode("#7F0000");
				case EXAMINE_ITEM:
				case EXAMINE_OBJECT:
				case EXAMINE_NPC:
				case GAME:
					return Color.decode("#FFFFFF");
			}
		}

		return null;
	}

	/**
	 * Load all configured colors
	 */
	public void loadColors()
	{
		colorCache.clear();

		// Apply defaults
		for (ChatMessageType chatMessageType : ChatMessageType.values())
		{
			Color defaultTransparent = getDefaultColor(chatMessageType, true);
			if (defaultTransparent != null)
			{
				cacheColor(new ChatColor(ChatColorType.NORMAL, defaultTransparent, true, true), chatMessageType);
			}

			Color defaultOpaque = getDefaultColor(chatMessageType, false);
			if (defaultOpaque != null)
			{
				cacheColor(new ChatColor(ChatColorType.NORMAL, defaultOpaque, false, true), chatMessageType);
			}
		}

		if (chatColorConfig.opaquePublicChat() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaquePublicChat(), false),
				ChatMessageType.PUBLIC);
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaquePublicChat(), false),
				ChatMessageType.PUBLIC_MOD);
		}
		if (chatColorConfig.opaquePublicChatHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaquePublicChatHighlight(), false),
				ChatMessageType.PUBLIC);
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaquePublicChatHighlight(), false),
				ChatMessageType.PUBLIC_MOD);
		}
		if (chatColorConfig.opaquePrivateMessageSent() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaquePrivateMessageSent(), false),
				ChatMessageType.PRIVATE_MESSAGE_SENT);
		}
		if (chatColorConfig.opaquePrivateMessageSentHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaquePrivateMessageSentHighlight(), false),
				ChatMessageType.PRIVATE_MESSAGE_SENT);
		}
		if (chatColorConfig.opaquePrivateMessageReceived() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaquePrivateMessageReceived(), false),
				ChatMessageType.PRIVATE_MESSAGE_RECEIVED);
		}
		if (chatColorConfig.opaquePrivateMessageReceivedHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaquePrivateMessageReceivedHighlight(), false),
				ChatMessageType.PRIVATE_MESSAGE_RECEIVED);
		}
		if (chatColorConfig.opaqueClanChatInfo() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueClanChatInfo(), false),
				ChatMessageType.CLANCHAT_INFO);
		}
		if (chatColorConfig.opaqueClanChatInfoHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueClanChatInfoHighlight(), false),
				ChatMessageType.CLANCHAT_INFO);
		}
		if (chatColorConfig.opaqueClanChatMessage() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueClanChatMessage(), false),
				ChatMessageType.CLANCHAT);
		}
		if (chatColorConfig.opaqueClanChatMessageHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueClanChatMessageHighlight(), false),
				ChatMessageType.CLANCHAT);
		}
		if (chatColorConfig.opaqueAutochatMessage() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueAutochatMessage(), false),
				ChatMessageType.AUTOCHAT);
		}
		if (chatColorConfig.opaqueAutochatMessageHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueAutochatMessageHighlight(), false),
				ChatMessageType.AUTOCHAT);
		}
		if (chatColorConfig.opaqueTradeChatMessage() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueTradeChatMessage(), false),
				ChatMessageType.TRADE);
		}
		if (chatColorConfig.opaqueTradeChatMessageHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueTradeChatMessageHighlight(), false),
				ChatMessageType.TRADE);
		}
		if (chatColorConfig.opaqueServerMessage() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueServerMessage(), false),
				ChatMessageType.SERVER);
		}
		if (chatColorConfig.opaqueServerMessageHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueServerMessageHighlight(), false),
				ChatMessageType.SERVER);
		}
		if (chatColorConfig.opaqueGameMessage() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueGameMessage(), false),
				ChatMessageType.GAME);
		}
		if (chatColorConfig.opaqueGameMessageHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueGameMessageHighlight(), false),
				ChatMessageType.GAME);
		}
		if (chatColorConfig.opaqueExamine() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueExamine(), false),
				ChatMessageType.EXAMINE_OBJECT);
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueExamine(), false),
				ChatMessageType.EXAMINE_NPC);
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueExamine(), false),
				ChatMessageType.EXAMINE_ITEM);
		}
		if (chatColorConfig.opaqueExamineHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueExamineHighlight(), false),
				ChatMessageType.EXAMINE_OBJECT);
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueExamineHighlight(), false),
				ChatMessageType.EXAMINE_NPC);
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueExamineHighlight(), false),
				ChatMessageType.EXAMINE_ITEM);
		}
		if (chatColorConfig.opaqueFiltered() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueFiltered(), false),
				ChatMessageType.FILTERED);
		}
		if (chatColorConfig.opaqueFilteredHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueFilteredHighlight(), false),
				ChatMessageType.FILTERED);
		}

		//Transparent Chat Colours
		if (chatColorConfig.transparentPublicChat() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentPublicChat(), true),
				ChatMessageType.PUBLIC);
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentPublicChat(), true),
				ChatMessageType.PUBLIC_MOD);
		}
		if (chatColorConfig.transparentPublicChatHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentPublicChatHighlight(), true),
				ChatMessageType.PUBLIC);
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentPublicChatHighlight(), true),
				ChatMessageType.PUBLIC_MOD);
		}
		if (chatColorConfig.transparentPrivateMessageSent() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentPrivateMessageSent(), true),
				ChatMessageType.PRIVATE_MESSAGE_SENT);
		}
		if (chatColorConfig.transparentPrivateMessageSentHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentPrivateMessageSentHighlight(), true),
				ChatMessageType.PRIVATE_MESSAGE_SENT);
		}
		if (chatColorConfig.transparentPrivateMessageReceived() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentPrivateMessageReceived(), true),
				ChatMessageType.PRIVATE_MESSAGE_RECEIVED);
		}
		if (chatColorConfig.transparentPrivateMessageReceivedHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentPrivateMessageReceivedHighlight(), true),
				ChatMessageType.PRIVATE_MESSAGE_RECEIVED);
		}
		if (chatColorConfig.transparentClanChatInfo() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentClanChatInfo(), true),
				ChatMessageType.CLANCHAT_INFO);
		}
		if (chatColorConfig.transparentClanChatInfoHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentClanChatInfoHighlight(), true),
				ChatMessageType.CLANCHAT_INFO);
		}
		if (chatColorConfig.transparentClanChatMessage() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentClanChatMessage(), true),
				ChatMessageType.CLANCHAT);
		}
		if (chatColorConfig.transparentClanChatMessageHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentClanChatMessageHighlight(), true),
				ChatMessageType.CLANCHAT);
		}
		if (chatColorConfig.transparentAutochatMessage() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentAutochatMessage(), true),
				ChatMessageType.AUTOCHAT);
		}
		if (chatColorConfig.transparentAutochatMessageHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentAutochatMessageHighlight(), true),
				ChatMessageType.AUTOCHAT);
		}
		if (chatColorConfig.transparentTradeChatMessage() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentTradeChatMessage(), true),
				ChatMessageType.TRADE);
		}
		if (chatColorConfig.transparentTradeChatMessageHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentTradeChatMessageHighlight(), true),
				ChatMessageType.TRADE);
		}
		if (chatColorConfig.transparentServerMessage() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentServerMessage(), true),
				ChatMessageType.SERVER);
		}
		if (chatColorConfig.transparentServerMessageHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentServerMessageHighlight(), true),
				ChatMessageType.SERVER);
		}
		if (chatColorConfig.transparentGameMessage() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentGameMessage(), true),
				ChatMessageType.GAME);
		}
		if (chatColorConfig.transparentGameMessageHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentGameMessageHighlight(), true),
				ChatMessageType.GAME);
		}
		if (chatColorConfig.transparentExamine() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentExamine(), true),
				ChatMessageType.EXAMINE_OBJECT);
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentExamine(), true),
				ChatMessageType.EXAMINE_NPC);
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentExamine(), true),
				ChatMessageType.EXAMINE_ITEM);
		}
		if (chatColorConfig.transparentExamineHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentExamineHighlight(), true),
				ChatMessageType.EXAMINE_OBJECT);
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentExamineHighlight(), true),
				ChatMessageType.EXAMINE_NPC);
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentExamineHighlight(), true),
				ChatMessageType.EXAMINE_ITEM);
		}
		if (chatColorConfig.transparentFiltered() != null)
		{
			cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentFiltered(), true),
				ChatMessageType.FILTERED);
		}
		if (chatColorConfig.transparentFilteredHighlight() != null)
		{
			cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentFilteredHighlight(), true),
				ChatMessageType.FILTERED);
		}
	}

	private void cacheColor(final ChatColor chatColor, final ChatMessageType... types)
	{
		for (ChatMessageType chatMessageType : types)
		{
			// color is excluded from equals/hashCode on ChatColor
			colorCache.remove(chatMessageType, chatColor);
			colorCache.put(chatMessageType, chatColor);
		}
	}

	public void queue(QueuedMessage message)
	{
		queuedMessages.add(message);
	}

	public void process()
	{
		if (!queuedMessages.isEmpty())
		{
			queuedMessages.forEach(this::add);
			queuedMessages.clear();
		}
	}

	private void add(QueuedMessage message)
	{
		// this updates chat cycle
		client.addChatMessage(
			message.getType(),
			MoreObjects.firstNonNull(message.getName(), ""),
			MoreObjects.firstNonNull(message.getValue(), message.getRuneLiteFormattedMessage()),
			message.getSender());

		// Get last message from line buffer (the one we just added)
		final ChatLineBuffer chatLineBuffer = client.getChatLineMap().get(message.getType().getType());
		final MessageNode[] lines = chatLineBuffer.getLines();
		final MessageNode line = lines[0];

		// Update the message with RuneLite additions
		line.setRuneLiteFormatMessage(message.getRuneLiteFormattedMessage());
		update(line);
	}

	public void update(final MessageNode target)
	{
		if (Strings.isNullOrEmpty(target.getRuneLiteFormatMessage()))
		{
			return;
		}

		final boolean transparent = client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) != 0;
		final Collection<ChatColor> chatColors = colorCache.get(target.getType());

		// If we do not have any colors cached, simply set clean message
		if (chatColors == null || chatColors.isEmpty())
		{
			target.setValue(target.getRuneLiteFormatMessage());
			return;
		}

		target.setValue(recolorMessage(transparent, target.getRuneLiteFormatMessage(), target.getType()));
	}

	private String recolorMessage(boolean transparent, String message, ChatMessageType messageType)
	{
		final Collection<ChatColor> chatColors = colorCache.get(messageType);
		final AtomicReference<String> resultMessage = new AtomicReference<>(message);

		// Replace custom formatting with actual colors
		chatColors.stream()
			.filter(chatColor -> chatColor.isTransparent() == transparent)
			.forEach(chatColor ->
				resultMessage.getAndUpdate(oldMessage -> oldMessage.replaceAll(
					"<col" + chatColor.getType().name() + ">",
					ColorUtil.colorTag(chatColor.getColor()))));

		return resultMessage.get();
	}

	private void refreshAll()
	{
		executor.submit(() ->
		{
			client.getChatLineMap().values().stream()
				.filter(Objects::nonNull)
				.flatMap(clb -> Arrays.stream(clb.getLines()))
				.filter(Objects::nonNull)
				.forEach(this::update);

			client.refreshChat();
		});
	}
}


text:
<?php

namespace app\models;

/**
 * This is the ActiveQuery class for [[Jenis]].
 *
 * @see Jenis
 */
class JenisQuery extends \yii\db\ActiveQuery
{
    /*public function active()
    {
        return $this->andWhere('[[status]]=1');
    }*/

    /**
     * @inheritdoc
     * @return Jenis[]|array
     */
    public function all($db = null)
    {
        return parent::all($db);
    }

    /**
     * @inheritdoc
     * @return Jenis|array|null
     */
    public function one($db = null)
    {
        return parent::one($db);
    }
}


text:
name             'jgit'
maintainer       'Joshua Burt'
maintainer_email 'joshburt@shapeandshare.com'
license          'Apache v2.0'
description      'Installs/Configures jgit'
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
version          '1.4.0'
issues_url       'https://github.com/joshburt/jgit/issues'
source_url       'https://github.com/joshburt/jgit'


text:
/* global requestAnimationFrame */
import 'style-loader!css-loader!mocha-css'
import 'style-loader!css-loader!./helpers/style.css'

// create a div where mocha can add its stuff
const mochaDiv = document.createElement('DIV')
mochaDiv.id = 'mocha'
document.body.appendChild(mochaDiv)

import 'mocha/mocha.js'
import sinon from 'sinon'
import chai from 'chai'
window.mocha.setup({
  ui: 'bdd',
  slow: 750,
  timeout: 5000,
  globals: [
    '__VUE_DEVTOOLS_INSTANCE_MAP__',
    'script',
    'inject',
    'originalOpenFunction',
    // some chrome plugins things
    'pb_blacklist',
    'pb_whitelist',
    'pb_isRunning',
  ],
})
window.sinon = sinon
chai.use(require('chai-dom'))
chai.use(require('sinon-chai'))
window.should = chai.should()

let vms = []
let testId = 0

beforeEach(function () {
  this.DOMElement = document.createElement('DIV')
  this.DOMElement.id = `test-${++testId}`
  document.body.appendChild(this.DOMElement)
})

afterEach(function () {
  const testReportElements = document.getElementsByClassName('test')
  const lastReportElement = testReportElements[testReportElements.length - 1]

  if (!lastReportElement) return
  const el = document.getElementById(this.DOMElement.id)
  if (el) lastReportElement.appendChild(el)
  // Save the vm to hide it later
  if (this.DOMElement.vm) vms.push(this.DOMElement.vm)
})

// Hide all tests at the end to prevent some weird bugs
before(function () {
  vms = []
  testId = 0
})
after(function () {
  requestAnimationFrame(function () {
    setTimeout(function () {
      vms.forEach(vm => {
        // Hide if test passed
        if (vm.$el.parentElement &&
            !vm.$el.parentElement.classList.contains('fail')) {
          vm.$children[0].visible = false
        }
      })
    }, 100)
  })
})

const specsContext = require.context('./specs', true)
specsContext.keys().forEach(specsContext)

window.mocha.checkLeaks()
window.mocha.run()


text:
import PermissionInheritancePicker from "./PermissionInheritancePicker";

export { PermissionInheritancePicker };

export default PermissionInheritancePicker;


text:
{% with classes=field.css_classes label=label|default:field.label help_text=help_text|default:field.help_text required=field.field.required %}

{% include "helper/forms/errors.html" with errors=field.errors %}

{% if field_type == "radio" or is_checkboxmultiple %}

{{ label }}

      {% for widget in field %}

          {{ widget }}

      {% endfor %}
      {% if help_text %}{{ help_text }}{% endif %}

{% elif field_type == "checkbox" %}

          {{ field }}
          {{ label }}

        {% if help_text %}{{ help_text }}{% endif %}

{% else %}

  {% if label %}{% if field.id_for_label %}{% endif %}{{ label }}{% if field.id_for_label %}{% endif %}{% endif %}

    {{ field }}
    {% if help_text %}{{ help_text }}{% endif %}

{% endif %}
{% endwith %}


text:
        <title>The OPAL Operating System Project</title>

Opal

The Opal project is exploring a new operating system structure, tuned
to the needs of complex applications, such as CAD/CAM, where a number
of cooperating programs manipulate a large shared persistent database
of objects.  In Opal, all code and data exists with in a single, huge,
shared address space.  The single address space enhances sharing and
cooperation, because addresses have a unique (for all time)
interpretation.  Thus, pointer-based data structures can be directly
communicated and shared between programs at any time, and can be
stored directly on secondary storage without the need for translation.
This structure is simplified by the availability of a large address
space, such as those provided by the DEC Alpha, MIPS R4000,
HP/PA-RISC, and IBM RS6000.

Protection in Opal is independent of the single address space;
each Opal thread executes within a protection domain
that defines which virtual pages it has the right to access.
The rights to access a page can be easily transmitted from one
process to another.  The result is a much more flexible protection
structure,  permitting different (and dynamically changing)
protection options depending on the trust relationship
between cooperating parties.  We believe that this organization can
improve both the structure and performance of complex, cooperating
applications.

An Opal prototype has been built for the DEC Alpha platform on top of
the Mach operating system.

Information Sources

List of Opal-related papers.

Faculty Members

 Hank Levy

 Ed Lazowska

  Jeff Chase (Duke University)

Current Graduate Students

 Mike Feeley

 Ashutosh Tiwary

 Vivek Narasayya

 Dylan McNamee

Related Information

 Single
address space mailing list archive.


text:
package org.forestguardian.DataAccess.Local;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.util.Base64;

import com.google.gson.annotations.Expose;

import java.io.ByteArrayOutputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.UUID;

import io.reactivex.Observable;
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import io.realm.Realm;
import io.realm.RealmObject;
import io.realm.annotations.PrimaryKey;

/**
 * Created by emma on 17/03/17.
 */

public class User extends RealmObject {

    @PrimaryKey
    private long id;

    /*Fields */
    private String username;
    @Expose
    private String email;
    @Expose
    private String password;

    private String password_confirmation;

    private AuthData auth;

    @Expose
    private String name;

    private String avatar_url;

    @Expose
    private String avatar;

    @Expose
    private String firebase_registration_token;

    /*Setters and Getters*/

    public String getEmail() {
        return email;
    }

    public void setEmail(final String pEmail) {
        email = pEmail;
    }

    public AuthData getAuth() {
        return auth;
    }

    public void setAuth(final AuthData pAuth) {
        auth = pAuth;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(final String pPassword) {
        password = pPassword;
    }

    public String getPasswordConfirmation() {
        return password_confirmation;
    }

    public void setPasswordConfirmation(final String pPassword_confirmation) {
        password_confirmation = pPassword_confirmation;
    }

    public String getName() {
        return name;
    }

    public void setName(final String pName) {
        name = pName;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(final String pUsername) {
        username = pUsername;
    }

    public String getAvatarUrl() {
        return avatar_url;
    }

    public void setAvatarUrl(final String pAvatarUrl) {
        avatar_url = pAvatarUrl;
    }

    public String getFirebaseRegistrationToken() {
        return firebase_registration_token;
    }

    public void setFirebaseRegistrationToken(final String pFirebase_registration_token) {
        firebase_registration_token = pFirebase_registration_token;
    }

    public String getAvatar() {
        return avatar;
    }

    @SuppressWarnings("WeakerAccess")
    public byte[] getBase64DecodedAvatar(){
        if (avatar == null){
            return null;
        }

        String avatarData = avatar.replace("data:image/png;base64,","");
        return Base64.decode( avatarData, Base64.DEFAULT );
    }

    public Bitmap getUncompressedAvatar(){
        byte[] decodedString = getBase64DecodedAvatar();
        if (decodedString == null){
            return null;
        }
        return BitmapFactory.decodeByteArray(decodedString, 0, decodedString.length);
    }

    public void setAvatar(final String pAvatar) {
        avatar = pAvatar;
    }

    public void updateAvatar(){
        final long id = this.id;
        Observable.create(e -> {
            String avatar_url = Realm.getDefaultInstance().where(User.class).equalTo("id", id ).findFirst().getAvatarUrl();
            if (avatar_url == null){
                if (!e.isDisposed()){
                    e.onError(null);
                    e.onComplete();
                }
                return;
            }
            try {
                Bitmap picture = BitmapFactory.decodeStream(new URL(avatar_url).openConnection().getInputStream());
                if (!e.isDisposed()){
                    e.onNext(picture);
                    e.onComplete();
                }
            }catch(MalformedURLException error){
                error.printStackTrace();
                if (!e.isDisposed()){
                    e.onError(error);
                    e.onComplete();
                }
                return;
            }
        }).subscribeOn(Schedulers.newThread())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe( bitmap -> {
                if (bitmap != null) {

                    // Decode PNG
                    ByteArrayOutputStream stream = new ByteArrayOutputStream();
                    ((Bitmap)bitmap).compress(Bitmap.CompressFormat.PNG, 100, stream);
                    byte[] data = stream.toByteArray();
                    ((Bitmap)bitmap).recycle();
                    stream.close();

                    String base64Encoded = "data:image/png;base64," + Base64.encodeToString( data, Base64.DEFAULT );

                    // Persist
                    Realm realm = Realm.getDefaultInstance();
                    realm.beginTransaction();
                    User obj = realm.where(User.class).equalTo("id", id ).findFirst();
                    obj.setAvatar(base64Encoded);
                    obj.setUsername(UUID.randomUUID().toString());
                    realm.commitTransaction();
                }
            }, e -> {});
    }

    public void setId(final long pId) {
        id = pId;
    }

    public long getId() {
        return id;
    }
}


text:
import { Box } from '../classes';
import { FaceDetection } from '../classes/FaceDetection';
import { isWithFaceDetection } from '../factories/WithFaceDetection';
import { round } from '../utils';
import { DrawBox } from './DrawBox';
export function drawDetections(canvasArg, detections) {
    var detectionsArray = Array.isArray(detections) ? detections : [detections];
    detectionsArray.forEach(function (det) {
        var score = det instanceof FaceDetection
            ? det.score
            : (isWithFaceDetection(det) ? det.detection.score : undefined);
        var box = det instanceof FaceDetection
            ? det.box
            : (isWithFaceDetection(det) ? det.detection.box : new Box(det));
        var label = score ? "" + round(score) : undefined;
        new DrawBox(box, { label: label }).draw(canvasArg);
    });
}
//# sourceMappingURL=drawDetections.js.map


text:
var tableData = function () {
    var that = {};
    var _editTableData = function (item) {
        $.ajax({
            url: "/api/editTableData",
            type: "post",
            data: item,
            success: function (res) {
                console.log(res);
            },
            error: function (err, xhr) {
                console.log(err);
            }
        });
    };
    var _insertTableData = function (item) {
        $.ajax({
            url: "/api/insertTableData",
            type: "post",
            data: item,
            success: function (res) {
                console.log(res);
            },
            error: function (err, xhr) {
                console.log(err);
            }
        });
    };
    var _deleteTableData = function (item) {
        $.ajax({
            url: "/api/deleteTableData",
            type: "post",
            data: item,
            success: function (res) {
                console.log(res);
            },
            error: function (err, xhr) {
                console.log(err);
            }
        });
    };
    var _getTableField = function (data) {
        debugger;
        var schemaConst = function () {
            return { name: "", type: "text", width: 150, validate: "required" };
        };

        var sampleRow = data[0];
        var schema = {};
        var fieldsArray = [];
        for (var fieldName in sampleRow) {
            schema = new schemaConst();
            schema.name = fieldName;
            if (schema.name == "_id") { delete schema.validate; schema.visible = false; }
            fieldsArray.push(schema)
        }
        fieldsArray.push({ type: "control" });
        return fieldsArray;
    };
    var _loadTable = function () {
        $.ajax({
            url: "/api/tabledata",
            type: "get",
            success: function (result) {
                $("#jsGrid").jsGrid({
                    width: "100%",
                    height: "400px",
                    paging: true,
                    inserting: true,
                    editing: true,
                    sorting: true,
                    paging: true,
                    data: result,
                    fields: _getTableField(result),
                    onItemInserted: function (args) {
                        debugger;
                        // cancel insertion of the item with empty 'name' field
                        if (args.item.name === "") {
                            args.cancel = true;
                            alert("Specify the name of the item!");
                        }
                        _insertTableData(args.item);
                    },
                    onItemUpdating: function (args) {
                        debugger;
                        // cancel update of the item with empty 'name' field
                        if (args.item.name === "") {
                            args.cancel = true;
                            alert("Specify the name of the item!");
                        }
                        _editTableData(args.item);
                    },
                    onItemDeleted: function (args) {
                        debugger;
                        // cancel insertion of the item with empty 'name' field
                        if (args.item.name === "") {
                            args.cancel = true;
                            alert("Specify the name of the item!");
                        }
                        _deleteTableData(args.item);
                    },
                });
            },
            error: function (err, xhr) { }
        });
    };
    _loadTable();
};
tableData();


text:
package net.maffoo.jsonquote

import net.liftweb.json._
import net.maffoo.jsonquote.Macros._
import scala.language.experimental.macros

package object lift {
  /**
   * Rendering JValue produces valid json literal
   */
  implicit class LiftToLiteralJson(val json: JValue) extends AnyVal {
    def toLiteral: literal.Json = new literal.Json(compactRender(json))
  }

  implicit class RichJsonSringContext(val sc: StringContext) extends AnyVal {
    def json(args: Any*): JValue = macro jsonImpl
  }

  def jsonImpl(c: Context)(args: c.Expr[Any]*): c.Expr[JValue] = {
    import c.universe._

    // fully-qualified symbols and types (for hygiene)
    val bigInt = q"_root_.scala.math.BigInt"
    val list = q"_root_.scala.collection.immutable.List"
    val nil = q"_root_.scala.collection.immutable.Nil"
    val seq = q"_root_.scala.Seq"
    val jArray = q"_root_.net.liftweb.json.JArray"
    val jField = q"_root_.net.liftweb.json.JField"
    val jObject = q"_root_.net.liftweb.json.JObject"
    val writesT = tq"_root_.net.maffoo.jsonquote.lift.Writes"

    // convert the given json AST to a tree with arguments spliced in at the correct locations
    def splice(js: JValue)(implicit args: Iterator[Tree]): Tree = js match {
      case SpliceValue()  => spliceValue(args.next)
      case SpliceValues() => c.abort(c.enclosingPosition, "cannot splice values at top level")

      case JObject(members) =>
        val seqMembers = members.collect {
          case SpliceFields()       =>
          case SpliceFieldNameOpt() =>
          case SpliceFieldOpt(k)    =>
        }
        if (seqMembers.isEmpty) {
          val ms = members.map {
            case SpliceField()      => spliceField(args.next)
            case SpliceFieldName(v) => q"$jField(${spliceFieldName(args.next)}, ${splice(v)})"
            case JField(k, v)       => q"$jField($k, ${splice(v)})"
          }
          q"$jObject($list(..$ms))"
        } else {
          val ms = members.map {
            case SpliceField()      => q"$seq(${spliceField(args.next)})"
            case SpliceFields()     => spliceFields(args.next)
            case SpliceFieldNameOpt() => spliceFieldNameOpt(args.next, args.next)
            case SpliceFieldName(v) => q"$seq($jField(${spliceFieldName(args.next)}, ${splice(v)}))"
            case SpliceFieldOpt(k)  => spliceFieldOpt(k, args.next)
            case JField(k, v)       => q"$seq($jField($k, ${splice(v)}))"
          }
          q"$jObject($list(..$ms).flatten)"
        }

      case JArray(elements) =>
        val seqElems = elements.collect {
          case SpliceValues() =>
        }
        if (seqElems.isEmpty) {
          val es = elements.map {
            case SpliceValue()  => spliceValue(args.next)
            case e              => splice(e)
          }
          q"$jArray($list(..$es))"
        } else {
          val es = elements.map {
            case SpliceValue()  => q"$seq(${spliceValue(args.next)})"
            case SpliceValues() => spliceValues(args.next)
            case e              => q"$seq(${splice(e)})"
          }
          q"$jArray($list(..$es).flatten)"
        }

      case JString(s) => q"_root_.net.liftweb.json.JString($s)"
      case JDouble(n) => q"_root_.net.liftweb.json.JDouble($n)"
      case JInt(n)    => q"_root_.net.liftweb.json.JInt($bigInt(${n.toString}))"
      case JBool(b)   => q"_root_.net.liftweb.json.JBool($b)"
      case JNull      => q"_root_.net.liftweb.json.JNull"
    }

    def spliceValue(e: Tree): Tree = e.tpe match {
      case t if t <:< c.typeOf[JValue] => e
      case t =>
        inferWriter(e, t)
        q"implicitly[$writesT[$t]].write($e)"
    }

    def spliceValues(e: Tree): Tree = e.tpe match {
      case t if t <:< c.typeOf[Iterable[JValue]] => e
      case t if t <:< c.typeOf[Iterable[Any]] =>
        val valueTpe = typeParams(lub(t :: c.typeOf[Iterable[Nothing]] :: Nil))(0)
        val writer = inferWriter(e, valueTpe)
        q"$e.map($writer.write)"

      case t if t <:< c.typeOf[None.type] => nil
      case t if t <:< c.typeOf[Option[JValue]] => e
      case t if t <:< c.typeOf[Option[Any]] =>
        val valueTpe = typeParams(lub(t :: c.typeOf[Option[Nothing]] :: Nil))(0)
        val writer = inferWriter(e, valueTpe)
        q"$e.toIterable.map($writer.write)"

      case t => c.abort(e.pos, s"required Iterable[_] but got $t")
    }

    def spliceField(e: Tree): Tree = e.tpe match {
      case t if t <:< c.typeOf[JField] => e
      case t if t <:< c.typeOf[(String, JValue)] =>
        q"val (k, v) = $e; $jField(k, v)"
      case t if t <:< c.typeOf[(String, Any)] =>
        val valueTpe = typeParams(lub(t :: c.typeOf[(String, Nothing)] :: Nil))(1)
        val writer = inferWriter(e, valueTpe)
        q"val (k, v) = $e; $jField(k, $writer.write(v))"

      case t => c.abort(e.pos, s"required Iterable[(String, _)] but got $t")
    }

    def spliceFields(e: Tree): Tree = e.tpe match {
      case t if t <:< c.typeOf[Iterable[JField]] => e
      case t if t <:< c.typeOf[Iterable[(String, JValue)]] =>
        q"$e.map { case (k, v) => $jField(k, v) }"
      case t if t <:< c.typeOf[Iterable[(String, Any)]] =>
        val valueTpe = typeParams(lub(t :: c.typeOf[Iterable[(String, Nothing)]] :: Nil))(2)
        val writer = inferWriter(e, valueTpe)
        q"$e.map { case (k, v) => $jField(k, $writer.write(v)) }"

      case t if t <:< c.typeOf[None.type] => nil
      case t if t <:< c.typeOf[Option[JField]] =>
        q"$e.toIterable"
      case t if t <:< c.typeOf[Option[(String, JValue)]] =>
        q"$e.toIterable.map { case (k, v) => $jField(k, v) }"
      case t if t <:< c.typeOf[Option[(String, Any)]] =>
        val valueTpe = typeParams(lub(t :: c.typeOf[Option[(String, Nothing)]] :: Nil))(2)
        val writer = inferWriter(e, valueTpe)
        q"$e.toIterable.map { case (k, v) => $jField(k, $writer.write(v)) }"

      case t => c.abort(e.pos, s"required Iterable[(String, _)] but got $t")
    }

    def spliceFieldOpt(k: String, e: Tree): Tree = e.tpe match {
      case t if t <:< c.typeOf[None.type] => nil
      case t if t <:< c.typeOf[Option[JValue]] => q"$e.toIterable.map(v => $jField($k, v))"
      case t if t <:< c.typeOf[Option[Any]] =>
        val valueTpe = typeParams(lub(t :: c.typeOf[Option[Nothing]] :: Nil))(0)
        val writer = inferWriter(e, valueTpe)
        q"$e.toIterable.map { v => $jField($k, $writer.write(v)) }"

      case t => c.abort(e.pos, s"required Option[_] but got $t")
    }

    def spliceFieldName(e: Tree): Tree = e.tpe match {
      case t if t =:= c.typeOf[String] => e
      case t => c.abort(e.pos, s"required String but got $t")
    }

    def spliceFieldNameOpt(k: Tree, v: Tree): Tree = {
      k.tpe match {
        case t if t =:= c.typeOf[String] =>
        case t => c.abort(k.pos, s"required String but got $t")
      }
      v.tpe match {
        case t if t <:< c.typeOf[None.type] => nil
        case t if t <:< c.typeOf[Option[JValue]] => q"$v.toIterable.map(v => $jField($k, v))"
        case t if t <:< c.typeOf[Option[Any]] =>
          val valueTpe = typeParams(lub(t :: c.typeOf[Option[Nothing]] :: Nil))(0)
          val writer = inferWriter(v, valueTpe)
          q"$v.toIterable.map { v => $jField($k, $writer.write(v)) }"

        case t => c.abort(v.pos, s"required Option[_] but got $t")
      }
    }

    // return a list of type parameters in the given type
    // example: List[(String, Int)] => Seq(Tuple2, String, Int)
    def typeParams(tpe: Type): Seq[Type] = {
      val b = Iterable.newBuilder[Type]
      tpe.foreach(b += _)
      b.result.drop(2).grouped(2).map(_.head).toIndexedSeq
    }

    // locate an implicit Writes[T] for the given type
    def inferWriter(e: Tree, t: Type): Tree = {
      val writerTpe = appliedType(c.typeOf[Writes[_]], List(t))
      c.inferImplicitValue(writerTpe) match {
        case EmptyTree => c.abort(e.pos, s"could not find implicit value of type Writes[$t]")
        case tree => tree
      }
    }

    // Parse the string context parts into a json AST with holes, and then
    // typecheck/convert args to the appropriate types and splice them in.
    c.prefix.tree match {
      case Apply(_, List(Apply(_, partTrees))) =>
        val parts = partTrees map { case Literal(Constant(const: String)) => const }
        val positions = (parts zip partTrees.map(_.pos)).toMap
        val js = try {
          Parse(parts)
        } catch {
          case JsonError(msg, Pos(s, ofs)) =>
            val pos = positions(s)
            c.abort(pos.withPoint(pos.point + ofs), msg)
        }
        c.Expr[JValue](splice(js)(args.iterator.map(_.tree)))

      case _ =>
        c.abort(c.enclosingPosition, "invalid")
    }
  }
}


text:
#include "stm32f7xx_hal.h"
#include <diag\Trace.h>
#include <assert.h>

#define MY_CLOCK
#ifdef  MY_CLOCK

#include <time.h>
#include <sys\time.h>
#include <sys\times.h>

#include <errno.h>

#ifdef errno
#undef errno
#endif
extern int errno;
extern "C" uint64_t sys_usec();
#define USEC (1000000U)
#define MSEC (1000U)

#define HAL_INCRMENT (USEC/(MSEC))-1
volatile uint32_t HAL_Ticks = 0;

struct timer_config {
	void* arg;
	time_t (*callback)(void*);
	time_t usec_left;
};

// disabed so I don't have second interrupts each time
//#define OVERFLOW_ON_SECOND

#ifdef OVERFLOW_ON_SECOND
#define OC_MAX_INCRMENT (USEC-1)
#else
#define OC_MAX_INCRMENT UINT32_MAX
#endif

static volatile uint32_t 		TimerOverflow = 0;
static volatile timer_config	g_timer_info[4];
// set up posic timers from comp
template<typename FUNC>
__attribute__((always_inline)) static inline void run_tim_flag(TIM_TypeDef* TIM, const uint32_t flag, FUNC func ) {
	if((TIM->DIER & flag) && (TIM->SR & flag)) {
		// we can get away with this because the intterrupt enable is in the same place as the SR
		func();
		TIM2->SR &= ~(flag); // clear it
	}
}
static inline uint32_t process_timer(int index) {
	auto& info = g_timer_info[index];
	uint32_t cnt = info.usec_left;
	if(info.usec_left == 0)
		cnt = info.callback(info.arg);
	if(cnt == 0) return 0;
	else if(cnt > OC_MAX_INCRMENT){
		info.usec_left = cnt - OC_MAX_INCRMENT;
		return OC_MAX_INCRMENT;
	} else {
		return cnt;
	}
}

__attribute__((weak)) void TimeBaseSecondCallback()  {}
extern "C" void TIM2_IRQHandler() {
	static_assert(TIM_DIER_UIE == TIM_SR_UIF, "Safety check");
	run_tim_flag(TIM2, TIM_SR_UIF,[]() {
		TimerOverflow++;
	#ifdef OVERFLOW_ON_SECOND
		TimeBaseSecondCallback();
	#endif
	});
	static_assert(TIM_DIER_CC1IE == TIM_SR_CC1IF, "Safety check");
	run_tim_flag(TIM2, TIM_SR_CC1IF,[]() {
		uint32_t cnt = process_timer(0);
		if(cnt == 0) {
			TIM2->DIER &= TIM_DIER_CC1IE; // disable the interrupt
		} else {
			TIM2->CCR1 = cnt; // set new count regester
		}
	});
	static_assert(TIM_DIER_CC2IE == TIM_SR_CC2IF, "Safety check");
	run_tim_flag(TIM2, TIM_SR_CC2IF,[]() {
		uint32_t cnt = process_timer(1);
		if(cnt == 0) {
			TIM2->DIER &= TIM_DIER_CC2IE; // disable the interrupt
		} else {
			TIM2->CCR2 = cnt; // set new count regester
		}
	});
	static_assert(TIM_DIER_CC3IE == TIM_SR_CC3IF, "Safety check");
	run_tim_flag(TIM2, TIM_SR_CC3IF,[]() {
		uint32_t cnt = process_timer(2);
		if(cnt == 0) {
			TIM2->DIER &= TIM_DIER_CC3IE; // disable the interrupt
		} else {
			TIM2->CCR3 = cnt; // set new count regester
		}
	});
	static_assert(TIM_DIER_CC4IE == TIM_SR_CC4IF, "Safety check");
	run_tim_flag(TIM2, TIM_SR_CC4IF,[]() {
		uint32_t cnt = process_timer(3);
		if(cnt == 0) {
			TIM2->DIER &= TIM_DIER_CC4IE; // disable the interrupt
		} else {
			TIM2->CCR4 = cnt; // set new count regester
		}
	});
}

// this is pure atomic
extern "C" uint64_t sys_usec() {
	uint32_t counter= TIM2->CNT;
	uint64_t overflow = TimerOverflow;
	if(counter > TIM2->CNT){// rare but the timer reset here turned over
		overflow= TIM2->CNT;
		++overflow;
	}
#ifdef OVERFLOW_ON_SECOND
	overflow *= USEC;
	overflow += counter;
#else
	overflow *= UINT32_MAX;
	overflow += counter;
#endif
	return overflow;
}
extern "C"  int clock_gettime(clockid_t clk_id, struct timespec *tp){
	(void)clk_id; // clock id dosn't matter right now
	if(tp){
		uint32_t counter= TIM2->CNT;
		uint32_t overflow = TimerOverflow;
		if(counter > TIM2->CNT){// rare but the timer reset here turned over
			overflow= TIM2->CNT;
			++overflow;
		}
		tp->tv_sec = overflow;
		tp->tv_nsec = counter * 1000U; // to nsec
		return 0;
	}
	errno = EFAULT;
	return -1;

}
// pure atomic
extern "C" void microtime(struct timeval* tv) {
	assert(tv);
#ifdef OVERFLOW_ON_SECOND
	uint32_t counter= TIM2->CNT;
	uint32_t overflow = TimerOverflow;
	if(counter > TIM2->CNT){// rare but the timer reset here turned over
		overflow= TIM2->CNT;
		++overflow;
	}
	tv->tv_sec = overflow;
	tv->tv_usec = counter;
#else
	uint32_t counter= TIM2->CNT;
	uint64_t overflow = TimerOverflow;
	overflow *= UINT32_MAX;
	if(counter > TIM2->CNT) {// rare but the timer reset here turned over
		overflow= TIM2->CNT;
		overflow+=UINT32_MAX;
	}
	overflow+= counter;
	tv->tv_sec = counter / USEC;
	tv->tv_usec = counter  % USEC;
#endif
}

extern "C" clock_t _times (struct tms *buf)
{
	uint64_t stamp = sys_usec();
	if(buf) {
		uint64_t sec = stamp/ USEC;
		buf->tms_utime  = sec;
		buf->tms_stime   = sec;
		buf->tms_cutime   = sec;
		buf->tms_cstime   = sec;
	}
	stamp*= _CLOCKS_PER_SEC_;
	stamp /= USEC;
 // errno = EINVAL;
  return stamp;
}

extern "C" clock_t clock() {
	uint64_t stamp = sys_usec();
	stamp*= _CLOCKS_PER_SEC_;
	stamp /= USEC;
	return stamp;
}

extern "C" int _gettimeofday(struct timeval *__p, void *__tz){
	if(__p) {
		microtime(__p);
		return -1;
	}
	if(__tz) {
		(void)__tz;
	}
	return 0;
}

#define MAX_MSEC (0xFFFFFFFF/MSEC)

extern "C" void HAL_Delay(__IO uint32_t Delay)
{
	if(Delay < OC_MAX_INCRMENT){
		Delay *= 1000U;
		 uint32_t tickstart = TIM2->CNT;
		 while((TIM2->CNT - tickstart) < Delay) {}
	} else {
		assert(0); // wow, thats a looong time
	}
#if 0
  uint32_t tickstart = 0;
  tickstart = HAL_GetTick();
  while((HAL_GetTick() - tickstart) < Delay)
  {
  }
#endif
}

extern "C" uint32_t HAL_GetTick(void)
{
	uint64_t stamp = sys_usec();
	return stamp / 1000U;

}
#include <os/irq.h>
void isr_mem_test() {
	TIM2_IRQHandler() ;
}

// configures TIM2 as a clock source
extern "C" HAL_StatusTypeDef HAL_InitTick (uint32_t TickPriority)
{
  TIM2->CR1 = 0;	// disable evetyhing
  TIM2->CR2 = 0;	// disable evetyhing
  TIM2->DIER = 0;	// and disable interrupts
  TIM2->SR = 0;		// and make sure the flags are cleared
  TimerOverflow = 0;

  // TickPriority RELALY needs to be super high
 // HAL_NVIC_SetPriority(TIM2_IRQn, TickPriority ,0U);
  install_isr(TIM2_IRQn,isr_mem_test);

  HAL_NVIC_SetPriority(TIM2_IRQn, TickPriority ,0U);
  HAL_NVIC_EnableIRQ(TIM2_IRQn);
  __HAL_RCC_TIM2_CLK_ENABLE();

  /* Compute TIM2 clock */
  uint32_t uwTimclock = HAL_RCC_GetPCLK1Freq();
  if ((uint32_t)(RCC->CFGR & RCC_CFGR_PPRE1) != 0) // ABA prescaler
    uwTimclock *= 2;

  /* Compute the prescaler value to have TIM2 counter clock equal to 1MHz */
  TIM2->PSC  = (uint32_t) ((uwTimclock / USEC) - 1U);
  TIM2->CNT = 0; // count reset
  TIM2->ARR = OC_MAX_INCRMENT ;// auto reload
#if 1
  // not sure we need below but just in case?
  TIM2->EGR = TIM_EGR_UG; // generate to update the presaler, only for tim1 and tim8?
  TIM2->CR1 |= TIM_CR1_CEN; // enable timer
  while((TIM2->SR & TIM_SR_UIF)==0);
  TIM2->CR1 &= ~TIM_CR1_CEN; // disable timer
  TIM2->SR = 0; // clear all flags
#endif
  // now we start it up!
  TIM2->CR1 |= TIM_CR1_CEN; // enable timer
  TIM2->DIER |= TIM_DIER_UIE; // enable interrput
  /* Return function status */
  return HAL_OK;
}

/**
  * @brief  Suspend Tick increment.
  * @note   Disable the tick increment by disabling TIM6 update interrupt.
  * @retval None
  */
void HAL_SuspendTick(void) // can never be disabled
{
  /* Disable TIM6 update Interrupt */
 // __HAL_TIM_DISABLE_IT(&TimHandle, TIM_IT_UPDATE);
}

/**
  * @brief  Resume Tick increment.
  * @note   Enable the tick increment by Enabling TIM6 update interrupt.
  * @retval None
  */
void HAL_ResumeTick(void)
{
  /* Enable TIM6 Update interrupt */
 // __HAL_TIM_ENABLE_IT(&TimHandle, TIM_IT_UPDATE);
}

#endif


text:
package com.emma.www.toumingapp;

import android.Manifest;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

    private static final int PERMISSIONS_REQUEST_CAMERA = 454;
    private Context mContext;
    static final String PERMISSION_CAMERA = Manifest.permission.CAMERA;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        mContext = this;
        findViewById(R.id.text)
                .setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View view) {
                        checkSelfPermission();
                    }
                });
    }

    /**
     * 检查权限
     */
    void checkSelfPermission() {
        if (ContextCompat.checkSelfPermission(mContext, PERMISSION_CAMERA) != PackageManager.PERMISSION_GRANTED) {
            ActivityCompat.requestPermissions(this,
                    new String[]{PERMISSION_CAMERA},
                    PERMISSIONS_REQUEST_CAMERA);
        } else {
//            setTransparentWallpaper();
            startWallpaper();
        }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        switch (requestCode) {
            case PERMISSIONS_REQUEST_CAMERA: {
                // If request is cancelled, the result arrays are empty.
                if (grantResults.length > 0
                        && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
//                    setTransparentWallpaper();
                    startWallpaper();

                } else {
                    Toast.makeText(mContext, getString(R.string._lease_open_permissions), Toast.LENGTH_SHORT).show();
                }
                return;
            }
        }
    }

    /**
     * 选择壁纸
     */
    void startWallpaper() {
        final Intent pickWallpaper = new Intent(Intent.ACTION_SET_WALLPAPER);
        Intent chooser = Intent.createChooser(pickWallpaper, getString(R.string.choose_wallpaper));
        startActivity(chooser);
    }

    /**
     * 不需要手动启动服务
     */
    void setTransparentWallpaper() {
        startService(new Intent(mContext, CameraLiveWallpaper.class));
    }
}


text:
#include "tensorflow/lite/kernels/internal/reference/elu.h"

#include <algorithm>
#include <limits>

#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/kernels/internal/cppmath.h"
#include "tensorflow/lite/kernels/internal/quantization_util.h"
#include "tensorflow/lite/kernels/internal/reference/process_broadcast_shapes.h"
#include "tensorflow/lite/kernels/internal/types.h"
#include "tensorflow/lite/kernels/kernel_util.h"
#include "tensorflow/lite/micro/kernels/kernel_util.h"
#include "tensorflow/lite/micro/micro_log.h"

namespace tflite {
namespace {

// Input/output tensor index.
constexpr int kInputTensor = 0;
constexpr int kOutputTensor = 0;

// OLD-TODO(b/142762739): We should figure out a multi-threading plan for most
// of the activation ops below.

struct OpData {
  int8_t table[256];
};

using TransformFunc = float (*)(float);

template <typename T>
void PopulateLookupTable(const TfLiteTensor* input, const TfLiteTensor* output,
                         const TransformFunc transform, OpData* data) {
  if (sizeof(T) != 1) {
    MicroPrintf("Lookup table valid only for 8bit");
    TFLITE_ABORT;
  }

  const float inverse_scale = 1 / output->params.scale;
  int32_t maxval = std::numeric_limits<T>::max();
  int32_t minval = std::numeric_limits<T>::min();
  for (int32_t val = minval; val <= maxval; ++val) {
    const float dequantized =
        input->params.scale * (val - input->params.zero_point);
    const float transformed = transform(dequantized);
    const float rescaled = TfLiteRound(transformed * inverse_scale);
    const int32_t quantized =
        static_cast<int32_t>(rescaled + output->params.zero_point);
    data->table[static_cast<uint8_t>(static_cast<T>(val))] =
        static_cast<T>(std::max(std::min(maxval, quantized), minval));
  }
}

// OLD-TODO(b/143696793): move this to optimized_ops.
void EvalUsingLookupTable(const OpData* data, const TfLiteEvalTensor* input,
                          TfLiteEvalTensor* output) {
  const int size = MatchingFlatSize(tflite::micro::GetTensorShape(input),
                                    tflite::micro::GetTensorShape(output));
  int8_t* output_data = tflite::micro::GetTensorData<int8_t>(output);
  const int8_t* input_data = tflite::micro::GetTensorData<int8_t>(input);

  for (int i = 0; i < size; ++i) {
    output_data[i] = data->table[static_cast<uint8_t>(input_data[i])];
  }
}

TfLiteStatus CalculateOpData(TfLiteContext* context, TfLiteNode* node) {
  MicroContext* micro_context = GetMicroContext(context);

  TF_LITE_ENSURE_EQ(context, NumInputs(node), 1);
  TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1);
  TfLiteTensor* input =
      micro_context->AllocateTempInputTensor(node, kInputTensor);
  TF_LITE_ENSURE(context, input != nullptr);
  TfLiteTensor* output =
      micro_context->AllocateTempOutputTensor(node, kOutputTensor);
  TF_LITE_ENSURE(context, output != nullptr);
  TF_LITE_ENSURE_TYPES_EQ(context, input->type, output->type);

  // Use LUT to handle quantized elu path.
  if (input->type == kTfLiteInt8) {
    OpData* data = static_cast<OpData*>(node->user_data);
    TransformFunc transform = [](float value) {
      return value < 0.0f ? std::exp(value) - 1.0f : value;
    };
    PopulateLookupTable<int8_t>(input, output, transform, data);
  }
  micro_context->DeallocateTempTfLiteTensor(input);
  micro_context->DeallocateTempTfLiteTensor(output);
  return kTfLiteOk;
}

void* EluInit(TfLiteContext* context, const char* buffer, size_t length) {
  // This is a builtin op, so we don't use the contents in 'buffer', if any.
  // Instead, we allocate a new object to carry information from Prepare() to
  // Eval().
  TFLITE_DCHECK(context->AllocatePersistentBuffer != nullptr);
  return context->AllocatePersistentBuffer(context, sizeof(OpData));
}

TfLiteStatus EluPrepare(TfLiteContext* context, TfLiteNode* node) {
  return CalculateOpData(context, node);
}

TfLiteStatus EluEval(TfLiteContext* context, TfLiteNode* node) {
  const TfLiteEvalTensor* input =
      tflite::micro::GetEvalInput(context, node, kInputTensor);
  TfLiteEvalTensor* output =
      tflite::micro::GetEvalOutput(context, node, kOutputTensor);
  switch (input->type) {
    case kTfLiteFloat32: {
      reference_ops::Elu(tflite::micro::GetTensorShape(input),
                         tflite::micro::GetTensorData<float>(input),
                         tflite::micro::GetTensorShape(output),
                         tflite::micro::GetTensorData<float>(output));
      return kTfLiteOk;
    }
    case kTfLiteInt8: {
      const OpData* data = static_cast<OpData*>(node->user_data);
      EvalUsingLookupTable(data, input, output);
      return kTfLiteOk;
    }
    default:
      MicroPrintf("ELU only supports float32 and int8 currently, got %s.",
                  TfLiteTypeGetName(input->type));
      return kTfLiteError;
  }
}

}  // namespace

TfLiteRegistration Register_ELU() {
  return tflite::micro::RegisterOp(EluInit, EluPrepare, EluEval);
}

}  // namespace tflite


text:
package com.wujingchao.android.demo.supportLibrary.design;

import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.wujingchao.android.demo.R;

class ViewHolder extends RecyclerView.ViewHolder {

        TextView textView;

        public ViewHolder(View itemView) {
            super(itemView);
            textView = (TextView) itemView.findViewById(R.id.textview);
        }
    }


text:
%!TEX root=../main9.tex
\textbf{progress}
\begin{block}
\item[ \eqref{prog0} ]{$\neg req = \emptyset \quad \mapsto\quad \neg req_0 \subseteq req$} %
\item[ \eqref{prog1} ]{$V = req \quad \mapsto\quad req \subset V  %
      \1\lor req = \emptyset \1\lor \neg req \subseteq req_0$} %
\end{block}


text:
[![Gem Version](https://badge.fury.io/rb/smalruby.png)](http://badge.fury.io/rb/smalruby)
[![Build Status](https://travis-ci.org/smalruby/smalruby.png?branch=master)](https://travis-ci.org/smalruby/smalruby)

smalruby is a 2D game development library. This is part of "Smalruby"
project that is a learning ruby programming environment for kids.

## Requirement

* Windows or UNIX like OS (MAC OS X, Linux, etc...)
* Ruby 2.0.0-p353 or higher
* dxruby_sdl (for Mac OS X and Linux): https://github.com/smalruby/dxruby_sdl
* rsdl (for Mac OS X): http://www.kumaryu.net/proj/ruby-rsdl/

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'smalruby'
```

And then execute:

```
$ bundle
```

Or install it yourself as:

```
$ gem install smalruby
```

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request


text:
require 'rails_helper'

feature 'roles' do
  scenario 'remove a user from a role' do
    role

    admin_sign_in
    role.add_user(user)
    visit admin_path

    click_link 'Roles'
    click_link role.name
    click_link 'Revoke'

    expect(page).to_not have_link user.email
  end
end


text:
---
uid: SolidEdgePart.ComponentSketches.Count
summary:
remarks:
---


text:
/*************************************************************************
 * Description: 相册图片选择组件
 * Author: raojia
 * Mail: raojia@le.com
 * Created Time: 2017-02-18
 * Modified Time: 2017-02-18
 ************************************************************************/
'use strict';

const { NativeModules } = require('react-native');
const ImagePickerAPI = NativeModules.ImagePickerModule;

const DEFAULT_OPTIONS = {
  title: '选取图片或视频',
  cancelButtonTitle: '取消',
  takePhotoButtonTitle: '拍摄',
  chooseFromLibraryButtonTitle: '从手机相册选择',
  quality: 1.0,
  allowsEditing: false
};

module.exports = {
  ...ImagePickerAPI,
  showImagePicker: function showImagePicker(options, callback) {
    if (typeof options === 'function') {
      callback = options;
      options = {};
    }
    return ImagePickerAPI.showImagePicker({...DEFAULT_OPTIONS, ...options}, callback);
  }
};


text:
#include "List.h"

typedef struct drListNode {
	void    *data;
	struct  drListNode *np; ///< pointer to (begin XOR end) node
} drListNode;

typedef struct drList {
	drListNode  *head,
	            *tail;
	size_t      size;
	void (*destructor)(void* data); // optional destructor, may be free
} drList;

typedef struct drListIter drListIter;

///////////////////////////////////////////////////////////
/// Private
drListNode*
xor (drListNode *a, drListNode *b){
	return (drListNode*) ((uintptr_t) a ^ (uintptr_t) b);
}

///////////////////////////////////////////////////////////
/// Public
drList*
drList_create (
	void (*destructor)(void* data) // optional destructor, can be free/NULL/own function.
){
	drList *ptr = malloc (sizeof (drList));
	ptr->head = ptr->tail = NULL;
	ptr->size = 0;
	ptr->destructor = destructor;
	return ptr;
}

void
drList_destroy (
	drList *self
){
	while (! drList_empty (self)){
		if (self->destructor != NULL)
			self->destructor (drList_front (self));
		drList_delete (self, 1);
	}
	free (self);
}

void
drList_insert (
	drList *self,
	void *data,
	bool at_tail
){
	if (at_tail)
		drListIter_insert (drList_end (self), data);
	else
		drListIter_insert (drList_begin (self), data);
}

void
drList_delete (
	drList *self,
	bool from_tail
){
	if (from_tail)
		drListIter_erase (drList_rbegin (self));
	else
		drListIter_erase (drList_begin (self));
}

void*
drList_front (drList *self){
	return drListIter_get (drList_rbegin (self));
}

void*
drList_back (drList *self){
	return drListIter_get (drList_begin (self));
}

///////////////////////////////////////////////////////////
drListIter
drList_begin (
	drList *self
){
	drListIter it = {NULL, self->head, NULL, self};
	if (self->head)
		it.next = xor (NULL, self->head->np);
	return it;
}

drListIter
drList_end (
	drList *self
){
	return (drListIter){self->tail, NULL, NULL, self};
}

drListIter
drList_rbegin (
	drList *self
){
	drListIter it = {NULL, self->tail, NULL, self};
	if (self->tail)
		it.prev = xor (self->tail->np, NULL);
	return it;
}

drListIter
drList_rend (
	drList *self
){
	return (drListIter){NULL, NULL, self->head, self};
}

void*
drListIter_get (
	drListIter self
){
	assert (self.curr);
	return self.curr->data;
}

void
drListIter_next (
	drListIter *self
){
	assert (self && (self->curr || self->next));
	drListIter it = {self->curr, self->next, NULL, self->list};
	if (it.curr)
		it.next = xor (it.curr->np, it.prev);
	*self = it;
}

void
drListIter_prev (
	drListIter *self
){
	assert (self && (self->curr || self->prev));
	drListIter it = {NULL, self->prev, self->curr, self->list};
	if (it.curr)
		it.prev = xor (it.curr->np, it.next);
	*self = it;
}

bool
drListIter_equal (
	drListIter *self,
	drListIter iter
){
	return (self->curr == iter.curr);
}

bool
drListIter_isEnd (
	drListIter *self
){
	return (self->curr == NULL);
}

/**
 * Is able to insert new element BEFORE 'self' pointer.
 * @param  self Pointer
 * @param  data Data
 * @return      Iterator on the brand new element
 */
drListIter
drListIter_insert (
	drListIter self,
	void *data
){
	drListNode *ptr = malloc (sizeof (drListNode));
	assert (ptr);
	ptr->data = data;

	// list is empty
	if (self.list->head == NULL){
		assert (!self.list->size);
		self.curr = self.list->head = self.list->tail = ptr;
		ptr->np = xor (NULL, NULL);
		self.list->size = 1;
		return self;
	}
	assert (self.list->size > 0); // list must have at least one element
	if (self.list->head == self.curr){ // at beginning
		assert (self.prev == NULL);
		self.list->head = ptr;
	}
	if (self.list->tail == self.prev){ // at the end
		assert (self.curr == NULL);
		self.list->tail = ptr;
	}
	drListIter before = self;
	drListIter_prev (&before);
	ptr->np = xor (before.curr, self.curr);
	if (self.curr)
		self.curr->np = xor (ptr, self.next);
	if (before.curr)
		before.curr->np = xor (before.prev, ptr);
	self.next = self.curr;
	self.curr = ptr;
	self.prev = before.curr;

	self.list->size++;
	assert (! drList_empty (self.list));

	return self;
}

/**
 * Delete the element pointed by self and return iterator on next element.
 * @param  self Element to delete
 * @return      Iterator on the next element
 */
drListIter
drListIter_erase (
	drListIter self
){
	assert (self.list->head != NULL && self.list->size > 0);
	assert (self.curr);
	drListIter before = self, after = self;
	drListIter_prev (&before);
	drListIter_next (&after);
	if (self.list->head == self.curr)
		self.list->head = self.next;
	if (self.list->tail == self.curr)
		self.list->tail = self.prev;
	if (before.curr){
		before.curr->np = xor (before.prev, self.next);
		before.next = self.next;
	}
	if (after.curr){
		after.curr->np = xor (self.prev, after.next);
		after.prev = self.prev;
	}
	free (self.curr);

	assert (after.list->size > 0);
	after.list->size--;

	return after;
}

/**
 * Swaps values of two iterators
 * @param x
 * @param y
 */
void
drListIter_swap (
	drListIter *x,
	drListIter *y
){
	swap (x->curr->data, y->curr->data);
}

void
drList_sort (
	drList *self,
	int (*data_cmp)(void *x, void *y)
){
	drListIter i = drList_begin (self), j;
	for (; !drListIter_equal (&i, drList_end (self)); drListIter_next (&i)){
		j = i;
		drListIter_next (&j);
		for (; !drListIter_equal (&j, drList_end (self)); drListIter_next (&j))
			if (data_cmp (i.curr->data, j.curr->data) == 1)
				drListIter_swap (&i, &j);
	}
}

bool
drList_empty (
	drList *self
){
	return !self->size;
}

/**
 * @return Counter of elements in list. O(1)
 */
size_t
drList_size (
	drList *self
){
	return self->size;
}