问:
merging plots from 2 models from sjplot
I need two models' plots combined into one graph, as seen in the image below. model 1 estimate's top line and model 2 estimates's bottom line.
I create the graph using one model, but I'm not sure how to incorporate an estimate from another model.

library(sjPlot)
library(sjlabelled)
library(sjmisc)
library(ggplot2)
library(MASS)
library(pscl)
library(boot)

zinb <- zeroinfl(ivdays~age,
                 link="logit",
                 dist = "negbin",
                 data=caterpillor)

summary(zinb)
plot_model(zinb, type="est")

zinb <- zeroinfl(ivdays~age+sex+edu,
                 link="logit",
                 dist = "negbin",
                 data=caterpillor)

summary(zinb)
plot_model(zinb, type="est", terms = c("count_ageb", "count_agec", "zero_ageb", "zero_agec"))

############ second model#######

zinb_sub <- zeroinfl(ivdays~age,
                     link="logit",
                     dist = "negbin",
                     data=subset(caterpillor, country=="eng"))

summary(zinb_sub)
plot_model(zinb_sub, type="est")

zinb_sub2 <- zeroinfl(ivdays~age+sex+edu,
                 link="logit",
                 dist = "negbin",
                 data=subset(caterpillor, country=="eng"))

summary(zinb_sub2)

plot_model(zinb_sub2, type="est", terms = c("count_ageb", "count_agec", "zero_ageb", "zero_agec"))

```
<p>Data:</p>
```caterpillor=structure(list(id = 1:100,
               age = structure(c(1L, 1L, 2L, 1L,
                                 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L, 3L, 3L,
                                 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 2L, 1L, 2L, 2L,
                                 2L, 3L, 3L, 3L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L,
                                 2L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L,
                                 3L, 3L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 2L, 1L,
                                 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L, 3L, 3L),
                               .Label = c("a", "b", "c"), class = "factor"),
               sex = structure(c(2L,
                                 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 1L,
                                 1L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L,
                                 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L,
                                 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L,
                                 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L,
                                 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L,
                                 2L, 1L, 1L),
                               .Label = c("F", "M"), class = "factor"),
               country = structure(c(1L,
                                     1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L, 3L, 3L,
                                     2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L,
                                     1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L,
                                     2L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L,
                                     3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L,
                                     1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L, 3L, 3L,
                                     2L, 2L, 2L),
                                   .Label = c("eng", "scot", "wale"), class = "factor"),
               edu = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
                                 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L,
                                 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
                                 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L,
                                 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
                                 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L,
                                 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L),
                               .Label = c("x", "y", "z"), class = "factor"),
               lungfunction = c(45L,
                                23L, 25L, 45L, 70L, 69L, 90L, 50L, 62L, 45L, 23L, 25L, 45L,
                                70L, 69L, 90L, 50L, 62L, 45L, 23L, 25L, 45L, 70L, 69L, 90L,
                                50L, 62L, 45L, 23L, 25L, 45L, 70L, 69L, 90L, 50L, 62L, 45L,
                                23L, 25L, 45L, 70L, 69L, 90L, 50L, 62L, 45L, 23L, 25L, 45L,
                                70L, 69L, 90L, 50L, 62L, 45L, 23L, 25L, 45L, 70L, 69L, 90L,
                                50L, 62L, 45L, 23L, 25L, 45L, 70L, 69L, 90L, 50L, 62L, 45L,
                                23L, 25L, 45L, 70L, 69L, 90L, 50L, 62L, 25L, 45L, 70L, 69L,
                                90L, 50L, 62L, 25L, 45L, 70L, 69L, 90L, 50L, 62L, 25L, 45L,
                                70L, 69L, 90L),
               ivdays = c(15L, 26L, 36L, 34L, 2L, 4L, 5L,
                          8L, 9L, 15L, 26L, 36L, 34L, 2L, 4L, 5L, 8L, 9L, 15L, 26L,
                          0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
                          0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
                          0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
                          0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
                          0L, 0L, 0L, 0L, 0L, 5L, 8L, 9L, 36L, 34L, 2L, 4L, 5L, 8L,
                          9L, 36L, 34L, 2L, 4L, 5L),
               no2_quintile = structure(c(1L,
                                          1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                          1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
                                          2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
                                          3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
                                          3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L,
                                          4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L,
                                          5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L),
                                        .Label = c("q1", "q2",
                                                   "q3", "q4", "q5"), class = "factor")),
          class = "data.frame", row.names = c(NA,
                                              -100L))
```

Title: merging plots from 2 models from sjplot

Body:
I need two models' plots combined into one graph, as seen in the image below. model 1 estimate's top line and model 2 estimates's bottom line.
I create the graph using one model, but I'm not sure how to incorporate an estimate from another model.

library(sjPlot)
library(sjlabelled)
library(sjmisc)
library(ggplot2)
library(MASS)
library(pscl)
library(boot)

zinb <- zeroinfl(ivdays~age,
                 link="logit",
                 dist = "negbin",
                 data=caterpillor)

summary(zinb)
plot_model(zinb, type="est")

zinb <- zeroinfl(ivdays~age+sex+edu,
                 link="logit",
                 dist = "negbin",
                 data=caterpillor)

summary(zinb)
plot_model(zinb, type="est", terms = c("count_ageb", "count_agec", "zero_ageb", "zero_agec"))

############ second model#######

zinb_sub <- zeroinfl(ivdays~age,
                     link="logit",
                     dist = "negbin",
                     data=subset(caterpillor, country=="eng"))

summary(zinb_sub)
plot_model(zinb_sub, type="est")

zinb_sub2 <- zeroinfl(ivdays~age+sex+edu,
                 link="logit",
                 dist = "negbin",
                 data=subset(caterpillor, country=="eng"))

summary(zinb_sub2)

plot_model(zinb_sub2, type="est", terms = c("count_ageb", "count_agec", "zero_ageb", "zero_agec"))

Data:

caterpillor=structure(list(id = 1:100,
               age = structure(c(1L, 1L, 2L, 1L,
                                 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L, 3L, 3L,
                                 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 2L, 1L, 2L, 2L,
                                 2L, 3L, 3L, 3L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L,
                                 2L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L,
                                 3L, 3L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 2L, 1L,
                                 2L, 2L, 2L, 3L, 3L, 3L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 3L, 3L, 3L),
                               .Label = c("a", "b", "c"), class = "factor"),
               sex = structure(c(2L,
                                 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 1L,
                                 1L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L,
                                 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L,
                                 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L,
                                 2L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L,
                                 2L, 2L, 1L, 1L, 1L, 1L, 2L, 2L, 1L, 1L, 1L, 1L, 2L, 1L, 2L, 2L,
                                 2L, 1L, 1L),
                               .Label = c("F", "M"), class = "factor"),
               country = structure(c(1L,
                                     1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L, 3L, 3L,
                                     2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L,
                                     1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L,
                                     2L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L,
                                     3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L,
                                     1L, 1L, 1L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 3L, 3L, 3L,
                                     2L, 2L, 2L),
                                   .Label = c("eng", "scot", "wale"), class = "factor"),
               edu = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
                                 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L,
                                 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
                                 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L,
                                 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
                                 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L,
                                 2L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 2L, 2L, 2L, 3L, 3L, 3L, 3L),
                               .Label = c("x", "y", "z"), class = "factor"),
               lungfunction = c(45L,
                                23L, 25L, 45L, 70L, 69L, 90L, 50L, 62L, 45L, 23L, 25L, 45L,
                                70L, 69L, 90L, 50L, 62L, 45L, 23L, 25L, 45L, 70L, 69L, 90L,
                                50L, 62L, 45L, 23L, 25L, 45L, 70L, 69L, 90L, 50L, 62L, 45L,
                                23L, 25L, 45L, 70L, 69L, 90L, 50L, 62L, 45L, 23L, 25L, 45L,
                                70L, 69L, 90L, 50L, 62L, 45L, 23L, 25L, 45L, 70L, 69L, 90L,
                                50L, 62L, 45L, 23L, 25L, 45L, 70L, 69L, 90L, 50L, 62L, 45L,
                                23L, 25L, 45L, 70L, 69L, 90L, 50L, 62L, 25L, 45L, 70L, 69L,
                                90L, 50L, 62L, 25L, 45L, 70L, 69L, 90L, 50L, 62L, 25L, 45L,
                                70L, 69L, 90L),
               ivdays = c(15L, 26L, 36L, 34L, 2L, 4L, 5L,
                          8L, 9L, 15L, 26L, 36L, 34L, 2L, 4L, 5L, 8L, 9L, 15L, 26L,
                          0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
                          0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
                          0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
                          0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
                          0L, 0L, 0L, 0L, 0L, 5L, 8L, 9L, 36L, 34L, 2L, 4L, 5L, 8L,
                          9L, 36L, 34L, 2L, 4L, 5L),
               no2_quintile = structure(c(1L,
                                          1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
                                          1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
                                          2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
                                          3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
                                          3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L,
                                          4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L, 5L, 5L,
                                          5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L, 5L),
                                        .Label = c("q1", "q2",
                                                   "q3", "q4", "q5"), class = "factor")),
          class = "data.frame", row.names = c(NA,
                                              -100L))


来源: stackexchange

问:
Create networkx from polygon geometry type
does anyone how to create a networkx if my geojson contained polygon geometry type? I can see that this documentation https://networkx.org/documentation/stable/auto_examples/geospatial/plot_polygons.html provide us how to create networkx from polygon but it is not able to retrieve the attribute data (G.edges(data=true)) instead it only shows the weight.</p>

ContentLicense: CC BY-SA 4.0


问:
Multiple screen avplayer on tizen
Can i play 4 screens on tizen by avplayer ?
I mean 4 live channel playing on the same time .

Can i play 4 screens on tizen by avplayer ?
I mean 4 live channel playing on the same time .

Title: Multiple screen avplayer on tizen


问:
How I create Multilingual WordPress Website without plugins
I was wondering for many days now how to make a multilingual website without any plugin.

THE PROBLEM is that i want to stay in the same page, can't do it with multisite

Is there any better solution?

I already made the pot file and converted from EN to FR with subdirectory and so on moving from one to another with a link.


问:
BLOB/TEXT column used in key specification without key length (1170)?
I have a table in my SQL Server database that I am trying to migrate to MySQL(MariaDB). The table in SQL Server has a column called "column1" that is causing the table migration to error out. When I checked the original table in SQL Server, that column is a unique key which is the primary key with datatype nvarchar(255). I'm not sure what the error is telling me. Is the length of the column too big to be a primary key? Do I need to get rid of the unique key altogether (I don't want to do that). Also, I am seeing the same 1170 error on about ~230 other tables on a column in those tables that are also the primary key. How do I fix this? I did some research online and saw possibly setting SET GLOBAL innodb_file_format=Barracuda; may work? I'm trying to find a solution where I can fix whatever limit is on the columns all at once so I don't have to individually go in each of the ~230 tables and fix each column one by one. Also, I ran SHOW GLOBAL VARIABLES LIKE 'innodb_fil%' and it returned this:

```<code>innodb_file_format
innodb_file_per_table   ON
innodb_fill_factor  100
</code>```

I'm not sure if this means anything useful or if I should change something here...

Body:
I have a table in my SQL Server database that I am trying to migrate to MySQL(MariaDB). The table in SQL Server has a column called "column1" that is causing the table migration to error out. When I checked the original table in SQL Server, that column is a unique key which is the primary key with datatype nvarchar(255). I'm not sure what the error is telling me. Is the length of the column too big to be a primary key? Do I need to get rid of the unique key altogether (I don't want to do that). Also, I am seeing the same 1170 error on about ~230 other tables on a column in those tables that are also the primary key. How do I fix this? I did some research online and saw possibly setting SET GLOBAL innodb_file_format=Barracuda; may work? I'm trying to find a solution where I can fix whatever limit is on the columns all at once so I don't have to individually go in each of the ~230 tables and fix each column one by one. Also, I ran SHOW GLOBAL VARIABLES LIKE 'innodb_fil%' and it returned this:

innodb_file_format
innodb_file_per_table   ON
innodb_fill_factor  100

I'm not sure if this means anything useful or if I should change something here...


问:
Framework to perform hyperparameter optimization for LSTM with meta-heuristic algorithms?
I need hyperparameter optimization for Lstm.I will use meta-heuristic i.e particle swarm optimization or artificial bee colony algorithms but ı have no idea how to code,ı decided to use framework.ı could not find framework that works with metaheuristic for Lstm.May you help me? I am using nasa turbofan dataset.

I am coding on google colab


问:
Connection to Cloud SQL works fin on local but not on App Engine
I have this NodeJS API hosted on App Engine and a MySQL instance on Cloud SQL

I'm using mysql2 and dotenv packages for my connection and for environment variables access, here's how I create the connection:

```<code>import mysql from "mysql2";
import * as dotenv from "dotenv";
dotenv.config();

