问:
Environment variables in Attachmate Extra Basic Macros
I needed to add current working directory to a macro which I thought would be simple using an environment variable, but quickly learned Extra basic does not recognize "CD" like windows does.  After searching I found the code below to see what all variables I have at my disposal and to my dismay none provide current working directory. Can someone suggest an efficient method of finding the path the Macro is currently running in?</p>
```<code>    Dim strEnviron As String
    Dim i As Long
    For i = 1 To 255
         strEnviron = Environ(i)
        If LenB(strEnviron) = 0& Then Exit For
        msgbox strEnviron
    Next
</code>```

Body:
I needed to add current working directory to a macro which I thought would be simple using an environment variable, but quickly learned Extra basic does not recognize "CD" like windows does.  After searching I found the code below to see what all variables I have at my disposal and to my dismay none provide current working directory. Can someone suggest an efficient method of finding the path the Macro is currently running in?

    Dim strEnviron As String
    Dim i As Long
    For i = 1 To 255
         strEnviron = Environ(i)
        If LenB(strEnviron) = 0& Then Exit For
        msgbox strEnviron
    Next


来源: stackexchange

问:
Shiny modules & insertUI/removeUI: storing all module inputs in a data frame
Background: I have an app where the user enters their cancer history. For each cancer type they need to enter 1) the name of the cancer, 2) the age of diagnosis, and 3) a conditional input with a secondary cancer name. Initially, the user sees no inputs, just an "add cancer" button. When they click this button, the UI module generates a set of those three inputs for entering the information for one cancer. Each successive click of the button adds a new set of inputs for another cancer. On the server side of my app, I have a three column data frame stored in a reactiveValues() for storing all of the cancer history information, I call this the master data frame. Each row of this data frame will store the cancer information for one cancer/one set of UI module inputs. This data frame should be updated any time any cancer input is updated.

The Problem: The UI module works great but the server module is a problem. The goal of the server module is to create a one row, three column data frame to store the data for one set of UI module inputs/one cancer. This single row data frame updates every time one of the three inputs in the related UI module is changed. In the server side of the app, I need the rows of the master data frame to be individually updated by each server module. When I try to do this I get the following error message just before the app crashes:

Warning: Error in as.vector: cannot coerce type 'environment' to vector of type 'any'

Using the View() function I inserted inside of the server module for testing confirms the server module is indeed doing what it is supposed to. The problem is integrating the server module into the master data frame.

REPREX:

UI module:

```<code># module to enter data for one cancer
canUI <- function(id, canNum){

  # reserve a local namespace for cancer hx
  ns <- NS(id)

  tags$div(id = paste0("canSubContainer", id),
   tagList(
     fluidRow(
       column(width = 2,
        selectInput(inputId = ns("Can"),
                    label = h5(paste0("Cancer ",canNum(),":")),
                    choices = c("No cancer selected", paste0("Cancer ", 1:10), "Other"),
                    width = "200px")
       ),
       column(width = 1,
        conditionalPanel(sprintf("input['%s'] != 'No cancer selected'", ns("Can")),
         div(numericInput(inputId = ns("CanAge"),
                          label = h5("Diagnosis Age:"),
                          min = 0, max = 100, step = 1, value = NA,
                          width = "100px")
         ),
        )
       ),
       # remove this set of cancer inputs
       column(width = 1,
        actionButton(inputId = ns("removeCan"),
                     label = NULL,
                     icon = icon('trash'),
                     style = "margin-top:40px")
       )
     ),
     conditionalPanel(sprintf("input['%s'] == 'Other'", ns("Can")),
      fluidRow(
        column(1, h5("Other cancer:", style = "margin-left:25px")),
        column(2,
         div(selectizeInput(inputId = ns("CanOther"),
                            label = NULL,
                            choices = c("Unknown/Not Listed", paste0("Other Cancer", 1:10)),
                            selected = "Unknown/Not Listed",
                            multiple = FALSE,
                            options = list(create=TRUE),
                            width = "225px")
         )
        )
      )
     ) # end of conditionalPanel for other cancers
   ) # end of tagList
  ) # end of div
}
</code>```

Server module:

```<code># module to transfer one set of cancer inputs (cancer name, age, other cancer name) to the cancer data frame
canServer <- function(id){
  moduleServer(
    id,
    function(input, output, session){

      # listen for changes in each of the three inputs
      observeEvent(list(input$Can, input$CanAge, input$CanOther), {

        # create a template 1 row data frame to store the inputs for this module
        this.row <- data.frame(Cancer = "No cancer selected",
                               Age = NA,
                               Other = "")

        # update the template 1 row data frame
        this.row$Cancer[1] <- input$Can
        this.row$Age[1] <- input$CanAge
        this.row$Other[1] <- input$CanOther

        # For testing: data frame appears correct here
        # View(this.row)

        # return the 1 row data frame
        return(reactive({this.row}))

      }, ignoreInit = TRUE, ignoreNULL = FALSE)
    }
  )
}
</code>```

UI

```<code># Define UI for application that draws a histogram
ui <- fluidPage(

  # enter cancers
  tags$div(
    id = "canContainer",
    style = "width:100%"
  ),
  actionButton("addCan", label = "Add Cancer",
               icon = icon('plus'))

)
</code>```

Server:

```<code># Define server logic required to draw a histogram
server <- function(input, output, session) {

  # reactive values related to the module:
  # 1) data frame to store all inputs from all modules (df)
  # 2) a module counter (canNum)
  canReactive <- reactiveValues(df = data.frame(Cancer = rep("No cancer selected", 25),
                                                Age    = rep(NA, 25),
                                                Other  = rep("", 25)),
                                canNum = 0)

  # for testing only
  observeEvent(canReactive$df, {
    View(canReactive$df)
  })

  # add a module and advance the module counter when user requests via an add button
  observeEvent(input$addCan, {

    # advance the number of modules by one
    canReactive$canNum <- canReactive$canNum + 1

    # create a unique ID for this set of modules
    id <- paste0("canModule", canReactive$canNum)

    # insert a new module into the UI
    insertUI(
      selector = "#canContainer",
      where = "beforeEnd",
      ui = canUI(id = id, canNum = reactive(canReactive$canNum))
    )

    # store inputs from a module to a row in the master data frame of cancer information
    canReactive$df[canReactive$canNum,] <- canServer(id = id)

    # observe if any UI model's delete button is clicked
    observeEvent(input[[paste0(id, '-removeCan')]], {

      # deleted the UI module for the specified set of cancer inputs
      removeUI(selector = paste0("#canSubContainer",id))

      # clean-up memory
      remove_shiny_inputs(id, input)

      # reduce cancer module counter by one
      if(canReactive$canNum > 0){
        canReactive$canNum <- canReactive$canNum - 1
      }
    })
  })

}

# Run the application
shinyApp(ui = ui, server = server)
</code>```

Other code:

```<code># function to clean up memory when module inputs are deleted
remove_shiny_inputs <- function(id, .input) {
  invisible(
    lapply(grep(id, names(.input), value = TRUE), function(i) {
      .subset2(.input, "impl")$.values$remove(i)
    })
  )
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
Background: I have an app where the user enters their cancer history. For each cancer type they need to enter 1) the name of the cancer, 2) the age of diagnosis, and 3) a conditional input with a secondary cancer name. Initially, the user sees no inputs, just an "add cancer" button. When they click this button, the UI module generates a set of those three inputs for entering the information for one cancer. Each successive click of the button adds a new set of inputs for another cancer. On the server side of my app, I have a three column data frame stored in a reactiveValues() for storing all of the cancer history information, I call this the master data frame. Each row of this data frame will store the cancer information for one cancer/one set of UI module inputs. This data frame should be updated any time any cancer input is updated.

The Problem: The UI module works great but the server module is a problem. The goal of the server module is to create a one row, three column data frame to store the data for one set of UI module inputs/one cancer. This single row data frame updates every time one of the three inputs in the related UI module is changed. In the server side of the app, I need the rows of the master data frame to be individually updated by each server module. When I try to do this I get the following error message just before the app crashes:

Warning: Error in as.vector: cannot coerce type 'environment' to vector of type 'any'

Using the View() function I inserted inside of the server module for testing confirms the server module is indeed doing what it is supposed to. The problem is integrating the server module into the master data frame.

REPREX:

UI module:

# module to enter data for one cancer
canUI <- function(id, canNum){

  # reserve a local namespace for cancer hx
  ns <- NS(id)

  tags$div(id = paste0("canSubContainer", id),
   tagList(
     fluidRow(
       column(width = 2,
        selectInput(inputId = ns("Can"),
                    label = h5(paste0("Cancer ",canNum(),":")),
                    choices = c("No cancer selected", paste0("Cancer ", 1:10), "Other"),
                    width = "200px")
       ),
       column(width = 1,
        conditionalPanel(sprintf("input['%s'] != 'No cancer selected'", ns("Can")),
         div(numericInput(inputId = ns("CanAge"),
                          label = h5("Diagnosis Age:"),
                          min = 0, max = 100, step = 1, value = NA,
                          width = "100px")
         ),
        )
       ),
       # remove this set of cancer inputs
       column(width = 1,
        actionButton(inputId = ns("removeCan"),
                     label = NULL,
                     icon = icon('trash'),
                     style = "margin-top:40px")
       )
     ),
     conditionalPanel(sprintf("input['%s'] == 'Other'", ns("Can")),
      fluidRow(
        column(1, h5("Other cancer:", style = "margin-left:25px")),
        column(2,
         div(selectizeInput(inputId = ns("CanOther"),
                            label = NULL,
                            choices = c("Unknown/Not Listed", paste0("Other Cancer", 1:10)),
                            selected = "Unknown/Not Listed",
                            multiple = FALSE,
                            options = list(create=TRUE),
                            width = "225px")
         )
        )
      )
     ) # end of conditionalPanel for other cancers
   ) # end of tagList
  ) # end of div
}

Server module:

# module to transfer one set of cancer inputs (cancer name, age, other cancer name) to the cancer data frame
canServer <- function(id){
  moduleServer(
    id,
    function(input, output, session){

      # listen for changes in each of the three inputs
      observeEvent(list(input$Can, input$CanAge, input$CanOther), {

        # create a template 1 row data frame to store the inputs for this module
        this.row <- data.frame(Cancer = "No cancer selected",
                               Age = NA,
                               Other = "")

        # update the template 1 row data frame
        this.row$Cancer[1] <- input$Can
        this.row$Age[1] <- input$CanAge
        this.row$Other[1] <- input$CanOther

        # For testing: data frame appears correct here
        # View(this.row)

        # return the 1 row data frame
        return(reactive({this.row}))

      }, ignoreInit = TRUE, ignoreNULL = FALSE)
    }
  )
}

UI

# Define UI for application that draws a histogram
ui <- fluidPage(

  # enter cancers
  tags$div(
    id = "canContainer",
    style = "width:100%"
  ),
  actionButton("addCan", label = "Add Cancer",
               icon = icon('plus'))

)

Server:

# Define server logic required to draw a histogram
server <- function(input, output, session) {

  # reactive values related to the module:
  # 1) data frame to store all inputs from all modules (df)
  # 2) a module counter (canNum)
  canReactive <- reactiveValues(df = data.frame(Cancer = rep("No cancer selected", 25),
                                                Age    = rep(NA, 25),
                                                Other  = rep("", 25)),
                                canNum = 0)

  # for testing only
  observeEvent(canReactive$df, {
    View(canReactive$df)
  })

  # add a module and advance the module counter when user requests via an add button
  observeEvent(input$addCan, {

    # advance the number of modules by one
    canReactive$canNum <- canReactive$canNum + 1

    # create a unique ID for this set of modules
    id <- paste0("canModule", canReactive$canNum)

    # insert a new module into the UI
    insertUI(
      selector = "#canContainer",
      where = "beforeEnd",
      ui = canUI(id = id, canNum = reactive(canReactive$canNum))
    )

    # store inputs from a module to a row in the master data frame of cancer information
    canReactive$df[canReactive$canNum,] <- canServer(id = id)

    # observe if any UI model's delete button is clicked
    observeEvent(input[[paste0(id, '-removeCan')]], {

      # deleted the UI module for the specified set of cancer inputs
      removeUI(selector = paste0("#canSubContainer",id))

      # clean-up memory
      remove_shiny_inputs(id, input)

      # reduce cancer module counter by one
      if(canReactive$canNum > 0){
        canReactive$canNum <- canReactive$canNum - 1
      }
    })
  })

}

# Run the application
shinyApp(ui = ui, server = server)

Other code:

# function to clean up memory when module inputs are deleted
remove_shiny_inputs <- function(id, .input) {
  invisible(
    lapply(grep(id, names(.input), value = TRUE), function(i) {
      .subset2(.input, "impl")$.values$remove(i)
    })
  )
}


问:
bxSlider Pager and Caption Background
How can I put the pager inside the image or the container. Also, how can I make the caption background gradient?

BxSlider Sample Picture

```<code>$(function(){
$('.bxslider').bxSlider({
    mode: 'fade',
    auto: true,
    captions: true,
    pager: true,
    slideMargin: 0,
    captions: true,
    responsive: true,
    useCSS: true,
    touchEnabled: true,
    slideWidth: 1500
    });
});
</code>```

Title: bxSlider Pager and Caption Background

Body:
How can I put the pager inside the image or the container. Also, how can I make the caption background gradient?

BxSlider Sample Picture

$(function(){
$('.bxslider').bxSlider({
    mode: 'fade',
    auto: true,
    captions: true,
    pager: true,
    slideMargin: 0,
    captions: true,
    responsive: true,
    useCSS: true,
    touchEnabled: true,
    slideWidth: 1500
    });
});


问:
How do I fix a google script error that says coordinates of target range are outside the dimensions of the sheet when trying to archive?
I have used this script for so long and it started to error out. The purpose is to archive any row that has an indication of "Yes" in the first column.

It will move from first tab called Tracker to another Archive tab.

The script should then delete the row from the original Tracker tab.

I get the error

Exception: The coordinates of the target range are outside the dimensions of the sheet.

I haven't change dimensions or anything in the script so not sure why its giving me the error now.

```<code>function archiveClosed() {
  var responseSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Tracker");
  var responseData = responseSheet.getRange(2, 1, responseSheet.getLastRow(),     responseSheet.getLastColumn()).getValues();
  for (var i = 0; i < responseData.length; i++) {

    var responseRow = responseData[i];

    if(responseRow[0] == "Yes") {

      var numColumns = responseSheet.getLastColumn();
      var numRows = responseSheet.getLastRow()
      var targetSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Archive- Tracker");
      var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
      responseSheet.getRange(i+2, 1, 1, numColumns).copyTo(target);
    }
  }
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Tracker");
  var rows = sheet.getDataRange();
  var numRows = rows.getNumRows();
  var values = rows.getValues();

  var rowsDeleted = 0;
  for (var i = 0; i <= numRows - 1; i++) {
    var row = values[i];
    if (row[0] == 'Yes') {
      sheet.deleteRow((parseInt(i)+1) - rowsDeleted);
      rowsDeleted++;
    }
  }
}
</code>```

Tried to debug but I dont understand the parameters. I want the script to use the entire range of the spreadsheet.

Body:
I have used this script for so long and it started to error out. The purpose is to archive any row that has an indication of "Yes" in the first column.

It will move from first tab called Tracker to another Archive tab.

The script should then delete the row from the original Tracker tab.

I get the error

Exception: The coordinates of the target range are outside the dimensions of the sheet.

I haven't change dimensions or anything in the script so not sure why its giving me the error now.

function archiveClosed() {
  var responseSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Tracker");
  var responseData = responseSheet.getRange(2, 1, responseSheet.getLastRow(),     responseSheet.getLastColumn()).getValues();
  for (var i = 0; i < responseData.length; i++) {

    var responseRow = responseData[i];

    if(responseRow[0] == "Yes") {

      var numColumns = responseSheet.getLastColumn();
      var numRows = responseSheet.getLastRow()
      var targetSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Archive- Tracker");
      var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
      responseSheet.getRange(i+2, 1, 1, numColumns).copyTo(target);
    }
  }
  var sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Tracker");
  var rows = sheet.getDataRange();
  var numRows = rows.getNumRows();
  var values = rows.getValues();

  var rowsDeleted = 0;
  for (var i = 0; i <= numRows - 1; i++) {
    var row = values[i];
    if (row[0] == 'Yes') {
      sheet.deleteRow((parseInt(i)+1) - rowsDeleted);
      rowsDeleted++;
    }
  }
}

Tried to debug but I dont understand the parameters. I want the script to use the entire range of the spreadsheet.


问:
WP ALL Export - Php snippet works on one server but not another
Im using the wordpress plugin wp all export to export a csv file and send it via FTP. They plugin provider actually had a code snippet on their site to do exactly what I need The only thing I changed in their code was adding in my own FTP details

See code example below

```<code>function wpae_after_export( $export_id ) {

    // Retrieve export object.
    $export = new PMXE_Export_Record();
    $export->getById($export_id);

    // Check if "Secure Mode" is enabled in All Export > Settings.
    $is_secure_export = PMXE_Plugin::getInstance()->getOption('secure');

    // Retrieve file path when not using secure mode.
    if ( !$is_secure_export) {
        $filepath = get_attached_file($export->attch_id);

    // Retrieve file path when using secure mode.
    } else {
        $filepath = wp_all_export_get_absolute_path($export->options['filepath']);
    }

    // Path to the export file.
    $localfile = $filepath;

    // File name of remote file (destination file name).
    $remotefile = basename($filepath);

    // Remote FTP server details.
    // The 'path' is relative to the FTP user's login directory.
    $ftp = array(
        'server' => 'ftp URL',
        'user' => 'ftp Password',
        'pass' => 'ftp Username',
        'path' => '/'
    );

    // Ensure username is formatted properly
    $ftp['user'] = str_replace('@', '%40', $ftp['user']);

    // Ensure password is formatted properly
    $ftp['pass'] = str_replace(array('#','?','/','\\'), array('%23','%3F','%2F','%5C'), $ftp['pass']);

    // Remote FTP URL.
    $remoteurl = "ftp://{$ftp['user']}:{$ftp['pass']}@{$ftp['server']}{$ftp['path']}/{$remotefile}";

    // Retrieve cURL object.
    $ch = curl_init();

    // Open export file.
    $fp = fopen($localfile, "rb");

    // Proceed if the local file was opened.
    if ($fp) {

        // Provide cURL the FTP URL.
        curl_setopt($ch, CURLOPT_URL, $remoteurl);

        // Prepare cURL for uploading files.
        curl_setopt($ch, CURLOPT_UPLOAD, 1);

        // Provide the export file to cURL.
        curl_setopt($ch, CURLOPT_INFILE, $fp);

        // Provide the file size to cURL.
        curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));

        // Start the file upload.
        curl_exec($ch);

        // If there is an error, write error number & message to PHP's error log.
        if($errno = curl_errno($ch)) {
            if (version_compare(phpversion(), '5.5.0', '>=')) {

                // If PHP 5.5.0 or greater is used, use newer function for cURL error message.
                $error_message = curl_strerror($errno);

            } else {

                // Otherwise, use legacy cURL error message function.
                $error_message = curl_error($ch);
            }

            // Write error to PHP log.
            error_log("cURL error ({$errno}): {$error_message}");

        }

        // Close the connection to remote server.
        curl_close($ch);

    } else {

        // If export file could not be found, write to error log.
        error_log("Could not find export file");

    }
}

