问:
Problem with ggplot scaling y-axis on graph (growth rate)
i have the following problem (see graph) This is my code:

[![enter image description here][1]][1]

```<code>nba2plot <- ggplot(wdata, aes(x=logBIPproKopf_start, y=Dwachstumsrate2, color=Bundesland, group = Bundesland)) + geom_point() +
  geom_smooth(method="lm", se=FALSE)
  #scale_y_continuous(trans = 'log10')

  #fullrange=TRUE

nba2plot +
  ylab("Durchschnittliche Wachstumsrate 1992-2021") + xlab("Log-BIP pro Kopf (1992)") +
  ggrepel::geom_label_repel(aes(label = Bundesländer),
                   box.padding   = 0.35,
                   point.padding = 0.5,
                   segment.color = 'grey50')+
theme_classic()
</code>```

My excel data sheet:

[![enter image description here][2]][2]

I´ve tried with ylim() and with scale_y_continous to change my y-axis scale into 0.01, 0.02, 0.03 steps. Unfortunately, it does not work. The error code for scale_y_continous is that the growth rate on y-axis is discrete. Has anyone an idea, how to change the y-scale?

Thank you in advance.

dput(wdata)
structure(list(Bundesländer = c("Baden-Württemberg", "Bayern",
"Berlin", "Brandenburg", "Bremen", "Hamburg", "Hessen", "Mecklenburg-Vorpommern",
"Niedersachsen", "Nordrhein-Westfalen", "Rheinland-Pfalz", "Saarland",
"Sachsen", "Sachsen-Anhalt", "Schleswig-Holstein", "Thüringen"
), Durch_Wachstumsrate = c(0.00214, 0.00243, 0.00238, 0.00414,
0.0019, 0.0019, 0.00192, 0.00419, 0.00225, 0.00198, 0.00219,
0.00193, 0.00432, 0.00434, 0.00195, 0.00445), logBIPproKopf_start = c(10.135063,
10.088054, 9.985669, 9.175367, 10.251523, 10.537632, 10.196896,
9.154323, 9.914183, 10.02792, 9.934173, 9.929703, 9.191263, 9.122386,
9.908949, 9.097269), Bundesland = c("Alt", "Alt", "Alt", "Neu",
"Alt", "Alt", "Alt", "Neu", "Alt", "Alt", "Alt", "Alt", "Neu",
"Neu", "Alt", "Neu"), Dwachstumsrate1 = c(0.0263, 0.0299, 0.0273,
0.0419, 0.0201, 0.0243, 0.0227, 0.0372, 0.0256, 0.0213, 0.025,
0.0169, 0.0391, 0.0348, 0.0233, 0.0382), Dwachstumsrate2 = c("0.0231",
"0.0259", "0.0252", "0.0420", "0.0206", "0.0210", "0.0205", "0.0425",
"0.0236", "0.0208", "0.0230", "0.0204", "0.0441", "0.0439", "0.0202",
"0.0450"), BIPproKopf_start = c(25212, 24054, 21173, 9656, 28326,
37708, 26820, 9455, 20215, 22650, 20623, 20531, 9811, 9158, 20110,
8931)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-16L))

Body:
i have the following problem (see graph) This is my code:

[![enter image description here][1]][1]

nba2plot <- ggplot(wdata, aes(x=logBIPproKopf_start, y=Dwachstumsrate2, color=Bundesland, group = Bundesland)) + geom_point() +
  geom_smooth(method="lm", se=FALSE)
  #scale_y_continuous(trans = 'log10')

  #fullrange=TRUE

nba2plot +
  ylab("Durchschnittliche Wachstumsrate 1992-2021") + xlab("Log-BIP pro Kopf (1992)") +
  ggrepel::geom_label_repel(aes(label = Bundesländer),
                   box.padding   = 0.35,
                   point.padding = 0.5,
                   segment.color = 'grey50')+
theme_classic()

My excel data sheet:

[![enter image description here][2]][2]

I´ve tried with ylim() and with scale_y_continous to change my y-axis scale into 0.01, 0.02, 0.03 steps. Unfortunately, it does not work. The error code for scale_y_continous is that the growth rate on y-axis is discrete. Has anyone an idea, how to change the y-scale?

Thank you in advance.

