々眼睛长脚气

文章 评论 浏览 29

々眼睛长脚气 2025-02-20 20:51:13

您可以将标题包装在 getruestector()中。现在,当标题被点击时, 将运行手势检测器,而不是 on Changed()

在此示例中,如果您点击文本“复选框”,则可以看到实际的复选框值未更新,但eStureDetector is 被调用,如果您查看控制台“敲击”是被打印。

这是一个完整的示例。我希望你明白:

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: MyWidget(),
        ),
      ),
    );
  }
}

class MyWidget extends StatefulWidget {
  const MyWidget({Key? key}) : super(key: key);

  @override
  State<MyWidget> createState() => _MyWidgetState();
}

class _MyWidgetState extends State<MyWidget> {
  var _value = false;
  @override
  Widget build(BuildContext context) {
    return CheckboxListTile(
      title: GestureDetector(
        child: Text('Checkbox'),
        onTap: () {
          print('tapped');
          // you can change the value here too
          // setState(() {
          //   _value = !_value;
          // });
        },
      ),
      value: _value,
      onChanged: (bool? value) {
        setState(() {
          _value = value!;
        });
      },
    );
    ;
  }
}

You can wrap your title in a GestureDetector(). Now when the title is tapped, only the gesture detector will be run, and not the onChanged().

In this example, if you tap on the text "Checkbox" then you can see the actual checkbox value is not being updated but the GestureDetector is being called, and if you look at the console "tapped" is being printed.

enter image description here

Here is a complete example. I hope you understand:

import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: MyWidget(),
        ),
      ),
    );
  }
}

class MyWidget extends StatefulWidget {
  const MyWidget({Key? key}) : super(key: key);

  @override
  State<MyWidget> createState() => _MyWidgetState();
}

class _MyWidgetState extends State<MyWidget> {
  var _value = false;
  @override
  Widget build(BuildContext context) {
    return CheckboxListTile(
      title: GestureDetector(
        child: Text('Checkbox'),
        onTap: () {
          print('tapped');
          // you can change the value here too
          // setState(() {
          //   _value = !_value;
          // });
        },
      ),
      value: _value,
      onChanged: (bool? value) {
        setState(() {
          _value = value!;
        });
      },
    );
    ;
  }
}

使用checkboxlisttile在flutter中使用CheckboxListtile时是否可以知道触发复选框或项目文本

々眼睛长脚气 2025-02-20 04:40:01

这是一个许可错误,经常发生在纱线上。使用:

$ sudo yarn global add eas-cli

而是。

This is a permission error, frequently happens on Yarn. Use:

$ sudo yarn global add eas-cli

instead.

我正在尝试安装EAS CLI,并收到错误:ZSH:找不到命令:EAS

々眼睛长脚气 2025-02-19 23:38:14

此错误可能出现的原因之一是因为没有属性称为 client.houter.houter in client 。但是一种方法,您可以使用 client.owner 是如果您创建了 集合 ,然后将其设置为数组。一个例子就是这样:

import { Collection } from 'discord.js'
// ...
client.owner = new Collection()
const ownerArray = [{
    username: '',
    id: ''
}] // Use something like a hardcoded value for the array of owners
ownerArray.forEach(owner => {
    client.owner.set(owner.id, owner.username)
})
// ...

One reason why this error could be coming is because there is no property called as client.owner in a Client. But one way, you could use client.owner is if you created a Collection and then set it to an array. An example would be like this:

import { Collection } from 'discord.js'
// ...
client.owner = new Collection()
const ownerArray = [{
    username: '',
    id: ''
}] // Use something like a hardcoded value for the array of owners
ownerArray.forEach(owner => {
    client.owner.set(owner.id, owner.username)
})
// ...

我的serverlist命令DISCORD机器人错误,任何人都可以帮助我

々眼睛长脚气 2025-02-19 21:24:19

您以前的代码中的错误是:

  1. 如果语句结束之后,则不需要semicolons ;
  2. 没有名称属性为密码以表单中的输入指定。
  3. 将表单数据的形式数据称为如果(isset($ _ post ['submit'])){...} 而无需在表单中指定 name =“ submit” 属性。
  4. 爆破函数的使用无效,它将生成输出就像 enfrit ,反之亦然。

其他提示

  1. 必需的属性添加到每个输入以防止发送空形式数据。
  2. 您已经在表单标签中指定 method =“ post” ,因此,无需验证每个输入字段为 if(isset($ _ post ['fieldName']))){... } 如果(ISSET($ _ post ['submit'])){...} 将以 post 方法发送所有表单数据。

最后,这是您的更新代码。

<?php

