问:
unable to get correct y_pred value in multiclass image classification. Found input variables with inconsistent numbers of samples: [7033, 160]
I found following error while printing confusion_matrix. Found input variables with inconsistent numbers of samples: [7033, 160]

```<code>train_generator, validation_generator = train_val_generators(TRAINING_DIR, TESTING_DIR)
</code>```

Output of the above line is as below:
Found 27549 images belonging to 5 classes.
Found 7033 images belonging to 5 classes.

```<code>predictions = model.predict_generator(validation_generator, steps=10)
predicted_classes = np.argmax(predictions, axis=1)

true_classes = validation_generator.classes
class_labels = list(validation_generator.class_indices.keys())

print (true_classes)
print(predicted_classes)

report = metrics.classification_report(true_classes, predicted_classes, target_names=class_labels)
print(report)

</code>```

Body:
I found following error while printing confusion_matrix. Found input variables with inconsistent numbers of samples: [7033, 160]

train_generator, validation_generator = train_val_generators(TRAINING_DIR, TESTING_DIR)

Output of the above line is as below:
Found 27549 images belonging to 5 classes.
Found 7033 images belonging to 5 classes.

predictions = model.predict_generator(validation_generator, steps=10)
predicted_classes = np.argmax(predictions, axis=1)

true_classes = validation_generator.classes
class_labels = list(validation_generator.class_indices.keys())

print (true_classes)
print(predicted_classes)

report = metrics.classification_report(true_classes, predicted_classes, target_names=class_labels)
print(report)


来源: stackexchange

问:
Error: ENOENT: no such file or directory, scandir '/usr/app/config/../src/plugins'
I attempting to run a node app in a docker container. I am getting an error that is difficult to trace

error message: Error: ENOENT: no such file or directory, scandir '/usr/app/config/../src/plugins'

an image of the complete error on docker.

my docker image code:

```<code># Node 14 on an Alpine
FROM node:14-alpine

RUN apk add --no-cache --virtual .gyp make g++
RUN apk add --update python3 py3-pip git openssh openssl-dev

# installing Python packages
RUN pip3 install webgme-bindings
RUN pip3 install jinja2
RUN pip3 install networkx
RUN pip3 install mako

WORKDIR /usr/app
ADD . /usr/app

RUN npm install -g npm@latest
RUN npm cache clean -force
RUN npm rm -rf node_modules && rm package-lock.json
RUN npm install  --unsafe-perm

CMD ["npm", "start"]
</code>```

The container starts and stops after a second.

I have tried deleting package-lock.json and reinstalling all the packages in package.json. I have also tried npm rebuild node-sass according to the different solutions I have seen online. I am expecting the docker container to run my node app successfully.

ContentLicense: CC BY-SA 4.0

Body:
I attempting to run a node app in a docker container. I am getting an error that is difficult to trace

error message: Error: ENOENT: no such file or directory, scandir '/usr/app/config/../src/plugins'

an image of the complete error on docker.

my docker image code:

# Node 14 on an Alpine
FROM node:14-alpine

RUN apk add --no-cache --virtual .gyp make g++
RUN apk add --update python3 py3-pip git openssh openssl-dev

# installing Python packages
RUN pip3 install webgme-bindings
RUN pip3 install jinja2
RUN pip3 install networkx
RUN pip3 install mako

WORKDIR /usr/app
ADD . /usr/app

RUN npm install -g npm@latest
RUN npm cache clean -force
RUN npm rm -rf node_modules && rm package-lock.json
RUN npm install  --unsafe-perm

CMD ["npm", "start"]

The container starts and stops after a second.

I have tried deleting package-lock.json and reinstalling all the packages in package.json. I have also tried npm rebuild node-sass according to the different solutions I have seen online. I am expecting the docker container to run my node app successfully.


问:
Ads are not loading in cypress v10.9.0
I am trying to test the ads that appears in the top of the page, I am currently using cypress v10.9.0. When i run the test, i dont get to see the ads loading. It is supposed to be here .

No ads

But when i open the same link in normal chrome or new tab in cypress runner I get to see the ads loading

website with ads in new tab of cypress ui

have done the following in my config file

```<code>chromeWebSecurity: false,
    modifyObstructiveCode:false,
</code>```

Title: Ads are not loading in cypress v10.9.0

Body:
I am trying to test the ads that appears in the top of the page, I am currently using cypress v10.9.0. When i run the test, i dont get to see the ads loading. It is supposed to be here .

No ads

But when i open the same link in normal chrome or new tab in cypress runner I get to see the ads loading

website with ads in new tab of cypress ui

have done the following in my config file

chromeWebSecurity: false,
    modifyObstructiveCode:false,


问:
snowflake.connector.errors.InterfaceError: 250003 (08001): 429 Too Many Requests: post https://coxauto.okta.com/api/v1/authn"
I'm querying snowflake using multi-threading in python using the concurrent.futures ThreadPoolExecutor, but getting a "Too Many Requests" error.  I"m trying to figure out how to work around this and maximize my multi-threading capacity.

My syntax was

```<code>from concurrent.futures import ThreadPoolExecutor

# task function
def task(value):
    return result from snowflake

with ThreadPoolExecutor() as exe:
    inputs = [1, 2, 3, 4, 5]
    result = {d : r for d,r in zip(inputs, exe.map(task, inputs))}
</code>```

But I get the 429 "Too many requests" error..

"snowflake.connector.errors.InterfaceError: 250003 (08001): 429 Too Many Requests: post https://coxauto.okta.com/api/v1/authn"

Body:
I'm querying snowflake using multi-threading in python using the concurrent.futures ThreadPoolExecutor, but getting a "Too Many Requests" error.  I"m trying to figure out how to work around this and maximize my multi-threading capacity.

My syntax was

from concurrent.futures import ThreadPoolExecutor

# task function
def task(value):
    return result from snowflake

with ThreadPoolExecutor() as exe:
    inputs = [1, 2, 3, 4, 5]
    result = {d : r for d,r in zip(inputs, exe.map(task, inputs))}

But I get the 429 "Too many requests" error..

"snowflake.connector.errors.InterfaceError: 250003 (08001): 429 Too Many Requests: post https://coxauto.okta.com/api/v1/authn"


问:
Android defaultSensor TYPE_SIGNIFICANT_MOTION returns null after 24 hours
I'm little bit confused why my Transitions API solution works usually for first day or two and after that stop receiving any updates. I dug deeper into it and found a lead that talks about how we need to have SIGNIFICAT_MOTION sensor active in order to wake up sensors that eventually wake up Transitions API solution as a whole.

What I did was I implemented listener that helps me understand when SIGNIFICANT_MOTION sensor is enabled and when not:

```<code>    try {
        boolean request = sensorManager.requestTriggerSensor(triggerEventListener, sensor);
        Timber.e("Transitions API is working. If returns false - device is STILL");
    } catch (IllegalArgumentException exception) {
        sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
        sensor = sensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION);

        Timber.e("SensorManager - " + sensorManager + ", sensor - " + sensor); //TODO: Later delete
    }
</code>```

Now as you can see, whenever this code throws exception I try to re-initialize sensors to make sure exception is not thrown later in the app. Logs show that sensor is null.

When sensor turns to null after day or two (for first day it works well and device returns sensor value correctly), there's no way to fix the issue anymore except rebooting the device.

Question: Why does sensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION); return value (sensor) for first day, but after 48ish hours returns null and stops working? (I believe that messes up my Transitions API solution and is root cause of why it is not working).

Additional information.

Phone: Google Pixel 3A
OS: Android 12

I think this ticker might be related? https://issuetracker.google.com/issues/259298110

Body:
I'm little bit confused why my Transitions API solution works usually for first day or two and after that stop receiving any updates. I dug deeper into it and found a lead that talks about how we need to have SIGNIFICAT_MOTION sensor active in order to wake up sensors that eventually wake up Transitions API solution as a whole.

What I did was I implemented listener that helps me understand when SIGNIFICANT_MOTION sensor is enabled and when not:

    try {
        boolean request = sensorManager.requestTriggerSensor(triggerEventListener, sensor);
        Timber.e("Transitions API is working. If returns false - device is STILL");
    } catch (IllegalArgumentException exception) {
        sensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
        sensor = sensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION);

        Timber.e("SensorManager - " + sensorManager + ", sensor - " + sensor); //TODO: Later delete
    }

Now as you can see, whenever this code throws exception I try to re-initialize sensors to make sure exception is not thrown later in the app. Logs show that sensor is null.

When sensor turns to null after day or two (for first day it works well and device returns sensor value correctly), there's no way to fix the issue anymore except rebooting the device.

Question: Why does sensorManager.getDefaultSensor(Sensor.TYPE_SIGNIFICANT_MOTION); return value (sensor) for first day, but after 48ish hours returns null and stops working? (I believe that messes up my Transitions API solution and is root cause of why it is not working).

Additional information.

Phone: Google Pixel 3A
OS: Android 12

I think this ticker might be related? https://issuetracker.google.com/issues/259298110


问:
Why Won't My Website Load On The Mobile Version Of Google Chrome?
I'm new to web design and have managed to create a simple website that I'm currently testing to see how it runs. I have no problems getting it to run on a computer but when I test it on a mobile device it often freezes. I've noticed that it runs well on most mobile web browsers except for Google Chrome.

What's happening is that after viewing a few pages of the website is that it just seems to stop. It doesn't necessarily crash, the page I'm currently using is still visible, but all of the links stop working (including the menu bar) and I'm only able to navigate back to a previous page that I've already viewed.

Does the CSS have anything to do with my site not functioning properly? Is the too much content on a page that's making it crash? Any knowledge or advice that one could share about any possible reasons why the site isn't functioning properly would be much appreciated. My code is listed below.

