问:
Swift AWS S3 Bucket Setup
I am trying to set up my S3 bucket to be able to upload an image and that image have a url from AWS. Currently I use the Amplify package to turn the image into an object and then upload it to AWS with a certain name key for that image. Here is the function and link to the package:
https://github.com/aws-amplify/amplify-swift

```<code>        let profileImage = imageSelected
        let profileImageData = profileImage.jpegData(compressionQuality: 1)!

        Amplify.Storage.uploadData(key: imageKey, data: profileImageData) { result in
            switch result {
            case .success(let uploadedData):
                print(uploadedData)
            case .failure(let error):
                print(error)
            }
        }
</code>```

My question is, is it possible to make a function that uploads to my bucket and create a AWS url to that image so that I can just save the url in my other database without having to use pods. If this is possible could I have help creating that function? Please let me know if I need to do more explaining.

Thank you!

Title: Swift AWS S3 Bucket Setup

Body:
I am trying to set up my S3 bucket to be able to upload an image and that image have a url from AWS. Currently I use the Amplify package to turn the image into an object and then upload it to AWS with a certain name key for that image. Here is the function and link to the package:
https://github.com/aws-amplify/amplify-swift

        let profileImage = imageSelected
        let profileImageData = profileImage.jpegData(compressionQuality: 1)!

        Amplify.Storage.uploadData(key: imageKey, data: profileImageData) { result in
            switch result {
            case .success(let uploadedData):
                print(uploadedData)
            case .failure(let error):
                print(error)
            }
        }

My question is, is it possible to make a function that uploads to my bucket and create a AWS url to that image so that I can just save the url in my other database without having to use pods. If this is possible could I have help creating that function? Please let me know if I need to do more explaining.

Thank you!


来源: stackexchange

问:
No view found for id 0x7f0a005b
I've met the problem that trouble me for days.

I have 2 fragments: theFirstFragment & theSecondFragment.
In MainActivity, i call theFirstFragment and it load ok. After that, i make event click on theFirstFragment to change theSecondFragment. It shows error:

java.lang.IllegalArgumentException: No view found for id 0x7f0a005b

This is my code:

MainActivity.java

```<code>@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        Fragment fragment = new TheFirstFragment();
        FragmentManager fm = getSupportFragmentManager();
        FragmentTransaction transaction = fm.beginTransaction();
        transaction.add(R.id.activeMain, fragment);
        transaction.commit();

    }
</code>```

activity_main.xml

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

TheFirstFragment.java

```<code>public class TheFirstFragment extends Fragment {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_first, container, false);
        return view;
    }
</code>```

fragment_first.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragment_first"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/background"
    tools:context=".TheFirstFragment">
</code>```

TheSecondFragment.java

```<code>public class TheSecondFragment extends Fragment
    @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            View view = inflater.inflate(R.layout.fragment_second, container, false);
            return view;
        }
</code>```

fragment_second

```<code><?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragment_second"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/background"
    tools:context=".TheSecondFragment">
</code>```

ContentLicense: CC BY-SA 4.0

Title: No view found for id 0x7f0a005b

Body:
I've met the problem that trouble me for days.

I have 2 fragments: theFirstFragment & theSecondFragment.
In MainActivity, i call theFirstFragment and it load ok. After that, i make event click on theFirstFragment to change theSecondFragment. It shows error:

java.lang.IllegalArgumentException: No view found for id 0x7f0a005b

This is my code:

MainActivity.java

@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        Fragment fragment = new TheFirstFragment();
        FragmentManager fm = getSupportFragmentManager();
        FragmentTransaction transaction = fm.beginTransaction();
        transaction.add(R.id.activeMain, fragment);
        transaction.commit();

    }

activity_main.xml

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

TheFirstFragment.java

public class TheFirstFragment extends Fragment {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_first, container, false);
        return view;
    }

fragment_first.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragment_first"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/background"
    tools:context=".TheFirstFragment">

TheSecondFragment.java

public class TheSecondFragment extends Fragment
    @Override
        public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
            View view = inflater.inflate(R.layout.fragment_second, container, false);
            return view;
        }

fragment_second

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/fragment_second"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@mipmap/background"
    tools:context=".TheSecondFragment">


问:
Y-Axis Scaling to normal distribution
I want to create a cumulative frequency plot with probability scaling on the y-axis.
When I transform the y-axis from the regular scaling to the probability scaling, the scale is not applied correctly.

```<code>plt <- ggplot(df, aes(df[,"test_values"]))
plt = plt + stat_ecdf()
last_plot()
plt = plt + stat_ecdf(geom="point")
last_plot()
last_plot()
plt = plt + ylab("Cumulative Frequency")
last_plot()
plt = plt + scale_x_continuous(labels = scales::scientific,breaks = scales::pretty_breaks(n = 8))
last_plot()
</code>```

Until this line everything is fine:

Then I want to scale the y axis

```<code>plt = plt + scale_y_continuous(trans=probability_trans("norm"), breaks=c(0.001,0.01,0.05,0.25,0.5,0.75,0.95,0.99,0.999))
last_plot()
</code>```

And i get this:

I would expect the value to be from 0 to 1 and not from 0.5 to 0.95.

I have scales version 1.2.1 and ggplot2 3.4.0 with R version 4.2.2

Title: Y-Axis Scaling to normal distribution

Body:
I want to create a cumulative frequency plot with probability scaling on the y-axis.
When I transform the y-axis from the regular scaling to the probability scaling, the scale is not applied correctly.

plt <- ggplot(df, aes(df[,"test_values"]))
plt = plt + stat_ecdf()
last_plot()
plt = plt + stat_ecdf(geom="point")
last_plot()
last_plot()
plt = plt + ylab("Cumulative Frequency")
last_plot()
plt = plt + scale_x_continuous(labels = scales::scientific,breaks = scales::pretty_breaks(n = 8))
last_plot()

Until this line everything is fine:

Then I want to scale the y axis

plt = plt + scale_y_continuous(trans=probability_trans("norm"), breaks=c(0.001,0.01,0.05,0.25,0.5,0.75,0.95,0.99,0.999))
last_plot()

And i get this:

I would expect the value to be from 0 to 1 and not from 0.5 to 0.95.

I have scales version 1.2.1 and ggplot2 3.4.0 with R version 4.2.2


问:
Uncaught (in promise) TypeError: http.Agent is not a constructor
I am trying to use Stripe. When I tried the code below, 'http.Agent is not a constructor' error thrown.

```<code>import Stripe from 'stripe';
const stripe = new Stripe('<my test key>', {
        apiVersion: '2022-11-15',
    });
</code>```

Error:

```<code>Uncaught (in promise) TypeError: http.Agent is not a constructor
    at node_modules/stripe/lib/net/NodeHttpClient.js (NodeHttpClient.js:6:26)
    at __require2 (chunk-NNYXQWFV.js?v=619287ea:19:50)
    at Stripe.createNodeHttpClient (stripe.js:117:28)
    at new Stripe (stripe.js:89:44)
    at myStripe (stripe.ts:8:20)
    at [lessonid].vue:189:5
    at runtime-core.esm-bundler.js:2723:40
    at callWithErrorHandling (runtime-core.esm-bundler.js:155:22)
    at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:164:21)
    at hook.__weh.hook.__weh (runtime-core.esm-bundler.js:2697:29)