if (isset($_POST['submit'])) {
    $name = '';
    $password = '';
    $gender = '';
    $color = '';
    $languages = [];
    $comments = '';
    $tc = '';

    if (isset($_POST['name'])) {
        $name = $_POST['name'];
    }
    if (isset($_POST['password'])) {
        $password = $_POST['password'];
    }
    if (isset($_POST['gender'])) {
        $gender = $_POST['gender'];
    }
    if (isset($_POST['color'])) {
        $color = $_POST['color'];
    }
    if (isset($_POST['languages'])) {
        $languages = $_POST['languages'];
    }
    if (isset($_POST['comments'])) {
        $comments = $_POST['comments'];
    }
    if (isset($_POST['tc'])) {
        $tc = $_POST['tc'];
    }

    //print output
    printf('User name: %s
    <br>Password: %s
    <br>Gender: %s
    <br>Color: %s
    <br>Language(s): %s
    <br>Comments: %s
    <br>T & C: %s
    <br><br>',
    htmlspecialchars($name, ENT_QUOTES),
    htmlspecialchars($password, ENT_QUOTES),
    htmlspecialchars($gender, ENT_QUOTES),
    htmlspecialchars($color, ENT_QUOTES),
    htmlspecialchars(implode(', ', $languages), ENT_QUOTES),
    htmlspecialchars($comments, ENT_QUOTES),
    htmlspecialchars($tc, ENT_QUOTES));
}

?>

<form action="" method="post">
    User name: <input type="text" name="name">
    <br>
    Password: <input type="password" name="password">
    <br>
    Gender:
    <input type="radio" name="gender" value="f"> female
    <input type="radio" name="gender" value="m"> male
    <input type="radio" name="gender" value="o"> other
    <br>
    Favorite color:
    <select name="color">
        <option value="">Please select</option>
        <option value="#f00">red</option>
        <option value="#0f0">green</option>
        <option value="#00f">blue</option>
    </select>
    <br>
    Languages spoken:
    <select name="languages[]" multiple size="3">
        <option value="en">English</option>
        <option value="fr">French</option>
        <option value="it">Italian</option>
    </select>
    <br>
    Comments: <textarea name="comments"></textarea>
    <br>
    <input type="checkbox" name="tc" value="ok"> I accept the T & C
    <br>
    <input type="submit" name="submit" value="Register">
</form>

Errors in your previous code are:

  1. No semicolons ; are needed after ending if statements.
  2. No name attribute is specified for password input in the form.
  3. Posting form data as if (isset($_POST['submit'])) {...} without specifying the name="submit" attribute in the form.
  4. Invalid use of implode function which will generate output be like enfrit or vice versa.

Additional Tips

  1. Add the required attribute to each input to prevent from sending empty form data.
  2. You have already specified method="post" in the form tag so, no need for validating each input field as if (isset($_POST['fieldname'])) {...} . if (isset($_POST['submit'])) {...} will send all the form data as POST method.

And lastly, here is your updated code.

<?php

if (isset($_POST['submit'])) {
    $name = '';
    $password = '';
    $gender = '';
    $color = '';
    $languages = [];
    $comments = '';
    $tc = '';

    if (isset($_POST['name'])) {
        $name = $_POST['name'];
    }
    if (isset($_POST['password'])) {
        $password = $_POST['password'];
    }
    if (isset($_POST['gender'])) {
        $gender = $_POST['gender'];
    }
    if (isset($_POST['color'])) {
        $color = $_POST['color'];
    }
    if (isset($_POST['languages'])) {
        $languages = $_POST['languages'];
    }
    if (isset($_POST['comments'])) {
        $comments = $_POST['comments'];
    }
    if (isset($_POST['tc'])) {
        $tc = $_POST['tc'];
    }

    //print output
    printf('User name: %s
    <br>Password: %s
    <br>Gender: %s
    <br>Color: %s
    <br>Language(s): %s
    <br>Comments: %s
    <br>T & C: %s
    <br><br>',
    htmlspecialchars($name, ENT_QUOTES),
    htmlspecialchars($password, ENT_QUOTES),
    htmlspecialchars($gender, ENT_QUOTES),
    htmlspecialchars($color, ENT_QUOTES),
    htmlspecialchars(implode(', ', $languages), ENT_QUOTES),
    htmlspecialchars($comments, ENT_QUOTES),
    htmlspecialchars($tc, ENT_QUOTES));
}

?>

<form action="" method="post">
    User name: <input type="text" name="name">
    <br>
    Password: <input type="password" name="password">
    <br>
    Gender:
    <input type="radio" name="gender" value="f"> female
    <input type="radio" name="gender" value="m"> male
    <input type="radio" name="gender" value="o"> other
    <br>
    Favorite color:
    <select name="color">
        <option value="">Please select</option>
        <option value="#f00">red</option>
        <option value="#0f0">green</option>
        <option value="#00f">blue</option>
    </select>
    <br>
    Languages spoken:
    <select name="languages[]" multiple size="3">
        <option value="en">English</option>
        <option value="fr">French</option>
        <option value="it">Italian</option>
    </select>
    <br>
    Comments: <textarea name="comments"></textarea>
    <br>
    <input type="checkbox" name="tc" value="ok"> I accept the T & C
    <br>
    <input type="submit" name="submit" value="Register">
</form>

PHP验证表格

々眼睛长脚气 2025-02-19 20:14:58