export const db =
    process.env.NODE_ENV === "development"
        ? mysql.createConnection({
                host: process.env.DB_HOST,
                user: process.env.DB_USER,
                password: process.env.DB_PASS,
                database: process.env.DB_NAME,
          })
        : mysql.createConnection({
                user: process.env.DB_USER,
                password: process.env.DB_PASS,
                database: process.env.DB_NAME,
                socketPath: `/cloudsql/${process.env.DB_INSTANCE_NAME}`,
          });
</code>```

I get to this connection creation by reading the official documentation of GCP, when I run it locally it works just fine, but when I deploy the app to App Engine I'm receiving this error:

```<code>Error: getaddrinfo ENOTFOUND 172.17.0.1:3306
</code>```

I think that ip and port are the defaults for the proxy connection or something like that because I'm not setting that ip on any variable

Here's how I set the environment variables on app.yaml

```<code>runtime: nodejs14
env: standard
instance_class: F1
automatic_scaling:
   min_idle_instances: 1
   max_idle_instances: automatic
   min_pending_latency: automatic
   max_pending_latency: automatic
env_variables:
   DB_USER: <db-user>
   DB_PASS: <db-pass>
   DB_NAME: <db-name>
   NODE_ENV: production
   DB_INSTANCE_NAME: <db-instance-name>
beta_settings:
   cloud_sql_instances: <db-instance-name>
</code>```

I've already check that the service user has the right permissions and roles

I don't know if I'm missing some configuration or if my app.yaml need another thing

I have tried to add the ip host directly in the connection creation but I'm getting the same behavior

```<code>export const db =
    process.env.NODE_ENV === "development"
        ? mysql.createConnection({
                host: process.env.DB_HOST,
                user: process.env.DB_USER,
                password: process.env.DB_PASS,
                database: process.env.DB_NAME,
          })
        : mysql.createConnection({
                                host: process.env.DB_HOST,
                user: process.env.DB_USER,
                password: process.env.DB_PASS,
                database: process.env.DB_NAME,
                socketPath: `/cloudsql/${process.env.DB_INSTANCE_NAME}`,
          });
</code>```

I have been fighting with this issue for three days, so any help will be very appreciated for me

Thanks in advance.

Body:
I have this NodeJS API hosted on App Engine and a MySQL instance on Cloud SQL

I'm using mysql2 and dotenv packages for my connection and for environment variables access, here's how I create the connection:

import mysql from "mysql2";
import * as dotenv from "dotenv";
dotenv.config();

export const db =
    process.env.NODE_ENV === "development"
        ? mysql.createConnection({
                host: process.env.DB_HOST,
                user: process.env.DB_USER,
                password: process.env.DB_PASS,
                database: process.env.DB_NAME,
          })
        : mysql.createConnection({
                user: process.env.DB_USER,
                password: process.env.DB_PASS,
                database: process.env.DB_NAME,
                socketPath: `/cloudsql/${process.env.DB_INSTANCE_NAME}`,
          });

I get to this connection creation by reading the official documentation of GCP, when I run it locally it works just fine, but when I deploy the app to App Engine I'm receiving this error:

Error: getaddrinfo ENOTFOUND 172.17.0.1:3306

I think that ip and port are the defaults for the proxy connection or something like that because I'm not setting that ip on any variable

Here's how I set the environment variables on app.yaml

runtime: nodejs14
env: standard
instance_class: F1
automatic_scaling:
   min_idle_instances: 1
   max_idle_instances: automatic
   min_pending_latency: automatic
   max_pending_latency: automatic
env_variables:
   DB_USER: <db-user>
   DB_PASS: <db-pass>
   DB_NAME: <db-name>
   NODE_ENV: production
   DB_INSTANCE_NAME: <db-instance-name>
beta_settings:
   cloud_sql_instances: <db-instance-name>

I've already check that the service user has the right permissions and roles

I don't know if I'm missing some configuration or if my app.yaml need another thing

I have tried to add the ip host directly in the connection creation but I'm getting the same behavior

export const db =
    process.env.NODE_ENV === "development"
        ? mysql.createConnection({
                host: process.env.DB_HOST,
                user: process.env.DB_USER,
                password: process.env.DB_PASS,
                database: process.env.DB_NAME,
          })
        : mysql.createConnection({
                                host: process.env.DB_HOST,
                user: process.env.DB_USER,
                password: process.env.DB_PASS,
                database: process.env.DB_NAME,
                socketPath: `/cloudsql/${process.env.DB_INSTANCE_NAME}`,
          });

I have been fighting with this issue for three days, so any help will be very appreciated for me

Thanks in advance.


问:
Pyarrow unable to load libhdfs on Windows 10
I am trying to use pyarrow on Windows but I'm getting the following error with fs.HadoopFileSystem() :

```<code>OSError                                   Traceback (most recent call last)
Cell In[1], line 2
      1 from pyarrow import fs
----> 2 hdfs = fs.HadoopFileSystem(host='localhost', port=9870)

File c:\prj\study\.venv\lib\site-packages\pyarrow\_hdfs.pyx:96, in pyarrow._hdfs.HadoopFileSystem.__init__()

File c:\prj\study\.venv\lib\site-packages\pyarrow\error.pxi:144, in pyarrow.lib.pyarrow_internal_check_status()

File c:\prj\study\.venv\lib\site-packages\pyarrow\error.pxi:115, in pyarrow.lib.check_status()