```<code><!DOCTYPE html>
<html lang="ja">

<head>

<meta name="viewport" content="width=device-width, initial-scale=1.0;" charset="utf-8">

<title>MORIKOBOSHI・</title>

<link rel="stylesheet" href="styleslocation/style.css">

</head>

<body>

<div class="page-wrap">

<div class="cp_cont">
<input id="cp_toggle03" type="checkbox">
<div class="cp_mobilebar">
<label for="cp_toggle03" class="cp_menuicon">
<span></span>
</label>
</div>
<label id="h-menu_black" class="cp_toggle03" for="cp_menuicon"></label>
<div id="body" class="noscroll"></div>

<header class="cp_offcm03">

<nav>
<ul style="text-align: center; margin-left: 210px; overflow: hidden; padding-bottom: 10px;">

<li style="border-bottom: .05px solid lightgray;"><a href="#">ホーム</a></li>
<li style="border-bottom: .05px solid lightgray;"><a href="#">ブログ</a></li>
<li style="border-bottom: .05px solid lightgray;"><a href="#">このサイトについて</a></li>
<li style="border-bottom: .05px solid lightgray;"><a href="#">参考文献</a></li>

<div class="searchbar">

<form id="frmSearch" class="search2" method="get" action="default.html" style=" padding-right: 10px; padding-top: 20px; text-align: center; position: inline;">
<input class="search2" id="txtSearch" type="text" placeholder="Googleカスタム検索" name="serach_bar" size="31" maxlength="255" value="" style="top: 185px; width: 180px; height: 26px;">
<input class="search1" type="submit" name="submition" value="検索" style="padding-left: 5px; top: 153px; height: 25px; width: 34px; display: inline-flex; justify-content: center;">
<input class="search2" type="hidden" name="sitesearch" value="default.html">
</form>
</div>

<script type="text/javascript">
 document.getElementById('frmSearch').onsubmit = function() {
 window.location = 'http://www.google.com/search?q=site:morikoboshi.com' + document.getElementById('txtSearch').value;
        return false;
    }

</script>

<script>
 document.getElementById('cp_toggle03').onchange = function() {
 if (document.getElementById('cp_toggle03').checked) {
 document.body.style.overflow = "hidden";
  } else {
 document.body.style.overflow = "";
  }
}

</script>

</ul>
</nav>
</header>

<div class="setsumei">
<br><h1 style="text-align: center; font-size: 40px;">◯◯◯◯</h1>
<br><p style="text-align: justify; font-size: 16px;"></p>

 <p style="text-align: center; font-size: 13px;">著者：◯◯◯◯</p>
 <p style="text-align: center; font-size: 13px;">撮影日：◯◯◯◯年◯◯月◯◯日</p>

 <br><br><p style="text-align: justify; font-size: 16px;">

    #
 </p>

</div>

<br><br><div class="image">

 <a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

 <br><br><a href="#"><img src="#" alt="#" width="90%"></a>

</div>
</div>

<br><br><footer class="site-footer" style="font-size: 12px;">MORIKOBOSHI© | <a href="#">English</a></footer>

</div>

<style>

html {visibility: visible;
      opacity: 1;}

.body{background-color: white;
      font-family: sans-serif;}

 .searchbar{float: right;}

 .image{text-align: center;}

 .setsumei{margin-left: 20px;
           margin-right: 20px;}

 .footer{width: 100%;
           height: 40px;
           text-align: center;
           border-top: 1px solid black;
           position: absolute;
           bottom: 0;
           padding: 10px;}

 .page-wrap {
  min-height: 100%;
  /* equal to footer height */
  margin-bottom: -40px;
}

 .page-wrap:after {
  content: "";
  display: block;
  }

 .site-footer, .page-wrap:after {
  /* .push must be the same height as footer */
  height: 20px;
}

 .site-footer {
  text-align: center;
  border-top: 1px solid black;
  padding: 10px;
}

 *, *:before, *:after {
    padding-left: 0;
    margin: 0;
    box-sizing: border-box;

}

 ol, ul {
    list-style: none;
}

 a {
    text-decoration: none;
    color: black;
}

 .cp_cont {
    height: auto;
}

/* menu */
 .cp_offcm03 {
    position: relative;
    z-index: 5000;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: auto;
    width: 100%;
    height: auto;
    padding-top: 0;
    -webkit-transition: transform 0.3s ease-in;
            transition: transform 0.3s ease-in;
    text-align: center;
    color: black;
    background-color: white;
}
 .cp_offcm03 nav,
 .cp_offcm03 ul {
    height: 100%;
}

 .cp_offcm03 li {
    display: inline-block;
    margin-right: -6px;
}

 .cp_offcm03 a {
    display: block;
    padding: 15px 45px;
    margin-bottom: -5px;
    -webkit-transition: background-color .3s ease-in;
            transition: background-color .3s ease-in;
}

 .cp_offcm03 a:hover {
    background-color: lightgray;
}

/* menu toggle */
 #cp_toggle03 {
    display: none;
}

 #cp_toggle03:checked ~ .cp_offcm03 {
    -webkit-transform: translateX(0);
                    transform: translateX(0);
}

 #cp_toggle03:checked ~ .cp_container {
    -webkit-transform: translateX(0);
                    transform: translateX(0);
}

 .cp_mobilebar {
    display: none;

}

/* content */
 .cp_container {
    position: relative;
    top: 0;
    padding: 35px auto;
    -webkit-transition: transform .3s ease-in;
            transition: transform .3s ease-in;
}

 .cp_content {
    margin: 0 auto;
    padding: 20px;
    height: 65vh;
    text-align: center;

}

@media (max-width: 1130px)and (min-width: 280px) {
/* menu */
 .cp_offcm03 {
        position: fixed;
        left: -250px;
        overflow-y: hidden;
        width: 250px;
        height: 100%;
        padding-top: 40px;
        color: black;
        background-color: white;
        z-index: 1000;
    }

 .cp_offcm03 nav {
        background: white;
        border-right: 0.5px solid lightgray;
        margin-left: -210px;
    }

 .cp_offcm03 li {
        display: block;
        margin-right: 0;}

 .cp_offcm03 a {
        padding: 20px;

    }

/* menu toggle */
 .cp_mobilebar {
        display: block;
        z-index: 2000;
        position: relative;
        top: 0;
        left: 0;
        padding: 0 25px;
        width: 100%;
        height: 40px;
        background-color: white;
        border-bottom: .05px solid lightgray;

    }

 .cp_menuicon {
        display: block;
        position: relative;
        width: 25px;
        height: 100%;
        cursor: pointer;
        -webkit-transition: transform .3s ease-in;
                transition: transform .3s ease-in;
    }
 .cp_menuicon > span {
        display: block;
        position: absolute;
        top: 55%;
        margin-top: -0.3em;
        width: 100%;
        height: 0.2em;
        border-radius: 1px;
        background-color: black;
        -webkit-transition: transform .3s ease;
                transition: transform .3s ease;
    }
 .cp_menuicon > span:before,
 .cp_menuicon > span:after {
        content: "";
        position: absolute;
        width: 100%;
        height: 100%;
        border-radius: 1px;
        background-color: black;
        -webkit-transition: transform .3s ease-in;
                transition: transform .3s ease-in;
    }

 .cp_menuicon > span:before {
        -webkit-transform: translateY(-0.6em);
                transform: translateY(-0.6em);
    }

 .cp_menuicon > span:after {
        -webkit-transform: translateY(0.6em);
                transform: translateY(0.6em);
    }

 #cp_toggle03:checked + .cp_mobilebar .cp_menuicon {
        -webkit-transform: rotate(45deg);
                transform: rotate(45deg);
    }

 #cp_toggle03:checked + .cp_mobilebar span:before,
 #cp_toggle03:checked + .cp_mobilebar span:after {
        -webkit-transform: rotate(90deg);
                transform: rotate(90deg);
    }

 #cp_toggle03:checked ~ .cp_offcm03 {
        -webkit-transform: translateX(100%);
                transform: translateX(100%);
    }

 #cp_toggle03:checked ~ .cp_container {
        -webkit-transform: translateX(250px);
                transform: translateX(250px);
    }

 input:checked ~ #h-menu_black {
    display: block;/*カバーを表示*/
    opacity: .6;
}

 #h-menu_black {
    display: none;
    position: fixed;
    z-index: 999;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: black;
    opacity: 0;
    transition: .7s ease-in-out;
}

/* content */
 .cp_container {
        top: 60px;
        height: 92vh;
        text-align: center;
    }

 .noscroll{
        overflow: hidden;
        position: fixed;
    }

</style>

</body>
</html>
</code>```

Body:
I'm new to web design and have managed to create a simple website that I'm currently testing to see how it runs. I have no problems getting it to run on a computer but when I test it on a mobile device it often freezes. I've noticed that it runs well on most mobile web browsers except for Google Chrome.

What's happening is that after viewing a few pages of the website is that it just seems to stop. It doesn't necessarily crash, the page I'm currently using is still visible, but all of the links stop working (including the menu bar) and I'm only able to navigate back to a previous page that I've already viewed.

Does the CSS have anything to do with my site not functioning properly? Is the too much content on a page that's making it crash? Any knowledge or advice that one could share about any possible reasons why the site isn't functioning properly would be much appreciated. My code is listed below.

<!DOCTYPE html>

<meta name="viewport" content="width=device-width, initial-scale=1.0;" charset="utf-8">

<title>MORIKOBOSHI・</title>

<link rel="stylesheet" href="styleslocation/style.css">

<input id="cp_toggle03" type="checkbox">

ホーム

ブログ

このサイトについて

参考文献

<form id="frmSearch" class="search2" method="get" action="default.html" style=" padding-right: 10px; padding-top: 20px; text-align: center; position: inline;">
<input class="search2" id="txtSearch" type="text" placeholder="Googleカスタム検索" name="serach_bar" size="31" maxlength="255" value="" style="top: 185px; width: 180px; height: 26px;">
<input class="search1" type="submit" name="submition" value="検索" style="padding-left: 5px; top: 153px; height: 25px; width: 34px; display: inline-flex; justify-content: center;">
<input class="search2" type="hidden" name="sitesearch" value="default.html">
</form>

◯◯◯◯

著者：◯◯◯◯

撮影日：◯◯◯◯年◯◯月◯◯日

    #

MORIKOBOSHI© | English


问:
Casting generic elements of collections with different types?
I have a class with a type parameter, InfoTag<>:

```<code>public abstract class InfoElement {}

public class InfoTag<T> : InfoElement
{
  public Func<string, T> Parser { get; set; }
  public string Terminator { get; set; }
  public char TypeChar { get; set; }
}
</code>```

And I have a list of InfoTags:

```<code>List<InfoElement> tagSet = new()
{
  new InfoTag<bool>() { Parser = bool.Parse, Terminator = "\r", TypeChar = '?' },
  new InfoTag<string>() { Parser = x => x, Terminator = "\r#;", TypeChar = ';' },
//etc...
};
</code>```

Iterating through the list returns InfoElements, but they need to be InfoTags.

```<code>foreach (InfoElement element in tagSet)
{
  var tag = ???;
  //do something...
}
</code>```

Using var tag = element as InfoTag<dynamic> or var tag = element as InfoTag<object> just return null.
How would I cast element to be an InfoTag<> with the correct generic parameter?

Body:
I have a class with a type parameter, InfoTag<>:

public abstract class InfoElement {}

public class InfoTag<T> : InfoElement
{
  public Func<string, T> Parser { get; set; }
  public string Terminator { get; set; }
  public char TypeChar { get; set; }
}

And I have a list of InfoTags:

List<InfoElement> tagSet = new()
{
  new InfoTag<bool>() { Parser = bool.Parse, Terminator = "\r", TypeChar = '?' },
  new InfoTag<string>() { Parser = x => x, Terminator = "\r#;", TypeChar = ';' },
//etc...
};

