text:
TF1* GetTPCCorrection(TString type){
   TString Map="TPCCorrMaps_5TeV.root";
   TFile *f = TFile::Open(Form("$ALICE_PHYSICS/PWGHF/hfe/macros/%s", Map.Data()));
   if (!f->IsOpen()) {
      printf("TPC map file not found \n");
      return 0;
   }
   gROOT->cd();
   TF1* CorrectionFunction(NULL);
   if (type == "Momentum") {
      CorrectionFunction = (TF1*) f->GetObjectChecked("TPCnsigmavspcor","TF1");
      if(!CorrectionFunction) printf("TPCCorrMaps_5TeV.root:TPCnsigmavspcor not found \n");
   } else if (type == "Momentum_Width"){
      CorrectionFunction = (TF1*) f->GetObjectChecked("TPCnsigmavspcor_width","TF1");
      if(!CorrectionFunction) printf("TPCCorrMaps_5TeV.root:TPCnsigmavspcor_width not found \n");
   } else if (type == "Eta"){
      CorrectionFunction = (TF1*) f->GetObjectChecked("TPCnsigmavsetacor","TF1");
      if(!CorrectionFunction) printf("TPCCorrMaps_5TeV.root:TPCnsigmavsetacor not found \n");
   } else if (type == "Eta_Width"){
      CorrectionFunction = (TF1*) f->GetObjectChecked("TPCnsigmavsetacor_width","TF1");
      if(!CorrectionFunction) printf("TPCCorrMaps_5TeV.root:TPCnsigmavsetacor_width not found \n");
   }
   return CorrectionFunction;
}

