问:
How can I target a bootstrap 4.6 tab element and trigger a click from a url hash?
I have a series of bootstrap 4.6 tabs on a page and I want any of these tabs to be opened via the hash value in a url. Using this thread as a start off-point, I have been able to detect a hash value at the end of the page url in a document.ready function like so, but for some reason the targeted tab is never clicked:

```<code>$(document).ready(function($) {

  function onHashChange() {
    var hash = window.location.hash;

    if (hash) {
      // using ES6 template string syntax
      $(`[data-toggle="tab"][href="${hash}"]`).trigger('click');
      // None of these seem to work either
      $(hash).trigger('click');
      $(hash)[0].click();
      $(hash).click();
    }
  }

  window.addEventListener('hashchange', onHashChange, false);
  onHashChange();
})
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script>
</code>```

I have confirmed that the $(hash) selector is finding the correct element, but it is never changed by the script. How can I modify my code so the targeted tab element is clicked and the correct tab content is shown when my page loads?

Body:
I have a series of bootstrap 4.6 tabs on a page and I want any of these tabs to be opened via the hash value in a url. Using this thread as a start off-point, I have been able to detect a hash value at the end of the page url in a document.ready function like so, but for some reason the targeted tab is never clicked:

$(document).ready(function($) {

  function onHashChange() {
    var hash = window.location.hash;

    if (hash) {
      // using ES6 template string syntax
      $(`[data-toggle="tab"][href="${hash}"]`).trigger('click');
      // None of these seem to work either
      $(hash).trigger('click');
      $(hash)[0].click();
      $(hash).click();
    }
  }

  window.addEventListener('hashchange', onHashChange, false);
  onHashChange();
})
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">

I have confirmed that the $(hash) selector is finding the correct element, but it is never changed by the script. How can I modify my code so the targeted tab element is clicked and the correct tab content is shown when my page loads?


来源: stackexchange

问:
Health Check keeps failing for ECS container
I am currently trying to deploy 2 ECS services on a single EC2 instance for test environment.

Here is what I have done so far:

Successfully created 2 Security Groups for Load Balancer and EC2 instance.

My EC2 Security Group

My ALB Security Group

Successfully created 2 different Task Definitions for my 2 applications, all Spring Boot application. First application is running on port 8080, Container Port in Task Definition is also 8080. The second application is running on port 8081, Container Port in Task Definition is also 8081.

Successfully created an ECS cluster with an Auto-Scaling Group as Capacity Provider. The cluster also recognizes the Container Instance created from Auto-Scaling Group (I am using t2.micro since it is in free-tier package). Attached created Security Group to EC2 instance.

My EC2 Security Group

Successfully created an ALB with 2 forward listeners 8080 and 8081 configured to 2 different Target Groups for each service. Attached created Security Group to ALB.

Here is how the ECS behaves with my services:

I attempted to create 2 new services. First service mapped with port 8080 on ALB. The second one mapped with port 8081 on ALB. Each of them have different Target Group but the Health Check configurations are the same

Health Check Configuration for Service 1

Health Check Configuration for Service 2

The first service was deployed pretty smooth, health check returned success on the first try.

However, for the second service, I use the exact same configuration as the first one, just a different port listener on ALB and the application container running on a different port number as well (which I believe that it should not be a problem). The service attempted 10 times before it fails the deployment and I noticed getting this repeated error message: service <service_name> instance <instance_id> port <port_number> is unhealthy in target-group <target_group_name> due to (reason Health checks failed).

This did not happen with my first service with the same configuration. The weird thing is that when I attempted to send a request the ALB domain name on port 8081, the application on the second service seems to be working fine without any error. It is just that the Unhealthy Check keeps throwing my service off.

I went over bunch of posts and nothing really helps with the current situation. Also, it is kind of dumb since I cannot dig any further details rather than this info in this image below.

Anyone has any suggestion to resolve this problem? Would really appreciate it.

ContentLicense: CC BY-SA 4.0


问:
Returning a certain pattern for animations using JavaScript
I'm learning JavaScript and intended to animate divs over an image to get the effect of "curtains closing" over that image. But I would like to do that in a specific endless way (one after the other till it starts all over again) since 9 images should be displayed inside a "matrix/grid" 3*3. After some research I've decided to try the setInterval method since, as far as I'm concerned, it keeps calling a function given a certain interval. Somehow, I don't know why, I can't get this effect, and the animation stucks after the first execution!