Iterating through the list returns InfoElements, but they need to be InfoTags.

foreach (InfoElement element in tagSet)
{
  var tag = ???;
  //do something...
}

Using var tag = element as InfoTag<dynamic> or var tag = element as InfoTag<object> just return null.
How would I cast element to be an InfoTag<> with the correct generic parameter?


问:
Heroku Flask API - How to improve response time when serving large JSON and image files?
I have a Python Flask API using gunicorn hosted on a Basic tier Heroku server. The API queries a Basic Heroku Postgres database for each endpoint of the API to retrieve and return the data. Since this tier of the database allows 20 connections, I have set the Python file to 17 workers, to handle concurrent requests faster.

The problem is, when serving large JSON files where I have to query the database first and then return a jsonify version of it, or query a table with images and return that, the response times range from 3 to 6 seconds or so, which is really not desirable. Especially if many users are using the API at once, it may become even slower.

How can I speed up serving large JSON files or images of like 2MB each, when I am using a Postgres database for the API?

Is there a way to cache them, would that speed things up? I have heard about Heroku Redis, would that improve the response times exponentially? How do commerical APIs do it, and how can I replicate it on Heroku with my Flask API?


问:
How to disable Swiper.js navigation at the beginning and the end outside the Swiper component / container? [React.js]
I have managed to take the buttons out of the Swiper component. But now I need to disable the left in the beginning and the right one upon reaching the end like the original navigations do. Also it should get re enabled if I leave these positions meaning start and end. Here is my code.

Note that: I am using Material UI on Gatsby.js.

```<code>const Services = () => {
  const swiperRef = useRef();
  const data = useStaticQuery(graphql`
    query HomeServicesQuery {
      allFile(
        filter: { sourceInstanceName: { eq: "services" } }
        sort: { childMdx: { frontmatter: { id: ASC } } }
      ) {
        nodes {
          childMdx {
            frontmatter {
              title
              slideImage {
                childImageSharp {
                  gatsbyImageData
                }
              }
              description
            }
          }
        }
      }
    }
  `);

  const StyledSwiper = styled(Swiper)(({ theme }) => ({
    "& .swiper-wrapper": {
      marginBottom: "20px",
    },
  }));

  const servicesData = data?.allFile?.nodes;

  return (
    <Container sx={{ mt: 10 }}>
      <Stack direction="row" alignItems="center">
        <IconButton
          color="secondary"
          onClick={() => swiperRef.current?.slidePrev()}
          sx={{
            border: "1px solid",
            borderColor: "border.main",
            marginRight: "20px",
            "&:hover": {
              backgroundColor: "primary.main",
              color: "white",
            },
          }}
        >
          <ArrowBackRoundedIcon />
        </IconButton>
        <StyledSwiper
          modules={[Autoplay]}
          spaceBetween={25}
          slidesPerView={3}
          onBeforeInit={(swiper) => {
            swiperRef.current = swiper;
          }}
          autoplay
        >
          {servicesData.map((item, index) => (
            <SwiperSlide key={index}>
              <Box>
                <GatsbyImage
                  image={
                    item.childMdx.frontmatter.slideImage.childImageSharp
                      .gatsbyImageData
                  }
                  alt={item.childMdx.frontmatter.title}
                />
              </Box>
              <Box
                sx={{
                  margin: "-60px 0 0 45px",
                  backgroundColor: "white",
                  zIndex: 1,
                  position: "relative",
                  padding: "35px 30px 30px",
                  boxShadow: "0 0 20px 0 rgba(6, 22, 58, 0.11)",
                  clipPath: "inset(0px 0px -25px -25px)",
                }}
              >
                <img
                  src={EicrIcon}
                  style={{ width: "50px", marginBottom: "20px" }}
                  alt=""
                />
                <Typography
                  sx={{
                    fontSize: 22,
                  }}
                  component="h3"
                  variant="h5"
                  color="secondary"
                >
                  {item.childMdx.frontmatter.title}
                </Typography>
                <Typography
                  paragraph
                  my={1}
                  sx={{ color: "text.main", ...theme.typography.body2, mb: 2 }}
                >
                  {item?.childMdx?.frontmatter?.description?.length > 50
                    ? item.childMdx.frontmatter.description.slice(0, 47) + "..."
                    : item.childMdx.frontmatter.description}
                </Typography>
                <Button
                  disableRipple
                  endIcon={
                    <ArrowCircleRightRoundedIcon
                      sx={{ fontSize: "16px!important" }}
                    />
                  }
                  variant="black-text"
                >
                  Learn More
                </Button>
              </Box>
            </SwiperSlide>
          ))}
        </StyledSwiper>

        <IconButton
          color="secondary"
          onClick={() => swiperRef.current?.slideNext()}
          sx={{
            border: "1px solid",
            borderColor: "border.main",
            marginLeft: "20px",
            "&:hover": {
              backgroundColor: "primary.main",
              color: "white",
            },
          }}
        >
          <ArrowForwardRoundedIcon />
        </IconButton>
      </Stack>
    </Container>
  );
};

export default Services;
</code>```

Body:
I have managed to take the buttons out of the Swiper component. But now I need to disable the left in the beginning and the right one upon reaching the end like the original navigations do. Also it should get re enabled if I leave these positions meaning start and end. Here is my code.

Note that: I am using Material UI on Gatsby.js.

const Services = () => {
  const swiperRef = useRef();
  const data = useStaticQuery(graphql`
    query HomeServicesQuery {
      allFile(
        filter: { sourceInstanceName: { eq: "services" } }
        sort: { childMdx: { frontmatter: { id: ASC } } }
      ) {
        nodes {
          childMdx {
            frontmatter {
              title
              slideImage {
                childImageSharp {
                  gatsbyImageData
                }
              }
              description
            }
          }
        }
      }
    }
  `);

  const StyledSwiper = styled(Swiper)(({ theme }) => ({
    "& .swiper-wrapper": {
      marginBottom: "20px",
    },
  }));

  const servicesData = data?.allFile?.nodes;

  return (
    <Container sx={{ mt: 10 }}>
      <Stack direction="row" alignItems="center">
        <IconButton
          color="secondary"
          onClick={() => swiperRef.current?.slidePrev()}
          sx={{
            border: "1px solid",
            borderColor: "border.main",
            marginRight: "20px",
            "&:hover": {
              backgroundColor: "primary.main",
              color: "white",
            },
          }}
        >
          <ArrowBackRoundedIcon />
        </IconButton>

        <IconButton
          color="secondary"
          onClick={() => swiperRef.current?.slideNext()}
          sx={{
            border: "1px solid",
            borderColor: "border.main",
            marginLeft: "20px",
            "&:hover": {
              backgroundColor: "primary.main",
              color: "white",
            },
          }}
        >
          <ArrowForwardRoundedIcon />
        </IconButton>
      </Stack>
    </Container>
  );
};

export default Services;


问:
How can i resolve ,render problem that below it writed couldnt resolve resource @color/purple_500
Render problem to reaolve @color/purple_500

I want to change the color primary and color accent


问:
OSError: [WinError 6] The handle is invalid (undetected_edgedriver)
I'm trying to use undetected edge driver with selenium and python. It is working but after all lines of code executed, it is closed suddenly and show this error message in console.

```<code>
Exception ignored in: <function Patcher.__del__ at 0x000002615221F1A0>
Traceback (most recent call last):
  File "C:\Users\Maduranga\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_edgedriver\patcher.py", line 262, in __del__
OSError: [WinError 6] The handle is invalid
</code>```

My code is below.

```<code>import undetected_edgedriver as edge
from selenium.webdriver.edge.options import Options
import time

if __name__ == '__main__':
    options = Options()
    options.add_argument(r"--user-data-dir=D:\\test\\profole")
    options.add_argument(r'--profile-directory=profile')

    driver = edge.Edge(options=options)
    driver.get("https://google.com/")
    time.sleep(10)

</code>```

I'm new to programming and have no experience. hope someone will help me and sorry for my bad English. thank you.

Body:
I'm trying to use undetected edge driver with selenium and python. It is working but after all lines of code executed, it is closed suddenly and show this error message in console.

Exception ignored in: <function Patcher.__del__ at 0x000002615221F1A0>
Traceback (most recent call last):
  File "C:\Users\Maduranga\AppData\Local\Programs\Python\Python311\Lib\site-packages\undetected_edgedriver\patcher.py", line 262, in __del__
OSError: [WinError 6] The handle is invalid

My code is below.

import undetected_edgedriver as edge
from selenium.webdriver.edge.options import Options
import time

if __name__ == '__main__':
    options = Options()
    options.add_argument(r"--user-data-dir=D:\\test\\profole")
    options.add_argument(r'--profile-directory=profile')

    driver = edge.Edge(options=options)
    driver.get("https://google.com/")
    time.sleep(10)

I'm new to programming and have no experience. hope someone will help me and sorry for my bad English. thank you.


问:
Snapping Layers are not loaded in Editor Widget In ArcGIS JS 4.24
I am using version ArcGIS API JavaScript 4.24.

1- I am using MapImageLayer and FeatureLayer layers in my project at the same time.
When I set the ListMode value to 'hide', layers are not loaded in SnappingLayer.
I don't want layers to be displayed in LayerList but SnappingLayer is active.

2- Is the simultaneous use of MapImageLayer and FetureLayer layers in the project
Is it the right thing to do?
What should I do to not override the layer?

