问:
How to import a class and tap into its __init__ attributes without initialising it in python?
I am trying to add some futures to my snake game. What I want to do is every third point that the snake eats, there is a mega point and its value is 3 instead of 1.

```<code>from turtle import Turtle
import random

class Food(Turtle):

    def __init__(self):
        super().__init__()
        self.shape("square")
        self.penup()
        self.shapesize(stretch_len=0.5, stretch_wid=0.5)
        self.color("#C9C9C9")
        self.speed(10)
        self.refresh()

    def refresh(self):
        random_x = random.randint(-280, 280)
        random_y = random.randint(-280, 265)
        self.goto(random_x, random_y)
</code>```
```<code>from turtle import Turtle
ALIGNMENT = 'center'
FONT = ('Courier', 22, 'normal')

class Scoreboard(Turtle):

    def __init__(self):
        super().__init__()
        self.score = 0
        with open('data.txt') as data:  # open and reading a file
            self.high_score = int(data.read())
        self.color('white')
        self.penup()
        self.goto(x=0, y=270)
        self.hideturtle()
        self.update_scoreboard()

    def update_scoreboard(self):
        self.clear()
        self.write(f"Score: {self.score} High score: {self.high_score}", align=ALIGNMENT, font=FONT)

    def reset(self):
        if self.score > self.high_score:
            self.high_score = self.score
            with open('data.txt', mode='w') as data:  # writing to a file
                data.write(f"{self.high_score}")
        self.score = 0
        self.update_scoreboard()

    def increase_score(self):
        if self.score % 5 == 0:
            self.score += 3
        else:
            self.score += 1
        self.update_scoreboard()

</code>```

What I thought is to use the modulo% in the scoreboard.py to increase the score attribute by 3 points every third food spawn, and I have managed to do that, the problem is, I do not know how to either tap into the scoreboard score attribute and change the color of the food in relation to the score without having two overlayed scoreboards on screen, or create some kind of loop in food.py that achieves the same functionality by looping through a list of colors.

I've also tried this method answered by another person on here but I couldn't make it work.

```<code>import inspect

params = []
for parent in ExampleParams.mro()[::-1]:
    parent_init = inspect.getfullargspec(parent.__init__)
    # parent_init.annotations contains annotations if specified in method signature
    for param in parent_init.args:
        if param == 'self':
            continue
        params.append(param)
</code>```

Body:
I am trying to add some futures to my snake game. What I want to do is every third point that the snake eats, there is a mega point and its value is 3 instead of 1.

from turtle import Turtle
import random

class Food(Turtle):

    def __init__(self):
        super().__init__()
        self.shape("square")
        self.penup()
        self.shapesize(stretch_len=0.5, stretch_wid=0.5)
        self.color("#C9C9C9")
        self.speed(10)
        self.refresh()

    def refresh(self):
        random_x = random.randint(-280, 280)
        random_y = random.randint(-280, 265)
        self.goto(random_x, random_y)

from turtle import Turtle
ALIGNMENT = 'center'
FONT = ('Courier', 22, 'normal')

class Scoreboard(Turtle):

    def __init__(self):
        super().__init__()
        self.score = 0
        with open('data.txt') as data:  # open and reading a file
            self.high_score = int(data.read())
        self.color('white')
        self.penup()
        self.goto(x=0, y=270)
        self.hideturtle()
        self.update_scoreboard()

    def update_scoreboard(self):
        self.clear()
        self.write(f"Score: {self.score} High score: {self.high_score}", align=ALIGNMENT, font=FONT)

    def reset(self):
        if self.score > self.high_score:
            self.high_score = self.score
            with open('data.txt', mode='w') as data:  # writing to a file
                data.write(f"{self.high_score}")
        self.score = 0
        self.update_scoreboard()

    def increase_score(self):
        if self.score % 5 == 0:
            self.score += 3
        else:
            self.score += 1
        self.update_scoreboard()

What I thought is to use the modulo% in the scoreboard.py to increase the score attribute by 3 points every third food spawn, and I have managed to do that, the problem is, I do not know how to either tap into the scoreboard score attribute and change the color of the food in relation to the score without having two overlayed scoreboards on screen, or create some kind of loop in food.py that achieves the same functionality by looping through a list of colors.

I've also tried this method answered by another person on here but I couldn't make it work.

import inspect

params = []
for parent in ExampleParams.mro()[::-1]:
    parent_init = inspect.getfullargspec(parent.__init__)
    # parent_init.annotations contains annotations if specified in method signature
    for param in parent_init.args:
        if param == 'self':
            continue
        params.append(param)


来源: stackexchange

问:
My dataframe converted to csv has two columns but PyCharm is only showing one. What might be wrong with PyCharm?
```<code>import pandas

data = pandas.read_csv("2018_Central_Park_Squirrel_Census_-_Squirrel_Data.csv")
data_gray_count = len(data[data['Primary Fur Color'] == "Gray"])
data_red_count = len(data[data['Primary Fur Color'] == "Cinnamon"])
data_black_count = len(data[data['Primary Fur Color'] == "Black"])

data_dict = {
"Fur Color": ["Gray", "Cinamon","Black"],
    "Count": [data_gray_count,data_red_count,data_black_count],
}
df = pandas.DataFrame(data_dict)
df.to_csv("Squirrel_Count.csv")
</code>```

CSV file has the column count but I'm not able to see in Pycharm

ContentLicense: CC BY-SA 4.0

Body:
import pandas

data = pandas.read_csv("2018_Central_Park_Squirrel_Census_-_Squirrel_Data.csv")
data_gray_count = len(data[data['Primary Fur Color'] == "Gray"])
data_red_count = len(data[data['Primary Fur Color'] == "Cinnamon"])
data_black_count = len(data[data['Primary Fur Color'] == "Black"])

data_dict = {
"Fur Color": ["Gray", "Cinamon","Black"],
    "Count": [data_gray_count,data_red_count,data_black_count],
}
df = pandas.DataFrame(data_dict)
df.to_csv("Squirrel_Count.csv")

CSV file has the column count but I'm not able to see in Pycharm


问:
Kmeans clustering NAs warning
I am trying to split my data into clusters using the kmeans function. After normalizing my data, when I use the kmeans function I get the following error

"Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning message:
In storage.mode(x) <- "double" : NAs introduced by coercion"

I have used "View(sapply(dataframeName, class))" and all columns except for the first one (which contains the countries) are numeric, so how can I go around it? Thank you so much in advance :)

```<code>country_norm[,c("exports")] <- (countries$exports-mean(countries$exports))/sd(countries$exports)
country_norm[,c("imports")] <- (countries$imports-mean(countries$imports))/sd(countries$imports)
country_norm[,c("income")] <- (countries$income-mean(countries$income))/sd(countries$income)
country_norm[,c("inflation")] <- (countries$inflation-mean(countries$inflation))/sd(countries$inflation)
country_norm[,c("gdpp")] <- (countries$gdpp-mean(countries$gdpp))/sd(countries$gdpp)
set.seed(70)
modelo_k5<-kmeans(country_norm,centers=5)
Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1) In addition: Warning message: In storage.mode(x) <- "double" : NAs introduced by coercion
</code>```

Title: Kmeans clustering NAs warning

Body:
I am trying to split my data into clusters using the kmeans function. After normalizing my data, when I use the kmeans function I get the following error

"Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1)
In addition: Warning message:
In storage.mode(x) <- "double" : NAs introduced by coercion"

I have used "View(sapply(dataframeName, class))" and all columns except for the first one (which contains the countries) are numeric, so how can I go around it? Thank you so much in advance :)

country_norm[,c("exports")] <- (countries$exports-mean(countries$exports))/sd(countries$exports)
country_norm[,c("imports")] <- (countries$imports-mean(countries$imports))/sd(countries$imports)
country_norm[,c("income")] <- (countries$income-mean(countries$income))/sd(countries$income)
country_norm[,c("inflation")] <- (countries$inflation-mean(countries$inflation))/sd(countries$inflation)
country_norm[,c("gdpp")] <- (countries$gdpp-mean(countries$gdpp))/sd(countries$gdpp)
set.seed(70)
modelo_k5<-kmeans(country_norm,centers=5)
Error in do_one(nmeth) : NA/NaN/Inf in foreign function call (arg 1) In addition: Warning message: In storage.mode(x) <- "double" : NAs introduced by coercion


问:
Why is Godot not showing + using my folders + files
I am relatively new to Godot, and have started a roguelike game project with a few friends of mine. Recently, we decided to change the repository, in an attempt to add room for newer projects and more people.

After the transition over, files are no longer showing in the Godot file explorer.

I have tried changing the code in the .gd files using notepad and recloning the new repository. I do not think it is an issue with the files themselves, though, as my friend is running the same code without any issues.

We have the same Godot version (3.4.4), code, and both moved over at the same time. I'm still relatively new to Godot, so this may be something obvious I'm missing, but nothing online is helping.


问:
Options to Subscribing to a Google Pub Sub Topic to Pull Data from GCP to AWS
We have a customer that publishes data to Google Pub Sub Topic and allows us in read only mode to consume the messages.   We would like to utilize AWS tools to accomplish this pipeline.  What would be the best method to execute this?

We have looked at SNS, SQS and using a lamba.


问:
getting duplicated text while using react simple chatbot api
I am getting duplicates text when using options

this is the steps I have used:

```<code>const steps = [
    {
        id: '1',
        message: 'Those Are The Services That I am offering ,Please Choose A Service?',
        trigger: '2',
    },
    {
        id: '2',
        options: [{
                value: "Web Developement",
                label: 'Web Developement',
                trigger: '3'
            },
            {
                value: "Data Science",
                label: 'Data Science',
                trigger: '4'
            },
            {
                value: "AI & Deep Learning",
                label: 'AI & Deep Learning',
                trigger: '4'
            },
        ],
    },
    {
        id: '3',
        message: 'Wrong answer, try again.',

    },
    {
        id: '4',
        message: 'Awesome! You are a telepath!',

    },
];

</code>```

and this the result I have got:
the dupliacted text is indicated in the image

I have tried to create an otion for the users so they can pick an answer I was expecting to get just 3 otions while I got 6 with 3 duplicates.

Body:
I am getting duplicates text when using options

this is the steps I have used:

const steps = [
    {
        id: '1',
        message: 'Those Are The Services That I am offering ,Please Choose A Service?',
        trigger: '2',
    },
    {
        id: '2',
        options: [{
                value: "Web Developement",
                label: 'Web Developement',
                trigger: '3'
            },
            {
                value: "Data Science",
                label: 'Data Science',
                trigger: '4'
            },
            {
                value: "AI & Deep Learning",
                label: 'AI & Deep Learning',
                trigger: '4'
            },
        ],
    },
    {
        id: '3',
        message: 'Wrong answer, try again.',

    },
    {
        id: '4',
        message: 'Awesome! You are a telepath!',

    },
];

and this the result I have got:
the dupliacted text is indicated in the image