您的输出对象 value ui 中两次使用。这些ID应该是唯一的。另外,制作 myData 是数据框架。尝试此

library(rsconnect)
library(shiny)
library(survival)
library(survminer)
library(readxl)

myData <- data.frame(Years_Diff_Surg_Death = c(36.99383984, 2.584531143, 36.91991786, 36.89527721, 36.88158795, 36.82135524), 
                     Survival = c(1L, 0L, 1L, 1L, 1L, 1L))

data_2013 <- structure(list(Years_Diff_Surg_Death = c(36.993839835729, 2.5845311430527, 
                                                      36.9199178644764, 36.8952772073922, 36.8815879534565, 36.8213552361396), 
                            Survival = c(1, 0, 1, 1, 1, 0)))

data_2014 <- structure(list(Years_Diff_Surg_Death = c(0.542094455852156, 5.19644079397673, 
                                                      35.9561943874059, 
                                                      35.917864476386, 35.8658453114305, 
                                                      35.8275154004107), 
                            Survival = c(0, 
                                         0, 1, 1, 1, 1)))

data_2015 <- structure(list(Years_Diff_Surg_Death = c(34.4476386036961, 34.2559890485969, 
                                                      0.621492128678987, 34.3874058863792, 
                                                      34.3326488706365, 1.08145106091718), Survival = c(0, 
                                                                                                        1, 1, 0, 1, 0)))

data_2016 <- structure(list(Years_Diff_Surg_Death = c(2.90212183436003, 
                                                      0.950034223134839, 
                                                      33.9301848049281, 33.9110198494182, 33.8726899383984, 
                                                      33.8535249828884), 
                            Survival = c(1, 1, 0, 0, 0, 0)))

data_2017 <- structure(list(Years_Diff_Surg_Death = c(32.9911019849418, 3.34839151266256, 
                                                      32.952772073922, 32.911704312115, 32.8761122518823, 0.791238877481177), 
                            Survival = c(1, 0, 1, 1, 1, 1)))

set.seed(121)
mydate = seq(Sys.Date(), by = "day", length.out = 1800)
mystatus = sample(c("DATE_OF_SURGERY", "DATE_OF_DEATH"), 30, replace = TRUE)
mydf = data.frame(Date = mydate, Status = mystatus)



# Define UI for dataset viewer application
ui <- shinyUI(
  
  pageWithSidebar(
    # Application title.
    headerPanel(""),
    
    sidebarPanel(
      sliderInput(inputId = "surv",
                  label = "Number of Years",
                  min = 0,
                  max = 5,
                  value = 1,
                  animate = animationOptions(interval=800, loop=TRUE)
      )
    ),
    
    mainPanel(
      h1("Survival Plot"),
      img(src = "logo-no-tag.png", height = 120, weight = 200),
      fluidPage(
        
        # Copy the line below to make a date selector 
        dateRangeInput(
          inputId = "daterange",
          label = "select the date range",
          start = min(mydf$Date),
          end = max(mydf$Date),
          min = min(mydf$Date),
          max = max(mydf$Date),
          format = "yyyy/mm/dd",
          separator = "to"
        ),
        textOutput("startdate"),
        textOutput("enddate"),
        textOutput("range"),
        tableOutput("subdata"),
        
        hr(),
        fluidRow(column(3, verbatimTextOutput("value"))),
        fluidRow(column(3, verbatimTextOutput("value2"))),
      ),
      
      tabsetPanel(
        tabPanel("Plot", plotOutput("plot_predicted")),
        tabPanel("Model Summary", verbatimTextOutput("summary")),
        tabPanel("Data", tableOutput("raw_data")),
        tabPanel("Survival Curves for Each Year", plotOutput("plot_predicted_2")),
        id = "tabs"
      ) 
    )
  ))

survfitdata4 <- survfit(Surv(Years_Diff_Surg_Death, Survival) ~ 1, data = myData)