add_action('pmxe_after_export', 'wpae_after_export', 10, 1);
</code>```

I first set this up on a hostgator dedicated server and it worked perfectly but when I tried to copy the exact same process into another server hosting via AWS I don't receive the file into my FTP.

I would assume there is some sort of configration within the cpanel on the AWS server but I cannot figure out what. I dont get any error message when running the export either so the only thing I can see is that the export runs to 100% quickly but still runs for about 2 mins before its complete.

I also checked with the FTP owner and confirmed there is nothing on their site blocking the file from one server but not the other.

Someone also suggested I ensure both servers have cURL installed which I did confirm.

Body:
Im using the wordpress plugin wp all export to export a csv file and send it via FTP. They plugin provider actually had a code snippet on their site to do exactly what I need The only thing I changed in their code was adding in my own FTP details

See code example below

function wpae_after_export( $export_id ) {

    // Retrieve export object.
    $export = new PMXE_Export_Record();
    $export->getById($export_id);

    // Check if "Secure Mode" is enabled in All Export > Settings.
    $is_secure_export = PMXE_Plugin::getInstance()->getOption('secure');

    // Retrieve file path when not using secure mode.
    if ( !$is_secure_export) {
        $filepath = get_attached_file($export->attch_id);

    // Retrieve file path when using secure mode.
    } else {
        $filepath = wp_all_export_get_absolute_path($export->options['filepath']);
    }

    // Path to the export file.
    $localfile = $filepath;

    // File name of remote file (destination file name).
    $remotefile = basename($filepath);

    // Remote FTP server details.
    // The 'path' is relative to the FTP user's login directory.
    $ftp = array(
        'server' => 'ftp URL',
        'user' => 'ftp Password',
        'pass' => 'ftp Username',
        'path' => '/'
    );

    // Ensure username is formatted properly
    $ftp['user'] = str_replace('@', '%40', $ftp['user']);

    // Ensure password is formatted properly
    $ftp['pass'] = str_replace(array('#','?','/','\\'), array('%23','%3F','%2F','%5C'), $ftp['pass']);

    // Remote FTP URL.
    $remoteurl = "ftp://{$ftp['user']}:{$ftp['pass']}@{$ftp['server']}{$ftp['path']}/{$remotefile}";

    // Retrieve cURL object.
    $ch = curl_init();

    // Open export file.
    $fp = fopen($localfile, "rb");

    // Proceed if the local file was opened.
    if ($fp) {

        // Provide cURL the FTP URL.
        curl_setopt($ch, CURLOPT_URL, $remoteurl);

        // Prepare cURL for uploading files.
        curl_setopt($ch, CURLOPT_UPLOAD, 1);

        // Provide the export file to cURL.
        curl_setopt($ch, CURLOPT_INFILE, $fp);

        // Provide the file size to cURL.
        curl_setopt($ch, CURLOPT_INFILESIZE, filesize($localfile));

        // Start the file upload.
        curl_exec($ch);

        // If there is an error, write error number & message to PHP's error log.
        if($errno = curl_errno($ch)) {
            if (version_compare(phpversion(), '5.5.0', '>=')) {

                // If PHP 5.5.0 or greater is used, use newer function for cURL error message.
                $error_message = curl_strerror($errno);

            } else {

                // Otherwise, use legacy cURL error message function.
                $error_message = curl_error($ch);
            }

            // Write error to PHP log.
            error_log("cURL error ({$errno}): {$error_message}");

        }

        // Close the connection to remote server.
        curl_close($ch);

    } else {

        // If export file could not be found, write to error log.
        error_log("Could not find export file");

    }
}

add_action('pmxe_after_export', 'wpae_after_export', 10, 1);

I first set this up on a hostgator dedicated server and it worked perfectly but when I tried to copy the exact same process into another server hosting via AWS I don't receive the file into my FTP.

I would assume there is some sort of configration within the cpanel on the AWS server but I cannot figure out what. I dont get any error message when running the export either so the only thing I can see is that the export runs to 100% quickly but still runs for about 2 mins before its complete.

I also checked with the FTP owner and confirmed there is nothing on their site blocking the file from one server but not the other.

Someone also suggested I ensure both servers have cURL installed which I did confirm.


问:
After upgrading angular 13 to 14 getting TypeError: p.charCodeAt is not a function on ng serve
Generating browser application bundles (phase: setup)...Processing legacy "View Engine" libraries:

ngx-bootstrap/utils [es2015/esm2015] (git+ssh://git@github.com/valor-software/ngx-bootstrap.git)

ngx-bootstrap/positioning [es2015/esm2015] (git+ssh://git@github.com/valor-software/ngx-bootstrap.git)

ngx-bootstrap/chronos [es2015/esm2015] (git+ssh://git@github.com/valor-software/ngx-bootstrap.git)

ngx-bootstrap/component-loader [es2015/esm2015] (git+ssh://git@github.com/valor-software/ngx-bootstrap.git)

ngx-bootstrap/mini-ngrx [es2015/esm2015] (git+ssh://git@github.com/valor-software/ngx-bootstrap.git)

ag-grid-angular [main/commonjs] (git+https://github.com/ag-grid/ag-grid-angular.git)

ngx-bootstrap/modal [es2015/esm2015] (git+ssh://git@github.com/valor-software/ngx-bootstrap.git)

angular2-multiselect-dropdown [es2015/esm2015] (git+https://github.com/CuppaLabs/angular2-multiselect-dropdown.git)
Warning: Unable to fully load C:/4214_IOSM/Accenture.CIO.Inspire/Inspire_Client/node_modules/ag-grid-angular/main.js for source-map flattening: ENOENT: no such file or directory, open 'C:/4214_IOSM/Accenture.CIO.Inspire/Inspire_Client/node_modules/ag-grid-angular/exports.js.map'
Warning: Unable to fully load C:/4214_IOSM/Accenture.CIO.Inspire/Inspire_Client/node_modules/ag-grid-angular/main.js for source-map flattening: ENOENT: no such file or directory, open 'C:/4214_IOSM/Accenture.CIO.Inspire/Inspire_Client/node_modules/ag-grid-angular/exports.js.map'

ngx-pagination [module/esm5] (git+https://github.com/michaelbromley/ngx-pagination.git)

ngx-bootstrap/datepicker [es2015/esm2015] (git+ssh://git@github.com/valor-software/ngx-bootstrap.git)

angular-oauth2-oidc [es2015/esm2015] (git+https://github.com/manfredsteyer/angular-oauth2-oidc.git)

ngx-bootstrap/alert [es2015/esm2015] (git+ssh://git@github.com/valor-software/ngx-bootstrap.git)

ng2-search-filter [es2015/esm2015] (git+https://github.com/solodynamo/ng2-search-filter.git)
Encourage the library authors to publish an Ivy distribution.
⠋ Generating browser application bundles (phase: building)...C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\util\path.js:85
const c0 = p.charCodeAt(0);
^

TypeError: p.charCodeAt is not a function
at getType (C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\util\path.js:85:15)
at Resolver.isPrivate (C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\Resolver.js:480:10)
at Resolver.parse (C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\Resolver.js:464:25)

at C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\ParsePlugin.js:33:29
at Hook.eval [as callAsync] (eval at create (C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\tapable\lib\HookCodeFactory.js:33:10), :7:1)
at Resolver.doResolve (C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\Resolver.js:432:16)
at C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\AliasFieldPlugin.js:80:14
at Hook.eval [as callAsync] (eval at create (C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\tapable\lib\HookCodeFactory.js:33:10), :22:1)
at Resolver.doResolve (C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\Resolver.js:432:16)
at C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\NextPlugin.js:30:14
at _next0 (eval at create (C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\tapable\lib\HookCodeFactory.js:33:10), :23:1)
at eval (eval at create (C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\tapable\lib\HookCodeFactory.js:33:10), :45:1)
at C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules@ngtools\webpack\src\paths-plugin.js:115:17
at Hook.eval [as callAsync] (eval at create (C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\tapable\lib\HookCodeFactory.js:33:10), :37:1)
at Resolver.doResolve (C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\Resolver.js:432:16)
at C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\DescriptionFilePlugin.js:74:17
at C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\DescriptionFileUtils.js:118:13
at C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\forEachBail.js:16:12
at onJson (C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\DescriptionFileUtils.js:108:6)
at C:\4214_IOSM\Accenture.CIO.Inspire\Inspire_Client\node_modules\enhanced-resolve\lib\DescriptionFileUtils.js:68:7
at processTicksAndRejections (internal/process/task_queues.js:82:21)

How to fix the above error


问:
How to deal with fuzzy matching cascades/collapse/chains
I have to implement a fuzzy matching solution for a client and am going to use Damerau-Levenshtein for that. So far so good, but I'm concerned about cascades/collapse/chains, or however you would like to call it where A matches B, and B matches C, but A doesn't match C, and C might match something else  in turn, etc... In theory all records could collapse onto one record. But even if that doesn't happen, what is the industry standard of handling this problem? All the sources I've read seem to conveniently ignore this problem, but to me that seems the actual hard part of fuzzy matching, not the trivial choice of the edit-distance.

Is the industry standard to just ignore this? Or to allow the cascade and just control the order in which it happens, or is the answer "it depends on what the client wants"?

This isn't even exclusive to fuzzy matching, anytime you have an "OR" statement in your match criteria you would run into the same problem, but I never see it addressed anywhere.

I played around with different solutions I thought of myself, but I'm not sure there's a definitive correct answer.


问:
Lottie animation makes unnecessary horizontal lines only on safari browser
My animation is like small particles moving on a same Direction and looping. Some of the smallest particles makes a horizontal lines while moving only on safari browser. This never happens on other browsers.</p>


问:
Library Installation issue in Google Colab
```<code>TypeError                                 Traceback (most recent call last)
<ipython-input-9-cf2b62201e08> in <module>
----> 1 from pyspark import SparkContext
      2
      3 sc = SparkContext.getOrCreate()
      4 sc

4 frames
/content/spark-2.3.1-bin-hadoop2.7/python/pyspark/cloudpickle.py in _make_cell_set_template_code()
    125         )
    126     else:
--> 127         return types.CodeType(
    128             co.co_argcount,
    129             co.co_kwonlyargcount,"

TypeError: an integer is required (got type bytes)

</code>```

I am trying to build a Pyspark project using Google colab notebooks, though this problem is not limited to colab, it could happen in any other IDE.

I tried resolving the issue using the latest versions of Spark and Hadoop, but this error comes in every new notebook.

I am expecting this work without any errors.

Body:
TypeError                                 Traceback (most recent call last)
<ipython-input-9-cf2b62201e08> in <module>
----> 1 from pyspark import SparkContext
      2
      3 sc = SparkContext.getOrCreate()
      4 sc

4 frames
/content/spark-2.3.1-bin-hadoop2.7/python/pyspark/cloudpickle.py in _make_cell_set_template_code()
    125         )
    126     else:
--> 127         return types.CodeType(
    128             co.co_argcount,
    129             co.co_kwonlyargcount,"

TypeError: an integer is required (got type bytes)

I am trying to build a Pyspark project using Google colab notebooks, though this problem is not limited to colab, it could happen in any other IDE.

I tried resolving the issue using the latest versions of Spark and Hadoop, but this error comes in every new notebook.

I am expecting this work without any errors.


问:
Displaced taps in an app (can't tap near right screen edge)
Hello everyone I don't have much programming experience, but I installed an apk for an app. (The apk can be found here: https://s2.rexdl.com/android/game/The-Walking-Dead-Season-One.1.18-Adreno-www.ReXdl.com.apk )(It works with a custom obb, but the obb is most likely not causing the error, but if you need to look at the obb file as well, here it is:https://s2.rexdl.com/android/game/The-Walking-Dead-Season-One.1.18-Adreno-www.ReXdl.com.rar ). But I have a problem: when I tap anywhere on the screen, my tap is displaced a certain distance to the left, so I have to aim a little bit right to where I want to tap, could anyone please tell me a solution to this, or modify the apk to solve the problem. Also, don't ask me to contact the developer, the app is no-longer supported by the developer- that is why I am asking the question here. Thanks, John Doe.

I was expecting the taps to be in sync with where I tap the screen, but the taps are displaced to the left. I tried tweaking some layout settings to no avail.


问:
Using the ComplexHeatmap package, can I make it so that certain columns have a different color scale than others?
I have a data matrix with 20 columns.
I am easily able to create the heatmap and determine a color scale.
HOWEVER, I want to create a single heatmap- where specific columns have specific color scales

I want columns 1,3,5,7,9,11,13,15,17,19 to be one color scale.
and then columns 2,4,6,8,10,12,14,16,18,20 to be another color scale.

They would ultimately be the same scale.. 0 to 1. but i want a constrast between the columns because they represent two different groups.


问:
How can I change the aspect ratio of images in php
(I am very new to php, so please forgive my blatant ignorance.)

My portfolio site theme uses this array to display realted images. Currently the theme crops those images to squares.  'images_proportion'  => 'marceau_core_image_size_square',

I would like to be able to control the size and proportions of these. Any thoughts on how I might do this would be greatly apreciated.

```<code><div id="qodef-portfolio-single-related-items">
    <h4 class="qodef-m-title"><?php echo esc_html__('Related projects', 'marceau-core') ?></h4>
    <?php
    $params = apply_filters(
        'marceau_core_filter_portfolio_single_related_posts_params',
        array(
            'custom_class'                  => 'qodef--no-bottom-space',
            'columns'                       => '4',
            'posts_per_page'                => 4,
            'additional_params'             => 'id',
            'post_ids'                      => $related_posts['items'],
            'layout'                        => 'info-on-hover',
            'hover_animation_info-on-hover' => 'roll-out',
            'title_tag'                     => 'h5',
            'behavior'                      => 'columns',
            'images_proportion'             => 'marceau_core_image_size_square',
            'image_source'                  => 'featured',
        )
    );

    echo MarceauCore_Portfolio_List_Shortcode::call_shortcode( $params );
    ?>
</div>
</code>```

I tried replaceing 'marceau_core_image_size_square' with actual ratios, like '16:9'. And I tried adding height and width to the array, but these megar efforts had no effect.

Body:
(I am very new to php, so please forgive my blatant ignorance.)

My portfolio site theme uses this array to display realted images. Currently the theme crops those images to squares.  'images_proportion'  => 'marceau_core_image_size_square',

I would like to be able to control the size and proportions of these. Any thoughts on how I might do this would be greatly apreciated.

<?php echo esc_html__('Related projects', 'marceau-core') ?>

    <?php
    $params = apply_filters(
        'marceau_core_filter_portfolio_single_related_posts_params',
        array(
            'custom_class'                  => 'qodef--no-bottom-space',
            'columns'                       => '4',
            'posts_per_page'                => 4,
            'additional_params'             => 'id',
            'post_ids'                      => $related_posts['items'],
            'layout'                        => 'info-on-hover',
            'hover_animation_info-on-hover' => 'roll-out',
            'title_tag'                     => 'h5',
            'behavior'                      => 'columns',
            'images_proportion'             => 'marceau_core_image_size_square',
            'image_source'                  => 'featured',
        )
    );

    echo MarceauCore_Portfolio_List_Shortcode::call_shortcode( $params );
    ?>

I tried replaceing 'marceau_core_image_size_square' with actual ratios, like '16:9'. And I tried adding height and width to the array, but these megar efforts had no effect.


问:
inspiration from Different Differences (codeforces problem 1772c)
link to problem

```<code>import java.util.Arrays;

 import java.util.Scanner;

class Codechef { static boolean test(int[]a,int n){

 for(int i=0;i<n;i++){

 if(a[i]-a[i+1]>0)

 System.out.println("not si");

return false;

    }
    return true;
}
static int[] array(int[]a,int n){
    int[] a1=new int[n-1];
    if(test(a,n )){
        for(int i=0;i<n-1;i++){
            a1[i]=a[i+1]=a[i];
        }
    }
    return a1;
}
static int type(int[]a,int n){
    int c=0;
    int []k=array(a, n);
    Arrays.sort(k);
    for(int i=0;i<n-2;i++){
        if(k[i]!=k[i+1])c++;
    }
    return c;
}
public static void main(String[] args) {
    Scanner in=new Scanner(System.in);

    System.out.println("Array & no of elements");
    int n=in.nextInt();
    int []a=new int[n];
    for(int i=0;i<n;i++)
    a[i]=in.nextInt();
    int c=type(a, n);
    System.out.println(c);

}`
</code>```

the following code gives the output:
Array & no of element
 5
0
2
8
10
16
0 (output)
clearly not the desired results. So where am i going wrong? please enlighten me.

Ive tried a set of "nested" methods and was expecting for the value of c to be greater than zero...

Body:
link to problem

import java.util.Arrays;

 import java.util.Scanner;

class Codechef { static boolean test(int[]a,int n){

 for(int i=0;i<n;i++){

 if(a[i]-a[i+1]>0)

 System.out.println("not si");

return false;

    }
    return true;
}
static int[] array(int[]a,int n){
    int[] a1=new int[n-1];
    if(test(a,n )){
        for(int i=0;i<n-1;i++){
            a1[i]=a[i+1]=a[i];
        }
    }
    return a1;
}
static int type(int[]a,int n){
    int c=0;
    int []k=array(a, n);
    Arrays.sort(k);
    for(int i=0;i<n-2;i++){
        if(k[i]!=k[i+1])c++;
    }
    return c;
}
public static void main(String[] args) {
    Scanner in=new Scanner(System.in);

    System.out.println("Array & no of elements");
    int n=in.nextInt();
    int []a=new int[n];
    for(int i=0;i<n;i++)
    a[i]=in.nextInt();
    int c=type(a, n);
    System.out.println(c);

}`

the following code gives the output:
Array & no of element
 5
0
2
8
10
16
0 (output)
clearly not the desired results. So where am i going wrong? please enlighten me.

Ive tried a set of "nested" methods and was expecting for the value of c to be greater than zero...


问:
Which Android API classes must have their methods runOnUiThread?
Despite Android being a multi-threaded, some API classes impose a strict requirement of having to only run on the UI thread.

For example,

All SpeechRecognizer's methods "must be invoked only from the main application thread."

The Android Developer's Threads section describes components from the android.widget and android.view packages as having to run on the main/UI thread.

According to this SO answer, TextToSpeech constructor also needs to be called from the main/UI thread.

The CountDownTimer must also be created on the UI thread, if its thread does not have a Looper.

Which other classes require their methods runOnUiThread()?

Is there a comprehensive list of such classes in the Android SDK?


问:
I have some qustion about the extension kind
the Relationship between ExtensionKind ``export type ExtensionKind = 'ui' | 'workspace' | 'web'`;?

I just see the extension serverManagement : local remote and web
readonly localExtensionManagementServer: IExtensionManagementServer | null; readonly remoteExtensionManagementServer: IExtensionManagementServer | null; readonly webExtensionManagementServer: IExtensionManagementServer | null;

the serverManagement if ExtensionKind and ExtensionManagementServer is one-to-one correspondence?

and if user in webIDE, but not in local Vscode ssh mode, there is no capability for install local,
but the Extension gallery Detail show install locally action for some web or ui extension , is that a bug

just give some idea ,how to fix it;


问:
Use Windows and Client Cert authentication alternatively
I got a .NET WebApp that will send a Cert + Imppersonate user (Windows Auth) to my API app and I want to now let my API be accessible by third-party apps without passing Windows Auth but only Client Cert.

With 3rd party Client Cert, I will then figure out the AD user from DB and will assume the identity.

What  I am wondering is if it possible to ignore Windows Auth when Client Cert comes from 3rd party and use Windows Auth when the Client cert comes from WebApp?


问:
Does anyone see any issues with my Fibonacci retracement function?
Pinescript doesn't have a built-in function that calculates Fibonacci retracements yet so I tried to write my own. It works by taking data from a security() call and running it through a for loop which does the actual calculations. I was hoping that the function would be able to identify support and resistance levels and use that information to help identify when to buy or sell. However, I'm having an issue simply getting the syntax correct, I have been looking for hours now and I can't seem to find the issue. Can anyone spot the issue? If you have any suggestions besides just syntax I'm all ears, I'm pretty new to pinescript so maybe there is a simpler way of doing this.

```<code>//@version=4

// Function for calculating Fibonacci Retracements
// Inputs: tickerid, 'D' (for daily chart), fibonacci_length

fibonacci(tickerid, chart_type, fibonacci_length) =>
    // Retrieve high and low prices of the given asset
    hl = security(tickerid, chart_type, high, low)
    high = hl[0]
    low = hl[1]

    // Calculate the retracement levels
    fibonacci_levels = fill(0.0,fibonacci_length+1)
    for i = 0 to fibonacci_length
        level = low + (high - low)*i/fibonacci_length
        fibonacci_levels[i] := level

    // Return the calculated retracement
    fibonacci_levels

</code>```

resulted in syntax error on line that says "fibonacci_levels[i] := level"

Body:
Pinescript doesn't have a built-in function that calculates Fibonacci retracements yet so I tried to write my own. It works by taking data from a security() call and running it through a for loop which does the actual calculations. I was hoping that the function would be able to identify support and resistance levels and use that information to help identify when to buy or sell. However, I'm having an issue simply getting the syntax correct, I have been looking for hours now and I can't seem to find the issue. Can anyone spot the issue? If you have any suggestions besides just syntax I'm all ears, I'm pretty new to pinescript so maybe there is a simpler way of doing this.

//@version=4

// Function for calculating Fibonacci Retracements
// Inputs: tickerid, 'D' (for daily chart), fibonacci_length

fibonacci(tickerid, chart_type, fibonacci_length) =>
    // Retrieve high and low prices of the given asset
    hl = security(tickerid, chart_type, high, low)
    high = hl[0]
    low = hl[1]

    // Calculate the retracement levels
    fibonacci_levels = fill(0.0,fibonacci_length+1)
    for i = 0 to fibonacci_length
        level = low + (high - low)*i/fibonacci_length
        fibonacci_levels[i] := level

    // Return the calculated retracement
    fibonacci_levels

resulted in syntax error on line that says "fibonacci_levels[i] := level"


问:
Issue downloading HERMIT, selecting old GHC in GHCup
I'm trying to download the HERMIT tool using the command cabal install hermit.

I dowloaded Haskell using GHCup. If I try to install with GHC 9.2.5 (recommended version by GHCup), I get errors like the following:

```<code>src\Text\PrettyPrint\MarkedHughesPJ.hs:487:43: error:
    Ambiguous occurrence `<>'
    It could refer to
       either `Prelude.<>',
              imported from `Prelude' at src\Text\PrettyPrint\MarkedHughesPJ.hs:33:8-38
              (and originally defined in `GHC.Base')
           or `Text.PrettyPrint.MarkedHughesPJ.<>',
              defined at src\Text\PrettyPrint\MarkedHughesPJ.hs:629:3
    |
487 |                          go y (z:zs) = (y <> p) : go z zs
    |                                           ^^
cabal-3.6.2.0.exe: Failed to build marked-pretty-1.1.2.1 (which is required by
exe:hermit from hermit-0.7.1.0). See the build log above for details.
</code>```

Given that the tool is pretty old, my suspicion is that it should work with an older GHC version. GHCup list gives me versions from 7.10.3 till 9.4.4.

If I run with GHC 7.10.3, I get a different kind of error:

```<code>Failed to build kure-2.18.6.
Build log (
C:\cabal\logs\ghc-7.10.3\kure-2.18.6-b07c497f3357de591e4a4906067e2a1c674021a6.log
):
Preprocessing library for kure-2.18.6..
Building library for kure-2.18.6..

Language\KURE\BiTransform.hs:41:8:
    Could not find module `Control.Monad.Fail'
    It is a member of the hidden package `fail-4.9.0.0@JWbBevols3d7TkSXAGkvyg'.
    Perhaps you need to add `fail' to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.
cabal-3.6.2.0.exe: Failed to build kure-2.18.6 (which is required by
exe:hermit from hermit-1.0.1). See the build log above for details.
</code>```

Very weird, since GHC 7.10.3 is recommended?

So, having no other options, I continued exploring versions. For GHC 8.0.2, I got yet another error:

```<code>Failed to build kure-2.18.6.
Build log (
C:\cabal\logs\ghc-8.0.2\kure-2.18.6-0171a393aff229af835cd303562178192d2a6c3c.log
):
Preprocessing library for kure-2.18.6..
Building library for kure-2.18.6..
[ 1 of 15] Compiling Language.KURE.Combinators.Monad ( Language\KURE\Combinators\Monad.hs, dist\build\Language\KURE\Combinators\Monad.o )
[ 2 of 15] Compiling Language.KURE.MonadCatch ( Language\KURE\MonadCatch.hs, dist\build\Language\KURE\MonadCatch.o )
[ 3 of 15] Compiling Language.KURE.Transform ( Language\KURE\Transform.hs, dist\build\Language\KURE\Transform.o )

Language\KURE\Transform.hs:241:42: error:
    Not in scope: type constructor or class `Semigroup'
cabal-3.6.2.0.exe: Failed to build kure-2.18.6 (which is required by
exe:hermit from hermit-0.7.1.0). See the build log above for details.
</code>```

I even tried installing on a virtual machine on the latest Ubuntu (my host PC is Windows 11), but I was stuck with the same kind of errors.

What should i try next? How to set a GHC in GHCup which is not listed anymore as availible? (an older GHC version may be the answer). Since I get this text back:

```<code>PS C:\Users\broland> ghcup install ghc 7.8.4
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file C:\ghcup\cache\ghcup-0.0.7.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[ Warn  ] New ghc version available. To upgrade, run 'ghcup install ghc 9.4.4'
[ Warn  ] New cabal version available. To upgrade, run 'ghcup install cabal 3.8.1.0'
[ Warn  ] New stack version available. To upgrade, run 'ghcup install stack 2.9.3'
[ Info  ] verifying digest of: gs.exe
[ Error ] Unable to find a download for the requested version/distro.
[ Error ] Also check the logs in C:\ghcup\logs
</code>```

PS: I would like to stick to GHCup because it makes handling dependencies easy, I also tried downloading binary packages and that way I got stuck in another error...

Body:
I'm trying to download the HERMIT tool using the command cabal install hermit.

I dowloaded Haskell using GHCup. If I try to install with GHC 9.2.5 (recommended version by GHCup), I get errors like the following:

src\Text\PrettyPrint\MarkedHughesPJ.hs:487:43: error:
    Ambiguous occurrence `<>'
    It could refer to
       either `Prelude.<>',
              imported from `Prelude' at src\Text\PrettyPrint\MarkedHughesPJ.hs:33:8-38
              (and originally defined in `GHC.Base')
           or `Text.PrettyPrint.MarkedHughesPJ.<>',
              defined at src\Text\PrettyPrint\MarkedHughesPJ.hs:629:3
    |
487 |                          go y (z:zs) = (y <> p) : go z zs
    |                                           ^^
cabal-3.6.2.0.exe: Failed to build marked-pretty-1.1.2.1 (which is required by
exe:hermit from hermit-0.7.1.0). See the build log above for details.

Given that the tool is pretty old, my suspicion is that it should work with an older GHC version. GHCup list gives me versions from 7.10.3 till 9.4.4.

If I run with GHC 7.10.3, I get a different kind of error:

Failed to build kure-2.18.6.
Build log (
C:\cabal\logs\ghc-7.10.3\kure-2.18.6-b07c497f3357de591e4a4906067e2a1c674021a6.log
):
Preprocessing library for kure-2.18.6..
Building library for kure-2.18.6..

Language\KURE\BiTransform.hs:41:8:
    Could not find module `Control.Monad.Fail'
    It is a member of the hidden package `fail-4.9.0.0@JWbBevols3d7TkSXAGkvyg'.
    Perhaps you need to add `fail' to the build-depends in your .cabal file.
    Use -v to see a list of the files searched for.
cabal-3.6.2.0.exe: Failed to build kure-2.18.6 (which is required by
exe:hermit from hermit-1.0.1). See the build log above for details.

Very weird, since GHC 7.10.3 is recommended?

So, having no other options, I continued exploring versions. For GHC 8.0.2, I got yet another error:

Failed to build kure-2.18.6.
Build log (
C:\cabal\logs\ghc-8.0.2\kure-2.18.6-0171a393aff229af835cd303562178192d2a6c3c.log
):
Preprocessing library for kure-2.18.6..
Building library for kure-2.18.6..
[ 1 of 15] Compiling Language.KURE.Combinators.Monad ( Language\KURE\Combinators\Monad.hs, dist\build\Language\KURE\Combinators\Monad.o )
[ 2 of 15] Compiling Language.KURE.MonadCatch ( Language\KURE\MonadCatch.hs, dist\build\Language\KURE\MonadCatch.o )
[ 3 of 15] Compiling Language.KURE.Transform ( Language\KURE\Transform.hs, dist\build\Language\KURE\Transform.o )

Language\KURE\Transform.hs:241:42: error:
    Not in scope: type constructor or class `Semigroup'
cabal-3.6.2.0.exe: Failed to build kure-2.18.6 (which is required by
exe:hermit from hermit-0.7.1.0). See the build log above for details.

I even tried installing on a virtual machine on the latest Ubuntu (my host PC is Windows 11), but I was stuck with the same kind of errors.

What should i try next? How to set a GHC in GHCup which is not listed anymore as availible? (an older GHC version may be the answer). Since I get this text back:

PS C:\Users\broland> ghcup install ghc 7.8.4
[ Info  ] downloading: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-0.0.7.yaml as file C:\ghcup\cache\ghcup-0.0.7.yaml
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
[ Warn  ] New ghc version available. To upgrade, run 'ghcup install ghc 9.4.4'
[ Warn  ] New cabal version available. To upgrade, run 'ghcup install cabal 3.8.1.0'
[ Warn  ] New stack version available. To upgrade, run 'ghcup install stack 2.9.3'
[ Info  ] verifying digest of: gs.exe
[ Error ] Unable to find a download for the requested version/distro.
[ Error ] Also check the logs in C:\ghcup\logs

PS: I would like to stick to GHCup because it makes handling dependencies easy, I also tried downloading binary packages and that way I got stuck in another error...


问:
Unable to convert a sparse matrix to a data frame
I have a sparse matrix having more than 200k rows and 200k columns. When I use

```<code>as.data.frame(as.matrix(sparse_matrix)
</code>```

I get the following error message

Error: cannot allocate vector of size 1232.3 Gb
In addition: Warning message:
In asMethod(object) :
sparse->dense coercion: allocating vector of size 1232.3 GiB

Body:
I have a sparse matrix having more than 200k rows and 200k columns. When I use

as.data.frame(as.matrix(sparse_matrix)

I get the following error message

Error: cannot allocate vector of size 1232.3 Gb
In addition: Warning message:
In asMethod(object) :
sparse->dense coercion: allocating vector of size 1232.3 GiB


问:
Phoenix framework: How to decode Phoenix Session Cookie with Java
I am trying two different ways to decode Phoenix Session Cookie.
First one is Elixir's interaction shell, and the second one is with Java.

Please see the following examples;

IEx

```<code>iex(1)> set_cookie = "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYZFRuNUtQMkJ5YWtKT1JnWUtCeXhmNmdP.l0T3G-i8I5dMwz7lEZnQAeK_WeqEZTxcDeyNY2poz_M"
"SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYZFRuNUtQMkJ5YWtKT1JnWUtCeXhmNmdP.l0T3G-i8I5dMwz7lEZnQAeK_WeqEZTxcDeyNY2poz_M"

iex(2)> [_, payload, _] = String.split(set_cookie, ".", parts: 3)
["SFMyNTY",
 "g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYZFRuNUtQMkJ5YWtKT1JnWUtCeXhmNmdP",
 "l0T3G-i8I5dMwz7lEZnQAeK_WeqEZTxcDeyNY2poz_M"]

iex(3)> {:ok, encoded_term } = Base.url_decode64(payload, padding: false)
{:ok,
 <<131, 116, 0, 0, 0, 1, 109, 0, 0, 0, 11, 95, 99, 115, 114, 102, 95, 116, 111,
   107, 101, 110, 109, 0, 0, 0, 24, 100, 84, 110, 53, 75, 80, 50, 66, 121, 97,
   107, 74, 79, 82, 103, 89, 75, 66, 121, 120, 102, ...>>}

iex(4)> :erlang.binary_to_term(encoded_term)
%{"_csrf_token" => "dTn5KP2ByakJORgYKByxf6gO"}
</code>```

Java

```<code>public static String decodePhoenixSessionCookie(String sessionCookie) {

    String payload = sessionCookie.split("\\.")[1];

    byte[] encoded_term = Base64.getUrlDecoder().decode(payload.getBytes());

    return new String(encoded_term);
}
</code>```

Java Output

```<code>�tm_csrf_tokenmdTn5KP2ByakJORgYKByxf6gO
</code>```

What I wonder is; with the Java way, I can fully achieve field name and it's value, but some gibberish values come with them.

Do you know what's the reason for this?

Do I have a chance to get clean output like Elixir way in Java way?

Body:
I am trying two different ways to decode Phoenix Session Cookie.
First one is Elixir's interaction shell, and the second one is with Java.

Please see the following examples;

IEx

iex(1)> set_cookie = "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYZFRuNUtQMkJ5YWtKT1JnWUtCeXhmNmdP.l0T3G-i8I5dMwz7lEZnQAeK_WeqEZTxcDeyNY2poz_M"
"SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYZFRuNUtQMkJ5YWtKT1JnWUtCeXhmNmdP.l0T3G-i8I5dMwz7lEZnQAeK_WeqEZTxcDeyNY2poz_M"

iex(2)> [_, payload, _] = String.split(set_cookie, ".", parts: 3)
["SFMyNTY",
 "g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYZFRuNUtQMkJ5YWtKT1JnWUtCeXhmNmdP",
 "l0T3G-i8I5dMwz7lEZnQAeK_WeqEZTxcDeyNY2poz_M"]

iex(3)> {:ok, encoded_term } = Base.url_decode64(payload, padding: false)
{:ok,
 <<131, 116, 0, 0, 0, 1, 109, 0, 0, 0, 11, 95, 99, 115, 114, 102, 95, 116, 111,
   107, 101, 110, 109, 0, 0, 0, 24, 100, 84, 110, 53, 75, 80, 50, 66, 121, 97,
   107, 74, 79, 82, 103, 89, 75, 66, 121, 120, 102, ...>>}

iex(4)> :erlang.binary_to_term(encoded_term)
%{"_csrf_token" => "dTn5KP2ByakJORgYKByxf6gO"}

Java

public static String decodePhoenixSessionCookie(String sessionCookie) {

    String payload = sessionCookie.split("\\.")[1];

    byte[] encoded_term = Base64.getUrlDecoder().decode(payload.getBytes());

    return new String(encoded_term);
}

Java Output

�tm_csrf_tokenmdTn5KP2ByakJORgYKByxf6gO

What I wonder is; with the Java way, I can fully achieve field name and it's value, but some gibberish values come with them.

Do you know what's the reason for this?

Do I have a chance to get clean output like Elixir way in Java way?


问:
What is execution context of of globally declared let ,const and Arrow Function In JavaScript
In Global Execution the declaration of var and regular function is executed on the top. But I don't understand how the execution happened to let, const & and arrow functions when are declared Globally.

I have searched on many plateforms about how execution happened to let, const & arrow function but couldn;t anything relevant.


问:
TensorFlow Keras make ThresholdedReLU Theta optimizable
I've built a seq-to-seq model to take N periods of continuous input data and predict M periods of continuous response data (M<N). Because my response is sparse - usually 0, I want to squish predictions that are "small" to 0, so have added a Thresholded ReLU as my final layer. The model, with a single encoder and single decoder is:

```<code># encoder
encoder_inputs_11 = tf.keras.layers.Input(shape=(n_past, n_features))
encoder_layr1_11 = tf.keras.layers.LSTM(encoderLayers[0], return_state=True)
encoder_outputs1_11 = encoder_layr1_11(encoder_inputs_11)
encoder_states1_11 = encoder_outputs1_11[1:]
# decoder
decoder_inputs_11 = tf.keras.layers.RepeatVector(n_future)(encoder_outputs1_11[0])
decoder_layr1_11 = tf.keras.layers.LSTM(decoderLayers[0], return_sequences=True)(decoder_inputs_11, initial_state = encoder_states1_11)
decoder_outputs1_11 = tf.keras.layers.TimeDistributed(tf.keras.layers.Dense(n_response))(decoder_layr1_11)
# threshold layer
thresh_11 = tf.keras.layers.ThresholdedReLU(theta=reluTheta)(decoder_outputs1_11)
# entire model
result = tf.keras.models.Model(encoder_inputs_11, thresh_11)
</code>```

How can I make theta in tf.keras.layers.ThresholdedReLU(theta=reluTheta) an optimizable parameter?

Body:
I've built a seq-to-seq model to take N periods of continuous input data and predict M periods of continuous response data (M<N). Because my response is sparse - usually 0, I want to squish predictions that are "small" to 0, so have added a Thresholded ReLU as my final layer. The model, with a single encoder and single decoder is:

# encoder
encoder_inputs_11 = tf.keras.layers.Input(shape=(n_past, n_features))
encoder_layr1_11 = tf.keras.layers.LSTM(encoderLayers[0], return_state=True)
encoder_outputs1_11 = encoder_layr1_11(encoder_inputs_11)
encoder_states1_11 = encoder_outputs1_11[1:]
# decoder
decoder_inputs_11 = tf.keras.layers.RepeatVector(n_future)(encoder_outputs1_11[0])
decoder_layr1_11 = tf.keras.layers.LSTM(decoderLayers[0], return_sequences=True)(decoder_inputs_11, initial_state = encoder_states1_11)
decoder_outputs1_11 = tf.keras.layers.TimeDistributed(tf.keras.layers.Dense(n_response))(decoder_layr1_11)
# threshold layer
thresh_11 = tf.keras.layers.ThresholdedReLU(theta=reluTheta)(decoder_outputs1_11)
# entire model
result = tf.keras.models.Model(encoder_inputs_11, thresh_11)

How can I make theta in tf.keras.layers.ThresholdedReLU(theta=reluTheta) an optimizable parameter?


问:
Why does my stretch attribute in mui flexbox not do anything?
So I want the boxes I have displayed in a parent box to completely stretch out. I followed the documentation on MUI for the flexbox, though after editing it a bit I do not understand why it does not work anymore :?
I have given the inner items a minimum for width and height, but even without this the items do not stretch.

Does the stretch attribute not mean that the parent container will be completely filled out?

Here's my code:

```<code>import "./styles.css";
import React from "react";

import Box, { BoxProps } from "@mui/material/Box";
import PropTypes from "prop-types";

function Item(props) {
  const { sx, ...other } = props;
  return (
    <Box
      sx={{
        border: "1px solid pink",
        borderRadius: 2,
        fontSize: "0.875rem",
        minHeight: "5rem",
        minWidth: "5rem",
        ...sx
      }}
      {...other}
    />
  );
}
Item.propTypes = {
  sx: PropTypes.oneOfType([
    PropTypes.arrayOf(
      PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])
    ),
    PropTypes.func,
    PropTypes.object
  ])
};

export default function App() {
  const items = [
    {
      title: "Car",
      color: "yellow"
    },
    {
      title: "Plane",
      color: "lightblue"
    },
    {
      title: "Bicycle",
      color: "lightgreen"
    },
    {
      title: "Train",
      color: "orange"
    }
  ];

  const movies = [
    {
      title: "Seven",
      color: "red"
    },
    {
      title: "Memento",
      color: "white"
    },
    {
      title: "Vivarium",
      color: "lightgreen"
    },
    {
      title: "Blue Velvet",
      color: "lightblue"
    }
  ];

  return (
    <>
      <Box
        className="Container Of Sub"
        style={{
          backgroundColor: "lightpink",
          display: "flex",
          alignItems: "center",
          width: "100%",
          height: "100%"
        }}
      >
        <Box className="FirstSub" style={{ width: "50%" }}>
          <Box
            className="Header"
            style={{
              borderRadius: "10px",
              paddingLeft: "10px",
              boxShadow: "4px 4px 20px 0px rgba(0,0,0,0.25",
              backgroundColor: "white"
            }}
          >
            <h4>Subcategory 1</h4>
          </Box>

          <Box
            className="Category Holder"
            sx={{
              display: "flex",
              flexWrap: "wrap",
              alignContent: "stretch",
              borderRadius: 1
            }}
          >
            {items.map((item) => (
              <Item
                sx={{
                  backgroundColor: item.color
                }}
              >
                {item.title}
              </Item>
            ))}
          </Box>
        </Box>

        <Box
          className="2ndSubCategory"
          style={{
            width: "50%",
            marginLeft: "20px"
          }}
        >
          <Box
            className="Header"
            style={{
              borderRadius: "10px",
              paddingLeft: "10px",
              boxShadow: "4px 4px 20px 0px rgba(0,0,0,0.25",
              backgroundColor: "white"
            }}
          >
            <h4>Subcategory 2</h4>
          </Box>

          <Box
            className="Category Holder"
            sx={{
              display: "flex",
              flexWrap: "wrap",

              alignContent: "stretch",
              borderRadius: 1
            }}
          >
            {movies.map((item) => (
              <Item
                sx={{
                  backgroundColor: item.color
                }}
              >
                {item.title}
              </Item>
            ))}
          </Box>
        </Box>
      </Box>
    </>
  );
}
</code>```

Body:
So I want the boxes I have displayed in a parent box to completely stretch out. I followed the documentation on MUI for the flexbox, though after editing it a bit I do not understand why it does not work anymore :?
I have given the inner items a minimum for width and height, but even without this the items do not stretch.

Does the stretch attribute not mean that the parent container will be completely filled out?

Here's my code:

import "./styles.css";
import React from "react";

import Box, { BoxProps } from "@mui/material/Box";
import PropTypes from "prop-types";

function Item(props) {
  const { sx, ...other } = props;
  return (
    <Box
      sx={{
        border: "1px solid pink",
        borderRadius: 2,
        fontSize: "0.875rem",
        minHeight: "5rem",
        minWidth: "5rem",
        ...sx
      }}
      {...other}
    />
  );
}
Item.propTypes = {
  sx: PropTypes.oneOfType([
    PropTypes.arrayOf(
      PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])
    ),
    PropTypes.func,
    PropTypes.object
  ])
};

export default function App() {
  const items = [
    {
      title: "Car",
      color: "yellow"
    },
    {
      title: "Plane",
      color: "lightblue"
    },
    {
      title: "Bicycle",
      color: "lightgreen"
    },
    {
      title: "Train",
      color: "orange"
    }
  ];

  const movies = [
    {
      title: "Seven",
      color: "red"
    },
    {
      title: "Memento",
      color: "white"
    },
    {
      title: "Vivarium",
      color: "lightgreen"
    },
    {
      title: "Blue Velvet",
      color: "lightblue"
    }
  ];

  return (
    <>
      <Box
        className="Container Of Sub"
        style={{
          backgroundColor: "lightpink",
          display: "flex",
          alignItems: "center",
          width: "100%",
          height: "100%"
        }}
      >
        <Box className="FirstSub" style={{ width: "50%" }}>
          <Box
            className="Header"
            style={{
              borderRadius: "10px",
              paddingLeft: "10px",
              boxShadow: "4px 4px 20px 0px rgba(0,0,0,0.25",
              backgroundColor: "white"
            }}
          >

Subcategory 1

          </Box>

          <Box
            className="Category Holder"
            sx={{
              display: "flex",
              flexWrap: "wrap",
              alignContent: "stretch",
              borderRadius: 1
            }}
          >
            {items.map((item) => (
              <Item
                sx={{
                  backgroundColor: item.color
                }}
              >
                {item.title}
              </Item>
            ))}
          </Box>
        </Box>

        <Box
          className="2ndSubCategory"
          style={{
            width: "50%",
            marginLeft: "20px"
          }}
        >
          <Box
            className="Header"
            style={{
              borderRadius: "10px",
              paddingLeft: "10px",
              boxShadow: "4px 4px 20px 0px rgba(0,0,0,0.25",
              backgroundColor: "white"
            }}
          >

Subcategory 2

          </Box>

          <Box
            className="Category Holder"
            sx={{
              display: "flex",
              flexWrap: "wrap",

              alignContent: "stretch",
              borderRadius: 1
            }}
          >
            {movies.map((item) => (
              <Item
                sx={{
                  backgroundColor: item.color
                }}
              >
                {item.title}
              </Item>
            ))}
          </Box>
        </Box>
      </Box>
    </>
  );
}


问:
Android NavigationComponent deepLink doesn't care about actions
So I have this navigation graph, and I'm implementing a deeplink to different fragments once the NEXT buton is pressed on the mainFragment.

However I encountered 2 problems:

If I call for example:

```<code>val deeplink = findNavController()
            .createDeepLink()
            .addDestination(R.id.fragmentNo5)
            .createPendingIntent()
deeplink.send()
</code>```

The app goes from mainFragment -> fragmentNo5, and when I click back it returns to mainFragment instead of fragmentNo2.

Then I tested opening the fragment8 which is not even in the path by actions, and it could still open it mainFragment -> fragmentNo8

I could even add more destinations to do something as the following, which should be illegal:

mainFragment -> fragmentNo8 -> otherFragment

So I see no purpose on using deeplink this way, or is it simply a way to construct the path that I need to still know and program?

```<code>val deeplink = findNavController()
            .createDeepLink()
            .addDestination(R.id.otherFragment)
            .addDestination(R.id.fragmentNo1)
            .addDestination(R.id.fragmentNo2)
            .addDestination(R.id.fragmentNo3)
            .createPendingIntent()
 deeplink.send()
</code>```

Body:
So I have this navigation graph, and I'm implementing a deeplink to different fragments once the NEXT buton is pressed on the mainFragment.

However I encountered 2 problems:

If I call for example:

val deeplink = findNavController()
            .createDeepLink()
            .addDestination(R.id.fragmentNo5)
            .createPendingIntent()
deeplink.send()

The app goes from mainFragment -> fragmentNo5, and when I click back it returns to mainFragment instead of fragmentNo2.

Then I tested opening the fragment8 which is not even in the path by actions, and it could still open it mainFragment -> fragmentNo8

I could even add more destinations to do something as the following, which should be illegal:

mainFragment -> fragmentNo8 -> otherFragment

So I see no purpose on using deeplink this way, or is it simply a way to construct the path that I need to still know and program?

val deeplink = findNavController()
            .createDeepLink()
            .addDestination(R.id.otherFragment)
            .addDestination(R.id.fragmentNo1)
            .addDestination(R.id.fragmentNo2)
            .addDestination(R.id.fragmentNo3)
            .createPendingIntent()
 deeplink.send()


问:
Mail Merge: Exception: The starting column of the range is too small
I copied a script and made changes to reference another sheet on my file. I've changed the relative columns, but I'm receiving an error message. The error is "The starting column of the range is too small". After reviewing various issues, I believe my issue is that my function isn't pointing to the sheet correctly.
enter image description here

I've added the sheet name within the function but received the same result.

```<code>/**
 * Creates the menu item "Mail Merge" for user to run scripts on drop-down.
 */
function onOpen() {
const ui = SpreadsheetApp.getUi();
ui.createMenu('Mail Merge')
    .addItem('Send Emails', 'sendEmails')
    .addToUi();
}

/**
 * Sends emails from sheet data.
 * @param {string} subjectLine (optional) for the email draft message
 * @param {Sheet} sheet to read data from
*/
function sendEmails(subjectLine, sheet=SpreadsheetApp.getActiveSheet()) {
// option to skip browser prompt if you want to use this code in other projects
if (!subjectLine){
  subjectLine = Browser.inputBox("Mail Merge",
                                    "Type or copy/paste the subject line of the Gmail " +
                                    "draft message you would like to mail merge with:",
                                    Browser.Buttons.OK_CANCEL);

  if (subjectLine === "cancel" || subjectLine == ""){
  // If no subject line, finishes up
  return;
  }
</code>```

Body:
I copied a script and made changes to reference another sheet on my file. I've changed the relative columns, but I'm receiving an error message. The error is "The starting column of the range is too small". After reviewing various issues, I believe my issue is that my function isn't pointing to the sheet correctly.
enter image description here

I've added the sheet name within the function but received the same result.

/**
 * Creates the menu item "Mail Merge" for user to run scripts on drop-down.
 */
function onOpen() {
const ui = SpreadsheetApp.getUi();
ui.createMenu('Mail Merge')
    .addItem('Send Emails', 'sendEmails')
    .addToUi();
}

/**
 * Sends emails from sheet data.
 * @param {string} subjectLine (optional) for the email draft message
 * @param {Sheet} sheet to read data from
*/
function sendEmails(subjectLine, sheet=SpreadsheetApp.getActiveSheet()) {
// option to skip browser prompt if you want to use this code in other projects
if (!subjectLine){
  subjectLine = Browser.inputBox("Mail Merge",
                                    "Type or copy/paste the subject line of the Gmail " +
                                    "draft message you would like to mail merge with:",
                                    Browser.Buttons.OK_CANCEL);

  if (subjectLine === "cancel" || subjectLine == ""){
  // If no subject line, finishes up
  return;
  }


问:
Delete all objects in S3 bucket except one which comes last in lexicographical order group by a prefix
Consider an S3 bucket with objects with keys like:

```<code>abc_1_epoch1.ext
abc_1_epoch2.ext
abc_2_epoch1.ext
xyz_1_epcoh1.ext
</code>```

When i group by keys with prefix, then due to epoch it forms a lexicographical order. I want to delete all objects except the one which comes last in lexicographical order. So, the expected output in the bucket after cleanup task is:

```<code>abc_1_epoch2.ext
abc_2_epoch1.ext
xyz_1_epoch1.ext
</code>```

As you can see grouping keys are abc_1, abc_2 and xyz_1. Point to note is that i have multi-million such objects in the bucket and hence I want a scalable solution.

Body:
Consider an S3 bucket with objects with keys like:

abc_1_epoch1.ext
abc_1_epoch2.ext
abc_2_epoch1.ext
xyz_1_epcoh1.ext

When i group by keys with prefix, then due to epoch it forms a lexicographical order. I want to delete all objects except the one which comes last in lexicographical order. So, the expected output in the bucket after cleanup task is:

abc_1_epoch2.ext
abc_2_epoch1.ext
xyz_1_epoch1.ext

As you can see grouping keys are abc_1, abc_2 and xyz_1. Point to note is that i have multi-million such objects in the bucket and hence I want a scalable solution.


问:
How do I create a MySql connection in .NET 6.0 Program.cs vs .NET 5.0 Startup.cs?
I have established a MySql connection in .NET 5.0 in startup.cs, but would like to do almost the exact same thing in a new MVC web app using .NET 6.0, and startup.cs is no longer a part of .NET 6.0. Below is the connection I used before, written in C#. How would I do the same thing in program.cs in .NET 6.0?

Code from .NET 5.0:

```<code>public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped<IDbConnection>((s) =>
            {
                IDbConnection conn = new MySqlConnection(Configuration.GetConnectionString("behs"));
                conn.Open();
                return conn;
            });

            services.AddTransient<IProductRepository, ProductRepository>();

            services.AddControllersWithViews();
        }
</code>```

I know (i.e. strongly suspect) it is done using builder, but cannot quite get it to work.

Again, I suspect the solution lies in program.cs, somewhere here:

```<code>// Add services to the container.
builder.Services.AddControllersWithViews();

var app = builder.Build();
</code>```

Any and all help is appreciated, thanks!

Body:
I have established a MySql connection in .NET 5.0 in startup.cs, but would like to do almost the exact same thing in a new MVC web app using .NET 6.0, and startup.cs is no longer a part of .NET 6.0. Below is the connection I used before, written in C#. How would I do the same thing in program.cs in .NET 6.0?

Code from .NET 5.0:

public void ConfigureServices(IServiceCollection services)
        {
            services.AddScoped<IDbConnection>((s) =>
            {
                IDbConnection conn = new MySqlConnection(Configuration.GetConnectionString("behs"));
                conn.Open();
                return conn;
            });

            services.AddTransient<IProductRepository, ProductRepository>();

            services.AddControllersWithViews();
        }

I know (i.e. strongly suspect) it is done using builder, but cannot quite get it to work.

Again, I suspect the solution lies in program.cs, somewhere here:

// Add services to the container.
builder.Services.AddControllersWithViews();

var app = builder.Build();

Any and all help is appreciated, thanks!


问:
python percentile centered in a 15 day window
I'm kind of new into Python functions and in general python (xarray for large data sets).
Does exist a function that can calculate the 90th percentile centered on a 15 day window for a long time series of a domain?

ie I have 62 years of daily maximum temperature during the summer season over North America (I merge with cdo the whole days within JJA). I want to calculate the 90th daily percentile of tmax (during the summer season) of the period based on a centered 15-day window (in order to calculate heat waves)

I was wondering if it exists something that can calculate directly this for a long time series? as in np.percentile? I was thinking if perhaps np.percentile has something like np.roll? but not sure how to use it properly

Thanks in advance!


问:
Samsung S22 Ultra Cutout Bounds Incorrect
I'm trying to determine the cutout position on a Samsung S22 Ultra (SM-S908U). The only Rect returned by WindowInsetsCompat.getDisplayCutout().getBoundingRects() seems to be incorrect when the device resolution is set to 2316 x 1080. Is this just a Samsung bug?

Cutout position for each resolution:

```<code>1544 x  720 : Left = 341, Right = 379
2316 x 1080 : Left = 692, Right = 748
3088 x 1440 : Left = 683, Right = 758
</code>```

Shouldn't the values for the 1080 resolution be about half way between the other two?

Body:
I'm trying to determine the cutout position on a Samsung S22 Ultra (SM-S908U). The only Rect returned by WindowInsetsCompat.getDisplayCutout().getBoundingRects() seems to be incorrect when the device resolution is set to 2316 x 1080. Is this just a Samsung bug?

Cutout position for each resolution:

1544 x  720 : Left = 341, Right = 379
2316 x 1080 : Left = 692, Right = 748
3088 x 1440 : Left = 683, Right = 758

Shouldn't the values for the 1080 resolution be about half way between the other two?


问:
Creating file upload progress bar with socket.io
So, when i try to upload a file via socket.io (running on NestJS) and Angular (Client), i want to create a progressbar to get some response from the server. Is there any way to do it?

Thanks!

Heres my code:

NestJS (BackEnd):

```<code>          function mkdirRecursiveSync(path: string) {
            if (!existsSync(path)) {
              mkdirRecursiveSync(dirname(path));
              mkdirSync(path);
            }
          }

          mkdirRecursiveSync(`CDN/attachments/${data.filesDest}`)

            writeFileSync(`CDN/attachments/${data.filesDest}/${file.name}`, file.file)

            files.push(`CDN/attachments/${data.filesDest}/${file.name}`)
        });

        console.log(files)

        let socketfiles = []

        files.forEach(file => {
          socketfiles.push(process.env.CDN_URL_NO_KEYWORD+file)
        });

        this.server.emit("onMessage", {
          author: data.userid,
          username: data.username,
          pfp: process.env.CDN_URL + "pfp/" + data.pfp,
          message: data.message,
          sent_at: new Date(),
          chatid: data.chatid,
          files: socketfiles,
        });
</code>```

Angular (FrontEnd):

```<code>
        let files: any = []

          let dateX = cur_day + hours + minutes + seconds;

          this.draftImages.forEach((file: any) => {
            files.push({
              file: file.file,
              name: file.fileName
            })
          })

            this.dmService.sendMessage({
              message: message,
              chatid: this.chatid,
              userid: this.userData.userid,
              username: this.userData.username,
              pfp: this.userData.pfp,
              files: files,
              filesDest: `${this.chatid}/${this.userData.userid}/${dateX}/`
            });

            this.draftImages = []
</code>```

dmService (angular):

```<code>  public sendMessage(data: any) {
    this.socket.emit('newMessage', data);
  }

</code>```

Body:
So, when i try to upload a file via socket.io (running on NestJS) and Angular (Client), i want to create a progressbar to get some response from the server. Is there any way to do it?

Thanks!

Heres my code:

NestJS (BackEnd):

          function mkdirRecursiveSync(path: string) {
            if (!existsSync(path)) {
              mkdirRecursiveSync(dirname(path));
              mkdirSync(path);
            }
          }

          mkdirRecursiveSync(`CDN/attachments/${data.filesDest}`)

            writeFileSync(`CDN/attachments/${data.filesDest}/${file.name}`, file.file)

            files.push(`CDN/attachments/${data.filesDest}/${file.name}`)
        });

        console.log(files)

        let socketfiles = []

        files.forEach(file => {
          socketfiles.push(process.env.CDN_URL_NO_KEYWORD+file)
        });

        this.server.emit("onMessage", {
          author: data.userid,
          username: data.username,
          pfp: process.env.CDN_URL + "pfp/" + data.pfp,
          message: data.message,
          sent_at: new Date(),
          chatid: data.chatid,
          files: socketfiles,
        });

Angular (FrontEnd):

        let files: any = []

          let dateX = cur_day + hours + minutes + seconds;

          this.draftImages.forEach((file: any) => {
            files.push({
              file: file.file,
              name: file.fileName
            })
          })

            this.dmService.sendMessage({
              message: message,
              chatid: this.chatid,
              userid: this.userData.userid,
              username: this.userData.username,
              pfp: this.userData.pfp,
              files: files,
              filesDest: `${this.chatid}/${this.userData.userid}/${dateX}/`
            });

            this.draftImages = []

dmService (angular):

  public sendMessage(data: any) {
    this.socket.emit('newMessage', data);
  }


问:
drag and drop between different recyclerviews with animation
I'm creating a simple (or so I thought) app that allows a user to drag/drop/reorder items within one of two recyclerview lists, or from one list to another. It should animate as you are dragging items, opening gaps that help you easily drop the item into the target spot. This functionality needs to go both ways between the lists. And for extra fun, drag should start on touch, not long press.

In case it makes any difference I'm trying to stick to MVVM, and my 2 recyclerviews are in 2 different fragments, but combined in one screen for this activity.

I'm a relative newbie to android, and using kotlin.

What I have managed so far

I can achieve a nice animation within one recyclerview, using ItemTouchHelper.
OR

I can achieve drag and drop from one recyclerview to the other, and I can start that on touch rather than long press, using View.OnDragListener.

What I can't seem to do is get both of those working at once--drag to another view, but with those beautiful animations ItemTouchHelper provides as the drag is underway.

I have tested all kinds of combinations of attaching customized drag or touchlisteners to my viewholders or recyclerviews. The closest I've gotten to getting things working is attaching the draglistener to the recyclerviews only, in order to receive the dropped view. Then I have set draglisteners and touchhelpers on the viewholders (via the recyclerview adapter).

With this setup I can drag between or within recyclerviews on touch, and have managed to get an animation AFTER drop by calling onItemMove of my adapter (provided as a parameter in my custom draglistener) from within the ACTION_DROP of my dragListener.

I've been working on this for a VERY LONG TIME and googled the heck out of it without luck. Help deeply appreciated.


问:
Auth0 Sign in with Apple Integration for an Expo app
I have a react native expo app that I'm trying to publish to the App store via expo. When uploading this app to App Store Connect, I used the option to let Expo handle the configuration including setting up a distribution certificate, profile, and whatever other settings were necessary (everything was automatic - I just had to provide my login credentials for my account).

The issue I'm now having is that I need the Client Secret Signing Key for this app because I'm trying to implement Sign in with Apple for this app in Auth0. I was able to find the Client ID and Team ID, but I don't know where the Client Secret Signing Key is supposed to be. I've been reading the docs on Expo and Auth0, but I can't find the information. If anyone knows how I could obtain this information, I would greatly appreciate it.


问:
How to use XGboost as multiclass regression in Python
I would like to run XGboost for multiclass regression. In my case, I'm using a single attribute as value (X) and label (y)

This is my code:

```<code> import xgboost as xgb
    from xgboost import XGBRegressor
    dat=dat2["gh"]
    raw= dat[0:num]
    X = raw[:-1]
    y = raw[1:]
    xg_reg = xgb.XGBRegressor()
    dist=[]
    for i in range (0,10):
        pred = xg_reg.predict([dat[(num-1)+i]])
        print(pred)

</code>```

The dataframe (raw) is the following:

```<code><class 'pandas.core.series.Series'>
0    14215279993634829673
1    14215279993634774575
2    14215279993657262886
3    14215279993655650232
4    14215279993656041129
5    14215279993653034890
6    14215279993663569327
7    14215279993664053186
8    14215279993308738063
9    14215279993308129682
Name: gh, dtype: uint64
</code>```

However, it fails in the fit function with this error:

```<code>XGBoostError: [18:23:06] /workspace/src/objective/regression_obj.cu:65: Check failed: preds.Size() == info.labels_.Size() (1 vs. 9) : labels are not correctly providedpreds.size=1, label.size=9
Stack trace:
</code>```

Any idea how to solve this issue

Body:
I would like to run XGboost for multiclass regression. In my case, I'm using a single attribute as value (X) and label (y)

This is my code:

 import xgboost as xgb
    from xgboost import XGBRegressor
    dat=dat2["gh"]
    raw= dat[0:num]
    X = raw[:-1]
    y = raw[1:]
    xg_reg = xgb.XGBRegressor()
    dist=[]
    for i in range (0,10):
        pred = xg_reg.predict([dat[(num-1)+i]])
        print(pred)

The dataframe (raw) is the following:

<class 'pandas.core.series.Series'>
0    14215279993634829673
1    14215279993634774575
2    14215279993657262886
3    14215279993655650232
4    14215279993656041129
5    14215279993653034890
6    14215279993663569327
7    14215279993664053186
8    14215279993308738063
9    14215279993308129682
Name: gh, dtype: uint64

However, it fails in the fit function with this error:

XGBoostError: [18:23:06] /workspace/src/objective/regression_obj.cu:65: Check failed: preds.Size() == info.labels_.Size() (1 vs. 9) : labels are not correctly providedpreds.size=1, label.size=9
Stack trace:

Any idea how to solve this issue


问:
Python code runs the first time, errors if I attempt to run it twice
I'm using elpy and python3 in Ubuntu.

I have the following python code in a file called turtleTest.py:

```<code>from turtle import Turtle, Screen

timy = Turtle()
timy.shape("turtle")
timy.fillcolor("red")

my_screen = Screen()
my_screen.exitonclick()
</code>```

When I open a new python shell with M-x run-python and send the above code to the shell with C-c C-c for the first time, it runs as expected.
But, if I try to send it to the shell a second time (also using C-c C-c), it throws an error:

```<code>Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gp/Documents/python/udemyPython100daysOfCode/day16_OOP/turtleTest.py", line 3, in <module>
    timy = Turtle()
  File "/usr/lib/python3.8/turtle.py", line 3814, in __init__
    RawTurtle.__init__(self, Turtle._screen,
  File "/usr/lib/python3.8/turtle.py", line 2558, in __init__
    self._update()
  File "/usr/lib/python3.8/turtle.py", line 2661, in _update
    self._update_data()
  File "/usr/lib/python3.8/turtle.py", line 2647, in _update_data
    self.screen._incrementudc()
  File "/usr/lib/python3.8/turtle.py", line 1293, in _incrementudc
    raise Terminator
turtle.Terminator
</code>```

If I run the code from the terminal (python3 turtleTest.py), it runs fine as many times as I run it.

```<code>gp@Cerberos:~$ emacs --version
GNU Emacs 26.3
gp@Cerberos:~$ python3 --version
Python 3.8.10
</code>```

When I M-x list-packages and search for elpy:

```<code> elpy               20220922.2253 installed             Emacs Python Development Environment
</code>```

M-x elpy-config:

```<code>Elpy Configuration

Emacs.............: 26.3
Elpy..............: 1.35.0
Virtualenv........: None
Interactive Python: python3 3.8.10 (/usr/bin/python3)
RPC virtualenv....: rpc-venv (/home/gp/.emacs.d/elpy/rpc-venv)
 Python...........: python 3.8.10 (/home/gp/.emacs.d/elpy/rpc-venv/bin/python)
 Jedi.............: 0.18.2
 Autopep8.........: 2.0.1
 Yapf.............: 0.32.0
 Black............: 22.12.0
Syntax checker....: flake8 (/home/gp/.local/bin/flake8)
</code>```

Posible duplicates checked:

I checked this question (without answer) but it seems to be related to a different problem.

What am I doing wrong and how can I fix this?

Body:
I'm using elpy and python3 in Ubuntu.

I have the following python code in a file called turtleTest.py:

from turtle import Turtle, Screen

timy = Turtle()
timy.shape("turtle")
timy.fillcolor("red")

my_screen = Screen()
my_screen.exitonclick()

When I open a new python shell with M-x run-python and send the above code to the shell with C-c C-c for the first time, it runs as expected.
But, if I try to send it to the shell a second time (also using C-c C-c), it throws an error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/gp/Documents/python/udemyPython100daysOfCode/day16_OOP/turtleTest.py", line 3, in <module>
    timy = Turtle()
  File "/usr/lib/python3.8/turtle.py", line 3814, in __init__
    RawTurtle.__init__(self, Turtle._screen,
  File "/usr/lib/python3.8/turtle.py", line 2558, in __init__
    self._update()
  File "/usr/lib/python3.8/turtle.py", line 2661, in _update
    self._update_data()
  File "/usr/lib/python3.8/turtle.py", line 2647, in _update_data
    self.screen._incrementudc()
  File "/usr/lib/python3.8/turtle.py", line 1293, in _incrementudc
    raise Terminator
turtle.Terminator

If I run the code from the terminal (python3 turtleTest.py), it runs fine as many times as I run it.

gp@Cerberos:~$ emacs --version
GNU Emacs 26.3
gp@Cerberos:~$ python3 --version
Python 3.8.10

When I M-x list-packages and search for elpy:

 elpy               20220922.2253 installed             Emacs Python Development Environment

M-x elpy-config:

Elpy Configuration

Emacs.............: 26.3
Elpy..............: 1.35.0
Virtualenv........: None
Interactive Python: python3 3.8.10 (/usr/bin/python3)
RPC virtualenv....: rpc-venv (/home/gp/.emacs.d/elpy/rpc-venv)
 Python...........: python 3.8.10 (/home/gp/.emacs.d/elpy/rpc-venv/bin/python)
 Jedi.............: 0.18.2
 Autopep8.........: 2.0.1
 Yapf.............: 0.32.0
 Black............: 22.12.0
Syntax checker....: flake8 (/home/gp/.local/bin/flake8)

Posible duplicates checked:

I checked this question (without answer) but it seems to be related to a different problem.

What am I doing wrong and how can I fix this?


问:
The correct usage of unlikely macro in multiple conditions
I see many examples using the unlikely macro (not the C++20 attribute) as if( unlikely( server == 0 ) ), but never combining them both as if( unlikely( server == 0 ) || unlikely( client == 0 ) ) or if( unlikely( server == 0 || client == 0 ) ).

Can I need to use two unlikely on two conditionals for the same if or the unlikely is interpreted correctly if used only once in the whole if condition as in if( unlikely( server == 0 || client == 0 ) )?

Other questions about unlikely:

gcc likely unlikely macro usage

efficient, extremely-unlikely conditionals?

likely and unlikely macros

likely/unlikely instead of if/else


问:
Kubernetes - Failed to Apply a yaml from a raw url, Unable to connect to the server: dial tcp: lookup raw.githubusercontent.com on: server misbehaving
Im Anddiy and im working with a kubernetes cluster deployed by Rancher.

Its important to say that all my machines don't have direct access to the internet, im using a proxy to use the internet for downloads or something, so i've setted RKE2 with this proxy during the installation steps.

Here i have a machine with an RKE2 that build up my Rancher, and from the Rancer U.I i've created my Kubernetes Cluster, here it tis:

```<code>
[15:19] root@vmrmmstnodehom01 [~]:# kubectl get nodes
NAME               STATUS   ROLES                      AGE     VERSION
vmrmmstnodehom01   Ready    controlplane               5d16h   v1.24.8
vmrmwrknodehom01   Ready    controlplane,etcd,worker   5d20h   v1.24.8
vmrmwrknodehom02   Ready    worker                     5d19h   v1.24.8
vmrmwrknodehom03   Ready    worker                     5d19h   v1.24.8
vmrmwrknodehom04   Ready    worker                     5d19h   v1.24.8
</code>```

My cluster is a clean cluster, no applications installed on it at moment.

I've tried to install the longhorn application by using this command ( got this on longhorn documentation):
kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.4.0/deploy/longhorn.yaml

But when i tried that, this error message are displayed to me:

```<code>Unable to connect to the server: dial tcp: lookup raw.githubusercontent.com on 10.129.251.125:53: server misbehaving
</code>```

I've tried to check if it is my proxy that don't connect to this url or something, but my machine connected succesfully to this url, i've tried that using the CURL -V and the longhorn url to test that.

I don't know if the kubernetes api has imported the proxy configs of my rke2/rancher, so i don't know if i need to set the proxy manually internal or something, really don't know what is happening here.

Body:
Im Anddiy and im working with a kubernetes cluster deployed by Rancher.

Its important to say that all my machines don't have direct access to the internet, im using a proxy to use the internet for downloads or something, so i've setted RKE2 with this proxy during the installation steps.

Here i have a machine with an RKE2 that build up my Rancher, and from the Rancer U.I i've created my Kubernetes Cluster, here it tis:

[15:19] root@vmrmmstnodehom01 [~]:# kubectl get nodes
NAME               STATUS   ROLES                      AGE     VERSION
vmrmmstnodehom01   Ready    controlplane               5d16h   v1.24.8
vmrmwrknodehom01   Ready    controlplane,etcd,worker   5d20h   v1.24.8
vmrmwrknodehom02   Ready    worker                     5d19h   v1.24.8
vmrmwrknodehom03   Ready    worker                     5d19h   v1.24.8
vmrmwrknodehom04   Ready    worker                     5d19h   v1.24.8

My cluster is a clean cluster, no applications installed on it at moment.

I've tried to install the longhorn application by using this command ( got this on longhorn documentation):
kubectl apply -f https://raw.githubusercontent.com/longhorn/longhorn/v1.4.0/deploy/longhorn.yaml

But when i tried that, this error message are displayed to me:

Unable to connect to the server: dial tcp: lookup raw.githubusercontent.com on 10.129.251.125:53: server misbehaving

I've tried to check if it is my proxy that don't connect to this url or something, but my machine connected succesfully to this url, i've tried that using the CURL -V and the longhorn url to test that.

I don't know if the kubernetes api has imported the proxy configs of my rke2/rancher, so i don't know if i need to set the proxy manually internal or something, really don't know what is happening here.