I have tried to create an otion for the users so they can pick an answer I was expecting to get just 3 otions while I got 6 with 3 duplicates.


问:
How to send a direct message to a user using Discord.js?
I'm trying to make my Discord bot to send a direct message new users which just have entered my Discord server.

client.on('guildMemberAdd', async member => {
    await member.send(`Hello, ${user}!`);
});
```

But it is not working at all. I assume it is outdated. I am a total newbie in Discord.js and I do not quite understand how to get info about new user to send them a direct message.

Thanks in advance!

Body:
I'm trying to make my Discord bot to send a direct message new users which just have entered my Discord server.

client.on('guildMemberAdd', async member => {
    await member.send(`Hello, ${user}!`);
});

But it is not working at all. I assume it is outdated. I am a total newbie in Discord.js and I do not quite understand how to get info about new user to send them a direct message.

Thanks in advance!


问:
Creating a function with Execute immediate PL/SQL oracle but not getting the output
```<code>CREATE OR REPLACE TYPE CDE_REC IS TABLE OF CDE_REC_TYPE;

CREATE OR REPLACE TYPE CDE_REC_TYPE AS OBJECT ( EmpId VARCHAR2(8), counter VARCHAR2(5), dayJ VARCHAR2(8),typeD NUMBER, unitD VARCHAR2(5));

CREATE OR REPLACE FUNCTION GET_DATA(EmpID VARCHAR2, DateFilter VARCHAR2)
 RETURN CDE_REC IS
    TMP_CDE_TBL CDE_REC := CDE_REC();
    v_sql VARCHAR(10000);
  BEGIN
   v_sql := 'with table1 as (
   select  id, counter,  dayJ, type,
      decode( counter,  ''XY'', ''7'',''AB'', ''7'', ''BC'', ''7'', ''CD'', ''7'', ''EF'', ''7'', ''GH'', ''7'', ''IJ'', ''7'', ''KL'', ''7'',  ''MN'', ''7H'', ''OP'', ''7H'',
      ''QR'', ''8'', ''FF'', ''8'',  ''ST'', ''9'', ''UV'', ''9'', ''XY'', ''9'', ''YZ'', ''9'', ''AA'', ''9'', ''BB'', ''9'', ''CC'', ''9'', ''DD'', ''9'', ''EE'', ''9''  ) as Lot_Don,
      lag (dayJ, 1) over (partition by id, counter order by dayJ asc, type asc) as dayJ_ER,
      lag (type, 1) over(partition by id, counter order by dayJ asc, type asc) as E_PREC,
      nvl(VALJ,0) as valj_7,
      nvl( lag (VALJ, 1) over(partition by id, counter order by dayJ, type asc), 0) as EARValJ,
      nvl(LOT7,0) as valh_7,
      nvl( lag (LOT7, 1) over(partition by id, counter order by dayJ, type asc), 0) as Data7_Ear,
      nvl(LOT8,0) as valj_8,
      nvl( lag (LOT8, 1) over(partition by id, counter order by dayJ, type asc), 0) as LOT8_E,
      nvl(LOT8_RH,0) as valh_8,
      nvl( lag (LOT8_RH, 1) over(partition by id, counter order by dayJ, type asc), 0) as LOT8_RH_E,
      nvl(LOT9,0) as valj_9,
      nvl( lag (LOT9, 1) over(partition by id, counter order by dayJ, type asc), 0) as LOT9_EH,
      nvl(LOT9_H,0) as valh_9,  nvl( lag (LOT9_H, 1) over(partition by id, counter order by dayJ, type asc), 0) as LOT9_E
   from  tableUsed1
   where  counter in (''XY'', ''AB'', ''BC'', ''CD'', ''EF'', ''GH'', ''IJ'', ''KL'', ''MN'', ''OP'', ''QR'', ''FF'', ''ST'', ''UV'', ''XY'', ''YZ'', ''AA'', ''BB'', ''CC'', ''DD'', ''EE'')
      AND id IN ('|| EmpID || ')
      and dayJ = to_char(to_date(' || DateFilter || ', ''dd.mm.yyyy''), ''yyyymmdd'') )  ,
table2 as (
   select  id, counter, dayJ, Lot_Don,
      case  when exists (
      select 1 from tableC
      where eID = id
         and to_date(dayJ,''YYYYMMDD'') between St_Date_Val and nvl(End_Date_V, to_date(''20991231'', ''YYYYMMDD''))
         and DATATAB is not null
         and DATATAB in (''151'',''152'',''420'')
      )  then
      case  when Lot_Don = ''7H'' then round(valh_7 / 3600 / 6.84, 2)
         when Lot_Don = ''8'' then round(valh_8 / 3600 / 6.84, 2)
         when Lot_Don = ''9H'' then round(valh_9 / 3600 / 6.84, 2)
         when Lot_Don = ''7'' then valj_7
         when Lot_Don = ''8J'' then valj_8
         when Lot_Don = ''9'' then valj_9
      end
      when exists (
         select 1
         from tableC
         where eID = id
            and to_date(dayJ,''YYYYMMDD'') between St_Date_Val and nvl(End_Date_V, to_date(''20991231'', ''YYYYMMDD''))
            and DATATAB is not null
            and DATATAB in (''704''))
       then
          case  when Lot_Don = ''7H'' then round(valh_7 / 3600 / 6.72, 2)
          when Lot_Don = ''8'' then round(valh_8 / 3600 / 6.72, 2)
          when Lot_Don = ''9H'' then round(valh_9 / 3600 / 6.72, 2)
          when Lot_Don = ''7'' then valj_7
          when Lot_Don = ''8J'' then valj_8
          when Lot_Don = ''9'' then valj_9
       end
       else
          case  when Lot_Don = ''7H'' then round(valh_7 / 3600 / 7, 2)
          when Lot_Don = ''8'' then round(valh_8 / 3600 / 7, 2)
          when Lot_Don = ''9H'' then round(valh_9 / 3600 / 7, 2)
          when Lot_Don = ''7'' then valj_7
          when Lot_Don = ''8J'' then valj_8
          when Lot_Don = ''9'' then valj_9
       end
       end  as VALP,
       case  when exists (
       select 1
       from tableC
       where eID = id
          and to_date(dayJ,''YYYYMMDD'') between St_Date_Val and nvl(End_Date_V, to_date(''20991231'', ''YYYYMMDD''))
          and DATATAB is not null
          and DATATAB in (''151'',''152'',''420''))
       then  case  when Lot_Don = ''7H'' then round(Data7_Ear / 3600 / 6.84, 2)
          when Lot_Don = ''8'' then round(LOT8_RH_E / 3600 / 6.84, 2)
          when Lot_Don = ''9H'' then round(LOT9_E / 3600 / 6.84, 2)
          when Lot_Don = ''7'' then EARValJ
          when Lot_Don = ''8J'' then LOT8_E
          when Lot_Don = ''9'' then LOT9_EH
       end  when exists (
       select 1
       from tableC
       where eID = id
          and to_date(dayJ,''YYYYMMDD'') between St_Date_Val and nvl(End_Date_V, to_date(''20991231'', ''YYYYMMDD''))
          and DATATAB is not null
          and DATATAB in (''704''))  then
       case  when Lot_Don = ''7H'' then round(Data7_Ear / 3600 / 6.72, 2)
          when Lot_Don = ''8'' then round(LOT8_RH_E / 3600 / 6.72, 2)
          when Lot_Don = ''9H'' then round(LOT9_E / 3600 / 6.72, 2)
          when Lot_Don = ''7'' then EARValJ
          when Lot_Don = ''8J'' then LOT8_E
          when Lot_Don = ''9'' then LOT9_EH
          end
       else
          case when Lot_Don = ''7H'' then round(Data7_Ear / 3600 / 7, 2)
          when Lot_Don = ''8'' then round(LOT8_RH_E / 3600 / 7, 2)
          when Lot_Don = ''9H'' then round(LOT9_E / 3600 / 7, 2)
          when Lot_Don = ''7'' then EARValJ  when Lot_Don = ''8J'' then LOT8_E
          when Lot_Don = ''9'' then LOT9_EH
          end
       end  as DatP_Ear,
       ''Days'' as unitD
    from  table1
    where  ((dayJ >= ''20151101''and dayJ like ''%1101'') or (dayJ >= ''20211102''and dayJ like ''%1102''))
       and type = ''M''  and (
           ( counter in (''XY'', ''AB'', ''BC'', ''CD'', ''EF'', ''GH'', ''IJ'', ''KL'') and valj_7 > 0 )
          or  ( counter in (''MN'', ''OP'') and valh_7 > 0 )  or  ( counter in (''QR'', ''FF'') and valh_8 > 0 )
          or  ( counter in (''ST'', ''UV'', ''XY'', ''YZ'', ''AA'', ''BB'', ''CC'', ''DD'', ''EE'') and valj_9 > 0 )
       )
       AND id IN (' || EmpID || ')
       and dayJ = to_char(to_date(' || DateFilter || ', ''dd.mm.yyyy''), ''yyyymmdd'') )
    select id, counter, dayJ, (sum(VALP) - sum(DatP_Ear)), unitD
    from table2
    group by  id, counter, dayJ, Lot_Don, unitD  order by  id, dayJ';

    EXECUTE IMMEDIATE v_SQL BULK COLLECT INTO TMP_CDE_TBL;
    --Initialise la collection

    RETURN TMP_CDE_TBL;
  END GET_DATA;