server <- function(input, output, session) {
  
  output$value <- renderPrint({ input$date })
  output$value2 <- renderPrint({ input$date + 1 })
  survobj1 <- with(myData, Surv(Years_Diff_Surg_Death, Survival))
  output$plot_predicted <- renderPlot({
    
    fit1 <- survfit(survobj1 ~ 1, data = myData)
    ggsurvplot(fit1, conf.int = TRUE,
               ylim = c(0,1),
               xlim = c(0,5),
               break.x.by = 1,
               title = ("Years of Death After Surgery via Survival"),
               xlab = ("Years"),
               legend = "none")
  })
  
  output$plot_predicted_2 <- renderPlot({
    survobj_2013 <- with(data_2013, Surv(Years_Diff_Surg_Death, Survival))
    survobj_2014 <- with(data_2014, Surv(Years_Diff_Surg_Death, Survival))
    survobj_2015 <- with(data_2015, Surv(Years_Diff_Surg_Death, Survival))
    survobj_2016 <- with(data_2016, Surv(Years_Diff_Surg_Death, Survival))
    survobj_2017 <- with(data_2017, Surv(Years_Diff_Surg_Death, Survival))
    surv_2013 <- survfit(Surv(Years_Diff_Surg_Death, Survival) ~ 1, data = data_2013)
    surv_2014 <- survfit(Surv(Years_Diff_Surg_Death, Survival) ~ 1, data = data_2014)
    surv_2015 <- survfit(Surv(Years_Diff_Surg_Death, Survival) ~ 1, data = data_2015)
    surv_2016 <- survfit(Surv(Years_Diff_Surg_Death, Survival) ~ 1, data = data_2016)
    surv_2017 <- survfit(Surv(Years_Diff_Surg_Death, Survival) ~ 1, data = data_2017)
    fit_comb <- list(s_2013 = surv_2013,
                     s_2014 = surv_2014,
                     s_2015 = surv_2015,
                     s_2016 = surv_2016,
                     s_2017 = surv_2017)
    ggsurvplot_combine(fit_comb,
                       data_ECV,
                       xlab = ("Years"),
                       xlim = c(0,5),
                       break.x.by = 1)
  })
  
  output$summary <- renderPrint({
    summary(survfitdata4)
  })
  
  output$raw_data <- renderTable({
    myData
  }, include.rownames = FALSE)
  
  # returns the start date selected by the user
  output$startdate <- renderText({
    as.character(input$daterange[1]) # start date selected by user
  })
  
  # returns the end date selected by the user
  output$enddate <- renderText({
    as.character(input$daterange[2]) # End date selected by the user
  })
  
  # returns the text showing the date range selected by the user
  output$range <- renderText({
    paste("Selected date range is ", input$daterange[1], "to", input$daterange[2]) 
  })
  
  # returns the status count information based on selected date
  output$subdata <- renderTable({
    # subsetting using the dates selected by the user
    s = subset(mydf, mydf$Date>= input$daterange[1] & mydf$Date<= input$daterange[2])
    table(s$Status) # to get the counts on status for selected date range
    
  })
}

shinyApp(ui = ui, server = server)

You had the output object value being used twice in the ui. These IDs should be unique. Also, made myData to be a data frame. Try this

library(rsconnect)
library(shiny)
library(survival)
library(survminer)
library(readxl)

myData <- data.frame(Years_Diff_Surg_Death = c(36.99383984, 2.584531143, 36.91991786, 36.89527721, 36.88158795, 36.82135524), 
                     Survival = c(1L, 0L, 1L, 1L, 1L, 1L))

data_2013 <- structure(list(Years_Diff_Surg_Death = c(36.993839835729, 2.5845311430527, 
                                                      36.9199178644764, 36.8952772073922, 36.8815879534565, 36.8213552361396), 
                            Survival = c(1, 0, 1, 1, 1, 0)))

data_2014 <- structure(list(Years_Diff_Surg_Death = c(0.542094455852156, 5.19644079397673, 
                                                      35.9561943874059, 
                                                      35.917864476386, 35.8658453114305, 
                                                      35.8275154004107), 
                            Survival = c(0, 
                                         0, 1, 1, 1, 1)))

data_2015 <- structure(list(Years_Diff_Surg_Death = c(34.4476386036961, 34.2559890485969, 
                                                      0.621492128678987, 34.3874058863792, 
                                                      34.3326488706365, 1.08145106091718), Survival = c(0, 
                                                                                                        1, 1, 0, 1, 0)))

data_2016 <- structure(list(Years_Diff_Surg_Death = c(2.90212183436003, 
                                                      0.950034223134839, 
                                                      33.9301848049281, 33.9110198494182, 33.8726899383984, 
                                                      33.8535249828884), 
                            Survival = c(1, 1, 0, 0, 0, 0)))

data_2017 <- structure(list(Years_Diff_Surg_Death = c(32.9911019849418, 3.34839151266256, 
                                                      32.952772073922, 32.911704312115, 32.8761122518823, 0.791238877481177), 
                            Survival = c(1, 0, 1, 1, 1, 1)))

set.seed(121)
mydate = seq(Sys.Date(), by = "day", length.out = 1800)
mystatus = sample(c("DATE_OF_SURGERY", "DATE_OF_DEATH"), 30, replace = TRUE)
mydf = data.frame(Date = mydate, Status = mystatus)



# Define UI for dataset viewer application
ui <- shinyUI(
  
  pageWithSidebar(
    # Application title.
    headerPanel(""),
    
    sidebarPanel(
      sliderInput(inputId = "surv",
                  label = "Number of Years",
                  min = 0,
                  max = 5,
                  value = 1,
                  animate = animationOptions(interval=800, loop=TRUE)
      )
    ),
    
    mainPanel(
      h1("Survival Plot"),
      img(src = "logo-no-tag.png", height = 120, weight = 200),
      fluidPage(
        
        # Copy the line below to make a date selector 
        dateRangeInput(
          inputId = "daterange",
          label = "select the date range",
          start = min(mydf$Date),
          end = max(mydf$Date),
          min = min(mydf$Date),
          max = max(mydf$Date),
          format = "yyyy/mm/dd",
          separator = "to"
        ),
        textOutput("startdate"),
        textOutput("enddate"),
        textOutput("range"),
        tableOutput("subdata"),
        
        hr(),
        fluidRow(column(3, verbatimTextOutput("value"))),
        fluidRow(column(3, verbatimTextOutput("value2"))),
      ),
      
      tabsetPanel(
        tabPanel("Plot", plotOutput("plot_predicted")),
        tabPanel("Model Summary", verbatimTextOutput("summary")),
        tabPanel("Data", tableOutput("raw_data")),
        tabPanel("Survival Curves for Each Year", plotOutput("plot_predicted_2")),
        id = "tabs"
      ) 
    )
  ))