OSError: Unable to load libhdfs: 指定されたモジュールが見つかりません。
</code>```

I followed the steps on this site to install Hadoop using binaries from Apache and I am able to use it through cmd. However when I checked lbhdfs.so in lib/native, it shows as a 0 kb file. Is this normal, or do I have to compile Hadoop source on my own so I could get the correct libhdfs.so?

Body:
I am trying to use pyarrow on Windows but I'm getting the following error with fs.HadoopFileSystem() :

OSError                                   Traceback (most recent call last)
Cell In[1], line 2
      1 from pyarrow import fs
----> 2 hdfs = fs.HadoopFileSystem(host='localhost', port=9870)

File c:\prj\study\.venv\lib\site-packages\pyarrow\_hdfs.pyx:96, in pyarrow._hdfs.HadoopFileSystem.__init__()

File c:\prj\study\.venv\lib\site-packages\pyarrow\error.pxi:144, in pyarrow.lib.pyarrow_internal_check_status()

File c:\prj\study\.venv\lib\site-packages\pyarrow\error.pxi:115, in pyarrow.lib.check_status()

OSError: Unable to load libhdfs: 指定されたモジュールが見つかりません。

I followed the steps on this site to install Hadoop using binaries from Apache and I am able to use it through cmd. However when I checked lbhdfs.so in lib/native, it shows as a 0 kb file. Is this normal, or do I have to compile Hadoop source on my own so I could get the correct libhdfs.so?


问:
clang-format adds newline before typedef name when struct defined with macro __PACKED_STRUCT
I am running clang-format on my C code which includes a large number of packed structs like this.  It keeps moving the typedef name onto a new line following the closing brace.  Is there a way I can update my .clang-format file to fix this?

This is the input (I want it to be unchanged)

```<code>typedef __PACKED_STRUCT nv_iis_VersionInfo_s
{
    uint8_t versionMajor;
    uint8_t versionMinor;
    uint8_t versionRevision;
} nv_iis_VersionInfo_t;
</code>```

clang-format produces this output:

```<code>typedef __PACKED_STRUCT nv_iis_VersionInfo_s
{
    uint8_t versionMajor;
    uint8_t versionMinor;
    uint8_t versionRevision;
}
nv_iis_VersionInfo_t;
</code>```

The problem is related to the __PACKED_STRUCT macro.  If this was a regular struct like this it works as expected:

```<code>typedef struct nv_iis_VersionInfo_s
{
    uint8_t versionMajor;
    uint8_t versionMinor;
    uint8_t versionRevision;
} nv_iis_VersionInfo_t;
</code>```

Body:
I am running clang-format on my C code which includes a large number of packed structs like this.  It keeps moving the typedef name onto a new line following the closing brace.  Is there a way I can update my .clang-format file to fix this?

This is the input (I want it to be unchanged)

typedef __PACKED_STRUCT nv_iis_VersionInfo_s
{
    uint8_t versionMajor;
    uint8_t versionMinor;
    uint8_t versionRevision;
} nv_iis_VersionInfo_t;

clang-format produces this output:

typedef __PACKED_STRUCT nv_iis_VersionInfo_s
{
    uint8_t versionMajor;
    uint8_t versionMinor;
    uint8_t versionRevision;
}
nv_iis_VersionInfo_t;

The problem is related to the __PACKED_STRUCT macro.  If this was a regular struct like this it works as expected:

typedef struct nv_iis_VersionInfo_s
{
    uint8_t versionMajor;
    uint8_t versionMinor;
    uint8_t versionRevision;
} nv_iis_VersionInfo_t;


问:
Android studio app developing.Can somebody help me breakdown this part of my code.It's 100% where my error is
i'm tring to figure out where my app does not pass data.
Here is my login fragment

```<code>package com.example.progettoprogrammazione.intro

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.navigation.findNavController
import com.example.progettoprogrammazione.R
import com.example.progettoprogrammazione.activity.EmployeeActivity
import com.example.progettoprogrammazione.activity.UserActivity
import com.example.progettoprogrammazione.activity.RestaurateurActivity
import com.example.progettoprogrammazione.databinding.FragmentLoginBinding
import com.example.progettoprogrammazione.models.Dipendente
import com.example.progettoprogrammazione.models.Restaurant
import com.example.progettoprogrammazione.models.dipendenteList
import com.example.progettoprogrammazione.utils.*
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
import com.google.firebase.database.FirebaseDatabase
import com.google.firebase.database.ValueEventListener

class FragmentLogin : Fragment(), UserUtil,DipendenteUtil,RestaurantUtils {
private lateinit var binding: FragmentLoginBinding
override var firebaseAuth: FirebaseAuth = FirebaseAuth.getInstance()
override var firebaseDatabase: FirebaseDatabase = FirebaseDatabase.getInstance()

private lateinit var restArrayList: ArrayList<Restaurant>
private lateinit var dipArrayList: ArrayList<Dipendente>

private var userlvl: String? = null

override fun onCreateView(
    inflater: LayoutInflater,
    container: ViewGroup?,
    savedInstanceState: Bundle?
): View? {
    binding = FragmentLoginBinding.inflate(layoutInflater)
    return binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

    firebaseAuth = FirebaseAuth.getInstance()

    binding.ConstraintLogin.setOnClickListener() {
        val email = binding.email.text.toString()
        val password = binding.password.text.toString()

        if (email.isNotEmpty() && password.isNotEmpty()) {
            firebaseAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener {
                if (it.isSuccessful) {

                    //FUNZIONE CHE PRENDE DATI RISTORANTI

                    /*
                    FUNZIONE CHE PRENDE I DATI DI DIPENDENTE

                    dipArrayList = arrayListOf()
                    getDipendenteData(object : FireBaseCallbackDipendente {
                        override fun onResponse(response: ResponseDipendente) {
                            dipArrayList = response.dipendenti
                        }
                    }, context)
                    */

                    //LOGIN
                    getUserData(object : FireBaseCallbackUser {
                        override fun onResponse(response: ResponseUser) {
                            userlvl = response.user!!.Livello

                            Toast.makeText(context,"Login effettuato con successo!", Toast.LENGTH_LONG).show()

                            when (userlvl) {
                                "1" -> {
                                    getRestaurantData(object : FireBaseCallbackRestaurant {
                                        override fun onResponse(responseR: ResponseRistorante) {
                                            restArrayList = responseR.ristoranti
                                            val args = Bundle()
                                            args.putParcelableArrayList("listaRistoranti", restArrayList)
                                            val intent =
                                                Intent(context, UserActivity::class.java).apply {
                                                    putExtra("user", response.user)
                                                    putExtra("listaRistoranti", responseR.ristoranti)
                                                }
                                            startActivity(intent)
                                            activity?.finish()
                                        }
                                    }, context)
                                }
                                "2" -> {
                                    getRestaurantData(object : FireBaseCallbackRestaurant {
                                        override fun onResponse(responseR: ResponseRistorante) {
                                            restArrayList = arrayListOf()
                                            restArrayList = responseR.ristoranti
                                            val args = Bundle()
                                            args.putParcelableArrayList("listaRistoranti", restArrayList)
                                            val intent =
                                                Intent(context, EmployeeActivity::class.java).apply {
                                                    putExtra("user", response.user)
                                                    putExtra("listaRistoranti", responseR.ristoranti)
                                                }
                                            startActivity(intent)
                                            activity?.finish()
                                        }
                                    }, context)
                                }
                                "3" -> {
                                    getRestaurantData(object : FireBaseCallbackRestaurant {
                                        override fun onResponse(responseR: ResponseRistorante) {
                                            restArrayList = arrayListOf()
                                            restArrayList = responseR.ristoranti
                                            val args = Bundle()
                                            args.putParcelableArrayList("listaRistoranti", restArrayList)
                                            //args.putSerializable("arraylist", restArrayList)
                                            val intent =
                                                Intent(context, RestaurateurActivity::class.java).apply {
                                                    putExtra("user", response.user)
                                                    putExtra("ristoranti", args)
                                                }
                                            startActivity(intent)
                                            activity?.finish()
                                        }
                                    }, context)
                                }
                                else -> {
                                    Toast.makeText(
                                        context,
                                        "Errore durante il caricamento.",
                                        Toast.LENGTH_LONG
                                    ).show()
                                }
                            }
                        }
                    }, context)
                } else Toast.makeText(
                    context,
                    "Email e password non corrispondono!",
                    Toast.LENGTH_LONG
                ).show()
            }
        } else {
            Toast.makeText(context, "Nessun campo può essere vuoto!", Toast.LENGTH_LONG).show()
        }
    }

    binding.noaccount.setOnClickListener {
        view.findNavController().navigate(R.id.LoginToRegister)
    }

}
</code>```

}

I wanted to focus on this portion of code

```<code>getRestaurantData(object : FireBaseCallbackRestaurant {
                                    override fun onResponse(responseR: ResponseRistorante) {
                                        restArrayList = responseR.ristoranti
                                        val args = Bundle()
                                        args.putParcelableArrayList("listaRistoranti", restArrayList)
                                        val intent =
                                            Intent(context, UserActivity::class.java).apply {
                                                putExtra("user", response.user)
                                                putExtra("listaRistoranti", responseR.ristoranti)
                                            }
                                        startActivity(intent)
                                        activity?.finish()
                                    }
                                }, context)
                            }
</code>```

Here it's my userActivity class

```<code>package com.example.progettoprogrammazione.activity

import android.content.Context
import android.content.Intent
import android.graphics.Rect
import android.os.Bundle
import android.view.MotionEvent
import android.view.View
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import com.example.progettoprogrammazione.R
import com.example.progettoprogrammazione.databinding.ActivityUserBinding
import com.example.progettoprogrammazione.fragment.FragmentRistoranti
import com.example.progettoprogrammazione.models.Restaurant
import com.example.progettoprogrammazione.models.User
import com.google.firebase.auth.FirebaseAuth

class UserActivity : AppCompatActivity() {
private lateinit var binding: ActivityUserBinding

private lateinit var user: FirebaseAuth

private var pressedTime = 0L

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    binding = ActivityUserBinding.inflate(layoutInflater)
    setContentView(binding.root)

    user = FirebaseAuth.getInstance()

    val u = intent.getParcelableExtra("user") as User?
    val bundleU = Bundle()
    bundleU.putParcelable("user", u)

    val r = intent.getParcelableArrayListExtra<Restaurant>("listaRistoranti") as ArrayList<Restaurant>?
    val bundleR = Bundle()
    bundleR.putParcelableArrayList("listaRistoranti", r)

    binding.navbarUser.setOnNavigationItemSelectedListener {
        when (it.itemId) {
            R.id.ic_ristorantiU -> {
                val navController = this.findNavController(R.id.user_nav)
                navController.navigate(R.id.Ristoranti_U, bundleR)
            }
            R.id.ic_profileU -> {
                val navController = this.findNavController(R.id.user_nav)
                navController.navigate(R.id.Profilo_U, bundleU)
            }
            R.id.ic_logoutU -> {
                user.signOut()
                Toast.makeText(this, "Logout effettuato con successo", Toast.LENGTH_LONG).show()
                val intent = Intent(this, IntroActivity::class.java)
                startActivity(intent)
                finish()
            }
        }
        true
    }
}