</code>```

I am trying to create a function with two parameters one is an sql query and the other on is the date on which the query needs to filtre down the result. The result is a table which i am trying to pick up in a type object. I have put up this query with execute immediate but unfortunately its not working and i am unable to find the reason why. Any insight on this would be really helpful. Its showing Invalid operation error.

To run this function i am using two type of queries

```<code>select * from table(GET_DATA('SELECT EmpID FROM CLIENT','02.12.2022'))
select * from table(GET_DATA('SELECT EmpID FROM CLIENT','\'02.12.2022\''))
select GET_DATA('SELECT EmpID FROM CLIENT','02.12.2022') from dual
select GET_DATA('SELECT EmpID FROM CLIENT','\'02.12.2022\'') from dual
</code>```

Body:
CREATE OR REPLACE TYPE CDE_REC IS TABLE OF CDE_REC_TYPE;

CREATE OR REPLACE TYPE CDE_REC_TYPE AS OBJECT ( EmpId VARCHAR2(8), counter VARCHAR2(5), dayJ VARCHAR2(8),typeD NUMBER, unitD VARCHAR2(5));

CREATE OR REPLACE FUNCTION GET_DATA(EmpID VARCHAR2, DateFilter VARCHAR2)
 RETURN CDE_REC IS
    TMP_CDE_TBL CDE_REC := CDE_REC();
    v_sql VARCHAR(10000);
  BEGIN
   v_sql := 'with table1 as (
   select  id, counter,  dayJ, type,
      decode( counter,  ''XY'', ''7'',''AB'', ''7'', ''BC'', ''7'', ''CD'', ''7'', ''EF'', ''7'', ''GH'', ''7'', ''IJ'', ''7'', ''KL'', ''7'',  ''MN'', ''7H'', ''OP'', ''7H'',
      ''QR'', ''8'', ''FF'', ''8'',  ''ST'', ''9'', ''UV'', ''9'', ''XY'', ''9'', ''YZ'', ''9'', ''AA'', ''9'', ''BB'', ''9'', ''CC'', ''9'', ''DD'', ''9'', ''EE'', ''9''  ) as Lot_Don,
      lag (dayJ, 1) over (partition by id, counter order by dayJ asc, type asc) as dayJ_ER,
      lag (type, 1) over(partition by id, counter order by dayJ asc, type asc) as E_PREC,
      nvl(VALJ,0) as valj_7,
      nvl( lag (VALJ, 1) over(partition by id, counter order by dayJ, type asc), 0) as EARValJ,
      nvl(LOT7,0) as valh_7,
      nvl( lag (LOT7, 1) over(partition by id, counter order by dayJ, type asc), 0) as Data7_Ear,
      nvl(LOT8,0) as valj_8,
      nvl( lag (LOT8, 1) over(partition by id, counter order by dayJ, type asc), 0) as LOT8_E,
      nvl(LOT8_RH,0) as valh_8,
      nvl( lag (LOT8_RH, 1) over(partition by id, counter order by dayJ, type asc), 0) as LOT8_RH_E,
      nvl(LOT9,0) as valj_9,
      nvl( lag (LOT9, 1) over(partition by id, counter order by dayJ, type asc), 0) as LOT9_EH,
      nvl(LOT9_H,0) as valh_9,  nvl( lag (LOT9_H, 1) over(partition by id, counter order by dayJ, type asc), 0) as LOT9_E
   from  tableUsed1
   where  counter in (''XY'', ''AB'', ''BC'', ''CD'', ''EF'', ''GH'', ''IJ'', ''KL'', ''MN'', ''OP'', ''QR'', ''FF'', ''ST'', ''UV'', ''XY'', ''YZ'', ''AA'', ''BB'', ''CC'', ''DD'', ''EE'')
      AND id IN ('|| EmpID || ')
      and dayJ = to_char(to_date(' || DateFilter || ', ''dd.mm.yyyy''), ''yyyymmdd'') )  ,
table2 as (
   select  id, counter, dayJ, Lot_Don,
      case  when exists (
      select 1 from tableC
      where eID = id
         and to_date(dayJ,''YYYYMMDD'') between St_Date_Val and nvl(End_Date_V, to_date(''20991231'', ''YYYYMMDD''))
         and DATATAB is not null
         and DATATAB in (''151'',''152'',''420'')
      )  then
      case  when Lot_Don = ''7H'' then round(valh_7 / 3600 / 6.84, 2)
         when Lot_Don = ''8'' then round(valh_8 / 3600 / 6.84, 2)
         when Lot_Don = ''9H'' then round(valh_9 / 3600 / 6.84, 2)
         when Lot_Don = ''7'' then valj_7
         when Lot_Don = ''8J'' then valj_8
         when Lot_Don = ''9'' then valj_9
      end
      when exists (
         select 1
         from tableC
         where eID = id
            and to_date(dayJ,''YYYYMMDD'') between St_Date_Val and nvl(End_Date_V, to_date(''20991231'', ''YYYYMMDD''))
            and DATATAB is not null
            and DATATAB in (''704''))
       then
          case  when Lot_Don = ''7H'' then round(valh_7 / 3600 / 6.72, 2)
          when Lot_Don = ''8'' then round(valh_8 / 3600 / 6.72, 2)
          when Lot_Don = ''9H'' then round(valh_9 / 3600 / 6.72, 2)
          when Lot_Don = ''7'' then valj_7
          when Lot_Don = ''8J'' then valj_8
          when Lot_Don = ''9'' then valj_9
       end
       else
          case  when Lot_Don = ''7H'' then round(valh_7 / 3600 / 7, 2)
          when Lot_Don = ''8'' then round(valh_8 / 3600 / 7, 2)
          when Lot_Don = ''9H'' then round(valh_9 / 3600 / 7, 2)
          when Lot_Don = ''7'' then valj_7
          when Lot_Don = ''8J'' then valj_8
          when Lot_Don = ''9'' then valj_9
       end
       end  as VALP,
       case  when exists (
       select 1
       from tableC
       where eID = id
          and to_date(dayJ,''YYYYMMDD'') between St_Date_Val and nvl(End_Date_V, to_date(''20991231'', ''YYYYMMDD''))
          and DATATAB is not null
          and DATATAB in (''151'',''152'',''420''))
       then  case  when Lot_Don = ''7H'' then round(Data7_Ear / 3600 / 6.84, 2)
          when Lot_Don = ''8'' then round(LOT8_RH_E / 3600 / 6.84, 2)
          when Lot_Don = ''9H'' then round(LOT9_E / 3600 / 6.84, 2)
          when Lot_Don = ''7'' then EARValJ
          when Lot_Don = ''8J'' then LOT8_E
          when Lot_Don = ''9'' then LOT9_EH
       end  when exists (
       select 1
       from tableC
       where eID = id
          and to_date(dayJ,''YYYYMMDD'') between St_Date_Val and nvl(End_Date_V, to_date(''20991231'', ''YYYYMMDD''))
          and DATATAB is not null
          and DATATAB in (''704''))  then
       case  when Lot_Don = ''7H'' then round(Data7_Ear / 3600 / 6.72, 2)
          when Lot_Don = ''8'' then round(LOT8_RH_E / 3600 / 6.72, 2)
          when Lot_Don = ''9H'' then round(LOT9_E / 3600 / 6.72, 2)
          when Lot_Don = ''7'' then EARValJ
          when Lot_Don = ''8J'' then LOT8_E
          when Lot_Don = ''9'' then LOT9_EH
          end
       else
          case when Lot_Don = ''7H'' then round(Data7_Ear / 3600 / 7, 2)
          when Lot_Don = ''8'' then round(LOT8_RH_E / 3600 / 7, 2)
          when Lot_Don = ''9H'' then round(LOT9_E / 3600 / 7, 2)
          when Lot_Don = ''7'' then EARValJ  when Lot_Don = ''8J'' then LOT8_E
          when Lot_Don = ''9'' then LOT9_EH
          end
       end  as DatP_Ear,
       ''Days'' as unitD
    from  table1
    where  ((dayJ >= ''20151101''and dayJ like ''%1101'') or (dayJ >= ''20211102''and dayJ like ''%1102''))
       and type = ''M''  and (
           ( counter in (''XY'', ''AB'', ''BC'', ''CD'', ''EF'', ''GH'', ''IJ'', ''KL'') and valj_7 > 0 )
          or  ( counter in (''MN'', ''OP'') and valh_7 > 0 )  or  ( counter in (''QR'', ''FF'') and valh_8 > 0 )
          or  ( counter in (''ST'', ''UV'', ''XY'', ''YZ'', ''AA'', ''BB'', ''CC'', ''DD'', ''EE'') and valj_9 > 0 )
       )
       AND id IN (' || EmpID || ')
       and dayJ = to_char(to_date(' || DateFilter || ', ''dd.mm.yyyy''), ''yyyymmdd'') )
    select id, counter, dayJ, (sum(VALP) - sum(DatP_Ear)), unitD
    from table2
    group by  id, counter, dayJ, Lot_Don, unitD  order by  id, dayJ';

    EXECUTE IMMEDIATE v_SQL BULK COLLECT INTO TMP_CDE_TBL;
    --Initialise la collection

    RETURN TMP_CDE_TBL;
  END GET_DATA;

I am trying to create a function with two parameters one is an sql query and the other on is the date on which the query needs to filtre down the result. The result is a table which i am trying to pick up in a type object. I have put up this query with execute immediate but unfortunately its not working and i am unable to find the reason why. Any insight on this would be really helpful. Its showing Invalid operation error.

To run this function i am using two type of queries

select * from table(GET_DATA('SELECT EmpID FROM CLIENT','02.12.2022'))
select * from table(GET_DATA('SELECT EmpID FROM CLIENT','\'02.12.2022\''))
select GET_DATA('SELECT EmpID FROM CLIENT','02.12.2022') from dual
select GET_DATA('SELECT EmpID FROM CLIENT','\'02.12.2022\'') from dual


问:
Unity's Button.onClick listener requires several clicks to be invoked
The cards with the Button component and an onClick listener require numerous erratic clicks to trigger and fail to invoke after just one click.

The first two cards will always invoke via the first click. Afterwards, the other cards often require multiple clicks (between 2 and 7 clicks) before their listener is invoked, and they are flipped over. This occurs at random as sometimes even the first three pairs will flip after just one click, and then the rest won´t.

If I wait for a set time of five seconds, the next card I click will turn over with just one click. So the issue appears to depend on the interval between clicks, as opposed to the number of clicks. Although this behaviour is inconsistent, as clicking just once on a new card and then waiting those 5 seconds doesn´t always work and the card will stay unflipped; assuming because I clicked too soon.

```<code>using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;

public class GameController : MonoBehaviour
{
    [SerializeField] private Sprite bgImage;

    public Sprite[] puzzles;
    public List<Sprite> gamePuzzles = new List<Sprite>();
    public List<Button> btns = new List<Button>();

    private bool firstGuess, secondGuess;

    private int countGuesses;
    private int countCorrectGuesses;
    private int gameGuesses;

    private int firstGuessIndex, secondGuessIndex;

    private string firstGuessPuzzle, secondGuessPuzzle;

    void Awake()
    {
        puzzles = Resources.LoadAll<Sprite>("Sprites/Cards");
    }

    void Start()
    {
        GetButtons();
        AddListeners();
        AddGamePuzzles();
        Shuffle(gamePuzzles);
        gameGuesses = gamePuzzles.Count / 2;
    }

    void GetButtons()
    {
        GameObject[] objects = GameObject.FindGameObjectsWithTag("Puzzle Button");

        for (int i = 0; i < objects.Length; i++)
        {
            btns.Add(objects[i].GetComponent<Button>());
            btns[i].image.sprite = bgImage;
        }
    }

    void AddGamePuzzles()
    {
        int looper = btns.Count;
        int index = 0;

        for (int i = 0; i < looper; i++)
        {
            if (index == looper / 2)
            {
                index = 0;
            }

            gamePuzzles.Add(puzzles[index]);

            index++;
        }
    }

    void AddListeners()
    {
        foreach (Button btn in btns)
        {
            btn.onClick.AddListener(() => PickAPuzzle());
        }
    }