```<code>`var strProxyUrl = "../../ProxyConfig/proxy.ashx";
    strUrl = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/MapServer";
    strUrl2 = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/FeatureServer";
    function rdBtnList_onchange() {

        if (document.getElementById('rdBtnList_1').checked) {
            strUrl = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/FarsProvince_SwereTransDistributionMap/MapServer";
            strUrl2 = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/FarsProvince_SwereTransDistributionMap/FeatureServer";
        }
        else if (document.getElementById('rdBtnList_2').checked) {
            strUrl = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/MapServer";
            strUrl2 = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/FeatureServer";
        }
        InitMap();
        return false;
    }

    var identifyTask;
    var params;
    var arrMapLayers = [];
    var objFeatureLayer = null;
    var view = null;
    function InitMap() {
        require([
             "esri/Map",
            "esri/WebMap",
            "esri/views/MapView",
            "esri/widgets/Editor",
            "esri/layers/MapImageLayer",
            "esri/request",
            "esri/layers/FeatureLayer",
            "esri/config", "esri/request", "esri/widgets/LayerList"
        ],
        function (Map, WebMap, MapView, Editor, MapImageLayer, esriRequest, FeatureLayer, esriConfig, esriRequest, LayerList) {
            esriConfig.request.proxyUrl = strProxyUrl;

            if (document.getElementById('rdBtnList_0').checked) {

                esriConfig.request.proxyUrl = strProxyUrl;
                const webmap = new WebMap({
                    portalItem: {
                        id: "459a495fc16d4d4caa35e92e895694c8"
                    }
                });

                var view = new MapView({
                    container: "viewDiv",
                    map: webmap
                });

            } else {

                var objMapImageLayer = new MapImageLayer({
                    url: strUrl,
                    proxyUrl: strProxyUrl
                });
                objmap = new Map();
                objmap.add(objMapImageLayer);
                view = new MapView({
                    container: "viewDiv",
                    map: objmap
                });
            }
            let layerList = new LayerList({
                view: view
            });
            view.ui.add(layerList, {
                position: "top-left"
            });
            view.when(function () {
                DoEsriRequest_GetMapLayers(esriRequest, Editor, view);
                DoEsriRequest_GetFeatureLayers(esriRequest, FeatureLayer);

            }).catch(function (err) {
                console.error("objMapView rejected:", err);
            });

        });
    }
    function DoEsriRequest_GetMapLayers(esriRequest, Editor, view) {
        var options = {
            query: {
                f: "json"
            },
            responseType: "json"
        };
        esriRequest(strUrl + "/legend", options).then(function (response) {
            if (response == null)
                return;

            if (response.data == null)
                return;

            let responseJSON = JSON.stringify(response, null, 2);
            let arrResponseJSON = JSON.parse(responseJSON);

            for (let i = arrResponseJSON.data.layers.length - 1; i >= 0; i--) {
                arrMapLayers.push(arrResponseJSON.data.layers[i]);
            }
            Make_Editor(Editor, view);
        });
    }

    function Make_Editor(Editor, view) {
        const editor = new Editor({
            view: view,
            snappingControlsElements: {
                featureEnabledToggle: false, // removes "Feature to feature" toggle
                layerList: false // removes Snapping layers list
            }
        });
        view.ui.add(editor, "top-right");
    }
    function DoEsriRequest_GetFeatureLayers(esriRequest, FeatureLayer) {
        var options = {
            query: {
                f: "json"
            },
            responseType: "json"
        };
        var strUrlFeature = strUrl.replace('MapServer', 'FeatureServer');

        esriRequest(strUrlFeature, options).then(function (response) {
            try {

                if (response == null)
                    return;

                if (response.data == null)
                    return;

                let responseJSON = JSON.stringify(response, null, 2);
                let arrResponseJSON = JSON.parse(responseJSON);

                for (let i = arrResponseJSON.data.layers.length - 1; i >= 0; i--) {
                    var objFeatureLayer = new FeatureLayer({
                        url: strUrlFeature + "/" + arrResponseJSON.data.layers[i].id,
                        listMode: 'show',
                        editingEnabled: true,
                        labelsVisible: false,
                        hasM: true,
                        gdbVersion: 'DEFAULT',
                        title: arrResponseJSON.data.layers[i].name,
                        opacity: 1
                    });

                    objmap.add(objFeatureLayer);
                }

            } catch (e) {

            }
        });
    }
    InitMap();`
</code>```

Body:
I am using version ArcGIS API JavaScript 4.24.

1- I am using MapImageLayer and FeatureLayer layers in my project at the same time.
When I set the ListMode value to 'hide', layers are not loaded in SnappingLayer.
I don't want layers to be displayed in LayerList but SnappingLayer is active.

2- Is the simultaneous use of MapImageLayer and FetureLayer layers in the project
Is it the right thing to do?
What should I do to not override the layer?

`var strProxyUrl = "../../ProxyConfig/proxy.ashx";
    strUrl = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/MapServer";
    strUrl2 = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/FeatureServer";
    function rdBtnList_onchange() {

        if (document.getElementById('rdBtnList_1').checked) {
            strUrl = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/FarsProvince_SwereTransDistributionMap/MapServer";
            strUrl2 = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/FarsProvince_SwereTransDistributionMap/FeatureServer";
        }
        else if (document.getElementById('rdBtnList_2').checked) {
            strUrl = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/MapServer";
            strUrl2 = "https://192.168.0.104:6443/arcgis/rest/services/SINARPIM/TehranCST_BaseMap/FeatureServer";
        }
        InitMap();
        return false;
    }

    var identifyTask;
    var params;
    var arrMapLayers = [];
    var objFeatureLayer = null;
    var view = null;
    function InitMap() {
        require([
             "esri/Map",
            "esri/WebMap",
            "esri/views/MapView",
            "esri/widgets/Editor",
            "esri/layers/MapImageLayer",
            "esri/request",
            "esri/layers/FeatureLayer",
            "esri/config", "esri/request", "esri/widgets/LayerList"
        ],
        function (Map, WebMap, MapView, Editor, MapImageLayer, esriRequest, FeatureLayer, esriConfig, esriRequest, LayerList) {
            esriConfig.request.proxyUrl = strProxyUrl;

            if (document.getElementById('rdBtnList_0').checked) {

                esriConfig.request.proxyUrl = strProxyUrl;
                const webmap = new WebMap({
                    portalItem: {
                        id: "459a495fc16d4d4caa35e92e895694c8"
                    }
                });

                var view = new MapView({
                    container: "viewDiv",
                    map: webmap
                });

            } else {

                var objMapImageLayer = new MapImageLayer({
                    url: strUrl,
                    proxyUrl: strProxyUrl
                });
                objmap = new Map();
                objmap.add(objMapImageLayer);
                view = new MapView({
                    container: "viewDiv",
                    map: objmap
                });
            }
            let layerList = new LayerList({
                view: view
            });
            view.ui.add(layerList, {
                position: "top-left"
            });
            view.when(function () {
                DoEsriRequest_GetMapLayers(esriRequest, Editor, view);
                DoEsriRequest_GetFeatureLayers(esriRequest, FeatureLayer);

            }).catch(function (err) {
                console.error("objMapView rejected:", err);
            });

        });
    }
    function DoEsriRequest_GetMapLayers(esriRequest, Editor, view) {
        var options = {
            query: {
                f: "json"
            },
            responseType: "json"
        };
        esriRequest(strUrl + "/legend", options).then(function (response) {
            if (response == null)
                return;

            if (response.data == null)
                return;

            let responseJSON = JSON.stringify(response, null, 2);
            let arrResponseJSON = JSON.parse(responseJSON);

            for (let i = arrResponseJSON.data.layers.length - 1; i >= 0; i--) {
                arrMapLayers.push(arrResponseJSON.data.layers[i]);
            }
            Make_Editor(Editor, view);
        });
    }

    function Make_Editor(Editor, view) {
        const editor = new Editor({
            view: view,
            snappingControlsElements: {
                featureEnabledToggle: false, // removes "Feature to feature" toggle
                layerList: false // removes Snapping layers list
            }
        });
        view.ui.add(editor, "top-right");
    }
    function DoEsriRequest_GetFeatureLayers(esriRequest, FeatureLayer) {
        var options = {
            query: {
                f: "json"
            },
            responseType: "json"
        };
        var strUrlFeature = strUrl.replace('MapServer', 'FeatureServer');

        esriRequest(strUrlFeature, options).then(function (response) {
            try {

                if (response == null)
                    return;

                if (response.data == null)
                    return;

                let responseJSON = JSON.stringify(response, null, 2);
                let arrResponseJSON = JSON.parse(responseJSON);

                for (let i = arrResponseJSON.data.layers.length - 1; i >= 0; i--) {
                    var objFeatureLayer = new FeatureLayer({
                        url: strUrlFeature + "/" + arrResponseJSON.data.layers[i].id,
                        listMode: 'show',
                        editingEnabled: true,
                        labelsVisible: false,
                        hasM: true,
                        gdbVersion: 'DEFAULT',
                        title: arrResponseJSON.data.layers[i].name,
                        opacity: 1
                    });

                    objmap.add(objFeatureLayer);
                }

            } catch (e) {

            }
        });
    }
    InitMap();`


问:
¿How can I correctly validate data sent from postman to firebase?
I am currently developing a project implementing firebase-database-realtime, however, I have some issues.

by having the security rules configured as

"read": "true",
"write": "true"

I don't have a major problem, however when I add the command for data validation with a field called "key" I have a problem since it directly invalidates my data despite using the same data types and structures as previously in the tool tests firebase requests accepted

I have made several versions of the code, however I cannot find an efficient solution.

```<code>/////////////////////////// test code ////////////////////////////////////////

// ver 1.0

{
  "rules": {
    ".write": "true",

    ".validate": "newData.hasChild('key')",
      "key": {
        ".validate": "newData.val() == '23451'"
      }

  }
}

// ver 2.0

{
  "rules": {
    ".read": "auth != null",

    ".write": "true",

    "$childid": {
       ".write": "!data.exists() || !newData.exists()",

       //Can write only Array with text and tag
       ".validate": "newData.hasChildren(['key'])",
       "$other": {
        ".validate": false
       },
       "key": {
         ".validate": "newData.val() == '23451'"
       }
     }

  }
}

// ver 3.0

{
  "rules": {
    ".read": "auth != null",

    ".write": "newData.child('key').val() === '23451'"

  }
}

</code>```

I do it this way since my idea is to implement this type of security for microcontrollers which will have authentication limitations and must handle keys as data types for validation on the server.

Body:
I am currently developing a project implementing firebase-database-realtime, however, I have some issues.

by having the security rules configured as

"read": "true",
"write": "true"

I don't have a major problem, however when I add the command for data validation with a field called "key" I have a problem since it directly invalidates my data despite using the same data types and structures as previously in the tool tests firebase requests accepted

I have made several versions of the code, however I cannot find an efficient solution.

/////////////////////////// test code ////////////////////////////////////////

// ver 1.0

{
  "rules": {
    ".write": "true",

    ".validate": "newData.hasChild('key')",
      "key": {
        ".validate": "newData.val() == '23451'"
      }

  }
}

// ver 2.0

{
  "rules": {
    ".read": "auth != null",

    ".write": "true",

    "$childid": {
       ".write": "!data.exists() || !newData.exists()",

       //Can write only Array with text and tag
       ".validate": "newData.hasChildren(['key'])",
       "$other": {
        ".validate": false
       },
       "key": {
         ".validate": "newData.val() == '23451'"
       }
     }

  }
}

// ver 3.0

{
  "rules": {
    ".read": "auth != null",

    ".write": "newData.child('key').val() === '23451'"

  }
}

I do it this way since my idea is to implement this type of security for microcontrollers which will have authentication limitations and must handle keys as data types for validation on the server.


问:
"cmdline-tools component is missing" error in Flutter
I was trying to install Flutter on ubuntu. Everything went well but when i run flutter doctor, i got an error saying:

```<code>[✗] Android toolchain - develop for Android devices
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.
</code>```

I enabled Android SDK Command-line Tools (latest) in Android Studio but still i am getting the error.
Any help would be appreciated.
Thanks