</code>```

Environment:

```<code>Node ^17.0.0
stripe ^11.3.0
MacOS
Typescript
</code>```

Body:
I am trying to use Stripe. When I tried the code below, 'http.Agent is not a constructor' error thrown.

import Stripe from 'stripe';
const stripe = new Stripe('<my test key>', {
        apiVersion: '2022-11-15',
    });

Error:

Uncaught (in promise) TypeError: http.Agent is not a constructor
    at node_modules/stripe/lib/net/NodeHttpClient.js (NodeHttpClient.js:6:26)
    at __require2 (chunk-NNYXQWFV.js?v=619287ea:19:50)
    at Stripe.createNodeHttpClient (stripe.js:117:28)
    at new Stripe (stripe.js:89:44)
    at myStripe (stripe.ts:8:20)
    at [lessonid].vue:189:5
    at runtime-core.esm-bundler.js:2723:40
    at callWithErrorHandling (runtime-core.esm-bundler.js:155:22)
    at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:164:21)
    at hook.__weh.hook.__weh (runtime-core.esm-bundler.js:2697:29)

Environment:

Node ^17.0.0
stripe ^11.3.0
MacOS
Typescript


问:
Wordpress local by flywheel, grant delete permissions
I am trying to delete a page using WordPress rest API in a Local by flywheel site.

This is the code I use in the terminal:

curl --request DELETE -I --user  admin:password http://site.local/wp-json/wp/v2/pages/18909

This is the response:

```<code> curl --request DELETE -I --user  admin:password http://site.local/wp-json/wp/v2/pages/18909
HTTP/1.1 401 Unauthorized
Server: nginx/1.16.0
Date: Thu, 15 Dec 2022 10:07:36 GMT
Content-Type: application/json; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.4.1
X-Robots-Tag: noindex
Link: <http://site.local/wp-json/>; rel="https://api.w.org/"
X-Content-Type-Options: nosniff
Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages, Link
Access-Control-Allow-Headers: Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type
Allow: GET
</code>```

I understand, by the last row above, That I have permission only to GET data.
How can I extend my permissions?

Is there a way to do it without accessing the server?

Body:
I am trying to delete a page using WordPress rest API in a Local by flywheel site.

This is the code I use in the terminal:

curl --request DELETE -I --user  admin:password http://site.local/wp-json/wp/v2/pages/18909

This is the response:

 curl --request DELETE -I --user  admin:password http://site.local/wp-json/wp/v2/pages/18909
HTTP/1.1 401 Unauthorized
Server: nginx/1.16.0
Date: Thu, 15 Dec 2022 10:07:36 GMT
Content-Type: application/json; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
X-Powered-By: PHP/7.4.1
X-Robots-Tag: noindex
Link: <http://site.local/wp-json/>; rel="https://api.w.org/"
X-Content-Type-Options: nosniff
Access-Control-Expose-Headers: X-WP-Total, X-WP-TotalPages, Link
Access-Control-Allow-Headers: Authorization, X-WP-Nonce, Content-Disposition, Content-MD5, Content-Type
Allow: GET

I understand, by the last row above, That I have permission only to GET data.
How can I extend my permissions?

Is there a way to do it without accessing the server?


问:
Does Github still allow private raw file access with PAT in URL
I used to be able to make the following call with a Personal Access Token (the classic token)

curl https://$PAT@raw.githubusercontent.com/$ORG/$REPO/master/$FILE
```
<p>But now I just get the Github default 404 response.</p>
<p>If I follow a different approach the the file is accessible.</p>
<pre class="lang-bash prettyprint-override"><code>curl -H 'Authorization: token $PAT' \
-H 'Accept: application/vnd.github.v3.raw' \
-O -L https://api.github.com/$ORG/$REPO/master/$FILE
</code>```

I can't find anything in the docs that states the old curl URL request has been removed. Has this method now been removed?

Body:
I used to be able to make the following call with a Personal Access Token (the classic token)

curl https://$PAT@raw.githubusercontent.com/$ORG/$REPO/master/$FILE

But now I just get the Github default 404 response.

If I follow a different approach the the file is accessible.

curl -H 'Authorization: token $PAT' \
-H 'Accept: application/vnd.github.v3.raw' \
-O -L https://api.github.com/$ORG/$REPO/master/$FILE

I can't find anything in the docs that states the old curl URL request has been removed. Has this method now been removed?


问:
Realtime collaboration MODE comments
we are using RealTimeCollaborativeComments plugin in editor for the real-time collaboration comments.
we have own other functionality on basis of real-time collaborative comments .so we want custom adaptor also we try with the RealTimeCollaborativeComments plugin and custom adaptor but got an error. I have attached error in attachments .so is there any way to using RealTimeCollaborativeComments plugin and custom adaptor we handle the real time collaboration comment ???
enter image description here

I try with the RealTimeCollaborativeComments plugin but it is working in collaboration mode. But we want particular type of data and with help of custom  adaptor we can achieve in anluar JS.

Title: Realtime collaboration MODE comments


问:
Do methods executed within a EF DbContext Transaction inherit it?
When using EF and wrapping a conditional block in a transaction, as long as the DbContext is passed into a method inside the block, will it inherit the transaction that was started?

Example, the DbContext is passed into the method as the last parameter:

```<code>var db = new DbContext();
if(action == "Remove")
{
    using (var tran = db.Database.BeginTransaction()
    {
        try
        {
            MyMethod(param1, param2, db);
            //do some more things to another db table
            db.SaveChanges();
            tran.Commit();
        }
        catch
        {
            tran.Rollback();
        }
    }
    return;
}
</code>```

The method also contains a SaveChanges():

```<code>public static void MyMethod(int param1, string param2, DbContext db)
{
    try
    {
        //do some table updates
        db.SaveChanges();
    }
    catch
    {
        //throw exception
    }
}

</code>```

So, I assume that if the method fails for whatever reason then the entire transaction gets rolled back? And, if the method is successful but the changes made outside the method (but still inside the transaction) fail, then the changes made by the method are also rolled back?

This particular set of circumstances is not documented within the EF guides, so any guidance would be appreciated.

Body:
When using EF and wrapping a conditional block in a transaction, as long as the DbContext is passed into a method inside the block, will it inherit the transaction that was started?

Example, the DbContext is passed into the method as the last parameter:

var db = new DbContext();
if(action == "Remove")
{
    using (var tran = db.Database.BeginTransaction()
    {
        try
        {
            MyMethod(param1, param2, db);
            //do some more things to another db table
            db.SaveChanges();
            tran.Commit();
        }
        catch
        {
            tran.Rollback();
        }
    }
    return;
}

The method also contains a SaveChanges():

public static void MyMethod(int param1, string param2, DbContext db)
{
    try
    {
        //do some table updates
        db.SaveChanges();
    }
    catch
    {
        //throw exception
    }
}

So, I assume that if the method fails for whatever reason then the entire transaction gets rolled back? And, if the method is successful but the changes made outside the method (but still inside the transaction) fail, then the changes made by the method are also rolled back?

This particular set of circumstances is not documented within the EF guides, so any guidance would be appreciated.


问:
JSON Layout with Pattern in Logback Java - changing the display order and disable the timestamp
i use ch.qos.logback.contrib.json.classic.JsonLayout with this pattern

<layout class="ch.qos.logback.classic.PatternLayout"> <pattern>[%-5level] [%X{requestId}] %logger: %msg %ex{5}%n </pattern> </layout>
and this timestamp - format:

<timestampFormat>yyyy-MM-dd' 'HH:mm:ss.SSS</timestampFormat>

How can i disable the timestamp?
And how can i change the displayorder?
i will the logger at the last info.

thx Kaladial

i have try: clear this line <timestampFormat>yyyy-MM-dd' 'HH:mm:ss.SSS</timestampFormat> for disable the timestamp, but the result was a not formated timestamp

i have try: <pattern>[%-5level] [%X{requestId}]: %msg %ex{5}%n  %logger</pattern>, but this change nothing


问:
Hibernate Envers request related entities by date not revId
Is it possible to select audit entities with related entities by date(not by revId)?

I have database data that migrated multiple times and old data was inserted in audit with new revId.
For example there are jpa entities A and related B with @OneToMany relationship.

Data in database:

```<code>Revision table:
rev| date
15 | 2022-12-15
16 | 2022-12-20
17 | 2021-12-20  <- old data inserted with new revision

Table A_aud:
rev| table_A_columns
15 | record2
16 | record3
17 | record1   <- old data inserted with new revision

Table B_aud:
rev| table_B_columns
15 | record2
16 | record3
17 | record1   <- old data inserted with new revision
</code>```

JPA Entity A:

```<code>@Table(name = "A")
@Audited
class A {
    @OneToMany(mappedBy = "a", cascade = CascadeType.ALL)
    private B b;
    ...
}
</code>```

Following code to select two A entities with B:

```<code>List<Object[]> resultList = AuditReader.createQuery()
        .forRevisionsOfEntity(A.class, false, true)
        .addOrder(AuditEntity.revisionNumber().desc())
        .add(AuditEntity.id().eq(entityId))
        .add(AuditEntity.revisionProperty("date").le(selectedDate))
        .setMaxResults(2)
        .getResultList();
</code>```

But the code selects B entity by revId not by date.
Is it possible to adjust Hibernte envers to select related entities by date?
Also, fixing data is not option for me.

Body:
Is it possible to select audit entities with related entities by date(not by revId)?

I have database data that migrated multiple times and old data was inserted in audit with new revId.
For example there are jpa entities A and related B with @OneToMany relationship.

Data in database:

Revision table:
rev| date
15 | 2022-12-15
16 | 2022-12-20
17 | 2021-12-20  <- old data inserted with new revision

Table A_aud:
rev| table_A_columns
15 | record2
16 | record3
17 | record1   <- old data inserted with new revision

Table B_aud:
rev| table_B_columns
15 | record2
16 | record3
17 | record1   <- old data inserted with new revision

JPA Entity A:

@Table(name = "A")
@Audited
class A {
    @OneToMany(mappedBy = "a", cascade = CascadeType.ALL)
    private B b;
    ...
}

Following code to select two A entities with B:

List<Object[]> resultList = AuditReader.createQuery()
        .forRevisionsOfEntity(A.class, false, true)
        .addOrder(AuditEntity.revisionNumber().desc())
        .add(AuditEntity.id().eq(entityId))
        .add(AuditEntity.revisionProperty("date").le(selectedDate))
        .setMaxResults(2)
        .getResultList();

But the code selects B entity by revId not by date.
Is it possible to adjust Hibernte envers to select related entities by date?
Also, fixing data is not option for me.


问:
error about negative ou NA values in a array when using absolute values
```<code>a = 2;
epsilon = 1e-10;
t0 = 1;
N = 20;

function t = metodoDeNewton(a, t0, N, epsilon)
  t = zeros(1, N+1);
  t(1) = t0;
  for i = 1:N
    t(i+1) = t(i) - (t(i)^2 - (a - sin(t(i)))) / (2 * t(i) - cos(t(i)));
    if (abs(t(i+1) - t(i)) < epsilon)
    break;
  endif
endfor
endfunction

t = metodoDeNewton(a, t0, N, epsilon);

% Mostra a última iteração, que é a aproximação da raiz da equação
disp(t(end));

% Estima a ordem de convergência e o coeficiente assintótico de convergência
% Para isso, calcula a razão entre duas iterações consecutivas e a razão entre
% o erro absoluto dessas iterações e o erro absoluto das iterações anteriores
r = zeros(1, length(t) - 1);
k = zeros(1, length(t) - 1);
for i = 2:length(t)
  r(i-1) = t(i) / t(i-1);
  k(i-1) = (abs(t(i) - t(i-1))) / (abs(t(i-1) - t(i-2)));
endfor

% Mostra a razão e o coeficiente assintótico de convergência
x = disp(r(end));
y = disp(k(end));
</code>```

This code gives me the error error: t(0): subscripts must be either integers 1 to (2^63)-1 or logicals I understand this is because my k variable calculates a negative integer maybe, and I don't really understand why, since my values will allways be positive. I thought that maybe it's because the for loop might be trying to calculate NA values, but even so, how do I fix that?

Body:
a = 2;
epsilon = 1e-10;
t0 = 1;
N = 20;

function t = metodoDeNewton(a, t0, N, epsilon)
  t = zeros(1, N+1);
  t(1) = t0;
  for i = 1:N
    t(i+1) = t(i) - (t(i)^2 - (a - sin(t(i)))) / (2 * t(i) - cos(t(i)));
    if (abs(t(i+1) - t(i)) < epsilon)
    break;
  endif
endfor
endfunction

t = metodoDeNewton(a, t0, N, epsilon);

% Mostra a última iteração, que é a aproximação da raiz da equação
disp(t(end));

% Estima a ordem de convergência e o coeficiente assintótico de convergência
% Para isso, calcula a razão entre duas iterações consecutivas e a razão entre
% o erro absoluto dessas iterações e o erro absoluto das iterações anteriores
r = zeros(1, length(t) - 1);
k = zeros(1, length(t) - 1);
for i = 2:length(t)
  r(i-1) = t(i) / t(i-1);
  k(i-1) = (abs(t(i) - t(i-1))) / (abs(t(i-1) - t(i-2)));
endfor

% Mostra a razão e o coeficiente assintótico de convergência
x = disp(r(end));
y = disp(k(end));

This code gives me the error error: t(0): subscripts must be either integers 1 to (2^63)-1 or logicals I understand this is because my k variable calculates a negative integer maybe, and I don't really understand why, since my values will allways be positive. I thought that maybe it's because the for loop might be trying to calculate NA values, but even so, how do I fix that?


问:
Why does ReactDom.hydrate require to (re)create the same markup on the client that has already been created on the server?
I'm currently trying to understand the concepts behind SSR in a ReactJS application and cannot seem to understand one of the key concepts.

The official ReactJS documentation explains that when hydrating, the content rendered on the client must be identical to the one rendered on the server.

React expects that the rendered content is identical between the
server and the client. It can patch up differences in text content,
but you should treat mismatches as bugs and fix them. In development
mode, React warns about mismatches during hydration. There are no
guarantees that attribute differences will be patched up in case of
mismatches. This is important for performance reasons because in most
apps, mismatches are rare, and so validating all markup would be
prohibitively expensive.

This is clearly possible by sharing components between the server and the client but somehow seems to defeat the idea to do the heavy lifting on the server side.
If for example a page requires loading a large amount of data from a database to be rendered and this is done on the server side, the client would now need to load all the data over to the client just to render the exact same page and hydrate it.

What am I missing?


问:
VBA Autofilter using logical AND across Columns
I have a situation where I have a list of dates and I want to exclude some of those dates. The problem is that some of those dates have more than one value, and there is a specific value that I want to exclude for each date. The problem is that the value I wish to exclude is not exclusive to those dates so I need the logical equivalent of AND where I exclude those rows with those dates and value.

```<code>With ActiveSheet.ListObjects("table")
.Range.AutoFilter Field:=1, Criteria1:="<>17/08/2016", Operator:=xlAnd, Criteria2:="<>18/11/2016"
.Range.AutoFilter Field:=4, Criteria1:="<>-350"
.AutoFilter.ShowAllData
</code>```

The code above removes all rows with date 18/11/2016 before I have the chance to condition on the value. Conversely if I condition on the <>-350 first it removes that values that value from all dates including the ones I want to keep. So I want to be able to filter such that the date AND the value match is this possible in VBA?

Body:
I have a situation where I have a list of dates and I want to exclude some of those dates. The problem is that some of those dates have more than one value, and there is a specific value that I want to exclude for each date. The problem is that the value I wish to exclude is not exclusive to those dates so I need the logical equivalent of AND where I exclude those rows with those dates and value.

With ActiveSheet.ListObjects("table")
.Range.AutoFilter Field:=1, Criteria1:="<>17/08/2016", Operator:=xlAnd, Criteria2:="<>18/11/2016"
.Range.AutoFilter Field:=4, Criteria1:="<>-350"
.AutoFilter.ShowAllData

The code above removes all rows with date 18/11/2016 before I have the chance to condition on the value. Conversely if I condition on the <>-350 first it removes that values that value from all dates including the ones I want to keep. So I want to be able to filter such that the date AND the value match is this possible in VBA?


问:
(.NET) How to add a mandatory admin role/policy who has authorization to all the API?
I need to add an admin role who can hit all the application endpoint regardless of the "Authorize" attributes in controllers or a global policy. The API is made in .NET 6.</p>


问:
After update KB5021090 image can't be read from xps in WPF app
After update KB5021090 image can't be read from xps in code

I use :

```<code>using (XpsDocument xpsDoc = new XpsDocument(xpsDocFileName, FileAccess.Read))
{
    ...
}
</code>```

For read xps.
Manipulate them, convert them to image.
With the update KB5021090, image are not read.
This update visibily can't be uninstalled.

Someone have a solution to fix it?

Body:
After update KB5021090 image can't be read from xps in code

I use :

using (XpsDocument xpsDoc = new XpsDocument(xpsDocFileName, FileAccess.Read))
{
    ...
}

For read xps.
Manipulate them, convert them to image.
With the update KB5021090, image are not read.
This update visibily can't be uninstalled.

Someone have a solution to fix it?


问:
It it okay to use Chakra UI hooks (useBoolean, useConst) for convenience in a project, or should I stick with built-in React hooks?
I'm interested in these hooks: useBoolean, useConst. Technically, you can achieve the same behavior with the built-in hooks. But those offered by Chakra UI are more convenient.
What do you think? Is it okay to use the hooks in your project for convenience, or is it going to complicate things in the future and make it more difficult to maintain the project? Should I React built-in ones whenever possible?

Chakra UI is a big part of the project I'm working on.


问:
Can an MMU and MPU conflict with each other?
In the AM5K2E02 System-on-Chip, there is an MMU (memory management unit) in the core, and also a peripheral device MPU (memory protection unit).

On other pages, the MMU is described as a superset of MPU, i.e. MMU does everything MPU does and more, but what would happen if both an MMU and MPU are both active?

Reason for asking is we have an MMU configured and setup, but there is an MPU alive with default settings running. Who gets priority when deciding whether such-and-such process or user has access to so-and-so memory region? I can't find a clear answer, and in fact some pages seem to suggest that a SoC will have either MPU or MMU but not both, which isn't true here as the AM5K2E02 has both.

Thanks all :) and merry christmas soon!


问:
String to Expression in Swift
I need Help
I have a simple math expression parser:

```<code>public indirect enum Expr {
    case variable // could take name as associated type to support multiple vars
    case const(Decimal)
    case negate(Expr)
    case sum([Expr])
    case product([Expr])
    case quotient(Expr, Expr)
    case power(Expr, Decimal)
}
</code>```
```<code>public extension Expr {
    static prefix func -(expr: Expr)    -> Expr { .negate(expr) }
    static func +(lhs: Expr, rhs: Expr) -> Expr { .sum([lhs, rhs]) }
    static func -(lhs: Expr, rhs: Expr) -> Expr { .sum([lhs, .negate(rhs)]) }
    static func *(lhs: Expr, rhs: Expr) -> Expr { .product([lhs, rhs]) }
    static func /(lhs: Expr, rhs: Expr) -> Expr { .quotient(lhs, rhs) }
    static func ^(lhs: Expr, rhs: Decimal) -> Expr { .power(lhs, rhs) }
}

extension Expr: ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral {
    public init(integerLiteral: Int64) {
        self = .const(Decimal(integerLiteral))
    }

    public init(floatLiteral: Double) {
        self = .const(Decimal(floatLiteral))
    }
}
</code>```

It works great with expressions:

for example:

```<code>let x: Expr = .variable
let expr: Expr = 3*(x+5)
print(expr)
</code>```

prints:

```<code>product([SymbolicDifferentiator_Sources.Expr.const(3), SymbolicDifferentiator_Sources.Expr.sum([SymbolicDifferentiator_Sources.Expr.variable, SymbolicDifferentiator_Sources.Expr.const(5)])])
</code>```

But I want to parse expressions entered with Command Line (as I String):

I've tried

```<code>let stringWithMathematicalOperation: String = "5*5" // Example
let exp: NSExpression = NSExpression(format: stringWithMathematicalOperation)
let result: Expr = exp.expressionValue(with:nil, context: nil) as! Expr
</code>```

But it gives me an error on the last string: Could not cast value of type '__NSCFNumber' (0x1fe417d18) to 'SymbolicDifferentiator_Sources.Expr' (0x1070e4510).

How can I convert String entered in Command Line to expression and cast it to my Expr indirect enum?

Title: String to Expression in Swift

Body:
I need Help
I have a simple math expression parser:

public indirect enum Expr {
    case variable // could take name as associated type to support multiple vars
    case const(Decimal)
    case negate(Expr)
    case sum([Expr])
    case product([Expr])
    case quotient(Expr, Expr)
    case power(Expr, Decimal)
}

public extension Expr {
    static prefix func -(expr: Expr)    -> Expr { .negate(expr) }
    static func +(lhs: Expr, rhs: Expr) -> Expr { .sum([lhs, rhs]) }
    static func -(lhs: Expr, rhs: Expr) -> Expr { .sum([lhs, .negate(rhs)]) }
    static func *(lhs: Expr, rhs: Expr) -> Expr { .product([lhs, rhs]) }
    static func /(lhs: Expr, rhs: Expr) -> Expr { .quotient(lhs, rhs) }
    static func ^(lhs: Expr, rhs: Decimal) -> Expr { .power(lhs, rhs) }
}

extension Expr: ExpressibleByIntegerLiteral, ExpressibleByFloatLiteral {
    public init(integerLiteral: Int64) {
        self = .const(Decimal(integerLiteral))
    }

    public init(floatLiteral: Double) {
        self = .const(Decimal(floatLiteral))
    }
}

It works great with expressions:

for example:

let x: Expr = .variable
let expr: Expr = 3*(x+5)
print(expr)

prints:

product([SymbolicDifferentiator_Sources.Expr.const(3), SymbolicDifferentiator_Sources.Expr.sum([SymbolicDifferentiator_Sources.Expr.variable, SymbolicDifferentiator_Sources.Expr.const(5)])])

But I want to parse expressions entered with Command Line (as I String):

I've tried

let stringWithMathematicalOperation: String = "5*5" // Example
let exp: NSExpression = NSExpression(format: stringWithMathematicalOperation)
let result: Expr = exp.expressionValue(with:nil, context: nil) as! Expr

But it gives me an error on the last string: Could not cast value of type '__NSCFNumber' (0x1fe417d18) to 'SymbolicDifferentiator_Sources.Expr' (0x1070e4510).

How can I convert String entered in Command Line to expression and cast it to my Expr indirect enum?


问:
spring boot and datadog getting metrics
I have configured the following in my application but i cant seem to get some metrics from http.servlet.request published to datadog.

Spring 2.7.1

```<code>implementation("com.datadoghq:dd-trace-ot:0.98.1")
implementation("com.datadoghq:dd-trace-api:0.98.1")
implementation("io.micrometer:micrometer-core:1.9.2")
implementation("io.micrometer:micrometer-registry-statsd:1.9.2")
</code>```

My props is as follows

```<code>management.endpoint.health.probes.enabled=true
management.metrics.export.datadog.step=1m
management.metrics.distribution.percentiles-histogram.http.server.requests=true
management.metrics.export.datadog.descriptions=true
management.metrics.web.server.request.autotime.enabled=true
management.endpoint.metrics.enabled=true
management.metrics.enable.logback=true
management.metrics.tags.application=my-app
management.metrics.export.statsd.enabled=true
management.metrics.export.statsd.host=${DD_HOST}
management.metrics.export.statsd.flavor=datadog
management.metrics.export.statsd.port=8125
</code>```

So i can see http.servlet.request, but i cant seem to get http.servlet.request.max or http.servlet.request.count.. i really wanted latency is that even possible?

im using tomcat with spring as per standard, Anyone got any ideas why this would be the case why im not seeing

Title: spring boot and datadog getting metrics

Body:
I have configured the following in my application but i cant seem to get some metrics from http.servlet.request published to datadog.

Spring 2.7.1

implementation("com.datadoghq:dd-trace-ot:0.98.1")
implementation("com.datadoghq:dd-trace-api:0.98.1")
implementation("io.micrometer:micrometer-core:1.9.2")
implementation("io.micrometer:micrometer-registry-statsd:1.9.2")

My props is as follows

management.endpoint.health.probes.enabled=true
management.metrics.export.datadog.step=1m
management.metrics.distribution.percentiles-histogram.http.server.requests=true
management.metrics.export.datadog.descriptions=true
management.metrics.web.server.request.autotime.enabled=true
management.endpoint.metrics.enabled=true
management.metrics.enable.logback=true
management.metrics.tags.application=my-app
management.metrics.export.statsd.enabled=true
management.metrics.export.statsd.host=${DD_HOST}
management.metrics.export.statsd.flavor=datadog
management.metrics.export.statsd.port=8125

So i can see http.servlet.request, but i cant seem to get http.servlet.request.max or http.servlet.request.count.. i really wanted latency is that even possible?

im using tomcat with spring as per standard, Anyone got any ideas why this would be the case why im not seeing


问:
Implementing SemVer versioning on Azure Function App Deployment with GitLab-CI pipeline
I'm looking for a sample in GitLab-CI-Pipeline for deploying an Azure Function App written in .Net 6.0 and deployed with Terraform [IaaC], which is available in a separate repository.

I am able to Build and Deploy but not getting a right reference for implementing versioning on App-Project-Repo.

The versioning has the following requirements:

It starts with every deployment from Master Branch.

Version manually incremented on QA-Deployment which happens from master-branch

Version also need to be create tagged to Master-branch

It needs to support roll-back as well.


问:
Flutter: pass data from one screen to another based on a list that I fetch from API
I am building a Job Find app on flutter and I am facing some State Management problems. I have a screen where I show all of my job listings (job_list_screen.dart) and if the user press on a job the app loads this specific job with all the details(job_details_screen.dart).
enter image description here
enter image description here
As you can see, I have an apply button(the blue button) on both screens. When I press apply on the job_details_screen I send a put request on my database and it works fine. But, when I go back to my job_list_screen the button doesn't change even thought I wrapped it with a Consumer.
enter image description here
enter image description here
Here is all the code I wrote with the providers, the **screens **and the **widgets **I use.

The jobs provider:

First of all, this is how I fetch jobs from the API and I insert all my data in a List model:
`

```<code>/*
    |--------------------------------------------------------------------------
    | Fetch Jobs from database
    |--------------------------------------------------------------------------
    |
    | 1. set the url for this function
    | 2. GET the response from the server only if you are authenticated
    | 3. Decode the
        response.body: {
          'listings': {
            'data': (*Inside here, there are all the job list*)
          }
        }
    | 4. For every job inside the data response
    | add a new Job item in the List<Job>
    | with the named variables from the current data.reposnse.job
  */
  Future<List<Job>?> fetchJobs() async {
    final key = await storage.read(key: 'auth');

    final baseUrl = AppUrl.baseUrl;

    try {
      // 1.
      var url = Uri.parse('$baseUrl/listings');

      // 2.
      var response = await http.get(
        url,
        headers: {
          'Accept': 'application/json',
          'Authorization': 'Bearer $key',
        },
      );

      // print(key);

      if (response.statusCode == 200 || response.statusCode == 201) {
        // 3.
        var jsonResponse = jsonDecode(response.body)['listings']['data'];
        _jobs = [];

        // 4.
        for (var j in jsonResponse) {
          Job job = Job(
            id: j['id'],
            title: j['title'],
            employmentType: j['employmentType'],
            major: j['major'],
            city: j['city'],
            companyName: j['companyName'],
            experience: j['experience'],
            date: j['date'],
            views: j['views'],
            description: j['description'],
            benefits: j['benefits'],
            requirements: j['requirements'],
            hasApplied: j['hasApplied'],
            hasViewed: j['hasViewed'],
          );

          _jobs.add(job);
          notifyListeners();
        }
        notifyListeners();
        return _jobs;
      } else {
        throw Exception('Problem loading jobs');
      }
    } catch (e) {
      print(e);
    }
  }
</code>```

`

This is the function that I call when the user presses the apply button:
`

```<code> /*
    |--------------------------------------------------------------------------
    | Apply for a job
    |--------------------------------------------------------------------------
  */
  Future<void> applyJob(String id) async {
    final key = await storage.read(key: 'auth');

    final baseUrl = AppUrl.baseUrl;

    try {
      var url = Uri.parse('$baseUrl/listings/$id/apply');

      var response = await http.put(
        url,
        headers: {
          'Accept': 'application/json',
          'Authorization': 'Bearer $key',
        },
      );

      if (response.statusCode == 200 || response.statusCode == 201) {
        print(jsonDecode(response.body));

        _hasApplied = jsonDecode(response.body)['hasApplied'];
        notifyListeners();
      } else {
        print(jsonDecode(response.body));
        notifyListeners();
      }
    } catch (e) {
      print(e);
    }
    notifyListeners();
  }
</code>```

`

The job_card widget:

`

```<code>import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'package:final_try/screens/job_details_screen.dart';

import '../models/job.dart';
import '../providers/jobs.dart';
import '../styles/colors.dart';

class JobCardBig extends StatefulWidget {

  static const routeName = '/job-card-big';

  @override
  State<JobCardBig> createState() => _JobCardBigState();
}

class _JobCardBigState extends State<JobCardBig> {
  @override
  Widget build(BuildContext context) {
    final job = Provider.of<Job>(context, listen: true);

    return Container(
      padding: EdgeInsets.all(10),
      margin: EdgeInsets.only(bottom: 10),
      width: double.infinity,
      decoration: BoxDecoration(
        border: Border.all(color: lightgrey, width: 1),
        borderRadius: BorderRadius.circular(5.0),
        boxShadow: [
          BoxShadow(
            color: lightgrey.withOpacity(.5),
            spreadRadius: 1,
            blurRadius: 2,
            offset: Offset(0, 1), // changes position of shadow
          ),
        ],
        color: white,
      ),
      child: Column(children: [
        Container(
            child: Row(
          children: [
            Container(
              height: 50,
              width: 50,
              alignment: Alignment.center,
              decoration:
                  BoxDecoration(shape: BoxShape.circle, color: lightgrey),
            ),
            SizedBox(
              width: 10,
            ),
            Expanded(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Flexible(
                    child: Container(
                      height: 70,
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: [
                          Text(
                            job.title.toString(),
                            style: TextStyle(
                              fontSize: 18,
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                          Text(
                            job.companyName.toString(),
                            style: TextStyle(
                              fontSize: 14,
                              color: lightgrey,
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                  Container(
                    height: 70,
                    width: 50,
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      crossAxisAlignment: CrossAxisAlignment.end,
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.end,
                          children: [
                            Icon(
                              Icons.remove_red_eye,
                              size: 14,
                              color: darkgrey,
                            ),
                            SizedBox(
                              width: 5,
                            ),
                            Text(
                              job.views == null
                                  ? job.views = '0'
                                  : job.views.toString(),
                              style: TextStyle(
                                fontSize: 14,
                                color: darkgrey,
                              ),
                            ),
                          ],
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        )),
        SizedBox(
          height: 5,
        ),
        Divider(
          thickness: 1,
        ),
        SizedBox(
          height: 5,
        ),
        Container(
          height: 80,
          alignment: Alignment.bottomLeft,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Row(
                children: [
                  Text(
                    'Είδος Απασχόλησης:',
                  ),
                  SizedBox(
                    width: 5,
                  ),
                  Text(
                    Provider.of<Jobs>(context, listen: false)
                        .jobTypeFormat(job.employmentType.toString()),
                    style: TextStyle(color: lightgrey),
                  ),
                ],
              ),
              Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text('Προϋπηρεσία:'),
                  SizedBox(
                    width: 5,
                  ),
                  Flexible(
                    child: job.experience == null
                        ? Text(
                            'Δεν απαιτείται',
                            style: TextStyle(color: lightgrey),
                          )
                        : job.experience! > 1
                            ? Text(
                                '${job.experience.toString()} χρόνια',
                                style: TextStyle(color: lightgrey),
                              )
                            : Text(
                                '${job.experience.toString()} χρόνο',
                                style: TextStyle(color: lightgrey),
                              ),
                  ),
                ],
              ),
              Row(
                children: [
                  Text('Τοποθεσία:'),
                  SizedBox(
                    width: 5,
                  ),
                  Text(
                    job.city.toString(),
                    style: TextStyle(color: lightgrey),
                  ),
                ],
              ),
              Row(
                children: [
                  Text('Δημοσιεύθηκε:'),
                  SizedBox(
                    width: 5,
                  ),
                  Text(
                    Provider.of<Jobs>(context, listen: false)
                        .dateFormat(job.date),
                    // job.date.toString(),
                    style: TextStyle(color: lightgrey),
                  ),
                ],
              ),
            ],
          ),
        ),
        Container(
          margin: EdgeInsets.only(top: 20),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              GestureDetector(
                child: Container(
                  padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
                  decoration: BoxDecoration(
                    border: Border.all(color: darkgrey, width: 1),
                    borderRadius: BorderRadius.circular(5.0),
                    color: darkgrey,
                  ),
                  child: Text(
                    'Περισσότερα',
                    style: TextStyle(color: white),
                  ),
                ),
                onTap: () {
                  Navigator.of(context)
                      .pushNamed(JobDetailsScreen.routeName, arguments: job.id)
                      .then((_) {
                    // Provider.of<Jobs>(context, listen: false).fetchJobs();
                  });
                },
              ),
              Container(
                padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(5.0),
                  color: job.hasApplied == 1
                      ? Color.fromARGB(255, 196, 76, 68)
                      : buttonColor,
                ),
                child: Consumer<Job>(
                  builder: (context, job, child) {
                    return Text(
                      job.hasApplied == 1 ? 'Δεν ενδιαφέρομαι' : 'Αίτηση',
                      style: TextStyle(
                        color: white,
                      ),
                    );
                  },
                ),
              ),
            ],
          ),
        ),
      ]),
    );
  }
}

</code>```

`

The job_list_screen:
Here I load all my job_card widgets with ListView.builder

`

```<code>import 'package:provider/provider.dart';
import 'package:flutter/material.dart';

import '../styles/colors.dart';

import '../providers/jobs.dart';

import '../widgets/header_screen.dart';
import '../widgets/job_card_big.dart';

class JobListScreen extends StatefulWidget {
  static const routeName = '/job-list-screen';
  const JobListScreen({super.key});

  @override
  State<JobListScreen> createState() => _JobListScreenState();
}

class _JobListScreenState extends State<JobListScreen> {
  final controller = ScrollController();
  bool _firstLoading = true;
  var _isLoading = false;
  int page = 1;

  final _formKey = GlobalKey<FormState>();
  String? _searchText;
  bool _isFiltered = false;

  @override
  void initState() {
    controller.addListener(() {
      if (controller.position.maxScrollExtent == controller.offset) {
        fetch();
      }
    });

    super.initState();
  }

  Future fetch() async {
    if (!_isFiltered) {
      setState(() {
        _isLoading = true;
        page++;
        Provider.of<Jobs>(context, listen: false)
            .fetchMore(page)
            .then((_) => _isLoading = false);
      });
    }
  }

  @override
  void didChangeDependencies() {
    if (_firstLoading) {
      Provider.of<Jobs>(context, listen: true).fetchJobs().then((_) {
        setState(() {
          _firstLoading = false;
        });
      });
    }
    super.didChangeDependencies();
  }

  void searchJob() {
    if(_searchText == null || _searchText == ''){
      setState(() {
      _isFiltered = false;
    });
    }
    else setState(() {
      Provider.of<Jobs>(context, listen: false).filterJobs(_searchText!);
      _isFiltered = true;
    });
  }

  @override
  Widget build(BuildContext context) {
    final jobsData = Provider.of<Jobs>(context, listen: true);
    var jobsList = jobsData.jobs;
    var filteredList = jobsData.filteredJobs;
    // var jobsListFiltered = jobsData.filteredJobs;

    return Scaffold(
      body: Stack(
        children: [
          Container(
            height: MediaQuery.of(context).size.height,
            padding: EdgeInsets.only(
              top: 20,
              right: 20,
              left: 20,
            ),
            child: Column(
              children: [
                HeaderScreen(title: 'Αγγελίες'),
                Container(
                  child: Form(
                    key: _formKey,
                    child: Row(
                      children: [
                        Expanded(
                          child: Container(
                            child: TextFormField(
                              decoration: InputDecoration(
                                hintText: 'Enter some text',
                              ),
                              onSaved: (value) {
                              _searchText = value;
                            },
                            ),
                          ),
                        ),
                        Container(
                          margin: EdgeInsets.only(top: 10, bottom: 5),
                          height: 40,
                          width: 40,
                          child: ElevatedButton(
                            style: ButtonStyle(
                              foregroundColor:
                                  MaterialStateProperty.all<Color>(white),
                              backgroundColor: MaterialStateProperty.all<Color>(
                                  primaryColor),
                            ),
                            child: Container(
                              child: Icon(Icons.search),
                            ),
                            onPressed: () {
                              _formKey.currentState?.save();

                              searchJob();
                            },
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
                SizedBox(
                  height: 10,
                ),
                Divider(
                  thickness: 1,
                ),
                SizedBox(
                  height: 10,
                ),
                Expanded(
                  child: !_isFiltered
                      ? Container(
                          child: !_firstLoading
                              ? ListView.builder(
                                  controller: controller,
                                  itemCount: jobsList.length,
                                  itemBuilder: (ctx, i) =>
                                      ChangeNotifierProvider.value(
                                    value: jobsList[i],
                                    child: Column(
                                      children: [
                                        JobCardBig(),
                                      ],
                                    ),
                                  ),
                                )
                              : Center(
                                  child: CircularProgressIndicator(),
                                ),
                        )
                      : Container(
                          child: !_firstLoading
                              ? ListView.builder(
                                  controller: controller,
                                  itemCount: filteredList.length,
                                  itemBuilder: (ctx, i) =>
                                      ChangeNotifierProvider.value(
                                    value: filteredList[i],
                                    child: Column(
                                      children: [
                                        JobCardBig(),
                                      ],
                                    ),
                                  ),
                                )
                              : Center(
                                  child: CircularProgressIndicator(),
                                ),
                        ),
                ),
              ],
            ),
          ),
          Positioned(
            child: _isLoading
                ? Container(
                    width: double.infinity,
                    height: MediaQuery.of(context).size.height,
                    color: Color.fromARGB(52, 0, 0, 0),
                    child: Center(
                      child: CircularProgressIndicator(),
                    ),
                  )
                : Container(),
          ),
        ],
      ),
    );
  }
}

</code>```

`

I tried to load my fetchJobs() function when the user exits the job_details_screen but even though it works, it is not the right solution. The reason why I say that this is not the right way, is because of this possible scenario:
If the user scrolls down a lot, and the app load 60 jobs, then if he presses on job 60, and he exit the job_details_screen, the app will load the first 15 jobs and the user will have to scroll down again. And that's not the user experience I want to provide.
I am searching for a solution that will update only the apply button and it will not need to recreate the whole list. Plus, with this solution the user will go back to the same scroll point he was when he entered the job_details_screen.

I hope I explained my problem properly. This is the first time I upload a question here and I would also like to mention that this is my first project on flutter so don't judge my code too harshly.

Thanks in advance!!

Body:
I am building a Job Find app on flutter and I am facing some State Management problems. I have a screen where I show all of my job listings (job_list_screen.dart) and if the user press on a job the app loads this specific job with all the details(job_details_screen.dart).
enter image description here
enter image description here
As you can see, I have an apply button(the blue button) on both screens. When I press apply on the job_details_screen I send a put request on my database and it works fine. But, when I go back to my job_list_screen the button doesn't change even thought I wrapped it with a Consumer.
enter image description here
enter image description here
Here is all the code I wrote with the providers, the **screens **and the **widgets **I use.

The jobs provider:

First of all, this is how I fetch jobs from the API and I insert all my data in a List model:
`

/*
    |--------------------------------------------------------------------------
    | Fetch Jobs from database
    |--------------------------------------------------------------------------
    |
    | 1. set the url for this function
    | 2. GET the response from the server only if you are authenticated
    | 3. Decode the
        response.body: {
          'listings': {
            'data': (*Inside here, there are all the job list*)
          }
        }
    | 4. For every job inside the data response
    | add a new Job item in the List<Job>
    | with the named variables from the current data.reposnse.job
  */
  Future<List<Job>?> fetchJobs() async {
    final key = await storage.read(key: 'auth');

    final baseUrl = AppUrl.baseUrl;

    try {
      // 1.
      var url = Uri.parse('$baseUrl/listings');

      // 2.
      var response = await http.get(
        url,
        headers: {
          'Accept': 'application/json',
          'Authorization': 'Bearer $key',
        },
      );

      // print(key);

      if (response.statusCode == 200 || response.statusCode == 201) {
        // 3.
        var jsonResponse = jsonDecode(response.body)['listings']['data'];
        _jobs = [];

        // 4.
        for (var j in jsonResponse) {
          Job job = Job(
            id: j['id'],
            title: j['title'],
            employmentType: j['employmentType'],
            major: j['major'],
            city: j['city'],
            companyName: j['companyName'],
            experience: j['experience'],
            date: j['date'],
            views: j['views'],
            description: j['description'],
            benefits: j['benefits'],
            requirements: j['requirements'],
            hasApplied: j['hasApplied'],
            hasViewed: j['hasViewed'],
          );

          _jobs.add(job);
          notifyListeners();
        }
        notifyListeners();
        return _jobs;
      } else {
        throw Exception('Problem loading jobs');
      }
    } catch (e) {
      print(e);
    }
  }

`

This is the function that I call when the user presses the apply button:
`

 /*
    |--------------------------------------------------------------------------
    | Apply for a job
    |--------------------------------------------------------------------------
  */
  Future<void> applyJob(String id) async {
    final key = await storage.read(key: 'auth');

    final baseUrl = AppUrl.baseUrl;

    try {
      var url = Uri.parse('$baseUrl/listings/$id/apply');

      var response = await http.put(
        url,
        headers: {
          'Accept': 'application/json',
          'Authorization': 'Bearer $key',
        },
      );

      if (response.statusCode == 200 || response.statusCode == 201) {
        print(jsonDecode(response.body));

        _hasApplied = jsonDecode(response.body)['hasApplied'];
        notifyListeners();
      } else {
        print(jsonDecode(response.body));
        notifyListeners();
      }
    } catch (e) {
      print(e);
    }
    notifyListeners();
  }

`

The job_card widget:

`

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

import 'package:final_try/screens/job_details_screen.dart';

import '../models/job.dart';
import '../providers/jobs.dart';
import '../styles/colors.dart';

class JobCardBig extends StatefulWidget {

  static const routeName = '/job-card-big';

  @override
  State<JobCardBig> createState() => _JobCardBigState();
}

class _JobCardBigState extends State<JobCardBig> {
  @override
  Widget build(BuildContext context) {
    final job = Provider.of<Job>(context, listen: true);

    return Container(
      padding: EdgeInsets.all(10),
      margin: EdgeInsets.only(bottom: 10),
      width: double.infinity,
      decoration: BoxDecoration(
        border: Border.all(color: lightgrey, width: 1),
        borderRadius: BorderRadius.circular(5.0),
        boxShadow: [
          BoxShadow(
            color: lightgrey.withOpacity(.5),
            spreadRadius: 1,
            blurRadius: 2,
            offset: Offset(0, 1), // changes position of shadow
          ),
        ],
        color: white,
      ),
      child: Column(children: [
        Container(
            child: Row(
          children: [
            Container(
              height: 50,
              width: 50,
              alignment: Alignment.center,
              decoration:
                  BoxDecoration(shape: BoxShape.circle, color: lightgrey),
            ),
            SizedBox(
              width: 10,
            ),
            Expanded(
              child: Row(
                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                children: [
                  Flexible(
                    child: Container(
                      height: 70,
                      child: Column(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        mainAxisAlignment: MainAxisAlignment.spaceAround,
                        children: [
                          Text(
                            job.title.toString(),
                            style: TextStyle(
                              fontSize: 18,
                              fontWeight: FontWeight.bold,
                            ),
                          ),
                          Text(
                            job.companyName.toString(),
                            style: TextStyle(
                              fontSize: 14,
                              color: lightgrey,
                            ),
                          ),
                        ],
                      ),
                    ),
                  ),
                  Container(
                    height: 70,
                    width: 50,
                    child: Column(
                      mainAxisAlignment: MainAxisAlignment.center,
                      crossAxisAlignment: CrossAxisAlignment.end,
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.end,
                          children: [
                            Icon(
                              Icons.remove_red_eye,
                              size: 14,
                              color: darkgrey,
                            ),
                            SizedBox(
                              width: 5,
                            ),
                            Text(
                              job.views == null
                                  ? job.views = '0'
                                  : job.views.toString(),
                              style: TextStyle(
                                fontSize: 14,
                                color: darkgrey,
                              ),
                            ),
                          ],
                        ),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        )),
        SizedBox(
          height: 5,
        ),
        Divider(
          thickness: 1,
        ),
        SizedBox(
          height: 5,
        ),
        Container(
          height: 80,
          alignment: Alignment.bottomLeft,
          child: Column(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              Row(
                children: [
                  Text(
                    'Είδος Απασχόλησης:',
                  ),
                  SizedBox(
                    width: 5,
                  ),
                  Text(
                    Provider.of<Jobs>(context, listen: false)
                        .jobTypeFormat(job.employmentType.toString()),
                    style: TextStyle(color: lightgrey),
                  ),
                ],
              ),
              Row(
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  Text('Προϋπηρεσία:'),
                  SizedBox(
                    width: 5,
                  ),
                  Flexible(
                    child: job.experience == null
                        ? Text(
                            'Δεν απαιτείται',
                            style: TextStyle(color: lightgrey),
                          )
                        : job.experience! > 1
                            ? Text(
                                '${job.experience.toString()} χρόνια',
                                style: TextStyle(color: lightgrey),
                              )
                            : Text(
                                '${job.experience.toString()} χρόνο',
                                style: TextStyle(color: lightgrey),
                              ),
                  ),
                ],
              ),
              Row(
                children: [
                  Text('Τοποθεσία:'),
                  SizedBox(
                    width: 5,
                  ),
                  Text(
                    job.city.toString(),
                    style: TextStyle(color: lightgrey),
                  ),
                ],
              ),
              Row(
                children: [
                  Text('Δημοσιεύθηκε:'),
                  SizedBox(
                    width: 5,
                  ),
                  Text(
                    Provider.of<Jobs>(context, listen: false)
                        .dateFormat(job.date),
                    // job.date.toString(),
                    style: TextStyle(color: lightgrey),
                  ),
                ],
              ),
            ],
          ),
        ),
        Container(
          margin: EdgeInsets.only(top: 20),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              GestureDetector(
                child: Container(
                  padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
                  decoration: BoxDecoration(
                    border: Border.all(color: darkgrey, width: 1),
                    borderRadius: BorderRadius.circular(5.0),
                    color: darkgrey,
                  ),
                  child: Text(
                    'Περισσότερα',
                    style: TextStyle(color: white),
                  ),
                ),
                onTap: () {
                  Navigator.of(context)
                      .pushNamed(JobDetailsScreen.routeName, arguments: job.id)
                      .then((_) {
                    // Provider.of<Jobs>(context, listen: false).fetchJobs();
                  });
                },
              ),
              Container(
                padding: EdgeInsets.symmetric(horizontal: 10, vertical: 5),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(5.0),
                  color: job.hasApplied == 1
                      ? Color.fromARGB(255, 196, 76, 68)
                      : buttonColor,
                ),
                child: Consumer<Job>(
                  builder: (context, job, child) {
                    return Text(
                      job.hasApplied == 1 ? 'Δεν ενδιαφέρομαι' : 'Αίτηση',
                      style: TextStyle(
                        color: white,
                      ),
                    );
                  },
                ),
              ),
            ],
          ),
        ),
      ]),
    );
  }
}

`

The job_list_screen:
Here I load all my job_card widgets with ListView.builder

`

import 'package:provider/provider.dart';
import 'package:flutter/material.dart';

import '../styles/colors.dart';

import '../providers/jobs.dart';

import '../widgets/header_screen.dart';
import '../widgets/job_card_big.dart';

class JobListScreen extends StatefulWidget {
  static const routeName = '/job-list-screen';
  const JobListScreen({super.key});

  @override
  State<JobListScreen> createState() => _JobListScreenState();
}

class _JobListScreenState extends State<JobListScreen> {
  final controller = ScrollController();
  bool _firstLoading = true;
  var _isLoading = false;
  int page = 1;

  final _formKey = GlobalKey<FormState>();
  String? _searchText;
  bool _isFiltered = false;

  @override
  void initState() {
    controller.addListener(() {
      if (controller.position.maxScrollExtent == controller.offset) {
        fetch();
      }
    });

    super.initState();
  }

  Future fetch() async {
    if (!_isFiltered) {
      setState(() {
        _isLoading = true;
        page++;
        Provider.of<Jobs>(context, listen: false)
            .fetchMore(page)
            .then((_) => _isLoading = false);
      });
    }
  }

  @override
  void didChangeDependencies() {
    if (_firstLoading) {
      Provider.of<Jobs>(context, listen: true).fetchJobs().then((_) {
        setState(() {
          _firstLoading = false;
        });
      });
    }
    super.didChangeDependencies();
  }

  void searchJob() {
    if(_searchText == null || _searchText == ''){
      setState(() {
      _isFiltered = false;
    });
    }
    else setState(() {
      Provider.of<Jobs>(context, listen: false).filterJobs(_searchText!);
      _isFiltered = true;
    });
  }

  @override
  Widget build(BuildContext context) {
    final jobsData = Provider.of<Jobs>(context, listen: true);
    var jobsList = jobsData.jobs;
    var filteredList = jobsData.filteredJobs;
    // var jobsListFiltered = jobsData.filteredJobs;

    return Scaffold(
      body: Stack(
        children: [
          Container(
            height: MediaQuery.of(context).size.height,
            padding: EdgeInsets.only(
              top: 20,
              right: 20,
              left: 20,
            ),
            child: Column(
              children: [
                HeaderScreen(title: 'Αγγελίες'),
                Container(
                  child: Form(
                    key: _formKey,
                    child: Row(
                      children: [
                        Expanded(
                          child: Container(
                            child: TextFormField(
                              decoration: InputDecoration(
                                hintText: 'Enter some text',
                              ),
                              onSaved: (value) {
                              _searchText = value;
                            },
                            ),
                          ),
                        ),
                        Container(
                          margin: EdgeInsets.only(top: 10, bottom: 5),
                          height: 40,
                          width: 40,
                          child: ElevatedButton(
                            style: ButtonStyle(
                              foregroundColor:
                                  MaterialStateProperty.all<Color>(white),
                              backgroundColor: MaterialStateProperty.all<Color>(
                                  primaryColor),
                            ),
                            child: Container(
                              child: Icon(Icons.search),
                            ),
                            onPressed: () {
                              _formKey.currentState?.save();

                              searchJob();
                            },
                          ),
                        ),
                      ],
                    ),
                  ),
                ),
                SizedBox(
                  height: 10,
                ),
                Divider(
                  thickness: 1,
                ),
                SizedBox(
                  height: 10,
                ),
                Expanded(
                  child: !_isFiltered
                      ? Container(
                          child: !_firstLoading
                              ? ListView.builder(
                                  controller: controller,
                                  itemCount: jobsList.length,
                                  itemBuilder: (ctx, i) =>
                                      ChangeNotifierProvider.value(
                                    value: jobsList[i],
                                    child: Column(
                                      children: [
                                        JobCardBig(),
                                      ],
                                    ),
                                  ),
                                )
                              : Center(
                                  child: CircularProgressIndicator(),
                                ),
                        )
                      : Container(
                          child: !_firstLoading
                              ? ListView.builder(
                                  controller: controller,
                                  itemCount: filteredList.length,
                                  itemBuilder: (ctx, i) =>
                                      ChangeNotifierProvider.value(
                                    value: filteredList[i],
                                    child: Column(
                                      children: [
                                        JobCardBig(),
                                      ],
                                    ),
                                  ),
                                )
                              : Center(
                                  child: CircularProgressIndicator(),
                                ),
                        ),
                ),
              ],
            ),
          ),
          Positioned(
            child: _isLoading
                ? Container(
                    width: double.infinity,
                    height: MediaQuery.of(context).size.height,
                    color: Color.fromARGB(52, 0, 0, 0),
                    child: Center(
                      child: CircularProgressIndicator(),
                    ),
                  )
                : Container(),
          ),
        ],
      ),
    );
  }
}

`

I tried to load my fetchJobs() function when the user exits the job_details_screen but even though it works, it is not the right solution. The reason why I say that this is not the right way, is because of this possible scenario:
If the user scrolls down a lot, and the app load 60 jobs, then if he presses on job 60, and he exit the job_details_screen, the app will load the first 15 jobs and the user will have to scroll down again. And that's not the user experience I want to provide.
I am searching for a solution that will update only the apply button and it will not need to recreate the whole list. Plus, with this solution the user will go back to the same scroll point he was when he entered the job_details_screen.

I hope I explained my problem properly. This is the first time I upload a question here and I would also like to mention that this is my first project on flutter so don't judge my code too harshly.

Thanks in advance!!


问:
Flutter url call
ERR_CACHE_MISS when I click on url , I changed androidmanifest.xml

Added this
Would this fix the issue as the app is still in review.  Here is my manifest.xml file

```<code> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.myfirstproject">
       <application
            android:label="Daily Calories"
            android:name="${applicationName}"
            android:icon="@mipmap/ic_launcher">
            <activity
                android:name=".MainActivity"
                android:exported="true"
                android:launchMode="singleTop"
                android:theme="@style/LaunchTheme"
                android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
                android:hardwareAccelerated="true"
                android:windowSoftInputMode="adjustResize">
                <!-- Specifies an Android theme to apply to this Activity as soon as
                     the Android process has started. This theme is visible to the user
                     while the Flutter UI initializes. After that, this theme continues
                     to determine the Window background behind the Flutter UI. -->
                <meta-data
                  android:name="io.flutter.embedding.android.NormalTheme"
                  android:resource="@style/NormalTheme"
                  />
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
            </activity>
            <!-- Don't delete the meta-data below.
                 This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
            <meta-data
                android:name="flutterEmbedding"
                android:value="2" />
        </application>
         <uses-permission android:name="android.permission.INTERNET"/>
    </manifest>
</code>```

Title: Flutter url call

Body:
ERR_CACHE_MISS when I click on url , I changed androidmanifest.xml

Added this
Would this fix the issue as the app is still in review.  Here is my manifest.xml file

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.example.myfirstproject">
       <application
            android:label="Daily Calories"
            android:name="${applicationName}"
            android:icon="@mipmap/ic_launcher">
            <activity
                android:name=".MainActivity"
                android:exported="true"
                android:launchMode="singleTop"
                android:theme="@style/LaunchTheme"
                android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
                android:hardwareAccelerated="true"
                android:windowSoftInputMode="adjustResize">

                <meta-data
                  android:name="io.flutter.embedding.android.NormalTheme"
                  android:resource="@style/NormalTheme"
                  />
                <intent-filter>
                    <action android:name="android.intent.action.MAIN"/>
                    <category android:name="android.intent.category.LAUNCHER"/>
                </intent-filter>
            </activity>

            <meta-data
                android:name="flutterEmbedding"
                android:value="2" />
        </application>
         <uses-permission android:name="android.permission.INTERNET"/>
    </manifest>


问:
what is & mean in react typescript
I read a code and it wrote the following code, and I can't underestand the & sign, what doest it work?

```<code>type PizzaData = {
    numberOfPeople: number
    slicePerPerson: number
    slicePerPie: number
}

type PizzaState = PizzaData & { pizzasNeeded: number }

</code>```

what will be  PizzaState ?

Title: what is & mean in react typescript

Body:
I read a code and it wrote the following code, and I can't underestand the & sign, what doest it work?

type PizzaData = {
    numberOfPeople: number
    slicePerPerson: number
    slicePerPie: number
}

type PizzaState = PizzaData & { pizzasNeeded: number }

what will be  PizzaState ?


问:
Docker - error after moved storage to second disk and using overlay2
I just moved Docker default storage location to second disk setting up a /etc/docker/daemon.json as described in documentation, so far so goood.

The problem is that now I keep getting a bunch of volumes being continuously (re)mounted, ad obiously it is really annoying.

So I tried to set up overlay2 in /etc/docker/daemon.json, but now Docker doesn't event start

```<code># sudo systemctl restart docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.
</code>```
```<code># systemctl status docker.service
× docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2022-12-15 11:06:36 CET; 10s ago
TriggeredBy: × docker.socket
       Docs: https://docs.docker.com
    Process: 17614 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status>
   Main PID: 17614 (code=exited, status=1/FAILURE)
        CPU: 54ms

dic 15 11:06:36 sgratani-OptiPlex-7060 systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
dic 15 11:06:36 sgratani-OptiPlex-7060 systemd[1]: Stopped Docker Application Container Engine.
dic 15 11:06:36 sgratani-OptiPlex-7060 systemd[1]: docker.service: Start request repeated too quickly.
dic 15 11:06:36 sgratani-OptiPlex-7060 systemd[1]: docker.service: Failed with result 'exit-code'.
dic 15 11:06:36 sgratani-OptiPlex-7060 systemd[1]: Failed to start Docker Application Container Engine.

</code>```

So, for now I give up using overlay2 since having all the Docker images and container on the seond disk is more important than getting rid of a bunch of volumes being mounted continuously, but can anyone tells me where the problem is and if there is a solution?

Update #1: strange permissions behaviour problem

Got a simple docker-compose.yml with a Wordpress service (official WP image) and a database service, and when I have the docker storage location on the second disk instead of default one the database (volume maybe?) seems inaccessible:

wordpress keep giving error on db connection

trying to run mysql interactive from db service result in error on login with root user

Obviously this is related to the docker storage location, but cannot find why, since new location is created by docker itself when started.

Body:
I just moved Docker default storage location to second disk setting up a /etc/docker/daemon.json as described in documentation, so far so goood.

The problem is that now I keep getting a bunch of volumes being continuously (re)mounted, ad obiously it is really annoying.

So I tried to set up overlay2 in /etc/docker/daemon.json, but now Docker doesn't event start

# sudo systemctl restart docker
Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xeu docker.service" for details.

# systemctl status docker.service
× docker.service - Docker Application Container Engine
     Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Thu 2022-12-15 11:06:36 CET; 10s ago
TriggeredBy: × docker.socket
       Docs: https://docs.docker.com
    Process: 17614 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status>
   Main PID: 17614 (code=exited, status=1/FAILURE)
        CPU: 54ms

dic 15 11:06:36 sgratani-OptiPlex-7060 systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
dic 15 11:06:36 sgratani-OptiPlex-7060 systemd[1]: Stopped Docker Application Container Engine.
dic 15 11:06:36 sgratani-OptiPlex-7060 systemd[1]: docker.service: Start request repeated too quickly.
dic 15 11:06:36 sgratani-OptiPlex-7060 systemd[1]: docker.service: Failed with result 'exit-code'.
dic 15 11:06:36 sgratani-OptiPlex-7060 systemd[1]: Failed to start Docker Application Container Engine.

So, for now I give up using overlay2 since having all the Docker images and container on the seond disk is more important than getting rid of a bunch of volumes being mounted continuously, but can anyone tells me where the problem is and if there is a solution?

Update #1: strange permissions behaviour problem

Got a simple docker-compose.yml with a Wordpress service (official WP image) and a database service, and when I have the docker storage location on the second disk instead of default one the database (volume maybe?) seems inaccessible:

wordpress keep giving error on db connection

trying to run mysql interactive from db service result in error on login with root user

Obviously this is related to the docker storage location, but cannot find why, since new location is created by docker itself when started.


问:
Facebook Graph API comments filtering not working
I need to filter out a specific comment by its id using the post thread. I have tried these processes but failed.

https://graph.facebook.com/v12.0/{post_id}?fields=message,comments&filtering=[{'field':'id','operator':'IN','value':[{comment_id}]}]&access_token

returns all comments

https://graph.facebook.com/v12.0/103436852373094_146018341448278?fields=message,comments{id,message&filtering=[{'field':'id','operator':'IN','value':[{comment_id}]}]}

returns

```<code>{
  "error": {
    "message": "Syntax error \"Expected \"}\", got end of string\" at character 27: message,comments{id,message",
    "type": "OAuthException",
    "code": 2500,
    "fbtrace_id": "ASHThq8rIMxJztBRcwWS-I2
"
  }
}
</code>```

did I missed anything?

Body:
I need to filter out a specific comment by its id using the post thread. I have tried these processes but failed.

https://graph.facebook.com/v12.0/{post_id}?fields=message,comments&filtering=[{'field':'id','operator':'IN','value':[{comment_id}]}]&access_token

returns all comments

https://graph.facebook.com/v12.0/103436852373094_146018341448278?fields=message,comments{id,message&filtering=[{'field':'id','operator':'IN','value':[{comment_id}]}]}

returns

{
  "error": {
    "message": "Syntax error \"Expected \"}\", got end of string\" at character 27: message,comments{id,message",
    "type": "OAuthException",
    "code": 2500,
    "fbtrace_id": "ASHThq8rIMxJztBRcwWS-I2
"
  }
}

did I missed anything?


问:
How to establish a GIOstream and GDBusConnection to a cellular modem device
I am trying to use libmm-glib documentation to put together a program to gather cellular modem information on Linux (Ubuntu 20.04). My question is how do I establish a GIOStream, and subsequently a GDBusConnection to the device. Namely, my device when pinged from the command line shows 2 tty devies, but both are labelled as "ignore" (dev/ttyUSB4,dev/ttyUSB1). I have also tried using /dev/cdc-wdm0 to initialize the Gfile with no success.

Steps (code below):

get a GFile associated with the modem

a. What path should I use to the device?

construct a GIOStream to the modem with the GFile

construct a DBusConnection with the GIOStream

contruct a MMManager with the DBusConnection

Use MMManager to query the specific modem.

```<code>gcc main.c -I/usr/include/libmm-glib -I/usr/include/ModemManager -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -lglib-2.0 -lz -lgio-2.0 -lpthread -lmm-glib

</code>```
```<code>#include <libmm-glib.h>
#include <gio/gio.h>
//#include <gtk/gtk.h>
#include <stdio.h>
int main (void)
{
    printf("begin 1\n");

    GCancellable                     *cancellable;
    GError                           **ppError;
    MMManager                        *pManager;
    GDBusAuthObserver                *observer;
    GDBusObjectManagerClientFlags    flags = G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE;
    const gchar                      *guid  = NULL;
    //g_type_init();
    //GFile * save = g_file_new_for_path("/org/freedesktop/ModemManager1/Modem/3");
    //GFile * save = g_file_new_for_path("/sys/devices/platform/soc@0/32c00000.bus/32e50000.usb/ci_hdrc.1/usb1/1-1/1-1.3");
    GFile * save = g_file_new_for_path("/dev/ttyUSB0");

    if(save == NULL)
    {
        printf("null GFile\n");
    }
    else
    {
        printf("GFile OK\n");

    }
    GFileIOStream *pStream = g_file_open_readwrite(save, NULL, NULL);

    if(pStream == NULL)
    {
        printf("null pStream\n");
    }
    else
    {
        printf("pStream OK\n");
    }

    GDBusConnection *pConnection= g_dbus_connection_new_sync(pStream,
                                                      guid, // for authent. as a server
                                                      flags,
                                                      NULL, // observer,
                                                      NULL, // cancellable,
                                                      ppError);

    if(pConnection == NULL)
    {
        printf("null GDBusConnection\n");
    }

    pManager = mm_manager_new_sync(pConnection,
                                   flags,
                                   cancellable,
                                   ppError);

    if(pManager == NULL)
    {
        printf("null pManager\n");
    }

    mm_manager_scan_devices_sync(pManager,
                 cancellable,
                 ppError);

    MMObject modem;

    printf("d\n");

    //const gchar* pChar = mm_object_get_path(&modem);

    //free resources here

    printf("end\n");
    return(0);
}

</code>```
```<code>  -----------------------------
  General  |              path: /org/freedesktop/ModemManager1/Modem/3
           |         device id:
  -----------------------------
  Hardware |      manufacturer: Telit
           |             model: LE910C4-NF
           | firmware revision: 25.21.660  1  [Mar 04 2021 12:00:00]
           |    carrier config: default
           |      h/w revision: 1.30
           |         supported: gsm-umts, lte
           |           current: gsm-umts, lte
           |      equipment id:
  -----------------------------
  System   |            device: /sys/devices/platform/soc@0/32c00000.bus/32e50000.usb/ci_hdrc.1/usb1/1-1/1-1.3
           |           drivers: qmi_wwan, option
           |            plugin: telit
           |      primary port: cdc-wdm0
           |             ports: cdc-wdm0 (qmi), ttyUSB0 (ignored), ttyUSB1 (gps),
           |                    ttyUSB4 (ignored), wwan0 (net)
  -----------------------------
  Status   |             state: failed
           |     failed reason: sim-missing
           |       power state: on
           |    signal quality: 0% (cached)
  -----------------------------
  Modes    |         supported: allowed: 3g; preferred: none
           |                    allowed: 4g; preferred: none
           |                    allowed: 3g, 4g; preferred: 4g
           |                    allowed: 3g, 4g; preferred: 3g
           |           current: allowed: any; preferred: none
  -----------------------------
  Bands    |         supported: utran-4, utran-5, utran-2, eutran-2, eutran-4, eutran-5,
           |                    eutran-12, eutran-13, eutran-14, eutran-66, eutran-71
  -----------------------------
  IP       |         supported: ipv4, ipv6, ipv4v6
  -----------------------------
  SIM      |    sim slot paths: slot 1: none (active)
           |                    slot 2: none
</code>```

OwnerDisplayName: sasukenebe

Body:
I am trying to use libmm-glib documentation to put together a program to gather cellular modem information on Linux (Ubuntu 20.04). My question is how do I establish a GIOStream, and subsequently a GDBusConnection to the device. Namely, my device when pinged from the command line shows 2 tty devies, but both are labelled as "ignore" (dev/ttyUSB4,dev/ttyUSB1). I have also tried using /dev/cdc-wdm0 to initialize the Gfile with no success.

Steps (code below):

get a GFile associated with the modem

a. What path should I use to the device?

construct a GIOStream to the modem with the GFile

construct a DBusConnection with the GIOStream

contruct a MMManager with the DBusConnection

Use MMManager to query the specific modem.

gcc main.c -I/usr/include/libmm-glib -I/usr/include/ModemManager -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -lglib-2.0 -lz -lgio-2.0 -lpthread -lmm-glib

#include <libmm-glib.h>
#include <gio/gio.h>
//#include <gtk/gtk.h>
#include <stdio.h>
int main (void)
{
    printf("begin 1\n");

    GCancellable                     *cancellable;
    GError                           **ppError;
    MMManager                        *pManager;
    GDBusAuthObserver                *observer;
    GDBusObjectManagerClientFlags    flags = G_DBUS_OBJECT_MANAGER_CLIENT_FLAGS_NONE;
    const gchar                      *guid  = NULL;
    //g_type_init();
    //GFile * save = g_file_new_for_path("/org/freedesktop/ModemManager1/Modem/3");
    //GFile * save = g_file_new_for_path("/sys/devices/platform/soc@0/32c00000.bus/32e50000.usb/ci_hdrc.1/usb1/1-1/1-1.3");
    GFile * save = g_file_new_for_path("/dev/ttyUSB0");

    if(save == NULL)
    {
        printf("null GFile\n");
    }
    else
    {
        printf("GFile OK\n");

    }
    GFileIOStream *pStream = g_file_open_readwrite(save, NULL, NULL);

    if(pStream == NULL)
    {
        printf("null pStream\n");
    }
    else
    {
        printf("pStream OK\n");
    }

    GDBusConnection *pConnection= g_dbus_connection_new_sync(pStream,
                                                      guid, // for authent. as a server
                                                      flags,
                                                      NULL, // observer,
                                                      NULL, // cancellable,
                                                      ppError);

    if(pConnection == NULL)
    {
        printf("null GDBusConnection\n");
    }

    pManager = mm_manager_new_sync(pConnection,
                                   flags,
                                   cancellable,
                                   ppError);

    if(pManager == NULL)
    {
        printf("null pManager\n");
    }

    mm_manager_scan_devices_sync(pManager,
                 cancellable,
                 ppError);

    MMObject modem;

    printf("d\n");

    //const gchar* pChar = mm_object_get_path(&modem);

    //free resources here

    printf("end\n");
    return(0);
}

  -----------------------------
  General  |              path: /org/freedesktop/ModemManager1/Modem/3
           |         device id:
  -----------------------------
  Hardware |      manufacturer: Telit
           |             model: LE910C4-NF
           | firmware revision: 25.21.660  1  [Mar 04 2021 12:00:00]
           |    carrier config: default
           |      h/w revision: 1.30
           |         supported: gsm-umts, lte
           |           current: gsm-umts, lte
           |      equipment id:
  -----------------------------
  System   |            device: /sys/devices/platform/soc@0/32c00000.bus/32e50000.usb/ci_hdrc.1/usb1/1-1/1-1.3
           |           drivers: qmi_wwan, option
           |            plugin: telit
           |      primary port: cdc-wdm0
           |             ports: cdc-wdm0 (qmi), ttyUSB0 (ignored), ttyUSB1 (gps),
           |                    ttyUSB4 (ignored), wwan0 (net)
  -----------------------------
  Status   |             state: failed
           |     failed reason: sim-missing
           |       power state: on
           |    signal quality: 0% (cached)
  -----------------------------
  Modes    |         supported: allowed: 3g; preferred: none
           |                    allowed: 4g; preferred: none
           |                    allowed: 3g, 4g; preferred: 4g
           |                    allowed: 3g, 4g; preferred: 3g
           |           current: allowed: any; preferred: none
  -----------------------------
  Bands    |         supported: utran-4, utran-5, utran-2, eutran-2, eutran-4, eutran-5,
           |                    eutran-12, eutran-13, eutran-14, eutran-66, eutran-71
  -----------------------------
  IP       |         supported: ipv4, ipv6, ipv4v6
  -----------------------------
  SIM      |    sim slot paths: slot 1: none (active)
           |                    slot 2: none