AliAnalysisTaskHFE* ConfigHFEnpepp5New(Bool_t useMC, Bool_t isAOD, TString appendix,
                                    UChar_t TPCcl=70, UChar_t TPCclPID = 80,
                                    UChar_t ITScl=3, Double_t DCAxy=1000., Double_t DCAz=1000.,
                                    Double_t* tpcdEdxcutlow=NULL, Double_t* tpcdEdxcuthigh=NULL,
                                    Double_t TOFs=3., Int_t TOFmis=0,
                                    Int_t itshitpixel = 0, Int_t ikink = 0,
                                    Double_t etami=-0.8, Double_t etama=0.8,
                                    Double_t assETAm=-0.8, Double_t assETAp=0.8,
                                    Double_t assMinPt=0.2, Int_t assITS=2,
                                    Int_t assTPCcl=100, Int_t assTPCPIDcl=80,
                                    Double_t assDCAr=1.0, Double_t assDCAz=2.0,
                                    Double_t *assTPCSminus=NULL, Double_t *assTPCSplus=NULL,
                                    Double_t assITSpid=-3., Double_t assTOFs=3.,
                                    Bool_t useCat1Tracks = kTRUE, Bool_t useCat2Tracks = kTRUE, Int_t weightlevelback = -1,
                                    Int_t HadronContFunc=0, Int_t PrimaryVertexTyp)
{

   Bool_t etacor = false;
   Bool_t MomCor = true;

   //***************************************//
   //        Setting up the HFE cuts        //
   //***************************************//

   AliHFEcuts *hfecuts = new AliHFEcuts(appendix,"HFE cuts for pp");
   //hfecuts->SetQAOn();
   hfecuts->CreateStandardCuts();
   if(isAOD) hfecuts->SetAODFilterBit(4); // standard cuts with very loose DCA

   hfecuts->SetMinNClustersTPC(TPCcl);
   hfecuts->SetMinNClustersTPCPID(TPCclPID);
   hfecuts->SetMinNClustersITS(ITScl);
   hfecuts->SetMinRatioTPCclusters(0.6);
   hfecuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
   hfecuts->SetCutITSpixel(itshitpixel);
   hfecuts->SetCheckITSLayerStatus(kFALSE);
   hfecuts->SetEtaRange(etami,etama);
   hfecuts->SetRejectKinkDaughters();
   if (ikink == 0){
      hfecuts->SetRejectKinkMothers();
   } else {
      hfecuts->SetAcceptKinkMothers();
   }
   hfecuts->SetMaxImpactParam(DCAxy,DCAz);

   if(PrimaryVertexTyp==1){
      hfecuts->SetUseMixedVertex(kFALSE);
      hfecuts->SetUseSPDVertex(kFALSE);
      hfecuts->SetUseTrackVertex(kTRUE);
   } else if(PrimaryVertexTyp==2){
      hfecuts->SetUseMixedVertex(kFALSE);
      hfecuts->SetUseSPDVertex(kTRUE);
      hfecuts->SetUseTrackVertex(kFALSE);
   } else{
      hfecuts->SetUseMixedVertex(kTRUE);
      hfecuts->SetUseSPDVertex(kFALSE);
      hfecuts->SetUseTrackVertex(kFALSE);
   }

   hfecuts->SetVertexRange(10.);

   if (hfecuts->GetUseSPDVertex() || hfecuts->GetUseMixedVertex() ) {
      //if SPD vertices are used acivate resolution cut
      printf("########## Additional cut for SPD vertex resolution ######### \n");
      hfecuts->SetSPDVtxResolutionCut();
   }

   // TOF settings:
   Int_t usetof=0;
   Bool_t kTOFmis=kFALSE;
   if (TOFs>0.){
      usetof = 1;
      printf("CONFIGURATION FILE: TOF is used \n");
      hfecuts->SetTOFPIDStep(kTRUE);
      printf("CONFIGURATION FILE: TOF PID step is requested !!!! \n");
      if (TOFmis>0){
         kTOFmis = kTRUE;
         printf("CONFIGURATION FILE: TOF mismatch rejection is set ON \n");
      }
   }

   //***************************************//
   //        Setting up the task            //
   //***************************************//

   AliAnalysisTaskHFE *task = new AliAnalysisTaskHFE(Form("HFEtask%s",appendix.Data()));
   printf("task %p\n", task);
   task->SetppAnalysis();
   //if(!isAOD) task->SetRemoveFirstEventInChunk();
   task->SetRemovePileUp(kTRUE);
   task->SetHFECuts(hfecuts);
   task->GetPIDQAManager()->SetHighResolutionHistos();

   //***************************************//
   //          Variable manager             //
   //***************************************//
   // Define Variables
   //standard binning
   Double_t ptbinning[36] = {0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1., 1.1, 1.2, 1.3, 1.4, 1.5, 1.75, 2., 2.25, 2.5, 2.75, 3., 3.5, 4., 4.5, 5., 5.5, 6., 7., 8., 10., 12., 14., 16., 18., 20.};
   Double_t etabinning[17] = {-0.8, -0.7, -0.6, -0.5, -0.4, -0.3, -0.2, -0.1, 0., 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8};

   Double_t phibinning[5] = {0, 0.5*TMath::Pi(), TMath::Pi(), 1.5*TMath::Pi(),2*TMath::Pi()};

   Int_t sizept=(sizeof(ptbinning)/sizeof(double))-1;
   Int_t sizeeta=(sizeof(etabinning)/sizeof(double))-1;
   Int_t sizephi=(sizeof(phibinning)/sizeof(double))-1;

   AliHFEvarManager *vm = task->GetVarManager();
   vm->AddVariable("pt", sizept, ptbinning);
   vm->AddVariable("eta", sizeeta, -0.8,0.8);
   vm->AddVariable("phi", sizephi, phibinning);
   vm->AddVariable("charge");
   vm->AddVariable("source");

   // The part dedicated to the background subtraction
   // should be implemented in a different way, reading it from a root file.

   if(!useMC){

      enum HadronContaminationFunctionChoice
      {
         kHadronDown = 1,
         kHadronUp= 2,
         kHadronError = 3,

         kHadronTPCMinus10 = 4, // exchange -1 and -0.5
         kHadronTPC0 = 5,
         kHadronTPC025 = 6,
         kHadronTPCMinus025 = 7,
         kHadronTPCMinus075 = 8,
         kHadronTPCMinus13 = 9,
         kHadronTPCUp10 = 10,
         kHadronTPCUp15 = 11,
         kHadronTPCUp20 = 12,
         kHadronEtaRange07 = 13,
         kHadronEtaRange06 = 14,
         kHadronEtaRange05 = 15
      };

      // First hadron contamination fit for 5TeV  by Sebastian Hornung, March 9, 2017
      // relative to the case of a TPC PID cut at -1 sigma

      TF1 *hBackground;
      if(TOFs==0){
         // Default of the TPC-TOF - TO-BE-UPDATED
         switch (HadronContFunc) {
            default:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0, 3.03382e+00 );
               hBackground->SetParameter(1, 9.63780e+00);
               hBackground->SetParameter(2, 2.35773e+00);

               hBackground->SetParameter(3, 2.18302e-02);
               hBackground->SetParameter(4, 8.72968e-01);
               hBackground->SetParameter(5, 2.88664e-02);
               break;
         }
      }else{
         //TPC-TOF default (-0.5 to 3)
         switch (HadronContFunc) {
            case kHadronDown:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0,2.40611e+00);
               hBackground->SetParameter(1,1.23231e+01);
               hBackground->SetParameter(2,3.11748e+00);

               hBackground->SetParameter(3,2.53125e-02);
               hBackground->SetParameter(4,8.72447e-01);
               hBackground->SetParameter(5,2.94525e-02);
               break;
            case kHadronUp:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0,5.30204e-01);
               hBackground->SetParameter(1,9.28479e+00);
               hBackground->SetParameter(2,2.11948e+00);

               hBackground->SetParameter(3,2.51495e-02);
               hBackground->SetParameter(4,8.72771e-01);
               hBackground->SetParameter(5,2.82148e-02);
               break;
            case kHadronError:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]+[1]*TMath::Erf([2]*x+[3]) + [4] * TMath::Gaus(x, [5], [6])",0. ,60.);
               hBackground->SetParameter(0,4.99956e-01 );
               hBackground->SetParameter(1,4.99956e-01 );
               hBackground->SetParameter(2, 4.87544e-01);
               hBackground->SetParameter(3,-3.68617e+00 );

               hBackground->SetParameter(4, 2.52016e-02);
               hBackground->SetParameter(5, 8.72577e-01);
               hBackground->SetParameter(6,2.88676e-02 );
               break;
            case kHadronTPC025:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0,3.90218e+03);
               hBackground->SetParameter(1,3.84285e+01);
               hBackground->SetParameter(2,9.11622e+00);

               //remaining Kaon crossing
               hBackground->SetParameter(3,3.77083e-02);
               hBackground->SetParameter(4,8.71585e-01);
               hBackground->SetParameter(5,2.89435e-02);
               break;
            case kHadronTPC0:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0,4.44955e+01);
               hBackground->SetParameter(1,2.30562e+01);
               hBackground->SetParameter(2,5.66418e+00);

               //remaining Kaon crossing
               hBackground->SetParameter(3,3.20295e-02);
               hBackground->SetParameter(4,8.71979e-01);
               hBackground->SetParameter(5,2.88944e-02);
               break;
            case kHadronTPCMinus025:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0,1.30727e+00);
               hBackground->SetParameter(1,1.29364e+01);
               hBackground->SetParameter(2,3.21639e+00);

               //remaining Kaon crossing
               hBackground->SetParameter(3,2.06710e-02);
               hBackground->SetParameter(4,8.75536e-01);
               hBackground->SetParameter(5,3.92824e-02);
               break;
            case kHadronTPCMinus075:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0,2.30571e+00);
               hBackground->SetParameter(1,1.07039e+01);
               hBackground->SetParameter(2,2.64137e+00);

               //remaining Kaon crossing
               hBackground->SetParameter(3,2.32047e-02);
               hBackground->SetParameter(4,8.72793e-01);
               hBackground->SetParameter(5,2.88682e-02);
               break;
            case kHadronTPCMinus10:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0, 3.03382e+00);
               hBackground->SetParameter(1, 9.63780e+00);
               hBackground->SetParameter(2, 2.35773e+00);

               hBackground->SetParameter(3, 2.18302e-02);
               hBackground->SetParameter(4, 8.72968e-01);
               hBackground->SetParameter(5, 2.88664e-02);
               break;
            case kHadronTPCMinus13:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0,6.35957e+00);
               hBackground->SetParameter(1,9.73830e+00);
               hBackground->SetParameter(2,2.44789e+00);

               //remaining Kaon crossing
               hBackground->SetParameter(3,2.08335e-02);
               hBackground->SetParameter(4,8.73207e-01);
               hBackground->SetParameter(5,2.87383e-02);
               break;
            case kHadronTPCUp10:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0,1.66022e+00);
               hBackground->SetParameter(1,1.12957e+01);
               hBackground->SetParameter(2,2.79755e+00);

               hBackground->SetParameter(3,1.06629e-02);
               hBackground->SetParameter(4,8.78917e-01);
               hBackground->SetParameter(5,2.52698e-02);
               break;
            case kHadronTPCUp15:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0,1.52601e+00);
               hBackground->SetParameter(1,1.13999e+01);
               hBackground->SetParameter(2,2.82235e+00);

               hBackground->SetParameter(3,1.34318e-02);
               hBackground->SetParameter(4,8.77420e-01);
               hBackground->SetParameter(5,2.59921e-02);
               break;
            case kHadronTPCUp20:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0,1.51286e+00);
               hBackground->SetParameter(1,1.14730e+01);
               hBackground->SetParameter(2,2.83933e+00);

               hBackground->SetParameter(3,1.69910e-02);
               hBackground->SetParameter(4,8.75860e-01);
               hBackground->SetParameter(5,2.68220e-02);
               break;
            case kHadronEtaRange07:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]+[1]*TMath::Erf([2]*x+[3]) + [4] * TMath::Gaus(x, [5], [6])",0. ,60.);
               hBackground->SetParameter(0,4.99690e-01);
               hBackground->SetParameter(1,4.99690e-01);
               hBackground->SetParameter(2,4.92101e-01);
               hBackground->SetParameter(3,-3.67450e+00);

               hBackground->SetParameter(4,3.22580e-02);
               hBackground->SetParameter(5,8.67630e-01);
               hBackground->SetParameter(6,2.78381e-02);
               break;
            case kHadronEtaRange06:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]+[1]*TMath::Erf([2]*x+[3]) + [4] * TMath::Gaus(x, [5], [6])",0. ,60.);
               hBackground->SetParameter(0,4.99690e-01);
               hBackground->SetParameter(1,4.99690e-01);
               hBackground->SetParameter(2,5.11702e-01);
               hBackground->SetParameter(3,-3.71773e+00);

               hBackground->SetParameter(4,4.29179e-02);
               hBackground->SetParameter(5,8.67045e-01);
               hBackground->SetParameter(6,2.65574e-02);
               break;
            case kHadronEtaRange05:
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0,6.58853e+01);
               hBackground->SetParameter(1,1.73884e+01);
               hBackground->SetParameter(2,4.21580e+00);

               hBackground->SetParameter(3,3.07715e-02);
               hBackground->SetParameter(4,8.67344e-01);
               hBackground->SetParameter(5,2.84939e-02);
               break;
            default: // lower cut -0.5
               hBackground = new TF1("hadronicBackgroundFunction", "[0]*TMath::Landau(x,[1],[2])+ [3] * TMath::Gaus(x, [4], [5])", 0., 30);
               hBackground->SetParameter(0,1.54134e+00);
               hBackground->SetParameter(1,1.15392e+01);
               hBackground->SetParameter(2,2.85580e+00);

               //remaining Kaon crossing
               hBackground->SetParameter(3,2.51913e-02);
               hBackground->SetParameter(4,8.72570e-01);
               hBackground->SetParameter(5,2.88833e-02);
               break;
         }
      }

      //error function
      task->SetBackGroundFactorsFunction(hBackground);

   }

   //***************************************//
   //          Configure the PID            //
   //***************************************//

   // Define PID
   AliHFEpid *pid = task->GetPID();
   if(useMC) pid->SetHasMCData(kTRUE);

   if (usetof){
      pid->AddDetector("TOF", 0);
      pid->AddDetector("TPC", 1);
   } else {
      pid->AddDetector("TPC", 0);
   }

   // Configure TPC PID
   // do the identical thing in data and MC
   Double_t paramsTPCdEdxcutlow[12] ={0.0, 0.0, 0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0};
   if(tpcdEdxcutlow) memcpy(paramsTPCdEdxcutlow,tpcdEdxcutlow,sizeof(paramsTPCdEdxcutlow));

   Double_t paramsTPCdEdxcuthigh[12] ={3.0, 3.0, 3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};
   if(tpcdEdxcuthigh) memcpy(paramsTPCdEdxcuthigh,tpcdEdxcuthigh,sizeof(paramsTPCdEdxcuthigh));

   char *cutmodel;

   //  if(useMC){ // constant (default) cut for MC
   cutmodel="pol0(0)";
   Double_t params[1];
   params[0]=paramsTPCdEdxcutlow[0];
   pid->ConfigureTPCdefaultCut(cutmodel, params,tpcdEdxcuthigh[0]);
   /*
    } else { // correct for mean shift in data
    cutmodel="min(pol1(0),pol0(2))";
    Double_t params[3];
    //params[0]=-0.12; params[1]=0.14; params[2]=0.09;
    params[0]=-0.21 + paramsTPCdEdxcutlow[0];
    params[1]=0.14;
    params[2]=paramsTPCdEdxcutlow[0];
    pid->ConfigureTPCdefaultCut(cutmodel, params,tpcdEdxcuthigh[0]);
    }
    */

   if(!useMC){
      AliHFEpidTPC *tpcpid = pid->GetDetPID(AliHFEpid::kTPCpid);
      if(etacor){
         printf("CONFIGURATION FILE: Eta correction of electrons in the TPC \n");
         // Apply eta correction
         TF1 *etacorrection = GetTPCCorrection("Eta");
         TF1 *etacorrectionWidth = GetTPCCorrection("Eta_Width");
         if(etacorrection) tpcpid->SetEtaCorrections(etacorrection,etacorrectionWidth);
      }
      if(MomCor){
         printf("CONFIGURATION FILE: Momentum correction of electrons in the TPC \n");
         // Apply eta correction
         TF1 *MomCorrection = GetTPCCorrection("Momentum");
         TF1 *MomCorrectionWidth = GetTPCCorrection("Momentum_Width");
         if(MomCorrection) tpcpid->SetMomentumCorrections(MomCorrection, MomCorrectionWidth);
      }
   }

   // Configure TOF PID
   if (usetof){
      pid->ConfigureTOF(TOFs);
      AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);
      if (kTOFmis){
         tofpid->SetRejectTOFmismatch();
      }
   }

   // To make different upper TOF cut to see contamination effect
   // The below two lines should be removed after this check
   //AliHFEpidTOF *tofpid = pid->GetDetPID(AliHFEpid::kTOFpid);
   //if(TOFs<3.) tofpid->SetTOFnSigmaBand(-3,TOFs); //only to check the assymmetric tof cut

   //***************************************//
   //       Configure NPE plugin            //
   //***************************************//

   AliHFENonPhotonicElectron *backe = new AliHFENonPhotonicElectron(Form("HFEBackGroundSubtractionPID2%s",appendix.Data()),"Background subtraction");  //appendix
   //Setting the Cuts for the Associated electron-pool
   AliHFEcuts *hfeBackgroundCuts = new AliHFEcuts(Form("HFEBackSub%s",appendix.Data()),"Background sub Cuts");
   hfeBackgroundCuts->SetEtaRange(assETAm,assETAp);
   hfeBackgroundCuts->SetPtRange(assMinPt,20.);

   hfeBackgroundCuts->SetMaxChi2perClusterTPC(4);

   hfeBackgroundCuts->SetMinNClustersITS(assITS);
   hfeBackgroundCuts->SetMinNClustersTPC(assTPCcl);
   hfeBackgroundCuts->SetMinNClustersTPCPID(assTPCPIDcl);
   hfeBackgroundCuts->SetMaxImpactParam(assDCAr,assDCAz);
   if(isAOD) hfeBackgroundCuts->SetAODFilterBit(0); // Standard TPC only tracks
   hfeBackgroundCuts->SetQAOn();			        // QA

   AliHFEpid *pidbackground = backe->GetPIDBackground();
   if(useMC) pidbackground->SetHasMCData(kTRUE);

   if (assTOFs>0.){
      pidbackground->AddDetector("TOF", 0);
      pidbackground->AddDetector("TPC", 1);
   } else {
      pidbackground->AddDetector("TPC", 0);
   }

   Double_t paramsTPCdEdxcutlowAssoc[12] ={-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0,-3.0};
   if(assTPCSminus) memcpy(paramsTPCdEdxcutlowAssoc,assTPCSminus,sizeof(paramsTPCdEdxcutlowAssoc));

   Double_t paramsTPCdEdxcuthighAssoc[12] ={3.0, 3.0, 3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0,3.0};
   if(assTPCSplus) memcpy(paramsTPCdEdxcuthighAssoc,assTPCSplus,sizeof(paramsTPCdEdxcuthighAssoc));

   char *cutmodelAssoc;
   cutmodelAssoc="pol0";
   for(Int_t a=0;a<11;a++){
      // Not necessary anymore, since the pPb case is handled similarly to the pp case
      //   cout << a << " " << paramsTPCdEdxcut[a] << endl;
      Double_t tpcparamlow[1]={paramsTPCdEdxcutlowAssoc[a]};
      Float_t tpcparamhigh=paramsTPCdEdxcuthighAssoc[a];
      pidbackground->ConfigureTPCcentralityCut(a,cutmodelAssoc,tpcparamlow,tpcparamhigh);
   }
   pidbackground->ConfigureTPCdefaultCut(cutmodelAssoc,paramsTPCdEdxcutlowAssoc,paramsTPCdEdxcuthighAssoc[0]); // After introducing the pPb flag, pPb is merged with pp and this line defines the cut
   //backe->GetPIDBackgroundQAManager()->SetHighResolutionHistos();

   if (assTOFs>0.){
      pidbackground->ConfigureTOF(TOFs);
   }

   backe->SetHFEBackgroundCuts(hfeBackgroundCuts);

   // Selection of associated tracks for the pool
   if(useCat1Tracks) backe->SelectCategory1Tracks(kTRUE);
   if(useCat2Tracks){
      backe->SelectCategory2Tracks(kTRUE);
      backe->SetITSMeanShift(-0.5);
      backe->SetITSnSigmaHigh(assITSpid);
      Double_t assITSminus = -1.0 * assITSpid;
      backe->SetITSnSigmaLow(assITSminus);
      //backe->SetminPt(assMinPt);
   }

   // apply opening angle cut to reduce file size
   backe->SetMaxInvMass(0.6);

   Double_t massbinning[32] = {0.0,0.005,0.01,0.015,0.02,0.025,0.03,0.035,0.04,0.05,0.06,0.07,0.08,0.09,0.1,0.11,0.12,0.13,0.14,0.16,0.18,0.2,0.24,0.28,0.32,0.36,0.4,0.44,0.48,0.52,0.56,0.6};
   Int_t sizemass=(sizeof(massbinning)/sizeof(double))-1;

   backe->SetPtBinning(sizept, ptbinning);
   backe->SetEtaBinning(sizeeta, etabinning);
   backe->SetInvMassBinning(sizemass, massbinning);
   backe->SetPhiBinning(sizephi,phibinning);

   if(useMC) {
      if((weightlevelback >=0) && (weightlevelback <3)) backe->SetWithWeights(weightlevelback);
   }

   task->SetHFEBackgroundSubtraction(backe);
   task->SetWeightHist();

   // Also May 30: try to add tagged tracks (photon conversions)
   // not used since long ...
   AliHFEcuts *v0trackCuts = new AliHFEcuts("V0trackCuts", "Track Cuts for tagged track Analysis");
   v0trackCuts->CreateStandardCuts();
   v0trackCuts->SetMinNClustersTPC(TPCcl);
   v0trackCuts->SetMinNClustersTPCPID(TPCclPID);
   v0trackCuts->SetMinRatioTPCclusters(0.6);
   v0trackCuts->SetTPCmodes(AliHFEextraCuts::kFound, AliHFEextraCuts::kFoundOverFindable);
   v0trackCuts->SetMinNClustersITS(1);
   v0trackCuts->SetCutITSpixel(AliHFEextraCuts::kFirst);
   v0trackCuts->SetCheckITSLayerStatus(kFALSE);
   v0trackCuts->UnsetVertexRequirement();
   //hfecuts->SetSigmaToVertex(10);
   //v0trackCuts->SetTOFPIDStep(kTRUE);
   v0trackCuts->SetQAOn();

   task->SwitchOnPlugin(AliAnalysisTaskHFE::kTaggedTrackAnalysis);
   task->SetTaggedTrackCuts(v0trackCuts);
   task->SetCleanTaggedTrack(kTRUE);
   // end tagged tracks

   // QA
   printf("task %p\n", task);
   task->SetQAOn(AliAnalysisTaskHFE::kPIDqa);
   task->SetQAOn(AliAnalysisTaskHFE::kMCqa);
   task->SwitchOnPlugin(AliAnalysisTaskHFE::kDEstep);
   task->SwitchOnPlugin(AliAnalysisTaskHFE::kNonPhotonicElectron);

   printf("*************************************\n");
   printf("Configuring standard Task:\n");
   task->PrintStatus();
   pid->PrintStatus();
   printf("*************************************\n");
   return task;
}