function Live(cont) {
  if (cont == 1) {
    return [
      (document.getElementById("curtain-1").style.animation = "t-enclosure 1.5s"), (document.getElementById("curtain-2").style.animation = "b-enclosure 1.5s "),
    ];
  } else if (cont == 2) {
    return [
      (document.getElementById("curtain-3").style.animation = "t-enclosure 1.5s"), (document.getElementById("curtain-4").style.animation = "b-enclosure 1.5s "),
    ];
  }

setInterval(Live(1), 1000);

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --```
<pre class="snippet-code-css lang-css prettyprint-override"><code>#section {
  width: 240px;
  height: 240px;
}

@keyframes t-enclosure {
  0% {
    height: 0px;
    opacity: 0;
    background-color: aqua;
  }
  100% {
    height: 180px;
    opacity: 0.5;
    background-color: aqua;
  }
}

@keyframes b-enclosure {
  0% {
    height: 0px;
    opacity: 0;
    background-color: aliceblue;
  }
  100% {
    height: 60px;
    opacity: 0.8;
    background-color: aliceblue;
  }
}</code>```

```

Body:
I'm learning JavaScript and intended to animate divs over an image to get the effect of "curtains closing" over that image. But I would like to do that in a specific endless way (one after the other till it starts all over again) since 9 images should be displayed inside a "matrix/grid" 3*3. After some research I've decided to try the setInterval method since, as far as I'm concerned, it keeps calling a function given a certain interval. Somehow, I don't know why, I can't get this effect, and the animation stucks after the first execution!

function Live(cont) {
  if (cont == 1) {
    return [
      (document.getElementById("curtain-1").style.animation = "t-enclosure 1.5s"), (document.getElementById("curtain-2").style.animation = "b-enclosure 1.5s "),
    ];
  } else if (cont == 2) {
    return [
      (document.getElementById("curtain-3").style.animation = "t-enclosure 1.5s"), (document.getElementById("curtain-4").style.animation = "b-enclosure 1.5s "),
    ];
  }

setInterval(Live(1), 1000);

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

#section {
  width: 240px;
  height: 240px;
}

@keyframes t-enclosure {
  0% {
    height: 0px;
    opacity: 0;
    background-color: aqua;
  }
  100% {
    height: 180px;
    opacity: 0.5;
    background-color: aqua;
  }
}

@keyframes b-enclosure {
  0% {
    height: 0px;
    opacity: 0;
    background-color: aliceblue;
  }
  100% {
    height: 60px;
    opacity: 0.8;
    background-color: aliceblue;
  }
}


问:
Mysql temp columns doesn't reset
i have a python function with sql query.

def DownloadLastMsgs(username,conn, cursor):
    cursor.execute("SELECT reciver, sender, encoded_to, msg, send_time, Opened \
    FROM \
     (SELECT reciver, sender, encoded_to, msg, send_time, Opened,  \
                  @msg_rank := IF(@current_sender = sender, @msg_rank + 1, 1) AS msg_rank, \
                  @current_sender := sender  \
       FROM MSG \
       ORDER BY sender, send_time DESC \
     ) ranked \
    WHERE (reciver =  %(u)s OR sender= %(u)s) AND encoded_to = %(u)s  AND msg_rank <= 1", {'u': username})
    data = cursor.fetchall()
    print(data)
    return data
```

I can use this function only once and then it breaks.

When I change msg_rank to <=2 i can use it twice. I suposse that the function doesn't reset? somehow?

When I try to use this command in adminer sql command it works fine everytime....

How can i fix it? is there a way to reset this temp columns?

Title: Mysql temp columns doesn't reset

Body:
i have a python function with sql query.

def DownloadLastMsgs(username,conn, cursor):
    cursor.execute("SELECT reciver, sender, encoded_to, msg, send_time, Opened \
    FROM \
     (SELECT reciver, sender, encoded_to, msg, send_time, Opened,  \
                  @msg_rank := IF(@current_sender = sender, @msg_rank + 1, 1) AS msg_rank, \
                  @current_sender := sender  \
       FROM MSG \
       ORDER BY sender, send_time DESC \
     ) ranked \
    WHERE (reciver =  %(u)s OR sender= %(u)s) AND encoded_to = %(u)s  AND msg_rank <= 1", {'u': username})
    data = cursor.fetchall()
    print(data)
    return data

I can use this function only once and then it breaks.

When I change msg_rank to <=2 i can use it twice. I suposse that the function doesn't reset? somehow?

When I try to use this command in adminer sql command it works fine everytime....

How can i fix it? is there a way to reset this temp columns?


问:
Connecting to kernel takes too long
I have a problem running interactive window (Jupyter) in VS Code to see results of my algorithm. It takes too long to start or it is loading to infinity. It says: Connecting to kernel 3.9.7: Activating Python Environment ' \ '. I searched through the internet to find solution to my problem but unsuccessful. I also tried to reinstall jupyter extension but also unsuccessful. How should I solve this issue?

Title: Connecting to kernel takes too long


问:
React-Native ScrollView inside PanResponder: onStartShouldSetPanResponderCapture and onMoveShouldSetPanResponderCapture ignored for fast gestures
I have a React-Native component consisting of a View with an attached PanResponder that wraps a ScrollView:

```<code>import React from "react";
import { PanResponder, ScrollView, StyleSheet, View, Text } from "react-native";

const TestPanResponder = () => {
    const panResponder = React.useRef(
        PanResponder.create({
            onStartShouldSetPanResponder: () => true,
            onStartShouldSetPanResponderCapture: () => true,
            onMoveShouldSetPanResponder: () => true,
            onMoveShouldSetPanResponderCapture: () => true,
            onPanResponderTerminationRequest: () => {
                console.log("Termination request.")
                return false;
            },
            onPanResponderTerminate: () => {
                console.log("Terminated.")
            },
            onShouldBlockNativeResponder: () => false,
        })
    ).current;

    return (
        <View style={styles.container} {...panResponder.panHandlers}>
            <ScrollView style={styles.list}>
                {[...Array(10).keys()].map((item, index) =>
                    <View style={styles.sections} key={index}>
                        <Text>This is some text.</Text>
                    </View>
                )}
            </ScrollView>
        </View>
    );
};

const styles = StyleSheet.create({
    container: {
        backgroundColor: "#aaa",
        flex: 1,
    },
    list: {
        flex: 1,
    },
    sections: {
        height: 100,
        backgroundColor: "#fff",
        margin: 10,
        borderRadius: 5,
        alignItems: "center",
        justifyContent: "center"
    }
});

export default TestPanResponder;
</code>```

Android 12, react: 18.1.0, react-native: 0.70.5, expo: 47.0.0

I want the PanResponder to remain in charge of handling all touches (i.e. in this case, I want to prevent scrolling of the ScrollView altogether; later I want to hand over control to the ScrollView if certain conditions about the gesture are met).

To my understanding, the RN Gesture Responder System consists of two phases:

an capturing phase that recursively calls on*ShouldSetPanResponderCapture starting with parent components, where each component can "decide" whether it wants to remain the responder,

a second phase where on*ShouldSetPanResponder methods are called following a bubbling pattern, i.e. starting at the most deeply nested component.

I would therefore expect that by setting on*ShouldSetPanResponderCapture to true the ScrollView should never respond to touches. This is indeed what happens if I scroll slowly. However, if the upward swipe gesture is performed quickly, the list starts scrolling. Looking at the console logs, I noticed that onPanResponderTerminate gets fired, but not onPanResponderTerminationRequest.

Can anyone explain why this is the case (esp. why does the velocity of the gesture matter?) and suggest a fix?

I do realize that I could set scrollEnabled on the ScrollView, but I want to avoid re-rendering the list if possible in the more complicated end scenario.

Body:
I have a React-Native component consisting of a View with an attached PanResponder that wraps a ScrollView:

import React from "react";
import { PanResponder, ScrollView, StyleSheet, View, Text } from "react-native";

const TestPanResponder = () => {
    const panResponder = React.useRef(
        PanResponder.create({
            onStartShouldSetPanResponder: () => true,
            onStartShouldSetPanResponderCapture: () => true,
            onMoveShouldSetPanResponder: () => true,
            onMoveShouldSetPanResponderCapture: () => true,
            onPanResponderTerminationRequest: () => {
                console.log("Termination request.")
                return false;
            },
            onPanResponderTerminate: () => {
                console.log("Terminated.")
            },
            onShouldBlockNativeResponder: () => false,
        })
    ).current;

    return (
        <View style={styles.container} {...panResponder.panHandlers}>
            <ScrollView style={styles.list}>
                {[...Array(10).keys()].map((item, index) =>
                    <View style={styles.sections} key={index}>
                        <Text>This is some text.</Text>
                    </View>
                )}
            </ScrollView>
        </View>
    );
};

const styles = StyleSheet.create({
    container: {
        backgroundColor: "#aaa",
        flex: 1,
    },
    list: {
        flex: 1,
    },
    sections: {
        height: 100,
        backgroundColor: "#fff",
        margin: 10,
        borderRadius: 5,
        alignItems: "center",
        justifyContent: "center"
    }
});

export default TestPanResponder;

Android 12, react: 18.1.0, react-native: 0.70.5, expo: 47.0.0

I want the PanResponder to remain in charge of handling all touches (i.e. in this case, I want to prevent scrolling of the ScrollView altogether; later I want to hand over control to the ScrollView if certain conditions about the gesture are met).

To my understanding, the RN Gesture Responder System consists of two phases:

an capturing phase that recursively calls on*ShouldSetPanResponderCapture starting with parent components, where each component can "decide" whether it wants to remain the responder,

a second phase where on*ShouldSetPanResponder methods are called following a bubbling pattern, i.e. starting at the most deeply nested component.

I would therefore expect that by setting on*ShouldSetPanResponderCapture to true the ScrollView should never respond to touches. This is indeed what happens if I scroll slowly. However, if the upward swipe gesture is performed quickly, the list starts scrolling. Looking at the console logs, I noticed that onPanResponderTerminate gets fired, but not onPanResponderTerminationRequest.

Can anyone explain why this is the case (esp. why does the velocity of the gesture matter?) and suggest a fix?

I do realize that I could set scrollEnabled on the ScrollView, but I want to avoid re-rendering the list if possible in the more complicated end scenario.


问:
Code From Book Doesn't Log Me in Automatically PHP & MariaDB
I register my user, but when I log in after registration I'm told to log in again. Please help.

Here's my code:

```<code><?php

// include function files for this application
require_once('bookmark_fns.php');
session_start();

//create short variable names
if (!isset($_POST['username']))  {
  //if not isset -> set with dummy value
  $_POST['username'] = " ";
}
$username = $_POST['username'];
if (!isset($_POST['passwd']))  {
  //if not isset -> set with dummy value
  $_POST['passwd'] = " ";
}
$passwd = $_POST['passwd'];

if ($username && $passwd) {
// they have just tried logging in
  try  {
    login($username, $passwd);
    // if they are in the database register the user id
    $_SESSION['valid_user'] = $username;
  }
  catch(Exception $e)  {
    // unsuccessful login
    do_html_header('Problem:');
    echo 'You could not be logged in.<br>
          You must be logged in to view this page.';
    do_html_url('login.php', 'Login');
    do_html_footer();
    exit;
  }
}

do_html_header('Home');
check_valid_user();
// get the bookmarks this user has saved
if ($url_array = get_user_urls($_SESSION['valid_user'])) {
  display_user_urls($url_array);
}

// give menu of options
display_user_menu();

do_html_footer();
?>
</code>```

I tried using this member.php code but it doesn't work the way I want it to. Please help me get the book example to work properly and log me in right after registration

Body:
I register my user, but when I log in after registration I'm told to log in again. Please help.

Here's my code:

<?php

// include function files for this application
require_once('bookmark_fns.php');
session_start();

//create short variable names
if (!isset($_POST['username']))  {
  //if not isset -> set with dummy value
  $_POST['username'] = " ";
}
$username = $_POST['username'];
if (!isset($_POST['passwd']))  {
  //if not isset -> set with dummy value
  $_POST['passwd'] = " ";
}
$passwd = $_POST['passwd'];

if ($username && $passwd) {
// they have just tried logging in
  try  {
    login($username, $passwd);
    // if they are in the database register the user id
    $_SESSION['valid_user'] = $username;
  }
  catch(Exception $e)  {
    // unsuccessful login
    do_html_header('Problem:');
    echo 'You could not be logged in.

          You must be logged in to view this page.';
    do_html_url('login.php', 'Login');
    do_html_footer();
    exit;
  }
}

do_html_header('Home');
check_valid_user();
// get the bookmarks this user has saved
if ($url_array = get_user_urls($_SESSION['valid_user'])) {
  display_user_urls($url_array);
}

// give menu of options
display_user_menu();

do_html_footer();
?>

I tried using this member.php code but it doesn't work the way I want it to. Please help me get the book example to work properly and log me in right after registration


问:
Why am I getting error "numbers of columns of arguments do not match" for some model specifications but not others?
I'm trying to use the caret function rfe for variable selection. One of the models I would like to use it on is a logistic regression. I'm trying to follow the example here: https://stats.stackexchange.com/questions/37830/how-do-you-get-lmfuncs-functions-of-the-rfe-function-in-caret-to-do-a-logistic-r

From what I've observed in the following models, I can get the rfe function to work with my binary response variable presence when using random forest, GAM or naive Bayes, but both the basic linear model function and my attempt at making a glm logistic regression function don't work when presence is the predictor. However, the basic linear regression works fine when I use a different continuous variable as the predictor. Why would this be?

The error I'm getting is

Error in rbind(deparse.level, ...) :
numbers of columns of arguments do not match

I'm not sure why this would be happening when the input predictors and response come from the same dataframe.

```<code>library(caret)

rfcontrol <- rfeControl(functions = rfFuncs, # random forest
                      method = "repeatedcv", # repeated cv
                      repeats = 5, # number of repeats
                      number = 10) # number of folds

out_rf <- rfe(dat[,c(2:6)], dat[,1], sizes = c(1:5), rfeControl = rfcontrol)
#works

nbcontrol <- rfeControl(functions = nbFuncs, # random forest
                        method = "repeatedcv", # repeated cv
                        repeats = 5, # number of repeats
                        number = 10) # number of folds

out_nb <- rfe(dat[,c(2:6)], dat[,1], sizes = c(1:5), rfeControl = nbcontrol)
#works

gamcontrol <- rfeControl(functions = gamFuncs, # random forest
                        method = "repeatedcv", # repeated cv
                        repeats = 5, # number of repeats
                        number = 10) # number of folds

out_gam <- rfe(dat[,c(2:6)], dat[,1], sizes = c(1:5), rfeControl = gamcontrol)
#works

lmcontrol <- rfeControl(functions = gamFuncs, # random forest
                        method = "repeatedcv", # repeated cv
                        repeats = 5, # number of repeats
                        number = 10) # number of folds

out_lm <- rfe(dat[,c(3:6)], dat[,2], sizes = c(1:4), rfeControl = lmcontrol)
#works

out_lm2 <- rfe(dat[,c(2:6)], dat[,1], sizes = c(1:5), rfeControl = lmcontrol)
#doesn't work

glmFuncs <- lmFuncs

glmFuncs$fit=function (x, y, first, last, ...)  {
  tmp <- as.data.frame(x)
  tmp$y <- y
  glm(y ~ ., data = tmp, family=binomial(link='logit'))
}

glmcontrol <- rfeControl(functions = glmFuncs, # random forest
                        method = "repeatedcv", # repeated cv
                        repeats = 5, # number of repeats
                        number = 10) # number of folds

out_glm <- rfe(dat[,c(2:6)], dat[,1], sizes = c(1:5), rfeControl = glmcontrol)
#doesn't work

</code>```

Here is a sample of the dataset I'm using

```<code>dat <- structure(list(presence = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
                                             1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                             1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                             2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                             1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), levels = c("FALSE",
                                                                                "TRUE"), class = "factor"), mean_annual_temp = c(-10L, -9L, -6L,
                                                                                -8L, -5L, -13L, -10L, -10L, -12L, -14L, -10L, -9L, -10L, -17L,
                                                                                -10L, -12L, -17L, -11L, -17L, -9L, -13L, -11L, -17L, -10L, -10L,
                                                                                -10L, -12L, -11L, -11L, -10L, -13L, -17L, -12L, -10L, -13L, -12L,
                                                                                -12L, -11L, -15L, -6L, -10L, -14L, -12L, -12L, -5L, -12L, -16L,
                                                                                -16L, -12L, -19L, -19L, -13L, -18L, -12L, -14L, -10L, -9L, -14L,
                                                                                -11L, -15L, -14L, -12L, -11L, -11L, -10L, -6L, -14L, -5L, -6L,
                                                                                -9L, -12L, -11L, -11L, -14L, -16L, -14L, -13L, -14L, -13L, -14L,
                                                                                -13L, -10L, -12L, -13L, -9L, -13L, -13L, -14L, -12L, -17L, -15L,
                                                                                -12L, -15L, -11L, -12L, -14L, -5L, -12L, -5L, -14L), min_temp_coldest_month = c(-33L,
                                                                                -31L, -26L, -32L, -25L, -37L, -36L, -33L, -35L, -35L, -33L, -33L,
                                                                                -32L, -37L, -30L, -36L, -37L, -32L, -38L, -30L, -36L, -32L, -38L,
                                                                                -36L, -32L, -30L, -36L, -32L, -34L, -34L, -32L, -38L, -34L, -30L,
                                                                                -34L, -35L, -35L, -33L, -37L, -27L, -36L, -36L, -35L, -36L, -26L,
                                                                                -35L, -36L, -37L, -36L, -41L, -41L, -34L, -39L, -36L, -39L, -30L,
                                                                                -30L, -38L, -33L, -37L, -38L, -35L, -34L, -34L, -34L, -27L, -38L,
                                                                                -27L, -27L, -30L, -35L, -36L, -33L, -39L, -37L, -37L, -36L, -36L,
                                                                                -34L, -39L, -34L, -31L, -36L, -37L, -31L, -33L, -36L, -38L, -34L,
                                                                                -37L, -36L, -36L, -37L, -36L, -36L, -38L, -27L, -33L, -25L, -38L
                                                                                ), temp_annual_range = c(49L, 49L, 41L, 50L, 39L, 52L, 52L, 48L,
                                                                                50L, 46L, 48L, 50L, 48L, 44L, 42L, 51L, 44L, 47L, 44L, 43L, 52L,
                                                                                44L, 47L, 52L, 48L, 45L, 51L, 47L, 49L, 53L, 43L, 46L, 47L, 42L,
                                                                                46L, 51L, 51L, 47L, 47L, 42L, 52L, 50L, 51L, 52L, 42L, 50L, 43L,
                                                                                45L, 51L, 51L, 48L, 46L, 45L, 52L, 52L, 42L, 47L, 51L, 48L, 47L,
                                                                                52L, 50L, 49L, 49L, 50L, 42L, 52L, 42L, 41L, 47L, 51L, 53L, 49L,
                                                                                52L, 47L, 50L, 52L, 48L, 45L, 52L, 46L, 46L, 52L, 51L, 49L, 45L,
                                                                                51L, 52L, 48L, 45L, 47L, 52L, 47L, 53L, 51L, 52L, 42L, 45L, 39L,
                                                                                51L), mean_temp_wettest_Q = c(7L, 8L, 4L, 9L, 9L, 6L, 8L, 7L,
                                                                                6L, 2L, 7L, 8L, 7L, 0L, 3L, 6L, 0L, 6L, 0L, 5L, 6L, 4L, 0L, 8L,
                                                                                7L, 6L, 6L, 6L, 6L, 8L, 3L, 0L, 5L, 5L, 3L, 6L, 7L, 6L, 2L, 5L,
                                                                                8L, 5L, 6L, 7L, 5L, 6L, 0L, 0L, 6L, 0L, 0L, 4L, 0L, 7L, 4L, 4L,
                                                                                8L, 4L, 6L, 2L, 5L, 6L, 7L, 7L, 8L, 5L, 5L, 5L, 5L, 8L, 6L, 7L,
                                                                                7L, 5L, 1L, 4L, 6L, 4L, 3L, 4L, 3L, 7L, 7L, 6L, 8L, 4L, 6L, 4L,
                                                                                6L, 0L, 2L, 7L, 3L, 7L, 6L, 5L, 5L, 4L, 8L, 5L), mean_temp_driest_Q = c(-28L,
                                                                                -21L, -22L, -26L, -17L, -31L, -22L, -22L, -30L, -30L, -22L, -21L,
                                                                                -24L, -33L, -25L, -31L, -33L, -27L, -33L, -24L, -31L, -27L, -33L,
                                                                                -22L, -27L, -22L, -31L, -28L, -29L, -28L, -27L, -33L, -29L, -25L,
                                                                                -29L, -31L, -30L, -28L, -32L, -23L, -21L, -32L, -30L, -31L, -22L,
                                                                                -30L, -31L, -32L, -30L, -37L, -36L, -28L, -34L, -31L, -33L, -25L,
                                                                                -25L, -32L, -28L, -32L, -32L, -30L, -29L, -29L, -28L, -23L, -32L,
                                                                                -22L, -23L, -24L, -31L, -30L, -27L, -33L, -32L, -32L, -31L, -31L,
                                                                                -29L, -33L, -29L, -18L, -30L, -32L, -21L, -28L, -31L, -33L, -29L,
                                                                                -33L, -31L, -31L, -32L, -30L, -30L, -33L, -22L, -29L, -19L, -33L
                                                                                )), class = "data.frame", row.names = c(NA, -100L))

</code>```

Body:
I'm trying to use the caret function rfe for variable selection. One of the models I would like to use it on is a logistic regression. I'm trying to follow the example here: https://stats.stackexchange.com/questions/37830/how-do-you-get-lmfuncs-functions-of-the-rfe-function-in-caret-to-do-a-logistic-r

From what I've observed in the following models, I can get the rfe function to work with my binary response variable presence when using random forest, GAM or naive Bayes, but both the basic linear model function and my attempt at making a glm logistic regression function don't work when presence is the predictor. However, the basic linear regression works fine when I use a different continuous variable as the predictor. Why would this be?

The error I'm getting is

Error in rbind(deparse.level, ...) :
numbers of columns of arguments do not match

I'm not sure why this would be happening when the input predictors and response come from the same dataframe.

library(caret)

rfcontrol <- rfeControl(functions = rfFuncs, # random forest
                      method = "repeatedcv", # repeated cv
                      repeats = 5, # number of repeats
                      number = 10) # number of folds

out_rf <- rfe(dat[,c(2:6)], dat[,1], sizes = c(1:5), rfeControl = rfcontrol)
#works

nbcontrol <- rfeControl(functions = nbFuncs, # random forest
                        method = "repeatedcv", # repeated cv
                        repeats = 5, # number of repeats
                        number = 10) # number of folds

out_nb <- rfe(dat[,c(2:6)], dat[,1], sizes = c(1:5), rfeControl = nbcontrol)
#works

gamcontrol <- rfeControl(functions = gamFuncs, # random forest
                        method = "repeatedcv", # repeated cv
                        repeats = 5, # number of repeats
                        number = 10) # number of folds

out_gam <- rfe(dat[,c(2:6)], dat[,1], sizes = c(1:5), rfeControl = gamcontrol)
#works

lmcontrol <- rfeControl(functions = gamFuncs, # random forest
                        method = "repeatedcv", # repeated cv
                        repeats = 5, # number of repeats
                        number = 10) # number of folds

out_lm <- rfe(dat[,c(3:6)], dat[,2], sizes = c(1:4), rfeControl = lmcontrol)
#works

out_lm2 <- rfe(dat[,c(2:6)], dat[,1], sizes = c(1:5), rfeControl = lmcontrol)
#doesn't work

glmFuncs <- lmFuncs

glmFuncs$fit=function (x, y, first, last, ...)  {
  tmp <- as.data.frame(x)
  tmp$y <- y
  glm(y ~ ., data = tmp, family=binomial(link='logit'))
}

glmcontrol <- rfeControl(functions = glmFuncs, # random forest
                        method = "repeatedcv", # repeated cv
                        repeats = 5, # number of repeats
                        number = 10) # number of folds

out_glm <- rfe(dat[,c(2:6)], dat[,1], sizes = c(1:5), rfeControl = glmcontrol)
#doesn't work

Here is a sample of the dataset I'm using

dat <- structure(list(presence = structure(c(1L, 1L, 1L, 1L, 1L, 1L,
                                             1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                             1L, 1L, 1L, 1L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                             2L, 1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                             1L, 1L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                             1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), levels = c("FALSE",
                                                                                "TRUE"), class = "factor"), mean_annual_temp = c(-10L, -9L, -6L,
                                                                                -8L, -5L, -13L, -10L, -10L, -12L, -14L, -10L, -9L, -10L, -17L,
                                                                                -10L, -12L, -17L, -11L, -17L, -9L, -13L, -11L, -17L, -10L, -10L,
                                                                                -10L, -12L, -11L, -11L, -10L, -13L, -17L, -12L, -10L, -13L, -12L,
                                                                                -12L, -11L, -15L, -6L, -10L, -14L, -12L, -12L, -5L, -12L, -16L,
                                                                                -16L, -12L, -19L, -19L, -13L, -18L, -12L, -14L, -10L, -9L, -14L,
                                                                                -11L, -15L, -14L, -12L, -11L, -11L, -10L, -6L, -14L, -5L, -6L,
                                                                                -9L, -12L, -11L, -11L, -14L, -16L, -14L, -13L, -14L, -13L, -14L,
                                                                                -13L, -10L, -12L, -13L, -9L, -13L, -13L, -14L, -12L, -17L, -15L,
                                                                                -12L, -15L, -11L, -12L, -14L, -5L, -12L, -5L, -14L), min_temp_coldest_month = c(-33L,
                                                                                -31L, -26L, -32L, -25L, -37L, -36L, -33L, -35L, -35L, -33L, -33L,
                                                                                -32L, -37L, -30L, -36L, -37L, -32L, -38L, -30L, -36L, -32L, -38L,
                                                                                -36L, -32L, -30L, -36L, -32L, -34L, -34L, -32L, -38L, -34L, -30L,
                                                                                -34L, -35L, -35L, -33L, -37L, -27L, -36L, -36L, -35L, -36L, -26L,
                                                                                -35L, -36L, -37L, -36L, -41L, -41L, -34L, -39L, -36L, -39L, -30L,
                                                                                -30L, -38L, -33L, -37L, -38L, -35L, -34L, -34L, -34L, -27L, -38L,
                                                                                -27L, -27L, -30L, -35L, -36L, -33L, -39L, -37L, -37L, -36L, -36L,
                                                                                -34L, -39L, -34L, -31L, -36L, -37L, -31L, -33L, -36L, -38L, -34L,
                                                                                -37L, -36L, -36L, -37L, -36L, -36L, -38L, -27L, -33L, -25L, -38L
                                                                                ), temp_annual_range = c(49L, 49L, 41L, 50L, 39L, 52L, 52L, 48L,
                                                                                50L, 46L, 48L, 50L, 48L, 44L, 42L, 51L, 44L, 47L, 44L, 43L, 52L,
                                                                                44L, 47L, 52L, 48L, 45L, 51L, 47L, 49L, 53L, 43L, 46L, 47L, 42L,
                                                                                46L, 51L, 51L, 47L, 47L, 42L, 52L, 50L, 51L, 52L, 42L, 50L, 43L,
                                                                                45L, 51L, 51L, 48L, 46L, 45L, 52L, 52L, 42L, 47L, 51L, 48L, 47L,
                                                                                52L, 50L, 49L, 49L, 50L, 42L, 52L, 42L, 41L, 47L, 51L, 53L, 49L,
                                                                                52L, 47L, 50L, 52L, 48L, 45L, 52L, 46L, 46L, 52L, 51L, 49L, 45L,
                                                                                51L, 52L, 48L, 45L, 47L, 52L, 47L, 53L, 51L, 52L, 42L, 45L, 39L,
                                                                                51L), mean_temp_wettest_Q = c(7L, 8L, 4L, 9L, 9L, 6L, 8L, 7L,
                                                                                6L, 2L, 7L, 8L, 7L, 0L, 3L, 6L, 0L, 6L, 0L, 5L, 6L, 4L, 0L, 8L,
                                                                                7L, 6L, 6L, 6L, 6L, 8L, 3L, 0L, 5L, 5L, 3L, 6L, 7L, 6L, 2L, 5L,
                                                                                8L, 5L, 6L, 7L, 5L, 6L, 0L, 0L, 6L, 0L, 0L, 4L, 0L, 7L, 4L, 4L,
                                                                                8L, 4L, 6L, 2L, 5L, 6L, 7L, 7L, 8L, 5L, 5L, 5L, 5L, 8L, 6L, 7L,
                                                                                7L, 5L, 1L, 4L, 6L, 4L, 3L, 4L, 3L, 7L, 7L, 6L, 8L, 4L, 6L, 4L,
                                                                                6L, 0L, 2L, 7L, 3L, 7L, 6L, 5L, 5L, 4L, 8L, 5L), mean_temp_driest_Q = c(-28L,
                                                                                -21L, -22L, -26L, -17L, -31L, -22L, -22L, -30L, -30L, -22L, -21L,
                                                                                -24L, -33L, -25L, -31L, -33L, -27L, -33L, -24L, -31L, -27L, -33L,
                                                                                -22L, -27L, -22L, -31L, -28L, -29L, -28L, -27L, -33L, -29L, -25L,
                                                                                -29L, -31L, -30L, -28L, -32L, -23L, -21L, -32L, -30L, -31L, -22L,
                                                                                -30L, -31L, -32L, -30L, -37L, -36L, -28L, -34L, -31L, -33L, -25L,
                                                                                -25L, -32L, -28L, -32L, -32L, -30L, -29L, -29L, -28L, -23L, -32L,
                                                                                -22L, -23L, -24L, -31L, -30L, -27L, -33L, -32L, -32L, -31L, -31L,
                                                                                -29L, -33L, -29L, -18L, -30L, -32L, -21L, -28L, -31L, -33L, -29L,
                                                                                -33L, -31L, -31L, -32L, -30L, -30L, -33L, -22L, -29L, -19L, -33L
                                                                                )), class = "data.frame", row.names = c(NA, -100L))


问:
modules not found by python shell,advice?
Im trying to use python shell to use both python and react simultaniously.

url to project:https://github.com/JonathanDaboush/calender.git

I got this error message

```<code>Compiled with problems:X

ERROR in ./node_modules/python-shell/index.js 35:24-48

Module not found: Error: Can't resolve 'child_process' in 'C:\Users\Jonathan\Documents\calender\node_modules\python-shell'

ERROR in ./node_modules/python-shell/index.js 36:13-26

Module not found: Error: Can't resolve 'os' in 'C:\Users\Jonathan\Documents\calender\node_modules\python-shell'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
    - install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "os": false }

ERROR in ./node_modules/python-shell/index.js 39:13-26

Module not found: Error: Can't resolve 'fs' in

'C:\Users\Jonathan\Documents\calender\node_modules\python-shell'
</code>```

I tried installing said modules but to no avail.
any advice?

Body:
Im trying to use python shell to use both python and react simultaniously.

url to project:https://github.com/JonathanDaboush/calender.git

I got this error message

Compiled with problems:X

ERROR in ./node_modules/python-shell/index.js 35:24-48

Module not found: Error: Can't resolve 'child_process' in 'C:\Users\Jonathan\Documents\calender\node_modules\python-shell'

ERROR in ./node_modules/python-shell/index.js 36:13-26

Module not found: Error: Can't resolve 'os' in 'C:\Users\Jonathan\Documents\calender\node_modules\python-shell'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
    - add a fallback 'resolve.fallback: { "os": require.resolve("os-browserify/browser") }'
    - install 'os-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
    resolve.fallback: { "os": false }

ERROR in ./node_modules/python-shell/index.js 39:13-26

Module not found: Error: Can't resolve 'fs' in

'C:\Users\Jonathan\Documents\calender\node_modules\python-shell'

I tried installing said modules but to no avail.
any advice?


问:
Webpack - Source maps intermittently providing typescript locations
I've recently taken over an issue with a full stack application which is SSR React and returning the HTML string to the client via a node lambda handler function, all written in Typescript. This app is being bundled using Webpack and I've been tasked with tidying the config up and sorting any issues out. The Webpack has three configurations (believe me when I say it was worse beforehand!): One for the node lambda, one for the client (bundling the js) and one which has shared config for the two of them. Below are the configs for each:

const handlerConfig = {
  target: "node",
  entry: "./src/lambda/index.tsx",
  output: {
    path: path.resolve("dist", "lambda"),
    filename: "index.js",
    library: "index",
    libraryTarget: "umd",
  },
  devtool: "inline-source-map",
};

const clientConfig = {
  target: "web",
  entry: { client: "./src/client/index.tsx" },
  output: {
    path: path.resolve("dist", "assets"),
    filename: "[name].[contenthash].bundle.js",
    publicPath: ASSET_PATH,
  },
  plugins: [
    new webpack.DefinePlugin({
      "process.env.ASSET_PATH": JSON.stringify(ASSET_PATH),
    }),
    new WebpackManifestPlugin({
      fileName: "../manifest.json",
      map: (fileDescriptor) => {
        fileDescriptor.name = fileDescriptor.path;
        return fileDescriptor;
      },
    }),
  ],
};

const commonConfig = {
  module: {
    rules: [
      {
        test: [/\.js$/],
        enforce: "pre",
        use: ["source-map-loader"],
      },
      {
        test: /\.ts(x?)$/,
        exclude: /node_modules/,
        use: [
          {
            loader: "babel-loader",
            options: {
              presets: [
                "@babel/preset-react",
                "@babel/preset-env",
                "@babel/preset-typescript",
              ],
              plugins: [
                "@babel/plugin-transform-runtime",
                ["babel-plugin-styled-components", { ssr: true }],
              ],
            },
          },
          {
            loader: "ts-loader",
          },
        ],
      },
      {
        test: /\.m?js$/,
        exclude: /node_modules/,
        use: [
          {
            loader: "babel-loader",
            options: {
              presets: ["@babel/preset-react", "@babel/preset-env"],
              plugins: ["@babel/plugin-transform-runtime"],
            },
          },
        ],
      },
    ],
  },
  resolve: {
    extensions: [".ts", ".tsx", ".js", ".jsx", ".json"],
  },
};

module.exports = [
  merge(commonConfig, handlerConfig),
  merge(commonConfig, clientConfig),
];

```
<p>The issue I'm having is getting the source maps to actually work. More often than not, the source maps are not being used - I'm just getting stack traces with references to the bundle rather than the Typescript used to generate it.</p>
<p>I've tried different source map outputs in the Webpack config, both <code>ts-loader</code> and <code>babel-loader</code> individually, I've been through the docs for all 3 and I'm just stumped. The only way I can get it to work consistently is by installing and importing the <code>source-map-support</code> module in to the handler file, otherwise I have had it providing Typescript references, but this appears to be intermittent and I can not pin down a reason why. <code>source-map-support</code> is something we'd like to avoid using if possible, so the question remains as to why I can't get this to work just using the Webpack generated source maps. Is there something glaringly obvious that I've missed?</p>
<p>Adding the tsconfig.json in case this is feeding in to the issue:</p>
<pre class="lang-json prettyprint-override"><code>{
  "compilerOptions": {
    "target": "ES2017",
    "lib": [
      "es5",
      "es6",
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "strictPropertyInitialization": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "noEmit": false,
    "esModuleInterop": true,
    "declaration": false,
    "allowSyntheticDefaultImports": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "useUnknownInCatchVariables": false,
    "jsx": "react",
    "sourceMap": true,
    "plugins": [
      {
        "transform": "ts-auto-mock/transformer",
        "cacheBetweenTests": false
      }
    ]
  },
  "types": [
    "node",
    "react",
    "jest",
    "@testing-library/jest-dom",
    "@types/testing-library__jest-dom"
  ],
  "include": [
    "src/**/*",
    "@types/jest-dom.d.ts",
    "setUpTests.ts",
    "**/*.css",
    "**/*.ts",
    "**/*.tsx"
  ],
  "exclude": ["node_modules", "dist*", "dist", "**/dist/*", "**/node_modules/*"]
}

</code>```

Body:
I've recently taken over an issue with a full stack application which is SSR React and returning the HTML string to the client via a node lambda handler function, all written in Typescript. This app is being bundled using Webpack and I've been tasked with tidying the config up and sorting any issues out. The Webpack has three configurations (believe me when I say it was worse beforehand!): One for the node lambda, one for the client (bundling the js) and one which has shared config for the two of them. Below are the configs for each:

const handlerConfig = {
  target: "node",
  entry: "./src/lambda/index.tsx",
  output: {
    path: path.resolve("dist", "lambda"),
    filename: "index.js",
    library: "index",
    libraryTarget: "umd",
  },
  devtool: "inline-source-map",
};

const clientConfig = {
  target: "web",
  entry: { client: "./src/client/index.tsx" },
  output: {
    path: path.resolve("dist", "assets"),
    filename: "[name].[contenthash].bundle.js",
    publicPath: ASSET_PATH,
  },
  plugins: [
    new webpack.DefinePlugin({
      "process.env.ASSET_PATH": JSON.stringify(ASSET_PATH),
    }),
    new WebpackManifestPlugin({
      fileName: "../manifest.json",
      map: (fileDescriptor) => {
        fileDescriptor.name = fileDescriptor.path;
        return fileDescriptor;
      },
    }),
  ],
};

const commonConfig = {
  module: {
    rules: [
      {
        test: [/\.js$/],
        enforce: "pre",
        use: ["source-map-loader"],
      },
      {
        test: /\.ts(x?)$/,
        exclude: /node_modules/,
        use: [
          {
            loader: "babel-loader",
            options: {
              presets: [
                "@babel/preset-react",
                "@babel/preset-env",
                "@babel/preset-typescript",
              ],
              plugins: [
                "@babel/plugin-transform-runtime",
                ["babel-plugin-styled-components", { ssr: true }],
              ],
            },
          },
          {
            loader: "ts-loader",
          },
        ],
      },
      {
        test: /\.m?js$/,
        exclude: /node_modules/,
        use: [
          {
            loader: "babel-loader",
            options: {
              presets: ["@babel/preset-react", "@babel/preset-env"],
              plugins: ["@babel/plugin-transform-runtime"],
            },
          },
        ],
      },
    ],
  },
  resolve: {
    extensions: [".ts", ".tsx", ".js", ".jsx", ".json"],
  },
};

module.exports = [
  merge(commonConfig, handlerConfig),
  merge(commonConfig, clientConfig),
];

The issue I'm having is getting the source maps to actually work. More often than not, the source maps are not being used - I'm just getting stack traces with references to the bundle rather than the Typescript used to generate it.

I've tried different source map outputs in the Webpack config, both ts-loader and babel-loader individually, I've been through the docs for all 3 and I'm just stumped. The only way I can get it to work consistently is by installing and importing the source-map-support module in to the handler file, otherwise I have had it providing Typescript references, but this appears to be intermittent and I can not pin down a reason why. source-map-support is something we'd like to avoid using if possible, so the question remains as to why I can't get this to work just using the Webpack generated source maps. Is there something glaringly obvious that I've missed?

Adding the tsconfig.json in case this is feeding in to the issue:

{
  "compilerOptions": {
    "target": "ES2017",
    "lib": [
      "es5",
      "es6",
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "strictPropertyInitialization": true,
    "strictBindCallApply": true,
    "noImplicitThis": true,
    "noImplicitReturns": true,
    "alwaysStrict": true,
    "noEmit": false,
    "esModuleInterop": true,
    "declaration": false,
    "allowSyntheticDefaultImports": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "useUnknownInCatchVariables": false,
    "jsx": "react",
    "sourceMap": true,
    "plugins": [
      {
        "transform": "ts-auto-mock/transformer",
        "cacheBetweenTests": false
      }
    ]
  },
  "types": [
    "node",
    "react",
    "jest",
    "@testing-library/jest-dom",
    "@types/testing-library__jest-dom"
  ],
  "include": [
    "src/**/*",
    "@types/jest-dom.d.ts",
    "setUpTests.ts",
    "**/*.css",
    "**/*.ts",
    "**/*.tsx"
  ],
  "exclude": ["node_modules", "dist*", "dist", "**/dist/*", "**/node_modules/*"]
}


问:
How to bring network_delegate to StdErr in wshell or vba?
If I run chrome from CMD I am able to retrieve OAuth2 code, but when I run via VBA / wscript the network_delegate lines which contain the code are absent.

Running this from VBA leaves out network_delegate lines and I have not been able to find a way to bring them in.  Pasting chrome & Web_URL into CMD - the lines show up in CMD.

To reproduce: close any open Chrome windows and then close Chrome for sub to end.

```<code>Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal Milliseconds As LongPtr)
Sub chromeLog()

Dim Web_URL As String, chrome As String

Web_URL = """https://www.google.com"""
chrome = """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"" --profile-directory=""Profile 1"" --enable-logging=stderr --v=1 "

sCmd = Environ$("COMSPEC") & " /s /c """ & chrome & Web_URL & """"

Set wShell = CreateObject("wscript.shell")
Set d = CreateObject("Scripting.Dictionary")

Set wsx = wShell.Exec(sCmd)
Set wsxOut = wsx.StdErr

DoEvents
Do: Sleep 1000

Do Until wsxOut.AtEndOfStream
    'If InStr(wsxOut.ReadLine, "network_delegate") > 0 Then
        d(d.Count) = wsxOut.ReadLine
    'End If
Loop
Loop Until wsx.Status <> 0 And wsxOut.AtEndOfStream

arLines = d.items()

Debug.Print d.Count

For Each iten In d.keys
    Debug.Print iten, d(iten)
    'Cells(iten + 1, 1).Value2 = d(iten)
Next

Set wShell = Nothing: Set wsx = Nothing: Set wsxOut = Nothing

End Sub

</code>```

Body:
If I run chrome from CMD I am able to retrieve OAuth2 code, but when I run via VBA / wscript the network_delegate lines which contain the code are absent.

Running this from VBA leaves out network_delegate lines and I have not been able to find a way to bring them in.  Pasting chrome & Web_URL into CMD - the lines show up in CMD.

To reproduce: close any open Chrome windows and then close Chrome for sub to end.

Public Declare PtrSafe Sub Sleep Lib "kernel32" (ByVal Milliseconds As LongPtr)
Sub chromeLog()

Dim Web_URL As String, chrome As String

Web_URL = """https://www.google.com"""
chrome = """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"" --profile-directory=""Profile 1"" --enable-logging=stderr --v=1 "

sCmd = Environ$("COMSPEC") & " /s /c """ & chrome & Web_URL & """"

Set wShell = CreateObject("wscript.shell")
Set d = CreateObject("Scripting.Dictionary")

Set wsx = wShell.Exec(sCmd)
Set wsxOut = wsx.StdErr

DoEvents
Do: Sleep 1000

Do Until wsxOut.AtEndOfStream
    'If InStr(wsxOut.ReadLine, "network_delegate") > 0 Then
        d(d.Count) = wsxOut.ReadLine
    'End If
Loop
Loop Until wsx.Status <> 0 And wsxOut.AtEndOfStream

arLines = d.items()

Debug.Print d.Count

For Each iten In d.keys
    Debug.Print iten, d(iten)
    'Cells(iten + 1, 1).Value2 = d(iten)
Next

Set wShell = Nothing: Set wsx = Nothing: Set wsxOut = Nothing

End Sub


问:
Create an image from a volume snapshot using terraform
We're using actions-runner-controller to deploy self-hosted runners as pods in GKE for github actions. Everything is specified in terraform including the GKE cluster that backs the runners.

The pods are managed by stateful sets so that we can mount a volume snapshot, which is a cache of stuff that jobs might need, e.g. common actions, cli tools etc.

We’re hitting rate limits in relation to snapshot creation (RESOURCE_OPERATION_RATE_EXCEEDED). It seems that we’re attempting to create a snapshot for each CI job that runs, whereas we should be creating an image from a snapshot and creating a persistent volume from that.

However, it's not clear to me how this can be done in terraform.

I'm not sure if it's relevant but we're using Node Auto Provisioning to provision the nodes on which the pods run.

Any guidance would be appreciated...


问:
Gulp isn't running and I don't know why
I am using gulp in a wordpress theme and I keep getting this error about something not being a function inside the gulp-cli folder.

```<code>  gulpInst.on('start', function(evt) {
           ^

TypeError: gulpInst.on is not a function
</code>```

Here is my gulpfile.js

```<code>const { src, dest, watch, series } = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const postcss = require('gulp-postcss');
const cssnano = require('cssnano');
const terser = require('gulp-terser');

// SASS Task
function scssTask() {
    return src(['assets/sass/*.scss', 'assets/sass/**/*.scss'], { sourcemaps: true })
    .pipe(sass())
    .pipe(postcss([cssnano()]))
    .pipe(dest('assets/css', {sourcemaps: '.' }));
}

// JavaScript Task
function jsTask() {
    return src('assets/js/*.js', { sourcemaps: true })
    .pipe(terser())
    .pipe(dest('dist/js', { sourcemaps: '.' }));
}

// Watch Task
function watchTask() {
    watch('*.php');
    watch(['assets/sass/**/*.scss', 'assets/js/*.js'], series(scssTask, jsTask));
}

// Default Gulp Task
exports.default = series(
    scssTask,
    jsTask,
    watchTask
);
</code>```

I have already tried uninstalling gulp and reinstalling it but nothing is fixing this error. Any idea how to fix this?

Title: Gulp isn't running and I don't know why

Body:
I am using gulp in a wordpress theme and I keep getting this error about something not being a function inside the gulp-cli folder.

  gulpInst.on('start', function(evt) {
           ^

TypeError: gulpInst.on is not a function

Here is my gulpfile.js

const { src, dest, watch, series } = require('gulp');
const sass = require('gulp-sass')(require('sass'));
const postcss = require('gulp-postcss');
const cssnano = require('cssnano');
const terser = require('gulp-terser');

// SASS Task
function scssTask() {
    return src(['assets/sass/*.scss', 'assets/sass/**/*.scss'], { sourcemaps: true })
    .pipe(sass())
    .pipe(postcss([cssnano()]))
    .pipe(dest('assets/css', {sourcemaps: '.' }));
}

// JavaScript Task
function jsTask() {
    return src('assets/js/*.js', { sourcemaps: true })
    .pipe(terser())
    .pipe(dest('dist/js', { sourcemaps: '.' }));
}

// Watch Task
function watchTask() {
    watch('*.php');
    watch(['assets/sass/**/*.scss', 'assets/js/*.js'], series(scssTask, jsTask));
}

// Default Gulp Task
exports.default = series(
    scssTask,
    jsTask,
    watchTask
);

I have already tried uninstalling gulp and reinstalling it but nothing is fixing this error. Any idea how to fix this?


问:
Eclipse error "JAX-RS (REST Web Services) 2.1 can not be installed" / "...requires Java 1.8 or newer"
When I try to build one of the modules within our application I keep getting two errors related to JAX-RS showing up in the "Problems"-view:

```<code>JAX-RS (REST Web Services) 2.1 can not be installed : One or more constraints have not been satisfied.
JAX-RS (REST Web Services) 2.1 requires Java 1.8 or newer.
</code>```

The module that causes this error is the web-interface of a GWT (Google Web Toolkit) project that still uses GWT 2.7 which indeed requires Java 1.7 code. While we do compile using Java 1.8 we have set the compiler version (just for that GWT module) like so:

```<code>            ...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            ...
</code>```

What I don't get here is:

Why does JAX-RS interfere or come into play here at all?
That project (or maven "module") has neither a "Dynamic Web Module" facet nor a "JAX-RS (REST Web Service)"-facet. It also has no GWT-related facet, since the GWT plugin doesn't work anymore with the latest eclipse version.

Any idea anyone, where this JAX-RS error comes from? Or how to find out, what is causing this?

This is using the very latest Eclipse version as of today (Eclipse for WebDevelopers / v2022-12) freshly downloaded and installed and the projects imported into it.

Body:
When I try to build one of the modules within our application I keep getting two errors related to JAX-RS showing up in the "Problems"-view:

JAX-RS (REST Web Services) 2.1 can not be installed : One or more constraints have not been satisfied.
JAX-RS (REST Web Services) 2.1 requires Java 1.8 or newer.

The module that causes this error is the web-interface of a GWT (Google Web Toolkit) project that still uses GWT 2.7 which indeed requires Java 1.7 code. While we do compile using Java 1.8 we have set the compiler version (just for that GWT module) like so:

            ...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            ...

What I don't get here is:

Why does JAX-RS interfere or come into play here at all?
That project (or maven "module") has neither a "Dynamic Web Module" facet nor a "JAX-RS (REST Web Service)"-facet. It also has no GWT-related facet, since the GWT plugin doesn't work anymore with the latest eclipse version.

Any idea anyone, where this JAX-RS error comes from? Or how to find out, what is causing this?

This is using the very latest Eclipse version as of today (Eclipse for WebDevelopers / v2022-12) freshly downloaded and installed and the projects imported into it.


问:
Tesseract for web input
I'm writing an application that reads data from a touch-screen (web app), and need to convert it to single digits, 0 - 9. Not sure if I'll be doing it one digit at a time or multiple digits. Is Tesseract the best solution?</p>

Title: Tesseract for web input


问:
Post identity Form with Razor Page
i create the  Identity form with razor Page but when click the Button nothing happin its just tell me
This page isn’t workingIf the problem continues, contact the site owner.
HTTP ERROR 400. this mistake its from browser i already know the browser its can't reach the Page but i don't know why

Best Regards

the Razor Page Code

```<code>namespace AuthuntecationPractice.Pages.Account
{
    public class RegisterModel : PageModel
    {
        private readonly UserManager<IdentityUser> _userManger;
        public RegisterModel(UserManager<IdentityUser> userManger)
        {
            _userManger = userManger;
        }

        [BindProperty]
        public RegisterVm RegisterVm { get; set; }
        public void OnGet()
        {

        }

        public async Task<IActionResult> OnPost()
        {
            if (!ModelState.IsValid) return Page();
            //Validation Email Address
            var vm = new IdentityUser()
            {
               Email = RegisterVm.EmailAddress,
               UserName = RegisterVm.EmailAddress
            };

            var user = await _userManger.CreateAsync(vm, RegisterVm.Password);
            if (user.Succeeded)
            {
                RedirectToPage("/Account/Login");
            }
            else
            {
                ModelState.AddModelError("error", "Plase review your informations");
            }

            return Page();
        }

    }

    public class RegisterVm
    {

        [Required]
        [EmailAddress(ErrorMessage = "invalid Email")]
        public string EmailAddress { get; set; }

        [Required]
        [DataType(DataType.Password)]
        public string Password { get; set; }

    }
}

</code>```

the form

```<code>@page
@model AuthuntecationPractice.Pages.Account.RegisterModel
@{
    Layout = "_Layout";
}

<div class="row">
    <div class="col-md-6 offset-3">
        <p>
            <h4>Sgin up to your account</h4>
        </p>

        <div class="row">
            <div class="col-md-8 offset-2">
                <form method="post">
                    <div asp-validation-summary="All" class="text-danger"></div>

                    <div class="form-group">
                        <label asp-for="RegisterVm.EmailAddress" class="control-label"></label>
                        <input asp-for="RegisterVm.EmailAddress" type="email" class="form-control" />
                        <span asp-validation-for="RegisterVm.EmailAddress" class="text-danger"></span>
                    </div>
                    <div class="form-group">
                        <label asp-for="RegisterVm.Password" class="control-label"></label>
                        <input asp-for="RegisterVm.Password" class="form-control" />
                        <span asp-validation-for="RegisterVm.Password" class="text-danger"></span>
                    </div>

                    <div class="form-group">
                 <input class="btn btn-outline-success float-right" type="submit" value="Sign up"/>

                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

</code>```

Title: Post identity Form with Razor Page

Body:
i create the  Identity form with razor Page but when click the Button nothing happin its just tell me
This page isn’t workingIf the problem continues, contact the site owner.
HTTP ERROR 400. this mistake its from browser i already know the browser its can't reach the Page but i don't know why

Best Regards

the Razor Page Code

namespace AuthuntecationPractice.Pages.Account
{
    public class RegisterModel : PageModel
    {
        private readonly UserManager<IdentityUser> _userManger;
        public RegisterModel(UserManager<IdentityUser> userManger)
        {
            _userManger = userManger;
        }

        [BindProperty]
        public RegisterVm RegisterVm { get; set; }
        public void OnGet()
        {

        }

        public async Task<IActionResult> OnPost()
        {
            if (!ModelState.IsValid) return Page();
            //Validation Email Address
            var vm = new IdentityUser()
            {
               Email = RegisterVm.EmailAddress,
               UserName = RegisterVm.EmailAddress
            };

            var user = await _userManger.CreateAsync(vm, RegisterVm.Password);
            if (user.Succeeded)
            {
                RedirectToPage("/Account/Login");
            }
            else
            {
                ModelState.AddModelError("error", "Plase review your informations");
            }

            return Page();
        }

    }

    public class RegisterVm
    {

        [Required]
        [EmailAddress(ErrorMessage = "invalid Email")]
        public string EmailAddress { get; set; }

        [Required]
        [DataType(DataType.Password)]
        public string Password { get; set; }

    }
}

the form

@page
@model AuthuntecationPractice.Pages.Account.RegisterModel
@{
    Layout = "_Layout";
}

Sgin up to your account

                <form method="post">

                        <input asp-for="RegisterVm.EmailAddress" type="email" class="form-control" />

                        <input asp-for="RegisterVm.Password" class="form-control" />

                 <input class="btn btn-outline-success float-right" type="submit" value="Sign up"/>

                </form>


问:
Click on certain pixel of Canvas using Selenium
I'm starting with selenium and I found the problem. I have a canva with some "hot points". For example I have canvas 230x230. My "hot point" is 4,144. I want click on this point on this canvas. Basically I want to click on cordinates 4,144 on canvas.

So I found a function move to element with offset. But nothing is clicked right now. What is wrong with my code?:

```<code>   from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    from selenium.webdriver.common.by import By
    from selenium.webdriver.common.action_chains import ActionChains
    import time
    webdriver_path = "****"
    driver = webdriver.Chrome(webdriver_path)
    path= "https://www.google.com"
    driver.get(path)
    element = driver.find_element(By.XPATH, '/html/body/div/div[2]/div[3]/div[2]/div[2]/div/canvas')
    action = ActionChains(driver)
    action.move_to_element_with_offset(element,4,144).click().perform()
</code>```

Body:
I'm starting with selenium and I found the problem. I have a canva with some "hot points". For example I have canvas 230x230. My "hot point" is 4,144. I want click on this point on this canvas. Basically I want to click on cordinates 4,144 on canvas.

So I found a function move to element with offset. But nothing is clicked right now. What is wrong with my code?:

   from selenium import webdriver
    from selenium.webdriver.common.keys import Keys
    from selenium.webdriver.common.by import By
    from selenium.webdriver.common.action_chains import ActionChains
    import time
    webdriver_path = "****"
    driver = webdriver.Chrome(webdriver_path)
    path= "https://www.google.com"
    driver.get(path)
    element = driver.find_element(By.XPATH, '/html/body/div/div[2]/div[3]/div[2]/div[2]/div/canvas')
    action = ActionChains(driver)
    action.move_to_element_with_offset(element,4,144).click().perform()


问:
Cannot access to Mongo Express webpage running by docker-compose, but it is running on docker desktop?
I am trying to use MongoDB and Mongo Express, but now I am having trouble to connect to Mongo Express.

So when I go to the localhost:4301

In Docker Desktop:

My application.yaml:

```<code>spring:
  data:
    mongodb:
      database: redo_report
      uri: mongodb://root:root@localhost:27018/redo_report?authSource=admin
      username: root
      password: root
  liquibase:
    change-log: classpath:db/changelog/db.changelog-master.xml
  kafka:
    bootstrap-servers: http://redo-kafka:9092
    consumer:
      auto-offset-reset: earliest
      group-id: redo_report_group
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
redo-notes-link: https://localhost/app/view/
redo-version: v0.1 (2022.10.28)
application:
  kafka-topics:
    doc-events: doc.events

</code>```

My docker-compose.yml

```<code>spring:
  data:
    mongodb:
      database: redo_report
      uri: mongodb://root:root@localhost:27018/redo_report?authSource=admin
      username: root
      password: root
  liquibase:
    change-log: classpath:db/changelog/db.changelog-master.xml
  kafka:
    bootstrap-servers: http://redo-kafka:9092
    consumer:
      auto-offset-reset: earliest
      group-id: redo_report_group
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
redo-notes-link: https://localhost/app/view/
redo-version: v0.1 (2022.10.28)
application:
  kafka-topics:
    doc-events: doc.events
</code>```

Body:
I am trying to use MongoDB and Mongo Express, but now I am having trouble to connect to Mongo Express.

So when I go to the localhost:4301

In Docker Desktop:

My application.yaml:

spring:
  data:
    mongodb:
      database: redo_report
      uri: mongodb://root:root@localhost:27018/redo_report?authSource=admin
      username: root
      password: root
  liquibase:
    change-log: classpath:db/changelog/db.changelog-master.xml
  kafka:
    bootstrap-servers: http://redo-kafka:9092
    consumer:
      auto-offset-reset: earliest
      group-id: redo_report_group
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
redo-notes-link: https://localhost/app/view/
redo-version: v0.1 (2022.10.28)
application:
  kafka-topics:
    doc-events: doc.events

My docker-compose.yml

spring:
  data:
    mongodb:
      database: redo_report
      uri: mongodb://root:root@localhost:27018/redo_report?authSource=admin
      username: root
      password: root
  liquibase:
    change-log: classpath:db/changelog/db.changelog-master.xml
  kafka:
    bootstrap-servers: http://redo-kafka:9092
    consumer:
      auto-offset-reset: earliest
      group-id: redo_report_group
      key-deserializer: org.apache.kafka.common.serialization.StringDeserializer
      value-deserializer: org.apache.kafka.common.serialization.StringDeserializer
redo-notes-link: https://localhost/app/view/
redo-version: v0.1 (2022.10.28)
application:
  kafka-topics:
    doc-events: doc.events


问:
Error: Could not find a version that satisfies the requirement dawdreamer (from version: none)
Doing:

```<code>pip install dawdreamer
</code>```

on my Windows 10 machine with Python 3.9.0 gives me:

```<code>ERROR: Could not find a version that satisfies the requirement dawdreamer (from version: none)
ERROR: No matching distribution found for dawdreamer
</code>```

This doesn't happen for any other package, and when I downloaded the dawdreamer-0.6.9-cp39-cp39-win_amd64.whl wheel from pypi.org/simple/dawdreamer and tried pip install path/to/wheel, I get:

```<code>ERROR: dawdreamer-0.6.9-cp39-cp39-win_amd64.whl is not a supported wheel on this platform
</code>```

What is the problem? Thanks.

Body:
Doing:

pip install dawdreamer

on my Windows 10 machine with Python 3.9.0 gives me:

ERROR: Could not find a version that satisfies the requirement dawdreamer (from version: none)
ERROR: No matching distribution found for dawdreamer

This doesn't happen for any other package, and when I downloaded the dawdreamer-0.6.9-cp39-cp39-win_amd64.whl wheel from pypi.org/simple/dawdreamer and tried pip install path/to/wheel, I get:

ERROR: dawdreamer-0.6.9-cp39-cp39-win_amd64.whl is not a supported wheel on this platform

What is the problem? Thanks.


问:
Find the smallest 4 points of data using python
I have data in a text files contain two columns x and y. I know that this data have 4 extreme minimum local points.

I used this code to get them. The problem is that my code gives me all minimum point which are 23 point and can't define the extreme minimum point as shown as in the attached figure

```<code>import numpy as np
import glob
import pandas as pd
from scipy.signal import argrelextrema
import matplotlib.pyplot as plt

Path = "input/*.txt"
input_files = glob.glob(Path)
for file_name in input_files:
    df = pd.read_csv(file_name, header=None, delimiter="\t")
    x = df[0]
    y = df[1]

    minima_indices = argrelextrema(np.array(y), np.less)[0]

    minima_x = x[minima_indices]
    minima_y = y[minima_indices]

    plt.plot(x,y)
    plt.plot(minima_x,minima_y, "x",markersize = 5)
</code>```

enter image description here

My target is to mark the 4 extreme minimum points and save them as a text file. Could you help me please?

Body:
I have data in a text files contain two columns x and y. I know that this data have 4 extreme minimum local points.

I used this code to get them. The problem is that my code gives me all minimum point which are 23 point and can't define the extreme minimum point as shown as in the attached figure

import numpy as np
import glob
import pandas as pd
from scipy.signal import argrelextrema
import matplotlib.pyplot as plt

Path = "input/*.txt"
input_files = glob.glob(Path)
for file_name in input_files:
    df = pd.read_csv(file_name, header=None, delimiter="\t")
    x = df[0]
    y = df[1]

    minima_indices = argrelextrema(np.array(y), np.less)[0]

    minima_x = x[minima_indices]
    minima_y = y[minima_indices]

    plt.plot(x,y)
    plt.plot(minima_x,minima_y, "x",markersize = 5)

enter image description here

My target is to mark the 4 extreme minimum points and save them as a text file. Could you help me please?


问:
Classroom API: unable to update MULTIPLE_CHOICE_QUESTION options
Classroom API provides patch method to update specific fields of CourseWork using updateMask request param with list of comma separated FieldMask, that identifies which fields on the course work to update - https://developers.google.com/classroom/reference/rest/v1/courses.courseWork/patch.

For MULTIPLE_CHOICE_QUESTION work type we have answers options that can be added during create request, like this: multipleChoiceQuestion choices. But I can't find any FieldMask for this field or any other ability to update this options for already created MultipleChoice WorkType.

Is there any way to update these options?

multipleChoiceQuestion, choices or multipleChoiceQuestion.choices FieldMask in patch request not working
multiple choice update error


问:
C# Higher-order function to reverse the order of arguments
I am reading the book Functional Programming in C# by Enrico Buonanno (great book).

There is one example for swapping the order of arguments, namely:

```<code>static Func<T2, T1, R>
     SwapArgs<T1, T2, R>(this Func<T1, T2, R> f) => (t2, t1) => f(t1, t2);
</code>```

Can someone please explain why is the => used twice? For example, a function for diving would be written as

Func<int, int, int> divide = (x,y) => x / y;

The order is: function name followed by = followed by arguments followed by => followed by the function body.
That is what is confusing me, in the SwapArgs we don't have = we have twice =>.

Could someone please clarify this?

Body:
I am reading the book Functional Programming in C# by Enrico Buonanno (great book).

There is one example for swapping the order of arguments, namely:

static Func<T2, T1, R>
     SwapArgs<T1, T2, R>(this Func<T1, T2, R> f) => (t2, t1) => f(t1, t2);

Can someone please explain why is the => used twice? For example, a function for diving would be written as

Func<int, int, int> divide = (x,y) => x / y;

The order is: function name followed by = followed by arguments followed by => followed by the function body.
That is what is confusing me, in the SwapArgs we don't have = we have twice =>.

Could someone please clarify this?


问:
Broken labels in eclipse in darkmode
As soon as I start using dark mode in eclipse my labels get weird names:

when I go back to light mode everything is normal

I am using an older version of eclipse

Please help, and save my eyes :|

Title: Broken labels in eclipse in darkmode


问:
onWillAccept: (data) and onAccept: (data) only has String as data
I specified that the data of the Draggable is final Map<FoodAttributes, bool>.

However, when I then try to work with the data of the
Draggable once it's dropped on the DragTarget, the compiler tells me that data is of type String?

Here are the relevant code-snippets:

```<code>child: DragTarget<String>(
builder: (context, candidateData, rejectedData) {
return Container(
width: 300,
height: 300,
alignment: Alignment.center,
child: Image.asset('assets/images/Doggo3.png'),
);
},
onWillAccept: (data) {
return true;
},
onAccept: (data) {
           //data is of type String, even though in
           //the draggable it is not specified as such.
},
),

class FoodWidget extends StatelessWidget {
  final Image image;
  final Map<FoodAttributes, bool> foodAttribute;
  const FoodWidget(
      {super.key, required this.image, required this.foodAttribute});

  @override
  Widget build(BuildContext context) {
    return Draggable(
      data: foodAttribute,
      feedback:
          SizedBox(height: 90.0, width: 90.0, child: Center(child: image)),
      child: SizedBox(
        height: 90.0,
        width: 90.0,
        child: Center(
          child: image,
        ),
      ),
    );
  }
}

</code>```

Body:
I specified that the data of the Draggable is final Map<FoodAttributes, bool>.

However, when I then try to work with the data of the
Draggable once it's dropped on the DragTarget, the compiler tells me that data is of type String?

Here are the relevant code-snippets:

child: DragTarget<String>(
builder: (context, candidateData, rejectedData) {
return Container(
width: 300,
height: 300,
alignment: Alignment.center,
child: Image.asset('assets/images/Doggo3.png'),
);
},
onWillAccept: (data) {
return true;
},
onAccept: (data) {
           //data is of type String, even though in
           //the draggable it is not specified as such.
},
),

class FoodWidget extends StatelessWidget {
  final Image image;
  final Map<FoodAttributes, bool> foodAttribute;
  const FoodWidget(
      {super.key, required this.image, required this.foodAttribute});

  @override
  Widget build(BuildContext context) {
    return Draggable(
      data: foodAttribute,
      feedback:
          SizedBox(height: 90.0, width: 90.0, child: Center(child: image)),
      child: SizedBox(
        height: 90.0,
        width: 90.0,
        child: Center(
          child: image,
        ),
      ),
    );
  }
}


问:
Upload FIle in OneDrive with python
I've tried to upload a file in OneDrive with python but I can't do it.

Here is an example of my code

```<code>import adal
import json

AUTHORITY_URL = 'https://login.microsoftonline.com/{}'.format('TENANT-ID')
CLIENT_ID = 'Client ID'
CLIENT_SECRET = 'Client Secret'
RESOURCE = 'https://graph.microsoft.com/'

context = adal.AuthenticationContext(AUTHORITY_URL)
token = context.acquire_token_with_client_credentials(RESOURCE, CLIENT_ID, CLIENT_SECRET)

print(json.dumps(token, indent=2))
#### To this pont its everithing ok, the code generates a token

import requests

# the url to upload the file direct to the root
url = "https://graph.microsoft.com/v1.0/me/drive/root/children/Texto.txt/content"

# name of the file to be uploaded
file_path = "Texto.txt"

headers = {"Authorization": "Bearer " + token["accessToken"]}

# Open the txt file and try to put in One drive but i get <Response [400]> and nothing happend
with open(file_path, "rb") as f:
    content = f.read()

response = requests.put(url, data=content, headers=headers)

response
</code>```

I think the fist par when the token is generate its ok, but I don't know woh to continue.

With print(response.text)

```<code>'{"error":{"code":"BadRequest","message":"/me request is only valid with delegated authentication flow.","innerError":{"date":"2023-01-11T16:20:30","request-id":"ed0baf5e-07fe-45cc-af3d-d688f11ee725","client-request-id":"ed0baf5e-07fe-45cc-af3d-d688f11ee725"}}}'
</code>```

thanks for the help!!

Title: Upload FIle in OneDrive with python

Body:
I've tried to upload a file in OneDrive with python but I can't do it.

Here is an example of my code

import adal
import json

AUTHORITY_URL = 'https://login.microsoftonline.com/{}'.format('TENANT-ID')
CLIENT_ID = 'Client ID'
CLIENT_SECRET = 'Client Secret'
RESOURCE = 'https://graph.microsoft.com/'

context = adal.AuthenticationContext(AUTHORITY_URL)
token = context.acquire_token_with_client_credentials(RESOURCE, CLIENT_ID, CLIENT_SECRET)

print(json.dumps(token, indent=2))
#### To this pont its everithing ok, the code generates a token

import requests

# the url to upload the file direct to the root
url = "https://graph.microsoft.com/v1.0/me/drive/root/children/Texto.txt/content"

# name of the file to be uploaded
file_path = "Texto.txt"

headers = {"Authorization": "Bearer " + token["accessToken"]}

# Open the txt file and try to put in One drive but i get <Response [400]> and nothing happend
with open(file_path, "rb") as f:
    content = f.read()

response = requests.put(url, data=content, headers=headers)

response

I think the fist par when the token is generate its ok, but I don't know woh to continue.

With print(response.text)

'{"error":{"code":"BadRequest","message":"/me request is only valid with delegated authentication flow.","innerError":{"date":"2023-01-11T16:20:30","request-id":"ed0baf5e-07fe-45cc-af3d-d688f11ee725","client-request-id":"ed0baf5e-07fe-45cc-af3d-d688f11ee725"}}}'

thanks for the help!!


问:
Problem with a Regular Expression in Python
I have a text file with some phrases and some dirt (numbers) that I need to clean.
I wrote the following regular expression in Python 3.8 to do that:

regex = '[^(\d*:?\d*)](\d{2,8}.*$)|[?).](\d{2,8}.*$)'

this part [^(\d*:?\d*)] is meant to exclude things like (19), (9:30) and similar cases that I dont want to eliminate (since it's part of the text and not dirt).

I added the part after the or operator because I noticed that the numbers after the questions mark were still been ignored.

and this is an example of the text that I'm trying to clean:

The last sentence of the example has all dirt after the question mark, and I wanted to clean it all.

Everything works well except, and as you can see, it grabs part of the text like "?" or ")" and points marks at the end of a sentence.
I couldn't figure it out how to keep those characters and I see no reason why it should work this way. As far as I underestand it, I should not remove those character as the group is restricted to the dirt part of [?).](\d{2,8}.*$).


问:
Error trying to load accuracy metric with evaluate
I'm trying to train a GPT-2 model using an example script from Huggingface Transformer Github and I get an error when the scripts tries to load 'accuracy' metric:

evaluate.load("accuracy")

File "/home/.../miniconda3/lib/python3.10/site-packages/evaluate/loading.py", line 752, in load
evaluation_instance = evaluation_cls(
TypeError: 'NoneType' object is not callable

I tried to load other metrics and I only get error with accuracy

I've got installed the requirements:

scikit-learn 1.3.dev0

evaluate 0.4.1.dev0

I'm running the run_clm.py script example for language modeling.

Is there something I need to install besides scikit-learn and evaluate? Is there something wrong with the library?

Thanks!


问:
How to record a voicemail if the call is not picked up the line is busy on Twilio Studio?
I want my my Twilio Studio flow help me record a voicemail and forward it to me.
I'm using 3 widgets to try to accomplish this.

Connect Call To

Split Based On

Add TwiML Redirect

The flow follows this direction Connect Call To > Split Based On > Add TwiML Redirect

The "Connected Call Ended" transition goes into the Split Based On widget, and I'm using the DialCallStatus as my variable to test. My condition is "Matches Any Of", and its values are "no-answer,busy,failed". The transition from this widget is to my Add TwiML Redirect, and then to my Voicemail Twimlet.

When I test, the last step isn't working and the voicemail I get is my personal one and not the one I setup on the last widget for my Voicemail Twimlet.
Any recommendations as to what I need to change?


问:
How to hide the Menu bar area?
I want to hide completely the menubar area, not just the menu (I know for option view -> appearance -> menu bar) so it always looks like it looks in full-screen mode.

Title: How to hide the Menu bar area?