Body:
I was trying to install Flutter on ubuntu. Everything went well but when i run flutter doctor, i got an error saying:

[✗] Android toolchain - develop for Android devices
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more details.

I enabled Android SDK Command-line Tools (latest) in Android Studio but still i am getting the error.
Any help would be appreciated.
Thanks


问:
Shiny passwordInput causes problem with selectInput
Using Shiny passwordInput causes a problem with selectInput. When the example below loads, the selectInput selected item has an extra character added. Also, and the more noticeable problem, when I either select a saved a password using my browser or refresh the page, the selectInput dropdown opens spontaneously. In my larger app, this issue presents itself as dropdown menus of some selectInputs opening spontaneously. Any workarounds for this?

```<code>shinyApp(
  ui = fluidPage(
    selectInput(inputId = "mySelectInput", label = "My Select Input", choices = letters),
    passwordInput(inputId = "myPasswordInput", label = "Password")
  ),
  server = function(input, output, session) {}
)
</code>```

Update

Using Chrome: Version 106.0.5249.119 (Official Build) (64-bit)

R sessionInfo():

```<code>R version 4.1.3 (2022-03-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8
 [5] LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8    LC_PAPER=C.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C           LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] shiny_1.7.3

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9       withr_2.5.0      digest_0.6.30    later_1.3.0      mime_0.12        R6_2.5.1
 [7] jsonlite_1.8.2   lifecycle_1.0.3  xtable_1.8-4     magrittr_2.0.3   cachem_1.0.6     rlang_1.0.6
[13] cli_3.4.1        rstudioapi_0.14  promises_1.2.0.1 jquerylib_0.1.4  bslib_0.4.0      ellipsis_0.3.2
[19] tools_4.1.3      httpuv_1.6.6     fastmap_1.1.0    compiler_4.1.3   memoise_2.0.1    htmltools_0.5.3
[25] sass_0.4.2
>
</code>```

Body:
Using Shiny passwordInput causes a problem with selectInput. When the example below loads, the selectInput selected item has an extra character added. Also, and the more noticeable problem, when I either select a saved a password using my browser or refresh the page, the selectInput dropdown opens spontaneously. In my larger app, this issue presents itself as dropdown menus of some selectInputs opening spontaneously. Any workarounds for this?

shinyApp(
  ui = fluidPage(
    selectInput(inputId = "mySelectInput", label = "My Select Input", choices = letters),
    passwordInput(inputId = "myPasswordInput", label = "Password")
  ),
  server = function(input, output, session) {}
)

Update

Using Chrome: Version 106.0.5249.119 (Official Build) (64-bit)

R sessionInfo():

R version 4.1.3 (2022-03-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8        LC_COLLATE=C.UTF-8
 [5] LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8    LC_PAPER=C.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C           LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] shiny_1.7.3

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.9       withr_2.5.0      digest_0.6.30    later_1.3.0      mime_0.12        R6_2.5.1
 [7] jsonlite_1.8.2   lifecycle_1.0.3  xtable_1.8-4     magrittr_2.0.3   cachem_1.0.6     rlang_1.0.6
[13] cli_3.4.1        rstudioapi_0.14  promises_1.2.0.1 jquerylib_0.1.4  bslib_0.4.0      ellipsis_0.3.2
[19] tools_4.1.3      httpuv_1.6.6     fastmap_1.1.0    compiler_4.1.3   memoise_2.0.1    htmltools_0.5.3
[25] sass_0.4.2
>


问:
Using Nginx to emulate a redis server
My existing application is using a true redis cluster and communicates with the cluster using the StackExchange Redis client.

I’m looking to build a caching layer that emulates some of the redis commands to set and get data. The caching layer I would like to implement would use http protocol for the endpoints.

I would like to use Nginx to handle the persistent connections. I’ve been reading over the stream and socket declarations Nginx has and would have the existing application connect to Nginx and have Nginx forward the messages to the caching endpoints.

Can Nginx behave as a middleware that will keep the connection to the application open while communicating to the caching endpoints in a stateless manner?

Title: Using Nginx to emulate a redis server


问:
View the content of Microsoft.EntityFrameworkCore.InMemory?
Is there any way to view the content, like exporting the in-memory database into a file or something?</p>


问:
I have created WebApp by consuming Flicker api to search for photos. Now I want user should be able to navigate back to previous search results page
I have created WebApp by consuming Flicker api to search for photos. Now I want user should be able to navigate back to previous search results page.
This is my web app design. By default it is displaying nature images. However if user search for flower and wants to navigate back to old search which is nature. I Took the reference of this page https://www.ezzylearning.net/tutorial/display-photos-in-asp-net-using-flickr-net-api

```<code>  <table style="border: 2px solid #0066CC; width: 60%;">
  <tr>
        <td style="width: 40%;">
           Search:
           <asp:TextBox ID="SearchTextBox" runat="server" ></asp:TextBox>
            <asp:Button ID="GoButton" runat="server" Text="Search"
                        OnClick="GoButton_Click"/>
        </td>
     </tr>
     <tr>
        <td style="vertical-align: top">
           <asp:DataList ID="ThumbnailsList" runat="server" HorizontalAlign="Center"
              RepeatColumns="4" Width="100%"
              OnSelectedIndexChanged="ThumbnailsList_SelectedIndexChanged">
              <ItemStyle HorizontalAlign="Center" />
              <ItemTemplate>
                 <asp:ImageButton ID="ThumbnailImage" runat="server"
                    ImageUrl='<%# Eval("SquareThumbnailUrl") %>'
                    AlternateText='<%# Eval("Title") %>'
                    ToolTip='<%# Eval("Title") %>'
                    CommandName="Select" OnClick ="OnLoadComplete" >
                </asp:ImageButton>

              </ItemTemplate>
           </asp:DataList>
        </td>
        <td style="vertical-align: top" >
           <asp:Image ID="PreviewImage" runat="server" BorderWidth ="3" BorderStyle="Solid"
            BorderColor="Crimson" OnLoad="PreviewImage_OnLoad">
               </asp:Image>
        </td>
     </tr>
  </table>
</code>```

I Have tried

But no success`

Body:
I have created WebApp by consuming Flicker api to search for photos. Now I want user should be able to navigate back to previous search results page.
This is my web app design. By default it is displaying nature images. However if user search for flower and wants to navigate back to old search which is nature. I Took the reference of this page https://www.ezzylearning.net/tutorial/display-photos-in-asp-net-using-flickr-net-api

           Search:
           <asp:TextBox ID="SearchTextBox" runat="server" ></asp:TextBox>
            <asp:Button ID="GoButton" runat="server" Text="Search"
                        OnClick="GoButton_Click"/>

           <asp:DataList ID="ThumbnailsList" runat="server" HorizontalAlign="Center"
              RepeatColumns="4" Width="100%"
              OnSelectedIndexChanged="ThumbnailsList_SelectedIndexChanged">
              <ItemStyle HorizontalAlign="Center" />
              <ItemTemplate>
                 <asp:ImageButton ID="ThumbnailImage" runat="server"
                    ImageUrl='<%# Eval("SquareThumbnailUrl") %>'
                    AlternateText='<%# Eval("Title") %>'
                    ToolTip='<%# Eval("Title") %>'
                    CommandName="Select" OnClick ="OnLoadComplete" >
                </asp:ImageButton>

              </ItemTemplate>
           </asp:DataList>

           <asp:Image ID="PreviewImage" runat="server" BorderWidth ="3" BorderStyle="Solid"
            BorderColor="Crimson" OnLoad="PreviewImage_OnLoad">
               </asp:Image>

I Have tried

But no success`


问:
Is there a way for Prisma to create a date in a timezone other than UTC
I am creating a webpage in nextjs that tracks an inventory.
I am using prisma to connect to my 'mysql' database. I want to create a new row that registers when a change is done to the inventory. In this row I want to include the date and time in which the row is created. The problem is that the date is generated in UTC+00:00 when i want for it to be generated in UTC-06:00.

This is the prisma schema model

```<code>model inventory_movements {
  moveNumber    Int       @id @default(autoincrement())
  name    String    @db.VarChar(128)
  date    DateTime? @default(now()) @db.DateTime(0)
  amount  Decimal   @db.Decimal(11, 2)
  comment String?   @db.VarChar(128)
}
</code>```

I use moment to generate the date and then change the timezone.

```<code>import moment from 'moment';
import 'moment-timezone';

prisma.inventory.create({
  data: {
    name: "product_name",
    amount: 1,
    comment: "comment on the change",
    date: moment().tz('America/Monterrey').format()
  }
});
</code>```

The generated date is '2022-12-11T00:21:29-06:00', but the database has another value '2022-12-11 06:21:28'

I tried another aproach in which the database generates the date automatically with default value. I configured the column to have a default value of NOW() which correctly generates the date.

I then deleted the date data from the prisma command, as such:

```<code>import moment from 'moment';
import 'moment-timezone';

prisma.inventory_movements.create({
  data: {
    name: "product_name",
    amount: 1,
    comment: "comment on the change",
  }
});
</code>```

But i get the error:

```<code>error - unhandledRejection: PrismaClientValidationError:
Invalid `prisma.inventory_movements.create()` invocation:

{
  data: {
    name: 'product_name',
    amount: '1',
    comment: 'comment on the change',
+   date: DateTime
  }
}

Note: Lines with + are required
</code>```

Body:
I am creating a webpage in nextjs that tracks an inventory.
I am using prisma to connect to my 'mysql' database. I want to create a new row that registers when a change is done to the inventory. In this row I want to include the date and time in which the row is created. The problem is that the date is generated in UTC+00:00 when i want for it to be generated in UTC-06:00.

This is the prisma schema model

model inventory_movements {
  moveNumber    Int       @id @default(autoincrement())
  name    String    @db.VarChar(128)
  date    DateTime? @default(now()) @db.DateTime(0)
  amount  Decimal   @db.Decimal(11, 2)
  comment String?   @db.VarChar(128)
}

I use moment to generate the date and then change the timezone.

import moment from 'moment';
import 'moment-timezone';

prisma.inventory.create({
  data: {
    name: "product_name",
    amount: 1,
    comment: "comment on the change",
    date: moment().tz('America/Monterrey').format()
  }
});

The generated date is '2022-12-11T00:21:29-06:00', but the database has another value '2022-12-11 06:21:28'

I tried another aproach in which the database generates the date automatically with default value. I configured the column to have a default value of NOW() which correctly generates the date.

I then deleted the date data from the prisma command, as such:

import moment from 'moment';
import 'moment-timezone';

prisma.inventory_movements.create({
  data: {
    name: "product_name",
    amount: 1,
    comment: "comment on the change",
  }
});

But i get the error:

error - unhandledRejection: PrismaClientValidationError:
Invalid `prisma.inventory_movements.create()` invocation:

{
  data: {
    name: 'product_name',
    amount: '1',
    comment: 'comment on the change',
+   date: DateTime
  }
}

Note: Lines with + are required


问:
Flutter:Null check operator used on a null value on ChangeNotifierProxyProvider
I am try to login in in my app when there is a token I am using future builder to check token if there is no token then it should go to login screen but in my case I am guessing it is moving forward when there is no token and throwing error Null check operator used on a null value following is my function where I am checking my token when I open app

```<code>Future<bool> tryAutoLogin() async {
    print('try auto login started');
    final prefs = await SharedPreferences.getInstance();
    if (!prefs.containsKey('userData')) {
      return false;
    }
    final extractData =
        json.decode(prefs.getString('userData')!) as Map<String, dynamic>;

    final expiryDate = DateTime.parse(extractData['refreshExpiry']);
    final accessExpiry = DateTime.parse(extractData['accessTokenExpiry']);

    if (expiryDate.isBefore(DateTime.now())) {
      return false;
    }
    sessionId = extractData['sessionId'];
    refreshToken = extractData['refreshToken'];
    accessToken = extractData['accessToken'];
    refreshTokenExpiryDate = expiryDate;
    accessTokenExpiryDate = accessExpiry;
    var timeToExpiry =
        accessTokenExpiryDate!.difference(DateTime.now()).inSeconds;
    notifyListeners();
    //autologout();

    print(accessToken);
    return true;
  }
</code>```

in the above code if there is no token it returns false following is my future builder where I am checking token

```<code>MaterialApp(
          debugShowCheckedModeBanner: false,
          title: 'Flutter Demo',
          scaffoldMessengerKey: scaffoldMessengerKey,
          theme: ThemeData(

            primarySwatch: Colors.red,
          ),
          home: Consumer<Auth>(builder: (context, value, _) {
            print("from material app");
            return value.isAuth
                ? const WellcomeScreen()
                : FutureBuilder(
                    future: value.tryAutoLogin(),
                    builder: (context, snapshot) =>
                        snapshot.connectionState == ConnectionState.waiting
                            ? CircularProgressIndicator(
                                backgroundColor: Colors.red,
                              )
                            : OtpScreen(
                                scaffoldMessengerKey: scaffoldMessengerKey,
                              ),
                  );
          }),
</code>```

following is my provider in build tree where I want to pass token but I am getting error in below provider that there is no accesstoken. Of course the token will be null when user run application on first time or user logout. But I want to check in future builder itself before running my providers and if token is null it should go to login screen with out running providers

```<code>ChangeNotifierProxyProvider<Auth, ApiCalls>(
            create: (_) => ApiCalls(),
            update: (_, value, previous) {
              return previous!..update(value.accesstoken!);
            },
          )
</code>```

Auth
I am getting token from below class

```<code>class Auth extends ChangeNotifier {
  var isloading = false;

  int? sessionId;
  String? accessToken;
  DateTime? accessTokenExpiryDate;
  String? refreshToken;
  DateTime? refreshTokenExpiryDate;
  Timer? authTimer;
  String? messages;
  String? get accesstoken {
    if (accessTokenExpiryDate != null &&
        accessTokenExpiryDate!.isAfter(DateTime.now()) &&
        accessToken != null) {
      return accessToken;
    }
    return null;
  }
</code>```

now I am not getting why my future builder is not working correctly

Body:
I am try to login in in my app when there is a token I am using future builder to check token if there is no token then it should go to login screen but in my case I am guessing it is moving forward when there is no token and throwing error Null check operator used on a null value following is my function where I am checking my token when I open app

Future<bool> tryAutoLogin() async {
    print('try auto login started');
    final prefs = await SharedPreferences.getInstance();
    if (!prefs.containsKey('userData')) {
      return false;
    }
    final extractData =
        json.decode(prefs.getString('userData')!) as Map<String, dynamic>;

    final expiryDate = DateTime.parse(extractData['refreshExpiry']);
    final accessExpiry = DateTime.parse(extractData['accessTokenExpiry']);

    if (expiryDate.isBefore(DateTime.now())) {
      return false;
    }
    sessionId = extractData['sessionId'];
    refreshToken = extractData['refreshToken'];
    accessToken = extractData['accessToken'];
    refreshTokenExpiryDate = expiryDate;
    accessTokenExpiryDate = accessExpiry;
    var timeToExpiry =
        accessTokenExpiryDate!.difference(DateTime.now()).inSeconds;
    notifyListeners();
    //autologout();

    print(accessToken);
    return true;
  }

in the above code if there is no token it returns false following is my future builder where I am checking token

MaterialApp(
          debugShowCheckedModeBanner: false,
          title: 'Flutter Demo',
          scaffoldMessengerKey: scaffoldMessengerKey,
          theme: ThemeData(

            primarySwatch: Colors.red,
          ),
          home: Consumer<Auth>(builder: (context, value, _) {
            print("from material app");
            return value.isAuth
                ? const WellcomeScreen()
                : FutureBuilder(
                    future: value.tryAutoLogin(),
                    builder: (context, snapshot) =>
                        snapshot.connectionState == ConnectionState.waiting
                            ? CircularProgressIndicator(
                                backgroundColor: Colors.red,
                              )
                            : OtpScreen(
                                scaffoldMessengerKey: scaffoldMessengerKey,
                              ),
                  );
          }),

following is my provider in build tree where I want to pass token but I am getting error in below provider that there is no accesstoken. Of course the token will be null when user run application on first time or user logout. But I want to check in future builder itself before running my providers and if token is null it should go to login screen with out running providers

ChangeNotifierProxyProvider<Auth, ApiCalls>(
            create: (_) => ApiCalls(),
            update: (_, value, previous) {
              return previous!..update(value.accesstoken!);
            },
          )

Auth
I am getting token from below class

class Auth extends ChangeNotifier {
  var isloading = false;

  int? sessionId;
  String? accessToken;
  DateTime? accessTokenExpiryDate;
  String? refreshToken;
  DateTime? refreshTokenExpiryDate;
  Timer? authTimer;
  String? messages;
  String? get accesstoken {
    if (accessTokenExpiryDate != null &&
        accessTokenExpiryDate!.isAfter(DateTime.now()) &&
        accessToken != null) {
      return accessToken;
    }
    return null;
  }

now I am not getting why my future builder is not working correctly


问:
Schema, ad hoc scanner, and recursive descent parser
Construct an interpreter for a simple language for expressions involving fractions. Your language need only support addition and subtraction of fractions.
Example:    1/5 – (2/11 + 5/3)
Adapt the ad-hoc scanner and recursive descent parser in order to suit your language. The interpreter should generate informed error messages, in case of any syntax error. No semantic analysis is required.

Its required to construct an interpreter using schema, ad hoc scanner, and ll parsing. I have tried searching about it and couldn't find any resources on how to create this program, can anybody help me on the solution.


问:
FirebaseError: Firebase Storage: An unknown error occurred, please check the error payload for server response. (storage/unknown)
I am using react js to upload images in firebase alongside its post contents i am able to post normal captions but when i try to post with image this error is showing up and cant upload image.

here is my code

```<code> const handleUpload = (event) => {
        if (document.getElementsByClassName('hidden')[0]) {
            document.getElementsByClassName('hidden')[0].classList.remove('hidden');
        }
        document.getElementsByClassName('postButton').disabled = true;
        document.getElementsByClassName('postButton')[0].classList.add('disabled');

        if (caption === "" && imageURL === "") {
            console.log("Prevented Access to Photo or Caption Submission")
        } else {
            event.preventDefault();
            if (imageURL === '') {
                db.collection("posts").add({
                    timestamp: firebase.firestore.FieldValue.serverTimestamp(),
                    caption: caption,
                    imageUrl: "",
                    noLikes: noLikes,
                    username: user?.displayName,
                    uid: user?.uid
                });
                handleClose();
                setProgress(0);
                setCaption("");
                setImage(null);
            } else {
                const uploadTask =  storage.ref(`images/${image.name}`).put(image);
                uploadTask.on(
                    "state_changed",
                    (snapshot) => {
                        const progress = Math.round(
                            (snapshot.bytesTransferred / snapshot.totalBytes) * 100
                        );
                        setProgress(progress);
                    },
                    (error) => {
                        console.log(error);
                        alert(error.message);
                    },
                    () => {
                        storage

                            .ref("images")
                            .child(image.name)
                            .getDownloadURL()
                            .then(url => {
                                db.collection("posts").add({
                                    timestamp: firebase.firestore.FieldValue.serverTimestamp(),
                                    caption: caption,
                                    imageUrl: url,
                                    noLikes: noLikes,
                                    username: user?.displayName,
                                    uid: user?.uid

                                });
                                handleClose();
                                setProgress(0);
                                setCaption("");
                                setImage(null);
                            })
                    }
                )
            }
        }

    }
</code>```

If I can get relevant examples it will be very helpful some says that the problem is that i am calling url before the image is not upload so i tried to add await but still does not work.

Body:
I am using react js to upload images in firebase alongside its post contents i am able to post normal captions but when i try to post with image this error is showing up and cant upload image.

here is my code

 const handleUpload = (event) => {
        if (document.getElementsByClassName('hidden')[0]) {
            document.getElementsByClassName('hidden')[0].classList.remove('hidden');
        }
        document.getElementsByClassName('postButton').disabled = true;
        document.getElementsByClassName('postButton')[0].classList.add('disabled');

        if (caption === "" && imageURL === "") {
            console.log("Prevented Access to Photo or Caption Submission")
        } else {
            event.preventDefault();
            if (imageURL === '') {
                db.collection("posts").add({
                    timestamp: firebase.firestore.FieldValue.serverTimestamp(),
                    caption: caption,
                    imageUrl: "",
                    noLikes: noLikes,
                    username: user?.displayName,
                    uid: user?.uid
                });
                handleClose();
                setProgress(0);
                setCaption("");
                setImage(null);
            } else {
                const uploadTask =  storage.ref(`images/${image.name}`).put(image);
                uploadTask.on(
                    "state_changed",
                    (snapshot) => {
                        const progress = Math.round(
                            (snapshot.bytesTransferred / snapshot.totalBytes) * 100
                        );
                        setProgress(progress);
                    },
                    (error) => {
                        console.log(error);
                        alert(error.message);
                    },
                    () => {
                        storage

                            .ref("images")
                            .child(image.name)
                            .getDownloadURL()
                            .then(url => {
                                db.collection("posts").add({
                                    timestamp: firebase.firestore.FieldValue.serverTimestamp(),
                                    caption: caption,
                                    imageUrl: url,
                                    noLikes: noLikes,
                                    username: user?.displayName,
                                    uid: user?.uid

                                });
                                handleClose();
                                setProgress(0);
                                setCaption("");
                                setImage(null);
                            })
                    }
                )
            }
        }

    }

If I can get relevant examples it will be very helpful some says that the problem is that i am calling url before the image is not upload so i tried to add await but still does not work.


问:
AWS: How to fix Resource limit error while creating AWS WAF resources
Ran into AWS WAF cloudn't perform the operation because you exceeded your resource limit error while creating following resources:

10X AWS::WAFv2::IPSet

Maybe AWS::WebACL (CloudFormation did not try to create this)

What is the exact reason of this happening?

What type of quotas I need to upgrade?


问:
Why is Angular not able to find main.js and pollyfills.js?
I have an Angular Universal code which works on my local machine but not on the server. So, I think some kind of settings and configurations on the server are not correct. But I can't find what exactly is wrong.

Here is the structure of my project on the server.

The errors I get are the followings:

Here.

And here is how the website looks like:

Here.

As you see, the code is somehow deployed and shown but not properly.

Here you can find the configuration of nginx.

And here are the steps I follow to deploy the code on the server:

```<code>1)  ng build --configuration production –aot
2)  npm run build:ssr
3)  Upload the files to the correct folders
4)  pm2 kill
5)  sudo pm2 start /var/www/myApp.com/html/server/ecosystem.config.js
6)  pm2 startup systemd
7)  systemctl restart nginx
</code>```

And here is my index file:

```<code> <!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>Something</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link rel="manifest" href="manifest.webmanifest">
  <meta name="theme-color" content="#1976d2">
  <meta name="description" content="something">
  <meta name="keywords" content="something">

 <meta name="google-site-verification" content="6xXxEb-Y" />
  <meta name="google-site-verification" content="O_PI" />
</head>
<body>
  <app-root></app-root>
  <noscript>Please enable JavaScript to continue using this application.</noscript>
</body>

<script src="https://www.youtube.com/iframe_api"></script>
<script type="text/javascript" charset="UTF-8" src="something.js"></script>

</html>
</code>```

In the meantime, if I do NOT comment out the line in the nginx configuration (the green line in the picture), I will not have anything in my app-root on page source. When I comment it out, the app-root gets filled but not everything on the website is showing correctly.

I hope somebody can help me, what I have done wrong.

Thanks in advance.

Body:
I have an Angular Universal code which works on my local machine but not on the server. So, I think some kind of settings and configurations on the server are not correct. But I can't find what exactly is wrong.

Here is the structure of my project on the server.

The errors I get are the followings:

Here.

And here is how the website looks like:

Here.

As you see, the code is somehow deployed and shown but not properly.

Here you can find the configuration of nginx.

And here are the steps I follow to deploy the code on the server:

1)  ng build --configuration production –aot
2)  npm run build:ssr
3)  Upload the files to the correct folders
4)  pm2 kill
5)  sudo pm2 start /var/www/myApp.com/html/server/ecosystem.config.js
6)  pm2 startup systemd
7)  systemctl restart nginx