    public void PickAPuzzle()
    {
        string name = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name;
        Debug.Log("You are clicking a button named" + name);

        if (!firstGuess)
        {
            firstGuess = true;

            firstGuessIndex =
                int.Parse(UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name);

            firstGuessPuzzle = gamePuzzles[firstGuessIndex].name;

            btns[firstGuessIndex].image.sprite = gamePuzzles[firstGuessIndex];
        }
        else if (!secondGuess)
        {
            secondGuess = true;

            secondGuessIndex =
                int.Parse(UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name);

            secondGuessPuzzle = gamePuzzles[secondGuessIndex].name;

            btns[secondGuessIndex].image.sprite = gamePuzzles[secondGuessIndex];

            countGuesses++;

            StartCoroutine(CheckIfThePuzzlesMatch());
        }
    }

    IEnumerator CheckIfThePuzzlesMatch()
    {
        yield return new WaitForSeconds(2f);

        if (firstGuessPuzzle == secondGuessPuzzle && firstGuessIndex != secondGuessIndex)
        {
            yield return new WaitForSeconds(1f);

            btns[firstGuessIndex].interactable = false;
            btns[secondGuessIndex].interactable = false;

            btns[firstGuessIndex].image.color = new Color(0, 0, 0, 0);
            btns[secondGuessIndex].image.color = new Color(0, 0, 0, 0);

            CheckIfTheGameIsFinished();
        }
        else
        {
            yield return new WaitForSeconds(1f);

            btns[firstGuessIndex].image.sprite = bgImage;
            btns[secondGuessIndex].image.sprite = bgImage;
        }

        yield return new WaitForSeconds(1f);

        firstGuess = secondGuess = false;
    }

    void CheckIfTheGameIsFinished()
    {
        countCorrectGuesses++;

        if (countCorrectGuesses == gameGuesses)
        {
            Debug.Log("Game Finished");
        }
    }

    void Shuffle(List<Sprite> list)
    {
        for (int i = 0; i < list.Count; i++)
        {
            Sprite temp = list[i];
            int randomIndex = Random.Range(i, list.Count);
            list[i] = list[randomIndex];
            list[randomIndex] = temp;
        }
    }
}
</code>```

Body:
The cards with the Button component and an onClick listener require numerous erratic clicks to trigger and fail to invoke after just one click.

The first two cards will always invoke via the first click. Afterwards, the other cards often require multiple clicks (between 2 and 7 clicks) before their listener is invoked, and they are flipped over. This occurs at random as sometimes even the first three pairs will flip after just one click, and then the rest won´t.

If I wait for a set time of five seconds, the next card I click will turn over with just one click. So the issue appears to depend on the interval between clicks, as opposed to the number of clicks. Although this behaviour is inconsistent, as clicking just once on a new card and then waiting those 5 seconds doesn´t always work and the card will stay unflipped; assuming because I clicked too soon.

using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;

public class GameController : MonoBehaviour
{
    [SerializeField] private Sprite bgImage;

    public Sprite[] puzzles;
    public List<Sprite> gamePuzzles = new List<Sprite>();
    public List<Button> btns = new List<Button>();

    private bool firstGuess, secondGuess;

    private int countGuesses;
    private int countCorrectGuesses;
    private int gameGuesses;

    private int firstGuessIndex, secondGuessIndex;

    private string firstGuessPuzzle, secondGuessPuzzle;

    void Awake()
    {
        puzzles = Resources.LoadAll<Sprite>("Sprites/Cards");
    }

    void Start()
    {
        GetButtons();
        AddListeners();
        AddGamePuzzles();
        Shuffle(gamePuzzles);
        gameGuesses = gamePuzzles.Count / 2;
    }

    void GetButtons()
    {
        GameObject[] objects = GameObject.FindGameObjectsWithTag("Puzzle Button");

        for (int i = 0; i < objects.Length; i++)
        {
            btns.Add(objects[i].GetComponent<Button>());
            btns[i].image.sprite = bgImage;
        }
    }

    void AddGamePuzzles()
    {
        int looper = btns.Count;
        int index = 0;

        for (int i = 0; i < looper; i++)
        {
            if (index == looper / 2)
            {
                index = 0;
            }

            gamePuzzles.Add(puzzles[index]);

            index++;
        }
    }

    void AddListeners()
    {
        foreach (Button btn in btns)
        {
            btn.onClick.AddListener(() => PickAPuzzle());
        }
    }

    public void PickAPuzzle()
    {
        string name = UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name;
        Debug.Log("You are clicking a button named" + name);

        if (!firstGuess)
        {
            firstGuess = true;

            firstGuessIndex =
                int.Parse(UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name);

            firstGuessPuzzle = gamePuzzles[firstGuessIndex].name;

            btns[firstGuessIndex].image.sprite = gamePuzzles[firstGuessIndex];
        }
        else if (!secondGuess)
        {
            secondGuess = true;

            secondGuessIndex =
                int.Parse(UnityEngine.EventSystems.EventSystem.current.currentSelectedGameObject.name);

            secondGuessPuzzle = gamePuzzles[secondGuessIndex].name;

            btns[secondGuessIndex].image.sprite = gamePuzzles[secondGuessIndex];

            countGuesses++;

            StartCoroutine(CheckIfThePuzzlesMatch());
        }
    }

    IEnumerator CheckIfThePuzzlesMatch()
    {
        yield return new WaitForSeconds(2f);

        if (firstGuessPuzzle == secondGuessPuzzle && firstGuessIndex != secondGuessIndex)
        {
            yield return new WaitForSeconds(1f);

            btns[firstGuessIndex].interactable = false;
            btns[secondGuessIndex].interactable = false;

            btns[firstGuessIndex].image.color = new Color(0, 0, 0, 0);
            btns[secondGuessIndex].image.color = new Color(0, 0, 0, 0);

            CheckIfTheGameIsFinished();
        }
        else
        {
            yield return new WaitForSeconds(1f);

            btns[firstGuessIndex].image.sprite = bgImage;
            btns[secondGuessIndex].image.sprite = bgImage;
        }

        yield return new WaitForSeconds(1f);

        firstGuess = secondGuess = false;
    }

    void CheckIfTheGameIsFinished()
    {
        countCorrectGuesses++;

        if (countCorrectGuesses == gameGuesses)
        {
            Debug.Log("Game Finished");
        }
    }

    void Shuffle(List<Sprite> list)
    {
        for (int i = 0; i < list.Count; i++)
        {
            Sprite temp = list[i];
            int randomIndex = Random.Range(i, list.Count);
            list[i] = list[randomIndex];
            list[randomIndex] = temp;
        }
    }
}


问:
Change "Error: response status" details in FastAPI / OpenAPI

I implemented some Custom Exceptions. And now I want to display the Exception name at the red box. Where can I set this value?

class CustomExceptionHandler(Exception):
    def __init__(self, exception):
        self.message = exception.message
        self.status_code_number = exception.status_code_number
```
<pre class="lang-py prettyprint-override"><code>@app.exception_handler(CustomExceptionHandler)
async def data_processing_error_handler(request: Request, exc: CustomExceptionHandler):
    return JSONResponse(
        status_code=exc.status_code_number,
        content=jsonable_encoder({exc.message}),
    )
</code>```

Body:
I implemented some Custom Exceptions. And now I want to display the Exception name at the red box. Where can I set this value?

class CustomExceptionHandler(Exception):
    def __init__(self, exception):
        self.message = exception.message
        self.status_code_number = exception.status_code_number

@app.exception_handler(CustomExceptionHandler)
async def data_processing_error_handler(request: Request, exc: CustomExceptionHandler):
    return JSONResponse(
        status_code=exc.status_code_number,
        content=jsonable_encoder({exc.message}),
    )


问:
escape from par function in R
```<code>par(mfrow=c(3,1))
plot(return_data[,1],main="883")
plot(return_data[,2],main="857")
plot(return_data[,3],main="386")
</code>```

After I am done using the par function and while I am doing my next graph, I see the following message, think I need to escape from the par function first before I do my next graph, any idea on how? Or generally, any commands I need to do so R knows I am done using the par function? Thank you so much.

What I am doing next after using the par function is as below:

```<code>highchart(type="chart")
  hc_add_series(return_data[,1],name="883")%>%
  hc_add_series(return_data[,2],name="857")%>%
  hc_add_series(return_data[,3],name="386")%>%
  hc_title(text="<b>883,386,857</b>")
</code>```

Then error is shown:

```<code>Error in NextMethod(.Generic) :
  number of items to replace is not a multiple of replacement length

> class(return_data)
[1] "xts" "zoo"
</code>```

Title: escape from par function in R

Body:
par(mfrow=c(3,1))
plot(return_data[,1],main="883")
plot(return_data[,2],main="857")
plot(return_data[,3],main="386")

After I am done using the par function and while I am doing my next graph, I see the following message, think I need to escape from the par function first before I do my next graph, any idea on how? Or generally, any commands I need to do so R knows I am done using the par function? Thank you so much.

What I am doing next after using the par function is as below:

highchart(type="chart")
  hc_add_series(return_data[,1],name="883")%>%
  hc_add_series(return_data[,2],name="857")%>%
  hc_add_series(return_data[,3],name="386")%>%
  hc_title(text="883,386,857")

Then error is shown:

Error in NextMethod(.Generic) :
  number of items to replace is not a multiple of replacement length

> class(return_data)
[1] "xts" "zoo"


问:
Addressable related confusion at runtime (for Unity games)?
Respected Seniors,

I need proper guidance for Addressable, please.
If someone wants to share his or her experiences, I would be very thankful for it. I am not able to understand after watching so many videos; I am so confused about them.

I need to upload the different spritesheets (almost 5 to 10) with different labels (should I make a separate group for each spritesheet or place them in a single group, which will be a better way in terms of performance, etc)?

And I am confused about the addressable cache and data.
When something new is added to the server, I want spritesheets to download from the server only once and update on the user's device only when we update the data at server.

The cache and data for addressable will be available until the user uninstall the application or this will be deleted in 150 days. (Someone told me this will delete automatically after 150 days.)

Please guide me about the settings and code. I have also done some stuff, but Addressable is a very confusing topic, so I am not sure if I am doing it correctly or not.

I am hoping for a positive response. Thank you for your precious time.


问:
How do Async coroutineBuilders execute tasks written in it concurrently in the same Main Thread when there are executing in parallell
My code:

```<code>import kotlinx.coroutines.*
import kotlin.system.measureTimeMillis
fun main() {
    runBlocking{
        val time = measureTimeMillis{
            val m1 = async{
                delay(2000)
                println("First async :" + Thread.currentThread().name)
                "Hello"
            }
            val m2 = async{
                delay(2000)
                println("Second async :" + Thread.currentThread().name)
                " World"
            }
            val j = m1.await()+m2.await()
            println(j)
        }
        println("Time is : "+time.toString())
    }
}
</code>```

Output:

```<code>First async :main @coroutine#2
Second async :main @coroutine#3
Hello World
Time is : 2029
</code>```

But how is this executing in 2 seconds and running on the same main thread instead of running on an other thread?

Can anybody explain me in detail how these coroutines here work, please?

Body:
My code:

import kotlinx.coroutines.*
import kotlin.system.measureTimeMillis
fun main() {
    runBlocking{
        val time = measureTimeMillis{
            val m1 = async{
                delay(2000)
                println("First async :" + Thread.currentThread().name)
                "Hello"
            }
            val m2 = async{
                delay(2000)
                println("Second async :" + Thread.currentThread().name)
                " World"
            }
            val j = m1.await()+m2.await()
            println(j)
        }
        println("Time is : "+time.toString())
    }
}

Output:

First async :main @coroutine#2
Second async :main @coroutine#3
Hello World
Time is : 2029

But how is this executing in 2 seconds and running on the same main thread instead of running on an other thread?

Can anybody explain me in detail how these coroutines here work, please?


问:
chef specification for yum-config-manager --add-repo
I use this command to download a repo config and install into /etc/yum.repos.d

```<code>yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
</code>```

I'd like to re-create that in a chef recipe.   Fairly certain that I use the yum_repository resource for chef.  But I can't seem to find an option within yum_repository that downloads the contents of the remote file and uses those contents as the local repo config (as the --add-repo option does).

Seems like I might need to just do something like this instead ?

```<code>remote_file '/etc/yum.repos.d/docker-ce.repo' do
  source 'https://download.docker.com/linux/centos/docker-ce.repo'
  action :create