dput(wdata)
structure(list(Bundesländer = c("Baden-Württemberg", "Bayern",
"Berlin", "Brandenburg", "Bremen", "Hamburg", "Hessen", "Mecklenburg-Vorpommern",
"Niedersachsen", "Nordrhein-Westfalen", "Rheinland-Pfalz", "Saarland",
"Sachsen", "Sachsen-Anhalt", "Schleswig-Holstein", "Thüringen"
), Durch_Wachstumsrate = c(0.00214, 0.00243, 0.00238, 0.00414,
0.0019, 0.0019, 0.00192, 0.00419, 0.00225, 0.00198, 0.00219,
0.00193, 0.00432, 0.00434, 0.00195, 0.00445), logBIPproKopf_start = c(10.135063,
10.088054, 9.985669, 9.175367, 10.251523, 10.537632, 10.196896,
9.154323, 9.914183, 10.02792, 9.934173, 9.929703, 9.191263, 9.122386,
9.908949, 9.097269), Bundesland = c("Alt", "Alt", "Alt", "Neu",
"Alt", "Alt", "Alt", "Neu", "Alt", "Alt", "Alt", "Alt", "Neu",
"Neu", "Alt", "Neu"), Dwachstumsrate1 = c(0.0263, 0.0299, 0.0273,
0.0419, 0.0201, 0.0243, 0.0227, 0.0372, 0.0256, 0.0213, 0.025,
0.0169, 0.0391, 0.0348, 0.0233, 0.0382), Dwachstumsrate2 = c("0.0231",
"0.0259", "0.0252", "0.0420", "0.0206", "0.0210", "0.0205", "0.0425",
"0.0236", "0.0208", "0.0230", "0.0204", "0.0441", "0.0439", "0.0202",
"0.0450"), BIPproKopf_start = c(25212, 24054, 21173, 9656, 28326,
37708, 26820, 9455, 20215, 22650, 20623, 20531, 9811, 9158, 20110,
8931)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(NA,
-16L))


来源: stackexchange

问:
How to integrate Android performance tuner in non game applications?
I want to integrate Android Performance Tuner(APT) in my android application.
I don't have any C and C++ code in my app, completely Kotlin and android code.

Does APT supports non gaming apps?

i came through two code labs

https://developer.android.com/codelabs/android-performance-tuner-native#0

https://developer.android.com/codelabs/android-performance-tuner-unity#0

But these are purely game bases applications.

How do i integrate APT in non games android application which not uses C and C++ ?

Do we have any alternative other than APT ?

ContentLicense: CC BY-SA 4.0


问:
how can center the items in owl carousel
i need to center the items of owl carousel in Angular, is important the items stay more closer to each other, but i dont know how to join the items, i tried to create the code in stackblitz but was impossible install the dependency. here is my code

```<code><owl-carousel-o [options]="customOptions">
<ng-container *ngFor="let slide of items">
<ng-template carouselSlide [id]="slide.id">
  <div class="d-flex justify-content-center">
    <mat-card class="card">
      <mat-card-header class="card-header">
        <img class="img-provider" src="{{slide.img}}" alt="">
      </mat-card-header>
      <mat-card-content>
        <div class="card-body">
          <span class="card-body__provider">{{slide.provider}}</span>
          <span class="card-body__link">{{slide.name}}</span>
          <p class="card-text"> {{slide.text1}} </p>
          <p class="card-text"> {{slide.text2}} </p>
          <p class="card-text"> {{slide.text3}} </p>
          <p class="card-text"> {{slide.text4}} </p>
          <p class="card-text"> {{slide.text5}} </p>
        </div>
      </mat-card-content>
    </mat-card>
  </div>
</ng-template>
</code>```

```<code>.bnr-3 {
 background: hsl(260, 49%, 76%, 0.2);
 --bs-gutter-x: 0;
 margin-bottom: 0px;
 width: 100%;
 max-height: 366px;

 margin-top: 120px;
 @media (max-width:1280px) {
 width: 100%;
 }
 @media (max-width:900px) {
  height: 66%;
 }

 }

.card{
 max-width: 397px;
 max-height: 394px;
 width: 397px;
 height: 394px;
 margin: auto;
 margin-top: -65px;
 margin-bottom: 3%;
 margin-top: 3%;
 padding: 0px;
 border-radius: 20px;
}

.card-header{
 background-color:#051F3F;
 width: 100%;
 display: flex;
 align-items: center;
 justify-content: center;
 height: 107px;
 border-radius: 20px 20px 0px 0px;
 padding: 0px;
}

.img-provider{
  max-width: 40%;
  margin-right: 40px;
}

.card-body {
  display: inline-flex;
  flex-direction: column;
}

.card-text {
  font-family: "Lato";
  font-size: 16px;
  display: flex;
  justify-content: start;
  color: #363E4B;
  margin-left: 10%;
  margin-bottom: 0px;
 }

 .card-body__provider {
   color: #043DAF;
   font-family: 'Lato';
   font-weight: 700;
   font-size: 16px;
   line-height: 20px;
   text-align: center;
   }

  .card-body__link {
    color: #7A16B5;
    font-family: 'Lato';
    font-weight: 300;
    font-size: 16px;
    line-height: 18px;
    text-align: center;
    margin-bottom: 50px;
  }
</code>```

Currently the Carousel looks of this way

I need it to look like this

maybe do you know how to center the items?

Body:
i need to center the items of owl carousel in Angular, is important the items stay more closer to each other, but i dont know how to join the items, i tried to create the code in stackblitz but was impossible install the dependency. here is my code

<owl-carousel-o [options]="customOptions">
<ng-container *ngFor="let slide of items">
<ng-template carouselSlide [id]="slide.id">

    <mat-card class="card">
      <mat-card-header class="card-header">

      </mat-card-header>
      <mat-card-content>

          {{slide.provider}}
          {{slide.name}}

 {{slide.text1}}

 {{slide.text2}}

 {{slide.text3}}

 {{slide.text4}}

 {{slide.text5}}

      </mat-card-content>
    </mat-card>

</ng-template>

.bnr-3 {
 background: hsl(260, 49%, 76%, 0.2);
 --bs-gutter-x: 0;
 margin-bottom: 0px;
 width: 100%;
 max-height: 366px;

 margin-top: 120px;
 @media (max-width:1280px) {
 width: 100%;
 }
 @media (max-width:900px) {
  height: 66%;
 }

 }

.card{
 max-width: 397px;
 max-height: 394px;
 width: 397px;
 height: 394px;
 margin: auto;
 margin-top: -65px;
 margin-bottom: 3%;
 margin-top: 3%;
 padding: 0px;
 border-radius: 20px;
}

.card-header{
 background-color:#051F3F;
 width: 100%;
 display: flex;
 align-items: center;
 justify-content: center;
 height: 107px;
 border-radius: 20px 20px 0px 0px;
 padding: 0px;
}

.img-provider{
  max-width: 40%;
  margin-right: 40px;
}

.card-body {
  display: inline-flex;
  flex-direction: column;
}

.card-text {
  font-family: "Lato";
  font-size: 16px;
  display: flex;
  justify-content: start;
  color: #363E4B;
  margin-left: 10%;
  margin-bottom: 0px;
 }

 .card-body__provider {
   color: #043DAF;
   font-family: 'Lato';
   font-weight: 700;
   font-size: 16px;
   line-height: 20px;
   text-align: center;
   }

  .card-body__link {
    color: #7A16B5;
    font-family: 'Lato';
    font-weight: 300;
    font-size: 16px;
    line-height: 18px;
    text-align: center;
    margin-bottom: 50px;
  }

Currently the Carousel looks of this way

I need it to look like this

maybe do you know how to center the items?


问:
Restrict access to specific html pages on Netlify (without Netlify Identity)
I'm looking for a solution to restrict access to specific html pages hosted on Netlify.

Just FYI: I'm using Jekyll to develop and build the current application.

This is roughly how the process should be for the user:

Enter something like a 6 digit long pin code or a password within a custom "login" page  (without any other information, no username/email).

Get access to the requested page

The following approaches are not an option due to the project itself:

Without the usage of frameworks like Angular, React or Vue

I have already tried the following things:

Using staticrypt or pagecrypt (Encrypt the HTML within the build process and decrypt it via JS by the user)

-> Could work, but not the "nicest" solution

Using Octauthent (Cloudflare connects to Domain/DNS and allows/disallows you access to specific pages based on the octauthent configuration)

-> No custom login page possible, controlled by Octauthent

Ship the whole application via express.js on Netlify so I can restrict the access on server side

-> Here I have not yet gone into detail

Do you have any other rough ideas how I could get something like that done? Suggestions are welcome!


问:
Multiple JPA joins in QueryDSL
I have three tables that I am querying using QueryDSL. The tables are connected together with JPA relations. Initially, I have two tables only and later added a Details table recently. From then onwards my QueryDSL is failing as in the JPA-generated query I am seeing

. as col_35 for the details column and throwing syntax exceptions.

```<code>@Entity
public class Resource {
    private Long id;
    @OneToOne
    @JoinColumn(name = "ID")
    private Document doc;
    private String path;
}

@Entity
public class Document {
    private Long id;
    private Integer pageCount;
    private String code;
    @OneToMany(mappedBy="document_id")
    Set<Details> details;
}

@Entity
public class Details {
    Long id
    Long document_id;
    String name;
    String author;
}
</code>```

My QueryDSL query looks something as similar

```<code>final JPAQuery<?> query = new JPAQuery<>(entitymanager);

query
.select(Qbeans[])
.from(Resource)
.leftJoin(QResource.ResourceEntity.doc, QDocumentEntity)
.innerJoin(QDocument.DocumentEntity.details, QDetailsEntity)
.transform(groupBy(SOME_PATH).as(Projections.bean(QResource, QResource.fields)
</code>```

How can I get Set/List details data in the Document entity?

Title: Multiple JPA joins in QueryDSL

Body:
I have three tables that I am querying using QueryDSL. The tables are connected together with JPA relations. Initially, I have two tables only and later added a Details table recently. From then onwards my QueryDSL is failing as in the JPA-generated query I am seeing

. as col_35 for the details column and throwing syntax exceptions.

@Entity
public class Resource {
    private Long id;
    @OneToOne
    @JoinColumn(name = "ID")
    private Document doc;
    private String path;
}

@Entity
public class Document {
    private Long id;
    private Integer pageCount;
    private String code;
    @OneToMany(mappedBy="document_id")
    Set details;
}

@Entity
public class Details {
    Long id
    Long document_id;
    String name;
    String author;
}

My QueryDSL query looks something as similar

final JPAQuery<?> query = new JPAQuery<>(entitymanager);

query
.select(Qbeans[])
.from(Resource)
.leftJoin(QResource.ResourceEntity.doc, QDocumentEntity)
.innerJoin(QDocument.DocumentEntity.details, QDetailsEntity)
.transform(groupBy(SOME_PATH).as(Projections.bean(QResource, QResource.fields)

How can I get Set/List details data in the Document entity?


问:
Install latest version of mono-complete on docker
```<code>RUN apt-get update
    apt-get install -y mono-complete
</code>```

I have added this on the docker file, but I get this error

```<code>/usr/local/lib/python3.8/site-packages/clr_loader/mono.py:180: UserWarning: Hosting Mono versions before v6.12 is known to be problematic. If the process crashes shortly after you see this message, try updating Mono to at least v6.12.
</code>```

I tried mentioning the versions like below:

```<code>apt-get install -y mono-complete@6.12.0
</code>```

But it says it could not find that version.

Body:
RUN apt-get update
    apt-get install -y mono-complete

I have added this on the docker file, but I get this error

/usr/local/lib/python3.8/site-packages/clr_loader/mono.py:180: UserWarning: Hosting Mono versions before v6.12 is known to be problematic. If the process crashes shortly after you see this message, try updating Mono to at least v6.12.

I tried mentioning the versions like below:

apt-get install -y mono-complete@6.12.0

But it says it could not find that version.


问:
Invalid authorization code using Spotify Web API Node
Ok so at first you Authorize using https://accounts.spotify.com/authorize? URL initially, which returns a code.

I'm then passing the code to the server whenever /login is hit, the code is successfully sent to the server but authorizationCodeGrant is throwing this error

```<code>WebapiAuthenticationError: An authentication error occurred while communicating with Spotify's Web API.
Details: invalid_grant Invalid authorization code.
</code>```

I've printed the code, it is generated differently every time when I refresh the page, is this the problem, that code expires quickly which is why this error occurs?

Authorization: useAuth.js

import React from "react";
import axios from "axios";

const useAuth = (code) => {
  const [accessToken, setAccessToken] = React.useState();
  const [refreshToken, setRefreshToken] = React.useState();
  const [expiresIn, setExpiresIn] = React.useState();

  React.useEffect(() => {
    axios.post("http://localhost:8080/login", {
        code,
      })
      .then(res => {
        setAccessToken(res.data.accessToken);
        setRefreshToken(res.data.refreshToken);
        setExpiresIn(res.data.expiresIn);
        window.history.pushState({}, null, "/");
      })
      .catch(err => {
        window.location = "/";
      })
  }, [code]);

  return accessToken;
};

export default useAuth;

```
<p>server.js</p>
<pre class="lang-js prettyprint-override"><code>const express = require("express");
const SpotifyWebApi = require("spotify-web-api-node");
const cors = require("cors");
const bodyParse = require("body-parser");

const app = express();
app.use(cors());
app.use(bodyParse.json());
const port = process.env.PORT || 8080;

app.post("/login", (req, res) => {
  const code = req?.body?.code;
  const spotify = new SpotifyWebApi({
    redirectUri: "http://localhost:5173",
    clientId: CLIENT_ID,
    clientSecret: CLIENT_SECRET,
  });

  spotify
    .authorizationCodeGrant(code)
    .then((data) => {
      res.json({
        accessToken: data.body.access_token,
        refreshToken: data.body.refresh_token,
        expiresIn: data.body.expires_in,
      });
    })
    .catch((err) => {
      console.log(err);
      res.sendStatus(400);
    });
});

app.listen(port, () => {
  console.log(`Server started at http://localhost:${port}`);
});

</code>```

PS: 1. I've set up Redirect URIs in Spotify's Dashboard

2. I'm using Spotify-Web-API-Node

Body:
Ok so at first you Authorize using https://accounts.spotify.com/authorize? URL initially, which returns a code.

I'm then passing the code to the server whenever /login is hit, the code is successfully sent to the server but authorizationCodeGrant is throwing this error

WebapiAuthenticationError: An authentication error occurred while communicating with Spotify's Web API.
Details: invalid_grant Invalid authorization code.

I've printed the code, it is generated differently every time when I refresh the page, is this the problem, that code expires quickly which is why this error occurs?

Authorization: useAuth.js

import React from "react";
import axios from "axios";

const useAuth = (code) => {
  const [accessToken, setAccessToken] = React.useState();
  const [refreshToken, setRefreshToken] = React.useState();
  const [expiresIn, setExpiresIn] = React.useState();

  React.useEffect(() => {
    axios.post("http://localhost:8080/login", {
        code,
      })
      .then(res => {
        setAccessToken(res.data.accessToken);
        setRefreshToken(res.data.refreshToken);
        setExpiresIn(res.data.expiresIn);
        window.history.pushState({}, null, "/");
      })
      .catch(err => {
        window.location = "/";
      })
  }, [code]);

  return accessToken;
};

export default useAuth;

server.js

const express = require("express");
const SpotifyWebApi = require("spotify-web-api-node");
const cors = require("cors");
const bodyParse = require("body-parser");

const app = express();
app.use(cors());
app.use(bodyParse.json());
const port = process.env.PORT || 8080;

app.post("/login", (req, res) => {
  const code = req?.body?.code;
  const spotify = new SpotifyWebApi({
    redirectUri: "http://localhost:5173",
    clientId: CLIENT_ID,
    clientSecret: CLIENT_SECRET,
  });

  spotify
    .authorizationCodeGrant(code)
    .then((data) => {
      res.json({
        accessToken: data.body.access_token,
        refreshToken: data.body.refresh_token,
        expiresIn: data.body.expires_in,
      });
    })
    .catch((err) => {
      console.log(err);
      res.sendStatus(400);
    });
});

app.listen(port, () => {
  console.log(`Server started at http://localhost:${port}`);
});

PS: 1. I've set up Redirect URIs in Spotify's Dashboard

2. I'm using Spotify-Web-API-Node


问:
Apache NiFi run file gives an error and its not opening in windows
I had installed jdk 8 . and i do that environment variable task.
then I download NiFi 1.19.1 and extract it. after opening the NiFi-run.bat file it gives me this prompt at cmd at last:

2023-01-06 07:44:30,187 INFO [main] org.apache.nifi.bootstrap.Command Failed to determine Process ID from [java.lang.ProcessImpl]: java.lang.Process.pid()
2023-01-06 07:44:30,187 WARN [main] org.apache.nifi.bootstrap.Command Launched Apache NiFi but could not determined the Process ID

please can anybody help me. i don't know what to do?

I opened the localhost but in command prompt it doesn't showing process ID . it should be there . i saw so many tutorials but mine end up like this.


问:
Loading dataset in Pytorch and Out of Memory
I am trying to load a dataset in python for the training point net model in PyTorch.

```<code>    X=[]

   for i in tqdm(range(5)):
        fnstr="./dataset/"+file[i]+".pickle"
        # Pickle load
        with open(fnstr, 'rb') as f:
            obj = pickle.load(f)
        if i==0:
           X=obj[0:2000, :, :]
        else:
           X=np.concatenate([X,obj[0:2000, :, :]],axis=0)
    print(X.shape)
</code>```