override fun onBackPressed() {
    if (pressedTime + 2000 > System.currentTimeMillis()) {
        super.onBackPressed()
        finishAffinity()
    } else {
        Toast.makeText(baseContext, "Premi indietro di nuovo per uscire.", Toast.LENGTH_SHORT).show()
    }
    pressedTime = System.currentTimeMillis()
}

override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {

    if (ev?.action == MotionEvent.ACTION_UP) {
        val v: View? = currentFocus
        if (v is EditText) {
            val outRect = Rect()
            v.getGlobalVisibleRect(outRect)
            if (!outRect.contains(ev.rawX.toInt(), ev.rawY.toInt())) {
                v.clearFocus()
                val imm: InputMethodManager =
                    getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
                imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0)
            }
        }
    }
    return super.dispatchTouchEvent(ev)
}
</code>```

}

In particular at this lines of code,cause I tried debbugging as you can see here , only to find out that I get null so I guess I'm not getting data from the intent (more in depth from

putExtra("listaRistoranti", responseR.ristoranti)

this line of code)

```<code>val r = intent.getParcelableArrayListExtra<Restaurant>("listaRistoranti") as ArrayList<Restaurant>?
val bundleR = Bundle()
bundleR.putParcelableArrayList("listaRistoranti", r)
</code>```

can somebody help me and also explain what I did wrong

Body:
i'm tring to figure out where my app does not pass data.
Here is my login fragment

package com.example.progettoprogrammazione.intro

import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.navigation.findNavController
import com.example.progettoprogrammazione.R
import com.example.progettoprogrammazione.activity.EmployeeActivity
import com.example.progettoprogrammazione.activity.UserActivity
import com.example.progettoprogrammazione.activity.RestaurateurActivity
import com.example.progettoprogrammazione.databinding.FragmentLoginBinding
import com.example.progettoprogrammazione.models.Dipendente
import com.example.progettoprogrammazione.models.Restaurant
import com.example.progettoprogrammazione.models.dipendenteList
import com.example.progettoprogrammazione.utils.*
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.database.DataSnapshot
import com.google.firebase.database.DatabaseError
import com.google.firebase.database.FirebaseDatabase
import com.google.firebase.database.ValueEventListener

class FragmentLogin : Fragment(), UserUtil,DipendenteUtil,RestaurantUtils {
private lateinit var binding: FragmentLoginBinding
override var firebaseAuth: FirebaseAuth = FirebaseAuth.getInstance()
override var firebaseDatabase: FirebaseDatabase = FirebaseDatabase.getInstance()

private lateinit var restArrayList: ArrayList<Restaurant>
private lateinit var dipArrayList: ArrayList<Dipendente>

private var userlvl: String? = null

override fun onCreateView(
    inflater: LayoutInflater,
    container: ViewGroup?,
    savedInstanceState: Bundle?
): View? {
    binding = FragmentLoginBinding.inflate(layoutInflater)
    return binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
    super.onViewCreated(view, savedInstanceState)

    firebaseAuth = FirebaseAuth.getInstance()

    binding.ConstraintLogin.setOnClickListener() {
        val email = binding.email.text.toString()
        val password = binding.password.text.toString()

        if (email.isNotEmpty() && password.isNotEmpty()) {
            firebaseAuth.signInWithEmailAndPassword(email, password).addOnCompleteListener {
                if (it.isSuccessful) {

                    //FUNZIONE CHE PRENDE DATI RISTORANTI

                    /*
                    FUNZIONE CHE PRENDE I DATI DI DIPENDENTE

                    dipArrayList = arrayListOf()
                    getDipendenteData(object : FireBaseCallbackDipendente {
                        override fun onResponse(response: ResponseDipendente) {
                            dipArrayList = response.dipendenti
                        }
                    }, context)
                    */

                    //LOGIN
                    getUserData(object : FireBaseCallbackUser {
                        override fun onResponse(response: ResponseUser) {
                            userlvl = response.user!!.Livello

                            Toast.makeText(context,"Login effettuato con successo!", Toast.LENGTH_LONG).show()

                            when (userlvl) {
                                "1" -> {
                                    getRestaurantData(object : FireBaseCallbackRestaurant {
                                        override fun onResponse(responseR: ResponseRistorante) {
                                            restArrayList = responseR.ristoranti
                                            val args = Bundle()
                                            args.putParcelableArrayList("listaRistoranti", restArrayList)
                                            val intent =
                                                Intent(context, UserActivity::class.java).apply {
                                                    putExtra("user", response.user)
                                                    putExtra("listaRistoranti", responseR.ristoranti)
                                                }
                                            startActivity(intent)
                                            activity?.finish()
                                        }
                                    }, context)
                                }
                                "2" -> {
                                    getRestaurantData(object : FireBaseCallbackRestaurant {
                                        override fun onResponse(responseR: ResponseRistorante) {
                                            restArrayList = arrayListOf()
                                            restArrayList = responseR.ristoranti
                                            val args = Bundle()
                                            args.putParcelableArrayList("listaRistoranti", restArrayList)
                                            val intent =
                                                Intent(context, EmployeeActivity::class.java).apply {
                                                    putExtra("user", response.user)
                                                    putExtra("listaRistoranti", responseR.ristoranti)
                                                }
                                            startActivity(intent)
                                            activity?.finish()
                                        }
                                    }, context)
                                }
                                "3" -> {
                                    getRestaurantData(object : FireBaseCallbackRestaurant {
                                        override fun onResponse(responseR: ResponseRistorante) {
                                            restArrayList = arrayListOf()
                                            restArrayList = responseR.ristoranti
                                            val args = Bundle()
                                            args.putParcelableArrayList("listaRistoranti", restArrayList)
                                            //args.putSerializable("arraylist", restArrayList)
                                            val intent =
                                                Intent(context, RestaurateurActivity::class.java).apply {
                                                    putExtra("user", response.user)
                                                    putExtra("ristoranti", args)
                                                }
                                            startActivity(intent)
                                            activity?.finish()
                                        }
                                    }, context)
                                }
                                else -> {
                                    Toast.makeText(
                                        context,
                                        "Errore durante il caricamento.",
                                        Toast.LENGTH_LONG
                                    ).show()
                                }
                            }
                        }
                    }, context)
                } else Toast.makeText(
                    context,
                    "Email e password non corrispondono!",
                    Toast.LENGTH_LONG
                ).show()
            }
        } else {
            Toast.makeText(context, "Nessun campo può essere vuoto!", Toast.LENGTH_LONG).show()
        }
    }

    binding.noaccount.setOnClickListener {
        view.findNavController().navigate(R.id.LoginToRegister)
    }

}

}

I wanted to focus on this portion of code

getRestaurantData(object : FireBaseCallbackRestaurant {
                                    override fun onResponse(responseR: ResponseRistorante) {
                                        restArrayList = responseR.ristoranti
                                        val args = Bundle()
                                        args.putParcelableArrayList("listaRistoranti", restArrayList)
                                        val intent =
                                            Intent(context, UserActivity::class.java).apply {
                                                putExtra("user", response.user)
                                                putExtra("listaRistoranti", responseR.ristoranti)
                                            }
                                        startActivity(intent)
                                        activity?.finish()
                                    }
                                }, context)
                            }

Here it's my userActivity class

package com.example.progettoprogrammazione.activity

import android.content.Context
import android.content.Intent
import android.graphics.Rect
import android.os.Bundle
import android.view.MotionEvent
import android.view.View
import android.view.inputmethod.InputMethodManager
import android.widget.EditText
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.navigation.findNavController
import com.example.progettoprogrammazione.R
import com.example.progettoprogrammazione.databinding.ActivityUserBinding
import com.example.progettoprogrammazione.fragment.FragmentRistoranti
import com.example.progettoprogrammazione.models.Restaurant
import com.example.progettoprogrammazione.models.User
import com.google.firebase.auth.FirebaseAuth

class UserActivity : AppCompatActivity() {
private lateinit var binding: ActivityUserBinding

private lateinit var user: FirebaseAuth

private var pressedTime = 0L

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    binding = ActivityUserBinding.inflate(layoutInflater)
    setContentView(binding.root)

    user = FirebaseAuth.getInstance()

    val u = intent.getParcelableExtra("user") as User?
    val bundleU = Bundle()
    bundleU.putParcelable("user", u)

    val r = intent.getParcelableArrayListExtra<Restaurant>("listaRistoranti") as ArrayList<Restaurant>?
    val bundleR = Bundle()
    bundleR.putParcelableArrayList("listaRistoranti", r)

    binding.navbarUser.setOnNavigationItemSelectedListener {
        when (it.itemId) {
            R.id.ic_ristorantiU -> {
                val navController = this.findNavController(R.id.user_nav)
                navController.navigate(R.id.Ristoranti_U, bundleR)
            }
            R.id.ic_profileU -> {
                val navController = this.findNavController(R.id.user_nav)
                navController.navigate(R.id.Profilo_U, bundleU)
            }
            R.id.ic_logoutU -> {
                user.signOut()
                Toast.makeText(this, "Logout effettuato con successo", Toast.LENGTH_LONG).show()
                val intent = Intent(this, IntroActivity::class.java)
                startActivity(intent)
                finish()
            }
        }
        true
    }
}

override fun onBackPressed() {
    if (pressedTime + 2000 > System.currentTimeMillis()) {
        super.onBackPressed()
        finishAffinity()
    } else {
        Toast.makeText(baseContext, "Premi indietro di nuovo per uscire.", Toast.LENGTH_SHORT).show()
    }
    pressedTime = System.currentTimeMillis()
}

override fun dispatchTouchEvent(ev: MotionEvent?): Boolean {

    if (ev?.action == MotionEvent.ACTION_UP) {
        val v: View? = currentFocus
        if (v is EditText) {
            val outRect = Rect()
            v.getGlobalVisibleRect(outRect)
            if (!outRect.contains(ev.rawX.toInt(), ev.rawY.toInt())) {
                v.clearFocus()
                val imm: InputMethodManager =
                    getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
                imm.toggleSoftInput(InputMethodManager.HIDE_IMPLICIT_ONLY, 0)
            }
        }
    }
    return super.dispatchTouchEvent(ev)
}

}

In particular at this lines of code,cause I tried debbugging as you can see here , only to find out that I get null so I guess I'm not getting data from the intent (more in depth from

putExtra("listaRistoranti", responseR.ristoranti)

this line of code)

val r = intent.getParcelableArrayListExtra<Restaurant>("listaRistoranti") as ArrayList<Restaurant>?
val bundleR = Bundle()
bundleR.putParcelableArrayList("listaRistoranti", r)

can somebody help me and also explain what I did wrong


问:
For more clarification about react components
In react js or jsx file confusing problem.

In react can I write the file name as home.js or home.jsx? These are not meaning same value?


问:
How to turn on eslint's @typescript-eslint/no-unnecessary-condition rule?
I am getting this "error", which is not correct, I expect last to be null in some cases.

That code block is this:

```<code>const term = stack[stack.length - 1]