end
</code>```

Body:
I use this command to download a repo config and install into /etc/yum.repos.d

yum-config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo

I'd like to re-create that in a chef recipe.   Fairly certain that I use the yum_repository resource for chef.  But I can't seem to find an option within yum_repository that downloads the contents of the remote file and uses those contents as the local repo config (as the --add-repo option does).

Seems like I might need to just do something like this instead ?

remote_file '/etc/yum.repos.d/docker-ce.repo' do
  source 'https://download.docker.com/linux/centos/docker-ce.repo'
  action :create
end


问:
mask coloring with mantaining the color intensity(gradient, shading) OpenCV
I am doing instance semantic segmentation and my main goal is to be able to change the color of the detected objects in the image. I obtained the mask and now when it comes to coloring I can't figure out how to maintain the intensity of the color from the original object so the colored one doesnt look so artificial.

Let me explain it on example. The image below represent the walls masks. Now I want to have the masks reflect original shading/intensity/gradient ( I am not sure what exactly plays a major part here), so the walls after coloring look normal.

images comparison:

Image using cv2.min

raw mask

I tried doing cv2.min and just multiplying the mask by the original image in the location of coloring just with /255. normalization, It is better but I still feel like there is some much cleverer way to do it.

```<code>color = (195, 123, 150)
rgb[markers == clicked_pixel] = color
rgb = cv2.min(rgb, rgb_copy)
# alternatively
rgb[markers == clicked_pixel] = color * (rgb_copy[markers == clicked_pixel]/255)

painted = pygame.surfarray.make_surface(rgb)
painted = pygame.transform.scale(painted, size)
display.blit(painted, (0, 0))
</code>```

Body:
I am doing instance semantic segmentation and my main goal is to be able to change the color of the detected objects in the image. I obtained the mask and now when it comes to coloring I can't figure out how to maintain the intensity of the color from the original object so the colored one doesnt look so artificial.

Let me explain it on example. The image below represent the walls masks. Now I want to have the masks reflect original shading/intensity/gradient ( I am not sure what exactly plays a major part here), so the walls after coloring look normal.

images comparison:

Image using cv2.min

raw mask

I tried doing cv2.min and just multiplying the mask by the original image in the location of coloring just with /255. normalization, It is better but I still feel like there is some much cleverer way to do it.

color = (195, 123, 150)
rgb[markers == clicked_pixel] = color
rgb = cv2.min(rgb, rgb_copy)
# alternatively
rgb[markers == clicked_pixel] = color * (rgb_copy[markers == clicked_pixel]/255)

painted = pygame.surfarray.make_surface(rgb)
painted = pygame.transform.scale(painted, size)
display.blit(painted, (0, 0))


问:
Loading Data From API which uses continuous token and Load it to DWH
I am trying to load data from citrixcloud Rest API which uses continuous token and Load it to DWH using ADF. But the processes time is taking more time than python. Can anyone has any solution to make processes faster:

Continuous token will be coming out in json and when we pass continuous token to restapi again it will fetch next set of records

I want to know if any other way that we can do to make it work fast. In python it take 2 mins to run in ADF it taken 14 mins to run.


问:
How can I use these commands together: host_rewrite_path_regex and regex_rewrite in the envoy
I have url https://envoy.workspace.svc.k8s.stage-dp/ns/suppliers/suppliers-portal-core/one
And envoy config:

```<code>                routes:
                - match:
                    prefix: /
                  route:
                    host_rewrite_path_regex:
                      pattern:
                        google_re2: {}
                        regex: ^/ns/([^/]+)/([^/]+)(/.*|)$
                      substitution: \1.\2.svc.k8s.stage-dp
                    append_x_forwarded_host: true

                    regex_rewrite:
                      pattern:
                        google_re2: {}
                        regex: ^/ns/([^/]+)/([^/]+)(/.*|)$
                      substitution: \3
</code>```

In this case regex_rewrite change uri and host_rewrite_path_regex does not work correct.
host_rewrite_path_regex thinks that host is /one
I want to use dynamic_forward_proxy_cluster_http and automatically change:

uri ns/suppliers/suppliers-portal-core/one to one
host envoy.workspace.svc.k8s.stage-dp to suppliers.suppliers-portal-core.svc.k8s.stage-dp
So the final request should change
from: https://envoy.workspace.svc.k8s.stage-dp/ns/suppliers/suppliers-portal-core/one
to: https://suppliers.suppliers-portal-core.svc.k8s.stage-dp/one
Note: I cant use host_rewrite_literal because I have very many URI and fqdn in Kubernetes. I have to use regex.

```<code>                - match:
                    prefix: /
                  route:
                    host_rewrite_path_regex:
                      pattern:
                        google_re2: {}
                        regex: ^/ns/([^/]+)/([^/]+)(/.*|)$
                      substitution: \1.\2.svc.k8s.stage-dp
                    # append_x_forwarded_host: true

                    regex_rewrite:
                      pattern:
                        google_re2: {}
                        regex: ^/ns/([^/]+)/([^/]+)(/.*|)$
                      substitution: \3

                    cluster: dynamic_forward_proxy_cluster_http
                    timeout: 150s
                    retry_policy:
                      retry_on: gateway-error
                      num_retries: 2
                 typed_per_filter_config:
                    envoy.filters.http.dynamic_forward_proxy:
                      "@type": type.googleapis.com/envoy.extensions.filters.http.dynamic_forward_proxy.v3.PerRouteConfig
                      host_rewrite_header: host
</code>```

Body:
I have url https://envoy.workspace.svc.k8s.stage-dp/ns/suppliers/suppliers-portal-core/one
And envoy config:

                routes:
                - match:
                    prefix: /
                  route:
                    host_rewrite_path_regex:
                      pattern:
                        google_re2: {}
                        regex: ^/ns/([^/]+)/([^/]+)(/.*|)$
                      substitution: \1.\2.svc.k8s.stage-dp
                    append_x_forwarded_host: true

                    regex_rewrite:
                      pattern:
                        google_re2: {}
                        regex: ^/ns/([^/]+)/([^/]+)(/.*|)$
                      substitution: \3

In this case regex_rewrite change uri and host_rewrite_path_regex does not work correct.
host_rewrite_path_regex thinks that host is /one
I want to use dynamic_forward_proxy_cluster_http and automatically change:

uri ns/suppliers/suppliers-portal-core/one to one
host envoy.workspace.svc.k8s.stage-dp to suppliers.suppliers-portal-core.svc.k8s.stage-dp
So the final request should change
from: https://envoy.workspace.svc.k8s.stage-dp/ns/suppliers/suppliers-portal-core/one
to: https://suppliers.suppliers-portal-core.svc.k8s.stage-dp/one
Note: I cant use host_rewrite_literal because I have very many URI and fqdn in Kubernetes. I have to use regex.

                - match:
                    prefix: /
                  route:
                    host_rewrite_path_regex:
                      pattern:
                        google_re2: {}
                        regex: ^/ns/([^/]+)/([^/]+)(/.*|)$
                      substitution: \1.\2.svc.k8s.stage-dp
                    # append_x_forwarded_host: true

                    regex_rewrite:
                      pattern:
                        google_re2: {}
                        regex: ^/ns/([^/]+)/([^/]+)(/.*|)$
                      substitution: \3

                    cluster: dynamic_forward_proxy_cluster_http
                    timeout: 150s
                    retry_policy:
                      retry_on: gateway-error
                      num_retries: 2
                 typed_per_filter_config:
                    envoy.filters.http.dynamic_forward_proxy:
                      "@type": type.googleapis.com/envoy.extensions.filters.http.dynamic_forward_proxy.v3.PerRouteConfig
                      host_rewrite_header: host


问:
Compile when concatenation keras models
I have two custom submodels model1 and model2. I concatenate them in another model3:

```<code>class ConcatenateModel(tf.keras.model):
  def __init__(self, model1, model2, **kwargs):
    super().__init__(**kwargs)
    self.model1 = model1
    self.model2 = model2

  def call(self, inputs):
    x = self.model1(inputs)
    x = self.model2(x)
    return x