after loading the dataset has the shape of (10000, 5, 34352).

Then I try to split to train and test with sklearn as follows:

```<code>    x_train, x_test, y_train, y_test = train_test_split(X,
                                                    X,
                                                    test_size=0.3,
                                                    random_state=1)
</code>```

and Finally, change the Numpy array to torch Tensor:

```<code>    x_train = torch.tensor(x_train, dtype=torch.float)
    x_test  = torch.tensor(x_test,  dtype=torch.float)
    y_train = torch.tensor(y_train, dtype=torch.float)
    y_test  = torch.tensor(y_test,  dtype=torch.float)
</code>```

Here I got error:

File "C:\Users\beiki\Desktop\PointNet\PointNet\5\Main.py", line 88, in
x_train = torch.tensor(x_train, dtype=torch.float)

RuntimeError: [enforce fail at C:\cb\pytorch_1000000000000\work\c10\core\impl\alloc_cpu.cpp:72] data. DefaultCPUAllocator: not enough memory: you tried to allocate 4809280000 bytes.

I am using Windows 10 which has 48 Gig RAM and Pytorch 1.13. Besides I am using RTX 3090.

I have a lot of memory but I am facing with out of memory, and more important not in the training model but in splitting the dataset.

I appreciate it if you can help me to find a solution.

Body:
I am trying to load a dataset in python for the training point net model in PyTorch.

    X=[]

   for i in tqdm(range(5)):
        fnstr="./dataset/"+file[i]+".pickle"
        # Pickle load
        with open(fnstr, 'rb') as f:
            obj = pickle.load(f)
        if i==0:
           X=obj[0:2000, :, :]
        else:
           X=np.concatenate([X,obj[0:2000, :, :]],axis=0)
    print(X.shape)

after loading the dataset has the shape of (10000, 5, 34352).

Then I try to split to train and test with sklearn as follows:

    x_train, x_test, y_train, y_test = train_test_split(X,
                                                    X,
                                                    test_size=0.3,
                                                    random_state=1)

and Finally, change the Numpy array to torch Tensor:

    x_train = torch.tensor(x_train, dtype=torch.float)
    x_test  = torch.tensor(x_test,  dtype=torch.float)
    y_train = torch.tensor(y_train, dtype=torch.float)
    y_test  = torch.tensor(y_test,  dtype=torch.float)

Here I got error:

File "C:\Users\beiki\Desktop\PointNet\PointNet\5\Main.py", line 88, in
x_train = torch.tensor(x_train, dtype=torch.float)

RuntimeError: [enforce fail at C:\cb\pytorch_1000000000000\work\c10\core\impl\alloc_cpu.cpp:72] data. DefaultCPUAllocator: not enough memory: you tried to allocate 4809280000 bytes.

I am using Windows 10 which has 48 Gig RAM and Pytorch 1.13. Besides I am using RTX 3090.

I have a lot of memory but I am facing with out of memory, and more important not in the training model but in splitting the dataset.

I appreciate it if you can help me to find a solution.


问:
Open a new tab, calling a class
I need to open a new window by calling my search class, but it gives me the error "TypeError: init() missing 1 required positional argument: 'master'". I'm new to this, appreciate your help!

```<code>#class i try to call

class Search():
    def __init__(self, master):
        self.db_name = "maindb.db"
        self.master = master
        self.master.title("SearchWindow")
        self.master.geometry("1200x300")

        frame1 = LabelFrame(master, text="Buscador")
        frame1.pack(fill=Y, side='right', pady=10)

        frame2 = LabelFrame(master, text='Instrucciones')
        frame2.pack(fill='both', expand='yes', side='left', pady=10)
.
.
.
.
.
.
.
</code>```
```<code>#main class with mainwindow

class Funcionario:
    db_name = "maindb.db"

        #my try to call a search
    def openSearch(self):
        searchWindow.Search = Toplevel(searchWindow.Search())

    def __init__(self, window):

        self.wind = window
        self.wind.title("Buscador de articulos")
        self.wind.geometry('1250x780')

        frame1 = LabelFrame(self.wind, text = "Datos de articulos")
        frame1.pack(fill=Y, side='left', pady=10)

        frame3 = LabelFrame(self.wind, text='Articulos disponibles')
        frame3.pack(fill="both", expand='yes', side='right',pady=10)

</code>```

I need to be able to open my article search window from my main window

Title: Open a new tab, calling a class

Body:
I need to open a new window by calling my search class, but it gives me the error "TypeError: init() missing 1 required positional argument: 'master'". I'm new to this, appreciate your help!

#class i try to call

class Search():
    def __init__(self, master):
        self.db_name = "maindb.db"
        self.master = master
        self.master.title("SearchWindow")
        self.master.geometry("1200x300")

        frame1 = LabelFrame(master, text="Buscador")
        frame1.pack(fill=Y, side='right', pady=10)

        frame2 = LabelFrame(master, text='Instrucciones')
        frame2.pack(fill='both', expand='yes', side='left', pady=10)
.
.
.
.
.
.
.

#main class with mainwindow

class Funcionario:
    db_name = "maindb.db"

        #my try to call a search
    def openSearch(self):
        searchWindow.Search = Toplevel(searchWindow.Search())

    def __init__(self, window):

        self.wind = window
        self.wind.title("Buscador de articulos")
        self.wind.geometry('1250x780')

        frame1 = LabelFrame(self.wind, text = "Datos de articulos")
        frame1.pack(fill=Y, side='left', pady=10)

        frame3 = LabelFrame(self.wind, text='Articulos disponibles')
        frame3.pack(fill="both", expand='yes', side='right',pady=10)

I need to be able to open my article search window from my main window


问:
changing name of x-axis for avplot
Using avplot in rStudio I created an Added Variable Plot.

I tried to change the name of the x-axis of the separate plots but can't figure out how to change them separately (so that every plot has the correct labelling of the x-axis).

Using xlab I could only change all of them at the same time with the same name.

My goal is to change the df$bis11_survey.Attention into "Attention" and so on.
I don't want to rename them in the data frame, only in the plot if thats's possible.

I added a screenshot of the plot

What command could I use that would let me change them separately?

Title: changing name of x-axis for avplot


问:
Array not updating with useState in react js 18.2.0",
I have a series of inputs populated by an array of questions marks. I have another a second array that holds alpha numeric characters. If a user enters a character that matches from this second array then the first array gets updated accordingly. Doing it the react way means that I need to create a new array from the old one and set the state with the new array. I'm doing this in the code below, according to what I gather from the docs, react intends for it to be done. Everything works in the code below, except for the "letters" array not getting updated. Again, by looking at the docs, I don't see what I'm missing.</p>
```<code>function inputChangeHandler(event) {
   const incomingLetter = event.target.value;

   const nextLetters = [...letters];
      letters.forEach((letter,idx)=>{
        if (letters_rec_of_truth[idx] === incomingLetter){
              nextLetters[idx] = incomingLetter;

            }

    });
    console.log("next letters is now "+nextLetters);
    setLetters(nextLetters);
      console.log("letters is now "+letters);

  }
</code>```

Body:
I have a series of inputs populated by an array of questions marks. I have another a second array that holds alpha numeric characters. If a user enters a character that matches from this second array then the first array gets updated accordingly. Doing it the react way means that I need to create a new array from the old one and set the state with the new array. I'm doing this in the code below, according to what I gather from the docs, react intends for it to be done. Everything works in the code below, except for the "letters" array not getting updated. Again, by looking at the docs, I don't see what I'm missing.

function inputChangeHandler(event) {
   const incomingLetter = event.target.value;

   const nextLetters = [...letters];
      letters.forEach((letter,idx)=>{
        if (letters_rec_of_truth[idx] === incomingLetter){
              nextLetters[idx] = incomingLetter;

            }

    });
    console.log("next letters is now "+nextLetters);
    setLetters(nextLetters);
      console.log("letters is now "+letters);

  }


问:
remote-style not showing on my GitHub Pages portfolio

The Problem

I wanted to install a remote theme for my portfolio website, but I am not exactly sure why it isn't working. Either I installed the remote-theme incorrectly in the only two files I edited, Gemfile and _config.yml, or it is going wrong whenever I enter bundle install/bundle update.

If you have any suggestions, please let me know!

Thanks!

I added "." at the beginning of each line of my Gemfile and _config.yml because it thought I was trying to use headings. As well as spacing each line out.

What I've Tried

In the Gemfile and config file, When I comment out the default "minima" theme, and only include the "hacker" theme, I expected it to update the theme of my GitHub pages website when I pushed to the GitHub repo.

Also, when I enter the command "bundle install" or "bundle update" in the terminal, I get an error:

Could not find gem 'http_parser.rb (= 0.8.0)' with platform 'x86_64-darwin-21' in rubygems repository
https://rubygems.org/ or installed locally.

The source contains the following gems matching 'http_parser.rb (= 0.8.0)':

http_parser.rb-0.8.0

So I installed http_parser.rb 0.8.0 I expected it to install all of these gems smoothly.

to show what I have done in each file, here is my _config.yml:

.`title: My Portfolio

.email:

.description: >- # this means to ignore newlines until "baseurl:"

.Welcome to my page! Here you will find an accumulation of completed projects

.from Frontend Mentor,

.as well as a few of my own unique projects.

.baseurl: "" # the subpath of your site, e.g. /blog

.url: "" # the base hostname & protocol for your site, e.g. http://example.com

.twitter_username: jekyllrb

.github_username: jekyll

.# Build settings

.# theme: minima

.remote_theme: pages-themes/hacker@v0.2.0

.plugins:

.jekyll-feed

.jekyll-remote-theme`

.and here is the part of the Gemfile that involves installing remote-themes:

`.# Happy Jekylling!

.# gem "jekyll", "~> 4.3.1"

.gem "github-pages", "~> 227", group: :jekyll_plugins

.gem "jekyll-include-cache", group: :jekyll_plugins

.gem "jekyll-remote-theme"

.# This is the default theme for new Jekyll sites. You may change this to .anything you like.

.# gem "minima", "~> 2.5"

.# gem "hacker", "~> 0.2"

.# If you want to use GitHub Pages, remove the "gem "jekyll"" above and

.# uncomment the line below. To upgrade, run bundle update github-pages.

.# gem "github-pages", group: :jekyll_plugins

.# If you have any plugins, put them here!

.group :jekyll_plugins do

. gem "jekyll-feed", "~> 0.12"

.end`


问:
Is it possible to write a type predicate whose second argument is the key to the object it applies to?
Let's assume I have the following error thrown when the API returns a 400 error:

```<code>type ServerError = {
  status: string
};

type ServerErrorResponse = {
  response: {
    errors: ServerError[];
  };
};
</code>```

To work with this response, I can write two predicate functions that look quite similar:

```<code>function hasResponseKey(res: unknown): res is { response: unknown } {
  return typeof res === 'object' && res !== null && 'response' in res;
}

function hasErrorsKey(response: unknown): response is { errors: unknown } {
  return typeof response === 'object' && response !== null && 'errors' in response
}
</code>```

And finally do the following:

```<code>function isResponseServerErrorResponse(
  res: unknown
): res is ServerErrorResponse {
  return (
    hasResponseKey(res) &&
    hasErrorKey(res.responseJSON) &&
    Array.isArray(res.responseJSON.errors)
  );
}
</code>```

This works, however it has a bit of a code repetition. I could avoid that by passing the key as an argument to one single predicate function. Is it possible to write a type predicate whose second argument is the key to the object it applies to?

Something like this:

```<code>function hasKey(res: unknown, key: string): res is { key: unknown } {
  return typeof res === 'object' && res !== null && key in res;
}
</code>```

Body:
Let's assume I have the following error thrown when the API returns a 400 error:

type ServerError = {
  status: string
};

type ServerErrorResponse = {
  response: {
    errors: ServerError[];
  };
};

To work with this response, I can write two predicate functions that look quite similar:

function hasResponseKey(res: unknown): res is { response: unknown } {
  return typeof res === 'object' && res !== null && 'response' in res;
}

function hasErrorsKey(response: unknown): response is { errors: unknown } {
  return typeof response === 'object' && response !== null && 'errors' in response
}

And finally do the following:

function isResponseServerErrorResponse(
  res: unknown
): res is ServerErrorResponse {
  return (
    hasResponseKey(res) &&
    hasErrorKey(res.responseJSON) &&
    Array.isArray(res.responseJSON.errors)
  );
}

This works, however it has a bit of a code repetition. I could avoid that by passing the key as an argument to one single predicate function. Is it possible to write a type predicate whose second argument is the key to the object it applies to?

Something like this:

function hasKey(res: unknown, key: string): res is { key: unknown } {
  return typeof res === 'object' && res !== null && key in res;
}


问:
Getting file permission error in docker container ERROR in [eslint] EACCES: permission denied, open '/app/node_modules/.cache/.eslintcache'
I am trying to create a react app wihout installing anything in my machine and for that I have used this Dockerfile

```<code>FROM node:18.12

# Create app directory
WORKDIR /app

# Install app dependencies
COPY package.json package-lock.json ./
RUN npm install

# Bundle app source
COPY . .

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

and following is my docker-compose.yml

```<code>version: '3'

services:
  ui:
    build: ./ui
    container_name: UI
    ports:
      - "3000:3000"
    volumes:
      - "./ui:/app"
      - "/app/node_modules"
</code>```

when I am doing docker-compose up
I am getting the following error

```<code>UI  | Failed to compile.
UI  |
UI  | [eslint] EACCES: permission denied, open '/app/node_modules/.cache/.eslintcache'
UI  | ERROR in [eslint] EACCES: permission denied, open '/app/node_modules/.cache/.eslintcache'
UI  |
UI  | webpack compiled with 1 error
</code>```

and here's the wsl2 file structure and permissions

```<code>drwxr-xr-x 5 blank blank   4096 Jan  6 18:40 .
drwxr-xr-x 5 blank blank   4096 Jan  6 18:54 ..
-rw-r--r-- 1 blank blank    310 Jan  6 18:38 .gitignore
-rw-r--r-- 1 blank blank    209 Jan  6 18:55 Dockerfile
-rw-r--r-- 1 blank blank   3359 Jan  6 18:38 README.md
drwxr-xr-x 2 root  root    4096 Jan  6 18:40 node_modules
-rw-r--r-- 1 blank blank 665979 Jan  6 18:38 package-lock.json
-rw-r--r-- 1 blank blank    827 Jan  6 18:38 package.json
drwxr-xr-x 2 blank blank   4096 Jan  6 18:38 public
drwxr-xr-x 2 blank blank   4096 Jan  6 18:38 src
</code>```

thanks.

Body:
I am trying to create a react app wihout installing anything in my machine and for that I have used this Dockerfile

FROM node:18.12

# Create app directory
WORKDIR /app

# Install app dependencies
COPY package.json package-lock.json ./
RUN npm install

# Bundle app source
COPY . .

EXPOSE 3000
CMD ["sudo", "npm", "start"]

and following is my docker-compose.yml

version: '3'

services:
  ui:
    build: ./ui
    container_name: UI
    ports:
      - "3000:3000"
    volumes:
      - "./ui:/app"
      - "/app/node_modules"

when I am doing docker-compose up
I am getting the following error

UI  | Failed to compile.
UI  |
UI  | [eslint] EACCES: permission denied, open '/app/node_modules/.cache/.eslintcache'
UI  | ERROR in [eslint] EACCES: permission denied, open '/app/node_modules/.cache/.eslintcache'
UI  |
UI  | webpack compiled with 1 error

and here's the wsl2 file structure and permissions

drwxr-xr-x 5 blank blank   4096 Jan  6 18:40 .
drwxr-xr-x 5 blank blank   4096 Jan  6 18:54 ..
-rw-r--r-- 1 blank blank    310 Jan  6 18:38 .gitignore
-rw-r--r-- 1 blank blank    209 Jan  6 18:55 Dockerfile
-rw-r--r-- 1 blank blank   3359 Jan  6 18:38 README.md
drwxr-xr-x 2 root  root    4096 Jan  6 18:40 node_modules
-rw-r--r-- 1 blank blank 665979 Jan  6 18:38 package-lock.json
-rw-r--r-- 1 blank blank    827 Jan  6 18:38 package.json
drwxr-xr-x 2 blank blank   4096 Jan  6 18:38 public
drwxr-xr-x 2 blank blank   4096 Jan  6 18:38 src

thanks.


问:
Uploading a file in electron using plupload programatically
I am trying to upload a file in electron (nodejs) using plupload by file path. I tried the following methods:

```<code>const form = new FormData()
form.append('file', fs.createReadStream(filePath));
uploader.addFile(form.file)
uploader.start();
</code>```

Didn't work. I also tried:

```<code>var form = {
    name: 'file1',
    file: {
      value:  fs.createReadStream(filePath),
      options: {
        filename: 'Radio.xspf'
      }
    }
};
uploader.addFile(form.file)
uploader.start();
</code>```

Also didn't work. I even tried to add a form in html, and then adding a file manually, and after that add the content of the html element using:

```<code>uploader.addFile(document.getElementById('files')) //Not working
uploader.addFile($('input[type="file"]')[0]) //Not working
</code>```

In all cases, the file is not being added, as console.log(uploader.files) is empty.
I need to implement adding files by path programmatically. Any ideas?

Body:
I am trying to upload a file in electron (nodejs) using plupload by file path. I tried the following methods:

const form = new FormData()
form.append('file', fs.createReadStream(filePath));
uploader.addFile(form.file)
uploader.start();

Didn't work. I also tried:

var form = {
    name: 'file1',
    file: {
      value:  fs.createReadStream(filePath),
      options: {
        filename: 'Radio.xspf'
      }
    }
};
uploader.addFile(form.file)
uploader.start();

Also didn't work. I even tried to add a form in html, and then adding a file manually, and after that add the content of the html element using:

uploader.addFile(document.getElementById('files')) //Not working
uploader.addFile($('input[type="file"]')[0]) //Not working

In all cases, the file is not being added, as console.log(uploader.files) is empty.
I need to implement adding files by path programmatically. Any ideas?


问:
Prometheus group alerts into single slack notification
New to Prometheus Alerting!

I have a prometheus Counter that has multiple Child metrics that keeps incrementing on  specific individual conditions.

On a given day, for this expression, these counters will look like:

```<code>Expression: floor(sum by (app_kubernetes_io_name, kubernetes_namespace, failure, owner_team) (increase(failure_stats_total[24h]))) > 0
</code>```

This is returning the sum of individual Child metrics for the past 24 hours.

```<code>
{app_kubernetes_io_name="consumer", failures="APP_FAILED", kubernetes_namespace="dev", owner_team="Team C"}
32
{app_kubernetes_io_name="consumer", failures="APP_TRANSFER_FAILED", kubernetes_namespace="dev", owner_team="Team C"}
10
{app_kubernetes_io_name="consumer", failures="DEVICE_FAILED", kubernetes_namespace="dev", owner_team="Team C"}
30
</code>```

My question here is how do I fire one single slack alert every 24 hours that gives the summary of all the failures occurred and the respective counts over the past day?

I'm not sure if group_by is the right choice here. Please advice

Body:
New to Prometheus Alerting!

I have a prometheus Counter that has multiple Child metrics that keeps incrementing on  specific individual conditions.

On a given day, for this expression, these counters will look like:

Expression: floor(sum by (app_kubernetes_io_name, kubernetes_namespace, failure, owner_team) (increase(failure_stats_total[24h]))) > 0

This is returning the sum of individual Child metrics for the past 24 hours.

{app_kubernetes_io_name="consumer", failures="APP_FAILED", kubernetes_namespace="dev", owner_team="Team C"}
32
{app_kubernetes_io_name="consumer", failures="APP_TRANSFER_FAILED", kubernetes_namespace="dev", owner_team="Team C"}
10
{app_kubernetes_io_name="consumer", failures="DEVICE_FAILED", kubernetes_namespace="dev", owner_team="Team C"}
30

My question here is how do I fire one single slack alert every 24 hours that gives the summary of all the failures occurred and the respective counts over the past day?

I'm not sure if group_by is the right choice here. Please advice


问:
Issue with convert datetime from UTC to local in GWT
I have following issue.
On client side ( GWT ) I have function

```<code>String getFormattedDateFromServer(Date dateFromServer)
</code>```

which should get date from server in UTC time and return formatted date in client local time

It was implemented as following:

```<code>public static String getFormattedDateFromServer(Date dateFromServer) {
        int offset = new Date().getTimezoneOffset();
        TimeZone localTimeZone = TimeZone.createTimeZone(offset);
        return DateTimeFormat.getFormat("MM/dd/yyyy hh:mm").format(dateFromServer, localTimeZone);
    }
</code>```

When running on client in GMT+2 timezone on date 04/05/2020 00:00
it was expected 04/05/2020 02:00. But I am getting 04/05/2020 00:00.
As I understand this is because on client side date 04/05/2020 00:00 considered already in local time (i.e. GMT+2) .For  server side as I see in other posts it can be see via SimpleDateFormat class and manualy set timezon ( like here  )

But SimpleDateFormat cannot be used for GWT. The question is how can it be done for GWT ? Or there are better solutions ? Thanks in advance

Body:
I have following issue.
On client side ( GWT ) I have function

String getFormattedDateFromServer(Date dateFromServer)

which should get date from server in UTC time and return formatted date in client local time

It was implemented as following:

public static String getFormattedDateFromServer(Date dateFromServer) {
        int offset = new Date().getTimezoneOffset();
        TimeZone localTimeZone = TimeZone.createTimeZone(offset);
        return DateTimeFormat.getFormat("MM/dd/yyyy hh:mm").format(dateFromServer, localTimeZone);
    }

When running on client in GMT+2 timezone on date 04/05/2020 00:00
it was expected 04/05/2020 02:00. But I am getting 04/05/2020 00:00.
As I understand this is because on client side date 04/05/2020 00:00 considered already in local time (i.e. GMT+2) .For  server side as I see in other posts it can be see via SimpleDateFormat class and manualy set timezon ( like here  )

But SimpleDateFormat cannot be used for GWT. The question is how can it be done for GWT ? Or there are better solutions ? Thanks in advance


问:
How to get ruffle-player in selenium python?
I am trying to get the ruffle player id of a game
by

```<code>profile = webdriver.FirefoxProfile()
profile.set_preference("plugin.state.flash", 2)