text:
package com.intellij.openapi.vcs.actions;

import com.intellij.openapi.actionSystem.ActionUpdateThread;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.colors.EditorColors;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.progress.Task;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopup;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.AbstractVcs;
import com.intellij.openapi.vcs.VcsBundle;
import com.intellij.openapi.vcs.changes.ChangesUtil;
import com.intellij.openapi.vcs.changes.issueLinks.IssueLinkHtmlRenderer;
import com.intellij.openapi.vcs.diff.DiffMixin;
import com.intellij.openapi.vcs.history.VcsRevisionDescription;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.BrowserHyperlinkListener;
import com.intellij.util.text.DateFormatUtil;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.StartupUiUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.awt.*;

import static java.util.Objects.requireNonNull;

public class ShowBaseRevisionAction extends DumbAwareAction {
  @Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    Project project = requireNonNull(e.getProject());
    VirtualFile file = requireNonNull(VcsContextUtil.selectedFile(e.getDataContext()));
    AbstractVcs vcs = requireNonNull(ChangesUtil.getVcsForFile(file, project));
    Editor editor = e.getData(CommonDataKeys.EDITOR);

    ProgressManager.getInstance().run(new MyTask(project, file, vcs, editor));
  }

  private static final class MyTask extends Task.Backgroundable {
    private final AbstractVcs vcs;
    private final VirtualFile selectedFile;
    private VcsRevisionDescription myDescription;
    private final Editor editor;

    private MyTask(Project project, VirtualFile selectedFile, AbstractVcs vcs, Editor editor) {
      super(project, VcsBundle.message("progress.title.loading.current.revision"), true);
      this.selectedFile = selectedFile;
      this.vcs = vcs;
      this.editor = editor;
    }

    @Override
    public void run(@NotNull ProgressIndicator indicator) {
      myDescription = requireNonNull((DiffMixin)vcs.getDiffProvider()).getCurrentRevisionDescription(selectedFile);
    }

    @Override
    public void onSuccess() {
      if (myProject.isDisposed() || !myProject.isOpen()) return;

      if (myDescription != null) {
        NotificationPanel panel = new NotificationPanel();
        panel.setText(createMessage(myProject, myDescription, selectedFile));
        final JBPopup message = JBPopupFactory.getInstance().createComponentPopupBuilder(panel, panel.getLabel()).createPopup();
        if (editor != null && editor.getComponent().isShowing()) {
          message.showInBestPositionFor(editor);
        }
        else {
          message.showCenteredInCurrentWindow(myProject);
        }
      }
    }
  }

  @Nls
  private static String createMessage(@NotNull Project project, @NotNull VcsRevisionDescription description, @NotNull VirtualFile vf) {
    String commitMessage = IssueLinkHtmlRenderer.formatTextWithLinks(project, StringUtil.notNullize(description.getCommitMessage()));
    String message = VcsBundle.message("current.version.text",
                                       description.getAuthor(),
                                       DateFormatUtil.formatPrettyDateTime(description.getRevisionDate()),
                                       commitMessage,
                                       description.getRevisionNumber().asString(),
                                       vf.getName());
    return "" + UIUtil.getCssFontDeclaration(StartupUiUtil.getLabelFont()) + "" + message + ""; //NON-NLS
  }

  @Override
  public void update(@NotNull AnActionEvent e) {
    boolean isEnabled = AbstractShowDiffAction.isEnabled(e.getDataContext(), false);
    e.getPresentation().setEnabled(isEnabled);
  }

  @Override
  public @NotNull ActionUpdateThread getActionUpdateThread() {
    return ActionUpdateThread.BGT;
  }

  static class NotificationPanel extends JPanel {
    protected final JEditorPane myLabel;

    NotificationPanel() {
      super(new BorderLayout());

      myLabel = new JEditorPane(UIUtil.HTML_MIME, "");
      myLabel.setEditable(false);
      myLabel.setFont(UIUtil.getToolTipFont());
      myLabel.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);

      setBorder(JBUI.Borders.empty(1, 15));

      add(myLabel, BorderLayout.CENTER);
      myLabel.setBackground(getBackground());
    }

    public void setText(@Nls String text) {
      myLabel.setText(text);
    }

    public JEditorPane getLabel() {
      return myLabel;
    }

    @Override
    public Color getBackground() {
      Color color = EditorColorsManager.getInstance().getGlobalScheme().getColor(EditorColors.NOTIFICATION_BACKGROUND);
      return color == null ? new Color(0xffffcc) : color;
    }
  }
}

redpajama_set_name: RedPajamaGithub


text:
using System.Collections.Generic;
using System.Reflection;
using System.Web.Mvc;
using Envoc.AzureLongRunningTask.AzureCommon.Persistance;
using Envoc.AzureLongRunningTask.AzureCommon.Persistance.Blob;
using Envoc.AzureLongRunningTask.AzureCommon.Persistance.Queues;
using Envoc.AzureLongRunningTask.Web.Models;
using Envoc.AzureLongRunningTask.Web.Services;
using SimpleInjector;
using SimpleInjector.Extensions;
using SimpleInjector.Integration.Web;
using SimpleInjector.Integration.Web.Mvc;

namespace Envoc.AzureLongRunningTask.Web
{
    public class IocRegistrar
    {
        public static void RegisterContainers()
        {
            var container = new Container();
            container.RegisterMvcControllers(Assembly.GetExecutingAssembly());
            container.RegisterMvcAttributeFilterProvider();

            var lifestyle = new WebRequestLifestyle();
            container.Register(() => new AzureContext(), lifestyle);
            container.RegisterOpenGeneric(typeof(IQueueContext<>), typeof(QueueContext<>), lifestyle);
            container.RegisterOpenGeneric(typeof(IStorageContext<>), typeof(StorageContext<>), lifestyle);
            container.RegisterOpenGeneric(typeof(IList<>), typeof(StaticList<>), lifestyle);
            container.Register<ImageProcessService>();
            container.Register<ImageUploadService>();

            container.Verify();
            DependencyResolver.SetResolver(new SimpleInjectorDependencyResolver(container));
        }
    }
}


text:
@import "comments-component.css";

/* This file must (for no good reason) be manually deployed at www.uio.no/vrtx/css */

/* START include:uri-menu style=[vrtx-vertical-menu] */

ul.vrtx-vertical-menu {
  padding: 0;
  margin: 0;
  list-style-type: none;
  border-bottom: 1px solid #ccc; /*for IE */
}

* html ul.vrtx-vertical-menu {
  position: relative; /* for IE6 */
}

ul.vrtx-vertical-menu li {
  border-top: 1px solid #ccc;
  border-bottom: 1px solid #ccc;
  margin-bottom: -1px;
  vertical-align: middle; /* for IE */
}

ul.vrtx-vertical-menu li a {
  display: block;
  padding: .3em .2em .3em .4em;
  border-left: .3em solid #fff;
  color: black;
  text-decoration: none;
  height: 1%; /* triggers hasLayout in IE browsers */
}

ul.vrtx-vertical-menu li.vrtx-active-item {
  font-weight: 900;
}

ul.vrtx-vertical-menu li.vrtx-active-item a {
  border-left: .3em solid #999;
  padding-left: .4em;
}

ul.vrtx-vertical-menu li a:hover,
ul.vrtx-vertical-menu li.vrtx-active-item a:hover {
  background-color: #eee;
  color: #666;
  border-left: .3em solid #ccc;
  padding-left: .4em;
}

ul.vrtx-vertical-menu li.parent-folder{
  border: none;
}

ul.vrtx-vertical-menu li.parent-folder a {
  border-left: none;
  padding-left: .7em;
  font-weight: 900;
}

ul.vrtx-vertical-menu li.parent-folder a:hover{
  text-decoration:none;
  background-color: transparent;
  border-left:none;
  padding-left: .7em;
}

/* Sublists */

ul.vrtx-vertical-menu ul {
  padding: 0 0 0 1.8em;
  margin: 0;
  list-style-type: square;
  color: #000;
}

ul.vrtx-vertical-menu li.vrtx-active-item ul li,
ul.vrtx-vertical-menu li ul li {
  margin: 0 0 -1px 0;
  padding: 0;
  font-weight: 100;
  font-size: 100%;
  border: none;
  border-bottom: 1px dotted #ddd;
}

* html ul.vrtx-vertical-menu li.vrtx-active-item ul li,
* html ul.vrtx-vertical-menu li ul li {
  margin: 0; /* for IE */
}

ul.vrtx-vertical-menu li.vrtx-active-item ul li.vrtx-active-item {
  font-weight: 900;
  color: #999;
}

ul.vrtx-vertical-menu li.vrtx-active-item ul li a,
ul.vrtx-vertical-menu li.vrtx-active-item ul li a:hover,
ul.vrtx-vertical-menu li.vrtx-active-item ul li.vrtx-active-item a,
ul.vrtx-vertical-menu li.vrtx-active-item ul li.vrtx-active-item a:hover {
  border: none;
  padding-left: 0;
  background-color: transparent;
}