survfitdata4 <- survfit(Surv(Years_Diff_Surg_Death, Survival) ~ 1, data = myData)

server <- function(input, output, session) {
  
  output$value <- renderPrint({ input$date })
  output$value2 <- renderPrint({ input$date + 1 })
  survobj1 <- with(myData, Surv(Years_Diff_Surg_Death, Survival))
  output$plot_predicted <- renderPlot({
    
    fit1 <- survfit(survobj1 ~ 1, data = myData)
    ggsurvplot(fit1, conf.int = TRUE,
               ylim = c(0,1),
               xlim = c(0,5),
               break.x.by = 1,
               title = ("Years of Death After Surgery via Survival"),
               xlab = ("Years"),
               legend = "none")
  })
  
  output$plot_predicted_2 <- renderPlot({
    survobj_2013 <- with(data_2013, Surv(Years_Diff_Surg_Death, Survival))
    survobj_2014 <- with(data_2014, Surv(Years_Diff_Surg_Death, Survival))
    survobj_2015 <- with(data_2015, Surv(Years_Diff_Surg_Death, Survival))
    survobj_2016 <- with(data_2016, Surv(Years_Diff_Surg_Death, Survival))
    survobj_2017 <- with(data_2017, Surv(Years_Diff_Surg_Death, Survival))
    surv_2013 <- survfit(Surv(Years_Diff_Surg_Death, Survival) ~ 1, data = data_2013)
    surv_2014 <- survfit(Surv(Years_Diff_Surg_Death, Survival) ~ 1, data = data_2014)
    surv_2015 <- survfit(Surv(Years_Diff_Surg_Death, Survival) ~ 1, data = data_2015)
    surv_2016 <- survfit(Surv(Years_Diff_Surg_Death, Survival) ~ 1, data = data_2016)
    surv_2017 <- survfit(Surv(Years_Diff_Surg_Death, Survival) ~ 1, data = data_2017)
    fit_comb <- list(s_2013 = surv_2013,
                     s_2014 = surv_2014,
                     s_2015 = surv_2015,
                     s_2016 = surv_2016,
                     s_2017 = surv_2017)
    ggsurvplot_combine(fit_comb,
                       data_ECV,
                       xlab = ("Years"),
                       xlim = c(0,5),
                       break.x.by = 1)
  })
  
  output$summary <- renderPrint({
    summary(survfitdata4)
  })
  
  output$raw_data <- renderTable({
    myData
  }, include.rownames = FALSE)
  
  # returns the start date selected by the user
  output$startdate <- renderText({
    as.character(input$daterange[1]) # start date selected by user
  })
  
  # returns the end date selected by the user
  output$enddate <- renderText({
    as.character(input$daterange[2]) # End date selected by the user
  })
  
  # returns the text showing the date range selected by the user
  output$range <- renderText({
    paste("Selected date range is ", input$daterange[1], "to", input$daterange[2]) 
  })
  
  # returns the status count information based on selected date
  output$subdata <- renderTable({
    # subsetting using the dates selected by the user
    s = subset(mydf, mydf$Date>= input$daterange[1] & mydf$Date<= input$daterange[2])
    table(s$Status) # to get the counts on status for selected date range
    
  })
}

shinyApp(ui = ui, server = server)

output

r&quot中的闪亮应用程序问题未找到“输出对象”

々眼睛长脚气 2025-02-19 13:19:12

如果您在分支机构中没有提议,这可能会发生。

This might happen if you have no commits in the branch.

新的分支IS不显示Git分支-A

々眼睛长脚气 2025-02-19 12:13:17

也许您可以为此使用一个队列。

  • 这个想法是直接以某些随机或有组织的顺序(例如字母顺序)将ID或审阅者发射的队列直接开始。
  • 然后,您首先将特定任务从队列中删除并将其附加到队列的背面,从而分配特定的任务。
  • 分配了所有特定任务后,您将从队列中拿出下一个审阅者,将他分配给他下一个任务,然后将他放在队列的后面。
  • 可以将新审稿人附加到队列的前面,因此他们将获得未具体的下一个任务,然后再转到队列后面。

以最简单的形式,您可以在Python中实现一个队列作为Deque,它具有您需要的所有功能(附加,附录Left,Pop和删除)。

from collections import deque