driver = webdriver.Firefox(profile, options=options)
driver.get("https://www.kongregate.com/games/Paulussss/bubbles-shooter/")
game_board_element = driver.find_element_by_css_selector("#gamers > ruffle-player:nth-child(1)")
</code>```

but
selenium gives error

```<code>selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: #gamers > ruffle-player:nth-child(1)
</code>```

I am trying to figure it out and I don't know about it.
Any help?

Body:
I am trying to get the ruffle player id of a game
by

profile = webdriver.FirefoxProfile()
profile.set_preference("plugin.state.flash", 2)

driver = webdriver.Firefox(profile, options=options)
driver.get("https://www.kongregate.com/games/Paulussss/bubbles-shooter/")
game_board_element = driver.find_element_by_css_selector("#gamers > ruffle-player:nth-child(1)")

but
selenium gives error

selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: #gamers > ruffle-player:nth-child(1)

I am trying to figure it out and I don't know about it.
Any help?


问:
Why I always get "Access Denied" or Timeout error while scrapping https://www.makemytrip.com/ or https://www.tanishq.co.in/?
I am not able to scrape these websites.
Make My Trip
Tanishq

Here is my code :

```<code>import requests
from bs4 import BeautifulSoup

request_headers = {
            "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
            'X-Crawlera-Profile': 'pass',
            'X-Crawlera-Cookies': 'disable',
            "Upgrade-Insecure-Requests": "1",
            'sec-fetch-site': 'none',
            'sec-fetch-mode': 'navigate',
            'sec-fetch-user': '?1',
            'sec-ch-ua-mobile':'?0',
            'sec-fetch-dest': 'document',
            "Dnt": "1",
            'cache-control': 'no-cache',
            "Accept-Encoding": "gzip, deflate,br",
            'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
            "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
            }
try:

    response = requests.get('https://makemytrip.com/',headers=request_headers,timeout=20,stream=True)
    soup = BeautifulSoup(response.text, 'html.parser')
    print(str(soup))
except requests.exceptions.Timeout as t:
    print(str(t))
    print ("Timeout occurred")
except Exception as e:
    print(str(e))

</code>```

I tried with Selenium too. Then also I can't scrape these websites.
What might be the problem?

Body:
I am not able to scrape these websites.
Make My Trip
Tanishq

Here is my code :

import requests
from bs4 import BeautifulSoup

request_headers = {
            "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36',
            'X-Crawlera-Profile': 'pass',
            'X-Crawlera-Cookies': 'disable',
            "Upgrade-Insecure-Requests": "1",
            'sec-fetch-site': 'none',
            'sec-fetch-mode': 'navigate',
            'sec-fetch-user': '?1',
            'sec-ch-ua-mobile':'?0',
            'sec-fetch-dest': 'document',
            "Dnt": "1",
            'cache-control': 'no-cache',
            "Accept-Encoding": "gzip, deflate,br",
            'accept-language': 'en-GB,en-US;q=0.9,en;q=0.8',
            "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
            }
try:

    response = requests.get('https://makemytrip.com/',headers=request_headers,timeout=20,stream=True)
    soup = BeautifulSoup(response.text, 'html.parser')
    print(str(soup))
except requests.exceptions.Timeout as t:
    print(str(t))
    print ("Timeout occurred")
except Exception as e:
    print(str(e))

I tried with Selenium too. Then also I can't scrape these websites.
What might be the problem?


问:
Getting Button Text Vertically Centred on Android Emulator but not on IOS Emulator
Same flutter code for outlined Button is giving text inside it as vertically centred when I run it on Android Emulator but when I run it on IOS Emulator text is lifted upward.

Here is the code for it:

```<code>import 'package:flutter/material.dart';
class WaterTemp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
    height: (MediaQuery.of(context).size.height -
            MediaQuery.of(context).padding.top) *
        0.13,
    child: LayoutBuilder(
      builder: (ctx, constraints) {
        return Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              height: constraints.maxHeight * 0.2,
              width: constraints.maxWidth * 0.6,
              child: FittedBox(
                fit: BoxFit.scaleDown,
                alignment: Alignment.topLeft,
                child: Text('WATER TEMPERATURE'),
              ),
            ),
            SizedBox(
              height: constraints.maxHeight * 0.1,
            ),
            Container(
              height: constraints.maxHeight * 0.4,
              width: constraints.maxWidth * 1,
              child:
                  OutlinedButton(
                    onPressed: null,
                    style: OutlinedButton.styleFrom(
                      minimumSize: Size(constraints.maxWidth * 0.48, 50),
                      maximumSize: Size(constraints.maxWidth * 0.48, 50),
                      textStyle: TextStyle(fontSize: 20),
                      shape: RoundedRectangleBorder(
                          borderRadius:
                              BorderRadius.all(Radius.circular(5))),
                    ),
                    child: Text(
                      "Normal",
                      textAlign: TextAlign.center,
                      style: TextStyle(
                          fontSize: 14,[enter image description here](https://i.stack.imgur.com/UcRDH.png)
                          fontWeight: FontWeight.w500,
                          fontFamily: 'GothamMedium'
                      ),
                    ),
                  ),
            )
          ],
        );
      },
    ));
}
}
</code>```

This is a screen shot of android emulator : -

This is a screen shot of iphone : -

I have tried Align, centre and padding widgets as well as fitted box. Is there any other solution to it.

Body:
Same flutter code for outlined Button is giving text inside it as vertically centred when I run it on Android Emulator but when I run it on IOS Emulator text is lifted upward.

Here is the code for it:

import 'package:flutter/material.dart';
class WaterTemp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
    height: (MediaQuery.of(context).size.height -
            MediaQuery.of(context).padding.top) *
        0.13,
    child: LayoutBuilder(
      builder: (ctx, constraints) {
        return Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Container(
              height: constraints.maxHeight * 0.2,
              width: constraints.maxWidth * 0.6,
              child: FittedBox(
                fit: BoxFit.scaleDown,
                alignment: Alignment.topLeft,
                child: Text('WATER TEMPERATURE'),
              ),
            ),
            SizedBox(
              height: constraints.maxHeight * 0.1,
            ),
            Container(
              height: constraints.maxHeight * 0.4,
              width: constraints.maxWidth * 1,
              child:
                  OutlinedButton(
                    onPressed: null,
                    style: OutlinedButton.styleFrom(
                      minimumSize: Size(constraints.maxWidth * 0.48, 50),
                      maximumSize: Size(constraints.maxWidth * 0.48, 50),
                      textStyle: TextStyle(fontSize: 20),
                      shape: RoundedRectangleBorder(
                          borderRadius:
                              BorderRadius.all(Radius.circular(5))),
                    ),
                    child: Text(
                      "Normal",
                      textAlign: TextAlign.center,
                      style: TextStyle(
                          fontSize: 14,[enter image description here](https://i.stack.imgur.com/UcRDH.png)
                          fontWeight: FontWeight.w500,
                          fontFamily: 'GothamMedium'
                      ),
                    ),
                  ),
            )
          ],
        );
      },
    ));
}
}

This is a screen shot of android emulator : -

This is a screen shot of iphone : -

I have tried Align, centre and padding widgets as well as fitted box. Is there any other solution to it.


问:
Thymeleaf 3.1 fails to render base64 image - TemplateProcessingException
I am migrating my application to Spring boot 3.0.1, and the thymeleaf version from 2 to 3.1

I have this line of code:

```<code><img class="img-logo-main" src="#" alt="logo" th:src="@{'data:image/jpeg;base64,'+${logoMBase64}}" width="335" height="82">
</code>```

which was executing normally before the upgrade, but now I am getting:

```<code>TemplateProcessingException - Caused by:

org.thymeleaf.exceptions.TemplateProcessingException: No configured link builder instance was able to build link with base "data:image/jpeg;base64,null" and parameters null (template: "my-template.html" - line 3, col 51)
</code>```

NOTES: I am sending the logoMBase64 param. IDK why the log states null

Am I missing any configuration? Or have there been any changes in support for rendering base64 imgs?

Thanks!

Body:
I am migrating my application to Spring boot 3.0.1, and the thymeleaf version from 2 to 3.1

I have this line of code:

which was executing normally before the upgrade, but now I am getting:

TemplateProcessingException - Caused by:

org.thymeleaf.exceptions.TemplateProcessingException: No configured link builder instance was able to build link with base "data:image/jpeg;base64,null" and parameters null (template: "my-template.html" - line 3, col 51)

NOTES: I am sending the logoMBase64 param. IDK why the log states null

Am I missing any configuration? Or have there been any changes in support for rendering base64 imgs?

Thanks!


问:
Android Java readFile to hex byte array
edited for code formatting

I'm trying to implement a Ble OTA system with a Esp32

I need to read a binary file into a Hex array and pass this over Ble to my Esp32 characteristic
The Esp32 works fine, and accepts an update from a simple Python3 script

the basics are below
`
# compute the packet size
packet_size = (512)

```<code>    # split the firmware into packets
    with open(file_path, "rb") as file:
        while chunk := file.read(packet_size):
            firmware.append(chunk)

    # sequentially write all packets to OTA data
    for i, pkg in enumerate(firmware):
        print(f"Sending packet {i}/{len(firmware)-1}")

        await client.write_gatt_char(
            OTA_DATA_UUID,
            pkg,
            response=True
        )`
</code>```

Trying the same in Android java produces an array of unsigned ints, this does not seem to be compatible with the type of bytes that the Esp32 is expecting

heres a cut down example of what im trying

```<code>     String path =
    ContentUriUtils.INSTANCE.getFilePath(firmwareSelectActivity.this,
    chosenFile);

    File file = new File(path);
    byte[] fileByteArray =  readFile(file);

    byte[][] test =   splitArray(fileByteArray,512);

    for(int i = 0;i <  test.length;i++)
{ mBluetoothLeService.addBleOtaWriteByteCommandToQueue(BluetoothLeService
   .getOtaTXcharacteristic(),  test[i]);
        }