if (term.like === 'term') {
  const last = term.link[term.link.length - 1]
  if (
    last &&
    last.like === 'cord' &&
    isDataTokenType(token)
  ) {
    last.cord += token.text
    last.end = token.end
  } else {
    term.link.push({
      like: 'cord',
      cord: token.text,
      start: token.start,
      end: token.end,
      lineNumber: token.lineNumber,
      lineCharacterNumberStart:
        token.lineCharacterNumberStart,
      lineCharacterNumberEnd:
        token.lineCharacterNumberEnd,
    })
  }
}
</code>```

My term type is like this:

```<code>export type ParserTermNodeType = {
  like: 'term'
  link: Array<ParserCordNodeType | ParserTermNodeType>
}

export type ParserCordNodeType = ParserTokenNodeType & {
  like: 'cord'
  cord: string
}

type ParserTokenNodeType = {
  start: number
  end: number
  lineNumber: number
  lineCharacterNumberStart: number
  lineCharacterNumberEnd: number
}
</code>```

I am building a parser, and progressively building up a tree of AST nodes. The ParserTermNodeType might have link.length === 0, so last might really be undefined / not exist yet. Why is it thus saying Unnecessary conditional, value is always truthy. coming from the @typescript-eslint/no-unnecessary-condition rule. I ended up just turning that rule off, but I want to keep it on because the reason when it works, are good reasons to have it on. Why is it not working in my case?

My .eslintrc.json has this (amongst other rules and stuff):

```<code>{
  "rules": {
    "@typescript-eslint/no-unnecessary-condition": [
      2,
      {
        "allowConstantLoopConditions": true
      }
    ]
  }
}
</code>```

Body:
I am getting this "error", which is not correct, I expect last to be null in some cases.

That code block is this:

const term = stack[stack.length - 1]

if (term.like === 'term') {
  const last = term.link[term.link.length - 1]
  if (
    last &&
    last.like === 'cord' &&
    isDataTokenType(token)
  ) {
    last.cord += token.text
    last.end = token.end
  } else {
    term.link.push({
      like: 'cord',
      cord: token.text,
      start: token.start,
      end: token.end,
      lineNumber: token.lineNumber,
      lineCharacterNumberStart:
        token.lineCharacterNumberStart,
      lineCharacterNumberEnd:
        token.lineCharacterNumberEnd,
    })
  }
}

My term type is like this:

export type ParserTermNodeType = {
  like: 'term'
  link: Array<ParserCordNodeType | ParserTermNodeType>
}

export type ParserCordNodeType = ParserTokenNodeType & {
  like: 'cord'
  cord: string
}

type ParserTokenNodeType = {
  start: number
  end: number
  lineNumber: number
  lineCharacterNumberStart: number
  lineCharacterNumberEnd: number
}

I am building a parser, and progressively building up a tree of AST nodes. The ParserTermNodeType might have link.length === 0, so last might really be undefined / not exist yet. Why is it thus saying Unnecessary conditional, value is always truthy. coming from the @typescript-eslint/no-unnecessary-condition rule. I ended up just turning that rule off, but I want to keep it on because the reason when it works, are good reasons to have it on. Why is it not working in my case?

My .eslintrc.json has this (amongst other rules and stuff):

{
  "rules": {
    "@typescript-eslint/no-unnecessary-condition": [
      2,
      {
        "allowConstantLoopConditions": true
      }
    ]
  }
}


问:
How to fix "Failed to scroll to visible" errors after invalid hit points computed during UI tests in Xcode 14.1+?
Our Xcode UI tests were working fine locally and on our CI but suddenly a few spots started failing when we upgraded to Xcode 14.1 (issue is also present on Xcode 14.2).

The affected areas involve scroll views and tapping a button (no UITableView here). These failures occur much of the time, but not always.

When a test fails in these spots the logs show that the computed hit point for the button is {-1, -1} which is invalid because it's off screen (the button is clearly not on screen and if you print out its frame in the console it has valid coordinates). When it doesn't fail the computed hit point is a valid point and it is able to tap the button without issue. In all cases the test is able to find the button and exists is true.

The button isn't even always scrolled out of sight. But even if the test needs to scroll to get the button, tap will always successfully scroll to the button, it just can't tap it if it computes an invalid hit point.

e.g.

t =  2369.32s         Check for interrupting elements affecting "Close" Button

t =  2369.38s         Synthesize event

t =  2369.40s             Scroll element to visible

t =  2369.40s             Find the "Close" Button

t =  2369.43s             Computed hit point {-1, -1} after scrolling to visible

t =  2369.43s             Failed: Failed to scroll to visible (by AX action) Button, {{338.0, 51.0}, {36.0, 36.0}}, label: 'Close', error: Error kAXErrorCannotComplete performing AXAction kAXScrollToVisibleAction on element AX element pid: 28238, elementOrHash.elementID: 4624960864.301

I have tried many different things including adding a swipeUp or swipeDown before the tap, adding a waitForExistence before the tap and a couple other ideas, but nothing has worked consistently.

Is this just an obscure bug in Xcode 14.1+ or is there a fix for this I haven't considered? Never had anything quite like this in Xcode 14 and earlier. But haven't seen any recent complaints around this, and this does seem like a fairly common setup to have in a UI test.

There are a couple pretty old questions complaining of similar-sounding issues but they aren't quite the same and don't have relevant solutions.


问:
ValueError: setting an array element with a sequence in Python
I am currently developing a GUI in Python and have stuck on a function that is supposed to show wipe animation of Image A covering Image B in square frame. When I run the program, I receive these two types of errors:

```<code>TypeError: only size-1 arrays can be converted to Python scalars

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\User\anaconda3\lib\tkinter\__init__.py", line 1705, in __call__
    return self.func(*args)
  File "g:\2020-2021\Python\Python1\PyProject\src\GUI.py", line 83, in apply_transitions
    frame = get_frame(frame_number)
  File "g:\2020-2021\Python\Python1\PyProject\src\GUI.py", line 79, in get_frame
    frame[x,y] = data_B_norm[x,y]
ValueError: setting an array element with a sequence.
</code>```

Here is the code snippet:

```<code>from tkinter import *
from tkinter import filedialog
from PIL import Image, ImageTk
from tkinter import Canvas
from numpy import asarray
import numpy as np
import time

window = Tk()
window.title("Image Transitions")
window.geometry("1200x800")
window.config(background="CornflowerBlue")
window.maxsize(1200, 800)

title1 = Label(window, text="Image 1", width=20)
title1.place(x=180, y=175)
title1.configure(bg="CornflowerBlue")

title2 = Label(window, text="Image 2", width=20)
title2.place(x=530, y=175)
title2.configure(bg="CornflowerBlue")

title3 = Label(window, text="Image Transitions", width=20)
title3.place(x=880, y=175)
title3.configure(bg="CornflowerBlue")

def browse_Image1():
    global image_first, img

    filename = filedialog.askopenfilename(
    initialdir = "/",
    title = "Select a File",
    filetypes = (("2D - JPG", "*.jpg*"), ("2D - PNG", "*.png*"), ("all files", "*.*")))

    img_opened = Image.open(filename)
    img = img_opened.resize((300, 300))
    image_first = ImageTk.PhotoImage(img)

    label = Label(window, image=image_first)
    label.pack()
    label.place(x=100, y=200)

button1 = Button(window, text="Upload Image 1", width=20, command=browse_Image1)
button1.place(x=180, y=510)

def browse_Image2():
    global image_second, img2

    filename = filedialog.askopenfilename(
    initialdir = "/",
    title = "Select a File",
    filetypes = (("2D - JPG", "*.jpg*"), ("2D - PNG", "*.png*"), ("all files", "*.*")))

    img2_opened = Image.open(filename)
    img2 = img2_opened.resize((300, 300))
    image_second = ImageTk.PhotoImage(img2)

    label = Label(window, image=image_second)
    label.pack()
    label.place(x=450, y=200)

button2 = Button(window, text="Upload Image 2", width=20, command=browse_Image2)
button2.place(x=530, y=510)

def apply_transitions():
    ImageA_Width, ImageA_Height = img.size
    data_A_norm = asarray(img2) / 255.0
    data_B_norm = asarray(img) / 255.0

    frame_number = 0

    def get_frame(frame_number):
        frame = np.zeros((ImageA_Height, ImageA_Width)) / 1.0
        for x in range(0, ImageA_Width):
            for y in range(0, ImageA_Height):
                if x < frame_number:
                    frame[x,y] = data_A_norm[x,y] #this is where the issue is
                else:
                    frame[x,y] = data_B_norm[x,y] #this is where the issue is
        return frame

    while frame_number < ImageA_Width:
        frame = get_frame(frame_number)
        image_opened = Image.fromarray(frame)
        shot = ImageTk.PhotoImage(image_opened)
        label = Label(window, image=shot)
        label.pack()
        label.place(x=800, y=200)
        time.sleep(0.1)
        frame_number = frame_number + 1