specific_tasks = [(3, "math"), (5, "english"), (2, "biology")]
print(f"{specific_tasks=}")
other_tasks = ["geography", "physiks", "chemistry", "sport", "history", "german"]
print(f"{other_tasks=}")
queue = deque([1, 2, 3, 4, 5, 6])
print(f"{queue=}")


print("\n--- assign specific tasks ---")
for reviewer_id, specific_task in specific_tasks:
    queue.remove(reviewer_id)
    queue.appendleft(reviewer_id)
    print(f"assign {specific_task=} to {reviewer_id=}")
    print(f"{queue=}")

print("\n--- assign other tasks ---")
for other_task in other_tasks:
    reviewer_id = queue.pop()
    queue.appendleft(reviewer_id)
    print(f"assign {other_task=} to {reviewer_id=}")
    print(f"{queue=}")

print("\n--- add reviewer ---")
new_reviewer = 9
queue.append(new_reviewer)
print(f"add reviewer {new_reviewer}")
print(f"{queue=}")

print("\n--- remove reviewer ---")
reviewer_to_remove = 4
queue.remove(reviewer_to_remove)
print(f"remove reviewer {reviewer_to_remove}")
print(f"{queue=}")

这给出以下输出:

specific_tasks=[(3, 'math'), (5, 'english'), (2, 'biology')]
other_tasks=['geography', 'physiks', 'chemistry', 'sport', 'history', 'german']
queue=deque([1, 2, 3, 4, 5, 6])

--- assign specific tasks ---
assign specific_task='math' to reviewer_id=3
queue=deque([3, 1, 2, 4, 5, 6])
assign specific_task='english' to reviewer_id=5
queue=deque([5, 3, 1, 2, 4, 6])
assign specific_task='biology' to reviewer_id=2
queue=deque([2, 5, 3, 1, 4, 6])

--- assign other tasks ---
assign other_task='geography' to reviewer_id=6
queue=deque([6, 2, 5, 3, 1, 4])
assign other_task='physiks' to reviewer_id=4
queue=deque([4, 6, 2, 5, 3, 1])
assign other_task='chemistry' to reviewer_id=1
queue=deque([1, 4, 6, 2, 5, 3])
assign other_task='sport' to reviewer_id=3
queue=deque([3, 1, 4, 6, 2, 5])
assign other_task='history' to reviewer_id=5
queue=deque([5, 3, 1, 4, 6, 2])
assign other_task='german' to reviewer_id=2
queue=deque([2, 5, 3, 1, 4, 6])

--- add reviewer ---
add reviewer 9
queue=deque([2, 5, 3, 1, 4, 6, 9])

--- remove reviewer ---
remove reviewer 4
queue=deque([2, 5, 3, 1, 6, 9])

Maybe you could just use a queue for that.

  • The idea is to have a queue of IDs or the reviewer-instances directly, that starts in some random or organized order (e.g. alphabetically).
  • Then you first assign the specific tasks by removing the reviewer from the queue and appending him to the back of the queue one by one.
  • After all the specific tasks are assigned you take the next reviewer from the queue assign him the next task and put him to the back of the queue.
  • New reviewers could be appended to the front of the queue so they'll get the next task that is not specific but then go to the back of the queue after.

In the easiest form you can implement a queue as a deque in python, that has all functionality you need (append, appendleft, pop and remove).

from collections import deque


specific_tasks = [(3, "math"), (5, "english"), (2, "biology")]
print(f"{specific_tasks=}")
other_tasks = ["geography", "physiks", "chemistry", "sport", "history", "german"]
print(f"{other_tasks=}")
queue = deque([1, 2, 3, 4, 5, 6])
print(f"{queue=}")


print("\n--- assign specific tasks ---")
for reviewer_id, specific_task in specific_tasks:
    queue.remove(reviewer_id)
    queue.appendleft(reviewer_id)
    print(f"assign {specific_task=} to {reviewer_id=}")
    print(f"{queue=}")

print("\n--- assign other tasks ---")
for other_task in other_tasks:
    reviewer_id = queue.pop()
    queue.appendleft(reviewer_id)
    print(f"assign {other_task=} to {reviewer_id=}")
    print(f"{queue=}")

print("\n--- add reviewer ---")
new_reviewer = 9
queue.append(new_reviewer)
print(f"add reviewer {new_reviewer}")
print(f"{queue=}")

print("\n--- remove reviewer ---")
reviewer_to_remove = 4
queue.remove(reviewer_to_remove)
print(f"remove reviewer {reviewer_to_remove}")
print(f"{queue=}")

This gives following output:

specific_tasks=[(3, 'math'), (5, 'english'), (2, 'biology')]
other_tasks=['geography', 'physiks', 'chemistry', 'sport', 'history', 'german']
queue=deque([1, 2, 3, 4, 5, 6])

--- assign specific tasks ---
assign specific_task='math' to reviewer_id=3
queue=deque([3, 1, 2, 4, 5, 6])
assign specific_task='english' to reviewer_id=5
queue=deque([5, 3, 1, 2, 4, 6])
assign specific_task='biology' to reviewer_id=2
queue=deque([2, 5, 3, 1, 4, 6])