</code>```

The ESP32 OTA library is expecting the first byte to be 0xE9 to start the upgrade process. But I seem to be sending 0x13

Title: Android Java readFile to hex byte array

Body:
edited for code formatting

I'm trying to implement a Ble OTA system with a Esp32

I need to read a binary file into a Hex array and pass this over Ble to my Esp32 characteristic
The Esp32 works fine, and accepts an update from a simple Python3 script

the basics are below
`
# compute the packet size
packet_size = (512)

    # split the firmware into packets
    with open(file_path, "rb") as file:
        while chunk := file.read(packet_size):
            firmware.append(chunk)

    # sequentially write all packets to OTA data
    for i, pkg in enumerate(firmware):
        print(f"Sending packet {i}/{len(firmware)-1}")

        await client.write_gatt_char(
            OTA_DATA_UUID,
            pkg,
            response=True
        )`

Trying the same in Android java produces an array of unsigned ints, this does not seem to be compatible with the type of bytes that the Esp32 is expecting

heres a cut down example of what im trying

     String path =
    ContentUriUtils.INSTANCE.getFilePath(firmwareSelectActivity.this,
    chosenFile);

    File file = new File(path);
    byte[] fileByteArray =  readFile(file);

    byte[][] test =   splitArray(fileByteArray,512);

    for(int i = 0;i <  test.length;i++)
{ mBluetoothLeService.addBleOtaWriteByteCommandToQueue(BluetoothLeService
   .getOtaTXcharacteristic(),  test[i]);
        }

The ESP32 OTA library is expecting the first byte to be 0xE9 to start the upgrade process. But I seem to be sending 0x13


问:
How to secure Nodejs end point api and make it private
I am trying to build a nodejs api, I am wondring how to make it only accessible by my frontend application (MERN stack). Because others can see from the console in the frontend site the address of my backend appilcation built using nodejs

I tried cors, but it's still accessible via POST MAN


问:
Android studio SDK can't find path
So, my problem is that their is a space in one of my directory leading to appdata and on android studio i need to give him this path but he can't find it because he think that after the space their is nothing else, as you can see with the screen at "ce pc", can i do something to change the name of this directory or maybe change the sdk location ?

I already tried to modify the name with regedit and it was a really bad idea hopefully i did a backup before doing it.

With all my research i didn't found any way to move the sdk directory so maybe you can help

Title: Android studio SDK can't find path


问:
Firestore, aggregating data: cloud function vs direct write using the client SDK
Using Firestore.

Let's say I have a chat app, and once a message is sent, I want to aggregate it to the user's document, which has a "last message" field.

The motivation is to show next to this user's widget the last message sent.

One way to achieve that is using a Cloud Function: listen to changes on the messages collection / document, and copy that data to the user's document.

Another way would be to use the client SDK and write the last message data to the user's document when adding this message to the messages collection / document.

My questions is what are the pros (and cons if any) of using a Cloud Function for that (and in general for aggregating data)?


问:
Why does the definition of the maximum digit - max not work?
It is necessary to check the array diff_prices (RSI, EMA and MACD), determine the highest indicator in the percentage field in the checked pairs and get all its values (symbols, future_price, spot_price, percentage).

My function:

```<code>function satisfies_rules($symbol, $closing_prices, $diff_prices) {
    // Calculate the RSI and EMA values using the PECL trader extension
    $rsi = trader_rsi($closing_prices, 6);
    $ema16 = trader_ema($closing_prices, 16);
    $ema48 = trader_ema($closing_prices, 48);
    $ema200 = trader_ema($closing_prices, 200);

    // Get the last values of the RSI, EMA, and MACD arrays
    $rsi = end($rsi);
    $ema16 = end($ema16);
    $ema48 = end($ema48);
    $ema200 = end($ema200);

    $macd = end(array_slice(trader_macd($closing_prices, 12, 26, 9), -1)[0]);
    $macd = sprintf("%f", $macd);

    // Check if the symbol satisfies the rules
    if ($rsi > 70) {
        // If the symbol satisfies the rules, return the symbol, future_price, and spot_price
        //var_dump($diff_prices[$symbol]);
        return $diff_prices[$symbol];
    }
}
</code>```

My index code:

// Check if the PECL trader extension is available
if (function_exists('trader_macd')) {
// Initialize an array to store the symbols that satisfy the rules
$valid_symbols = array();

```<code>// Iterate over the $responses array
foreach ($responses as $symbol => $candle_data) {
    // Extract the closing prices from the candle data
    $closing_prices = array_column($candle_data, 4);

    // Check if the symbol satisfies the rules
    if ($response = satisfies_rules($symbol, $closing_prices, $diff_prices)) {
        // If the symbol satisfies the rules, add it to the $valid_symbols array
        $valid_symbols[$symbol] = $diff_prices[$symbol]; //var_dump($valid_symbols[$symbol]['percentage']);
        var_dump($valid_symbols[$symbol]);// check

    }
}

// Print the symbol, future_price, and spot_price
//var_dump($valid_symbols);
$max_symbol = array_keys($valid_symbols, max($valid_symbols))[0];

$future_price = $valid_symbols[$max_symbol]['future_price'];
$spot_price = $valid_symbols[$max_symbol]['spot_price'];
$percentage = $valid_symbols[$max_symbol]['percentage'];

