问:
Values summed in a previous group won't sum in a new group
When I group 'time_interval_code' the values of 'vehicle_real' in a result file are correct only for the first group, but not for the others. When 'time_interval_code' was used in previous group it seems that it is not in the sum of the new group. How to make sure 'vehicle _real' values are available to sum in every group?

The idea of 'time_interval_code' was to get rid of time format. I have 8 time intervals in the morning (07:00 - 07:15 is 1, 07:15 - 07:30 - 2, etc. up to 8).

I want to check maximum flow rate in an hour by adding 15 minutes each time for every junction and every direction from which cars were entering a junction. The measurements are given in 15 minutes interval, so I need to check 4 intervals every time. Results to be 'junction_id', 'source_direction' and sum of the 'vehicle_real' for that junction, direction and group of 'time_interval_code'.

To solve this I created groups that contains 4 time intervals. The problem I have is when I group 'time_interval_code' the values of 'vehicle_real' in a result file are correct only for the first group (1,2,3,4), but not for the others.

```<code>import pandas as pd
data = pd.read_excel("traffic.xlsx")

# Create a DataFrame from the list of data
df = pd.DataFrame(data)

# Define a function to get the morning groups for each time interval code
def get_morning_group(time_interval_code):
  morning_groups = [(1, 2, 3, 4), (2, 3, 4, 5), (3, 4, 5, 6), (4, 5, 6, 7), (5, 6, 7, 8)]

  for group in morning_groups:
    if time_interval_code in group:
      return group

# Add a new column to the DataFrame that contains the morning groups for each time interval code
df['morning_groups'] = df['time_interval_code'].apply(get_morning_group)

# Group data by values
grouped_data = df.groupby(['junction_id', 'source_direction', 'morning_groups'])

# Calculate the sum of the vehicles_real values for each group
grouped_data = grouped_data['vehicles_real'].sum()

# Convert the grouped data back into a DataFrame
df = grouped_data.reset_index()

# Create the pivot table
pivot_table = df.pivot_table(index=['junction_id', 'source_direction'], columns=['morning_groups'], values='vehicles_real')

# Save the pivot table to a new Excel file
pivot_table.to_excel('max_flow_rate.xlsx')
</code>```

The traffic.xlsx file has ca. 140k records. Every junction has at least 2 'source_direction' values. Junction with 'source_direction' has 'vehicles_real' values for every 'time_interval_code'. The file looks like this:

id
time_interval_code
junction_id
source_direction
vehicles_real

1
3
1001
N
140

2
1
2002
E
10

18
2
2011
W
41

21
5
2030
S
2

33
8
2030
N
140

35
7
2150
E
10

41
6
2150
W
41

52
5
2150
S
2

The output I get is fine, but the values are correct only for (1,2,3,4).

junction_id
source_direction
(1,2,3,4)
(2,3,4,5)
(3,4,5,6)
(4,5,6,7)
(5,6,7,8)

1001
N
257
95
69
61
59

1001
S
456
120
136
153
111

1002
N
2597
676
670
619
645

1002
S
2571
552
641
656
595

1003
N
586
181
148
127
142

1003
S
711
174
147
157
141

Body:
When I group 'time_interval_code' the values of 'vehicle_real' in a result file are correct only for the first group, but not for the others. When 'time_interval_code' was used in previous group it seems that it is not in the sum of the new group. How to make sure 'vehicle _real' values are available to sum in every group?

The idea of 'time_interval_code' was to get rid of time format. I have 8 time intervals in the morning (07:00 - 07:15 is 1, 07:15 - 07:30 - 2, etc. up to 8).

I want to check maximum flow rate in an hour by adding 15 minutes each time for every junction and every direction from which cars were entering a junction. The measurements are given in 15 minutes interval, so I need to check 4 intervals every time. Results to be 'junction_id', 'source_direction' and sum of the 'vehicle_real' for that junction, direction and group of 'time_interval_code'.

To solve this I created groups that contains 4 time intervals. The problem I have is when I group 'time_interval_code' the values of 'vehicle_real' in a result file are correct only for the first group (1,2,3,4), but not for the others.

import pandas as pd
data = pd.read_excel("traffic.xlsx")

# Create a DataFrame from the list of data
df = pd.DataFrame(data)

# Define a function to get the morning groups for each time interval code
def get_morning_group(time_interval_code):
  morning_groups = [(1, 2, 3, 4), (2, 3, 4, 5), (3, 4, 5, 6), (4, 5, 6, 7), (5, 6, 7, 8)]

  for group in morning_groups:
    if time_interval_code in group:
      return group

# Add a new column to the DataFrame that contains the morning groups for each time interval code
df['morning_groups'] = df['time_interval_code'].apply(get_morning_group)

# Group data by values
grouped_data = df.groupby(['junction_id', 'source_direction', 'morning_groups'])

# Calculate the sum of the vehicles_real values for each group
grouped_data = grouped_data['vehicles_real'].sum()

# Convert the grouped data back into a DataFrame
df = grouped_data.reset_index()

# Create the pivot table
pivot_table = df.pivot_table(index=['junction_id', 'source_direction'], columns=['morning_groups'], values='vehicles_real')

# Save the pivot table to a new Excel file
pivot_table.to_excel('max_flow_rate.xlsx')

The traffic.xlsx file has ca. 140k records. Every junction has at least 2 'source_direction' values. Junction with 'source_direction' has 'vehicles_real' values for every 'time_interval_code'. The file looks like this:

id
time_interval_code
junction_id
source_direction
vehicles_real

1
3
1001
N
140

2
1
2002
E
10

18
2
2011
W
41

21
5
2030
S
2

33
8
2030
N
140

35
7
2150
E
10

41
6
2150
W
41

52
5
2150
S
2

The output I get is fine, but the values are correct only for (1,2,3,4).

junction_id
source_direction
(1,2,3,4)
(2,3,4,5)
(3,4,5,6)
(4,5,6,7)
(5,6,7,8)

1001
N
257
95
69
61
59

1001
S
456
120
136
153
111

1002
N
2597
676
670
619
645

1002
S
2571
552
641
656
595

1003
N
586
181
148
127
142

1003
S
711
174
147
157
141


来源: stackexchange

问:
Handling Redshift identity columns in SQLAlchemy
This question is related to a Question posted a few years ago.

I'm using the redshift-sqlalchemy package to connect SQLAlchemy to Redshift.
In Redshift I have a simple "companies" table:

```<code>CREATE TABLE apis
(
   id   INTEGER IDENTITY(1,1) NOT NULL,
   name   VARCHAR(255) NOT NULL,
   PRIMARY KEY(id)
);
</code>```

On the SQLAlchemy side I have mapped it like so:

```<code>Base = declarative_base()
class Company(Base):
    __tablename__ = 'companies'
    id = Column(BigInteger, primary_key=True, redshift_identity=(1, 1))
    name = Column(String, nullable=False)
    def __init__(self, name: str):
        self.name = name
</code>```

If I try to create a company:

```<code>company = Company(name = 'Hoge')
session.add(company)
session.commit()
</code>```

then I get this error:

```<code>(sqlalchemy.exc.ProgrammingError) (redshift_connector.error.ProgrammingError) {'S': 'ERROR', 'C': '42P01', 'M': 'relation "companies_id_seq" does not exist', 'F': '../src/pg/src/backend/catalog/namespace.c', 'L': '267', 'R': 'LocalRangeVarGetRelid'}
[SQL: INSERT INTO companies (id, name) VALUES (%s, %s)]
[parameters: [{'name': 'Hoge'}]]
(Background on this error at: https://sqlalche.me/e/14/f405)
</code>```

I think the problem is that you are trying to insert data also in the ID column with the IDENTITY option set.

```<code>SQL: INSERT INTO companies (id, name) VALUES (%s, %s)
</code>```

If I execute SQL directly on a Redshift table I get the following error.

```<code>ERROR: cannot set an identity column to a value.
</code>```

Please tell me how to define the auto-populated ID column in sqlalchemy-redshift model?

ContentLicense: CC BY-SA 4.0

Body:
This question is related to a Question posted a few years ago.

I'm using the redshift-sqlalchemy package to connect SQLAlchemy to Redshift.
In Redshift I have a simple "companies" table:

CREATE TABLE apis
(
   id   INTEGER IDENTITY(1,1) NOT NULL,
   name   VARCHAR(255) NOT NULL,
   PRIMARY KEY(id)
);

On the SQLAlchemy side I have mapped it like so:

Base = declarative_base()
class Company(Base):
    __tablename__ = 'companies'
    id = Column(BigInteger, primary_key=True, redshift_identity=(1, 1))
    name = Column(String, nullable=False)
    def __init__(self, name: str):
        self.name = name

If I try to create a company:

company = Company(name = 'Hoge')
session.add(company)
session.commit()

then I get this error:

(sqlalchemy.exc.ProgrammingError) (redshift_connector.error.ProgrammingError) {'S': 'ERROR', 'C': '42P01', 'M': 'relation "companies_id_seq" does not exist', 'F': '../src/pg/src/backend/catalog/namespace.c', 'L': '267', 'R': 'LocalRangeVarGetRelid'}
[SQL: INSERT INTO companies (id, name) VALUES (%s, %s)]
[parameters: [{'name': 'Hoge'}]]
(Background on this error at: https://sqlalche.me/e/14/f405)

I think the problem is that you are trying to insert data also in the ID column with the IDENTITY option set.

SQL: INSERT INTO companies (id, name) VALUES (%s, %s)

If I execute SQL directly on a Redshift table I get the following error.

ERROR: cannot set an identity column to a value.

Please tell me how to define the auto-populated ID column in sqlalchemy-redshift model?


问:
ModuleNotFoundError: No module named 'twilio.rest'; 'twilio' is not a package
from twilio.rest import Client
ModuleNotFoundError: No module named 'twilio.rest'; 'twilio' is not a package

Getting error while trying to use Twilio.
Have already uninstalled and installed twilio

Please help me fix this

I am trying to connect Twilio with my VS Code, it works on google colab but not on VS Code


问:
How to stack dark mode and peer-checked in tailwind css
I have custom radio buttons and I'm using the tailwind peer and peer-checked to change the background of the label when the radio button is checked , now I need to change the background color of the label when I am dark mode.</p>
```<code>
<input class="radio_input hidden peer" type="radio" id="html"  name="expense_categories_id" value="html">
<label  class="radio_label cursor-pointer  bg-white flex justify-center items-center flex-col text-gray-800 rounded-xl   border-4 border-gray-200 px-4 py-4 peer-checked:bg-gray-800 peer-checked:dark:bg-gray-100 peer-checked:text-white peer-checked:dark:text-gray-600 dark:border-gray-800 dark:bg-gray-600 dark:text-gray-100 " for="html">Name
</label>

</code>```

Body:
I have custom radio buttons and I'm using the tailwind peer and peer-checked to change the background of the label when the radio button is checked , now I need to change the background color of the label when I am dark mode.

<input class="radio_input hidden peer" type="radio" id="html"  name="expense_categories_id" value="html">
Name


问:
criteria api sub-select with sub-select and custom fields
I'd like to rewrite following sql query to criteria api:

select * from demands d
where exists (
  select * from (
   select a.demandid,
     min(coalesce(a.securitylevel, a.securitylevel, -1)) themin,
     max(coalesce(a.securitylevel, -1)) themax
     from allocations a
     group by demandid)
  where demandid = d.id
  and (themin = -1 and themax = -1
   or themax >= 5)
);
```
<p>The problem is that I'm not able to figure out how to write <code>select</code> clause for sub-queries, my current implementation produces <code>CompoundSelection</code> however <code>subQyer.select</code> accepts only <code>Expression</code> (<code>DemandSecLevel</code> is custom POJO/DTO).</p>
<pre class="lang-java prettyprint-override"><code>public static Specification<Demand> bySecurityLevel(
        final Integer securityLevel) {
    return (root, query, cb) -> {

        final Subquery<DemandSecLevel> subQuery = query.subquery(DemandSecLevel.class);
        final Root<AllocationEntry> allocationEntryRoot = subQuery.from(AllocationEntry.class);
        subQuery.select(cb.construct(
                DemandSecLevel.class,
                allocationEntryRoot.get(AllocationEntry_.incidentDemandId),
                cb.min(cb.coalesce(allocationEntryRoot.get(AllocationEntry_.securityLevel), -1))
                        .alias("minSecLevel"),
                cb.max(cb.coalesce(allocationEntryRoot.get(AllocationEntry_.securityLevel), -1))
                        .alias("maxSecLevel")
        ));
</code>```

Body:
I'd like to rewrite following sql query to criteria api:

select * from demands d
where exists (
  select * from (
   select a.demandid,
     min(coalesce(a.securitylevel, a.securitylevel, -1)) themin,
     max(coalesce(a.securitylevel, -1)) themax
     from allocations a
     group by demandid)
  where demandid = d.id
  and (themin = -1 and themax = -1
   or themax >= 5)
);

The problem is that I'm not able to figure out how to write select clause for sub-queries, my current implementation produces CompoundSelection however subQyer.select accepts only Expression (DemandSecLevel is custom POJO/DTO).

public static Specification<Demand> bySecurityLevel(
        final Integer securityLevel) {
    return (root, query, cb) -> {

        final Subquery<DemandSecLevel> subQuery = query.subquery(DemandSecLevel.class);
        final Root<AllocationEntry> allocationEntryRoot = subQuery.from(AllocationEntry.class);
        subQuery.select(cb.construct(
                DemandSecLevel.class,
                allocationEntryRoot.get(AllocationEntry_.incidentDemandId),
                cb.min(cb.coalesce(allocationEntryRoot.get(AllocationEntry_.securityLevel), -1))
                        .alias("minSecLevel"),
                cb.max(cb.coalesce(allocationEntryRoot.get(AllocationEntry_.securityLevel), -1))
                        .alias("maxSecLevel")
        ));


问:
Jetpack Composable gets disposed when SurfaceView is playing video and navigates back to previous screen
I am adding a surfaceView wrapped inside AndroidView to play some video, here is the snippet of it -

```<code>    AndroidView(
        modifier = modifier.fillMaxSize(),
        factory = { context ->
            val view = LayoutInflater.from(context).inflate(R.layout.layout_player, FrameLayout(context), false)

            val aspectRatioFrameLayout = view.findViewById<AspectRatioFrameLayout>(R.id.aspect_ratio_frame_layout)
            aspectRatioFrameLayout.setAspectRatio(videoAspectRatioValue)

            val surfaceView = view.findViewById<SurfaceView>(R.id.surface_view)
            surfaceView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
                override fun onViewAttachedToWindow(view: View) {
                    attachSurface(view as SurfaceView)
                }

                override fun onViewDetachedFromWindow(view: View) {
                    detachSurface(view as SurfaceView)
                }
            })

            return@AndroidView view
        }
    )
</code>```

and seeing random closing/disposing of the composable and navigating back to its previous screen when the video is playing and here is the logs that I am getting right now when it happens. the detach is just from the surface view detach callback set right now and then afterwards the composable is disposed. how can I fix this? is this an internal bug with surface view and composable?

``` 15:08:31.242 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=1
 15:08:31.242 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=2
 15:08:31.242 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=3
 15:08:31.242 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=4
 15:08:31.242 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=5
 15:08:31.242 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=6
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=0
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=1
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=2
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=3
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=4
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=5
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=6
 15:08:31.626 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 1774/1780 (recycle/alloc) - 6/1779 (fetch/transfer)
 15:08:31.955 21064-21631 TrafficStats                             D  tagSocket(138) with statsTag=0xffffffff, statsUid=-1
 15:08:33.566 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 1766/1771 (recycle/alloc) - 5/1770 (fetch/transfer)
 15:08:33.966 21064-21642 TrafficStats                             D  tagSocket(412) with statsTag=0xffffffff, statsUid=-1
 15:08:35.974 21064-21646 TrafficStats                             D  tagSocket(103) with statsTag=0xffffffff, statsUid=-1
 15:08:36.677 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 2074/2080 (recycle/alloc) - 6/2079 (fetch/transfer)
 15:08:37.982 21064-21651 TrafficStats                             D  tagSocket(224) with statsTag=0xffffffff, statsUid=-1
 15:08:38.931 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 2016/2021 (recycle/alloc) - 5/2020 (fetch/transfer)
 15:08:39.994 21064-21661 TrafficStats                             D  tagSocket(135) with statsTag=0xffffffff, statsUid=-1
 15:08:41.729 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 2380/2386 (recycle/alloc) - 6/2385 (fetch/transfer)
 15:08:42.001 21064-21666 TrafficStats                             D  tagSocket(287) with statsTag=0xffffffff, statsUid=-1
 15:08:44.010 21064-21670 TrafficStats                             D  tagSocket(134) with statsTag=0xffffffff, statsUid=-1
 15:08:44.441 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 2275/2280 (recycle/alloc) - 5/2279 (fetch/transfer)
 15:08:46.019 21064-21680 TrafficStats                             D  tagSocket(241) with statsTag=0xffffffff, statsUid=-1
 15:08:46.803 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 2683/2689 (recycle/alloc) - 6/2689 (fetch/transfer)
 15:08:48.027 21064-21682 TrafficStats                             D  tagSocket(274) with statsTag=0xffffffff, statsUid=-1
 15:08:49.972 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 2533/2538 (recycle/alloc) - 5/2537 (fetch/transfer)
 15:08:50.038 21064-21686 TrafficStats                             D  tagSocket(284) with statsTag=0xffffffff, statsUid=-1
 15:08:51.889 21064-21469 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 2989/2995 (recycle/alloc) - 6/2994 (fetch/transfer)
 15:08:52.044 21064-21723 TrafficStats                             D  tagSocket(175) with statsTag=0xffffffff, statsUid=-1
 15:08:54.055 21064-21801 TrafficStats                             D  tagSocket(124) with statsTag=0xffffffff, statsUid=-1
 15:08:55.424 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 2792/2797 (recycle/alloc) - 5/2797 (fetch/transfer)
 15:08:56.067 21064-21805 TrafficStats                             D  tagSocket(152) with statsTag=0xffffffff, statsUid=-1
 15:08:56.957 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 3292/3298 (recycle/alloc) - 6/3298 (fetch/transfer)
 15:08:58.079 21064-21815 TrafficStats                             D  tagSocket(138) with statsTag=0xffffffff, statsUid=-1
 15:09:00.090 21064-21820 TrafficStats                             D  tagSocket(178) with statsTag=0xffffffff, statsUid=-1
 15:09:00.930 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 3048/3053 (recycle/alloc) - 5/3052 (fetch/transfer)
 15:09:02.036 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 3596/3602 (recycle/alloc) - 6/3602 (fetch/transfer)
 15:09:02.098 21064-21824 TrafficStats                             D  tagSocket(99) with statsTag=0xffffffff, statsUid=-1
 15:09:04.106 21064-21831 TrafficStats                             D  tagSocket(105) with statsTag=0xffffffff, statsUid=-1
 15:09:06.113 21064-21839 TrafficStats                             D  tagSocket(99) with statsTag=0xffffffff, statsUid=-1
 15:09:06.371 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 3303/3308 (recycle/alloc) - 5/3307 (fetch/transfer)
 15:09:07.098 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 3900/3906 (recycle/alloc) - 6/3906 (fetch/transfer)
 15:09:08.124 21064-21844 TrafficStats                             D  tagSocket(133) with statsTag=0xffffffff, statsUid=-1
 15:09:10.133 21064-21848 TrafficStats                             D  tagSocket(373) with statsTag=0xffffffff, statsUid=-1
 15:09:11.400 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 3538/3543 (recycle/alloc) - 5/3542 (fetch/transfer)
 15:09:12.146 21064-21988 TrafficStats                             D  tagSocket(206) with statsTag=0xffffffff, statsUid=-1
 15:09:12.173 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 4204/4210 (recycle/alloc) - 6/4209 (fetch/transfer)
 15:09:14.153 21064-21995 TrafficStats                             D  tagSocket(124) with statsTag=0xffffffff, statsUid=-1
 15:09:14.341 21064-21073 bo.mobile.debug                          I  Compiler allocated 4100KB to compile java.util.List androidx.compose.ui.graphics.vector.PathNodeKt.toPathNodes(char, float[])
 15:09:16.162 21064-22002 TrafficStats                             D  tagSocket(250) with statsTag=0xffffffff, statsUid=-1
 15:09:16.807 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 3792/3797 (recycle/alloc) - 5/3796 (fetch/transfer)
 15:09:17.223 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 4507/4513 (recycle/alloc) - 6/4512 (fetch/transfer)
 15:09:18.172 21064-22012 TrafficStats                             D  tagSocket(341) with statsTag=0xffffffff, statsUid=-1
 15:09:20.184 21064-22016 TrafficStats                             D  tagSocket(312) with statsTag=0xffffffff, statsUid=-1
 15:09:22.193 21064-22021 TrafficStats                             D  tagSocket(271) with statsTag=0xffffffff, statsUid=-1
 15:09:22.206 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 4046/4051 (recycle/alloc) - 5/4050 (fetch/transfer)
 15:09:22.284 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 4810/4816 (recycle/alloc) - 6/4815 (fetch/transfer)
 15:09:24.202 21064-22036 TrafficStats                             D  tagSocket(172) with statsTag=0xffffffff, statsUid=-1
 15:09:26.214 21064-22040 TrafficStats                             D  tagSocket(206) with statsTag=0xffffffff, statsUid=-1
 15:09:27.333 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 5113/5119 (recycle/alloc) - 6/5119 (fetch/transfer)
 15:09:27.647 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 4301/4306 (recycle/alloc) - 5/4305 (fetch/transfer)
 15:09:28.223 21064-22044 TrafficStats                             D  tagSocket(297) with statsTag=0xffffffff, statsUid=-1
 15:09:30.237 21064-22055 TrafficStats                             D  tagSocket(138) with statsTag=0xffffffff, statsUid=-1
 15:09:32.246 21064-22059 TrafficStats                             D  tagSocket(407) with statsTag=0xffffffff, statsUid=-1
 15:09:32.393 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 5416/5422 (recycle/alloc) - 6/5422 (fetch/transfer)
 15:09:33.085 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 4556/4561 (recycle/alloc) - 5/4560 (fetch/transfer)
 15:09:34.257 21064-22063 TrafficStats                             D  tagSocket(133) with statsTag=0xffffffff, statsUid=-1
 15:09:36.269 21064-22073 TrafficStats                             D  tagSocket(299) with statsTag=0xffffffff, statsUid=-1
 15:09:36.943 21064-21473 PipelineWatcher                          D  onInputBufferReleased: frameIndex not found (5690); ignored
 15:09:37.495 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 5722/5728 (recycle/alloc) - 6/5728 (fetch/transfer)
 15:09:38.279 21064-22077 TrafficStats                             D  tagSocket(134) with statsTag=0xffffffff, statsUid=-1
 15:09:38.524 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 4811/4816 (recycle/alloc) - 5/4815 (fetch/transfer)
 15:09:40.291 21064-22081 TrafficStats                             D  tagSocket(150) with statsTag=0xffffffff, statsUid=-1
 15:09:42.299 21064-22118 TrafficStats                             D  tagSocket(150) with statsTag=0xffffffff, statsUid=-1
 15:09:42.553 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 6025/6031 (recycle/alloc) - 6/6030 (fetch/transfer)
 15:09:43.562 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 5046/5051 (recycle/alloc) - 5/5050 (fetch/transfer)
 15:09:44.313 21064-22175 TrafficStats                             D  tagSocket(178) with statsTag=0xffffffff, statsUid=-1
 15:09:46.324 21064-22196 TrafficStats                             D  tagSocket(185) with statsTag=0xffffffff, statsUid=-1
 15:09:47.598 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 6328/6334 (recycle/alloc) - 6/6334 (fetch/transfer)
 15:09:48.336 21064-22208 TrafficStats                             D  tagSocket(360) with statsTag=0xffffffff, statsUid=-1
 15:09:49.046 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 5304/5309 (recycle/alloc) - 5/5308 (fetch/transfer)
 15:09:50.343 21064-22214 TrafficStats                             D  tagSocket(157) with statsTag=0xffffffff, statsUid=-1
 15:09:52.355 21064-22222 TrafficStats                             D  tagSocket(219) with statsTag=0xffffffff, statsUid=-1
 15:09:52.655 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 6630/6636 (recycle/alloc) - 6/6636 (fetch/transfer)
 15:09:54.368 21064-22232 TrafficStats                             D  tagSocket(245) with statsTag=0xffffffff, statsUid=-1
 15:09:54.642 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 5565/5570 (recycle/alloc) - 5/5569 (fetch/transfer)
 15:09:56.381 21064-22236 TrafficStats                             D  tagSocket(162) with statsTag=0xffffffff, statsUid=-1
 15:09:57.708 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 6934/6940 (recycle/alloc) - 6/6939 (fetch/transfer)
 15:09:58.391 21064-22240 TrafficStats                             D  tagSocket(103) with statsTag=0xffffffff, statsUid=-1
 15:09:59.683 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 5802/5807 (recycle/alloc) - 5/5806 (fetch/transfer)
 15:10:00.399 21064-22250 TrafficStats                             D  tagSocket(247) with statsTag=0xffffffff, statsUid=-1
 15:10:02.407 21064-22258 TrafficStats                             D  tagSocket(152) with statsTag=0xffffffff, statsUid=-1
 15:10:02.767 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 7237/7243 (recycle/alloc) - 6/7243 (fetch/transfer)
 15:10:04.418 21064-22263 TrafficStats                             D  tagSocket(249) with statsTag=0xffffffff, statsUid=-1
 15:10:05.204 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 6061/6066 (recycle/alloc) - 5/6065 (fetch/transfer)
 15:10:06.428 21064-22274 TrafficStats                             D  tagSocket(353) with statsTag=0xffffffff, statsUid=-1
 15:10:07.826 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 7540/7546 (recycle/alloc) - 6/7545 (fetch/transfer)
 15:10:08.443 21064-22278 TrafficStats                             D  tagSocket(157) with statsTag=0xffffffff, statsUid=-1
 15:10:10.455 21064-22282 TrafficStats                             D  tagSocket(148) with statsTag=0xffffffff, statsUid=-1
 15:10:10.763 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 6321/6326 (recycle/alloc) - 5/6325 (fetch/transfer)
 15:10:12.466 21064-22292 TrafficStats                             D  tagSocket(174) with statsTag=0xffffffff, statsUid=-1
 15:10:12.905 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 7845/7851 (recycle/alloc) - 6/7850 (fetch/transfer)
 15:10:14.477 21064-22296 TrafficStats                             D  tagSocket(162) with statsTag=0xffffffff, statsUid=-1
 15:10:16.243 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 6579/6584 (recycle/alloc) - 5/6583 (fetch/transfer)
 15:10:16.487 21064-22306 TrafficStats                             D  tagSocket(150) with statsTag=0xffffffff, statsUid=-1
 15:10:17.969 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 8148/8154 (recycle/alloc) - 6/8153 (fetch/transfer)
 15:10:18.497 21064-22318 TrafficStats                             D  tagSocket(140) with statsTag=0xffffffff, statsUid=-1
 15:10:20.510 21064-22322 TrafficStats                             D  tagSocket(140) with statsTag=0xffffffff, statsUid=-1
 15:10:21.602 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 6829/6834 (recycle/alloc) - 5/6833 (fetch/transfer)
 15:10:22.522 21064-22326 TrafficStats                             D  tagSocket(382) with statsTag=0xffffffff, statsUid=-1
 15:10:23.049 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 8453/8459 (recycle/alloc) - 6/8459 (fetch/transfer)
 15:10:24.530 21064-22342 TrafficStats                             D  tagSocket(224) with statsTag=0xffffffff, statsUid=-1
 15:10:26.542 21064-22346 TrafficStats                             D  tagSocket(156) with statsTag=0xffffffff, statsUid=-1
 15:10:26.604 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 7064/7069 (recycle/alloc) - 5/7068 (fetch/transfer)
 15:10:28.093 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 8755/8761 (recycle/alloc) - 6/8760 (fetch/transfer)
 15:10:28.554 21064-22350 TrafficStats                             D  tagSocket(209) with statsTag=0xffffffff, statsUid=-1
 15:10:30.562 21064-22360 TrafficStats                             D  tagSocket(105) with statsTag=0xffffffff, statsUid=-1
 15:10:32.049 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 7318/7323 (recycle/alloc) - 5/7322 (fetch/transfer)
 15:10:32.575 21064-22364 TrafficStats                             D  tagSocket(270) with statsTag=0xffffffff, statsUid=-1
 15:10:33.149 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 9058/9064 (recycle/alloc) - 6/9064 (fetch/transfer)
 15:10:34.585 21064-22368 TrafficStats                             D  tagSocket(185) with statsTag=0xffffffff, statsUid=-1
 15:10:36.592 21064-22378 TrafficStats                             D  tagSocket(261) with statsTag=0xffffffff, statsUid=-1
 15:10:37.480 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 7573/7578 (recycle/alloc) - 5/7577 (fetch/transfer)
 15:10:38.224 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 9362/9368 (recycle/alloc) - 6/9368 (fetch/transfer)
 15:10:38.607 21064-22382 TrafficStats                             D  tagSocket(140) with statsTag=0xffffffff, statsUid=-1
 15:10:40.618 21064-22386 TrafficStats                             D  tagSocket(103) with statsTag=0xffffffff, statsUid=-1
 15:10:42.632 21064-22398 TrafficStats                             D  tagSocket(241) with statsTag=0xffffffff, statsUid=-1
 15:10:42.924 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 7829/7834 (recycle/alloc) - 5/7833 (fetch/transfer)
 15:10:43.272 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 9664/9670 (recycle/alloc) - 6/9670 (fetch/transfer)
 15:10:44.641 21064-22402 TrafficStats                             D  tagSocket(253) with statsTag=0xffffffff, statsUid=-1
 15:10:46.649 21064-22410 TrafficStats                             D  tagSocket(174) with statsTag=0xffffffff, statsUid=-1
 15:10:48.322 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 9968/9974 (recycle/alloc) - 6/9973 (fetch/transfer)
 15:10:48.367 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 8084/8089 (recycle/alloc) - 5/8088 (fetch/transfer)
 15:10:48.657 21064-22418 TrafficStats                             D  tagSocket(185) with statsTag=0xffffffff, statsUid=-1
 15:10:48.741 21064-21064 bo.mobile.debug                          W  type=1400 audit(0.0:607267): avc: granted { execute } for path="/data/data//code_cache/startup_agents/3c67707e-agent.so" dev="dm-40" ino=170340 scontext=u:r:untrusted_app:s0:c77,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c77,c257,c512,c768 tclass=file app=
 15:10:48.775 21064-21468 SurfaceUtils                             D  connecting to surface 0xb4000076f5ddfff0, reason connectToSurface
 15:10:48.775 21064-21468 MediaCodec                               I  [c2.qti.avc.decoder] setting surface generation to 21569538
 15:10:48.775 21064-21468 SurfaceUtils                             D  disconnecting from surface 0xb4000076f5ddfff0, reason connectToSurface(reconnect)
 15:10:48.775 21064-21468 SurfaceUtils                             D  connecting to surface 0xb4000076f5ddfff0, reason connectToSurface(reconnect)
 15:10:48.777 21064-21468 Codec2-Out...ufferQueue                  D  remote graphic buffer migration 17/17
 15:10:48.778 21064-21468 Codec2Client                             D  setOutputSurface -- failed to set consumer usage (6/BAD_INDEX)
 15:10:48.778 21064-21468 Codec2Client                             D  setOutputSurface -- generation=21569538 consumer usage=0x900
 15:10:48.783 21064-21468 Codec2Client                             D  Surface configure completed
 15:10:48.783 21064-21468 SurfaceUtils                             D  disconnecting from surface 0xb4000076f5db78c0, reason disconnectFromSurface
 15:10:48.791 21064-21064 (DefaultPl...achSurface                  D  Player: action detach
 15:10:48.792 21064-21064 (DefaultPl...achSurface                  D  Player: action detach successful
 15:10:49.407 21064-21064 Choreographer                            I  Skipped 38 frames!  The application may be doing too much work on its main thread.
```

Body:
I am adding a surfaceView wrapped inside AndroidView to play some video, here is the snippet of it -

    AndroidView(
        modifier = modifier.fillMaxSize(),
        factory = { context ->
            val view = LayoutInflater.from(context).inflate(R.layout.layout_player, FrameLayout(context), false)

            val aspectRatioFrameLayout = view.findViewById<AspectRatioFrameLayout>(R.id.aspect_ratio_frame_layout)
            aspectRatioFrameLayout.setAspectRatio(videoAspectRatioValue)

            val surfaceView = view.findViewById<SurfaceView>(R.id.surface_view)
            surfaceView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
                override fun onViewAttachedToWindow(view: View) {
                    attachSurface(view as SurfaceView)
                }

                override fun onViewDetachedFromWindow(view: View) {
                    detachSurface(view as SurfaceView)
                }
            })

            return@AndroidView view
        }
    )

and seeing random closing/disposing of the composable and navigating back to its previous screen when the video is playing and here is the logs that I am getting right now when it happens. the detach is just from the surface view detach callback set right now and then afterwards the composable is disposed. how can I fix this? is this an internal bug with surface view and composable?

 15:08:31.242 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=1
 15:08:31.242 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=2
 15:08:31.242 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=3
 15:08:31.242 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=4
 15:08:31.242 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=5
 15:08:31.242 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=6
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=0
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=1
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=2
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=3
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=4
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=5
 15:08:31.253 21064-21064 SurfaceSyncer                            E  Failed to find sync for id=6
 15:08:31.626 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 1774/1780 (recycle/alloc) - 6/1779 (fetch/transfer)
 15:08:31.955 21064-21631 TrafficStats                             D  tagSocket(138) with statsTag=0xffffffff, statsUid=-1
 15:08:33.566 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 1766/1771 (recycle/alloc) - 5/1770 (fetch/transfer)
 15:08:33.966 21064-21642 TrafficStats                             D  tagSocket(412) with statsTag=0xffffffff, statsUid=-1
 15:08:35.974 21064-21646 TrafficStats                             D  tagSocket(103) with statsTag=0xffffffff, statsUid=-1
 15:08:36.677 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 2074/2080 (recycle/alloc) - 6/2079 (fetch/transfer)
 15:08:37.982 21064-21651 TrafficStats                             D  tagSocket(224) with statsTag=0xffffffff, statsUid=-1
 15:08:38.931 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 2016/2021 (recycle/alloc) - 5/2020 (fetch/transfer)
 15:08:39.994 21064-21661 TrafficStats                             D  tagSocket(135) with statsTag=0xffffffff, statsUid=-1
 15:08:41.729 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 2380/2386 (recycle/alloc) - 6/2385 (fetch/transfer)
 15:08:42.001 21064-21666 TrafficStats                             D  tagSocket(287) with statsTag=0xffffffff, statsUid=-1
 15:08:44.010 21064-21670 TrafficStats                             D  tagSocket(134) with statsTag=0xffffffff, statsUid=-1
 15:08:44.441 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 2275/2280 (recycle/alloc) - 5/2279 (fetch/transfer)
 15:08:46.019 21064-21680 TrafficStats                             D  tagSocket(241) with statsTag=0xffffffff, statsUid=-1
 15:08:46.803 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 2683/2689 (recycle/alloc) - 6/2689 (fetch/transfer)
 15:08:48.027 21064-21682 TrafficStats                             D  tagSocket(274) with statsTag=0xffffffff, statsUid=-1
 15:08:49.972 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 2533/2538 (recycle/alloc) - 5/2537 (fetch/transfer)
 15:08:50.038 21064-21686 TrafficStats                             D  tagSocket(284) with statsTag=0xffffffff, statsUid=-1
 15:08:51.889 21064-21469 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 2989/2995 (recycle/alloc) - 6/2994 (fetch/transfer)
 15:08:52.044 21064-21723 TrafficStats                             D  tagSocket(175) with statsTag=0xffffffff, statsUid=-1
 15:08:54.055 21064-21801 TrafficStats                             D  tagSocket(124) with statsTag=0xffffffff, statsUid=-1
 15:08:55.424 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 2792/2797 (recycle/alloc) - 5/2797 (fetch/transfer)
 15:08:56.067 21064-21805 TrafficStats                             D  tagSocket(152) with statsTag=0xffffffff, statsUid=-1
 15:08:56.957 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 3292/3298 (recycle/alloc) - 6/3298 (fetch/transfer)
 15:08:58.079 21064-21815 TrafficStats                             D  tagSocket(138) with statsTag=0xffffffff, statsUid=-1
 15:09:00.090 21064-21820 TrafficStats                             D  tagSocket(178) with statsTag=0xffffffff, statsUid=-1
 15:09:00.930 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 3048/3053 (recycle/alloc) - 5/3052 (fetch/transfer)
 15:09:02.036 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 3596/3602 (recycle/alloc) - 6/3602 (fetch/transfer)
 15:09:02.098 21064-21824 TrafficStats                             D  tagSocket(99) with statsTag=0xffffffff, statsUid=-1
 15:09:04.106 21064-21831 TrafficStats                             D  tagSocket(105) with statsTag=0xffffffff, statsUid=-1
 15:09:06.113 21064-21839 TrafficStats                             D  tagSocket(99) with statsTag=0xffffffff, statsUid=-1
 15:09:06.371 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 3303/3308 (recycle/alloc) - 5/3307 (fetch/transfer)
 15:09:07.098 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 3900/3906 (recycle/alloc) - 6/3906 (fetch/transfer)
 15:09:08.124 21064-21844 TrafficStats                             D  tagSocket(133) with statsTag=0xffffffff, statsUid=-1
 15:09:10.133 21064-21848 TrafficStats                             D  tagSocket(373) with statsTag=0xffffffff, statsUid=-1
 15:09:11.400 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 3538/3543 (recycle/alloc) - 5/3542 (fetch/transfer)
 15:09:12.146 21064-21988 TrafficStats                             D  tagSocket(206) with statsTag=0xffffffff, statsUid=-1
 15:09:12.173 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 4204/4210 (recycle/alloc) - 6/4209 (fetch/transfer)
 15:09:14.153 21064-21995 TrafficStats                             D  tagSocket(124) with statsTag=0xffffffff, statsUid=-1
 15:09:14.341 21064-21073 bo.mobile.debug                          I  Compiler allocated 4100KB to compile java.util.List androidx.compose.ui.graphics.vector.PathNodeKt.toPathNodes(char, float[])
 15:09:16.162 21064-22002 TrafficStats                             D  tagSocket(250) with statsTag=0xffffffff, statsUid=-1
 15:09:16.807 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 3792/3797 (recycle/alloc) - 5/3796 (fetch/transfer)
 15:09:17.223 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 4507/4513 (recycle/alloc) - 6/4512 (fetch/transfer)
 15:09:18.172 21064-22012 TrafficStats                             D  tagSocket(341) with statsTag=0xffffffff, statsUid=-1
 15:09:20.184 21064-22016 TrafficStats                             D  tagSocket(312) with statsTag=0xffffffff, statsUid=-1
 15:09:22.193 21064-22021 TrafficStats                             D  tagSocket(271) with statsTag=0xffffffff, statsUid=-1
 15:09:22.206 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 4046/4051 (recycle/alloc) - 5/4050 (fetch/transfer)
 15:09:22.284 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 4810/4816 (recycle/alloc) - 6/4815 (fetch/transfer)
 15:09:24.202 21064-22036 TrafficStats                             D  tagSocket(172) with statsTag=0xffffffff, statsUid=-1
 15:09:26.214 21064-22040 TrafficStats                             D  tagSocket(206) with statsTag=0xffffffff, statsUid=-1
 15:09:27.333 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 5113/5119 (recycle/alloc) - 6/5119 (fetch/transfer)
 15:09:27.647 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 4301/4306 (recycle/alloc) - 5/4305 (fetch/transfer)
 15:09:28.223 21064-22044 TrafficStats                             D  tagSocket(297) with statsTag=0xffffffff, statsUid=-1
 15:09:30.237 21064-22055 TrafficStats                             D  tagSocket(138) with statsTag=0xffffffff, statsUid=-1
 15:09:32.246 21064-22059 TrafficStats                             D  tagSocket(407) with statsTag=0xffffffff, statsUid=-1
 15:09:32.393 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 5416/5422 (recycle/alloc) - 6/5422 (fetch/transfer)
 15:09:33.085 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 4556/4561 (recycle/alloc) - 5/4560 (fetch/transfer)
 15:09:34.257 21064-22063 TrafficStats                             D  tagSocket(133) with statsTag=0xffffffff, statsUid=-1
 15:09:36.269 21064-22073 TrafficStats                             D  tagSocket(299) with statsTag=0xffffffff, statsUid=-1
 15:09:36.943 21064-21473 PipelineWatcher                          D  onInputBufferReleased: frameIndex not found (5690); ignored
 15:09:37.495 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 5722/5728 (recycle/alloc) - 6/5728 (fetch/transfer)
 15:09:38.279 21064-22077 TrafficStats                             D  tagSocket(134) with statsTag=0xffffffff, statsUid=-1
 15:09:38.524 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 4811/4816 (recycle/alloc) - 5/4815 (fetch/transfer)
 15:09:40.291 21064-22081 TrafficStats                             D  tagSocket(150) with statsTag=0xffffffff, statsUid=-1
 15:09:42.299 21064-22118 TrafficStats                             D  tagSocket(150) with statsTag=0xffffffff, statsUid=-1
 15:09:42.553 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 6025/6031 (recycle/alloc) - 6/6030 (fetch/transfer)
 15:09:43.562 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 5046/5051 (recycle/alloc) - 5/5050 (fetch/transfer)
 15:09:44.313 21064-22175 TrafficStats                             D  tagSocket(178) with statsTag=0xffffffff, statsUid=-1
 15:09:46.324 21064-22196 TrafficStats                             D  tagSocket(185) with statsTag=0xffffffff, statsUid=-1
 15:09:47.598 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 6328/6334 (recycle/alloc) - 6/6334 (fetch/transfer)
 15:09:48.336 21064-22208 TrafficStats                             D  tagSocket(360) with statsTag=0xffffffff, statsUid=-1
 15:09:49.046 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 5304/5309 (recycle/alloc) - 5/5308 (fetch/transfer)
 15:09:50.343 21064-22214 TrafficStats                             D  tagSocket(157) with statsTag=0xffffffff, statsUid=-1
 15:09:52.355 21064-22222 TrafficStats                             D  tagSocket(219) with statsTag=0xffffffff, statsUid=-1
 15:09:52.655 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 6630/6636 (recycle/alloc) - 6/6636 (fetch/transfer)
 15:09:54.368 21064-22232 TrafficStats                             D  tagSocket(245) with statsTag=0xffffffff, statsUid=-1
 15:09:54.642 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 5565/5570 (recycle/alloc) - 5/5569 (fetch/transfer)
 15:09:56.381 21064-22236 TrafficStats                             D  tagSocket(162) with statsTag=0xffffffff, statsUid=-1
 15:09:57.708 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 6934/6940 (recycle/alloc) - 6/6939 (fetch/transfer)
 15:09:58.391 21064-22240 TrafficStats                             D  tagSocket(103) with statsTag=0xffffffff, statsUid=-1
 15:09:59.683 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 5802/5807 (recycle/alloc) - 5/5806 (fetch/transfer)
 15:10:00.399 21064-22250 TrafficStats                             D  tagSocket(247) with statsTag=0xffffffff, statsUid=-1
 15:10:02.407 21064-22258 TrafficStats                             D  tagSocket(152) with statsTag=0xffffffff, statsUid=-1
 15:10:02.767 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 7237/7243 (recycle/alloc) - 6/7243 (fetch/transfer)
 15:10:04.418 21064-22263 TrafficStats                             D  tagSocket(249) with statsTag=0xffffffff, statsUid=-1
 15:10:05.204 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 6061/6066 (recycle/alloc) - 5/6065 (fetch/transfer)
 15:10:06.428 21064-22274 TrafficStats                             D  tagSocket(353) with statsTag=0xffffffff, statsUid=-1
 15:10:07.826 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 7540/7546 (recycle/alloc) - 6/7545 (fetch/transfer)
 15:10:08.443 21064-22278 TrafficStats                             D  tagSocket(157) with statsTag=0xffffffff, statsUid=-1
 15:10:10.455 21064-22282 TrafficStats                             D  tagSocket(148) with statsTag=0xffffffff, statsUid=-1
 15:10:10.763 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 6321/6326 (recycle/alloc) - 5/6325 (fetch/transfer)
 15:10:12.466 21064-22292 TrafficStats                             D  tagSocket(174) with statsTag=0xffffffff, statsUid=-1
 15:10:12.905 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 7845/7851 (recycle/alloc) - 6/7850 (fetch/transfer)
 15:10:14.477 21064-22296 TrafficStats                             D  tagSocket(162) with statsTag=0xffffffff, statsUid=-1
 15:10:16.243 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 6579/6584 (recycle/alloc) - 5/6583 (fetch/transfer)
 15:10:16.487 21064-22306 TrafficStats                             D  tagSocket(150) with statsTag=0xffffffff, statsUid=-1
 15:10:17.969 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 8148/8154 (recycle/alloc) - 6/8153 (fetch/transfer)
 15:10:18.497 21064-22318 TrafficStats                             D  tagSocket(140) with statsTag=0xffffffff, statsUid=-1
 15:10:20.510 21064-22322 TrafficStats                             D  tagSocket(140) with statsTag=0xffffffff, statsUid=-1
 15:10:21.602 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 6829/6834 (recycle/alloc) - 5/6833 (fetch/transfer)
 15:10:22.522 21064-22326 TrafficStats                             D  tagSocket(382) with statsTag=0xffffffff, statsUid=-1
 15:10:23.049 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 8453/8459 (recycle/alloc) - 6/8459 (fetch/transfer)
 15:10:24.530 21064-22342 TrafficStats                             D  tagSocket(224) with statsTag=0xffffffff, statsUid=-1
 15:10:26.542 21064-22346 TrafficStats                             D  tagSocket(156) with statsTag=0xffffffff, statsUid=-1
 15:10:26.604 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 7064/7069 (recycle/alloc) - 5/7068 (fetch/transfer)
 15:10:28.093 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 8755/8761 (recycle/alloc) - 6/8760 (fetch/transfer)
 15:10:28.554 21064-22350 TrafficStats                             D  tagSocket(209) with statsTag=0xffffffff, statsUid=-1
 15:10:30.562 21064-22360 TrafficStats                             D  tagSocket(105) with statsTag=0xffffffff, statsUid=-1
 15:10:32.049 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 7318/7323 (recycle/alloc) - 5/7322 (fetch/transfer)
 15:10:32.575 21064-22364 TrafficStats                             D  tagSocket(270) with statsTag=0xffffffff, statsUid=-1
 15:10:33.149 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 9058/9064 (recycle/alloc) - 6/9064 (fetch/transfer)
 15:10:34.585 21064-22368 TrafficStats                             D  tagSocket(185) with statsTag=0xffffffff, statsUid=-1
 15:10:36.592 21064-22378 TrafficStats                             D  tagSocket(261) with statsTag=0xffffffff, statsUid=-1
 15:10:37.480 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 7573/7578 (recycle/alloc) - 5/7577 (fetch/transfer)
 15:10:38.224 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 9362/9368 (recycle/alloc) - 6/9368 (fetch/transfer)
 15:10:38.607 21064-22382 TrafficStats                             D  tagSocket(140) with statsTag=0xffffffff, statsUid=-1
 15:10:40.618 21064-22386 TrafficStats                             D  tagSocket(103) with statsTag=0xffffffff, statsUid=-1
 15:10:42.632 21064-22398 TrafficStats                             D  tagSocket(241) with statsTag=0xffffffff, statsUid=-1
 15:10:42.924 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 7829/7834 (recycle/alloc) - 5/7833 (fetch/transfer)
 15:10:43.272 21064-21468 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 4(28311552 size) used buffers - 9664/9670 (recycle/alloc) - 6/9670 (fetch/transfer)
 15:10:44.641 21064-22402 TrafficStats                             D  tagSocket(253) with statsTag=0xffffffff, statsUid=-1
 15:10:46.649 21064-22410 TrafficStats                             D  tagSocket(174) with statsTag=0xffffffff, statsUid=-1
 15:10:48.322 21064-21473 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d40e78 : 5(35389440 size) total buffers - 5(35389440 size) used buffers - 9968/9974 (recycle/alloc) - 6/9973 (fetch/transfer)
 15:10:48.367 21064-21479 BufferPoolAccessor2.0                    D  bufferpool2 0xb400007655d4c2d8 : 5(40960 size) total buffers - 1(8192 size) used buffers - 8084/8089 (recycle/alloc) - 5/8088 (fetch/transfer)
 15:10:48.657 21064-22418 TrafficStats                             D  tagSocket(185) with statsTag=0xffffffff, statsUid=-1
 15:10:48.741 21064-21064 bo.mobile.debug                          W  type=1400 audit(0.0:607267): avc: granted { execute } for path="/data/data//code_cache/startup_agents/3c67707e-agent.so" dev="dm-40" ino=170340 scontext=u:r:untrusted_app:s0:c77,c257,c512,c768 tcontext=u:object_r:app_data_file:s0:c77,c257,c512,c768 tclass=file app=
 15:10:48.775 21064-21468 SurfaceUtils                             D  connecting to surface 0xb4000076f5ddfff0, reason connectToSurface
 15:10:48.775 21064-21468 MediaCodec                               I  [c2.qti.avc.decoder] setting surface generation to 21569538
 15:10:48.775 21064-21468 SurfaceUtils                             D  disconnecting from surface 0xb4000076f5ddfff0, reason connectToSurface(reconnect)
 15:10:48.775 21064-21468 SurfaceUtils                             D  connecting to surface 0xb4000076f5ddfff0, reason connectToSurface(reconnect)
 15:10:48.777 21064-21468 Codec2-Out...ufferQueue                  D  remote graphic buffer migration 17/17
 15:10:48.778 21064-21468 Codec2Client                             D  setOutputSurface -- failed to set consumer usage (6/BAD_INDEX)
 15:10:48.778 21064-21468 Codec2Client                             D  setOutputSurface -- generation=21569538 consumer usage=0x900
 15:10:48.783 21064-21468 Codec2Client                             D  Surface configure completed
 15:10:48.783 21064-21468 SurfaceUtils                             D  disconnecting from surface 0xb4000076f5db78c0, reason disconnectFromSurface
 15:10:48.791 21064-21064 (DefaultPl...achSurface                  D  Player: action detach
 15:10:48.792 21064-21064 (DefaultPl...achSurface                  D  Player: action detach successful
 15:10:49.407 21064-21064 Choreographer                            I  Skipped 38 frames!  The application may be doing too much work on its main thread.


问:
Attribute based access with AzureAd and C# WebApi
I have an spa (though this is the client part of the app, and may end up being converted to blazor) that is requesting data from a Web Api.  The User is granted app access with Azure AD single tenant authentication.  Then the user will be authorized to view various data within the app based on their role and several custom values.  Here is an illustration of what I'm looking to do: (this is net core 7.0 btw)

```<code>builder.Services
    .AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
    .AddMicrosoftIdentityWebApi(
        options =>
        {
            builder.Configuration.Bind("AzureAd", options);
            options.Events = new JwtBearerEvents();
            var existingOnTokenValidatedHandler = options.Events.OnTokenValidated;
            options.Events.OnTokenValidated += async context =>
            {
                await existingOnTokenValidatedHandler(context);
                var allowedClient = builder.Configuration["AzureAd:ClientId"];
                string? audience = context
                    ?.Principal?.Claims.FirstOrDefault(x => x.Type == "aud")
                    ?.Value;
                string? clientappId = context
                    ?.Principal?.Claims.FirstOrDefault(x => x.Type == "appid")
                    ?.Value;
                if (allowedClient == clientappId && audience == options.Audience) {
                      /** Right here, I want to bind this user with a locally stored
                          user **/
                }
            };
        },
        options =>
        {
            builder.Configuration.Bind("AzureAd", options);
        }
    );
</code>```

Each user will have a school associated with them.  I want that school to automatically be included with each request on behalf of the user.  That school will also be a parameter to the controller routes.  It will be a little more complicated than that, but, the essence of my question is the following:

How can I attach local user information to the token that get's passed to each request and use that information in the request?

Or maybe I'm approaching this wrong?  What I want seems so basic, so I have a feeling I might be missing something fundamental.

Body:
I have an spa (though this is the client part of the app, and may end up being converted to blazor) that is requesting data from a Web Api.  The User is granted app access with Azure AD single tenant authentication.  Then the user will be authorized to view various data within the app based on their role and several custom values.  Here is an illustration of what I'm looking to do: (this is net core 7.0 btw)

builder.Services
    .AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
    .AddMicrosoftIdentityWebApi(
        options =>
        {
            builder.Configuration.Bind("AzureAd", options);
            options.Events = new JwtBearerEvents();
            var existingOnTokenValidatedHandler = options.Events.OnTokenValidated;
            options.Events.OnTokenValidated += async context =>
            {
                await existingOnTokenValidatedHandler(context);
                var allowedClient = builder.Configuration["AzureAd:ClientId"];
                string? audience = context
                    ?.Principal?.Claims.FirstOrDefault(x => x.Type == "aud")
                    ?.Value;
                string? clientappId = context
                    ?.Principal?.Claims.FirstOrDefault(x => x.Type == "appid")
                    ?.Value;
                if (allowedClient == clientappId && audience == options.Audience) {
                      /** Right here, I want to bind this user with a locally stored
                          user **/
                }
            };
        },
        options =>
        {
            builder.Configuration.Bind("AzureAd", options);
        }
    );

Each user will have a school associated with them.  I want that school to automatically be included with each request on behalf of the user.  That school will also be a parameter to the controller routes.  It will be a little more complicated than that, but, the essence of my question is the following:

How can I attach local user information to the token that get's passed to each request and use that information in the request?

Or maybe I'm approaching this wrong?  What I want seems so basic, so I have a feeling I might be missing something fundamental.


问:
How to have an image render before alt text
I'm working on a documentation site and noticed that the images have a very slight delay. I realized it's because the alt text shows up before the image renders.

Is there a way to hide the alt text before the image appears?alt-text-shows-up

I want the image load to look a little cleaner to the users. If there's something that I could do on my end it would be appreciated. In the docusaurus blog I noticed the same thing happens with the image, I see the alt text before the image appears https://docusaurus.io/blog
At first I thought it was just on my end, but my peer noticed it on his machine as well.

I had the images in a folder with the .md document, then moved them to the static folder as it was suggested on the docusaurus website. The delay still persists even when moved to the correct folders.


问:
Filter by geometry and group by location in Django
I have a SQL query similar to the following:

```<code>SELECT Fip.fipcode, COUNT(Land.id)
FROM Land, Fip
WHERE ST_Intersects(Fip.geometry, Land.geometry)
GROUP BY Fip.fipcode
</code>```

I have the following models implemented:

```<code>class Land(models.Model):
    id = models.IntegerField(primary_key=True, db_column="id")
    geometry = models.GeometryField(null=False, db_column="geometry", geography=True)

class Fip(models.Model):
    fipcode = models.CharField(db_column="fipcode", max_length=5)
    geometry = models.GeometryField(srid=4326, geography=False, db_column="geometry")
</code>```

I would like to use Django's models to do the filtering/grouping instead of running raw SQL queries.

How would I go about doing this?
Sorry if this kind of question has already been answered, I couldn't find a good answer.

I have tried varius filter annotation commands with my models, but I can't get it to work as expected. Django's Docs are not the best.

Body:
I have a SQL query similar to the following:

SELECT Fip.fipcode, COUNT(Land.id)
FROM Land, Fip
WHERE ST_Intersects(Fip.geometry, Land.geometry)
GROUP BY Fip.fipcode

I have the following models implemented:

class Land(models.Model):
    id = models.IntegerField(primary_key=True, db_column="id")
    geometry = models.GeometryField(null=False, db_column="geometry", geography=True)

class Fip(models.Model):
    fipcode = models.CharField(db_column="fipcode", max_length=5)
    geometry = models.GeometryField(srid=4326, geography=False, db_column="geometry")

I would like to use Django's models to do the filtering/grouping instead of running raw SQL queries.

How would I go about doing this?
Sorry if this kind of question has already been answered, I couldn't find a good answer.

I have tried varius filter annotation commands with my models, but I can't get it to work as expected. Django's Docs are not the best.


问:
Ignore field codes and compare only text on word documents using hwpf
I am trying to work with .doc files and i am stuck where i neei need to compare two documents. Even though the documents are similar, because of the field codes on the document the program says they don't match.

The same document with xwpf works fine.Is there anyway i can do the same with hwpf too?

Any other method to achieve this will also work!

Can anyone help me with this?

Tried with different methods with in poi.... nothing seems to be working!


问:
How to use Sparkline in function react with Highcharts.js/highcharts-react-official?
I want to create a sparklines graph in react using Highcharts. What I've found so far is implemented in vanilla javascript/jquery and class-based react. Is there a functional way to do this?</p>


问:
I'm having trouble with some characters when searching within the app
I bought a movie app from Codecanyon. The support team screwed up, they can't fix the problem. I'm having trouble with letters like ç, ş, ğ, ü (Space) while searching for movies in the app. When I add a space between a two-word movie, all movies come off the screen.

https://youtube.com/shorts/Z9SOkbIa5kk

Home.java

Searchlistaddepter.java

Searchlist.java
Below

```<code>----------------------------------------------------------------------------
HOME.java
---------------------------------------------------------------------------
void searchContent(String text) {
    RequestQueue queue = Volley.newRequestQueue(this);
    StringRequest sr = new StringRequest(Request.Method.GET, AppConfig.url +"searchContent/"+text+"/"+onlyPremium, response -> {
        if(!response.equals("No Data Avaliable") ) {
            JsonArray jsonArray = new Gson().fromJson(response, JsonArray.class);

            List<SearchList> searchList = new ArrayList<>();
            for (JsonElement r : jsonArray) {
                JsonObject rootObject = r.getAsJsonObject();
                int id = rootObject.get("id").getAsInt();
                String name = rootObject.get("name").getAsString();

                String year = "";
                if(!rootObject.get("release_date").getAsString().equals("")) {
                    year = getYearFromDate(rootObject.get("release_date").getAsString());
                }

                String poster = rootObject.get("poster").getAsString();
                int type = rootObject.get("type").getAsInt();
                int status = rootObject.get("status").getAsInt();
                int contentType = rootObject.get("content_type").getAsInt();

                if (status == 1) {
                    searchList.add(new SearchList(id, type, name, year, poster, contentType));
                }
            }

            RecyclerView searchLayoutRecyclerView = findViewById(R.id.Search_Layout_RecyclerView);
            SearchListAdepter myadepter = new SearchListAdepter(context, searchList);
            searchLayoutRecyclerView.setLayoutManager(new GridLayoutManager(context, 3));
            searchLayoutRecyclerView.setAdapter(myadepter);

        } else {
            View bigSearchLottieAnimation = findViewById(R.id.big_search_Lottie_animation);
            RecyclerView searchLayoutRecyclerView = findViewById(R.id.Search_Layout_RecyclerView);
            bigSearchLottieAnimation.setVisibility(View.VISIBLE);
            searchLayoutRecyclerView.setVisibility(View.GONE);

        }
    }, error -> {
        //  Do nothing because There is No Error if error It will return 0
    }) {
        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            Map<String,String> params = new HashMap<>();
            params.put("x-api-key", AppConfig.apiKey);
            return params;
        }
        @Override
        protected Map<String,String> getParams(){
            Map<String,String> params = new HashMap<>();
            params.put("search",text);
            params.put("onlypremium", String.valueOf(onlyPremium));
            return params;
        }
    };
    queue.add(sr);
}
---------------------------------------------------------
SEARCHLİSTADDEPTER.Java
----------------------------------------------------------
package com.xxxx.android.adepter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;

import com.xxxx.android.AppConfig;
import com.xxxx.android.R;
import com.xxxx.android.MovieDetails;
import com.xxxx.android.list.SearchList;
import com.xxxx.android.WebSeriesDetails;

import java.util.List;

public class SearchListAdepter extends RecyclerView.Adapter<SearchListAdepter.MyViewHolder> {
    private Context mContext;
    private List<SearchList> mData;

    Context context;

    public SearchListAdepter(Context mContext, List<SearchList> mData) {
        this.mContext = mContext;
        this.mData = mData;
    }

    @NonNull
    @Override
    public SearchListAdepter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        context = parent.getContext();
        View view;
        LayoutInflater mInflater = LayoutInflater.from(mContext);
        view = mInflater.inflate(AppConfig.contentItem,parent,false);
        return new SearchListAdepter.MyViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull SearchListAdepter.MyViewHolder holder, @SuppressLint("RecyclerView") int position) {
        holder.setTitle(mData.get(position));
        holder.setYear(mData.get(position));
        holder.setImage(mData.get(position));

        holder.IsPremium(mData.get(position));

        holder.Movie_Item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(mData.get(position).getContent_Type() == 1) {
                    Intent intent = new Intent(mContext, MovieDetails.class);
                    intent.putExtra("ID", mData.get(position).getID());
                    mContext.startActivity(intent);
                } else if(mData.get(position).getContent_Type() == 2) {
                    Intent intent = new Intent(mContext, WebSeriesDetails.class);
                    intent.putExtra("ID", mData.get(position).getID());
                    mContext.startActivity(intent);
                }
            }
        });
    }

    @Override
    public int getItemCount() {
        return mData.size();
    }

    public class MyViewHolder extends RecyclerView.ViewHolder {
        TextView Title;
        TextView Year;
        ImageView Thumbnail;

        View Premium_Tag;

        CardView Movie_Item;

        public MyViewHolder(@NonNull View itemView) {
            super(itemView);

            Title = (TextView) itemView.findViewById(R.id.Movie_list_Title);
            Year = (TextView) itemView.findViewById(R.id.Movie_list_Year);
            Thumbnail = (ImageView) itemView.findViewById(R.id.Movie_Item_thumbnail);

            Premium_Tag = (View) itemView.findViewById(R.id.Premium_Tag);

            Movie_Item = itemView.findViewById(R.id.Movie_Item);
        }

        void IsPremium(SearchList type) {
            if(type.getType() == 1) {
                Premium_Tag.setVisibility(View.VISIBLE);
            } else {
                Premium_Tag.setVisibility(View.GONE);
            }
        }

        void setTitle(SearchList title_text) {
            Title.setText(title_text.getTitle());
        }

        void setYear(SearchList year_text) {
            Year.setText(year_text.getYear());
        }

        void setImage(SearchList Thumbnail_Image) {
            Glide.with(context)
                    .load(Thumbnail_Image.getThumbnail())
                    .placeholder(R.drawable.thumbnail_placeholder)
                    .into(Thumbnail);
        }
    }

}

------------------------------------------
SEARCHLİST.Java
---------------------------------------
package com.xxxx.android.list;

public class SearchList {
    private int ID;
    private int Type;
    private String Title;
    private String Year;
    private String Thumbnail;
    private int Content_Type;

    public SearchList(int ID, int type, String title, String year, String thumbnail, int content_Type) {
        this.ID = ID;
        Type = type;
        Title = title;
        Year = year;
        Thumbnail = thumbnail;
        Content_Type = content_Type;
    }

    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }

    public int getType() {
        return Type;
    }

    public void setType(int type) {
        Type = type;
    }

    public String getTitle() {
        return Title;
    }

    public void setTitle(String title) {
        Title = title;
    }

    public String getYear() {
        return Year;
    }

    public void setYear(String year) {
        Year = year;
    }

    public String getThumbnail() {
        return Thumbnail;
    }

    public void setThumbnail(String thumbnail) {
        Thumbnail = thumbnail;
    }

    public int getContent_Type() {
        return Content_Type;
    }

    public void setContent_Type(int content_Type) {
        Content_Type = content_Type;
    }
    public void onResponse(String response) {

        try{ byte[] u = response.toString().getBytes("ISO-8859-1");

            response = new String(u, "UTF-8");

        }

        catch (Exception e){

            e.printStackTrace();

        }
    }
}
</code>```

Body:
I bought a movie app from Codecanyon. The support team screwed up, they can't fix the problem. I'm having trouble with letters like ç, ş, ğ, ü (Space) while searching for movies in the app. When I add a space between a two-word movie, all movies come off the screen.

https://youtube.com/shorts/Z9SOkbIa5kk

Home.java

Searchlistaddepter.java

Searchlist.java
Below

----------------------------------------------------------------------------
HOME.java
---------------------------------------------------------------------------
void searchContent(String text) {
    RequestQueue queue = Volley.newRequestQueue(this);
    StringRequest sr = new StringRequest(Request.Method.GET, AppConfig.url +"searchContent/"+text+"/"+onlyPremium, response -> {
        if(!response.equals("No Data Avaliable") ) {
            JsonArray jsonArray = new Gson().fromJson(response, JsonArray.class);

            List<SearchList> searchList = new ArrayList<>();
            for (JsonElement r : jsonArray) {
                JsonObject rootObject = r.getAsJsonObject();
                int id = rootObject.get("id").getAsInt();
                String name = rootObject.get("name").getAsString();

                String year = "";
                if(!rootObject.get("release_date").getAsString().equals("")) {
                    year = getYearFromDate(rootObject.get("release_date").getAsString());
                }

                String poster = rootObject.get("poster").getAsString();
                int type = rootObject.get("type").getAsInt();
                int status = rootObject.get("status").getAsInt();
                int contentType = rootObject.get("content_type").getAsInt();

                if (status == 1) {
                    searchList.add(new SearchList(id, type, name, year, poster, contentType));
                }
            }

            RecyclerView searchLayoutRecyclerView = findViewById(R.id.Search_Layout_RecyclerView);
            SearchListAdepter myadepter = new SearchListAdepter(context, searchList);
            searchLayoutRecyclerView.setLayoutManager(new GridLayoutManager(context, 3));
            searchLayoutRecyclerView.setAdapter(myadepter);

        } else {
            View bigSearchLottieAnimation = findViewById(R.id.big_search_Lottie_animation);
            RecyclerView searchLayoutRecyclerView = findViewById(R.id.Search_Layout_RecyclerView);
            bigSearchLottieAnimation.setVisibility(View.VISIBLE);
            searchLayoutRecyclerView.setVisibility(View.GONE);

        }
    }, error -> {
        //  Do nothing because There is No Error if error It will return 0
    }) {
        @Override
        public Map<String, String> getHeaders() throws AuthFailureError {
            Map<String,String> params = new HashMap<>();
            params.put("x-api-key", AppConfig.apiKey);
            return params;
        }
        @Override
        protected Map<String,String> getParams(){
            Map<String,String> params = new HashMap<>();
            params.put("search",text);
            params.put("onlypremium", String.valueOf(onlyPremium));
            return params;
        }
    };
    queue.add(sr);
}
---------------------------------------------------------
SEARCHLİSTADDEPTER.Java
----------------------------------------------------------
package com.xxxx.android.adepter;

import android.annotation.SuppressLint;
import android.content.Context;
import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.cardview.widget.CardView;
import androidx.recyclerview.widget.RecyclerView;

import com.bumptech.glide.Glide;

import com.xxxx.android.AppConfig;
import com.xxxx.android.R;
import com.xxxx.android.MovieDetails;
import com.xxxx.android.list.SearchList;
import com.xxxx.android.WebSeriesDetails;

import java.util.List;

public class SearchListAdepter extends RecyclerView.Adapter<SearchListAdepter.MyViewHolder> {
    private Context mContext;
    private List<SearchList> mData;

    Context context;

    public SearchListAdepter(Context mContext, List<SearchList> mData) {
        this.mContext = mContext;
        this.mData = mData;
    }

    @NonNull
    @Override
    public SearchListAdepter.MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        context = parent.getContext();
        View view;
        LayoutInflater mInflater = LayoutInflater.from(mContext);
        view = mInflater.inflate(AppConfig.contentItem,parent,false);
        return new SearchListAdepter.MyViewHolder(view);
    }

    @Override
    public void onBindViewHolder(@NonNull SearchListAdepter.MyViewHolder holder, @SuppressLint("RecyclerView") int position) {
        holder.setTitle(mData.get(position));
        holder.setYear(mData.get(position));
        holder.setImage(mData.get(position));

        holder.IsPremium(mData.get(position));

        holder.Movie_Item.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(mData.get(position).getContent_Type() == 1) {
                    Intent intent = new Intent(mContext, MovieDetails.class);
                    intent.putExtra("ID", mData.get(position).getID());
                    mContext.startActivity(intent);
                } else if(mData.get(position).getContent_Type() == 2) {
                    Intent intent = new Intent(mContext, WebSeriesDetails.class);
                    intent.putExtra("ID", mData.get(position).getID());
                    mContext.startActivity(intent);
                }
            }
        });
    }

    @Override
    public int getItemCount() {
        return mData.size();
    }

    public class MyViewHolder extends RecyclerView.ViewHolder {
        TextView Title;
        TextView Year;
        ImageView Thumbnail;

        View Premium_Tag;

        CardView Movie_Item;

        public MyViewHolder(@NonNull View itemView) {
            super(itemView);

            Title = (TextView) itemView.findViewById(R.id.Movie_list_Title);
            Year = (TextView) itemView.findViewById(R.id.Movie_list_Year);
            Thumbnail = (ImageView) itemView.findViewById(R.id.Movie_Item_thumbnail);

            Premium_Tag = (View) itemView.findViewById(R.id.Premium_Tag);

            Movie_Item = itemView.findViewById(R.id.Movie_Item);
        }

        void IsPremium(SearchList type) {
            if(type.getType() == 1) {
                Premium_Tag.setVisibility(View.VISIBLE);
            } else {
                Premium_Tag.setVisibility(View.GONE);
            }
        }

        void setTitle(SearchList title_text) {
            Title.setText(title_text.getTitle());
        }

        void setYear(SearchList year_text) {
            Year.setText(year_text.getYear());
        }

        void setImage(SearchList Thumbnail_Image) {
            Glide.with(context)
                    .load(Thumbnail_Image.getThumbnail())
                    .placeholder(R.drawable.thumbnail_placeholder)
                    .into(Thumbnail);
        }
    }

}