And here is my index file:

 <!doctype html>

  <meta charset="utf-8">
  <title>Something</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <link rel="manifest" href="manifest.webmanifest">
  <meta name="theme-color" content="#1976d2">
  <meta name="description" content="something">
  <meta name="keywords" content="something">

 <meta name="google-site-verification" content="6xXxEb-Y" />
  <meta name="google-site-verification" content="O_PI" />

  <app-root></app-root>
  Please enable JavaScript to continue using this application.

In the meantime, if I do NOT comment out the line in the nginx configuration (the green line in the picture), I will not have anything in my app-root on page source. When I comment it out, the app-root gets filled but not everything on the website is showing correctly.

I hope somebody can help me, what I have done wrong.

Thanks in advance.


问:
MongoDB: Is it possible to count/set the specific map in the array field?
My test collection seems like this:

```<code>{
    _id: ...,
    owner: '...',
    mapList: [
        {
            type: '...',
            expireAt: '...',
            isUsed: ...,
            password: '...',
        },
        {
            type: '...',
            expireAt: '...',
            isUsed: ...,
            password: '...',
        }
    ]
}
</code>```

I want to

check the mapList in the specific owner contains the map that is equal to mapList.type, and is not expired with mapList.expireAt, and is not used with mapList.isUsed.

set a new map in a mapList. This new map will replace the old map that has the same type.

set the type in mapList with unique (don't have type duplicate in mapList)

If the mapList is an object instead of an array these can be done in one step with this

```<code>final WriteResult writeResult = await mongodb.testDbCollection.updateOne(
        where.eq('owner', '...').eq('mapList.type', '...').lt('mapList.expireAt', '...').eq('mapList.isUsed', false),
        modify.set('mapList.expireAt', '...').set('mapList.isUsed', '...').set('mapList.password', '...'));
    return writeResult.isSuccess && writeResult.nModified == 1;
</code>```

How can do something like this with array (List<Map<String,dynamic>>)?

I have tried this (I tried updateOne and got an error so I tried findOne)

```<code>await mongodb.testDbCollection.findOne(where.eq('owner', '...').eq('mapList.type', 'type 1').eq('mapList.isUsed', false));
</code>```

with these data:

```<code>{
    _id: ...,
    owner: '...',
    mapList: [
        {
            type: 'type 1',
            expireAt: '...',
            isUsed: true,
            password: '...',
        },
        {
            type: 'type 2',
            expireAt: '...',
            isUsed: false,
            password: '...',
        }
    ]
}
</code>```

And I got one result!
The MongoDB joins the type field at index 0 with the isUsed field at index 1.
Or I must fecth by owner first then check it by my self?

Body:
My test collection seems like this:

{
    _id: ...,
    owner: '...',
    mapList: [
        {
            type: '...',
            expireAt: '...',
            isUsed: ...,
            password: '...',
        },
        {
            type: '...',
            expireAt: '...',
            isUsed: ...,
            password: '...',
        }
    ]
}

I want to

check the mapList in the specific owner contains the map that is equal to mapList.type, and is not expired with mapList.expireAt, and is not used with mapList.isUsed.

set a new map in a mapList. This new map will replace the old map that has the same type.

set the type in mapList with unique (don't have type duplicate in mapList)

If the mapList is an object instead of an array these can be done in one step with this

final WriteResult writeResult = await mongodb.testDbCollection.updateOne(
        where.eq('owner', '...').eq('mapList.type', '...').lt('mapList.expireAt', '...').eq('mapList.isUsed', false),
        modify.set('mapList.expireAt', '...').set('mapList.isUsed', '...').set('mapList.password', '...'));
    return writeResult.isSuccess && writeResult.nModified == 1;

How can do something like this with array (List<Map<String,dynamic>>)?

I have tried this (I tried updateOne and got an error so I tried findOne)

await mongodb.testDbCollection.findOne(where.eq('owner', '...').eq('mapList.type', 'type 1').eq('mapList.isUsed', false));

with these data:

{
    _id: ...,
    owner: '...',
    mapList: [
        {
            type: 'type 1',
            expireAt: '...',
            isUsed: true,
            password: '...',
        },
        {
            type: 'type 2',
            expireAt: '...',
            isUsed: false,
            password: '...',
        }
    ]
}

And I got one result!
The MongoDB joins the type field at index 0 with the isUsed field at index 1.
Or I must fecth by owner first then check it by my self?


问:
Springboot, Caffeine and bucket4j Integration with individual expiry for each cache
I have created a Springboot app and have implemented in-memory Cache & throttling using Caffeine and bucket4j.
application.yml

```<code>spring:
  cache:
    jcache:
      provider: com.github.benmanes.caffeine.jcache.spi.CaffeineCachingProvider
    cache-names:
    - allEndpoints
    - hello
    - world
    - myCache1
    - myCache2
    caffeine:
      spec: maximumSize=1000000,expireAfterAccess=3600s
bucket4j:
  enabled: true
  filters:
  - cache-name: allEndpoints
    url: /api/v1/.*
    rate-limits:
    - bandwidths:
      - capacity: 10
        time: 1
        unit: minutes
        fixed-refill-interval: 1
        fixed-refill-interval-unit: minutes
  - cache-name: hello
    url: /api/v1/hello.*
    rate-limits:
      - bandwidths:
          - capacity: 2
            time: 1
            unit: minutes
            fixed-refill-interval: 1
            fixed-refill-interval-unit: minutes
  - cache-name: world
    url: /api/v1/world.*
    rate-limits:
      - bandwidths:
          - capacity: 2
            time: 1
            unit: minutes
            fixed-refill-interval: 1
            fixed-refill-interval-unit: minutes
</code>```

The caches allEndpoints, hello and world are used by bucket4j. Whereas the caches myCache1 and myCache2 are used by application to cache the results returned by the service methods. Below is the service class.

```<code>@Service
public class TestService {

    @Cacheable("myCache1")
    public String myService1(int key){
        System.out.println("Service1 Invoked");
        return "hello from Service1:: " + key;
    }

    @Cacheable("myCache2")
    public String myService2(int key){
        System.out.println("Service2 Invoked");
        return "hello from Service2:: " + key;
    }
}
</code>```

I would like to know if it is possible to have multiple expireAfterAccess or expireAfterWrite for the memory caches the application uses. i.e. something like mentioned in this article. TIA.

The entire code can be found here.

Body:
I have created a Springboot app and have implemented in-memory Cache & throttling using Caffeine and bucket4j.
application.yml

spring:
  cache:
    jcache:
      provider: com.github.benmanes.caffeine.jcache.spi.CaffeineCachingProvider
    cache-names:
    - allEndpoints
    - hello
    - world
    - myCache1
    - myCache2
    caffeine:
      spec: maximumSize=1000000,expireAfterAccess=3600s
bucket4j:
  enabled: true
  filters:
  - cache-name: allEndpoints
    url: /api/v1/.*
    rate-limits:
    - bandwidths:
      - capacity: 10
        time: 1
        unit: minutes
        fixed-refill-interval: 1
        fixed-refill-interval-unit: minutes
  - cache-name: hello
    url: /api/v1/hello.*
    rate-limits:
      - bandwidths:
          - capacity: 2
            time: 1
            unit: minutes
            fixed-refill-interval: 1
            fixed-refill-interval-unit: minutes
  - cache-name: world
    url: /api/v1/world.*
    rate-limits:
      - bandwidths:
          - capacity: 2
            time: 1
            unit: minutes
            fixed-refill-interval: 1
            fixed-refill-interval-unit: minutes

The caches allEndpoints, hello and world are used by bucket4j. Whereas the caches myCache1 and myCache2 are used by application to cache the results returned by the service methods. Below is the service class.

@Service
public class TestService {

    @Cacheable("myCache1")
    public String myService1(int key){
        System.out.println("Service1 Invoked");
        return "hello from Service1:: " + key;
    }

    @Cacheable("myCache2")
    public String myService2(int key){
        System.out.println("Service2 Invoked");
        return "hello from Service2:: " + key;
    }
}

I would like to know if it is possible to have multiple expireAfterAccess or expireAfterWrite for the memory caches the application uses. i.e. something like mentioned in this article. TIA.

The entire code can be found here.


问:
Can not send crashes to the server
I wrote a class to get stackTrace to send this to the elastic.

elk is a class that we insert the crash in room database and send the crash and logs to the elastic then delete them.

in the application class I wrote this line:

```<code>Thread.setDefaultUncaughtExceptionHandler(ExceptionHandler(elk))
</code>```

my problem is that when I wrote a dummy RuntimeException, the app closed also the database is diAtached and I can not send the crash to elastic.

I can see stackTrace timber in logcat.

This happen in real phone application, but  in the emulators are fine.

Title: Can not send crashes to the server

Body:
I wrote a class to get stackTrace to send this to the elastic.

elk is a class that we insert the crash in room database and send the crash and logs to the elastic then delete them.

in the application class I wrote this line:

Thread.setDefaultUncaughtExceptionHandler(ExceptionHandler(elk))

my problem is that when I wrote a dummy RuntimeException, the app closed also the database is diAtached and I can not send the crash to elastic.

I can see stackTrace timber in logcat.

This happen in real phone application, but  in the emulators are fine.


问:
How to change Thread name from [default task-2] to [http-/10.20.00.00:8080-2] in Jboss7.4 server
How to change Thread name from [default task-2] to [http-/10.20.00.00:8080-2] in Jboss7.4 server

we have log format mentioned in standalone.xml file. Currently it is giving default thread name which i want to change to [http-/10.20.00.00:8080-2]. So where i need to make changes in standaone.xml or any other file?


问:
Netflix kind of carousel ui button recreating divs using getComputedStyle css
I am trying to recreate netflix kind of carousel ui using this wds tutorial (https://www.youtube.com/watch?v=yq4BeRtUHbk) for movie cast details using Reactjs and running through a problem.

I am fetching data from moviedb database and trying to achieve netflix like carousel effect.
the problem is when i click button for changing the slider index using getComputedStyle in css,
I get entire div recreated again several times.

I Fetch the data in the MovieDetails component and pass it to MovieDetailsPage component

```<code>export default function MovieDetails() {

const [MovieDetail, setMovieDetail] = useState([])
const [CastDetails, setCastDetails] = useState([])

const { id } = useParams();

const API_Key = '4ee812b6fb59e5f8fc44beff6b8647ed';

console.log('this is id', id);

useEffect(() => {

    getDetail();
    getCastDetails();

    console.log('main');

}, [id])

const getDetail = useCallback(() => {

    fetch(`https://api.themoviedb.org/3/movie/${id}?api_key=${API_Key}&language=en-US`)
        .then(res => res.json())
        .then(data => {
            console.log(data, 'data');
            setMovieDetail(data)
        })

}, [id])

const getCastDetails = useCallback(() => {

    fetch(`https://api.themoviedb.org/3/movie/${id}/credits?api_key=${API_Key}&language=en-
    US`)
        .then(res => res.json())
        .then(data => {
            setCastDetails(data.cast)
        }
        )

        console.log('get cast details rendered');

}, [id])

useEffect(() => {

    console.log(MovieDetail, 'Moviedetils')

}, [MovieDetail])

return (

    <div>
        <MoviesDetailsPage {...MovieDetail} CastDetails={CastDetails} API_Key={API_Key} />
    </div>

)
}
</code>```

MovieDetailsPage.jsx

```<code>export default function MoviesDetailsPage({ id, poster_path, backdrop_path, API_Key,
 CastDetails }) {

const API_image = 'https://image.tmdb.org/t/p/w500/';

document.addEventListener('click', e => {
   e.preventDefault();
   let handle;
   if(e.target.matches(".handle")){
    handle = e.target
   }else{
    handle = e.target.closest(".handle")
   }

   if(handle != null) onHandleClick(handle)

})

function onHandleClick(handle){
    const slider = handle.closest(".MovieCastContainer").querySelector(".slider")
    console.log(slider, 'sliderindex')

    const sliderIndex = parseInt(getComputedStyle(slider).getPropertyValue("--slider-index"))

    if(handle.classList.contains("left-handle")){
        slider.style.setProperty("--slider-index", sliderIndex - 1)
    }

    if(handle.classList.contains("right-handle")){
        slider.style.setProperty("--slider-index", sliderIndex + 1)
    }

}

const castInfo = CastDetails && CastDetails.map(data => <img src={API_image+data.profile_path}
alt={data.name}   />)

console.log(CastDetails, 'Castdetails')

return (
    <div className="MovieDetailsPageCont">

        <div className='MovieDetailsContainer'>
            <div className="headerImg"><img src={API_image + backdrop_path}
    alt='backdrop_path' style={{ width: '100%', borderRadius: '10px' }} /></div>
            <div className="movieid">{id}</div>
        </div>

        <div className='MovieCastContainer'>

            <button className="handle left-handle">
            <div className="text">‹</div>
            </button>

            <div className='slider'>

                {
                    castInfo ? castInfo : '...Loading'
                }

            </div>

            <button className="handle right-handle">
                <div className="text">›</div>
            </button>

        </div>

    </div>
)
 }