echo "Symbol: $max_symbol\n";
echo "Future price: $future_price\n";
echo "Spot price: $spot_price\n";
echo "Percentage: $percentage\n";
</code>```

}

As a result, I get an incorrect selection.

Symbol: ENSUSDT Future price: 11.191 Spot price: 11.22000000 Percentage: 0.25913680636225

There are higher values in var_dump Percentage

Help me fix it, please.

Body:
It is necessary to check the array diff_prices (RSI, EMA and MACD), determine the highest indicator in the percentage field in the checked pairs and get all its values (symbols, future_price, spot_price, percentage).

My function:

function satisfies_rules($symbol, $closing_prices, $diff_prices) {
    // Calculate the RSI and EMA values using the PECL trader extension
    $rsi = trader_rsi($closing_prices, 6);
    $ema16 = trader_ema($closing_prices, 16);
    $ema48 = trader_ema($closing_prices, 48);
    $ema200 = trader_ema($closing_prices, 200);

    // Get the last values of the RSI, EMA, and MACD arrays
    $rsi = end($rsi);
    $ema16 = end($ema16);
    $ema48 = end($ema48);
    $ema200 = end($ema200);

    $macd = end(array_slice(trader_macd($closing_prices, 12, 26, 9), -1)[0]);
    $macd = sprintf("%f", $macd);

    // Check if the symbol satisfies the rules
    if ($rsi > 70) {
        // If the symbol satisfies the rules, return the symbol, future_price, and spot_price
        //var_dump($diff_prices[$symbol]);
        return $diff_prices[$symbol];
    }
}

My index code:

// Check if the PECL trader extension is available
if (function_exists('trader_macd')) {
// Initialize an array to store the symbols that satisfy the rules
$valid_symbols = array();

// Iterate over the $responses array
foreach ($responses as $symbol => $candle_data) {
    // Extract the closing prices from the candle data
    $closing_prices = array_column($candle_data, 4);

    // Check if the symbol satisfies the rules
    if ($response = satisfies_rules($symbol, $closing_prices, $diff_prices)) {
        // If the symbol satisfies the rules, add it to the $valid_symbols array
        $valid_symbols[$symbol] = $diff_prices[$symbol]; //var_dump($valid_symbols[$symbol]['percentage']);
        var_dump($valid_symbols[$symbol]);// check

    }
}

// Print the symbol, future_price, and spot_price
//var_dump($valid_symbols);
$max_symbol = array_keys($valid_symbols, max($valid_symbols))[0];

$future_price = $valid_symbols[$max_symbol]['future_price'];
$spot_price = $valid_symbols[$max_symbol]['spot_price'];
$percentage = $valid_symbols[$max_symbol]['percentage'];

echo "Symbol: $max_symbol\n";
echo "Future price: $future_price\n";
echo "Spot price: $spot_price\n";
echo "Percentage: $percentage\n";

}

As a result, I get an incorrect selection.

Symbol: ENSUSDT Future price: 11.191 Spot price: 11.22000000 Percentage: 0.25913680636225

There are higher values in var_dump Percentage

Help me fix it, please.


问:
I want to add feature like MIUI Toolbox feature in my android app which on swiped open app popups. See the pic below for more reference
I want to add a feature like this in my android app. The feature shows a small vertical bar on the screen and when swiped we can see a popup like the one shown in the picture below.

If you have any idea how I can implement it please share it.


问:
Increasing the API rate limit when trying to configure a self-hosted github runner
I have been using a self-hosted github runner for a few months now. It was working well for all along until at one point it stopped connecting to github.

I tried to run the connectivity check using ./config.sh --check  and I got the following message in the generated log file.

```<code>Http response body: {"message":"API rate limit exceeded for x.x.x.x. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}

</code>```

It seems the runner has exceeded the API rate limit. I am not sure know how that happened because it supposed to be 60 API requests per hour and the runner was basically idling for some days before this happened.
The documentation URL mentioned in the error message above does contain information on how to increase the rate limit but it does not mention anything about how to do that when using self-hosted runners. Can someone point me in the right direction?

Body:
I have been using a self-hosted github runner for a few months now. It was working well for all along until at one point it stopped connecting to github.

I tried to run the connectivity check using ./config.sh --check  and I got the following message in the generated log file.

Http response body: {"message":"API rate limit exceeded for x.x.x.x. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)","documentation_url":"https://docs.github.com/rest/overview/resources-in-the-rest-api#rate-limiting"}

It seems the runner has exceeded the API rate limit. I am not sure know how that happened because it supposed to be 60 API requests per hour and the runner was basically idling for some days before this happened.
The documentation URL mentioned in the error message above does contain information on how to increase the rate limit but it does not mention anything about how to do that when using self-hosted runners. Can someone point me in the right direction?


问:
NSOutlineView with usesAutomaticRowHeights causes log "WARNING: Application performed a reentrant operation in its NSTableView delegate."
What does this warning mean? In my main app, whenever this warning is logged, the outline view begins to behave weirdly after that, overlapping rows and not responding to clicks anymore. When not using automatic row heights or group rows, the warning doesn't appear anymore.

An interesting thing is that even if there are no group rows, simply implementing the data source method

```<code>func outlineView(_ outlineView: NSOutlineView, isGroupItem item: Any) -> Bool {
    return false
}
</code>```

makes the warning appear.

Here is the full code:

```<code>import Cocoa

class ViewController: NSViewController, NSOutlineViewDataSource, NSOutlineViewDelegate {

    var outlineView: NSOutlineView!

    let data: Any = [[[[[[[0], [0, [0,0,0]]], [0, [0, [0,0]],0,0,0,0,0]]], [[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],1]]]]

    override func loadView() {
        outlineView = NSOutlineView(dataSource: self, delegate: self, columns: [
            NSTableColumn(identifier: "", title: "", width: 400),
            NSTableColumn(identifier: "", title: "", width: 100)
        ])
        let scrollView = NSScrollView(documentView: outlineView)
        view = NSView()
        view.addSubview(scrollView)
        NSLayoutConstraint.constrain(scrollView, toMarginsOf: view, edgeInsets: .zero)
        outlineView.reloadData()
        expandItem(data)
    }

    private func expandItem(_ item: Any) {
        if let item = item as? [Any] {
            outlineView.expandItem(item)
            for content in item {
                expandItem(content)
            }
        }
    }

    func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool {
        return item is [Any]
    }

    func outlineView(_ outlineView: NSOutlineView, isGroupItem item: Any) -> Bool {
        return false
    }

    func outlineView(_ outlineView: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int {
        return ((item ?? data) as! [Any]).count
    }

    func outlineView(_ outlineView: NSOutlineView, child index: Int, ofItem item: Any?) -> Any {
        return ((item ?? data) as! [Any])[index]
    }

    func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
        let view = NSTableCellView()
        return view
    }

}

extension NSOutlineView {

    convenience init(dataSource: NSOutlineViewDataSource, delegate: NSOutlineViewDelegate, columns: [NSTableColumn]) {
        self.init()
        self.dataSource = dataSource
        self.delegate = delegate
        for column in columns {
            addTableColumn(column)
        }
        usesAutomaticRowHeights = true
    }

}

extension NSTableColumn {

    convenience init(identifier: String, title: String, width: Double, minWidth: Double = 10, maxWidth: Double = .infinity) {
        self.init(identifier: NSUserInterfaceItemIdentifier(identifier))
        self.title = title
        self.width = width
        self.minWidth = minWidth
        self.maxWidth = maxWidth
    }

}

extension NSLayoutConstraint {

    static func constrain(_ view: NSView, toMarginsOf superview: NSView, edgeInsets: NSEdgeInsets) {
        NSLayoutConstraint.activate([NSLayoutConstraint(item: view, attribute: .top, relatedBy: .equal, toItem: superview, attribute: .top, multiplier: 1, constant: edgeInsets.top), NSLayoutConstraint(item: view, attribute: .left, relatedBy: .equal, toItem: superview, attribute: .left, multiplier: 1, constant: edgeInsets.left), NSLayoutConstraint(item: superview, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: edgeInsets.bottom), NSLayoutConstraint(item: superview, attribute: .right, relatedBy: .equal, toItem: view, attribute: .right, multiplier: 1, constant: edgeInsets.right)])
    }

}

extension NSEdgeInsets {

    static var zero: NSEdgeInsets {
        return NSEdgeInsets(all: 0)
    }

    init(all: Double) {
        self.init(top: all, left: all, bottom: all, right: all)
    }

}

extension NSScrollView {

    convenience init(documentView: NSView) {
        self.init()
        self.documentView = documentView
        hasVerticalScroller = true
        translatesAutoresizingMaskIntoConstraints = false
    }
}
</code>```

Body:
What does this warning mean? In my main app, whenever this warning is logged, the outline view begins to behave weirdly after that, overlapping rows and not responding to clicks anymore. When not using automatic row heights or group rows, the warning doesn't appear anymore.

An interesting thing is that even if there are no group rows, simply implementing the data source method

func outlineView(_ outlineView: NSOutlineView, isGroupItem item: Any) -> Bool {
    return false
}

makes the warning appear.

Here is the full code:

import Cocoa

class ViewController: NSViewController, NSOutlineViewDataSource, NSOutlineViewDelegate {

    var outlineView: NSOutlineView!

    let data: Any = [[[[[[[0], [0, [0,0,0]]], [0, [0, [0,0]],0,0,0,0,0]]], [[[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]],1]]]]

    override func loadView() {
        outlineView = NSOutlineView(dataSource: self, delegate: self, columns: [
            NSTableColumn(identifier: "", title: "", width: 400),
            NSTableColumn(identifier: "", title: "", width: 100)
        ])
        let scrollView = NSScrollView(documentView: outlineView)
        view = NSView()
        view.addSubview(scrollView)
        NSLayoutConstraint.constrain(scrollView, toMarginsOf: view, edgeInsets: .zero)
        outlineView.reloadData()
        expandItem(data)
    }

    private func expandItem(_ item: Any) {
        if let item = item as? [Any] {
            outlineView.expandItem(item)
            for content in item {
                expandItem(content)
            }
        }
    }

    func outlineView(_ outlineView: NSOutlineView, isItemExpandable item: Any) -> Bool {
        return item is [Any]
    }

    func outlineView(_ outlineView: NSOutlineView, isGroupItem item: Any) -> Bool {
        return false
    }

    func outlineView(_ outlineView: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int {
        return ((item ?? data) as! [Any]).count
    }

    func outlineView(_ outlineView: NSOutlineView, child index: Int, ofItem item: Any?) -> Any {
        return ((item ?? data) as! [Any])[index]
    }

    func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
        let view = NSTableCellView()
        return view
    }

}

extension NSOutlineView {

    convenience init(dataSource: NSOutlineViewDataSource, delegate: NSOutlineViewDelegate, columns: [NSTableColumn]) {
        self.init()
        self.dataSource = dataSource
        self.delegate = delegate
        for column in columns {
            addTableColumn(column)
        }
        usesAutomaticRowHeights = true
    }

}

extension NSTableColumn {

    convenience init(identifier: String, title: String, width: Double, minWidth: Double = 10, maxWidth: Double = .infinity) {
        self.init(identifier: NSUserInterfaceItemIdentifier(identifier))
        self.title = title
        self.width = width
        self.minWidth = minWidth
        self.maxWidth = maxWidth
    }

}

extension NSLayoutConstraint {

    static func constrain(_ view: NSView, toMarginsOf superview: NSView, edgeInsets: NSEdgeInsets) {
        NSLayoutConstraint.activate([NSLayoutConstraint(item: view, attribute: .top, relatedBy: .equal, toItem: superview, attribute: .top, multiplier: 1, constant: edgeInsets.top), NSLayoutConstraint(item: view, attribute: .left, relatedBy: .equal, toItem: superview, attribute: .left, multiplier: 1, constant: edgeInsets.left), NSLayoutConstraint(item: superview, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: edgeInsets.bottom), NSLayoutConstraint(item: superview, attribute: .right, relatedBy: .equal, toItem: view, attribute: .right, multiplier: 1, constant: edgeInsets.right)])
    }

}

extension NSEdgeInsets {

    static var zero: NSEdgeInsets {
        return NSEdgeInsets(all: 0)
    }

    init(all: Double) {
        self.init(top: all, left: all, bottom: all, right: all)
    }

}

extension NSScrollView {

    convenience init(documentView: NSView) {
        self.init()
        self.documentView = documentView
        hasVerticalScroller = true
        translatesAutoresizingMaskIntoConstraints = false
    }
}


问:
CSS/Keyframes: problem with animation in second class of the selector
I have a problem with the animation. I added an animation that lasts 5 seconds to the .carousel selector. Then to the same selector I gave a new class where there was a second animation. The problem is that the second animation works and the first one doesn't. I want the first animation to start first and then the second. How to do it?

```<code>
.carousel {
  width: 100%;
  overflow: hidden;
  position: relative;
  height: 200px;
  display: flex;
  background-color: white;
  flex-direction: column;
  justify-content: center;
  animation: animateOne 5s ease-out;
          animation-fill-mode: forwards;
          animation-delay: 1s;
          opacity: 0;
}
.carousel.second{
  animation: animateTwo 5s ease-out;
          animation-fill-mode: forwards;
          animation-delay: 7s;

}

@keyframes animateOne{
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
    background-color: blue;
  }

}
@keyframes animateTwo{
  0% {
    background-color: blue;
  }

  100% {
    opacity: 1;
    background-color: red;
  }

}
</code>```

Body:
I have a problem with the animation. I added an animation that lasts 5 seconds to the .carousel selector. Then to the same selector I gave a new class where there was a second animation. The problem is that the second animation works and the first one doesn't. I want the first animation to start first and then the second. How to do it?

.carousel {
  width: 100%;
  overflow: hidden;
  position: relative;
  height: 200px;
  display: flex;
  background-color: white;
  flex-direction: column;
  justify-content: center;
  animation: animateOne 5s ease-out;
          animation-fill-mode: forwards;
          animation-delay: 1s;
          opacity: 0;
}
.carousel.second{
  animation: animateTwo 5s ease-out;
          animation-fill-mode: forwards;
          animation-delay: 7s;

}

@keyframes animateOne{
  0% {
    opacity: 0;
  }

  100% {
    opacity: 1;
    background-color: blue;
  }

}
@keyframes animateTwo{
  0% {
    background-color: blue;
  }

  100% {
    opacity: 1;
    background-color: red;
  }

}


问:
the fragments do not replace each other but are superimposed android studio
I'm trying to replace a fragment in a tabbed activity with another, when I search online I find people using FragmentLayout or View but I can't find a solution that works. This is my first application, sorry if the code is not optimized.

MainActivity.java :
`

```<code>public class MainActivity extends AppCompatActivity implements View.OnClickListener{
    public ViewPager viewPager;
    public FragmentAbstract fragmentActuel;
    public FragmentAbstract fragmentAncien;
    public VPAdapter vpAdapter;
    public String message;

    public ViewModelFactory viewModelFactory;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //on récupere le container des tableau par son id
        TabLayout tabLayout = findViewById(R.id.tabs);
        //page de base
        viewPager = findViewById(R.id.view_pager);

        //on definit la page de base
        tabLayout.setupWithViewPager(viewPager);

        viewModelFactory = new ViewModelFactory(this);

        //on ajouter les fragments dans la page de base
        this.vpAdapter = new VPAdapter(getSupportFragmentManager(),  FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
        this.fragmentActuel = new Fragment_repetition_home(this);
        this.fragmentAncien = fragmentActuel;
        vpAdapter.addfragment(fragmentActuel,"REPETITION");
        vpAdapter.addfragment(new Fragment_technique_home(this),"TECHNIQUE");
        vpAdapter.addfragment(new Fragment_figure_home(this),"FIGURE");
        viewPager.setAdapter(vpAdapter);

        //pour dire que l'on veut 3 pages en arrière plan
        viewPager.setOffscreenPageLimit(3);

    }
}
</code>```

VPAdapter.java :

```<code>public class VPAdapter extends FragmentPagerAdapter {
    private ArrayList<FragmentAbstract> fragmentArrayList = new ArrayList<>();
    private final ArrayList<String> fragmentTitle = new ArrayList<>();

    public VPAdapter(@NonNull FragmentManager fm, int behavior) {
        super(fm, behavior);
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragmentArrayList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentArrayList.size();
    }

    public void addfragment(FragmentAbstract fragment, String title){

        fragmentArrayList.add(fragment);
        fragmentTitle.add(title);
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return fragmentTitle.get(position);
    }

    //pour changer les fragments dans la liste
    public void changeFragment(MainActivity mainActivity) {
        if (!mainActivity.fragmentAncien.equals(mainActivity.fragmentActuel)) {
            int index = fragmentArrayList.indexOf(((FragmentAbstract) mainActivity.vpAdapter.getItem(mainActivity.viewPager.getCurrentItem())));
            fragmentArrayList.set(index,mainActivity.fragmentActuel);
        }
    }
}
</code>```