--- assign other tasks ---
assign other_task='geography' to reviewer_id=6
queue=deque([6, 2, 5, 3, 1, 4])
assign other_task='physiks' to reviewer_id=4
queue=deque([4, 6, 2, 5, 3, 1])
assign other_task='chemistry' to reviewer_id=1
queue=deque([1, 4, 6, 2, 5, 3])
assign other_task='sport' to reviewer_id=3
queue=deque([3, 1, 4, 6, 2, 5])
assign other_task='history' to reviewer_id=5
queue=deque([5, 3, 1, 4, 6, 2])
assign other_task='german' to reviewer_id=2
queue=deque([2, 5, 3, 1, 4, 6])

--- add reviewer ---
add reviewer 9
queue=deque([2, 5, 3, 1, 4, 6, 9])

--- remove reviewer ---
remove reviewer 4
queue=deque([2, 5, 3, 1, 6, 9])

是否有算法来解决任务分配问题?

々眼睛长脚气 2025-02-18 22:47:09

我不想编辑应用程序的app.xaml文件来放置解决用户控制问题的样式,因为我不得不使用此类控件编辑每个应用程序。
幸运的是,我发现将解决方法放入用户控制概要中,该方法使我可以解决问题而无需编辑应用程序XAML文件:

Style listViewItemStyle = new Style(typeof(ListViewItem));
listViewItemStyle.Setters.Add(new Setter(ListViewItem.HorizontalContentAlignmentProperty, HorizontalAlignment.Stretch));
listViewItemStyle.Setters.Add(new Setter(ListViewItem.VerticalContentAlignmentProperty, VerticalAlignment.Center));

if (!Application.Current.Resources.Contains(typeof(ListViewItem)))
{
    Application.Current.Resources.Add(typeof(ListViewItem), listViewItemStyle);
}

尽管以上代码工作,我想知道为什么我无法直接从中获得所需的结果用户控制XAML。

I didn't like to edit the App.xaml file of an app to put a style that fixes the an user control problem, cause like that I would had to edit every app using such control.
Luckily I found a workaround to be placed into the user control contructor that allows me to solve the problem without to edit the applications xaml file:

Style listViewItemStyle = new Style(typeof(ListViewItem));
listViewItemStyle.Setters.Add(new Setter(ListViewItem.HorizontalContentAlignmentProperty, HorizontalAlignment.Stretch));
listViewItemStyle.Setters.Add(new Setter(ListViewItem.VerticalContentAlignmentProperty, VerticalAlignment.Center));

if (!Application.Current.Resources.Contains(typeof(ListViewItem)))
{
    Application.Current.Resources.Add(typeof(ListViewItem), listViewItemStyle);
}

although the above code works I'd like to know why I can't get the desired result directly from the user control xaml.

listViewItem样式从app.xaml起作用,而从用户控制xaml工作不从用户控制

々眼睛长脚气 2025-02-18 20:19:36

这是帮助我在Visual Studio中解决同样问题的步骤。

  1. 确保您拥有Azure Devops中提要的所有者或贡献者的权限。像这样:

“在此处输入图像描述”

  1. 然后在Visual Studio中确保使用具有上一步的权限的帐户签名。

  1. 最终重建解决方案。

希望这也可以解决您的问题!

Here are the steps that helped me fix this same issue in Visual Studio.

  1. Make sure that you have Owner or Contributor permissions to the Feed in Azure DevOps. Something like this:

enter image description here

  1. Then in Visual Studio make sure that you are signed in using the account that has the permissions from the previous step.

enter image description here

  1. Finally rebuild the solution.

Hopefully this fix your issue too!

Azure Devops Nuget Restore失败了,“无法为源代码加载服务索引。

々眼睛长脚气 2025-02-18 07:12:12

我知道您正在使用React。但是这个答案是针对角度的人,因为我也有同样的问题,但对于角度。

您输入此命令 -

ng build

将创建DIST文件夹。

文档可以在这里找到 -

I know you're using react. But this answer is for the Angular folks because I had the same question, but for Angular.

You type in this command -

ng build

That will create the dist folder.

Documentation can be found here -
https://angular.io/guide/deployment#building-and-serving-from-disk

哪个NPM命令在Nodejs中创建DIST文件夹?

々眼睛长脚气 2025-02-18 00:04:31

您可以使用 get-azkeyvaultSecret keyVault 秘密中获取访问令牌,并具有相应的SAS定义。

要检索特定的SAS定义,您必须


# Take a substring of vault secret from the secret identifier 
# https://<keyvaultName>.vault.azure.net/secrets/<vault name>/<vault secret>

$sas = Set-AzKeyVaultManagedStorageSasDefinition -AccountName <StorageAccount Name> -VaultName <vault Name> -Name accountsas -TemplateUri <Template Uri> -SasType 'account' -ValidityPeriod ([System.Timespan]::FromDays(30))

Get-AzKeyVaultSecret -VaultName <Keyvault Name> -Name $sas.Sid.Substring($sas.Sid.LastIndexOf('/')+1)