</code>```

My css page where change the slider index to transfrom to next set of values

```<code>*, *::after, *::before{
box-sizing: border-box;
   }

:root{
--slider-padding: 5rem;
}

    .MovieCastContainer{
display: flex;
justify-content: center;
overflow: hidden;

}

.slider{
--slider-index: 0;
display: flex;
flex-grow: 1;
margin: 0 .25rem;
transform: translateX(calc(var(--slider-index) * -100%));
transition: transform 250ms ease-in-out;
   }

.slider > img {
flex: 0 0 25%;
max-width: 25%;
aspect-ratio: 16 / 9;
padding: .25rem;
border-radius: 1rem;
overflow: hidden;
  }

.handle{
border: none;
border-radius: 1rem;
flex-grow: 0;
background-color: rgba(0, 0, 0, .25);
z-index: 10;
margin: .25rem 0;
padding: 0 .5rem;
cursor: pointer;
font-size: 5rem;
display: flex;
align-items: center;
justify-content: center;
color: white;
line-height: 0;
transition: font-size 150ms ease-in-out;

}

.left-handle{
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}

.right-handle{
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}

.handle:hover,
.handle:focus {
background-color: rgba(0, 0, 0, .5);

}

 .handle:hover .text,
 .handle:focus .text{
transform: scale(1.2)
}
</code>```

Everytime I click next button in ui the I get this

please if you can help out with this any help would be appreciated.

Body:
I am trying to recreate netflix kind of carousel ui using this wds tutorial (https://www.youtube.com/watch?v=yq4BeRtUHbk) for movie cast details using Reactjs and running through a problem.

I am fetching data from moviedb database and trying to achieve netflix like carousel effect.
the problem is when i click button for changing the slider index using getComputedStyle in css,
I get entire div recreated again several times.

I Fetch the data in the MovieDetails component and pass it to MovieDetailsPage component

export default function MovieDetails() {

const [MovieDetail, setMovieDetail] = useState([])
const [CastDetails, setCastDetails] = useState([])

const { id } = useParams();

const API_Key = '4ee812b6fb59e5f8fc44beff6b8647ed';

console.log('this is id', id);

useEffect(() => {

    getDetail();
    getCastDetails();

    console.log('main');

}, [id])

const getDetail = useCallback(() => {

    fetch(`https://api.themoviedb.org/3/movie/${id}?api_key=${API_Key}&language=en-US`)
        .then(res => res.json())
        .then(data => {
            console.log(data, 'data');
            setMovieDetail(data)
        })

}, [id])

const getCastDetails = useCallback(() => {

    fetch(`https://api.themoviedb.org/3/movie/${id}/credits?api_key=${API_Key}&language=en-
    US`)
        .then(res => res.json())
        .then(data => {
            setCastDetails(data.cast)
        }
        )

        console.log('get cast details rendered');

}, [id])

useEffect(() => {

    console.log(MovieDetail, 'Moviedetils')

}, [MovieDetail])

return (

        <MoviesDetailsPage {...MovieDetail} CastDetails={CastDetails} API_Key={API_Key} />

)
}

MovieDetailsPage.jsx

export default function MoviesDetailsPage({ id, poster_path, backdrop_path, API_Key,
 CastDetails }) {

const API_image = 'https://image.tmdb.org/t/p/w500/';

document.addEventListener('click', e => {
   e.preventDefault();
   let handle;
   if(e.target.matches(".handle")){
    handle = e.target
   }else{
    handle = e.target.closest(".handle")
   }

   if(handle != null) onHandleClick(handle)

})

function onHandleClick(handle){
    const slider = handle.closest(".MovieCastContainer").querySelector(".slider")
    console.log(slider, 'sliderindex')

    const sliderIndex = parseInt(getComputedStyle(slider).getPropertyValue("--slider-index"))

    if(handle.classList.contains("left-handle")){
        slider.style.setProperty("--slider-index", sliderIndex - 1)
    }

    if(handle.classList.contains("right-handle")){
        slider.style.setProperty("--slider-index", sliderIndex + 1)
    }

}

const castInfo = CastDetails && CastDetails.map(data => )

console.log(CastDetails, 'Castdetails')

return (

{id}

            <button className="handle left-handle">

‹

            </button>

                {
                    castInfo ? castInfo : '...Loading'
                }

            <button className="handle right-handle">

›

            </button>

)
 }

My css page where change the slider index to transfrom to next set of values

*, *::after, *::before{
box-sizing: border-box;
   }

:root{
--slider-padding: 5rem;
}

    .MovieCastContainer{
display: flex;
justify-content: center;
overflow: hidden;

}

.slider{
--slider-index: 0;
display: flex;
flex-grow: 1;
margin: 0 .25rem;
transform: translateX(calc(var(--slider-index) * -100%));
transition: transform 250ms ease-in-out;
   }

.slider > img {
flex: 0 0 25%;
max-width: 25%;
aspect-ratio: 16 / 9;
padding: .25rem;
border-radius: 1rem;
overflow: hidden;
  }

.handle{
border: none;
border-radius: 1rem;
flex-grow: 0;
background-color: rgba(0, 0, 0, .25);
z-index: 10;
margin: .25rem 0;
padding: 0 .5rem;
cursor: pointer;
font-size: 5rem;
display: flex;
align-items: center;
justify-content: center;
color: white;
line-height: 0;
transition: font-size 150ms ease-in-out;

}

.left-handle{
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}

.right-handle{
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}

.handle:hover,
.handle:focus {
background-color: rgba(0, 0, 0, .5);

}

 .handle:hover .text,
 .handle:focus .text{
transform: scale(1.2)
}

Everytime I click next button in ui the I get this

please if you can help out with this any help would be appreciated.