button3 = Button(window, text="Apply Transitions", width=20, command=apply_transitions)
button3.place(x=880, y=510)

canvas1 = Canvas(window, width=300, height=300)
canvas1.pack()
canvas1.configure(bg="LightSkyBlue")
canvas1.place(x=100, y=200)

canvas2 = Canvas(window, width=300, height=300)
canvas2.pack()
canvas2.configure(bg="LightSkyBlue")
canvas2.place(x=450, y=200)

canvas3 = Canvas(window, width=300, height=300)
canvas3.pack()
canvas3.configure(bg="LightSkyBlue")
canvas3.place(x=800, y=200)
</code>```

Although it is clear to me that the problem is either with the different types of elements of arrays or different dimensions, I can't figure out what exactly is not matching. img and img2 here are Image type objects.

Body:
I am currently developing a GUI in Python and have stuck on a function that is supposed to show wipe animation of Image A covering Image B in square frame. When I run the program, I receive these two types of errors:

TypeError: only size-1 arrays can be converted to Python scalars

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\User\anaconda3\lib\tkinter\__init__.py", line 1705, in __call__
    return self.func(*args)
  File "g:\2020-2021\Python\Python1\PyProject\src\GUI.py", line 83, in apply_transitions
    frame = get_frame(frame_number)
  File "g:\2020-2021\Python\Python1\PyProject\src\GUI.py", line 79, in get_frame
    frame[x,y] = data_B_norm[x,y]
ValueError: setting an array element with a sequence.

Here is the code snippet:

from tkinter import *
from tkinter import filedialog
from PIL import Image, ImageTk
from tkinter import Canvas
from numpy import asarray
import numpy as np
import time

window = Tk()
window.title("Image Transitions")
window.geometry("1200x800")
window.config(background="CornflowerBlue")
window.maxsize(1200, 800)

title1 = Label(window, text="Image 1", width=20)
title1.place(x=180, y=175)
title1.configure(bg="CornflowerBlue")

title2 = Label(window, text="Image 2", width=20)
title2.place(x=530, y=175)
title2.configure(bg="CornflowerBlue")

title3 = Label(window, text="Image Transitions", width=20)
title3.place(x=880, y=175)
title3.configure(bg="CornflowerBlue")

def browse_Image1():
    global image_first, img

    filename = filedialog.askopenfilename(
    initialdir = "/",
    title = "Select a File",
    filetypes = (("2D - JPG", "*.jpg*"), ("2D - PNG", "*.png*"), ("all files", "*.*")))

    img_opened = Image.open(filename)
    img = img_opened.resize((300, 300))
    image_first = ImageTk.PhotoImage(img)

    label = Label(window, image=image_first)
    label.pack()
    label.place(x=100, y=200)

button1 = Button(window, text="Upload Image 1", width=20, command=browse_Image1)
button1.place(x=180, y=510)

def browse_Image2():
    global image_second, img2

    filename = filedialog.askopenfilename(
    initialdir = "/",
    title = "Select a File",
    filetypes = (("2D - JPG", "*.jpg*"), ("2D - PNG", "*.png*"), ("all files", "*.*")))

    img2_opened = Image.open(filename)
    img2 = img2_opened.resize((300, 300))
    image_second = ImageTk.PhotoImage(img2)

    label = Label(window, image=image_second)
    label.pack()
    label.place(x=450, y=200)

button2 = Button(window, text="Upload Image 2", width=20, command=browse_Image2)
button2.place(x=530, y=510)

def apply_transitions():
    ImageA_Width, ImageA_Height = img.size
    data_A_norm = asarray(img2) / 255.0
    data_B_norm = asarray(img) / 255.0

    frame_number = 0

    def get_frame(frame_number):
        frame = np.zeros((ImageA_Height, ImageA_Width)) / 1.0
        for x in range(0, ImageA_Width):
            for y in range(0, ImageA_Height):
                if x < frame_number:
                    frame[x,y] = data_A_norm[x,y] #this is where the issue is
                else:
                    frame[x,y] = data_B_norm[x,y] #this is where the issue is
        return frame

    while frame_number < ImageA_Width:
        frame = get_frame(frame_number)
        image_opened = Image.fromarray(frame)
        shot = ImageTk.PhotoImage(image_opened)
        label = Label(window, image=shot)
        label.pack()
        label.place(x=800, y=200)
        time.sleep(0.1)
        frame_number = frame_number + 1

button3 = Button(window, text="Apply Transitions", width=20, command=apply_transitions)
button3.place(x=880, y=510)

canvas1 = Canvas(window, width=300, height=300)
canvas1.pack()
canvas1.configure(bg="LightSkyBlue")
canvas1.place(x=100, y=200)

canvas2 = Canvas(window, width=300, height=300)
canvas2.pack()
canvas2.configure(bg="LightSkyBlue")
canvas2.place(x=450, y=200)

canvas3 = Canvas(window, width=300, height=300)
canvas3.pack()
canvas3.configure(bg="LightSkyBlue")
canvas3.place(x=800, y=200)

Although it is clear to me that the problem is either with the different types of elements of arrays or different dimensions, I can't figure out what exactly is not matching. img and img2 here are Image type objects.


问:
Wrapping templated functions
I am currently trying my hand at developing a small game engine, and I am using EnTT for the ECS and event system. Because all of the EnTT stuff is just implementation stuff, I don't want to have any of it exposed, so I am developing wrappers for all of the stuff I am going to use.

I am currently trying to wrap the event dispatcher in my own class. Here's how the EnTT event dispatcher is used (from their wiki):

struct an_event { int value; };
struct another_event {};

struct listener {
    void receive(const an_event &) { /* ... */ }
    void method(const another_event &) { /* ... */ }
};

// ...

listener listener;
dispatcher.sink<an_event>().connect<&listener::receive>(listener);
dispatcher.sink<another_event>().connect<&listener::method>(listener);
```
<p>Seems pretty simple, so I tried to do this to wrap just that line up:</p>
<pre class="lang-cpp prettyprint-override"><code>template<typename E, typename L>
void EventManager::subscribe(L listener) {
    dispatcher.sink<E>().connect<&L::receive>(listener);
}
</code>```

And that didn't work, I got this error:

```<code>error: invalid operands of types ‘<unresolved overloaded function type>’ and ‘void (handler::*)(const TestEvent1&)’ to binary ‘operator<’
</code>```

However, I didn't give it much thought, because I wanted to be able to have more than one handler per class anyway, so then I tried to find a way to also pass the handler function itself as a template argument:

template<typename E, typename L, void(L::*callback)(const E&)>
void EventManager::subscribe(L listener) {
    dispatcher.sink<E>().connect<callback>(listener);
}
```

And I got the same result. After this, I tried numerous ways of doing this, and none of them were able to even compile. I even tried wrapping just the connect function by itself, and that didn't work either in any way.

Is this approach even possible? How can I achieve this?

Title: Wrapping templated functions

Body:
I am currently trying my hand at developing a small game engine, and I am using EnTT for the ECS and event system. Because all of the EnTT stuff is just implementation stuff, I don't want to have any of it exposed, so I am developing wrappers for all of the stuff I am going to use.

I am currently trying to wrap the event dispatcher in my own class. Here's how the EnTT event dispatcher is used (from their wiki):

struct an_event { int value; };
struct another_event {};

struct listener {
    void receive(const an_event &) { /* ... */ }
    void method(const another_event &) { /* ... */ }
};

// ...

listener listener;
dispatcher.sink<an_event>().connect<&listener::receive>(listener);
dispatcher.sink<another_event>().connect<&listener::method>(listener);

Seems pretty simple, so I tried to do this to wrap just that line up:

template<typename E, typename L>
void EventManager::subscribe(L listener) {
    dispatcher.sink<E>().connect<&L::receive>(listener);
}

And that didn't work, I got this error:

error: invalid operands of types ‘<unresolved overloaded function type>’ and ‘void (handler::*)(const TestEvent1&)’ to binary ‘operator<’

However, I didn't give it much thought, because I wanted to be able to have more than one handler per class anyway, so then I tried to find a way to also pass the handler function itself as a template argument:

template<typename E, typename L, void(L::*callback)(const E&)>
void EventManager::subscribe(L listener) {
    dispatcher.sink<E>().connect<callback>(listener);
}

And I got the same result. After this, I tried numerous ways of doing this, and none of them were able to even compile. I even tried wrapping just the connect function by itself, and that didn't work either in any way.

Is this approach even possible? How can I achieve this?


问:
How do I scrape multiple urls with the same formatting in R?
I scraped a website already and made a dataframe from it that only contains a column called "racenames" in this example. Each row has its own link that works if I were to take it and put it into a browser, this column is called "realtest.Event". How do I create a scraper that goes through my dataframe of links one by one? I'm not sure if a for loop is the way to go about this or not. If I can use a for loop, what am I doing wrong?

```<code>
res_all <- NULL

for (realtest.Event in racename) {
    urlrunning = paste0(realtest.Event)

  scrapinghere = read_html(urlrunning)

  putithere <- tibble(
      bubba = scrapinghere %>% html_nodes("#sites-canvas-main-content td:nth-child(2)") %>% html_text(),
      bubba2 = scrapinghere %>% html_node("#sites-canvas-main-content td:nth-child(1)")) %>% html_text()

  res_all <- bind_rows(res_all, putithere)
  }
</code>```

My error I'm currently getting is... Error: x must be a string of length 1

Body:
I scraped a website already and made a dataframe from it that only contains a column called "racenames" in this example. Each row has its own link that works if I were to take it and put it into a browser, this column is called "realtest.Event". How do I create a scraper that goes through my dataframe of links one by one? I'm not sure if a for loop is the way to go about this or not. If I can use a for loop, what am I doing wrong?