/* Sub-sub-list ++ */

ul.vrtx-vertical-menu ul li ul {
  padding: 0 0 0 1em;
  margin: 0;
  list-style-type: square;
}

ul.vrtx-vertical-menu ul li ul li {
  font-size: 100%;
}

ul.vrtx-vertical-menu ul li ul li,
ul.vrtx-vertical-menu ul li.vrtx-active-item ul li {
  margin: 0;
  padding: 0;
  border: none;
}

ul.vrtx-vertical-menu li.vrtx-active-item ul li.vrtx-active-item {
  font-weight: 900;
}

ul.vrtx-vertical-menu li.vrtx-active-item ul li.vrtx-active-item ul li.vrtx-active-item a:hover,
ul.vrtx-vertical-menu li.vrtx-active-item ul li.vrtx-active-item ul li a:hover {
  color: #666;
  background-color: transparent;
}

ul.vrtx-vertical-menu li.vrtx-active-item ul li.vrtx-active-item ul li a,
ul.vrtx-vertical-menu li.vrtx-active-item ul li.vrtx-active-item ul li.vrtx-active-item a,
ul.vrtx-vertical-menu li.vrtx-active-item ul li.vrtx-active-item ul li a:hover,
ul.vrtx-vertical-menu li.vrtx-active-item ul li.vrtx-active-item ul li.vrtx-active-item ul li.vrtx-active-item a:hover {
  border: none;
  padding: .2em 0;
  margin: 0;
}

/* END include:uri-menu style=[vrtx-vertical-menu] */

/* START include:uri-menu style=[vrtx-horizontal-menu] */

ul.vrtx-horizontal-menu {
  white-space: nowrap;
  padding: 0 0 0 .4em;
  margin: 0;
  border: 1px solid #ccc;
  list-style-type: none;
  height: 1%; /* triggers hasLayout in IE browsers */
}

ul.vrtx-horizontal-menu:after {
  display: block;
  content: ".";
  height: 0;
  visibility: hidden;
  clear: both;
}

ul.vrtx-horizontal-menu li {
  float: left;
  margin: 0 .5em 0 0;
  padding: 0;
}

ul.vrtx-horizontal-menu a {
  display: block;
  margin: 0;
  padding: .2em .5em .3em .5em;
  color: #000;
  text-decoration: none;
}

ul.vrtx-horizontal-menu li.vrtx-active-item a {
  border-bottom: .2em solid #000;
  padding-bottom: .1em;
}

ul.vrtx-horizontal-menu a:hover, ul.vrtx-horizontal-menu li.vrtx-active-item a:hover {
  color: #666;
  border-bottom: .2em solid #666;
  padding-bottom: .1em;
}

/* Same menu but with inline style - better scalability but IE7 won't handle it properly when text size is increased or decreased */

/* ul.vrtx-horizontal-menu { */
/*   white-space: nowrap; */
/*   background-color: #dfd2b0; */
/*   padding: .3em 0; */
/*   margin: 0; */
/* } */

/* ul.vrtx-horizontal-menu li { */
/*   display:inline; */
/*   list-type: none;  */
/*   margin: 0px; */
/*   padding: 0px; */
/* } */

/* ul.vrtx-horizontal-menu a { */
/*   margin: 0em; */
/*   padding: .3em .75em; */
/*   color: #000; */
/*   text-decoration: none; */
/*   height: 1%; /\* triggers hasLayout in IE browsers *\/ */
/* } */

/* ul.vrtx-horizontal-menu li.vrtx-active-item a { */
/*   border-bottom: .2em solid #000; */
/*   padding-bottom: .1em; */
/* } */

/* ul.vrtx-horizontal-menu a:hover, ul.vrtx-horizontal-menu li.vrtx-active-item a:hover { */
/*   color: #666; */
/*   border-bottom: .2em solid #666; */
/*   padding-bottom: .1em; */
/* } */

/* END include:uri-menu style=[vrtx-horizontal-menu] */

/* START include:uri-menu style=[vrtx-tab-menu] */

ul.vrtx-tab-menu {
  margin: 0px;
  padding: 4px 0px;
  border-bottom: 1px solid #ccc;
  white-space: nowrap;
}

ul.vrtx-tab-menu li {
  display: inline;
  list-style: none;
  margin: 0px;
}

ul.vrtx-tab-menu li a {
  text-align: center;
  text-decoration: none;
  color: #333;
  padding: 4px 15px;
  margin: 0px 1px 0px 0px;
  border: 1px solid #ccc;
  background-color: #eee;
  border: 1px solid #ccc;
  border-bottom: none;
}

ul.vrtx-tab-menu li.vrtx-active-item a, ul.vrtx-tab-menu li.vrtx-active-item a:hover {
  color: #000;
  padding: 5px 15px;
  background-color: #fff;
}

ul.vrtx-tab-menu li a:hover{
  color: #000;
  padding-top: 5px;
}

/* END include:uri-menu style=[vrtx-tab-menu] */

/* START include:feed, include:feeds */

div.vrtx-feed {
  padding: 1em;
  border: 1px solid #ccc;
  font-size: .9em;
}

div.vrtx-feed .feed-title {
  display:block;
  font-size: 1.2em;
  font-weight: 900;
  margin-bottom: 0.5em;
  text-decoration: none;
  color: black;
}

div.vrtx-feed a.feed-title:hover {
  color: #999;
}

div.vrtx-feed div.feed-description {

}

div.vrtx-feed a.all-messages {

}

div.vrtx-feed ul.items {
  margin: 1em 0px;
  padding: 0px;
  list-style: none;
}

div.vrtx-feed li {
  margin: 0.75em 0px;
}

div.vrtx-feed ul.items li a.item-title {
  display:block;
  margin-bottom: .2em;
}

div.vrtx-feed ul.items li div.item-description {
   margin-bottom: .2em;
}

div.vrtx-feed ul.items li span.published-date {
  font-size: .9em;
  white-space: nowrap;
}

div.vrtx-feed ul.items li a.channel {
  font-size: .9em;
}

/* END include:feed, include:feeds */

/* START include:recent-comments */

div.vrtx-recent-comments {
  padding: 1em;
  border: 1px solid #ccc;
  font-size: .9em;
}

div.vrtx-recent-comments .comments-title {
  display:block;
  font-size: 1.2em;
  font-weight: 900;
  margin-bottom: 0.5em;
  text-decoration: none;
  color: black;
}

div.vrtx-recent-comments a.comments-title:hover {
  color: #999;
}

div.vrtx-recent-comments ul.items {
  margin: 1em 0px;
  padding: 0px;
  list-style: none;
}

div.vrtx-recent-comments li {
  margin: 0.75em 0px;
}

div.vrtx-recent-comments ul.items li a.item-title {
  display:block;
  margin-bottom: .2em;
}

div.vrtx-recent-comments ul.items li span.published-date {
  display:block;
  font-size: .9em;
  white-space: nowrap;
}

div.vrtx-recent-comments ul.items li div.item-description {
   margin-top: .2em;
}

/* END include:recent-comments */

/* START resource:breadcrumb */

div.breadcrumb {
  font-size: .8em;
}

/* END resource:breadcrumb */

/* START resource:subfolder-menu */

div.vrtx-subfolder-menu {
  border: 1px solid #ccc;
  padding: 1em 1em .2em 1em;
  height: 1%; /* Triggers hasLayout in IE browser */
}

div.vrtx-subfolder-menu:after {
  content: ".";
  display: block;
  height: 0;
  clear: both;
  visibility: hidden;
}

div.vrtx-subfolder-menu div.menu-title {
  font-size: 1.2em;
  font-weight: bold;
  margin-bottom: .5em;
}

div.vrtx-subfolder-menu ul {
  float:left;
  list-style-type: square;
  padding: 0 2em;
  margin: 0 0 1em 0;
}

/* Sublists ++ */
div.vrtx-subfolder-menu ul ul {
  float: none;
  padding: 0 .5em 0 1em;
  margin: 0;
}

/* Comma separated lists */

div.vrtx-subfolder-menu.comma-separated ul,
div.vrtx-subfolder-menu.comma-separated ul li {
  list-style: none;
  padding-left: 0;
}

div.vrtx-subfolder-menu.comma-separated ul li ul li {
  display: inline;
}

/* END resource:subfolder-menu */

/* START resource:tags */
span.vrtx-tags {
}

/* END resource:tags */

/* START resource:manage-url */

a.vrtx-manage-url {
  font-size: .8em;
  float:right;
  clear:both;
}

/* END resource:manage-url */

/* START resource:email-friend */

a.vrtx-email-friend {
  font-size: .8em;
  float: right;
}

/* END resource:email-friend */

/* END resource:manage-url */

/* START resource:toc */

span.vrtx-toc-header {
  font-size: 150%;
  font-weight:bold;
}

/* END resource:toc */

/* START include:tag-cloud */

ul.vrtx-tag-cloud li {
    display: inline;
    margin-right: 6px;
}
ul.vrtx-tag-cloud li a {
    text-decoration: none;
}
ul.vrtx-tag-cloud li a:hover {
    color: #ffffff;
    text-decoration: none;
    background-color: #0063dc;
}
ul.vrtx-tag-cloud {
    margin-left:0;
    padding-left:0;
}
ul.vrtx-tag-cloud {
    //font-family: 'Lucida Grande', sans-serif;
    font-size: 13px; /* set global font size */
}
.vrtx-tag-cloud .tag-magnitude-5 {
    font-size: 1.76em;
}
.vrtx-tag-cloud .tag-magnitude-4 {
    font-size: 1.5em;
}
.vrtx-tag-cloud .tag-magnitude-3 {
    font-size: 1.3em;
}
.vrtx-tag-cloud .tag-magnitude-2 {
    font-size: 1.1em;
}
.vrtx-tag-cloud .tag-magnitude-1 {
    font-size: 0.9em;
}

/* END include:tag-cloud */

/* for tags component */

.vrtx-tags ul{
	float:left;
}


text:
CKEDITOR.editorConfig = function( config )
{
    // Define changes to default configuration here. For example:
    //config.language = 'en-au';
    //config.startupOutlineBlocks = true;
    //config.uiColor = '#AADC6E';

	config.extraPlugins = 'syntaxhighlight';
	config.syntaxhighlightLangDefault = 'php;
	config.toolbar_Full.push(['Code']);
};