------------------------------------------
SEARCHLİST.Java
---------------------------------------
package com.xxxx.android.list;

public class SearchList {
    private int ID;
    private int Type;
    private String Title;
    private String Year;
    private String Thumbnail;
    private int Content_Type;

    public SearchList(int ID, int type, String title, String year, String thumbnail, int content_Type) {
        this.ID = ID;
        Type = type;
        Title = title;
        Year = year;
        Thumbnail = thumbnail;
        Content_Type = content_Type;
    }

    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }

    public int getType() {
        return Type;
    }

    public void setType(int type) {
        Type = type;
    }

    public String getTitle() {
        return Title;
    }

    public void setTitle(String title) {
        Title = title;
    }

    public String getYear() {
        return Year;
    }

    public void setYear(String year) {
        Year = year;
    }

    public String getThumbnail() {
        return Thumbnail;
    }

    public void setThumbnail(String thumbnail) {
        Thumbnail = thumbnail;
    }

    public int getContent_Type() {
        return Content_Type;
    }

    public void setContent_Type(int content_Type) {
        Content_Type = content_Type;
    }
    public void onResponse(String response) {

        try{ byte[] u = response.toString().getBytes("ISO-8859-1");

            response = new String(u, "UTF-8");

        }

        catch (Exception e){

            e.printStackTrace();

        }
    }
}