res_all <- NULL

for (realtest.Event in racename) {
    urlrunning = paste0(realtest.Event)

  scrapinghere = read_html(urlrunning)

  putithere <- tibble(
      bubba = scrapinghere %>% html_nodes("#sites-canvas-main-content td:nth-child(2)") %>% html_text(),
      bubba2 = scrapinghere %>% html_node("#sites-canvas-main-content td:nth-child(1)")) %>% html_text()

  res_all <- bind_rows(res_all, putithere)
  }

My error I'm currently getting is... Error: x must be a string of length 1


问:
how to catch CsvRequiredFieldEmptyException when using openCsv
I use OpenCSV for CSV files reading and writing. I am stuck at handling the exception when a required column is missing in the csv file. Below is the code :

```<code>CsvToBean<T> beans = new CsvToBeanBuilder<T>(new FileReader(file))
          .withType(targetClazz)
          .withFieldAsNull(CSVReaderNullFieldIndicator.BOTH)
          .withThrowExceptions(false)
          .build();

      List<T> correctlyParsed = beans.parse();
      List<String[]> linesWithErrors = buildListOfLinesWithErrors(beans.getCapturedExceptions());
</code>```

This works fine till I receive the all the headers as defined in the Java object. But, if any one is missing, I get the below error:

```<code>Caused by: com.opencsv.exceptions.CsvRequiredFieldEmptyException: Header is missing required fields [X]. The list of headers encountered is [A, B, C, D].
</code>```

This error is caused from line

```<code>List<T> correctlyParsed = beans.parse();
</code>```

The only way I could handle this error is by adding a catch block for RuntimeException. But catching RuntimeException doesn't seem to be good coding.
Please suggest if there is a way around.

Thanks!

Body:
I use OpenCSV for CSV files reading and writing. I am stuck at handling the exception when a required column is missing in the csv file. Below is the code :

CsvToBean<T> beans = new CsvToBeanBuilder<T>(new FileReader(file))
          .withType(targetClazz)
          .withFieldAsNull(CSVReaderNullFieldIndicator.BOTH)
          .withThrowExceptions(false)
          .build();

      List<T> correctlyParsed = beans.parse();
      List<String[]> linesWithErrors = buildListOfLinesWithErrors(beans.getCapturedExceptions());

This works fine till I receive the all the headers as defined in the Java object. But, if any one is missing, I get the below error:

Caused by: com.opencsv.exceptions.CsvRequiredFieldEmptyException: Header is missing required fields [X]. The list of headers encountered is [A, B, C, D].

This error is caused from line

List<T> correctlyParsed = beans.parse();

The only way I could handle this error is by adding a catch block for RuntimeException. But catching RuntimeException doesn't seem to be good coding.
Please suggest if there is a way around.

Thanks!


问:
Windows DDK 4.0 not building some obj files
The sources in the source file are lance.c send.c  request.c  alloc.c    Pcntn3.rc

Builds only:  send.obj   request.obj    alloc.obj    Pcntn3.res

error LNK1181: cannot open input file "obj\i386\lance.obj"

expecting it to build lance.obj so the compiler can do the final linking for the sys file.

Not on the hard drive anywhere.


问:
Getting assert message in SIGABRT handler
I catch problems with this code:

```<code>void handler (int sig) {
    // write error information with a stack trace to disk
}

void set_crash_signals () {
    signal(SIGSEGV, handler);
    signal(SIGABRT, handler);
    signal(SIGFPE, handler);
}
</code>```

Is there a way to get the assert message in the SIGABRT handler?
Is there some other trick I could use?

Body:
I catch problems with this code:

void handler (int sig) {
    // write error information with a stack trace to disk
}

void set_crash_signals () {
    signal(SIGSEGV, handler);
    signal(SIGABRT, handler);
    signal(SIGFPE, handler);
}

Is there a way to get the assert message in the SIGABRT handler?
Is there some other trick I could use?


问:
PyQt5 integrated ROS Subscriber
How to update PyQt5 based GUI with data came from ROS subscriber.

Hi everyone,
I have a subscriber node and this subscriber gets some string data from a selected topic on GUI. I use a comboBox for topic selection. There is a button for start the subscribtion. I can send the data to terminal with loginfo function. But i want to send the data to a textEdit. When i do that there is a error about threads. Because the callback of the subscriber and GUI are working in different threads. I know that i can use Qthread but do you have any examples or ideas about that. How can i merge this code with Qthread or how can i update GUI with data came from subscriber.

```<code>import rospy
from PyQt5 import QtCore, QtGui, QtWidgets
from std_msgs.msg import String
import time

class Ui_MainWindow(object):
    def my_node(self):
        self.topic = self.comboBox.currentText()
        self.sb = rospy.Subscriber(self.topic,String,self.callback_diag,queue_size=1)
        rate = rospy.Rate(10)
        while(not rospy.is_shutdown):
            rate.sleep()

    def callback_diag(self,data):
        if self.topic != self.comboBox.currentText():
            self.sb.unregister()
            time.sleep(1)
        #self.textEdit_diag.setText(str(data)+ "\n") when i use this code i get the error
        rospy.loginfo(data)

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1129, 732)
        . #about GUI design
        . #about GUI design
        . #about GUI design
        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        . #about GUI design
        . #about GUI design
        . #about GUI design

        self.pushButton.clicked.connect(lambda: self.my_node())

if __name__ == "__main__":
    import sys
    rospy.init_node("my_node")
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())

</code>```

Title: PyQt5 integrated ROS Subscriber

Body:
How to update PyQt5 based GUI with data came from ROS subscriber.

Hi everyone,
I have a subscriber node and this subscriber gets some string data from a selected topic on GUI. I use a comboBox for topic selection. There is a button for start the subscribtion. I can send the data to terminal with loginfo function. But i want to send the data to a textEdit. When i do that there is a error about threads. Because the callback of the subscriber and GUI are working in different threads. I know that i can use Qthread but do you have any examples or ideas about that. How can i merge this code with Qthread or how can i update GUI with data came from subscriber.

import rospy
from PyQt5 import QtCore, QtGui, QtWidgets
from std_msgs.msg import String
import time

class Ui_MainWindow(object):
    def my_node(self):
        self.topic = self.comboBox.currentText()
        self.sb = rospy.Subscriber(self.topic,String,self.callback_diag,queue_size=1)
        rate = rospy.Rate(10)
        while(not rospy.is_shutdown):
            rate.sleep()

    def callback_diag(self,data):
        if self.topic != self.comboBox.currentText():
            self.sb.unregister()
            time.sleep(1)
        #self.textEdit_diag.setText(str(data)+ "\n") when i use this code i get the error
        rospy.loginfo(data)

    def setupUi(self, MainWindow):
        MainWindow.setObjectName("MainWindow")
        MainWindow.resize(1129, 732)
        . #about GUI design
        . #about GUI design
        . #about GUI design
        self.retranslateUi(MainWindow)
        QtCore.QMetaObject.connectSlotsByName(MainWindow)

    def retranslateUi(self, MainWindow):
        _translate = QtCore.QCoreApplication.translate
        MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
        . #about GUI design
        . #about GUI design
        . #about GUI design

        self.pushButton.clicked.connect(lambda: self.my_node())

if __name__ == "__main__":
    import sys
    rospy.init_node("my_node")
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())


问:
How to debug a webapp from the Edge browser in iPad?
How to debug a webapp from the Edge browser in iPad? There are no developer tools attached to the browser in the iPad. What will be the best bay to enable debugging webapps in iPad?</p>


问:
How can something be delayed based off of FPS?
I'm trying to make a timing based thing in a game (I have under a week of pygame experience), and I was wondering how to delay something a certain number of ticks, for example end lag in things like fighting games.

I would use pygame.time.delay(), but I want it to be based on ticks, not IRL time.


问:
does anyone know what this warning means?
Does anyone know what this warning (not an error/exception) means?

```<code>W/MetadataUtil( 7942): Failed to parse standard genre code
</code>```

Some audio files triggers this warning and no audio comes out for that particular file.

just_aduio thinks its playing as the positionStream and playingStream shows progression, but with no sound. Other files work without any problem.

This is related the question I asked earlier. However I did not get much help (I do realize my question was lacking a lot of imformation) so in this post I just want to know what this error means.

Body:
Does anyone know what this warning (not an error/exception) means?

W/MetadataUtil( 7942): Failed to parse standard genre code

Some audio files triggers this warning and no audio comes out for that particular file.

just_aduio thinks its playing as the positionStream and playingStream shows progression, but with no sound. Other files work without any problem.

This is related the question I asked earlier. However I did not get much help (I do realize my question was lacking a lot of imformation) so in this post I just want to know what this error means.


问:
Objects don't seem to stay in cache for the duration I expect
I am new to Java Caching System. I am using it on my website. Here is the cache.ccf file:

```<code>jcs.default.cacheattributes=org.apache.commons.jcs3.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=5000
jcs.default.cacheattributes.MemoryCacheName=org.apache.commons.jcs3.engine.memory.lru.LRUMemoryCache

jcs.default.cacheattributes.UseMemoryShrinker=false

jcs.default.elementattributes=org.apache.commons.jcs3.engine.ElementAttributes
jcs.default.elementattributes.IsEternal=true
jcs.default.elementattributes.MaxLife=-1
#7 days
jcs.default.elementattributes.IdleTime=604800
jcs.default.elementattributes.IsSpool=false
jcs.default.elementattributes.IsRemote=false
jcs.default.elementattributes.IsLateral=true

# -------------  AUXILIARY CACHE REGION ---------------

jcs.auxiliary.DC=org.apache.commons.jcs3.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.commons.jcs3.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=E:/jcs

# -------------  REGION pastactivity---------------

jcs.region.pastactivity=
jcs.region.pastactivity.cacheattributes=org.apache.commons.jcs3.engine.CompositeCacheAttributes
jcs.region.pastactivity.cacheattributes.MaxObjects=5000
jcs.region.pastactivity.cacheattributes.MemoryCacheName=org.apache.commons.jcs3.engine.memory.lru.LRUMemoryCache

jcs.region.pastactivity.cacheattributes.UseMemoryShrinker=false

jcs.region.pastactivity.elementattributes=org.apache.commons.jcs3.engine.ElementAttributes
jcs.region.pastactivity.elementattributes.IsEternal=false
#3 days
jcs.region.pastactivity.elementattributes.MaxLife=259200
jcs.region.pastactivity.elementattributes.IdleTime=259100
jcs.region.pastactivity.elementattributes.IsSpool=false
jcs.region.pastactivity.elementattributes.IsRemote=false
jcs.region.pastactivity.elementattributes.IsLateral=true
</code>```