text:
import '../application.scss';
import * as Sentry from '@sentry/browser';
import { RewriteFrames } from '@sentry/integrations';
// eslint-disable-next-line no-useless-escape
const SENTRY_PATH_STRIP_RE = /^.*\/[^\.]+(\.app|CodePush|.*(?=\/))/;
Sentry.init({
  dsn: process.env.SENTRY_DSN,
  autoSessionTracking: process.env.BUILD_TYPE === 'electron',
  environment: process.env.NODE_ENV,
  release: process.env.RELEASE,
  integrations: [
    new RewriteFrames({
      iteratee(frame) {
        if (frame.filename !== '[native code]' && frame.filename !== '<anonymous>') {
          // eslint-disable-next-line no-useless-escape
          frame.filename = frame.filename.replace(/^file\:\/\//, '').replace(SENTRY_PATH_STRIP_RE, '');
        }
        return frame;
      },
    }),
  ],
});
const { error } = console;
console.error = function() {
  if (typeof arguments[0] === 'string') {
    Sentry.captureException(new Error(arguments[0]));
  } else {
    Sentry.captureException(arguments[0]);
  }
  error.apply(this, arguments);
};

import { fadeOut } from 'lib/transitions/fade.js';
import i18n from 'lib/i18n';

function init() {
  i18n.loadTranslation().then(() => {
    let localStorageSupport = false;
    try {
      localStorageSupport = !!window.localStorage;
    } catch (err) {
      console.error(err);
    }
    if (localStorageSupport && window.Worker) {
      const containerEl = document.getElementById('loader');
      return import(
        /* webpackChunkName: 'application' */
        '../application'
      ).then(() => {
        fadeOut(containerEl, () => {
          window.initCSApp();
        });
      });
    } else {
      nope();
    }
  });
}

function nope() {
  const message = i18n.translate('Sorry, Coin Wallet did not load.') +
  '

' +
  // eslint-disable-next-line max-len
  i18n.translate('Try updating your browser, or switching out of private browsing mode. If all else fails, download Chrome for your device.');
  document.getElementById('loader-message').innerHTML = message;
}

init();


text:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
    android:fromXDelta="-500"
    android:toXDelta="500"
    android:fromYDelta="-200"
    android:toYDelta="200"
    android:duration="1500"
    android:fillAfter="false"
    android:repeatCount="3"
    />
</set>


text:
/**
* Author: Bob Chen
*/

package com.jcommerce.core.action;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Map;

import org.springframework.context.ApplicationContext;

import com.jcommerce.core.model.ModelObject;
import com.jcommerce.core.service.Manager;

public class MapUpdateAction extends MapAction {
    public MapUpdateAction(ApplicationContext ctx, BeanConfig config) {
        super(ctx, config);
    }

    public boolean updateObject(String modelName, String id, Map<String, Object> props) {
        System.out.println("updateObject("+modelName);

        try {
            Manager manager = getManager(modelName);
//            System.out.println("-----2-------"+manager);
            String methodName = config.getGetMethod(modelName);
            Method method = manager.getClass().getMethod(methodName, String.class);
//            System.out.println("-----3-------");
//            if (method == null) {
//                System.out.println("Method not found: "+methodName);
//            }
//            System.out.println("-----4-------");
            ModelObject model = (ModelObject)method.invoke(manager, id);
            if (model != null) {
                copyProperties(props, model);
                id = saveObject(modelName, model);
                return id != null;
            } else {
                return false;
            }
        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (IllegalArgumentException e) {
            e.printStackTrace();
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (NoSuchMethodException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
        return false;
    }
}


text:
import { createClient, createResource, HalProperty, HalResource, resetCache } from "../";

import * as nock from "nock";
import { test } from "tape-async";

class NotificationConfig {
    public category;
    public notificationDescription;
    public subcategory;
    public email: NotificationEmail;
}

class HalNotification extends HalResource {
    @HalProperty()
    public cellphoneSet;

    @HalProperty(NotificationConfig)
    public notificationConfigs: NotificationConfig[];
}

class NotificationEmail {
    public id;
    public enabled;
}

// mock list response
function initTests() {
  nock.cleanAll();
  resetCache();

  const json = {
    _links: {
      self: {
        href: "http://test.fr/notificationConfig",
        type: "application/hal+json",
      },
      updateNotificationConfigs: {
        href: "http://test.fr/notificationConfig/update",
        type: "application/hal+json",
      },
    },
    cellphoneSet: false,
    notificationConfigs: [
      {
        category: "Login",
        email: {
          enabled: true,
          id: 3,
        },
        notificationDescription: "Your password has been reset",
        subcategory: "Reset_Password",
      },
    ],
  };

  const testNock = nock("http://test.fr/");

  testNock
    .get("/notificationConfigs")
    .reply(200, json);
}

test("can fetch array of non hal resource", async (t) => {
  initTests();
  const fetched = await createClient("http://test.fr/").fetch("/notificationConfigs", HalNotification);
  t.equals(fetched.cellphoneSet, false);
  t.equals(fetched.notificationConfigs.length, 1);
  t.equals(fetched.notificationConfigs[0].subcategory, "Reset_Password");
  t.equals(fetched.notificationConfigs[0].email.id, 3);
});


text:
package com.commercetools.sunrise.productcatalog.productdetail;

import com.commercetools.sunrise.framework.hooks.HookRunner;
import com.commercetools.sunrise.framework.hooks.ctpevents.ProductVariantLoadedHook;
import io.sphere.sdk.products.ProductProjection;
import io.sphere.sdk.products.ProductVariant;

import javax.inject.Inject;
import java.util.Optional;
import java.util.concurrent.CompletionStage;

import static java.util.concurrent.CompletableFuture.completedFuture;

final class ProductVariantFinderBySku implements ProductVariantFinder {

    private final HookRunner hookRunner;

    @Inject
    ProductVariantFinderBySku(final HookRunner hookRunner) {
        this.hookRunner = hookRunner;
    }

    @Override
    public CompletionStage<Optional<ProductVariant>> apply(final ProductProjection product, final String sku) {
        final Optional<ProductVariant> variantOpt = product.findVariantBySku(sku);
        variantOpt.ifPresent(variant -> ProductVariantLoadedHook.runHook(hookRunner, product, variant));
        return completedFuture(variantOpt);
    }
}


text:
require 'rails_helper'

RSpec.describe QuotaOrderNumber do
  context 'with an existing QuotaOrderNumber' do
    let(:quota_order_number) { create(:quota_order_number) }
    let(:definition) { create(:quota_definition, quota_order_number_sid: quota_order_number.quota_order_number_sid) }

    before { definition }

    describe '#quota_definition!' do
      subject { quota_order_number.quota_definition! }

      it { is_expected.to eq(definition) }
    end
  end

  context 'without a persisted QuotaOrderNumber' do
    context 'when not handled by the RPA' do
      let(:quota_order_number) { described_class.new(quota_order_number_id: '090000') }

      describe '#quota_definition!' do
        it 'returns nil' do
          expect(quota_order_number.quota_definition!).to eq(nil)
        end
      end
    end

    context 'when handled by the RPA' do
      let(:quota_order_number) { described_class.new(quota_order_number_id: '094504') }

      describe '#quota_definition!' do
        it 'returns nil' do
          expect(quota_order_number.quota_definition!).to eq(nil)
        end
      end
    end
  end
end


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
null

#### Original name
Octaviania stephensii var. ravenelii Berk. & M.A. Curtis

### Remarks
null


text:
import java.util.Scanner;

/**
 * Exercise 3.10 from the book Introduction to Java Programming (10th).
 *
 * @author Henrik Samuelsson, henrik.samuelsson(at)gmail.com
 */

public class Exercise_10_10 {

	public static void main(String[] args) {
		// generate two random integers both less than 100
		int number1 = (int) (Math.random() * 100);
		int number2 = (int) (Math.random() * 100);

		// prompt the student to answer "what is number1 + number2?"
		System.out.print("What is " + number1 + " + " + number2 + "? ");
		Scanner input = new Scanner(System.in);
		int answer = input.nextInt();

		// grade the answer and display the result
		if (number1 + number2 == answer)
			System.out.println("You are correct!");
		else
			System.out.println("Your answer is wrong.\n" + number1 + " + "
					+ number2 + " should be " + (number1 + number2));
	}
}


text:
这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀.由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变.

概述

取消一个先前通过调用window.requestAnimationFrame()方法添加到计划中的动画帧请求.

语法

window.mozCancelAnimationFrame(requestID);               // Firefox

参数

                requestID

                先前调用window.requestAnimationFrame()方法时返回的ID.

示例

var requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame || window.msRequestAnimationFrame;
var cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;
var start = window.mozAnimationStartTime;
// 只有Firefox支持mozAnimationStartTime属性,其他浏览器可以使用Date.now()来替代.
function step(timestamp) {
  var progress = timestamp - start;
  d.style.left = Math.min(progress/10, 200) + "px";
  if (progress < 2000) {
    requestAnimationFrame(step);
  }
}
var myReq = requestAnimationFrame(step);
window.cancelAnimationFrame(myReq);
window.cancelAnimationFrame(myReq);

浏览器兼容性

Desktop

Mobile

                    Feature
                    Chrome
                    Firefox (Gecko)
                    Internet Explorer
                    Opera
                    Safari (WebKit)

                    Basic support

21.0 webkit

24.0 脱前缀

11.0 (11.0) moz

                    10
                    ?

6.0 webkit

                Feature
                Android
                Chrome for Android
                Firefox Mobile (Gecko)
                IE Phone
                Opera Mobile
                Safari Mobile

                Basic support
                ?

?

                11.0 (11.0) moz
                ?
                ?
                ?

规范

Timing control for script-based animations: cancelAnimationFrameWD

相关链接

window.mozAnimationStartTime

window.requestAnimationFrame()

Document Tags and Contributors

 Contributors to this page: ziyunfei

        Last updated by:
        ziyunfei,
        <time datetime="2013-02-27T22:13:38-08:00">Feb 27, 2013 10:13:38 PM</time>


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

package com.google.security.zynamics.binnavi.API.disassembly;

import java.util.List;

import com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment;

// / Adapter class for instruction listeners
/**
 * Adapter class that can be used by objects that want to listen on instructions but only need to
 * process few events.
 */
public class InstructionListenerAdapter implements IInstructionListener {
  @Override
  public void appendedComment(final Instruction instruction, final IComment comment) {
    // Adapter function
  }

  @Override
  public void deletedComment(final Instruction instruction, final IComment comment) {
    // Adapter function
  }

  @Override
  public void editedComment(final Instruction instruction, final IComment comment) {
    // Adapter function
  }

  @Override
  public void initializedComment(final Instruction instruction, final List<IComment> comments) {
    // Adapter function
  }
}


text:
[![MIT license](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE.md)

This repository is created to learn and work with docker images and containers.
It contains some base Dockerfiles.
The repository is more a template and the individual files can be used in other projects.

## Prerequisites

### Docker

* `docker 19.03.5-ce` or higher

## Getting started

```bash
# clone project
git clone https://github.com/inpercima/docker
cd docker
```

## Usage

### Using docker

```bash
# build an image e.g. alpine-java8
cd alpine-java8
docker image build -t inpercima/alpine-java8 .

# run an image e.g. alpine-java8-spring-boot
cd alpine-java8-spring-boot
docker image build -t inpercima/alpine-java8-spring-boot .
docker container rm -f inpercima_ajsb
docker container run --name inpercima_ajsb -d -it -p 8080:8080 inpercima/alpine-java8-spring-boot
```

### Using docker-compose

Some images/container can be build with docker-compose to handle the containers, e.g. mysql.

```bash
# deploy mysql
docker-compose up -d

# undeploy mysql
docker-compose down
```

## Cheat sheet docker

### Introduction

Collection of commands creating/removing docker images and containers and working with them.

### Preparation

To create a image a configuration file (a simple textfile) named `Dockerfile` is needed. Mostly it is in the same directory working on.
This includes commands to build an image.

```bash
FROM ubuntu:16.04

LABEL maintainer="Marcel Jänicke <inpercima@gmail.com>"

WORKDIR /usr/src/app

ARG port=80

RUN echo "Europe/Berlin" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata

EXPOSE $port

COPY hostfile.txt /file-in-image.txt

ENTRYPOINT ["/path/to/runfile"]

CMD ["/path/to/runfile"]

HEALTHCHECK --interval=30s --timeout=30s --start-period=10s --retries=3 \
    CMD curl -f http://localhost:8080 || exit 1
```

* `FROM` load a base image from the docker hub
* `LABEL maintainer` name the author of the image with contact details
* `WORKDIR` set a path as workdir
* `ARG` defines a variable for build-time
* `ENV` defines an environment variable
* `RUN` run a command in the image, use a separate line for each command with `&& \`
* `EXPOSE` define a port the container listen
* `COPY` copy files or directory from the host system into the image
* `ENTRYPOINT` defines a file which run with the container
* `CMD` defines a file which run with the container
* `HEALTHCHECK` integrate a check to an app

### Images

* `docker image build -t <NAME> /path/to/Dockerfile` creates a docker image
  * `-t <NAME>` name the image
  * `/path/to/Dockerfile` the location of the Dockerfile, is it in the same directory `/path/Dockerfile` can replaced with `.`
* `docker image ls -a` list images
  * `-a` list all, includes intermediate images
* `docker image rm <IMAGE-ID/NAME>` removes an image

### Containers

* `docker container run -it -d -p 8080:8081 <IMAGE-ID/NAME>` run a docker container
  * `-i` starts the images as an interactive container
  * `-d` starts the images as an deamon container
  * `-p <PORTS>` bind ports from host to the container
  * `-t` maps the console to the container
* `docker container start <CONTAINER-ID/NAME>` starts a container
* `docker container stop <CONTAINER-ID/NAME>` stops a container
* `docker container logs <CONTAINER-ID/NAME>` gets mapped logs from the container
* `docker container inspect <CONTAINER-ID/NAME>` gets some information about the container
* `docker container pause <CONTAINER-ID/NAME>` pause all processes
* `docker container unpause <CONTAINER-ID/NAME>` unpause all processes
* `docker container ls -a` list containers
  * `-a` list all, includes stopped
* `docker rm -f <CONTAINER-ID/NAME>` removes a container
  * `-f` removes forced, if the container should be removed while running
* `docker exec -it <CONTAINER-ID/NAME> /bin/bash` interact with the container with a new instance of the shell
  * `-i` interactive container
  * `-t` maps the console to the container
  * to detach use `Ctrl`+`P`+`Q`

### System

* `docker system df` shows size of images, containers and volumes

## Cheat sheet docker-compose

### Introduction docker-compose

Collection of commands working with docker containers under docker-compose.

### Preparation docker-compose

To start with docker-compose an file named `docker-compose.yml` is needed. Mostly it is in the same directory working on.

```bash
version: "2"
services:
  mysql:
    image: mysql:5.7
    container_name: mysql
    mem_limit: 1g
    ports:
      - "3306:3306"
    restart: unless-stopped
    environment:
      - MYSQL_ROOT_PASSWORD=password
    volumes:
      - data-mysql:/var/lib/mysql
    command: mysqld --lower_case_table_names=1 --max_allowed_packet=100M
  phpmyadmin:
    image: phpmyadmin/phpmyadmin
    container_name: phpmyadmin
    mem_limit: 1g
    restart: unless-stopped
    environment:
      - PMA_HOSTS=mysql
    ports:
      - "80:80"
    depends_on:
      - mysql
volumes:
  data-mysql:
```

* `version: "2"` version 2 of docker-compose
* `services` the listes services/containers
* `mysql` the name of one service, e.g. mysql
* `build` used if the image should build from a Dockerfile like `build: .`
* `image` the image from the hub which should be used or the name if build is used
* `container_name` name of the created container
* `mem_limit` memory limit
* `ports` bind ports from host to the container
* `restart: unless-stopped` restart service when stopped
* `environment` environment for the container
* `volumes` mapped volume
* `command` comand line
* `depends_on` the service on which this service depends
* `volumes` parallel to `services` created volumes which can mapped

### Containers docker-compose

* `docker-compose build` build images
* `docker-compose up -d` deploy application
* `docker-compose logs -f` analyze logs
* `docker-compose down` undeploy application


text:
<?php

namespace OCA\Files\Command;

use OC\ForbiddenException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class Scan extends Command {

	/**
	 * @var \OC\User\Manager $userManager
	 */
	private $userManager;

	public function __construct(\OC\User\Manager $userManager) {
		$this->userManager = $userManager;
		parent::__construct();
	}

	protected function configure() {
		$this
			->setName('files:scan')
			->setDescription('rescan filesystem')
			->addArgument(
				'user_id',
				InputArgument::OPTIONAL | InputArgument::IS_ARRAY,
				'will rescan all files of the given user(s)'
			)
			->addOption(
				'all',
				null,
				InputOption::VALUE_NONE,
				'will rescan all files of all known users'
			);
	}

	protected function scanFiles($user, OutputInterface $output) {
		$scanner = new \OC\Files\Utils\Scanner($user);
		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFile', function ($path) use ($output) {
			$output->writeln("Scanning <info>$path</info>");
		});
		$scanner->listen('\OC\Files\Utils\Scanner', 'scanFolder', function ($path) use ($output) {
			$output->writeln("Scanning <info>$path</info>");
		});
		try {
			$scanner->scan('');
		} catch (ForbiddenException $e) {
			$output->writeln("<error>Home storage for user $user not writable</error>");
			$output->writeln("Make sure you're running the scan command only as the user the web server runs as");
		}
	}

	protected function execute(InputInterface $input, OutputInterface $output) {
		if ($input->getOption('all')) {
			$users = $this->userManager->search('');
		} else {
			$users = $input->getArgument('user_id');
		}

		if (count($users) === 0) {
			$output->writeln("<error>Please specify the user id to scan or \"--all\" to scan for all users</error>");
			return;
		}

		foreach ($users as $user) {
			if (is_object($user)) {
				$user = $user->getUID();
			}
			$this->scanFiles($user, $output);
		}
	}
}


text:
@implementation UITableDataSourceController
@synthesize data;

- (id) init {
	if(!(self = [super init])) return nil;
	data = [[NSMutableArray alloc] init];
	return self;
}

- (void) addSection {
	NSMutableArray * a = [[NSMutableArray alloc] init];
	[data addObject:a];
	[a release];
}

- (NSMutableArray *) dataInSection:(NSInteger) section {
	if([data count] < section) return nil;
	return [data objectAtIndex:section];
}

- (void) addItem:(id) item toSection:(NSInteger) section {
	if([data count] < section || !data) return;
	[[data objectAtIndex:section] addObject:item];
}

- (void) removeLastItemInSection:(NSInteger) section {
	if([data count] < section || !data) return;
	[[data objectAtIndex:section] removeLastObject];
}

- (void) removeAllItemsInSection:(NSInteger) section {
	if([data count] < section || !data) return;
	[[data objectAtIndex:section] removeAllObjects];
}

- (NSUInteger) countOfItemsInSection:(NSInteger) section {
	if([data count] < section) return 0;
	return [[data objectAtIndex:section] count];
}

- (void) removeItemInSection:(NSInteger) section atIndex:(NSInteger) index {
	if([data count] < section) return;
	if([[data objectAtIndex:section] count] < index) return;
	[[data objectAtIndex:section] removeObjectAtIndex:index];
}

- (id) itemInSection:(NSInteger) section atIndex:(NSInteger) index {
	if([data count] < section) return nil;
	if([[data objectAtIndex:section] count] < index) return nil;
	return [[data objectAtIndex:section] objectAtIndex:index];
}

- (NSInteger) numberOfSectionsInTableView:(UITableView *) tableView {
	if(!data) return 0;
	return [data count];
}

- (NSInteger) tableView:(UITableView *) table numberOfRowsInSection:(NSInteger) section {
	if(!data) return 0;
	if([data count] < section) return 0;
	return [[data objectAtIndex:section] count];
}

- (UITableViewCell *) tableView:(UITableView *) tableView cellForRowAtIndexPath:(NSIndexPath *) indexPath {
	NSLog(@"ERROR: You need to implement tableView:cellForRowAtIndexPath: in your UITableDataSourceController subclass.");
	return nil;
}

- (void) dealloc {
#ifdef ACNSLogDealloc
	NSLog(@"DEALLOC UITableDataSourceController");
#endif
	[data release];
	data = nil;
	[super dealloc];
}

@end


text:
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports VANS.MdwsDemo.dao.soap
Imports VANS.MdwsDemo.domain
Imports VANS.us.vacloud.devmdws

Public Class SignatureManagement
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'login check
        Dim loginchk = New clsLoginCheck()
        If (Not loginchk.LoggedIn) Then
            Response.Redirect("~/login.aspx")
        End If

        If Not loginchk.Admin Then
            Response.Redirect("HomeMain.aspx")
        End If

        If Not Page.IsPostBack Then

        End If
    End Sub

    Private Sub rgdSignature_DeleteCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles rgdSignature.DeleteCommand
        Dim gdi As GridDataItem = DirectCast(e.Item, GridDataItem)

        Dim db As Database = DatabaseFactory.CreateDatabase("VOAConnectionString")
        Dim sqlCommand As String = "SignatureDelete"
        Dim objCommand As DbCommand = db.GetStoredProcCommand(sqlCommand)
        db.AddInParameter(objCommand, "@SignatureID", DbType.Int32, gdi.GetDataKeyValue("SignatureID"))
        db.ExecuteNonQuery(objCommand)

        ScriptManager.RegisterStartupScript(Me, Me.GetType(), "MyScript", "alert('" & gdi("Title").Text & " has been deleted" & "');", True)

        rgdSignature.Rebind()
    End Sub

    Private Sub rgdSignature_NeedDataSource(sender As Object, e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgdSignature.NeedDataSource
        Dim db As Database = DatabaseFactory.CreateDatabase("VOAConnectionString")
        Dim sqlCommand As String = "SignatureSelect"
        Dim objCommand As DbCommand = db.GetStoredProcCommand(sqlCommand)
        rgdSignature.DataSource = db.ExecuteDataSet(objCommand)
    End Sub

    Private Sub btnAdd_Click(sender As Object, e As System.EventArgs) Handles btnAdd.Click
        pnlSignatureEdit.Visible = True
        pnlSignatureList.Visible = False
        lblSignatureEditTitle.Text = "Add Signature"
        reSignature.Content = ""
        txtTitle.Text = ""
        chkDefaultEnabled.Checked = False
    End Sub

    Private Sub rgdSignature_UpdateCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs) Handles rgdSignature.UpdateCommand
        pnlSignatureEdit.Visible = True
        pnlSignatureList.Visible = False
        lblSignatureEditTitle.Text = "Edit Signature"
        chkDefaultEnabled.Checked = False

        Dim gdi As GridDataItem = DirectCast(e.Item, GridDataItem)
        lblSignatureID.Text = gdi.GetDataKeyValue("SignatureID")

        Dim db As Database = DatabaseFactory.CreateDatabase("VOAConnectionString")
        Dim sqlCommand As String = "SignatureSelect"
        Dim objCommand As DbCommand = db.GetStoredProcCommand(sqlCommand)
        db.AddInParameter(objCommand, "@SignatureID", DbType.Int32, lblSignatureID.Text)
        Using datareader As IDataReader = db.ExecuteReader(objCommand)
            If datareader.Read Then
                txtTitle.Text = datareader("Title")
                chkDefaultEnabled.Checked = datareader("DefaultEnabled") * -1
                reSignature.Content = datareader("Message")
            End If
        End Using

    End Sub

    Private Sub btnCancel_Click(sender As Object, e As System.EventArgs) Handles btnCancel.Click
        pnlSignatureEdit.Visible = False
        pnlSignatureList.Visible = True
        lblSignatureID.Text = ""
        chkDefaultEnabled.Checked = False
    End Sub

    Private Sub ResetDefault()
        Dim db As Database = DatabaseFactory.CreateDatabase("VOAConnectionString")
        Dim sqlCommand As String = "SignatureDefaultResetUpdate"
        Dim objCommand As DbCommand = db.GetStoredProcCommand(sqlCommand)
        db.ExecuteNonQuery(objCommand)
    End Sub

    Private Sub btnSave_Click(sender As Object, e As System.EventArgs) Handles btnSave.Click
        Dim blnInsert As Boolean
        If Val(lblSignatureID.Text) = 0 Then
            blnInsert = True
        End If

        Dim db As Database = DatabaseFactory.CreateDatabase("VOAConnectionString")
        Dim sqlCommand As String = "SignatureInsertUpdate"
        Dim objCommand As DbCommand = db.GetStoredProcCommand(sqlCommand)

        If chkDefaultEnabled.Checked = True Then
            'Reset previous default enabled.
            ResetDefault()
        End If

        If blnInsert = True Then
            db.AddOutParameter(objCommand, "@InsertSignatureID", SqlDbType.Int, 100)
        Else
            db.AddInParameter(objCommand, "@SignatureID", DbType.Int32, lblSignatureID.Text)
        End If

        db.AddInParameter(objCommand, "@DefaultEnabled", DbType.Int32, chkDefaultEnabled.Checked * -1)
        db.AddInParameter(objCommand, "@Title", DbType.String, txtTitle.Text)
        db.AddInParameter(objCommand, "@Message", DbType.String, reSignature.Content)
        db.ExecuteNonQuery(objCommand)

        If blnInsert = True Then
            lblSignatureID.Text = db.GetParameterValue(objCommand, "@InsertSignatureID")
        End If

        pnlSignatureEdit.Visible = False
        pnlSignatureList.Visible = True
        rgdSignature.Rebind()

        'Display popup message for insert or update
        If blnInsert = True Then
            'New record created
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), "MyScript", "alert('" & txtTitle.Text & " has been created." & "');", True)
        Else
            'Record updated with name
            ScriptManager.RegisterStartupScript(Me, Me.GetType(), "MyScript", "alert('" & txtTitle.Text & " has been updated" & "');", True)
        End If

        lblSignatureID.Text = ""
    End Sub

End Class


text:
Python-PlexAPI
==============
.. image:: https://github.com/pkkid/python-plexapi/workflows/CI/badge.svg
    :target: https://github.com/pkkid/python-plexapi/actions?query=workflow%3ACI
.. image:: https://readthedocs.org/projects/python-plexapi/badge/?version=latest
    :target: http://python-plexapi.readthedocs.io/en/latest/?badge=latest
.. image:: https://codecov.io/gh/pkkid/python-plexapi/branch/master/graph/badge.svg?token=fOECznuMtw
    :target: https://codecov.io/gh/pkkid/python-plexapi
.. image:: https://img.shields.io/github/tag/pkkid/python-plexapi.svg?label=github+release
    :target: https://github.com/pkkid/python-plexapi/releases
.. image:: https://badge.fury.io/py/PlexAPI.svg
    :target: https://badge.fury.io/py/PlexAPI
.. image:: https://img.shields.io/github/last-commit/pkkid/python-plexapi.svg
    :target: https://img.shields.io/github/last-commit/pkkid/python-plexapi.svg

Overview
--------
Unofficial Python bindings for the Plex API. Our goal is to match all capabilities of the official
Plex Web Client. A few of the many features we currently support are:

* Navigate local or remote shared libraries.
* Perform library actions such as scan, analyze, empty trash.
* Remote control and play media on connected clients, including `Controlling Sonos speakers`_
* Listen in on all Plex Server notifications.

Installation & Documentation
----------------------------

.. code-block:: python

    pip install plexapi

Documentation_ can be found at Read the Docs.

.. _Documentation: http://python-plexapi.readthedocs.io/en/latest/

Join our Discord_ for support and discussion.

.. _Discord: https://discord.gg/GtAnnZAkuw

Getting a PlexServer Instance
-----------------------------

There are two types of authentication. If you are running on a separate network
or using Plex Users you can log into MyPlex to get a PlexServer instance. An
example of this is below. NOTE: Servername below is the name of the server (not
the hostname and port).  If logged into Plex Web you can see the server name in
the top left above your available libraries.

.. code-block:: python

    from plexapi.myplex import MyPlexAccount
    account = MyPlexAccount('<USERNAME>', '<PASSWORD>')
    plex = account.resource('<SERVERNAME>').connect()  # returns a PlexServer instance

If you want to avoid logging into MyPlex and you already know your auth token
string, you can use the PlexServer object directly as above, by passing in
the baseurl and auth token directly.

.. code-block:: python

    from plexapi.server import PlexServer
    baseurl = 'http://plexserver:32400'
    token = '2ffLuB84dqLswk9skLos'
    plex = PlexServer(baseurl, token)

Usage Examples
--------------

.. code-block:: python

    # Example 1: List all unwatched movies.
    movies = plex.library.section('Movies')
    for video in movies.search(unwatched=True):
        print(video.title)

.. code-block:: python

    # Example 2: Mark all Game of Thrones episodes as played.
    plex.library.section('TV Shows').get('Game of Thrones').markPlayed()

.. code-block:: python

    # Example 3: List all clients connected to the Server.
    for client in plex.clients():
        print(client.title)

.. code-block:: python

    # Example 4: Play the movie Cars on another client.
    # Note: Client must be on same network as server.
    cars = plex.library.section('Movies').get('Cars')
    client = plex.client("Michael's iPhone")
    client.playMedia(cars)

.. code-block:: python

    # Example 5: List all content with the word 'Game' in the title.
    for video in plex.search('Game'):
        print(f'{video.title} ({video.TYPE})')

.. code-block:: python

    # Example 6: List all movies directed by the same person as Elephants Dream.
    movies = plex.library.section('Movies')
    elephants_dream = movies.get('Elephants Dream')
    director = elephants_dream.directors[0]
    for movie in movies.search(None, director=director):
        print(movie.title)

.. code-block:: python

    # Example 7: List files for the latest episode of The 100.
    last_episode = plex.library.section('TV Shows').get('The 100').episodes()[-1]
    for part in last_episode.iterParts():
        print(part.file)

.. code-block:: python

    # Example 8: Get audio/video/all playlists
    for playlist in plex.playlists():
        print(playlist.title)

.. code-block:: python

    # Example 9: Rate the 100 four stars.
    plex.library.section('TV Shows').get('The 100').rate(8.0)

Controlling Sonos speakers
--------------------------

To control Sonos speakers directly using Plex APIs, the following requirements must be met:

1. Active Plex Pass subscription
2. Sonos account linked to Plex account
3. Plex remote access enabled

Due to the design of Sonos music services, the API calls to control Sonos speakers route through https://sonos.plex.tv
and back via the Plex server's remote access. Actual media playback is local unless networking restrictions prevent the
Sonos speakers from connecting to the Plex server directly.

.. code-block:: python

    from plexapi.myplex import MyPlexAccount
    from plexapi.server import PlexServer

    baseurl = 'http://plexserver:32400'
    token = '2ffLuB84dqLswk9skLos'

    account = MyPlexAccount(token)
    server = PlexServer(baseurl, token)

    # List available speakers/groups
    for speaker in account.sonos_speakers():
        print(speaker.title)

    # Obtain PlexSonosPlayer instance
    speaker = account.sonos_speaker("Kitchen")

    album = server.library.section('Music').get('Stevie Wonder').album('Innervisions')

    # Speaker control examples
    speaker.playMedia(album)
    speaker.pause()
    speaker.setVolume(10)
    speaker.skipNext()

Running tests over PlexAPI
--------------------------

Use:

.. code-block:: bash

     tools/plex-boostraptest.py

with appropriate
arguments and add this new server to a shared user which username is defined in environment veriable `SHARED_USERNAME`.
It uses `official docker image`_ to create a proper instance.

For skipping the docker and reuse a existing server use

.. code-block:: bash

    python plex-bootstraptest.py --no-docker --username USERNAME --password PASSWORD --server-name NAME-OF-YOUR-SEVER

Also in order to run most of the tests you have to provide some environment variables:

* `PLEXAPI_AUTH_SERVER_BASEURL` containing an URL to your Plex instance, e.g. `http://127.0.0.1:32400` (without trailing
  slash)
* `PLEXAPI_AUTH_MYPLEX_USERNAME` and `PLEXAPI_AUTH_MYPLEX_PASSWORD` with your MyPlex username and password accordingly

After this step you can run tests with following command:

.. code-block:: bash

    py.test tests -rxXs --ignore=tests/test_sync.py

Some of the tests in main test-suite require a shared user in your account (e.g. `test_myplex_users`,
`test_myplex_updateFriend`, etc.), you need to provide a valid shared user's username to get them running you need to
provide the username of the shared user as an environment variable `SHARED_USERNAME`. You can enable a Guest account and
simply pass `Guest` as `SHARED_USERNAME` (or just create a user like `plexapitest` and play with it).

To be able to run tests over Mobile Sync api you have to some some more environment variables, to following values
exactly:

* PLEXAPI_HEADER_PROVIDES='controller,sync-target'
* PLEXAPI_HEADER_PLATFORM=iOS
* PLEXAPI_HEADER_PLATFORM_VERSION=11.4.1
* PLEXAPI_HEADER_DEVICE=iPhone

And finally run the sync-related tests:

.. code-block:: bash

    py.test tests/test_sync.py -rxXs

.. _official docker image: https://hub.docker.com/r/plexinc/pms-docker/

Common Questions
----------------

**Why are you using camelCase and not following PEP8 guidelines?**

This API reads XML documents provided by MyPlex and the Plex Server.
We decided to conform to their style so that the API variable names directly
match with the provided XML documents.

**Why don't you offer feature XYZ?**

This library is meant to be a wrapper around the XML pages the Plex
server provides. If we are not providing an API that is offerered in the
XML pages, please let us know! -- Adding additional features beyond that
should be done outside the scope of this library.

**What are some helpful links if trying to understand the raw Plex API?**

* https://github.com/plexinc/plex-media-player/wiki/Remote-control-API
* https://forums.plex.tv/discussion/104353/pms-web-api-documentation
* https://github.com/Arcanemagus/plex-api/wiki


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SortingHelper.cs" company="KlusterKite">
//   All rights reserved
// </copyright>
// <summary>
//   Helper to apply sorting to <see cref="IQueryable{T}" />
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace KlusterKite.API.Client
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics.CodeAnalysis;
    using System.Linq;
    using System.Linq.Expressions;
    using System.Reflection;

    /// <summary>
    /// Helper to apply sorting to <see cref="IQueryable{T}"/>
    /// </summary>
    public static class SortingHelper
    {
        /// <summary>
        /// Applies sorting to the query
        /// </summary>
        /// <typeparam name="TObject">The type of objects to sort</typeparam>
        /// <param name="query">The initial query</param>
        /// <param name="sortingConditions">The list of sorting conditions</param>
        /// <returns>The sorted query</returns>
        public static IQueryable<TObject> ApplySorting<TObject>(
            this IQueryable<TObject> query,
            IEnumerable<SortingCondition> sortingConditions)
        {
            return Helper<TObject>.ApplySorting(query, sortingConditions);
        }

        /// <summary>
        /// Helper to apply sorting to <see cref="IQueryable{T}"/>
        /// </summary>
        /// <typeparam name="TObject">The type of objects to sort</typeparam>
        [SuppressMessage("ReSharper", "StaticMemberInGenericType", Justification = "Suppression is OK here. We are getting use from static members of generic class.")]
        private static class Helper<TObject>
        {
            /// <summary>
            /// The list of sortable properties
            /// </summary>
            private static readonly Dictionary<string, PropertyInfo> Properties;

            /// <summary>
            /// The prepared generics of <see cref="Queryable.OrderBy{TSource,TKey}(IQueryable{TSource},Expression{Func{TSource,TKey}})"/>
            /// </summary>
            private static readonly Dictionary<Type, MethodInfo> OrderByMethods;

            /// <summary>
            /// The prepared generics of <see cref="Queryable.OrderByDescending{TSource,TKey}(IQueryable{TSource},Expression{Func{TSource,TKey}})"/>
            /// </summary>
            private static readonly Dictionary<Type, MethodInfo> OrderByDescendingMethods;

            /// <summary>
            /// The prepared generics of <see cref="Queryable.ThenBy{TSource,TKey}(IOrderedQueryable{TSource},Expression{Func{TSource,TKey}})"/>
            /// </summary>
            private static readonly Dictionary<Type, MethodInfo> ThenByMethods;

            /// <summary>
            /// The prepared generics of <see cref="Queryable.ThenByDescending{TSource,TKey}(IOrderedQueryable{TSource},Expression{Func{TSource,TKey}})"/>
            /// </summary>
            private static readonly Dictionary<Type, MethodInfo> ThenByDescendingMethods;

            /// <summary>
            /// Initializes static members of the <see cref="Helper{TObject}"/> class.
            /// </summary>
            static Helper()
            {
                Properties = new Dictionary<string, PropertyInfo>();
                OrderByMethods = new Dictionary<Type, MethodInfo>();
                OrderByDescendingMethods = new Dictionary<Type, MethodInfo>();
                ThenByMethods = new Dictionary<Type, MethodInfo>();
                ThenByDescendingMethods = new Dictionary<Type, MethodInfo>();

                var queryableType = typeof(Queryable);
                var entityType = typeof(TObject);

                var propertyInfos =
                    typeof(TObject).GetProperties(
                        BindingFlags.Instance | BindingFlags.Public | BindingFlags.GetProperty);
                foreach (var propertyInfo in propertyInfos)
                {
                    Properties[propertyInfo.Name] = propertyInfo;
                    if (OrderByMethods.ContainsKey(propertyInfo.PropertyType))
                    {
                        continue;
                    }

                    OrderByMethods[propertyInfo.PropertyType] =
                        queryableType.GetMethods()
                            .Single(
                                method =>
                                    method.Name == "OrderBy" && method.IsGenericMethodDefinition
                                    && method.GetGenericArguments().Length == 2 && method.GetParameters().Length == 2)
                            .MakeGenericMethod(entityType, propertyInfo.PropertyType);

                    OrderByDescendingMethods[propertyInfo.PropertyType] =
                        queryableType.GetMethods()
                            .Single(
                                method =>
                                    method.Name == "OrderByDescending" && method.IsGenericMethodDefinition
                                    && method.GetGenericArguments().Length == 2 && method.GetParameters().Length == 2)
                            .MakeGenericMethod(entityType, propertyInfo.PropertyType);

                    ThenByMethods[propertyInfo.PropertyType] =
                        queryableType.GetMethods()
                            .Single(
                                method =>
                                    method.Name == "ThenBy" && method.IsGenericMethodDefinition
                                    && method.GetGenericArguments().Length == 2 && method.GetParameters().Length == 2)
                            .MakeGenericMethod(entityType, propertyInfo.PropertyType);

                    ThenByDescendingMethods[propertyInfo.PropertyType] =
                        queryableType.GetMethods()
                            .Single(
                                method =>
                                    method.Name == "ThenByDescending" && method.IsGenericMethodDefinition
                                    && method.GetGenericArguments().Length == 2 && method.GetParameters().Length == 2)
                            .MakeGenericMethod(entityType, propertyInfo.PropertyType);
                }
            }

            /// <summary>
            /// Applies sorting to the query
            /// </summary>
            /// <param name="query">The initial query</param>
            /// <param name="sortingConditions">The list of sorting conditions</param>
            /// <returns>The sorted query</returns>
            public static IQueryable<TObject> ApplySorting(
                IQueryable<TObject> query,
                IEnumerable<SortingCondition> sortingConditions)
            {
                if (sortingConditions == null || query == null)
                {
                    return query;
                }

                var sorted =
                    sortingConditions.Where(c => Properties.ContainsKey(c.PropertyName))
                        .Select(c => new { c.Direction, Property = Properties[c.PropertyName] })
                        .ToList();

                if (sorted.Count == 0)
                {
                    return query;
                }

                var firstCondition = sorted[0];
                var type = typeof(TObject);
                var parameter = Expression.Parameter(type, "e");
                var property = Expression.Property(parameter, firstCondition.Property);
                var expression = Expression.Lambda(property, parameter);

                var sortedQuery = firstCondition.Direction == SortingCondition.EnDirection.Asc
                    ? (IOrderedQueryable<TObject>)OrderByMethods[firstCondition.Property.PropertyType].Invoke(null, new object[] { query, expression })
                    : (IOrderedQueryable<TObject>)OrderByDescendingMethods[firstCondition.Property.PropertyType].Invoke(null, new object[] { query, expression });

                foreach (var sort in sorted.Skip(1))
                {
                    parameter = Expression.Parameter(type, "e");
                    property = Expression.Property(parameter, sort.Property);
                    expression = Expression.Lambda(property, parameter);

                    sortedQuery = sort.Direction == SortingCondition.EnDirection.Asc
                        ? (IOrderedQueryable<TObject>)ThenByMethods[sort.Property.PropertyType].Invoke(null, new object[] { sortedQuery, expression })
                        : (IOrderedQueryable<TObject>)ThenByDescendingMethods[sort.Property.PropertyType].Invoke(null, new object[] { sortedQuery, expression });
                }

                return sortedQuery;
            }
        }
    }
}


text:
// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: google/example/library/v1/library.proto

package com.google.example.library.v1;

public interface CreateBookRequestOrBuilder extends
    // @@protoc_insertion_point(interface_extends:google.example.library.v1.CreateBookRequest)
    com.google.protobuf.MessageOrBuilder {

  /**
   *

   * The name of the shelf in which the book is created.
   *

   *
   * optional string name = 1;
   */
  java.lang.String getName();
  /**
   *

   * The name of the shelf in which the book is created.
   *

   *
   * optional string name = 1;
   */
  com.google.protobuf.ByteString
      getNameBytes();

  /**
   *

   * The book to create.
   *

   *
   * optional .google.example.library.v1.Book book = 2;
   */
  boolean hasBook();
  /**
   *

   * The book to create.
   *

   *
   * optional .google.example.library.v1.Book book = 2;
   */
  com.google.example.library.v1.Book getBook();
  /**
   *

   * The book to create.
   *

   *
   * optional .google.example.library.v1.Book book = 2;
   */
  com.google.example.library.v1.BookOrBuilder getBookOrBuilder();
}


text:
using System;

namespace Microsoft.Recognizers.Text.Sequence
{
    public class BaseIpParser : BaseSequenceParser
    {
        public override ParseResult Parse(ExtractResult extResult)
        {
            var result = new ParseResult
            {
                Start = extResult.Start,
                Length = extResult.Length,
                Text = extResult.Text,
                Type = extResult.Type,
                ResolutionStr = DropLeadingZeros(extResult.Text),
                Data = extResult.Data
            };

            return result;
        }

        private string DropLeadingZeros(string text)
        {
            var result = "";
            var number = "";
            for(var i = 0; i < text.Length; i++)
            {
                var c = text[i];
                if (c == '.' || c == ':')
                {
                    if (number != "")
                    {
                        number = number == "0" ? number : number.TrimStart('0');
                        number = number == "" ? "0" : number;
                        result += number;
                    }
                    result += text[i];
                    number = "";
                }
                else
                {
                    number += c.ToString();
                    if (i == text.Length - 1)
                    {
                        number = number == "0" ? number : number.TrimStart('0');
                        number = number == "" ? "0" : number;
                        result += number;
                    }
                }
            }

            return result;
        }
    }
}


text:
layout: resource
title: Lithuania
---

Code Avengers

Javascript programavimo valanda Šiose pamokose mokinsimės, kaip su JavaScript sukurti viktorinos žaidimą per 5 trumpas pamokas.

Know any other resources? Send us an email or add links to this page with a Pull request on GitHub!


text:
mvn clean compile assembly:single

cd target
java -server -XX:+UseNUMA -XX:+UseParallelGC -XX:+AggressiveOpts -jar rapidoid-1.0-jar-with-dependencies.jar


text:
package dk.jarry.todo.entity;

import java.time.ZonedDateTime;
import java.util.UUID;

public class ToDo {

	private String id;

	private String subject;
	private String body;

	private ZonedDateTime created;
	private ZonedDateTime updated;

	private ZonedDateTime start;
	private ZonedDateTime end;

	private Integer priority;
	private Integer importens;

	private String owner;
	private String createBy;
	private String updatedBy;

	public ToDo() {
		this.id = UUID.randomUUID().toString();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

	public String getBody() {
		return body;
	}

	public void setBody(String body) {
		this.body = body;
	}

	public ZonedDateTime getCreated() {
		return created;
	}

	public void setCreated(ZonedDateTime created) {
		this.created = created;
	}

	public ZonedDateTime getUpdated() {
		return updated;
	}

	public void setUpdated(ZonedDateTime updated) {
		this.updated = updated;
	}

	public ZonedDateTime getStart() {
		return start;
	}

	public void setStart(ZonedDateTime start) {
		this.start = start;
	}

	public ZonedDateTime getEnd() {
		return end;
	}

	public void setEnd(ZonedDateTime end) {
		this.end = end;
	}

	public Integer getPriority() {
		return priority;
	}

	public void setPriority(Integer priority) {
		this.priority = priority;
	}

	public Integer getImportens() {
		return importens;
	}

	public void setImportens(Integer importens) {
		this.importens = importens;
	}

	public String getOwner() {
		return owner;
	}

	public void setOwner(String owner) {
		this.owner = owner;
	}

	public String getCreateBy() {
		return createBy;
	}

	public void setCreateBy(String createBy) {
		this.createBy = createBy;
	}

	public String getUpdatedBy() {
		return updatedBy;
	}

	public void setUpdatedBy(String updatedBy) {
		this.updatedBy = updatedBy;
	}

}


text:
import datetime

from base_manager import BaseManager
from ..models import Export

class ExportManager(BaseManager):
    __model__ = Export

    def last_exports(self):
        return (
            self.session.query(Export)
            .order_by(Export.started_at.desc())
            .limit(50)
            .all()
        )

    def clean_up_old_exports(self):
        """
            Delete all exports older than 30 days from now
        """
        threshold = datetime.datetime.utcnow() - datetime.timedelta(days=30)
        self.session.query(Export).filter(Export.started_at < threshold).delete()


text:
<!-- Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt -->

<script src="src/scope.js"></script>
<script src="src/targetfind.js"></script>
<script src="src/touch-action.js"></script>
<script src="src/eventFactory.js"></script>
<script src="src/pointermap.js"></script>
<script src="src/dispatcher.js"></script>
<script src="src/mouse.js"></script>
<script src="src/touch.js"></script>
<script src="src/ms.js"></script>
<script src="src/pointer.js"></script>
<script src="src/platform-events.js"></script>
<script src="src/track.js"></script>
<script src="src/hold.js"></script>
<script src="src/tap.js"></script>