activity_main.xml :

```<code><?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/Theme.MonProgramme.AppBarOverlay">

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:minHeight="?actionBarSize"
            android:padding="@dimen/appbar_padding"
            android:text="@string/app_name"
            android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" />

        <com.google.android.material.tabs.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <com.google.android.material.tabs.TabItem
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="REPETITION"/>

            <com.google.android.material.tabs.TabItem
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="FIGURE"/>

            <com.google.android.material.tabs.TabItem
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="TECHNIQUE"/>
        </com.google.android.material.tabs.TabLayout>
    </com.google.android.material.appbar.AppBarLayout>

    <androidx.viewpager.widget.ViewPager
        android:id="@+id/view_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</code>```

fragment_figure_home.xml :

```<code><?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/figure_home"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

    <ListView
        android:id="@+id/selection_figure"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true">
    </ListView>

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/button_plus_figure"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="@dimen/fab_margin"
        android:layout_marginBottom="16dp"
        android:src="@drawable/ic_plus"
        android:backgroundTint="@color/grey_2"
        android:onClick="onClick"/>
</FrameLayout>
</code>```

Do you have a idea for replace the fragment not superimposed ?

Body:
I'm trying to replace a fragment in a tabbed activity with another, when I search online I find people using FragmentLayout or View but I can't find a solution that works. This is my first application, sorry if the code is not optimized.

MainActivity.java :
`

public class MainActivity extends AppCompatActivity implements View.OnClickListener{
    public ViewPager viewPager;
    public FragmentAbstract fragmentActuel;
    public FragmentAbstract fragmentAncien;
    public VPAdapter vpAdapter;
    public String message;

    public ViewModelFactory viewModelFactory;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //on récupere le container des tableau par son id
        TabLayout tabLayout = findViewById(R.id.tabs);
        //page de base
        viewPager = findViewById(R.id.view_pager);

        //on definit la page de base
        tabLayout.setupWithViewPager(viewPager);

        viewModelFactory = new ViewModelFactory(this);

        //on ajouter les fragments dans la page de base
        this.vpAdapter = new VPAdapter(getSupportFragmentManager(),  FragmentPagerAdapter.BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);
        this.fragmentActuel = new Fragment_repetition_home(this);
        this.fragmentAncien = fragmentActuel;
        vpAdapter.addfragment(fragmentActuel,"REPETITION");
        vpAdapter.addfragment(new Fragment_technique_home(this),"TECHNIQUE");
        vpAdapter.addfragment(new Fragment_figure_home(this),"FIGURE");
        viewPager.setAdapter(vpAdapter);

        //pour dire que l'on veut 3 pages en arrière plan
        viewPager.setOffscreenPageLimit(3);

    }
}

VPAdapter.java :

public class VPAdapter extends FragmentPagerAdapter {
    private ArrayList<FragmentAbstract> fragmentArrayList = new ArrayList<>();
    private final ArrayList<String> fragmentTitle = new ArrayList<>();

    public VPAdapter(@NonNull FragmentManager fm, int behavior) {
        super(fm, behavior);
    }

    @NonNull
    @Override
    public Fragment getItem(int position) {
        return fragmentArrayList.get(position);
    }

    @Override
    public int getCount() {
        return fragmentArrayList.size();
    }

    public void addfragment(FragmentAbstract fragment, String title){

        fragmentArrayList.add(fragment);
        fragmentTitle.add(title);
    }

    @Nullable
    @Override
    public CharSequence getPageTitle(int position) {
        return fragmentTitle.get(position);
    }

    //pour changer les fragments dans la liste
    public void changeFragment(MainActivity mainActivity) {
        if (!mainActivity.fragmentAncien.equals(mainActivity.fragmentActuel)) {
            int index = fragmentArrayList.indexOf(((FragmentAbstract) mainActivity.vpAdapter.getItem(mainActivity.viewPager.getCurrentItem())));
            fragmentArrayList.set(index,mainActivity.fragmentActuel);
        }
    }
}

activity_main.xml :

<?xml version="1.0" encoding="utf-8"?>
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

    <com.google.android.material.appbar.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/Theme.MonProgramme.AppBarOverlay">

        <TextView
            android:id="@+id/title"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:gravity="center"
            android:minHeight="?actionBarSize"
            android:padding="@dimen/appbar_padding"
            android:text="@string/app_name"
            android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" />

        <com.google.android.material.tabs.TabLayout
            android:id="@+id/tabs"
            android:layout_width="match_parent"
            android:layout_height="wrap_content" >

            <com.google.android.material.tabs.TabItem
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="REPETITION"/>

            <com.google.android.material.tabs.TabItem
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="FIGURE"/>

            <com.google.android.material.tabs.TabItem
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="TECHNIQUE"/>
        </com.google.android.material.tabs.TabLayout>
    </com.google.android.material.appbar.AppBarLayout>

    <androidx.viewpager.widget.ViewPager
        android:id="@+id/view_pager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

fragment_figure_home.xml :

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/figure_home"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">

    <ListView
        android:id="@+id/selection_figure"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true">
    </ListView>

    <com.google.android.material.floatingactionbutton.FloatingActionButton
        android:id="@+id/button_plus_figure"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_marginEnd="@dimen/fab_margin"
        android:layout_marginBottom="16dp"
        android:src="@drawable/ic_plus"
        android:backgroundTint="@color/grey_2"
        android:onClick="onClick"/>
</FrameLayout>

Do you have a idea for replace the fragment not superimposed ?


问:
Microsoft Graph API: Fetch attachments for a particular email not an entire email thread
I am using Microsoft Graph API to get attachments of particular email.

```<code>https://graph.microsoft.com/v1.0/users/<user-id>/messages/<message_id>/attachments
</code>```

Above API returns attachments from previous conversation thread as well.

Suppose a mail was started and it had bunch of replies with attachments and my latest email contains only one attachment and in entire email there are like 5 attachments with latest message-id if i try to fetch attachment instead of returning 1 attachment, it returns all attachment.

Is there any filter available just to get that particular attachment of the given mail.

i tried to get attachments of that particular sent mail but instead i am getting attachments of entire thread

Body:
I am using Microsoft Graph API to get attachments of particular email.

https://graph.microsoft.com/v1.0/users/<user-id>/messages/<message_id>/attachments

Above API returns attachments from previous conversation thread as well.

Suppose a mail was started and it had bunch of replies with attachments and my latest email contains only one attachment and in entire email there are like 5 attachments with latest message-id if i try to fetch attachment instead of returning 1 attachment, it returns all attachment.

Is there any filter available just to get that particular attachment of the given mail.

i tried to get attachments of that particular sent mail but instead i am getting attachments of entire thread


问:
Calculate the confidence score for the machine learning results
I have applied Xgboost classifier to classify my output. I already included the probability by using  predict_proba. However, I would like to add a confidence interval score to show how confident the model is or</p>
```<code>import xgboost as xgb
xgb_model = xgb.XGBClassifier(base_score=0.2, booster='gbtree', colsample_bylevel=1,
              colsample_bynode=1, colsample_bytree=1, enable_categorical=False,
              gamma=0, gpu_id=-1, importance_type=None,
              interaction_constraints='', learning_rate=0.300000012,
              max_delta_step=0, max_depth=40, min_child_weight=1,
              monotone_constraints='()', n_estimators=100, n_jobs=10,
              num_parallel_tree=1, objective='multi:softprob', predictor='auto',
              random_state=0, reg_alpha=0, reg_lambda=1, scale_pos_weight=None,
              subsample=1, tree_method='exact', validate_parameters=1,
              verbosity=None)
xgb_model.fit(X_train_vectors_tfidf, y_train)

y_predict = xgb_model.predict(X_test_vectors_tfidf)
y_prob = xgb_model.predict_proba(X_test_vectors_tfidf)[:,1]
print(classification_report(y_test,y_predict))
print('Confusion Matrix:',confusion_matrix(y_test, y_predict))

</code>```

Body:
I have applied Xgboost classifier to classify my output. I already included the probability by using  predict_proba. However, I would like to add a confidence interval score to show how confident the model is or

import xgboost as xgb
xgb_model = xgb.XGBClassifier(base_score=0.2, booster='gbtree', colsample_bylevel=1,
              colsample_bynode=1, colsample_bytree=1, enable_categorical=False,
              gamma=0, gpu_id=-1, importance_type=None,
              interaction_constraints='', learning_rate=0.300000012,
              max_delta_step=0, max_depth=40, min_child_weight=1,
              monotone_constraints='()', n_estimators=100, n_jobs=10,
              num_parallel_tree=1, objective='multi:softprob', predictor='auto',
              random_state=0, reg_alpha=0, reg_lambda=1, scale_pos_weight=None,
              subsample=1, tree_method='exact', validate_parameters=1,
              verbosity=None)
xgb_model.fit(X_train_vectors_tfidf, y_train)

y_predict = xgb_model.predict(X_test_vectors_tfidf)
y_prob = xgb_model.predict_proba(X_test_vectors_tfidf)[:,1]
print(classification_report(y_test,y_predict))
print('Confusion Matrix:',confusion_matrix(y_test, y_predict))


问:
Using ThreadGroups with Spring Boot
I wan`t to use following library in Spring Boot: https://github.com/hbci4j/hbci4java.

Unfortunately this library is not that nice, so depending on the Documentation (German) I should run this Library inside a ThreadGroup (Because of Configuration)

Therefore I would like to know how to run an @Async Method from SpringBoot inside a ThreadGroup (and I need to change the ThreadGroup Name)

Title: Using ThreadGroups with Spring Boot


问:
How to decrypt on frontend which is encrypted on backend using crypto
Data is encrypted with the below code, is there any option to decrypt on the front-end if know the key and iv?</p>
```<code>const algorithm = 'aes-256-ctr';
 // const algorithm = 'aes-128-cbc';
 let inVec = crypto.randomBytes(16);
 const secret = 'salted';
 const key = crypto.createHash('sha256').update(String(secret)).digest('base64').substr(0, 32);
 const cipher = crypto.createCipheriv(algorithm, key, key.substr(0, 16))
 let encrypt = cipher.update(name, 'utf8', 'base64')
 encrypt = encrypt + cipher.final();
</code>```

Body:
Data is encrypted with the below code, is there any option to decrypt on the front-end if know the key and iv?

const algorithm = 'aes-256-ctr';
 // const algorithm = 'aes-128-cbc';
 let inVec = crypto.randomBytes(16);
 const secret = 'salted';
 const key = crypto.createHash('sha256').update(String(secret)).digest('base64').substr(0, 32);
 const cipher = crypto.createCipheriv(algorithm, key, key.substr(0, 16))
 let encrypt = cipher.update(name, 'utf8', 'base64')
 encrypt = encrypt + cipher.final();