问:
Not been able to send to outlook client using Gmail smtp protocol
I built service in c# using MailKit package to send emails using smtp protocol.I have two problems :
when i am on localhost it send emails successfully to gmail client , but when i move to production, it fails, even so i set 2-step verification on and created app password and use it in configs.
my second problem is that even in localhost my service not succeeded in sending to outlook client.
can you please help me?
`

```<code>   using(var client = new  SmtpClient() )
                    {
                try
                {
                    client.Connect(_config.GetSection("Email").GetSection("Host").Value, 587, SecureSocketOptions.StartTls);
                    client.AuthenticationMechanisms.Remove("XOAUTH2");
                    client.Authenticate(_config.GetSection("Email").GetSection("Username").Value, _config.GetSection("Email").GetSection("Password").Value);
                    client.Send(email);
                }
                catch(Exception e)
                {
                    throw e;
                }
                finally
                {
                    client.Disconnect(true);
                    client.Dispose();
                }
            }
</code>```

`

Body:
I built service in c# using MailKit package to send emails using smtp protocol.I have two problems :
when i am on localhost it send emails successfully to gmail client , but when i move to production, it fails, even so i set 2-step verification on and created app password and use it in configs.
my second problem is that even in localhost my service not succeeded in sending to outlook client.
can you please help me?
`

   using(var client = new  SmtpClient() )
                    {
                try
                {
                    client.Connect(_config.GetSection("Email").GetSection("Host").Value, 587, SecureSocketOptions.StartTls);
                    client.AuthenticationMechanisms.Remove("XOAUTH2");
                    client.Authenticate(_config.GetSection("Email").GetSection("Username").Value, _config.GetSection("Email").GetSection("Password").Value);
                    client.Send(email);
                }
                catch(Exception e)
                {
                    throw e;
                }
                finally
                {
                    client.Disconnect(true);
                    client.Dispose();
                }
            }

`