model3 = ConcatenateModel(model1, model2)
</code>```

The concatenation allows me to access the individual outputs of each submodel after training model3.

To train model3, I run model3.compile(...) and model3.fit(...). As I understand the training procedure, I do NOT have to compile model1 and model2 to train model3, right?

Curiously, I am getting a warning when training model3:

WARNING:tensorflow:Gradients do not exist for variables "layer in model2" when minimizing the loss. If you're using model.compile(), did you forget to provide a loss argument?

I don't really get why this warning occurs. Yes, I didn't compile model2. Thus, it has no loss argument. But since I provided a loss in model3.compile() and run fit() on model3 that shouldn't be a problem, right?

Title: Compile when concatenation keras models

Body:
I have two custom submodels model1 and model2. I concatenate them in another model3:

class ConcatenateModel(tf.keras.model):
  def __init__(self, model1, model2, **kwargs):
    super().__init__(**kwargs)
    self.model1 = model1
    self.model2 = model2

  def call(self, inputs):
    x = self.model1(inputs)
    x = self.model2(x)
    return x

model3 = ConcatenateModel(model1, model2)

The concatenation allows me to access the individual outputs of each submodel after training model3.

To train model3, I run model3.compile(...) and model3.fit(...). As I understand the training procedure, I do NOT have to compile model1 and model2 to train model3, right?

Curiously, I am getting a warning when training model3:

WARNING:tensorflow:Gradients do not exist for variables "layer in model2" when minimizing the loss. If you're using model.compile(), did you forget to provide a loss argument?

I don't really get why this warning occurs. Yes, I didn't compile model2. Thus, it has no loss argument. But since I provided a loss in model3.compile() and run fit() on model3 that shouldn't be a problem, right?


问:
How to use the 'source' command to activate a virtual environment in a separate gnome-terminal?
I am trying to activate my virtual environment using a gnome-terminal.

When I type the following code in terminal,

```<code>gnome-terminal -- bash -c 'source $HOME/dir/to/virtual/environment/bin/activate; exec bash'
</code>```

a new terminal opens, however virtual environment is not activated.

On the other hand if I use other commands (but not source) such as,

```<code>gnome-terminal -- bash -c 'echo "that one works"; exec bash'
</code>```

then I see that new terminal opens with message that I entered.

I see that those are different type of commands, but couldn't make source work.

I would appreciate any help.

Thanks!

Body:
I am trying to activate my virtual environment using a gnome-terminal.

When I type the following code in terminal,

gnome-terminal -- bash -c 'source $HOME/dir/to/virtual/environment/bin/activate; exec bash'

a new terminal opens, however virtual environment is not activated.

On the other hand if I use other commands (but not source) such as,

gnome-terminal -- bash -c 'echo "that one works"; exec bash'

then I see that new terminal opens with message that I entered.

I see that those are different type of commands, but couldn't make source work.

I would appreciate any help.

Thanks!


问:
Ignoring point in trendline
Is there a way to ignore specific points in a series when drawing a trendline?
In a series, I have some "abnormal" points that I still want to plot but they should be excluded when drawing a trendline.</p>

Title: Ignoring point in trendline


问:
Firebase web client ignores storage bucket config
I need help to configure my Firebase project correctly to upload files to the correct storage bucket.

For some strange reason, my Firebase project is ignoring my storage bucket config and always using the default appspot.com bucket.

My Firebase config is as follows:

```<code>const firebaseConfig = {
  ...
  storageBucket: 'my-project-bucket-2', // not the original 'my-project.appspot.com'
};
const app = initializeApp(firebaseConfig);
const storage = getStorage(app, 'gs://my-project-bucket-2');
</code>```

Yet, when I do a file upload, it still lands up in the project's default bucket my-project.appspot.com:

```<code>const bucketPath = uploadPath + '/' + file.name;
const storageRef = ref(storage, bucketPath);
const uploadTask = uploadBytesResumable(storageRef, file);
</code>```

Any ideas what I might be missing?

Note that the project is hosted in a US region, but the default storage bucket is in the EU (by mistake in original setup). Hence I'm now trying to fix this and get everything in the same region.

Body:
I need help to configure my Firebase project correctly to upload files to the correct storage bucket.

For some strange reason, my Firebase project is ignoring my storage bucket config and always using the default appspot.com bucket.

My Firebase config is as follows:

const firebaseConfig = {
  ...
  storageBucket: 'my-project-bucket-2', // not the original 'my-project.appspot.com'
};
const app = initializeApp(firebaseConfig);
const storage = getStorage(app, 'gs://my-project-bucket-2');

Yet, when I do a file upload, it still lands up in the project's default bucket my-project.appspot.com:

const bucketPath = uploadPath + '/' + file.name;
const storageRef = ref(storage, bucketPath);
const uploadTask = uploadBytesResumable(storageRef, file);

Any ideas what I might be missing?

Note that the project is hosted in a US region, but the default storage bucket is in the EU (by mistake in original setup). Hence I'm now trying to fix this and get everything in the same region.


问:
Replace Fragment results in overlaping fragments
This is a known problem, when I change fragments they overlap.
I followed the examples on the internet with a brand new project to test it out, but no success.
What am I missing here?

I started a simple project with the Navigation Drawer Activity

I've given the fragment_home and fragment_gallery an as id

```<code> <androidx.constraintlayout.widget.ConstraintLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/fragment_home"
     android:background="@android:color/background_light"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     tools:context=".ui.home.HomeFragment">
     <Button
         android:id="@+id/button"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="Button"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/textView2" />
     <TextView
         android:id="@+id/textView2"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginBottom="333dp"
         android:text="TextView"
         app:layout_constraintBottom_toTopOf="@+id/button"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 </androidx.constraintlayout.widget.ConstraintLayout>
</code>```

I setup  fragment manager with the transaction:

public void replaceFragment() {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.fragment_home, GalleryFragment.class, null);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}

Created a button and set the method as the onClick activity:

public class HomeFragment extends Fragment {
private View root;
private FragmentHomeBinding binding;
private Button button;

public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
binding = FragmentHomeBinding.inflate(inflater, container, false);
root = binding.getRoot();
button = root.findViewById(R.id.button);

```<code> button.setOnClickListener(new View.OnClickListener() {
     @Override
     public void onClick(View v) {
         // Change Fragment
         ((MainActivity)getActivity()).replaceFragment();
     }
 });
 return root;