The cache can really improve the site speed, and I can see it. However, the objects stored in cache don't seem to stay in cache for the duration I expect. For example, for objects stored in the pastactivity region, I hope they stay there for 3 days. In tests, they seem to stay in cache for a much shorter period. Is there anything wrong with the settings in the cache.ccf file?

Body:
I am new to Java Caching System. I am using it on my website. Here is the cache.ccf file:

jcs.default.cacheattributes=org.apache.commons.jcs3.engine.CompositeCacheAttributes
jcs.default.cacheattributes.MaxObjects=5000
jcs.default.cacheattributes.MemoryCacheName=org.apache.commons.jcs3.engine.memory.lru.LRUMemoryCache

jcs.default.cacheattributes.UseMemoryShrinker=false

jcs.default.elementattributes=org.apache.commons.jcs3.engine.ElementAttributes
jcs.default.elementattributes.IsEternal=true
jcs.default.elementattributes.MaxLife=-1
#7 days
jcs.default.elementattributes.IdleTime=604800
jcs.default.elementattributes.IsSpool=false
jcs.default.elementattributes.IsRemote=false
jcs.default.elementattributes.IsLateral=true

# -------------  AUXILIARY CACHE REGION ---------------

jcs.auxiliary.DC=org.apache.commons.jcs3.auxiliary.disk.indexed.IndexedDiskCacheFactory
jcs.auxiliary.DC.attributes=org.apache.commons.jcs3.auxiliary.disk.indexed.IndexedDiskCacheAttributes
jcs.auxiliary.DC.attributes.DiskPath=E:/jcs

# -------------  REGION pastactivity---------------

jcs.region.pastactivity=
jcs.region.pastactivity.cacheattributes=org.apache.commons.jcs3.engine.CompositeCacheAttributes
jcs.region.pastactivity.cacheattributes.MaxObjects=5000
jcs.region.pastactivity.cacheattributes.MemoryCacheName=org.apache.commons.jcs3.engine.memory.lru.LRUMemoryCache

jcs.region.pastactivity.cacheattributes.UseMemoryShrinker=false

jcs.region.pastactivity.elementattributes=org.apache.commons.jcs3.engine.ElementAttributes
jcs.region.pastactivity.elementattributes.IsEternal=false
#3 days
jcs.region.pastactivity.elementattributes.MaxLife=259200
jcs.region.pastactivity.elementattributes.IdleTime=259100
jcs.region.pastactivity.elementattributes.IsSpool=false
jcs.region.pastactivity.elementattributes.IsRemote=false
jcs.region.pastactivity.elementattributes.IsLateral=true

The cache can really improve the site speed, and I can see it. However, the objects stored in cache don't seem to stay in cache for the duration I expect. For example, for objects stored in the pastactivity region, I hope they stay there for 3 days. In tests, they seem to stay in cache for a much shorter period. Is there anything wrong with the settings in the cache.ccf file?


问:
Why does the Navbar only toggle to show and not hide on links?
I have been developing a site, the site has a mobile nav bar which expands from the side. The Javascript and HTML show the current state where I have tried to slide the nav bar back in once a link has been pressed. (By slide I mean toggle the nav)

const mobileNavShow = document.querySelector('.mobile-nav-show');
  const mobileNavHide = document.querySelector('.mobile-nav-hide');

  document.querySelectorAll('.mobile-nav-toggle').forEach(el => {
    el.addEventListener('click', function(event) {
      event.preventDefault();
      mobileNavToogle();
    })
  });

  function mobileNavToogle() {
    document.querySelector('body').classList.toggle('mobile-nav-active');
    mobileNavShow.classList.toggle('d-none');
    mobileNavHide.classList.toggle('d-none');
  }```
<pre class="snippet-code-html lang-html prettyprint-override"><code> <i class="mobile-nav-toggle mobile-nav-show bi bi-list"></i>
      <i class="mobile-nav-toggle mobile-nav-hide d-none bi bi-x"></i>
      <nav id="navbar" class="navbar">
        <ul>
          <li>Home</li>
          <li>Why Choose Us</li>
          <li>Products</li>
          <li>Clients</li>
          <li>Our Team</li>
          <li>Contact Us</li>
        </ul>
      </nav></code>```

/*--------------------------------------------------------------
# Mobile Navigation
--------------------------------------------------------------*/
@media (max-width: 1279px) {
  .navbar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    bottom: 0;
    transition: 0.3s;
    z-index: 9997;
  }

  .navbar ul {
    position: absolute;
    inset: 0;
    padding: 50px 0 10px 0;
    margin: 0;
    background: rgba(27, 47, 69, 0.9);
    overflow-y: auto;
    transition: 0.3s;
    z-index: 9998;
  }

  .navbar a,
  .navbar a:focus {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    font-family: var(--font-default);
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    transition: 0.3s;
  }

  .navbar a i,
  .navbar a:focus i {
    font-size: 12px;
    line-height: 0;
    margin-left: 5px;
  }

  .navbar a:hover,
  .navbar .active,
  .navbar .active:focus,
  .navbar li:hover>a {
    color: #fff;
  }

  .navbar .dropdown ul,
  .navbar .dropdown .dropdown ul {
    position: static;
    display: none;
    padding: 10px 0;
    margin: 10px 20px;
    background-color: rgba(20, 35, 51, 0.6);
  }

  .navbar .dropdown>.dropdown-active,
  .navbar .dropdown .dropdown>.dropdown-active {
    display: block;
  }

  .mobile-nav-show {
    color: rgba(255, 255, 255, 0.9);
    font-size: 28px;
    cursor: pointer;
    line-height: 0;
    transition: 0.5s;
  }

  .mobile-nav-hide {
    color: rgba(255, 255, 255, 0.9);
    font-size: 32px;
    cursor: pointer;
    line-height: 0;
    transition: 0.5s;
    position: fixed;
    right: 15px;
    top: 15px;
    z-index: 9999;
  }

  .mobile-nav-active {
    overflow: hidden;
  }

  .mobile-nav-active .navbar {
    right: 0;
  }

  .mobile-nav-active .navbar:before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(27, 47, 69, 0.7);
    z-index: 9996;
  }
}```

I need someone to review this and tell me where I'm going wrong or provide some insight into where I can go from here.

TIA.

Body:
I have been developing a site, the site has a mobile nav bar which expands from the side. The Javascript and HTML show the current state where I have tried to slide the nav bar back in once a link has been pressed. (By slide I mean toggle the nav)

const mobileNavShow = document.querySelector('.mobile-nav-show');
  const mobileNavHide = document.querySelector('.mobile-nav-hide');

  document.querySelectorAll('.mobile-nav-toggle').forEach(el => {
    el.addEventListener('click', function(event) {
      event.preventDefault();
      mobileNavToogle();
    })
  });

  function mobileNavToogle() {
    document.querySelector('body').classList.toggle('mobile-nav-active');
    mobileNavShow.classList.toggle('d-none');
    mobileNavHide.classList.toggle('d-none');
  }

Home

Why Choose Us

Products

Clients

Our Team

Contact Us

/*--------------------------------------------------------------
# Mobile Navigation
--------------------------------------------------------------*/
@media (max-width: 1279px) {
  .navbar {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 400px;
    bottom: 0;
    transition: 0.3s;
    z-index: 9997;
  }

  .navbar ul {
    position: absolute;
    inset: 0;
    padding: 50px 0 10px 0;
    margin: 0;
    background: rgba(27, 47, 69, 0.9);
    overflow-y: auto;
    transition: 0.3s;
    z-index: 9998;
  }

  .navbar a,
  .navbar a:focus {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    font-family: var(--font-default);
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    transition: 0.3s;
  }

  .navbar a i,
  .navbar a:focus i {
    font-size: 12px;
    line-height: 0;
    margin-left: 5px;
  }

  .navbar a:hover,
  .navbar .active,
  .navbar .active:focus,
  .navbar li:hover>a {
    color: #fff;
  }

  .navbar .dropdown ul,
  .navbar .dropdown .dropdown ul {
    position: static;
    display: none;
    padding: 10px 0;
    margin: 10px 20px;
    background-color: rgba(20, 35, 51, 0.6);
  }

  .navbar .dropdown>.dropdown-active,
  .navbar .dropdown .dropdown>.dropdown-active {
    display: block;
  }

  .mobile-nav-show {
    color: rgba(255, 255, 255, 0.9);
    font-size: 28px;
    cursor: pointer;
    line-height: 0;
    transition: 0.5s;
  }

  .mobile-nav-hide {
    color: rgba(255, 255, 255, 0.9);
    font-size: 32px;
    cursor: pointer;
    line-height: 0;
    transition: 0.5s;
    position: fixed;
    right: 15px;
    top: 15px;
    z-index: 9999;
  }

  .mobile-nav-active {
    overflow: hidden;
  }

  .mobile-nav-active .navbar {
    right: 0;
  }

  .mobile-nav-active .navbar:before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(27, 47, 69, 0.7);
    z-index: 9996;
  }
}

I need someone to review this and tell me where I'm going wrong or provide some insight into where I can go from here.

TIA.