在检索SAS定义后使用以下PowerShell命令尝试列出容器文件。

请参阅此处有关更多信息。

You can use the Get-AzKeyVaultSecret to get the access token from the keyVault secret with respective SAS Definition.

To retrieve the specific SAS Definition, you have to use the below PowerShell Command


# Take a substring of vault secret from the secret identifier 
# https://<keyvaultName>.vault.azure.net/secrets/<vault name>/<vault secret>

$sas = Set-AzKeyVaultManagedStorageSasDefinition -AccountName <StorageAccount Name> -VaultName <vault Name> -Name accountsas -TemplateUri <Template Uri> -SasType 'account' -ValidityPeriod ([System.Timespan]::FromDays(30))

Get-AzKeyVaultSecret -VaultName <Keyvault Name> -Name $sas.Sid.Substring($sas.Sid.LastIndexOf('/')+1)

After retrieving the SAS Definition try to list the container files.

Refer here for more information.

使用Azure Vault Secret访问Azure容器文件

々眼睛长脚气 2025-02-17 22:59:31

在Expo Go应用程序上调试时,尝试使用本机模块时会发生此错误消息。该模块应在独立应用程序中使用。

您可以在此处找到其他与本机模块进行调试的方法/构建/内部分布/

This error message occurs when trying to use a native module when debugging on the expo go app. The module should work in the standalone app.

You can find other ways to debug with the native modules here https://docs.expo.dev/build/internal-distribution/

当使用反应现代购买时,本机模块不能为null

々眼睛长脚气 2025-02-17 18:38:53

@Router 中没有 @component

@Autowired Spring Bean注入只能在Spring Bean组件中使用,并且只能与Spring Bean组件一起使用。

如果要注入Spring Bean,则必须在 @component 上使用 loginview 如下所示。

@Component
@Route("login")
public class LoginView extends VerticalLayout {

    private LoginOverlay login;

    @Autowired
    private UiSecurityService uiSecurityService;
    
    public LoginView() {
    createContents();
    }
    
    private void createContents() {
    // create Layout
    }

    private void onLoginPressed(LoginEvent e) {
    // handle login
    }
}

There is no @Component in @Router.

@Autowired spring bean injection can use only in spring bean component and can use only with spring bean component.

If you want to inject spring bean, you must use @Component on LoginView like below.

@Component
@Route("login")
public class LoginView extends VerticalLayout {

    private LoginOverlay login;

    @Autowired
    private UiSecurityService uiSecurityService;
    
    public LoginView() {
    createContents();
    }
    
    private void createContents() {
    // create Layout
    }

    private void onLoginPressed(LoginEvent e) {
    // handle login
    }
}

春季:注射字段为空

々眼睛长脚气 2025-02-17 12:27:50
SELECT count(*) AS votes
FROM  (SELECT ndistrict FROM polling WHERE name = 'm1') p
JOIN   census USING (ndistrict);

用于从子查询 P 的任意数量的行作品。
它假定该子查询没有重复(由于 ndistrict 是根据您的表定义的 polling 的pk),并且 iDcard 要定义代码>不是null (以便更快的计数(*)等效于 count> count(idcard)

它返回投票数,这不一定与:

选民人数(IDCARD编号),他们在市政当局投票'M1'

如果同一选民可以投票多次投票,则

SELECT count(DISTINCT idcard) AS voters
FROM  (SELECT ndistrict FROM polling WHERE name = 'm1') p
JOIN   census USING (ndistrict);
SELECT count(*) AS votes
FROM  (SELECT ndistrict FROM polling WHERE name = 'm1') p
JOIN   census USING (ndistrict);

Works for any number of rows returned from subquery p.
It assumes no duplicates from that subquery (given since ndistrict is the PK of polling according to your table definition), and idcard to be defined NOT NULL (so that the faster count(*) is equivalent to count(idcard).

It returns the number of votes, which is not necessarily the same as:

the number of voters (the idcard number), who have voted in the municipality 'm1'

If the same voter can have cast multiple votes, to count distinct voters:

SELECT count(DISTINCT idcard) AS voters
FROM  (SELECT ndistrict FROM polling WHERE name = 'm1') p
JOIN   census USING (ndistrict);

SQL具有两个行的聚合函数

々眼睛长脚气 2025-02-17 07:50:04

这将是命令中提到的@mad物理学家的不确定行为来自缓冲区的确切尺寸。

读取比缓冲区的大小少1个,以留出空间的空字符。

示例:

char buff[8], str[32]="asdfasdfasasdfasdfdfasdf";
sscanf(buff, "%7s", str);

That will be an undefined behavior as @Mad Physicist mentioned in the command but if you want to avoid I, you can use the width modifier of scanf() function to read the exact size from the buffer.

Read by 1 less than the size of the buffer to leave space for the the null character.

The example:

char buff[8], str[32]="asdfasdfasasdfasdfdfasdf";
sscanf(buff, "%7s", str);

如果SCANF接受比缓冲区中的空间更多的角色会发生什么?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文