</code>```

}

@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

I run the app and press the button, the fragments overlap. What is going on? I've already added a background to the fragments,
did not work. It has something to do with the BackStack, but how? Why is this so difficult? Why can't I simply add and remove a fragment?

Body:
This is a known problem, when I change fragments they overlap.
I followed the examples on the internet with a brand new project to test it out, but no success.
What am I missing here?

I started a simple project with the Navigation Drawer Activity

I've given the fragment_home and fragment_gallery an as id

 <androidx.constraintlayout.widget.ConstraintLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
     xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/fragment_home"
     android:background="@android:color/background_light"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     tools:context=".ui.home.HomeFragment">
     <Button
         android:id="@+id/button"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:text="Button"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toBottomOf="@+id/textView2" />
     <TextView
         android:id="@+id/textView2"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_marginBottom="333dp"
         android:text="TextView"
         app:layout_constraintBottom_toTopOf="@+id/button"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
         app:layout_constraintTop_toTopOf="parent" />
 </androidx.constraintlayout.widget.ConstraintLayout>

I setup  fragment manager with the transaction:

public void replaceFragment() {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.fragment_home, GalleryFragment.class, null);
fragmentTransaction.addToBackStack(null);
fragmentTransaction.commit();
}

Created a button and set the method as the onClick activity:

public class HomeFragment extends Fragment {
private View root;
private FragmentHomeBinding binding;
private Button button;

public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
binding = FragmentHomeBinding.inflate(inflater, container, false);
root = binding.getRoot();
button = root.findViewById(R.id.button);

 button.setOnClickListener(new View.OnClickListener() {
     @Override
     public void onClick(View v) {
         // Change Fragment
         ((MainActivity)getActivity()).replaceFragment();
     }
 });
 return root;

}

@Override
public void onDestroyView() {
super.onDestroyView();
binding = null;
}
}

I run the app and press the button, the fragments overlap. What is going on? I've already added a background to the fragments,
did not work. It has something to do with the BackStack, but how? Why is this so difficult? Why can't I simply add and remove a fragment?


问:
How to mock handling HTTP requests when setting src value of Image?
I'm trying to cover by unit tests some code that looks like:

```<code>const image = new Image();
image.src = 'some.url';
// subscribing on loading event
</code>```

On setting value to src property some HTTP client sends request to this URL. In unit test I'm using URL that doesn't exists in the 'real world' and, I think, this action (sending HTTP-request to specified URL) should be isolated and mocked. I tried to do it using HttpClientTestingModule and HttpTestingController, but received NullInjectorError (testable module doesn't use HttpClientModule and that HTTP-request executes at a lower level). So how can I mock this functionality and control requests/responses without sending them into 'real world'?

Body:
I'm trying to cover by unit tests some code that looks like:

const image = new Image();
image.src = 'some.url';
// subscribing on loading event

On setting value to src property some HTTP client sends request to this URL. In unit test I'm using URL that doesn't exists in the 'real world' and, I think, this action (sending HTTP-request to specified URL) should be isolated and mocked. I tried to do it using HttpClientTestingModule and HttpTestingController, but received NullInjectorError (testable module doesn't use HttpClientModule and that HTTP-request executes at a lower level). So how can I mock this functionality and control requests/responses without sending them into 'real world'?


问:
React useState is undefined after I gave it a value in another method
I have this useState:

```<code>    const [round, setRound] = useState();
</code>```

and I give it value here:

```<code>if (phase == 2) {
            const cookies = new Cookies();
            const url = "http://localhost:7101/GetAllPlayerRounds?userID=" + cookies.get('UserID');
            fetch(url)
                .then((response) => response.json())
                .then((data) => {
                    console.log(data[0]);
                    setRound(data[0]);
}
</code>```

Afterwards, if I want to use it, in for example phase 3 (so in another method), the useState return "undefined". This is the case for a few more useStates. It is like, I am giving it a value and then it doesn't even save it and is again null. I guess I am doing something wrong but I can't really find a solution to this, so would be glad if someone can point me in a direction.

Body:
I have this useState:

    const [round, setRound] = useState();

and I give it value here:

if (phase == 2) {
            const cookies = new Cookies();
            const url = "http://localhost:7101/GetAllPlayerRounds?userID=" + cookies.get('UserID');
            fetch(url)
                .then((response) => response.json())
                .then((data) => {
                    console.log(data[0]);
                    setRound(data[0]);
}

Afterwards, if I want to use it, in for example phase 3 (so in another method), the useState return "undefined". This is the case for a few more useStates. It is like, I am giving it a value and then it doesn't even save it and is again null. I guess I am doing something wrong but I can't really find a solution to this, so would be glad if someone can point me in a direction.


问:
Detecting and Writing if ALL_BUILD was run from CMake
I am creating a project that is built using CMake requires some special packaging afterwards. I would like to ensure that the build is release and that every part has been built in release. I wrote the build type using the following code:

```<code>FUNCTION ( GetCMakeBuildType ret)
    # Returns the generator string to get the current build type:
    SET(${ret} "$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>" PARENT_SCOPE)
ENDFUNCTION()

FUNCTION ( WriteBuildType )
    GetCMakeBuildType(buildTypeString)
    ADD_CUSTOM_TARGET(RecordBuildType ALL COMMAND echo ${buildTypeString} > ./target/build_type.txt)
ENDFUNCTION()
</code>```

But I would also like to detect if ALL the libraries were built by determining if ALL_BUILD was the target or if they only built a single library while the rest is in debug. Can I detect if the user ran ALL_BUILD and write a flag to file to note that packaging is okay?

Body:
I am creating a project that is built using CMake requires some special packaging afterwards. I would like to ensure that the build is release and that every part has been built in release. I wrote the build type using the following code:

FUNCTION ( GetCMakeBuildType ret)
    # Returns the generator string to get the current build type:
    SET(${ret} "$<$<CONFIG:MinSizeRel>:MinSizeRel>$<$<CONFIG:Debug>:Debug>$<$<CONFIG:Release>:Release>$<$<CONFIG:RelWithDebInfo>:RelWithDebInfo>" PARENT_SCOPE)
ENDFUNCTION()

FUNCTION ( WriteBuildType )
    GetCMakeBuildType(buildTypeString)
    ADD_CUSTOM_TARGET(RecordBuildType ALL COMMAND echo ${buildTypeString} > ./target/build_type.txt)
ENDFUNCTION()

But I would also like to detect if ALL the libraries were built by determining if ALL_BUILD was the target or if they only built a single library while the rest is in debug. Can I detect if the user ran ALL_BUILD and write a flag to file to note that packaging is okay?


问:
MongoTimeoutError: Server selection timed out after 10000 ms
I am trying to create a MERN app and containerize it with docker and manage the containers using kubernetes (minikube).

When I try to run the nodejs container it logs the following error

```<code>Server v8 up and running on port 5000 !
MongoTimeoutError: Server selection timed out after 10000 ms
at Timeout._onTimeout (/home/app/node_modules/mongodb-core/lib/sdam/topology.js:773:16)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
[Symbol(mongoErrorContextSymbol)]: {}
}
</code>```

The code at server.js is as follows:

const express = require("express");
const mongoose = require("mongoose");

const app = express();

// the connection string when using username and password in mongodb-server
// mongodb://${process.env.MONGO_DB_USERNAME}:${process.env.MONGO_DB_PASSWORD}@mongodb-service:27017/exam?authSource=${process.env.MONGO_DB_USERNAME}
mongoose
  .connect("mongodb://mongodb-service/exam", {
    useNewUrlParser: true,
    useUnifiedTopology: true,
  })
  .then(() => console.log(`MongoDB successfully connected`))
  .catch((err) => console.log(err));```
</div>
</div>
</p>
<p>The logs in mongodb container are as follows:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>{"t":{"$date":"2022-12-16T14:28:58.316+00:00"},"s":"I",  "c":"COMMAND",  "id":51803,   "ctx":"LogicalSessionCacheRefresh","msg":"Slow query","attr":{"type":"command","ns":"config.system.sessions","command":{"createIndexes":"system.sessions","v":2,"indexes":[{"key":{"lastUse":1},"name":"lsidTTLIndex","expireAfterSeconds":1800}],"ignoreUnknownIndexOptions":false,"writeConcern":{},"$db":"config"},"numYields":0,"reslen":114,"locks":{"ParallelBatchWriterMode":{"acquireCount":{"r":5}},"FeatureCompatibilityVersion":{"acquireCount":{"r":5,"w":1}},"ReplicationStateTransition":{"acquireCount":{"w":5}},"Global":{"acquireCount":{"r":5,"w":1}},"Database":{"acquireCount":{"r":4,"w":1}},"Collection":{"acquireCount":{"r":5,"w":1}},"Mutex":{"acquireCount":{"r":8}}},"storage":{},"protocol":"op_msg","durationMillis":529}}</code>```

If I should provide more details please tell me

Thanks in advance

Body:
I am trying to create a MERN app and containerize it with docker and manage the containers using kubernetes (minikube).

When I try to run the nodejs container it logs the following error

Server v8 up and running on port 5000 !
MongoTimeoutError: Server selection timed out after 10000 ms
at Timeout._onTimeout (/home/app/node_modules/mongodb-core/lib/sdam/topology.js:773:16)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
[Symbol(mongoErrorContextSymbol)]: {}
}

The code at server.js is as follows:

const express = require("express");
const mongoose = require("mongoose");

const app = express();

// the connection string when using username and password in mongodb-server
// mongodb://${process.env.MONGO_DB_USERNAME}:${process.env.MONGO_DB_PASSWORD}@mongodb-service:27017/exam?authSource=${process.env.MONGO_DB_USERNAME}
mongoose
  .connect("mongodb://mongodb-service/exam", {
    useNewUrlParser: true,
    useUnifiedTopology: true,
  })
  .then(() => console.log(`MongoDB successfully connected`))
  .catch((err) => console.log(err));

The logs in mongodb container are as follows:

{"t":{"$date":"2022-12-16T14:28:58.316+00:00"},"s":"I",  "c":"COMMAND",  "id":51803,   "ctx":"LogicalSessionCacheRefresh","msg":"Slow query","attr":{"type":"command","ns":"config.system.sessions","command":{"createIndexes":"system.sessions","v":2,"indexes":[{"key":{"lastUse":1},"name":"lsidTTLIndex","expireAfterSeconds":1800}],"ignoreUnknownIndexOptions":false,"writeConcern":{},"$db":"config"},"numYields":0,"reslen":114,"locks":{"ParallelBatchWriterMode":{"acquireCount":{"r":5}},"FeatureCompatibilityVersion":{"acquireCount":{"r":5,"w":1}},"ReplicationStateTransition":{"acquireCount":{"w":5}},"Global":{"acquireCount":{"r":5,"w":1}},"Database":{"acquireCount":{"r":4,"w":1}},"Collection":{"acquireCount":{"r":5,"w":1}},"Mutex":{"acquireCount":{"r":8}}},"storage":{},"protocol":"op_msg","durationMillis":529}}

If I should provide more details please tell me

Thanks in advance


问:
mysql --version returns information but mysql.server start not found
I am on m1 mac os ventura
using .zshrc and mamp.
I added the path in my .zshrc txt  file

```<code>export PATH="/Applications/MAMP/Library/bin/:$PATH"
</code>```

in terminal

```<code>mysql --version
</code>```

returns

```<code> Ver 14.14 Distrib 5.7.34, for osx11.0 (x86_64) using  EditLine wrapper
</code>```

in terminal

```<code> mysql.server start
</code>```

returns

```<code> zsh: command not found: mysql.server
</code>```

How do i troubleshoot and fix this?

Body:
I am on m1 mac os ventura
using .zshrc and mamp.
I added the path in my .zshrc txt  file

export PATH="/Applications/MAMP/Library/bin/:$PATH"

in terminal

mysql --version

returns

 Ver 14.14 Distrib 5.7.34, for osx11.0 (x86_64) using  EditLine wrapper

in terminal

 mysql.server start

returns

 zsh: command not found: mysql.server

How do i troubleshoot and fix this?


问:
Jetpack Compose ExposedDropdownMenu always going up
I'm trying to implement ExposedDropdownMenu - which I want to be displayed underneath TextField - when I set height of dropdown to max. 20 dp then everything is okay. But for any greater value it is always displayed above. Do you know what could be the issue here?

How it looks like:

My code:

```<code>@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TextFieldWithDropdown(
    modifier: Modifier = Modifier,
    textFieldState: TextFieldState,
    textCallback: (String) -> Unit,
    list: List<String>,
    keyboardOptions: KeyboardOptions,
    textStyle: TextStyle
) {
//        .align(Alignment.CenterStart)

    val dropDownOptions = remember { mutableStateOf(listOf<String>()) }
    val textFieldValue = remember { mutableStateOf(TextFieldValue()) }
    val dropDownExpanded = remember { mutableStateOf(false) }

    ExposedDropdownMenuBox(
        modifier = modifier,
        expanded = dropDownExpanded.value, onExpandedChange = {
            dropDownExpanded.value = !dropDownExpanded.value
        }) {
        TextField(
            modifier = Modifier
                .menuAnchor()
                .fillMaxWidth()
                .onFocusChanged { focusState ->
                    if (!focusState.isFocused)
                        dropDownExpanded.value = false
                },
            value = textFieldState.text.value,
            onValueChange = {
                textFieldState.text.value = it
                textCallback.invoke(it)
                dropDownOptions.value =
                    list.filter { it.startsWith(textFieldState.text.value) && it != textFieldState.text.value }
                        .take(3)
                dropDownExpanded.value = dropDownOptions.value.isNotEmpty()
            },
            singleLine = true,
            maxLines = 1,
            textStyle = textStyle,
        )
        ExposedDropdownMenu(
            expanded = dropDownExpanded.value,
            onDismissRequest = {
                dropDownExpanded.value = false
            },
        ) {
            dropDownOptions.value.forEach { text ->
                DropdownMenuItem(text = {
                    Text(text = text)
                }, onClick = {
                    textFieldState.text.value = text
                    dropDownExpanded.value = false
                })
            }
        }
    }
}
</code>```

Body:
I'm trying to implement ExposedDropdownMenu - which I want to be displayed underneath TextField - when I set height of dropdown to max. 20 dp then everything is okay. But for any greater value it is always displayed above. Do you know what could be the issue here?

How it looks like:

My code:

@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TextFieldWithDropdown(
    modifier: Modifier = Modifier,
    textFieldState: TextFieldState,
    textCallback: (String) -> Unit,
    list: List<String>,
    keyboardOptions: KeyboardOptions,
    textStyle: TextStyle
) {
//        .align(Alignment.CenterStart)

    val dropDownOptions = remember { mutableStateOf(listOf<String>()) }
    val textFieldValue = remember { mutableStateOf(TextFieldValue()) }
    val dropDownExpanded = remember { mutableStateOf(false) }

    ExposedDropdownMenuBox(
        modifier = modifier,
        expanded = dropDownExpanded.value, onExpandedChange = {
            dropDownExpanded.value = !dropDownExpanded.value
        }) {
        TextField(
            modifier = Modifier
                .menuAnchor()
                .fillMaxWidth()
                .onFocusChanged { focusState ->
                    if (!focusState.isFocused)
                        dropDownExpanded.value = false
                },
            value = textFieldState.text.value,
            onValueChange = {
                textFieldState.text.value = it
                textCallback.invoke(it)
                dropDownOptions.value =
                    list.filter { it.startsWith(textFieldState.text.value) && it != textFieldState.text.value }
                        .take(3)
                dropDownExpanded.value = dropDownOptions.value.isNotEmpty()
            },
            singleLine = true,
            maxLines = 1,
            textStyle = textStyle,
        )
        ExposedDropdownMenu(
            expanded = dropDownExpanded.value,
            onDismissRequest = {
                dropDownExpanded.value = false
            },
        ) {
            dropDownOptions.value.forEach { text ->
                DropdownMenuItem(text = {
                    Text(text = text)
                }, onClick = {
                    textFieldState.text.value = text
                    dropDownExpanded.value = false
                })
            }
        }
    }
}


问:
Jenkins and Docker compose: No such file or directory eror when adding a command
I have a compose manifest with all my services(client,server,db) and also a jenkins image, in my compose file, it works fine if I add no commands for the Jenkins image (my container runs without issues).

But Since i would like to make use of Docker commands in my Jenkinsfile, I would need Docker installed within my Jenkins container, i tried adding commands to be able to get the Docker client in my container but I get this error

```<code>/usr/local/bin/jenkins.sh: line 49: /apt-get update && curl -sSL https://get.docker.com/ | sh: No such file or directory
</code>```

My Jenkinsfile just consists of commands to output the versions of docker, docker compose etc

This is my docker compose file for jen

```<code>version: '3.7'

# Define services
services:
  jenkins:
    image: jenkins/jenkins:lts
    privileged: true
    user: root
    ports:
      - 8080:8080
      - 50000:50000
    restart: always
    volumes:
      - jenkins-volume:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - docker_certs:/certs/client
    # this is what gives me an error
    command:
      - "apt-get update && curl -sSL https://get.docker.com/ | bash"

volumes:
  jenkins-volume:
  docker_certs:
</code>```

If i remove this command

```<code>    command:
      - "apt-get update && curl -sSL https://get.docker.com/ | bash"
</code>```

and execute those commands manually via the shell, it works fine and my Jenkins job actually works as expected, but adding this command in my compose file doesn't and gives me an error.

EDIT

It seems to work now, I ended up using a separate Dockerfile for Jenkins where I could add commands needed to install docker + docker compose and also add the jenkins that Jenkins creates to the docker group (RUN usermod -aG docker jenkins).

Jenkins Dockerfile

```<code>FROM jenkins/jenkins:lts
USER root
# get latest packages
RUN apt-get update
# download docker and docker compose
RUN curl -sSL https://get.docker.com/ | sh
# add the jenkins user to the docker group - fixed the permissions issue
RUN usermod -aG docker jenkins
</code>```

and in my docker compose file

```<code> jenkins:
    privileged: true
    build:
      # Path where my Dockerfile is (Wherever you put the above Dockerfile)
      context: ./
    ports:
      - 8080:8080
      - 50000:50000
    restart: always

    # Making use of the 2 volumes defined in volumes section to persist data after bringing containers down
    volumes:
      - jenkins-volume:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - docker_certs:/certs/client

# you would need to create these volumes first
# using this: docker volume create <your_volume_name>
volumes:
  jenkins-volume:
  docker_certs:

</code>```

I brought down all my containers and then brought it back up, accessed the jenkins url in my browser and I could complete my test pipeline successfully.

```<code>pipeline {
    agent any

    stages {

        // Makes sure docker and docker compose are on the system
        stage('Verify tools') {
            steps {
                sh '''
                    docker info
                    docker version
                    docker compose version
                    curl --version
                  '''
            }
        }
    }
}
</code>```

Body:
I have a compose manifest with all my services(client,server,db) and also a jenkins image, in my compose file, it works fine if I add no commands for the Jenkins image (my container runs without issues).

But Since i would like to make use of Docker commands in my Jenkinsfile, I would need Docker installed within my Jenkins container, i tried adding commands to be able to get the Docker client in my container but I get this error

/usr/local/bin/jenkins.sh: line 49: /apt-get update && curl -sSL https://get.docker.com/ | sh: No such file or directory

My Jenkinsfile just consists of commands to output the versions of docker, docker compose etc

This is my docker compose file for jen

version: '3.7'

# Define services
services:
  jenkins:
    image: jenkins/jenkins:lts
    privileged: true
    user: root
    ports:
      - 8080:8080
      - 50000:50000
    restart: always
    volumes:
      - jenkins-volume:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - docker_certs:/certs/client
    # this is what gives me an error
    command:
      - "apt-get update && curl -sSL https://get.docker.com/ | bash"

volumes:
  jenkins-volume:
  docker_certs:

If i remove this command

    command:
      - "apt-get update && curl -sSL https://get.docker.com/ | bash"

and execute those commands manually via the shell, it works fine and my Jenkins job actually works as expected, but adding this command in my compose file doesn't and gives me an error.

EDIT

It seems to work now, I ended up using a separate Dockerfile for Jenkins where I could add commands needed to install docker + docker compose and also add the jenkins that Jenkins creates to the docker group (RUN usermod -aG docker jenkins).

Jenkins Dockerfile

FROM jenkins/jenkins:lts
USER root
# get latest packages
RUN apt-get update
# download docker and docker compose
RUN curl -sSL https://get.docker.com/ | sh
# add the jenkins user to the docker group - fixed the permissions issue
RUN usermod -aG docker jenkins

and in my docker compose file

 jenkins:
    privileged: true
    build:
      # Path where my Dockerfile is (Wherever you put the above Dockerfile)
      context: ./
    ports:
      - 8080:8080
      - 50000:50000
    restart: always

    # Making use of the 2 volumes defined in volumes section to persist data after bringing containers down
    volumes:
      - jenkins-volume:/var/jenkins_home
      - /var/run/docker.sock:/var/run/docker.sock
      - docker_certs:/certs/client

# you would need to create these volumes first
# using this: docker volume create <your_volume_name>
volumes:
  jenkins-volume:
  docker_certs:

I brought down all my containers and then brought it back up, accessed the jenkins url in my browser and I could complete my test pipeline successfully.

pipeline {
    agent any

    stages {

        // Makes sure docker and docker compose are on the system
        stage('Verify tools') {
            steps {
                sh '''
                    docker info
                    docker version
                    docker compose version
                    curl --version
                  '''
            }
        }
    }
}


问:
Unable to consume messages from AWS SQS DLQ but can consume from main SQS queue
I have two separate message listener classes written in Kotlin to listen to two separate AWS SQS queues (one is main SQS queue and another is Dead Letter Queue (DLQ)).
The problem is that the message listener for DLQ is unable to consume the messages from its DLQ. This is a tricky problem because my listener code of DLQ is absolutely correct and can consume the messages from other SQS queues but not for this DLQ particularly. I tested its working functionality by replacing DLQ name by the main queue name. There are messages on DLQ as well. By the way both queues are standard queues on AWS (not FIFO).

Here is the code snippet where I'm initializing the SQS connection:-

```<code>@PostConstruct
fun init() {
    try {
        if (enableCalmQueue) {
            initializeListeners("$podName-${Util.MAIN_QUEUE}", mainQueueListener)
            initializeListeners("$podName-${Util.DLQ}", dlqListener)
            LOG.info("Initialized SQS Queue Response Handler")
        }
    } catch (e: Exception) {
        LOG.warn("Failed to Initialize response handler due to ${e.message}")
    }
}
   private fun initializeListeners(queueName: String, messageListener: MessageListener) {
        val connection = getSqsConnectionObject()
        val session = connection.createSession(false, SQSSession.UNORDERED_ACKNOWLEDGE)
        val consumer = session.createConsumer(session.createQueue(queueName))
        consumer.messageListener = messageListener
        connection.start()
        LOG.info("Initialized $messageListener for $queueName")
    }

  private fun getSqsConnectionObject(): SQSConnection {
        val connectionFactory = SQSConnectionFactory(
                ProviderConfiguration(),
                AmazonSQSClientBuilder.defaultClient()
        )
        return connectionFactory.createConnection()
    }
</code>```

DLQ Listener:-

```<code>@Named("dlqListener")
class DeadLetterQueueListener : MessageListener {

    @Value("\${pod_name}")
    private val podName: String = "dev"

    @Inject
    private lateinit var tradeStatusService: TradeStatusService

    companion object {
        private val LOG = LoggerFactory.getLogger(DeadLetterQueueListener::class.java)
    }

    override fun onMessage(message: Message?) {
        try {
            if (message is TextMessage) {
                LOG.info("Received message ${message.text} in Dead Letter Queue Listener " +
                        "with jmsMessageId: ${message.jmsMessageID}")
                if(message.getStringProperty(Util.QUEUE_NAME) == "$podName-${Util.MAIN_QUEUE}") {
                    message.acknowledge()
                    val jsonMessage = message.text
                    val objectMapper = ObjectMapper()
                    val externalTradeInputs = objectMapper.readValue(jsonMessage, ExternalTradeInputs::class.java)
                    val tradeStatusData = TradeStatusData().apply {
                        this.tradeBookingId = externalTradeInputs.tradeBookingId
                        this.statusDateTime = Date()
                    }
                }
            }
        } catch (e: Exception) {
            LOG.error("Error processing in Dead Letter Queue Listener with : ${e.message}")
        }
    }
}
</code>```

Like I mentioned, this dlqListener works fine if I pass the main queue name but not DLQ queue name.
I tried to debug a lot but could not find anything concrete. Both main and DLQ exists in AWS. I suspect something some wrong in the way DLQ has been configured but to my best I have verified but nothing found any issues over there.
I would really appreciate if someone can give me some reference or hints about its root cause.

Body:
I have two separate message listener classes written in Kotlin to listen to two separate AWS SQS queues (one is main SQS queue and another is Dead Letter Queue (DLQ)).
The problem is that the message listener for DLQ is unable to consume the messages from its DLQ. This is a tricky problem because my listener code of DLQ is absolutely correct and can consume the messages from other SQS queues but not for this DLQ particularly. I tested its working functionality by replacing DLQ name by the main queue name. There are messages on DLQ as well. By the way both queues are standard queues on AWS (not FIFO).

Here is the code snippet where I'm initializing the SQS connection:-

@PostConstruct
fun init() {
    try {
        if (enableCalmQueue) {
            initializeListeners("$podName-${Util.MAIN_QUEUE}", mainQueueListener)
            initializeListeners("$podName-${Util.DLQ}", dlqListener)
            LOG.info("Initialized SQS Queue Response Handler")
        }
    } catch (e: Exception) {
        LOG.warn("Failed to Initialize response handler due to ${e.message}")
    }
}
   private fun initializeListeners(queueName: String, messageListener: MessageListener) {
        val connection = getSqsConnectionObject()
        val session = connection.createSession(false, SQSSession.UNORDERED_ACKNOWLEDGE)
        val consumer = session.createConsumer(session.createQueue(queueName))
        consumer.messageListener = messageListener
        connection.start()
        LOG.info("Initialized $messageListener for $queueName")
    }

  private fun getSqsConnectionObject(): SQSConnection {
        val connectionFactory = SQSConnectionFactory(
                ProviderConfiguration(),
                AmazonSQSClientBuilder.defaultClient()
        )
        return connectionFactory.createConnection()
    }

DLQ Listener:-

@Named("dlqListener")
class DeadLetterQueueListener : MessageListener {

    @Value("\${pod_name}")
    private val podName: String = "dev"

    @Inject
    private lateinit var tradeStatusService: TradeStatusService

    companion object {
        private val LOG = LoggerFactory.getLogger(DeadLetterQueueListener::class.java)
    }

    override fun onMessage(message: Message?) {
        try {
            if (message is TextMessage) {
                LOG.info("Received message ${message.text} in Dead Letter Queue Listener " +
                        "with jmsMessageId: ${message.jmsMessageID}")
                if(message.getStringProperty(Util.QUEUE_NAME) == "$podName-${Util.MAIN_QUEUE}") {
                    message.acknowledge()
                    val jsonMessage = message.text
                    val objectMapper = ObjectMapper()
                    val externalTradeInputs = objectMapper.readValue(jsonMessage, ExternalTradeInputs::class.java)
                    val tradeStatusData = TradeStatusData().apply {
                        this.tradeBookingId = externalTradeInputs.tradeBookingId
                        this.statusDateTime = Date()
                    }
                }
            }
        } catch (e: Exception) {
            LOG.error("Error processing in Dead Letter Queue Listener with : ${e.message}")
        }
    }
}

Like I mentioned, this dlqListener works fine if I pass the main queue name but not DLQ queue name.
I tried to debug a lot but could not find anything concrete. Both main and DLQ exists in AWS. I suspect something some wrong in the way DLQ has been configured but to my best I have verified but nothing found any issues over there.
I would really appreciate if someone can give me some reference or hints about its root cause.