问:
Put ResponseExceptionMapper on keycloak admin client
I use the keycloak admin client :

```<code><dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-keycloak-admin-client</artifactId>
  <version>2.15.0.CR1</version>
</dependency>
</code>```

I have the following code :

```<code>     try {
            realm.users().get(userId.toString()).resetPassword(credentialRepresentation);
        } catch (NotFoundException notFoundException) {
            log.debug(String.format("No user found for id %s", userId.toString()), notFoundException);
            throw new MyException();
        } catch (BadRequestException e) {
            // Need message detail from keycloak response
        }

</code>```

When i catch the exception the javax.ws.rs.BadRequestException is wrapped inside a org.jboss.resteasy.client.exception.ResteasyBadRequestException.

Unfortunatly  i need to access javax.ws.rs.BadRequestException to get the return body.

How can i prevent the keycloak admin client to wrap the original exception ?

Is it possible to add a ResponseExceptionMapper for this client ?

Body:
I use the keycloak admin client :

<dependency>
  <groupId>io.quarkus</groupId>
  <artifactId>quarkus-keycloak-admin-client</artifactId>
  <version>2.15.0.CR1</version>
</dependency>

I have the following code :

     try {
            realm.users().get(userId.toString()).resetPassword(credentialRepresentation);
        } catch (NotFoundException notFoundException) {
            log.debug(String.format("No user found for id %s", userId.toString()), notFoundException);
            throw new MyException();
        } catch (BadRequestException e) {
            // Need message detail from keycloak response
        }

When i catch the exception the javax.ws.rs.BadRequestException is wrapped inside a org.jboss.resteasy.client.exception.ResteasyBadRequestException.

Unfortunatly  i need to access javax.ws.rs.BadRequestException to get the return body.

How can i prevent the keycloak admin client to wrap the original exception ?

Is it possible to add a ResponseExceptionMapper for this client ?


问:
Deploy WearOS app from within Android app
I'm currently developing an app mainly for WearOS which needs a phone companion to work. Due to the phone app needing quite powerful permissions (BIND_NOTIFICATION_LISTENER_SERVICE, QUERY_ALL_PACKAGES) I'll not have a good time releasing this on the PlayStore.

I want to release it open source on GitHub. This means I'll have the hassle of explaining the user how to sideload a WearOS app.

Is there a way to remotely install the WearOS app from within the phone app?